From d303b5b853d52e61e0163c29307cb0c94e193504 Mon Sep 17 00:00:00 2001 From: "raveit65 (via Travis CI)" Date: Wed, 27 Nov 2024 05:12:52 +0000 Subject: Deploy mate-desktop/mate-applets to github.com/mate-desktop/mate-applets.git:gh-pages --- .../0.html | 701 + .../1.html | 3711 ++++++ .../10.html | 911 ++ .../100.html | 1577 +++ .../101.html | 417 + .../102.html | 351 + .../103.html | 343 + .../104.html | 349 + .../105.html | 305 + .../106.html | 365 + .../107.html | 1381 ++ .../108.html | 997 ++ .../109.html | 2797 ++++ .../11.html | 891 ++ .../110.html | 939 ++ .../111.html | 343 + .../112.html | 281 + .../113.html | 1097 ++ .../114.html | 263 + .../115.html | 1311 ++ .../116.html | 677 + .../117.html | 267 + .../118.html | 1429 ++ .../119.html | 1179 ++ .../12.html | 2699 ++++ .../120.html | 365 + .../121.html | 1609 +++ .../122.html | 1997 +++ .../123.html | 457 + .../124.html | 13329 +++++++++++++++++++ .../125.html | 743 ++ .../126.html | 299 + .../127.html | 307 + .../128.html | 1131 ++ .../129.html | 3777 ++++++ .../13.html | 1317 ++ .../130.html | 1485 +++ .../131.html | 2537 ++++ .../132.html | 443 + .../133.html | 413 + .../134.html | 297 + .../135.html | 461 + .../136.html | 1569 +++ .../137.html | 447 + .../138.html | 1583 +++ .../139.html | 779 ++ .../14.html | 699 + .../140.html | 503 + .../141.html | 831 ++ .../142.html | 1181 ++ .../143.html | 991 ++ .../144.html | 295 + .../145.html | 821 ++ .../146.html | 1561 +++ .../15.html | 2025 +++ .../16.html | 369 + .../17.html | 1415 ++ .../18.html | 829 ++ .../19.html | 1271 ++ .../2.html | 469 + .../20.html | 323 + .../21.html | 1071 ++ .../22.html | 1989 +++ .../3.html | 707 + .../35.html | 1027 ++ .../36.html | 1249 ++ .../37.html | 335 + .../39.html | 881 ++ .../4.html | 1183 ++ .../40.html | 887 ++ .../43.html | 327 + .../46.html | 1209 ++ .../47.html | 379 + .../48.html | 577 + .../5.html | 1241 ++ .../53.html | 2213 +++ .../54.html | 379 + .../55.html | 1279 ++ .../56.html | 383 + .../57.html | 697 + .../58.html | 699 + .../59.html | 853 ++ .../6.html | 401 + .../60.html | 1205 ++ .../61.html | 401 + .../62.html | 963 ++ .../63.html | 863 ++ .../64.html | 1309 ++ .../65.html | 1769 +++ .../66.html | 397 + .../67.html | 6753 ++++++++++ .../68.html | 2025 +++ .../69.html | 309 + .../7.html | 937 ++ .../70.html | 437 + .../71.html | 489 + .../72.html | 383 + .../73.html | 6079 +++++++++ .../74.html | 433 + .../75.html | 725 + .../76.html | 533 + .../77.html | 335 + .../78.html | 8907 +++++++++++++ .../79.html | 2941 ++++ .../8.html | 315 + .../80.html | 439 + .../81.html | 1159 ++ .../82.html | 339 + .../83.html | 3107 +++++ .../84.html | 1341 ++ .../85.html | 321 + .../86.html | 2915 ++++ .../87.html | 343 + .../88.html | 4187 ++++++ .../89.html | 637 + .../9.html | 563 + .../90.html | 537 + .../91.html | 405 + .../92.html | 1333 ++ .../93.html | 741 ++ .../94.html | 4569 +++++++ .../95.html | 365 + .../96.html | 553 + .../97.html | 413 + .../98.html | 353 + .../99.html | 327 + .../index.html | 1323 ++ .../stats.html | 207 + .../style.css | 177 + 129 files changed, 159637 insertions(+) create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/0.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/1.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/10.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/100.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/101.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/102.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/103.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/104.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/105.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/106.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/107.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/108.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/109.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/11.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/110.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/111.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/112.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/113.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/114.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/115.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/116.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/117.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/118.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/119.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/12.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/120.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/121.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/122.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/123.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/124.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/125.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/126.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/127.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/128.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/129.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/13.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/130.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/131.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/132.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/133.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/134.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/135.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/136.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/137.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/138.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/139.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/14.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/140.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/141.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/142.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/143.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/144.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/145.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/146.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/15.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/16.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/17.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/18.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/19.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/2.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/20.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/21.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/22.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/3.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/35.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/36.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/37.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/39.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/4.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/40.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/43.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/46.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/47.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/48.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/5.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/53.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/54.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/55.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/56.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/57.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/58.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/59.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/6.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/60.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/61.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/62.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/63.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/64.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/65.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/66.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/67.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/68.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/69.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/7.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/70.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/71.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/72.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/73.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/74.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/75.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/76.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/77.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/78.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/79.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/8.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/80.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/81.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/82.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/83.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/84.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/85.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/86.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/87.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/88.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/89.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/9.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/90.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/91.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/92.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/93.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/94.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/95.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/96.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/97.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/98.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/99.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/index.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/stats.html create mode 100644 2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/style.css (limited to '2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master') diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/0.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/0.html new file mode 100644 index 00000000..a9f8c7f4 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/0.html @@ -0,0 +1,701 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.accessx"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[393]; const double alignment; void * const ptr;}  accessx_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0310, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0006, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0004, 0000, 0000, 0000, 0347, 0227, 0356, 0040, 0004, 0000, 0000, 0000, 
+  0310, 0000, 0000, 0000, 0017, 0000, 0114, 0000, 0330, 0000, 0000, 0000, 0334, 0000, 0000, 0000, 
+  0113, 0120, 0220, 0013, 0002, 0000, 0000, 0000, 0334, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 
+  0340, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 
+  0344, 0000, 0000, 0000, 0001, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 0354, 0000, 0000, 0000, 
+  0026, 0053, 0276, 0273, 0000, 0000, 0000, 0000, 0354, 0000, 0000, 0000, 0036, 0000, 0166, 0000, 
+  0020, 0001, 0000, 0000, 0150, 0001, 0000, 0000, 0275, 0342, 0315, 0116, 0005, 0000, 0000, 0000, 
+  0150, 0001, 0000, 0000, 0015, 0000, 0114, 0000, 0170, 0001, 0000, 0000, 0174, 0001, 0000, 0000, 
+  0201, 0321, 0040, 0031, 0001, 0000, 0000, 0000, 0174, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 
+  0204, 0001, 0000, 0000, 0210, 0001, 0000, 0000, 0141, 0143, 0143, 0145, 0163, 0163, 0170, 0055, 
+  0163, 0164, 0141, 0164, 0165, 0163, 0057, 0000, 0003, 0000, 0000, 0000, 0157, 0162, 0147, 0057, 
+  0005, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0141, 0143, 0143, 0145, 
+  0163, 0163, 0170, 0055, 0163, 0164, 0141, 0164, 0165, 0163, 0055, 0141, 0160, 0160, 0154, 0145, 
+  0164, 0055, 0155, 0145, 0156, 0165, 0056, 0170, 0155, 0154, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0200, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0263, 0311, 0115, 0315, 0053, 0315, 
+  0054, 0111, 0315, 0125, 0310, 0113, 0314, 0115, 0265, 0125, 0362, 0004, 0061, 0015, 0225, 0024, 
+  0022, 0223, 0113, 0062, 0363, 0363, 0154, 0225, 0134, 0062, 0023, 0163, 0362, 0323, 0225, 0024, 
+  0364, 0355, 0270, 0154, 0260, 0051, 0065, 0102, 0050, 0365, 0110, 0315, 0051, 0300, 0255, 0320, 
+  0030, 0241, 0320, 0061, 0051, 0277, 0264, 0004, 0254, 0222, 0213, 0013, 0000, 0221, 0255, 0050, 
+  0124, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 0055, 0141, 0160, 0160, 
+  0154, 0145, 0164, 0163, 0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0155, 0141, 0164, 0145, 
+  0057, 0000, 0000, 0000, 0004, 0000, 0000, 0000
+} };
+
+static GStaticResource static_resource = { accessx_resource_data.data, sizeof (accessx_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *accessx_get_resource (void);
+GResource *accessx_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * 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.1 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/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CONSTRUCTOR_H__
+#define __G_CONSTRUCTOR_H__
+
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+/*
+ * Only try to include gslist.h if not already included via glib.h,
+ * so that items using gconstructor.h outside of GLib (such as
+ * GResources) continue to build properly.
+ */
+#ifndef __G_LIB_H__
+#include "gslist.h"
+#endif
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+#endif /* __G_CONSTRUCTOR_H__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(accessxresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(accessxresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(accessxresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(accessxresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void accessxresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void accessxresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/1.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/1.html new file mode 100644 index 00000000..a5dcbacf --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/1.html @@ -0,0 +1,3711 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+1545
+1546
+1547
+1548
+1549
+1550
+1551
+1552
+1553
+1554
+1555
+1556
+1557
+1558
+1559
+1560
+1561
+1562
+1563
+1564
+1565
+1566
+1567
+1568
+1569
+1570
+1571
+1572
+1573
+1574
+1575
+1576
+1577
+1578
+1579
+1580
+1581
+1582
+1583
+1584
+1585
+1586
+1587
+1588
+1589
+1590
+1591
+1592
+1593
+1594
+1595
+1596
+1597
+1598
+1599
+1600
+1601
+1602
+1603
+1604
+1605
+1606
+1607
+1608
+1609
+1610
+1611
+1612
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+1631
+1632
+1633
+1634
+1635
+1636
+1637
+1638
+1639
+1640
+1641
+1642
+1643
+1644
+1645
+1646
+1647
+1648
+1649
+1650
+1651
+1652
+1653
+1654
+1655
+1656
+1657
+1658
+1659
+1660
+1661
+1662
+1663
+1664
+1665
+1666
+1667
+1668
+1669
+1670
+1671
+1672
+1673
+1674
+1675
+1676
+1677
+1678
+1679
+1680
+1681
+1682
+1683
+1684
+1685
+1686
+1687
+1688
+1689
+1690
+1691
+1692
+1693
+1694
+1695
+1696
+1697
+1698
+1699
+1700
+1701
+1702
+1703
+1704
+1705
+1706
+1707
/* Keyboard Accessibility Status Applet
+ * Copyright 2003, 2004 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gdesktopappinfo.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkkeysyms.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <X11/XKBlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define XK_MISCELLANY
+#define XK_XKB_KEYS
+
+#include <X11/keysymdef.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "applet.h"
+
+static int xkb_base_event_type = 0;
+
+#define ALT_GRAPH_LED_MASK (0x10)
+#define ICON_PADDING 4
+
+typedef enum {
+    modifier_Shift = 0,
+    modifier_Control,
+    modifier_Mod1,
+    modifier_Mod2,
+    modifier_Mod3,
+    modifier_Mod4,
+    modifier_Mod5,
+    modifier_n
+} E_modifiers;
+
+typedef struct {
+    unsigned int mask;
+    GtkWidget* indicator;
+    gchar *icon_name;<--- struct member 'ModifierStruct::icon_name' is never used.
+} ModifierStruct;
+
+static ModifierStruct modifiers[modifier_n] = {
+    [modifier_Shift] = {ShiftMask, NULL, SHIFT_KEY_ICON},
+    [modifier_Control] = {ControlMask, NULL, CONTROL_KEY_ICON},
+    [modifier_Mod1] = {Mod1Mask, NULL, ALT_KEY_ICON},
+    [modifier_Mod2] = {Mod2Mask, NULL, META_KEY_ICON},
+    [modifier_Mod3] = {Mod3Mask, NULL, HYPER_KEY_ICON},
+    [modifier_Mod4] = {Mod4Mask, NULL, SUPER_KEY_ICON},
+    [modifier_Mod5] = {Mod5Mask, NULL, ALTGRAPH_KEY_ICON}
+};
+
+typedef struct {
+    unsigned int mask;
+    gchar* icon_name;
+} ButtonIconStruct;
+
+static ButtonIconStruct button_icons[] = {
+    {Button1Mask, MOUSEKEYS_BUTTON_LEFT},
+    {Button2Mask, MOUSEKEYS_BUTTON_MIDDLE},
+    {Button3Mask, MOUSEKEYS_BUTTON_RIGHT}
+};
+
+static void
+popup_error_dialog (AccessxStatusApplet* sapplet);
+
+/* cribbed from geyes */
+static void
+about_cb (GtkAction*           action,
+          AccessxStatusApplet* sapplet)
+{
+    static const gchar* authors[] = {
+        "Calum Benson <calum.benson@sun.com>",
+        "Bill Haneman <bill.haneman@sun.com>",
+        NULL
+    };
+
+    const gchar* documenters[] = {
+        "Bill Haneman <bill.haneman@sun.com>",
+        N_("Sun GNOME Documentation Team <gdocteam@sun.com>"),
+        N_("MATE Documentation Team"),
+        NULL
+    };
+
+#ifdef ENABLE_NLS
+    const char **p;
+    for (p = documenters; *p; ++p)
+        *p = _(*p);
+#endif
+
+    gtk_show_about_dialog (NULL,
+        "title", _("About AccessX Status"),
+        "version", VERSION,
+        "comments", _("Shows the state of AccessX features such as latched modifiers"),
+        "copyright", _("Copyright \xc2\xa9 2003 Sun Microsystems\n"
+                       "Copyright \xc2\xa9 2012-2021 MATE developers"),
+        "authors", authors,
+        "documenters", documenters,
+        "translator-credits", _("translator-credits"),
+        "logo-icon-name", ACCESSX_APPLET,
+        NULL);
+}
+
+static void
+help_cb (GtkAction*           action,
+         AccessxStatusApplet* sapplet)
+{
+    GError* error = NULL;
+    GdkScreen* screen = gtk_widget_get_screen (GTK_WIDGET (sapplet->applet));
+
+    gtk_show_uri_on_window (NULL,
+                            "help:mate-accessx-status",
+                            gtk_get_current_event_time (),
+                            &error);
+
+    if (error)
+    {
+        GtkWidget* parent = gtk_widget_get_parent (GTK_WIDGET (sapplet->applet));
+
+        GtkWidget* dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
+                                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                    GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+                                                    _("There was an error launching the help viewer: %s"),
+                                                    error->message);
+
+        g_signal_connect (dialog, "response",
+                          G_CALLBACK (gtk_widget_destroy),
+                          NULL);
+
+        gtk_window_set_screen (GTK_WINDOW (dialog), screen);
+        gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+
+        gtk_widget_show (dialog);
+        g_error_free (error);
+    }
+}
+
+static void
+dialog_cb (GtkAction*           action,
+           AccessxStatusApplet* sapplet)
+{
+    GError* error = NULL;
+    GdkScreen *screen;
+    GdkAppLaunchContext *launch_context;
+    GAppInfo *appinfo;
+
+    if (sapplet->error_type != ACCESSX_STATUS_ERROR_NONE)
+    {
+        popup_error_dialog (sapplet);
+        return;
+    }
+
+    screen = gtk_widget_get_screen (GTK_WIDGET (sapplet->applet));
+    appinfo = g_app_info_create_from_commandline ("mate-keyboard-properties --a11y",
+                                                  _("Open the keyboard preferences dialog"),
+                                                  G_APP_INFO_CREATE_NONE,
+                                                  &error);
+
+    if (!error) {
+        launch_context =
+            gdk_display_get_app_launch_context (gtk_widget_get_display (GTK_WIDGET (sapplet->applet)));
+
+        gdk_app_launch_context_set_screen (launch_context, screen);
+        g_app_info_launch (appinfo,
+                           NULL,
+                           G_APP_LAUNCH_CONTEXT (launch_context),
+                           &error);
+
+        g_object_unref (launch_context);
+    }
+
+    if (error != NULL)
+    {
+        GtkWidget* dialog = gtk_message_dialog_new (NULL,
+                                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                    GTK_MESSAGE_ERROR,
+                                                    GTK_BUTTONS_CLOSE,
+                                                    _("There was an error launching the keyboard preferences dialog: %s"),
+                                                    error->message);
+
+        g_signal_connect (dialog, "response",
+                          G_CALLBACK (gtk_widget_destroy),
+                          NULL);
+
+        gtk_window_set_screen (GTK_WINDOW (dialog), screen);
+        gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+
+        gtk_widget_show (dialog);
+        g_error_free (error);
+    }
+
+    g_object_unref (appinfo);
+}
+
+static const GtkActionEntry accessx_status_applet_menu_actions[] = {
+    {"Dialog", "document-properties",
+        N_("_Keyboard Accessibility Preferences"),
+        NULL, NULL, G_CALLBACK (dialog_cb)},
+    {"Help", "help-browser", N_("_Help"),
+        NULL, NULL, G_CALLBACK (help_cb)},
+    {"About", "help-about", N_("_About"),
+        NULL, NULL, G_CALLBACK (about_cb)}
+};
+
+static XkbDescPtr
+accessx_status_applet_get_xkb_desc (AccessxStatusApplet* sapplet)
+{
+    Display* display;
+
+    if (sapplet->xkb == NULL)
+    {
+        int ir, reason_return;
+        char* display_name = getenv ("DISPLAY");
+        display = XkbOpenDisplay (display_name,
+                                  &xkb_base_event_type,
+                                  &ir,
+                                  NULL, NULL,
+                                  &reason_return);
+        g_assert (display);
+
+        /* TODO: change error message below to something user-viewable */
+        if (display == NULL)
+        {
+            g_warning ("Xkb extension could not be initialized! (error code %x)",
+                       reason_return);
+        }
+        else
+        {
+            sapplet->xkb = XkbGetMap (display,
+                                      XkbAllComponentsMask,
+                                      XkbUseCoreKbd);
+        }
+
+        g_assert (sapplet->xkb);
+
+        if (sapplet->xkb == NULL)
+        {
+            g_warning ("Xkb keyboard description not available!");
+        }
+
+        sapplet->xkb_display = display;
+    }
+    return sapplet->xkb;
+}
+
+static gboolean
+accessx_status_applet_xkb_select (AccessxStatusApplet* sapplet)
+{
+    int opcode_rtn, error_rtn;
+    gboolean retval = FALSE;
+    GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (sapplet->applet));<--- Null pointer dereference
+
+    g_assert (sapplet && sapplet->applet && window);<--- Assuming that condition 'sapplet' is not redundant
+
+    Display* display = GDK_WINDOW_XDISPLAY (window);
+
+    g_assert (display);
+
+    retval = XkbQueryExtension (display,
+                                &opcode_rtn,
+                                &xkb_base_event_type,
+                                &error_rtn,
+                                NULL, NULL);
+
+    if (retval)
+    {
+        retval = XkbSelectEvents (display,
+                                  XkbUseCoreKbd,
+                                  XkbAllEventsMask,
+                                  XkbAllEventsMask);
+        sapplet->xkb = accessx_status_applet_get_xkb_desc (sapplet);
+    }
+    else
+    {
+        sapplet->error_type = ACCESSX_STATUS_ERROR_XKB_DISABLED;
+    }
+
+    return retval;
+}
+
+static void
+accessx_status_applet_init_modifiers (AccessxStatusApplet* sapplet)
+{
+    unsigned int hyper_mask, super_mask, alt_gr_mask;
+
+    unsigned int alt_mask = XkbKeysymToModifiers (sapplet->xkb_display, XK_Alt_L);
+    unsigned int meta_mask = XkbKeysymToModifiers (sapplet->xkb_display, XK_Meta_L);
+
+    g_assert (sapplet->meta_indicator);
+
+    if (meta_mask && (meta_mask != alt_mask))
+    {
+        gtk_widget_show (sapplet->meta_indicator);
+    }
+    else
+    {
+        gtk_widget_hide (sapplet->meta_indicator);
+    }
+
+    hyper_mask = XkbKeysymToModifiers (sapplet->xkb_display, XK_Hyper_L);
+
+    if (hyper_mask)
+    {
+        gtk_widget_show (sapplet->hyper_indicator);
+    }
+    else
+    {
+        gtk_widget_hide (sapplet->hyper_indicator);
+    }
+
+    super_mask = XkbKeysymToModifiers (sapplet->xkb_display, XK_Super_L);
+
+    if (super_mask)
+    {
+        gtk_widget_show (sapplet->super_indicator);
+    }
+    else
+    {
+        gtk_widget_hide (sapplet->super_indicator);
+    }
+
+    alt_gr_mask = XkbKeysymToModifiers (sapplet->xkb_display, XK_Mode_switch) |
+        XkbKeysymToModifiers (sapplet->xkb_display, XK_ISO_Level3_Shift) |
+        XkbKeysymToModifiers (sapplet->xkb_display, XK_ISO_Level3_Latch) |
+        XkbKeysymToModifiers (sapplet->xkb_display, XK_ISO_Level3_Lock);
+
+    if (alt_gr_mask)
+    {
+        gtk_widget_show (sapplet->alt_graph_indicator);
+    }
+    else
+    {
+        gtk_widget_hide (sapplet->alt_graph_indicator);
+    }
+
+    modifiers[modifier_Shift].indicator = sapplet->shift_indicator;
+    modifiers[modifier_Control].indicator = sapplet->ctrl_indicator;
+    modifiers[modifier_Mod1].indicator = sapplet->alt_indicator;
+    modifiers[modifier_Mod2].indicator = sapplet->meta_indicator;
+    modifiers[modifier_Mod3].indicator = sapplet->hyper_indicator;
+    modifiers[modifier_Mod4].indicator = sapplet->super_indicator;
+    modifiers[modifier_Mod5].indicator = sapplet->alt_graph_indicator;
+}
+
+static gboolean
+timer_reset_slowkeys_image (AccessxStatusApplet* sapplet)
+{
+    GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
+    gint icon_size = mate_panel_applet_get_size (sapplet->applet) - ICON_PADDING;
+    gint icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (sapplet->applet));
+    cairo_surface_t* surface = gtk_icon_theme_load_surface (icon_theme,
+                                                            SLOWKEYS_IDLE_ICON,
+                                                            icon_size,
+                                                            icon_scale,
+                                                            NULL, 0, NULL);
+
+    gtk_image_set_from_surface (GTK_IMAGE (sapplet->slowfoo), surface);
+    cairo_surface_destroy (surface);
+
+    return G_SOURCE_REMOVE;
+}
+
+static gboolean
+timer_reset_bouncekeys_image (AccessxStatusApplet* sapplet)
+{
+    GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
+    gint icon_size = mate_panel_applet_get_size (sapplet->applet) - ICON_PADDING;
+    gint icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (sapplet->applet));
+    cairo_surface_t* surface = gtk_icon_theme_load_surface (icon_theme,
+                                                            BOUNCEKEYS_ICON,
+                                                            icon_size,
+                                                            icon_scale,
+                                                            NULL, 0, NULL);
+
+    gtk_image_set_from_surface (GTK_IMAGE (sapplet->bouncefoo), surface);
+    cairo_surface_destroy (surface);
+
+    return G_SOURCE_REMOVE;
+}
+
+static GdkPixbuf*
+accessx_status_applet_get_glyph_pixbuf (GtkWidget* widget,
+                                        GdkPixbuf* base,
+                                        GdkRGBA*   fg,
+                                        gchar*     glyphstring)
+{
+    GdkPixbuf* glyph_pixbuf;
+    cairo_surface_t *surface;
+    PangoLayout* layout;
+    PangoRectangle ink, logic;
+    PangoContext* pango_context;
+    PangoFontDescription* font_description;
+    static gint font_size = 0;
+    gint w = gdk_pixbuf_get_width (base);
+    gint h = gdk_pixbuf_get_height (base);
+    gint icon_scale = 2;
+    cairo_t *cr;
+
+    surface = gdk_window_create_similar_surface (gdk_get_default_root_window (),
+                                                 CAIRO_CONTENT_COLOR_ALPHA, w, h);
+
+    pango_context = gtk_widget_get_pango_context (widget);
+
+    font_description = pango_context_get_font_description (pango_context);
+    if (font_size == 0)
+        font_size = pango_font_description_get_size (font_description);
+    pango_font_description_set_size (font_description, font_size * icon_scale);
+
+    layout = pango_layout_new (pango_context);
+    pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
+    pango_layout_set_text (layout, glyphstring, -1);
+
+    cr = cairo_create (surface);
+    cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+    gdk_cairo_set_source_rgba (cr, fg);
+
+    pango_layout_get_pixel_extents (layout, &ink, &logic);
+
+    cairo_move_to (cr, (w - ink.x - ink.width)/2, (h - ink.y - ink.height)/2);
+    pango_cairo_show_layout (cr, layout);
+    cairo_destroy (cr);
+
+    g_object_unref (layout);
+    glyph_pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, w, h);
+    cairo_surface_destroy (surface);
+    return glyph_pixbuf;
+}
+
+static cairo_surface_t*
+accessx_status_applet_altgraph_image (AccessxStatusApplet *sapplet,
+                                      GtkStateFlags       state)
+{
+    GtkIconTheme *icon_theme;
+    GdkPixbuf* pixbuf;
+    GdkPixbuf* glyph_pixbuf;
+    GdkPixbuf* icon_base;
+    cairo_surface_t *surface;
+    GdkRGBA fg;
+    gchar* icon_name;
+    int alpha;
+    int icon_size, icon_scale;
+
+    icon_theme = gtk_icon_theme_get_default ();
+    icon_size = mate_panel_applet_get_size (sapplet->applet) - ICON_PADDING;
+    icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (sapplet->applet));
+
+    switch (state)
+    {
+        case GTK_STATE_FLAG_NORMAL:
+            icon_name = ACCESSX_BASE_ICON_BASE;
+            alpha = 255;
+            gdk_rgba_parse (&fg, "black");
+            break;
+        case GTK_STATE_FLAG_SELECTED:
+            icon_name = ACCESSX_BASE_ICON_INVERSE;
+            alpha = 255;
+            gdk_rgba_parse (&fg, "white");
+            break;
+        case GTK_STATE_FLAG_INSENSITIVE:
+        default:
+            icon_name = ACCESSX_BASE_ICON;
+            alpha = 63;
+            gdk_rgba_parse (&fg, "black");
+            break;
+    }
+
+    icon_base = gtk_icon_theme_load_icon_for_scale (icon_theme,
+                                                    icon_name,
+                                                    icon_size,
+                                                    icon_scale,
+                                                    0, NULL);
+    pixbuf = gdk_pixbuf_copy (icon_base);
+    g_object_unref (icon_base);
+    /*
+     * should be N_("ae"));
+     * need en_ locale for this.
+     */
+    /*
+     * Translators: substitute an easily-recognized single glyph
+     * from Level 2, i.e. an AltGraph character from a common keyboard
+     * in your locale.
+     */
+    glyph_pixbuf = accessx_status_applet_get_glyph_pixbuf (GTK_WIDGET (sapplet->applet),
+                                                           pixbuf, &fg, ("æ"));
+    gdk_pixbuf_composite (glyph_pixbuf,
+                          pixbuf, 0, 0,
+                          gdk_pixbuf_get_width (glyph_pixbuf),
+                          gdk_pixbuf_get_height (glyph_pixbuf),
+                          0., 0., 1.0, 1.0,
+                          GDK_INTERP_NEAREST, alpha);
+    g_object_unref (glyph_pixbuf);
+
+    surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, icon_scale, NULL);
+    g_object_unref (pixbuf);
+
+    return surface;
+}
+
+static cairo_surface_t*
+accessx_status_applet_slowkeys_image (AccessxStatusApplet*   sapplet,
+                                      XkbAccessXNotifyEvent* event)
+{
+    GdkPixbuf* ret_pixbuf;
+    cairo_surface_t *surface;
+    GdkWindow* window;
+    gboolean is_idle = TRUE;
+    gchar* icon_name = SLOWKEYS_IDLE_ICON;
+    GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
+    gint icon_size = mate_panel_applet_get_size (sapplet->applet) - ICON_PADDING;
+    gint icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (sapplet->applet));
+
+    if (event != NULL)
+    {
+        is_idle = FALSE;
+
+        switch (event->detail)
+        {
+            case XkbAXN_SKPress:
+                icon_name = ACCESSX_BASE_ICON;
+                break;
+            case XkbAXN_SKAccept:
+                icon_name = ACCESSX_ACCEPT_BASE;
+                break;
+            case XkbAXN_SKReject:
+                icon_name = ACCESSX_REJECT_BASE;
+                g_timeout_add_full (G_PRIORITY_HIGH_IDLE,
+                                   MAX (event->sk_delay, 150),
+                                   (GSourceFunc)timer_reset_slowkeys_image,
+                                   sapplet, NULL);
+                break;
+            case XkbAXN_SKRelease:
+            default:
+                icon_name = SLOWKEYS_IDLE_ICON;
+                is_idle = TRUE;
+                break;
+        }
+    }
+
+    ret_pixbuf = gtk_icon_theme_load_icon_for_scale (icon_theme,
+                                                     icon_name,
+                                                     icon_size,
+                                                     icon_scale,
+                                                     0, NULL);
+
+    if (!is_idle)
+    {
+        GdkPixbuf* glyph_pixbuf;
+        GdkPixbuf* tmp_pixbuf;
+        GdkRGBA fg;
+        gchar* glyphstring = N_("a");
+        gint alpha;
+        tmp_pixbuf = ret_pixbuf;
+        ret_pixbuf = gdk_pixbuf_copy (tmp_pixbuf);
+        g_object_unref (tmp_pixbuf);
+
+        window = gtk_widget_get_window (GTK_WIDGET (sapplet->applet));
+
+        if (event && window)
+        {
+            KeySym keysym = XkbKeycodeToKeysym (GDK_WINDOW_XDISPLAY (window),
+                                                event->keycode, 0, 0);
+            glyphstring = XKeysymToString (keysym);
+
+            if ((!g_utf8_validate (glyphstring, -1, NULL)) ||
+                (g_utf8_strlen (glyphstring, -1) > 1))
+            {
+                glyphstring = "";
+            }
+        }
+
+        switch (gtk_widget_get_state_flags (GTK_WIDGET (sapplet->applet)))
+        {
+            case GTK_STATE_FLAG_NORMAL:
+                alpha = 255;
+                gdk_rgba_parse (&fg, "black");
+                break;
+            case GTK_STATE_FLAG_SELECTED:
+                alpha = 255;
+                gdk_rgba_parse (&fg, "white");
+                break;
+            case GTK_STATE_FLAG_INSENSITIVE:
+            default:
+                alpha = 63;
+                gdk_rgba_parse (&fg, "black");
+                break;
+        }
+
+        glyph_pixbuf = accessx_status_applet_get_glyph_pixbuf (GTK_WIDGET (sapplet->applet),
+                                                               ret_pixbuf,
+                                                               &fg,
+                                                               glyphstring);
+
+        gdk_pixbuf_composite (glyph_pixbuf,
+                              ret_pixbuf,
+                              0, 0,
+                              gdk_pixbuf_get_width (glyph_pixbuf),
+                              gdk_pixbuf_get_height (glyph_pixbuf),
+                              0., 0., 1.0, 1.0,
+                              GDK_INTERP_NEAREST, alpha);
+
+        g_object_unref (glyph_pixbuf);
+    }
+
+    surface = gdk_cairo_surface_create_from_pixbuf (ret_pixbuf, icon_scale, NULL);
+    g_object_unref (ret_pixbuf);
+
+    return surface;
+}
+
+static cairo_surface_t*
+accessx_status_applet_bouncekeys_image (AccessxStatusApplet*   sapplet,
+                                        XkbAccessXNotifyEvent* event)
+{
+    GdkRGBA fg;
+    GdkPixbuf* icon_base = NULL;
+    GdkPixbuf* tmp_pixbuf;
+    cairo_surface_t *surface;
+    /* Note to translators: the first letter of the alphabet, not the indefinite article */
+    gchar* glyphstring = N_("a");
+    gchar* icon_name = ACCESSX_BASE_ICON;
+    gint alpha;
+    GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
+    gint icon_size = mate_panel_applet_get_size (sapplet->applet) - ICON_PADDING;
+    gint icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (sapplet->applet));
+
+    g_assert (sapplet->applet);
+
+    switch (gtk_widget_get_state_flags (GTK_WIDGET (sapplet->applet)))
+    {
+        case GTK_STATE_FLAG_NORMAL:
+            alpha = 255;
+            gdk_rgba_parse (&fg, "black");
+            break;
+        case GTK_STATE_FLAG_SELECTED:
+            alpha = 255;
+            gdk_rgba_parse (&fg, "white");
+            break;
+        case GTK_STATE_FLAG_INSENSITIVE:
+        default:
+            alpha = 63;
+            gdk_rgba_parse (&fg, "black");
+            break;
+    }
+
+    if (event != NULL)
+    {
+        switch (event->detail)
+        {
+            case XkbAXN_BKAccept:
+                icon_name = SLOWKEYS_ACCEPT_ICON;
+                break;
+            case XkbAXN_BKReject:
+                icon_name = SLOWKEYS_REJECT_ICON;
+                g_timeout_add_full (G_PRIORITY_HIGH_IDLE,
+                                    MAX (event->debounce_delay, 150),
+                                    (GSourceFunc)timer_reset_bouncekeys_image,
+                                    sapplet, NULL);
+                break;
+            default:
+                icon_name = ACCESSX_BASE_ICON;
+                break;
+        }
+    }
+    tmp_pixbuf = gtk_icon_theme_load_icon_for_scale (icon_theme,
+                                                     icon_name,
+                                                     icon_size,
+                                                     icon_scale,
+                                                     0, NULL);
+
+    if (tmp_pixbuf)
+    {
+        GdkPixbuf* glyph_pixbuf;
+        icon_base = gdk_pixbuf_copy (tmp_pixbuf);
+        g_object_unref (tmp_pixbuf);
+        glyph_pixbuf = accessx_status_applet_get_glyph_pixbuf (GTK_WIDGET (sapplet->applet),
+                                                               icon_base,
+                                                               &fg,
+                                                               glyphstring);
+
+        gdk_pixbuf_composite (glyph_pixbuf,
+                              icon_base,
+                              2, 2,
+                              gdk_pixbuf_get_width (glyph_pixbuf) - 2,
+                              gdk_pixbuf_get_height (glyph_pixbuf) - 2,
+                              -2., -2., 1.0, 1.0,
+                              GDK_INTERP_NEAREST, 96);
+
+        gdk_pixbuf_composite (glyph_pixbuf,
+                              icon_base,
+                              1, 1,
+                              gdk_pixbuf_get_width (glyph_pixbuf) - 1,
+                              gdk_pixbuf_get_height (glyph_pixbuf) - 1,
+                              1., 1., 1.0, 1.0,
+                              GDK_INTERP_NEAREST, alpha);
+
+        g_object_unref (glyph_pixbuf);
+    }
+
+    surface = gdk_cairo_surface_create_from_pixbuf (icon_base,
+                                                    icon_scale,
+                                                    NULL);
+    g_object_unref (icon_base);
+
+    return surface;
+}
+
+static cairo_surface_t*
+accessx_status_applet_mousekeys_image (AccessxStatusApplet* sapplet,
+                                       XkbStateNotifyEvent* event)<--- Parameter 'event' can be declared as pointer to const
+{
+    GdkPixbuf* mouse_pixbuf = NULL, *button_pixbuf, *dot_pixbuf, *tmp_pixbuf;
+    cairo_surface_t *surface;
+    gchar* which_dot = MOUSEKEYS_DOT_LEFT;
+    GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
+    gint icon_size = mate_panel_applet_get_size (sapplet->applet) - ICON_PADDING;
+    gint icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (sapplet->applet));
+    tmp_pixbuf = gtk_icon_theme_load_icon_for_scale (icon_theme,
+                                                     MOUSEKEYS_BASE_ICON,
+                                                     icon_size,
+                                                     icon_scale,
+                                                     0, NULL);
+
+    mouse_pixbuf = gdk_pixbuf_copy (tmp_pixbuf);
+    g_object_unref (tmp_pixbuf);
+    /* composite in the buttons */
+    if (mouse_pixbuf && event && event->ptr_buttons)
+    {
+        gint i;
+
+        for (i = 0; i < G_N_ELEMENTS (button_icons); ++i)
+        {
+            if (event->ptr_buttons & button_icons[i].mask)
+            {
+                button_pixbuf = gtk_icon_theme_load_icon_for_scale (icon_theme,
+                                                                    button_icons[i].icon_name,
+                                                                    icon_size,
+                                                                    icon_scale,
+                                                                    0, NULL);
+
+                gdk_pixbuf_composite (button_pixbuf,
+                                      mouse_pixbuf,
+                                      0, 0,
+                                      gdk_pixbuf_get_width (button_pixbuf),
+                                      gdk_pixbuf_get_height (button_pixbuf),
+                                      0.0, 0.0, 1.0, 1.0,
+                                      GDK_INTERP_NEAREST, 255);
+
+                g_object_unref (button_pixbuf);
+            }
+        }
+    }
+
+    if (event)
+    {
+        switch (sapplet->xkb->ctrls->mk_dflt_btn)
+        {
+            case Button2:
+                which_dot = MOUSEKEYS_DOT_MIDDLE;
+                break;
+            case Button3:
+                which_dot = MOUSEKEYS_DOT_RIGHT;
+                break;
+            case Button1:
+            default:
+                which_dot = MOUSEKEYS_DOT_LEFT;
+                break;
+        }
+    }
+    dot_pixbuf = gtk_icon_theme_load_icon_for_scale (icon_theme,
+                                                     which_dot,
+                                                     icon_size,
+                                                     icon_scale,
+                                                     0, NULL);
+
+    gdk_pixbuf_composite (dot_pixbuf,
+                          mouse_pixbuf,
+                          0, 0,
+                          gdk_pixbuf_get_width (dot_pixbuf),
+                          gdk_pixbuf_get_height (dot_pixbuf),
+                          0.0, 0.0, 1.0, 1.0,
+                          GDK_INTERP_NEAREST, 255);
+
+    surface = gdk_cairo_surface_create_from_pixbuf (mouse_pixbuf,
+                                                    icon_scale,
+                                                    NULL);
+
+    g_object_unref (mouse_pixbuf);
+    g_object_unref (dot_pixbuf);
+
+    return surface;
+}
+
+static void
+accessx_status_applet_set_state_icon (AccessxStatusApplet* sapplet,
+                                      ModifierStruct*      modifier,
+                                      GtkStateFlags        state)
+{
+    cairo_surface_t* surface = NULL;
+    GtkIconTheme *icon_theme;
+    gint icon_size, icon_scale;
+    gchar *icon_name = NULL;
+
+    switch (modifier->mask)
+    {
+        case ShiftMask:
+            if (state == GTK_STATE_FLAG_SELECTED)
+                icon_name = SHIFT_KEY_ICON_LOCKED;
+            else if (state == GTK_STATE_FLAG_NORMAL)
+                icon_name = SHIFT_KEY_ICON_LATCHED;
+            else
+                icon_name = SHIFT_KEY_ICON;
+            break;
+
+        case ControlMask:
+            if (state == GTK_STATE_FLAG_SELECTED)
+                icon_name = CONTROL_KEY_ICON_LOCKED;
+            else if (state == GTK_STATE_FLAG_NORMAL)
+                icon_name = CONTROL_KEY_ICON_LATCHED;
+            else
+                icon_name = CONTROL_KEY_ICON;
+            break;
+
+        case Mod1Mask:
+            if (state == GTK_STATE_FLAG_SELECTED)
+                icon_name = ALT_KEY_ICON_LOCKED;
+            else if (state == GTK_STATE_FLAG_NORMAL)
+                icon_name = ALT_KEY_ICON_LATCHED;
+            else
+                icon_name = ALT_KEY_ICON;
+            break;
+
+        case Mod2Mask:
+            if (state == GTK_STATE_FLAG_SELECTED)
+                icon_name = META_KEY_ICON_LOCKED;
+            else if (state == GTK_STATE_FLAG_NORMAL)
+                icon_name = META_KEY_ICON_LATCHED;
+            else
+                icon_name = META_KEY_ICON;
+            break;
+
+        case Mod3Mask:
+            if (state == GTK_STATE_FLAG_SELECTED)
+                icon_name = HYPER_KEY_ICON_LOCKED;
+            else if (state == GTK_STATE_FLAG_NORMAL)
+                icon_name = HYPER_KEY_ICON_LATCHED;
+            else
+                icon_name = HYPER_KEY_ICON;
+            break;
+
+        case Mod4Mask:
+            if (state == GTK_STATE_FLAG_SELECTED)
+                icon_name = SUPER_KEY_ICON_LOCKED;
+            else if (state == GTK_STATE_FLAG_NORMAL)
+                icon_name = SUPER_KEY_ICON_LATCHED;
+            else
+                icon_name = SUPER_KEY_ICON;
+            break;
+
+        case Mod5Mask:
+            surface = accessx_status_applet_altgraph_image (sapplet, state);
+            break;
+    }
+
+    if (surface == NULL && icon_name != NULL)
+    {
+        icon_theme = gtk_icon_theme_get_default ();
+        icon_size = mate_panel_applet_get_size (sapplet->applet) - ICON_PADDING;
+        icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (sapplet->applet));
+        surface = gtk_icon_theme_load_surface (icon_theme,
+                                               icon_name,
+                                               icon_size,
+                                               icon_scale,
+                                               NULL, 0, NULL);
+    }
+
+    if (surface != NULL)
+    {
+        gtk_image_set_from_surface (GTK_IMAGE (modifier->indicator), surface);
+        cairo_surface_destroy (surface);
+    }
+}
+
+static void
+accessx_status_applet_update (AccessxStatusApplet*    sapplet,
+                              AccessxStatusNotifyType notify_type,
+                              XkbEvent*               event)
+{
+    GdkWindow* window;
+    gint i;
+
+    window = gtk_widget_get_window (GTK_WIDGET (sapplet->applet));
+
+    if (notify_type & ACCESSX_STATUS_MODIFIERS)
+    {
+        unsigned int locked_mods = 0, latched_mods = 0;
+
+        if (event != NULL)
+        {
+            locked_mods = event->state.locked_mods;
+            latched_mods = event->state.latched_mods;
+        }
+        else if (sapplet->applet && window)
+        {
+            XkbStateRec state;
+            XkbGetState (GDK_WINDOW_XDISPLAY (window), XkbUseCoreKbd, &state);
+            locked_mods = state.locked_mods;
+            latched_mods = state.latched_mods;
+        }
+        /* determine which modifiers are locked, and set state accordingly */
+        for (i = 0; i < modifier_n; ++i)
+        {
+            if (modifiers[i].indicator != NULL && modifiers[i].mask)
+            {
+                if (locked_mods & modifiers[i].mask)
+                {
+                    gtk_widget_set_sensitive (modifiers[i].indicator, TRUE);
+                    accessx_status_applet_set_state_icon (sapplet,
+                                                          &modifiers[i],
+                                                          GTK_STATE_FLAG_SELECTED);
+                }
+                else if (latched_mods & modifiers[i].mask)
+                {
+                    gtk_widget_set_sensitive (modifiers[i].indicator, TRUE);
+                    accessx_status_applet_set_state_icon (sapplet,
+                                                          &modifiers[i],
+                                                          GTK_STATE_FLAG_NORMAL);
+                }
+                else
+                {
+                    gtk_widget_set_sensitive (modifiers[i].indicator, FALSE);
+                    accessx_status_applet_set_state_icon (sapplet,
+                                                          &modifiers[i],
+                                                          GTK_STATE_FLAG_INSENSITIVE);
+                }
+            }
+        }
+    }
+
+    if ((notify_type & ACCESSX_STATUS_SLOWKEYS) && (event != NULL))
+    {
+        cairo_surface_t* surface = accessx_status_applet_slowkeys_image (sapplet,
+                                                                         &event->accessx);
+        gtk_image_set_from_surface (GTK_IMAGE (sapplet->slowfoo), surface);
+        cairo_surface_destroy (surface);
+    }
+
+    if ((notify_type & ACCESSX_STATUS_BOUNCEKEYS) && (event != NULL))
+    {
+        cairo_surface_t* surface = accessx_status_applet_bouncekeys_image (sapplet,
+                                                                           &event->accessx);
+        gtk_image_set_from_surface (GTK_IMAGE (sapplet->bouncefoo), surface);
+        cairo_surface_destroy (surface);
+    }
+
+    if ((notify_type & ACCESSX_STATUS_MOUSEKEYS) && (event != NULL))
+    {
+        cairo_surface_t* surface = accessx_status_applet_mousekeys_image (sapplet,
+                                                                          &event->state);
+        gtk_image_set_from_surface (GTK_IMAGE (sapplet->mousefoo), surface);
+        cairo_surface_destroy (surface);
+    }
+
+    if (notify_type & ACCESSX_STATUS_ENABLED)
+    {
+        /* Update the visibility of widgets in the box */
+        /* XkbMouseKeysMask | XkbStickyKeysMask | XkbSlowKeysMask | XkbBounceKeysMask */
+        XkbGetControls (GDK_WINDOW_XDISPLAY (window), XkbAllControlsMask, sapplet->xkb);
+
+        if (!(sapplet->xkb->ctrls->enabled_ctrls &
+            (XkbMouseKeysMask | XkbStickyKeysMask | XkbSlowKeysMask | XkbBounceKeysMask)))
+        {
+            gtk_widget_show (sapplet->idlefoo);
+        }
+        else
+        {
+            gtk_widget_hide (sapplet->idlefoo);
+        }
+
+        if (sapplet->xkb->ctrls->enabled_ctrls & XkbMouseKeysMask)
+        {
+            gtk_widget_show (sapplet->mousefoo);
+        }
+        else
+        {
+            gtk_widget_hide (sapplet->mousefoo);
+        }
+
+        if (sapplet->xkb->ctrls->enabled_ctrls & XkbStickyKeysMask)
+        {
+            gtk_widget_show (sapplet->stickyfoo);
+        }
+        else
+        {
+            gtk_widget_hide (sapplet->stickyfoo);
+        }
+
+        if (sapplet->xkb->ctrls->enabled_ctrls & XkbSlowKeysMask)
+        {
+            gtk_widget_show (sapplet->slowfoo);
+        }
+        else
+        {
+            gtk_widget_hide (sapplet->slowfoo);
+        }
+
+        if (sapplet->xkb->ctrls->enabled_ctrls & XkbBounceKeysMask)
+        {
+            gtk_widget_show (sapplet->bouncefoo);
+        }
+        else
+        {
+            gtk_widget_hide (sapplet->bouncefoo);
+        }
+    }
+
+    return;
+}
+
+static void
+accessx_status_applet_notify_xkb_ax (AccessxStatusApplet*   sapplet,
+                                     XkbAccessXNotifyEvent* event)
+{
+    AccessxStatusNotifyType notify_mask = 0;
+
+    switch (event->detail)
+    {
+        case XkbAXN_SKPress:
+        case XkbAXN_SKAccept:
+        case XkbAXN_SKRelease:
+        case XkbAXN_SKReject:
+            notify_mask |= ACCESSX_STATUS_SLOWKEYS;
+            break;
+        case XkbAXN_BKAccept:
+        case XkbAXN_BKReject:
+            notify_mask |= ACCESSX_STATUS_BOUNCEKEYS;
+            break;
+        case XkbAXN_AXKWarning:
+            break;
+        default:
+            break;
+    }
+
+    accessx_status_applet_update (sapplet,
+                                  notify_mask,
+                                  (XkbEvent*) event);
+}
+
+static void
+accessx_status_applet_notify_xkb_state (AccessxStatusApplet* sapplet,
+                                        XkbStateNotifyEvent* event)
+{
+    AccessxStatusNotifyType notify_mask = 0;
+
+    if (event->changed & XkbPointerButtonMask)
+    {
+        notify_mask |= ACCESSX_STATUS_MOUSEKEYS;
+    }
+
+    if (event->changed & (XkbModifierLatchMask | XkbModifierLockMask))
+    {
+        notify_mask |= ACCESSX_STATUS_MODIFIERS;
+    }
+
+    accessx_status_applet_update (sapplet,
+                                  notify_mask,
+                                  (XkbEvent*) event);
+}
+
+static void
+accessx_status_applet_notify_xkb_device (AccessxStatusApplet*           sapplet,
+                                         XkbExtensionDeviceNotifyEvent* event)
+{
+    if (event->reason == XkbXI_IndicatorStateMask)
+    {
+        if (event->led_state &= ALT_GRAPH_LED_MASK)
+        {
+            gtk_widget_set_sensitive (sapplet->alt_graph_indicator, TRUE);
+            accessx_status_applet_set_state_icon (sapplet,
+                                                  &modifiers[modifier_Mod5],
+                                                  GTK_STATE_FLAG_NORMAL);
+        }
+        else
+        {
+            gtk_widget_set_sensitive (sapplet->alt_graph_indicator, FALSE);
+            accessx_status_applet_set_state_icon (sapplet,
+                                                  &modifiers[modifier_Mod5],
+                                                  GTK_STATE_FLAG_INSENSITIVE);
+        }
+    }
+}
+
+static void
+accessx_status_applet_notify_xkb_controls (AccessxStatusApplet*    sapplet,
+                                           XkbControlsNotifyEvent* event)
+{
+    unsigned int mask = XkbStickyKeysMask | XkbSlowKeysMask | XkbBounceKeysMask | XkbMouseKeysMask;
+    unsigned int notify_mask = 0;
+
+    XkbGetControls (sapplet->xkb_display, XkbMouseKeysMask, sapplet->xkb);
+
+    if (event->enabled_ctrl_changes & mask)
+    {
+        notify_mask = ACCESSX_STATUS_ENABLED;
+    }
+
+    if (event->changed_ctrls & XkbMouseKeysMask)
+    {
+        notify_mask |= ACCESSX_STATUS_MOUSEKEYS;
+    }
+
+    if (notify_mask)
+    {
+        accessx_status_applet_update (sapplet, notify_mask, (XkbEvent*) event);
+    }
+}
+
+static void
+accessx_status_applet_notify_xkb_event (AccessxStatusApplet* sapplet,
+                                        XkbEvent*            event)
+{
+    switch (event->any.xkb_type)
+    {
+        case XkbStateNotify:
+            accessx_status_applet_notify_xkb_state (sapplet, &event->state);
+            break;
+        case XkbAccessXNotify:
+            accessx_status_applet_notify_xkb_ax (sapplet, &event->accessx);
+            break;
+        case XkbControlsNotify:
+            accessx_status_applet_notify_xkb_controls (sapplet, &event->ctrls);
+            break;
+        case XkbExtensionDeviceNotify:
+            /* This is a hack around the fact that XFree86's XKB doesn't give AltGr notifications */
+            accessx_status_applet_notify_xkb_device (sapplet, &event->device);
+            break;
+        default:
+            break;
+    }
+}
+
+static
+GdkFilterReturn accessx_status_xkb_filter (GdkXEvent* gdk_xevent,
+                                           GdkEvent*  event,
+                                           gpointer   user_data)
+{
+    AccessxStatusApplet* sapplet = user_data;
+    XkbEvent* xevent = gdk_xevent;
+
+    if (xevent->any.type == xkb_base_event_type)
+    {
+        accessx_status_applet_notify_xkb_event (sapplet, xevent);
+    }
+
+    return GDK_FILTER_CONTINUE;
+}
+
+static void
+accessx_status_applet_reparent_widget (GtkWidget*    widget,
+                                       GtkContainer* container)
+{
+    if (widget)
+    {
+        if (gtk_widget_get_parent (widget))
+        {
+            g_object_ref (G_OBJECT (widget));
+            gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (widget)),
+                                  widget);
+        }
+
+        gtk_container_add (container, widget);
+    }
+}
+
+static void
+accessx_status_applet_layout_box (AccessxStatusApplet* sapplet,
+                                  GtkWidget*           box,
+                                  GtkWidget*           stickyfoo)
+{
+    AtkObject* atko;
+
+    accessx_status_applet_reparent_widget (sapplet->shift_indicator,
+                                           GTK_CONTAINER (stickyfoo));
+    accessx_status_applet_reparent_widget (sapplet->ctrl_indicator,
+                                           GTK_CONTAINER (stickyfoo));
+    accessx_status_applet_reparent_widget (sapplet->alt_indicator,
+                                           GTK_CONTAINER (stickyfoo));
+    accessx_status_applet_reparent_widget (sapplet->meta_indicator,
+                                           GTK_CONTAINER (stickyfoo));
+    accessx_status_applet_reparent_widget (sapplet->hyper_indicator,
+                                           GTK_CONTAINER (stickyfoo));
+    accessx_status_applet_reparent_widget (sapplet->super_indicator,
+                                           GTK_CONTAINER (stickyfoo));
+    accessx_status_applet_reparent_widget (sapplet->alt_graph_indicator,
+                                           GTK_CONTAINER (stickyfoo));
+    accessx_status_applet_reparent_widget (sapplet->idlefoo,
+                                           GTK_CONTAINER (box));
+    accessx_status_applet_reparent_widget (sapplet->mousefoo,
+                                           GTK_CONTAINER (box));
+    accessx_status_applet_reparent_widget (stickyfoo,
+                                           GTK_CONTAINER (box));
+    accessx_status_applet_reparent_widget (sapplet->slowfoo,
+                                           GTK_CONTAINER (box));
+    accessx_status_applet_reparent_widget (sapplet->bouncefoo,
+                                           GTK_CONTAINER (box));
+
+    if (sapplet->stickyfoo)
+    {
+        gtk_widget_destroy (sapplet->stickyfoo);
+    }
+
+    if (sapplet->box)
+    {
+        gtk_container_remove (GTK_CONTAINER (sapplet->applet), sapplet->box);
+    }
+
+    gtk_container_add (GTK_CONTAINER (sapplet->applet), box);
+    sapplet->stickyfoo = stickyfoo;
+    sapplet->box = box;
+
+    atko = gtk_widget_get_accessible (sapplet->box);
+    atk_object_set_name (atko, _("AccessX Status"));
+    atk_object_set_description (atko,
+                                _("Shows keyboard status when accessibility features are used."));
+
+    gtk_widget_show (sapplet->box);
+    gtk_widget_show (GTK_WIDGET (sapplet->applet));
+
+    if (gtk_widget_get_realized (sapplet->box) && sapplet->initialized)
+    {
+        accessx_status_applet_update (sapplet, ACCESSX_STATUS_ALL, NULL);
+    }
+}
+
+static void
+disable_applet (AccessxStatusApplet* sapplet)
+{
+    gtk_widget_hide (sapplet->meta_indicator);
+    gtk_widget_hide (sapplet->hyper_indicator);
+    gtk_widget_hide (sapplet->super_indicator);
+    gtk_widget_hide (sapplet->alt_graph_indicator);
+    gtk_widget_hide (sapplet->shift_indicator);
+    gtk_widget_hide (sapplet->ctrl_indicator);
+    gtk_widget_hide (sapplet->alt_indicator);
+    gtk_widget_hide (sapplet->mousefoo);
+    gtk_widget_hide (sapplet->stickyfoo);
+    gtk_widget_hide (sapplet->slowfoo);
+    gtk_widget_hide (sapplet->bouncefoo);
+}
+
+static void
+popup_error_dialog (AccessxStatusApplet* sapplet)
+{
+    GtkWidget* dialog;
+    gchar* error_txt;
+
+    switch (sapplet->error_type)
+    {
+        case ACCESSX_STATUS_ERROR_XKB_DISABLED:
+            error_txt = g_strdup (_("XKB Extension is not enabled"));
+            break;
+
+        case ACCESSX_STATUS_ERROR_UNKNOWN:
+
+        default: error_txt = g_strdup (_("Unknown error"));
+            break;
+    }
+
+    dialog = gtk_message_dialog_new (NULL,
+                                     GTK_DIALOG_DESTROY_WITH_PARENT,
+                                     GTK_MESSAGE_ERROR,
+                                     GTK_BUTTONS_CLOSE,
+                                     _("Error: %s"),
+                                     error_txt);
+
+    g_signal_connect (dialog, "response",
+                      G_CALLBACK (gtk_widget_destroy),
+                      NULL);
+
+    gtk_window_set_screen (GTK_WINDOW (dialog),
+                           gtk_widget_get_screen (GTK_WIDGET (sapplet->applet)));
+
+    gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+
+    gtk_widget_show (dialog);
+    g_free (error_txt);
+}
+
+static AccessxStatusApplet*
+create_applet (MatePanelApplet* applet)
+{
+    AccessxStatusApplet* sapplet = g_new0 (AccessxStatusApplet, 1);
+    GtkWidget* box;
+    GtkWidget* stickyfoo;
+    AtkObject* atko;
+    cairo_surface_t *surface;
+    GtkIconTheme *icon_theme;
+    gint icon_size, icon_scale;
+
+#ifndef ENABLE_IN_PROCESS
+    g_set_application_name (_("AccessX Status"));
+#endif
+
+    sapplet->xkb = NULL;
+    sapplet->xkb_display = NULL;
+    sapplet->box = NULL;
+    sapplet->initialized = False; /* there must be a better way */
+    sapplet->error_type = ACCESSX_STATUS_ERROR_NONE;
+    sapplet->applet = applet;
+    mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR);
+    sapplet->orient = mate_panel_applet_get_orient (applet);
+
+    if (sapplet->orient == MATE_PANEL_APPLET_ORIENT_LEFT ||
+        sapplet->orient == MATE_PANEL_APPLET_ORIENT_RIGHT)
+    {
+        box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+        stickyfoo = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+    }
+    else
+    {
+        box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+        stickyfoo = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+    }
+
+    gtk_box_set_homogeneous (GTK_BOX (stickyfoo), TRUE);
+
+    icon_theme = gtk_icon_theme_get_default ();
+    icon_size = mate_panel_applet_get_size (sapplet->applet) - ICON_PADDING;
+    icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (sapplet->applet));
+
+    surface = accessx_status_applet_mousekeys_image (sapplet, NULL);
+    sapplet->mousefoo = gtk_image_new_from_surface (surface);
+    cairo_surface_destroy (surface);
+    gtk_widget_hide (sapplet->mousefoo);
+
+    surface = gtk_icon_theme_load_surface (icon_theme,
+                                           SHIFT_KEY_ICON,
+                                           icon_size,
+                                           icon_scale,
+                                           NULL, 0, NULL);
+
+    sapplet->shift_indicator = gtk_image_new_from_surface (surface);
+    cairo_surface_destroy (surface);
+
+    surface = gtk_icon_theme_load_surface (icon_theme,
+                                           CONTROL_KEY_ICON,
+                                           icon_size, icon_scale,
+                                           NULL, 0, NULL);
+
+    sapplet->ctrl_indicator = gtk_image_new_from_surface (surface);
+    cairo_surface_destroy (surface);
+
+    surface = gtk_icon_theme_load_surface (icon_theme,
+                                           ALT_KEY_ICON,
+                                           icon_size,
+                                           icon_scale,
+                                           NULL, 0, NULL);
+
+    sapplet->alt_indicator = gtk_image_new_from_surface (surface);
+    cairo_surface_destroy (surface);
+
+    surface = gtk_icon_theme_load_surface (icon_theme,
+                                           META_KEY_ICON,
+                                           icon_size,
+                                           icon_scale,
+                                           NULL, 0, NULL);
+
+    sapplet->meta_indicator = gtk_image_new_from_surface (surface);
+    cairo_surface_destroy (surface);
+    gtk_widget_set_sensitive (sapplet->meta_indicator, FALSE);
+    gtk_widget_hide (sapplet->meta_indicator);
+
+    surface = gtk_icon_theme_load_surface (icon_theme,
+                                           HYPER_KEY_ICON,
+                                           icon_size,
+                                           icon_scale,
+                                           NULL, 0, NULL);
+
+    sapplet->hyper_indicator = gtk_image_new_from_surface (surface);
+    cairo_surface_destroy (surface);
+    gtk_widget_set_sensitive (sapplet->hyper_indicator, FALSE);
+    gtk_widget_hide (sapplet->hyper_indicator);
+
+    surface = gtk_icon_theme_load_surface (icon_theme,
+                                           SUPER_KEY_ICON,
+                                           icon_size,
+                                           icon_scale,
+                                           NULL, 0, NULL);
+
+    sapplet->super_indicator = gtk_image_new_from_surface (surface);
+    cairo_surface_destroy (surface);
+    gtk_widget_set_sensitive (sapplet->super_indicator, FALSE);
+    gtk_widget_hide (sapplet->super_indicator);
+
+    surface = accessx_status_applet_altgraph_image (sapplet,
+                                                    GTK_STATE_FLAG_NORMAL);
+
+    sapplet->alt_graph_indicator = gtk_image_new_from_surface (surface);
+    cairo_surface_destroy (surface);
+    gtk_widget_set_sensitive (sapplet->alt_graph_indicator, FALSE);
+
+    surface = accessx_status_applet_slowkeys_image (sapplet, NULL);
+    sapplet->slowfoo = gtk_image_new_from_surface (surface);
+    cairo_surface_destroy (surface);
+    gtk_widget_hide (sapplet->slowfoo);
+
+    surface = accessx_status_applet_bouncekeys_image (sapplet, NULL);
+    sapplet->bouncefoo = gtk_image_new_from_surface (surface);
+    cairo_surface_destroy (surface);
+    gtk_widget_hide (sapplet->bouncefoo);
+
+    surface = gtk_icon_theme_load_surface (icon_theme,
+                                           ACCESSX_APPLET,
+                                           icon_size,
+                                           icon_scale,
+                                           NULL, 0, NULL);
+
+    sapplet->idlefoo = gtk_image_new_from_surface (surface);
+    cairo_surface_destroy (surface);
+    gtk_widget_show (sapplet->idlefoo);
+
+    accessx_status_applet_layout_box (sapplet, box, stickyfoo);
+    atko = gtk_widget_get_accessible (GTK_WIDGET (sapplet->applet));
+    atk_object_set_name (atko, _("AccessX Status"));
+    atk_object_set_description (atko,
+                                _("Shows keyboard status when accessibility features are used."));
+    return sapplet;
+}
+
+static void
+accessx_status_applet_destroy (GtkWidget* widget,
+                               gpointer   user_data)
+{
+    AccessxStatusApplet* sapplet = user_data;
+    /* do we need to free the icon factory ? */
+
+    gdk_window_remove_filter (NULL, accessx_status_xkb_filter, sapplet);
+
+    if (sapplet->xkb)
+    {
+        XkbFreeKeyboard (sapplet->xkb, 0, True);
+    }
+
+    if (sapplet->xkb_display)
+    {
+        XCloseDisplay (sapplet->xkb_display);
+    }
+}
+
+static void
+accessx_status_applet_reorient (GtkWidget*            widget,
+                                MatePanelAppletOrient o,
+                                gpointer              user_data)
+{
+    AccessxStatusApplet* sapplet = user_data;
+    GtkWidget* box;
+    GtkWidget* stickyfoo;
+
+    sapplet->orient = o;
+
+    if (o == MATE_PANEL_APPLET_ORIENT_LEFT || o == MATE_PANEL_APPLET_ORIENT_RIGHT)
+    {
+        box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+        stickyfoo = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+    }
+    else
+    {
+        box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+        stickyfoo = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+    }
+    gtk_box_set_homogeneous (GTK_BOX (stickyfoo), TRUE);
+    accessx_status_applet_layout_box (sapplet, box, stickyfoo);
+}
+
+static void
+accessx_status_applet_resize (GtkWidget* widget,
+                              int        size,
+                              gpointer   user_data)
+{
+    cairo_surface_t *surface;
+
+    AccessxStatusApplet* sapplet = user_data;
+    GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
+    gint icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (sapplet->applet));
+
+    accessx_status_applet_update (sapplet, ACCESSX_STATUS_ALL, NULL);
+
+    surface = accessx_status_applet_slowkeys_image (sapplet, NULL);
+    gtk_image_set_from_surface (GTK_IMAGE (sapplet->slowfoo), surface);
+    cairo_surface_destroy (surface);
+
+    surface = accessx_status_applet_bouncekeys_image (sapplet, NULL);
+    gtk_image_set_from_surface (GTK_IMAGE (sapplet->bouncefoo), surface);
+    cairo_surface_destroy (surface);
+
+    surface = accessx_status_applet_mousekeys_image (sapplet, NULL);
+    gtk_image_set_from_surface (GTK_IMAGE (sapplet->mousefoo), surface);
+    cairo_surface_destroy (surface);
+
+    surface = gtk_icon_theme_load_surface (icon_theme,
+                                           ACCESSX_APPLET, size - ICON_PADDING,
+                                           icon_scale,
+                                           NULL, 0, NULL);
+
+    gtk_image_set_from_surface (GTK_IMAGE (sapplet->idlefoo), surface);
+    cairo_surface_destroy (surface);
+}
+
+static gboolean
+button_press_cb (GtkWidget*           widget,
+                 GdkEventButton*      event,<--- Parameter 'event' can be declared as pointer to const
+                 AccessxStatusApplet* sapplet)
+{
+    if (event->button == 1 && event->type == GDK_BUTTON_PRESS)
+    {
+        dialog_cb (NULL, sapplet);
+    }
+
+    return FALSE;
+}
+
+static gboolean
+key_press_cb (GtkWidget*           widget,
+              GdkEventKey*         event,<--- Parameter 'event' can be declared as pointer to const
+              AccessxStatusApplet* sapplet)
+{
+    switch (event->keyval)
+    {
+        case GDK_KEY_KP_Enter:
+        case GDK_KEY_ISO_Enter:
+        case GDK_KEY_3270_Enter:
+        case GDK_KEY_Return:
+        case GDK_KEY_space:
+        case GDK_KEY_KP_Space:
+            dialog_cb (NULL, sapplet);
+            return TRUE;
+
+        default:
+            break;
+    }
+
+    return FALSE;
+}
+
+static gboolean
+accessx_status_applet_reset (gpointer user_data)
+{
+    AccessxStatusApplet* sapplet = user_data;
+    g_assert (sapplet->applet);
+    accessx_status_applet_reorient (GTK_WIDGET (sapplet->applet),
+                                    mate_panel_applet_get_orient (sapplet->applet),
+                                    sapplet);
+
+    return FALSE;
+}
+
+static gboolean
+accessx_status_applet_initialize (AccessxStatusApplet* sapplet)
+{
+    if (!sapplet->initialized)
+    {
+        sapplet->initialized = True;
+
+        if (!accessx_status_applet_xkb_select (sapplet))
+        {
+            disable_applet (sapplet);
+            popup_error_dialog (sapplet);
+            return FALSE ;
+        }
+
+        gdk_window_add_filter (NULL, accessx_status_xkb_filter, sapplet);
+    }
+
+    accessx_status_applet_init_modifiers (sapplet);
+    accessx_status_applet_update (sapplet, ACCESSX_STATUS_ALL, NULL);
+
+    return TRUE;
+}
+
+static void
+accessx_status_applet_realize (GtkWidget* widget,
+                               gpointer   user_data)
+{
+    AccessxStatusApplet* sapplet = user_data;
+
+    if (!accessx_status_applet_initialize (sapplet))
+    {
+        return;
+    }
+
+    g_idle_add (accessx_status_applet_reset, sapplet);
+
+    return;
+}
+
+static gboolean
+accessx_status_applet_fill (MatePanelApplet* applet)
+{
+    AccessxStatusApplet* sapplet;
+    AtkObject* atk_object;
+    GtkActionGroup* action_group;
+    gboolean was_realized = FALSE;
+
+    sapplet = create_applet (applet);
+
+    if (!gtk_widget_get_realized (sapplet->box))
+    {
+        g_signal_connect_after (sapplet->box, "realize",
+                                G_CALLBACK (accessx_status_applet_realize),
+                                sapplet);
+    }
+    else
+    {
+        accessx_status_applet_initialize (sapplet);
+        was_realized = TRUE;
+    }
+
+    g_object_connect (sapplet->applet,
+                      "signal::destroy", accessx_status_applet_destroy, sapplet,
+                      "signal::change-orient", accessx_status_applet_reorient, sapplet,
+                      "signal::change-size", accessx_status_applet_resize, sapplet,
+                      NULL);
+
+    g_signal_connect (sapplet->applet, "button-press-event",
+                      G_CALLBACK (button_press_cb),<--- You might need to cast the function pointer here
+                      sapplet);
+
+    g_signal_connect (sapplet->applet, "key-press-event",
+                      G_CALLBACK (key_press_cb),<--- You might need to cast the function pointer here
+                      sapplet);
+
+    action_group = gtk_action_group_new ("Accessx Applet Actions");
+    gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+    gtk_action_group_add_actions (action_group,
+                                  accessx_status_applet_menu_actions,
+                                  G_N_ELEMENTS (accessx_status_applet_menu_actions),
+                                  sapplet);
+
+    mate_panel_applet_setup_menu_from_resource (sapplet->applet,
+                                                ACCESSX_RESOURCE_PATH "accessx-status-applet-menu.xml",
+                                                action_group);
+
+    if (mate_panel_applet_get_locked_down (sapplet->applet))
+    {
+        GtkAction* action = gtk_action_group_get_action (action_group, "Dialog");
+        gtk_action_set_visible (action, FALSE);
+    }
+
+    g_object_unref (action_group);
+
+    gtk_widget_set_tooltip_text (GTK_WIDGET (sapplet->applet),
+                                 _("Keyboard Accessibility Status"));
+
+    atk_object = gtk_widget_get_accessible (GTK_WIDGET (sapplet->applet));
+    atk_object_set_name (atk_object, _("AccessX Status"));
+    atk_object_set_description (atk_object,
+                                _("Displays current state of keyboard accessibility features"));
+    gtk_widget_show_all (GTK_WIDGET (sapplet->applet));
+
+    if (was_realized)
+    {
+        accessx_status_applet_reset (sapplet);
+    }
+
+    return TRUE;
+}
+
+static gboolean
+accessx_status_applet_factory (MatePanelApplet* applet,
+                               const gchar*     iid,
+                               gpointer         data)
+{
+    gboolean retval = FALSE;
+
+    if (!strcmp (iid, "AccessxStatusApplet"))
+    {
+        retval = accessx_status_applet_fill (applet);
+    }
+
+    return retval;
+}
+
+PANEL_APPLET_FACTORY ("AccessxStatusAppletFactory",
+                      PANEL_TYPE_APPLET,
+                      "accessx-status",
+                      accessx_status_applet_factory,
+                      NULL)
+
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/10.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/10.html new file mode 100644 index 00000000..95738f28 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/10.html @@ -0,0 +1,911 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.battstat"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[2069]; const double alignment; void * const ptr;}  battstat_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 
+  0002, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 
+  0354, 0000, 0000, 0000, 0205, 0041, 0211, 0170, 0003, 0000, 0000, 0000, 0354, 0000, 0000, 0000, 
+  0027, 0000, 0166, 0000, 0010, 0001, 0000, 0000, 0131, 0007, 0000, 0000, 0324, 0265, 0002, 0000, 
+  0377, 0377, 0377, 0377, 0131, 0007, 0000, 0000, 0001, 0000, 0114, 0000, 0134, 0007, 0000, 0000, 
+  0140, 0007, 0000, 0000, 0023, 0155, 0112, 0252, 0006, 0000, 0000, 0000, 0140, 0007, 0000, 0000, 
+  0011, 0000, 0114, 0000, 0154, 0007, 0000, 0000, 0164, 0007, 0000, 0000, 0201, 0321, 0040, 0031, 
+  0000, 0000, 0000, 0000, 0164, 0007, 0000, 0000, 0005, 0000, 0114, 0000, 0174, 0007, 0000, 0000, 
+  0200, 0007, 0000, 0000, 0156, 0304, 0170, 0140, 0003, 0000, 0000, 0000, 0200, 0007, 0000, 0000, 
+  0030, 0000, 0166, 0000, 0230, 0007, 0000, 0000, 0001, 0010, 0000, 0000, 0275, 0342, 0315, 0116, 
+  0004, 0000, 0000, 0000, 0001, 0010, 0000, 0000, 0015, 0000, 0114, 0000, 0020, 0010, 0000, 0000, 
+  0024, 0010, 0000, 0000, 0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 0142, 0141, 0164, 0164, 
+  0163, 0164, 0141, 0164, 0055, 0160, 0162, 0145, 0146, 0145, 0162, 0145, 0156, 0143, 0145, 0163, 
+  0056, 0165, 0151, 0000, 0000, 0000, 0000, 0000, 0125, 0106, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0134, 0137, 0223, 0233, 0066, 0020, 0177, 0317, 0247, 0120, 0365, 0332, 0361, 
+  0071, 0276, 0114, 0323, 0116, 0306, 0046, 0163, 0271, 0116, 0322, 0316, 0064, 0235, 0114, 0222, 
+  0116, 0037, 0031, 0001, 0062, 0050, 0221, 0045, 0052, 0211, 0363, 0371, 0333, 0107, 0200, 0377, 
+  0300, 0131, 0200, 0060, 0272, 0073, 0137, 0217, 0067, 0033, 0264, 0313, 0256, 0264, 0373, 0333, 
+  0325, 0256, 0140, 0376, 0366, 0166, 0105, 0301, 0015, 0026, 0222, 0160, 0266, 0200, 0263, 0213, 
+  0227, 0020, 0140, 0026, 0362, 0210, 0260, 0170, 0001, 0377, 0371, 0372, 0176, 0362, 0033, 0174, 
+  0353, 0275, 0230, 0377, 0064, 0231, 0200, 0017, 0230, 0141, 0201, 0024, 0216, 0300, 0232, 0250, 
+  0004, 0304, 0024, 0105, 0030, 0274, 0272, 0170, 0365, 0372, 0342, 0045, 0230, 0114, 0364, 0040, 
+  0302, 0024, 0026, 0113, 0024, 0142, 0357, 0005, 0000, 0163, 0201, 0377, 0313, 0210, 0300, 0022, 
+  0120, 0022, 0054, 0140, 0254, 0276, 0377, 0014, 0017, 0017, 0172, 0165, 0161, 0171, 0011, 0247, 
+  0305, 0070, 0036, 0174, 0303, 0241, 0002, 0041, 0105, 0122, 0056, 0340, 0007, 0365, 0375, 0052, 
+  0372, 0226, 0111, 0265, 0302, 0114, 0101, 0100, 0242, 0005, 0104, 0373, 0377, 0063, 0230, 0123, 
+  0150, 0232, 0124, 0360, 0024, 0013, 0265, 0001, 0014, 0255, 0360, 0002, 0146, 0251, 0376, 0007, 
+  0275, 0313, 0137, 0346, 0323, 0335, 0035, 0363, 0100, 0251, 0160, 0352, 0023, 0026, 0012, 0134, 
+  0260, 0367, 0146, 0135, 0004, 0051, 0212, 0161, 0225, 0340, 0316, 0023, 0346, 0323, 0122, 0172, 
+  0263, 0042, 0177, 0256, 0064, 0165, 0251, 0103, 0110, 0271, 0324, 0214, 0126, 0161, 0203, 0006, 
+  0067, 0104, 0222, 0200, 0142, 0350, 0175, 0025, 0031, 0356, 0022, 0052, 0104, 0314, 0137, 0362, 
+  0060, 0223, 0320, 0173, 0217, 0250, 0354, 0034, 0117, 0102, 0316, 0374, 0374, 0047, 0364, 0326, 
+  0204, 0105, 0174, 0075, 0051, 0304, 0071, 0121, 0225, 0004, 0323, 0364, 0014, 0064, 0311, 0305, 
+  0230, 0004, 0202, 0257, 0045, 0026, 0055, 0232, 0050, 0274, 0112, 0251, 0066, 0332, 0235, 0056, 
+  0357, 0220, 0122, 0122, 0041, 0365, 0111, 0340, 0045, 0026, 0332, 0324, 0261, 0204, 0040, 0105, 
+  0372, 0227, 0052, 0024, 0375, 0235, 0040, 0312, 0233, 0164, 0353, 0053, 0156, 0300, 0105, 0204, 
+  0205, 0277, 0046, 0221, 0112, 0264, 0261, 0135, 0166, 0215, 0127, 0104, 0351, 0231, 0003, 0112, 
+  0040, 0046, 0265, 0320, 0110, 0317, 0343, 0002, 0156, 0264, 0204, 0136, 0056, 0066, 0026, 0033, 
+  0160, 0235, 0040, 0021, 0143, 0360, 0221, 0063, 0242, 0270, 0000, 0025, 0055, 0072, 0171, 0157, 
+  0122, 0354, 0047, 0044, 0067, 0342, 0250, 0320, 0361, 0210, 0100, 0222, 0230, 0041, 0272, 0035, 
+  0256, 0035, 0067, 0345, 0114, 0152, 0151, 0022, 0304, 0042, 0212, 0305, 0341, 0222, 0037, 0006, 
+  0020, 0310, 0065, 0322, 0116, 0247, 0315, 0201, 0361, 0322, 0217, 0065, 0203, 0060, 0041, 0064, 
+  0002, 0005, 0012, 0150, 0106, 0223, 0342, 0257, 0066, 0210, 0200, 0337, 0156, 0347, 0323, 0144, 
+  0131, 0357, 0052, 0167, 0373, 0317, 0270, 0211, 0206, 0013, 0242, 0127, 0023, 0051, 0015, 0064, 
+  0320, 0323, 0210, 0243, 0110, 0210, 0250, 0015, 0241, 0114, 0121, 0250, 0161, 0317, 0264, 0122, 
+  0055, 0372, 0241, 0060, 0177, 0222, 0257, 0115, 0010, 0125, 0024, 0061, 0252, 0232, 0051, 0305, 
+  0131, 0135, 0341, 0123, 0225, 0066, 0321, 0121, 0264, 0341, 0231, 0362, 0245, 0332, 0344, 0376, 
+  0207, 0131, 0324, 0110, 0130, 0210, 0136, 0277, 0326, 0054, 0160, 0305, 0355, 0003, 0305, 0340, 
+  0135, 0062, 0223, 0034, 0001, 0246, 0106, 0063, 0366, 0377, 0320, 0134, 0232, 0244, 0352, 0215, 
+  0046, 0226, 0163, 0330, 0227, 0124, 0340, 0020, 0223, 0033, 0054, 0375, 0010, 0057, 0121, 0106, 
+  0125, 0177, 0016, 0244, 0100, 0113, 0157, 0207, 0224, 0175, 0110, 0063, 0355, 0137, 0031, 0323, 
+  0250, 0101, 0011, 0073, 0101, 0155, 0104, 0327, 0150, 0043, 0175, 0231, 0360, 0265, 0277, 0225, 
+  0242, 0235, 0105, 0025, 0054, 0353, 0214, 0121, 0370, 0135, 0073, 0103, 0367, 0043, 0361, 0155, 
+  0252, 0021, 0242, 0277, 0250, 0113, 0102, 0151, 0177, 0252, 0224, 0113, 0122, 0172, 0366, 0313, 
+  0066, 0245, 0214, 0322, 0317, 0247, 0006, 0273, 0077, 0305, 0027, 0312, 0150, 0076, 0330, 0031, 
+  0256, 0217, 0243, 0360, 0371, 0171, 0103, 0116, 0172, 0262, 0043, 0044, 0150, 0200, 0027, 0071, 
+  0363, 0303, 0175, 0362, 0065, 0072, 0342, 0175, 0070, 0342, 0314, 0205, 0043, 0232, 0324, 0067, 
+  0253, 0336, 0244, 0166, 0257, 0120, 0131, 0352, 0334, 0213, 0244, 0023, 0171, 0014, 0312, 0036, 
+  0051, 0172, 0214, 0066, 0135, 0031, 0321, 0311, 0070, 0340, 0052, 0253, 0260, 0116, 0247, 0116, 
+  0110, 0251, 0372, 0000, 0360, 0173, 0121, 0344, 0375, 0017, 0002, 0222, 0255, 0023, 0324, 0210, 
+  0362, 0376, 0055, 0242, 0072, 0207, 0156, 0015, 0115, 0206, 0051, 0112, 0220, 0336, 0222, 0371, 
+  0171, 0176, 0016, 0075, 0306, 0131, 0373, 0163, 0215, 0223, 0145, 0236, 0260, 0253, 0134, 0230, 
+  0162, 0333, 0152, 0030, 0077, 0140, 0342, 0206, 0116, 0236, 0161, 0002, 0361, 0122, 0371, 0051, 
+  0212, 0242, 0016, 0153, 0351, 0236, 0010, 0133, 0247, 0162, 0066, 0025, 0056, 0246, 0303, 0304, 
+  0143, 0245, 0267, 0172, 0204, 0371, 0212, 0247, 0320, 0173, 0175, 0012, 0203, 0136, 0236, 0153, 
+  0345, 0305, 0166, 0142, 0264, 0056, 0215, 0171, 0171, 0256, 0023, 0034, 0326, 0123, 0254, 0374, 
+  0202, 0257, 0360, 0255, 0202, 0155, 0234, 0172, 0345, 0133, 0137, 0164, 0060, 0006, 0212, 0254, 
+  0360, 0124, 0023, 0204, 0371, 0324, 0304, 0370, 0215, 0215, 0106, 0116, 0114, 0144, 0140, 0136, 
+  0326, 0057, 0123, 0262, 0066, 0072, 0163, 0326, 0126, 0302, 0230, 0124, 0110, 0250, 0123, 0231, 
+  0364, 0314, 0237, 0332, 0130, 0105, 0002, 0351, 0044, 0212, 0105, 0332, 0174, 0025, 0027, 0075, 
+  0171, 0325, 0252, 0032, 0212, 0307, 0061, 0305, 0121, 0245, 0250, 0121, 0044, 0150, 0271, 0231, 
+  0371, 0373, 0173, 0206, 0322, 0106, 0003, 0357, 0206, 0224, 0315, 0056, 0175, 0033, 0234, 0323, 
+  0270, 0311, 0353, 0006, 0157, 0266, 0054, 0362, 0275, 0316, 0115, 0330, 0120, 0370, 0310, 0321, 
+  0375, 0016, 0154, 0370, 0251, 0022, 0360, 0161, 0135, 0172, 0320, 0352, 0155, 0321, 0277, 0360, 
+  0101, 0233, 0200, 0350, 0074, 0010, 0330, 0255, 0205, 0171, 0075, 0076, 0243, 0210, 0360, 0052, 
+  0234, 0213, 0374, 0102, 0271, 0056, 0063, 0330, 0305, 0257, 0017, 0250, 0027, 0230, 0356, 0347, 
+  0240, 0016, 0004, 0136, 0041, 0302, 0264, 0361, 0331, 0152, 0347, 0314, 0006, 0034, 0102, 0373, 
+  0075, 0300, 0273, 0063, 0210, 0167, 0014, 0363, 0306, 0155, 0163, 0250, 0264, 0246, 0303, 0371, 
+  0014, 0011, 0031, 0367, 0035, 0066, 0154, 0103, 0207, 0175, 0370, 0160, 0026, 0102, 0334, 0204, 
+  0021, 0047, 0241, 0304, 0062, 0234, 0130, 0205, 0224, 0373, 0202, 0262, 0313, 0173, 0200, 0262, 
+  0103, 0152, 0072, 0002, 0332, 0010, 0150, 0356, 0000, 0355, 0016, 0277, 0130, 0360, 0114, 0357, 
+  0053, 0253, 0161, 0171, 0304, 0307, 0263, 0300, 0307, 0331, 0143, 0340, 0343, 0063, 0332, 0312, 
+  0314, 0036, 0152, 0053, 0323, 0076, 0247, 0055, 0304, 0315, 0204, 0215, 0104, 0333, 0336, 0164, 
+  0136, 0104, 0334, 0205, 0030, 0273, 0042, 0341, 0137, 0215, 0143, 0317, 0255, 0100, 0330, 0030, 
+  0067, 0257, 0064, 0254, 0040, 0175, 0071, 0354, 0346, 0211, 0224, 0022, 0044, 0310, 0024, 0226, 
+  0215, 0213, 0266, 0037, 0262, 0175, 0356, 0032, 0223, 0070, 0121, 0020, 0334, 0040, 0232, 0025, 
+  0107, 0072, 0150, 0324, 0004, 0137, 0363, 0151, 0073, 0377, 0336, 0353, 0352, 0256, 0047, 0324, 
+  0273, 0240, 0375, 0304, 0272, 0263, 0143, 0163, 0140, 0154, 0016, 0214, 0315, 0201, 0307, 0155, 
+  0016, 0330, 0325, 0250, 0116, 0055, 0357, 0075, 0341, 0122, 0336, 0260, 0022, 0334, 0240, 0136, 
+  0314, 0220, 0235, 0357, 0121, 0117, 0206, 0362, 0165, 0240, 0043, 0334, 0066, 0245, 0167, 0272, 
+  0367, 0365, 0377, 0105, 0202, 0201, 0165, 0202, 0031, 0010, 0266, 0107, 0035, 0303, 0362, 0250, 
+  0143, 0244, 0131, 0110, 0240, 0370, 0233, 0161, 0023, 0374, 0144, 0067, 0301, 0367, 0135, 0215, 
+  0253, 0033, 0346, 0270, 0327, 0374, 0277, 0326, 0342, 0366, 0155, 0236, 0044, 0340, 0267, 0026, 
+  0015, 0236, 0207, 0202, 0202, 0301, 0353, 0172, 0152, 0263, 0307, 0115, 0200, 0260, 0137, 0022, 
+  0363, 0262, 0174, 0111, 0011, 0253, 0306, 0011, 0251, 0377, 0133, 0256, 0216, 0323, 0025, 0162, 
+  0014, 0330, 0116, 0021, 0326, 0130, 0033, 0074, 0274, 0350, 0342, 0125, 0136, 0162, 0351, 0315, 
+  0266, 0206, 0216, 0305, 0076, 0165, 0242, 0203, 0047, 0213, 0353, 0025, 0271, 0355, 0242, 0064, 
+  0235, 0336, 0167, 0203, 0221, 0375, 0160, 0322, 0051, 0126, 0272, 0303, 0113, 0147, 0230, 0331, 
+  0003, 0067, 0255, 0261, 0163, 0250, 0263, 0136, 0363, 0125, 0300, 0065, 0220, 0176, 0315, 0217, 
+  0326, 0224, 0075, 0363, 0374, 0312, 0031, 0372, 0253, 0023, 0013, 0030, 0346, 0260, 0104, 0341, 
+  0225, 0264, 0033, 0273, 0035, 0155, 0112, 0156, 0077, 0225, 0055, 0235, 0371, 0064, 0037, 0060, 
+  0230, 0333, 0107, 0302, 0362, 0002, 0023, 0370, 0174, 0350, 0016, 0331, 0363, 0055, 0307, 0312, 
+  0123, 0200, 0345, 0030, 0122, 0366, 0206, 0063, 0142, 0312, 0100, 0114, 0231, 0075, 0066, 0246, 
+  0074, 0134, 0016, 0074, 0064, 0355, 0032, 0333, 0055, 0117, 0253, 0335, 0162, 0346, 0047, 0307, 
+  0216, 0212, 0034, 0313, 0214, 0122, 0273, 0012, 0107, 0217, 0352, 0306, 0337, 0134, 0221, 0345, 
+  0246, 0136, 0337, 0040, 0022, 0344, 0317, 0332, 0000, 0201, 0313, 0122, 0107, 0064, 0036, 0105, 
+  0175, 0326, 0107, 0121, 0053, 0226, 0067, 0236, 0102, 0035, 0133, 0267, 0317, 0241, 0165, 0133, 
+  0340, 0142, 0356, 0113, 0172, 0171, 0345, 0330, 0275, 0075, 0233, 0356, 0355, 0323, 0175, 0245, 
+  0257, 0317, 0033, 0161, 0235, 0372, 0166, 0277, 0321, 0127, 0327, 0261, 0166, 0163, 0136, 0176, 
+  0030, 0140, 0262, 0046, 0121, 0214, 0325, 0336, 0244, 0352, 0227, 0301, 0356, 0243, 0012, 0013, 
+  0070, 0231, 0315, 0266, 0257, 0214, 0007, 0212, 0151, 0143, 0254, 0016, 0353, 0046, 0376, 0165, 
+  0367, 0232, 0153, 0023, 0361, 0235, 0213, 0262, 0366, 0315, 0206, 0022, 0174, 0212, 0317, 0117, 
+  0004, 0350, 0120, 0007, 0230, 0247, 0024, 0205, 0070, 0321, 0116, 0203, 0305, 0364, 0110, 0305, 
+  0371, 0164, 0367, 0161, 0015, 0357, 0205, 0336, 0127, 0036, 0076, 0376, 0362, 0003, 0323, 0234, 
+  0260, 0000, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0057, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0142, 0141, 0164, 0164, 0163, 0164, 0141, 0164, 0057, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 
+  0001, 0000, 0000, 0000, 0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 
+  0142, 0141, 0164, 0164, 0163, 0164, 0141, 0164, 0055, 0141, 0160, 0160, 0154, 0145, 0164, 0055, 
+  0155, 0145, 0156, 0165, 0056, 0170, 0155, 0154, 0306, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0263, 0311, 0115, 0315, 0053, 0315, 0054, 0111, 0315, 0125, 0310, 0113, 0314, 0115, 
+  0265, 0125, 0162, 0112, 0054, 0051, 0051, 0056, 0111, 0054, 0121, 0010, 0050, 0312, 0057, 0110, 
+  0055, 0052, 0311, 0114, 0055, 0126, 0360, 0004, 0112, 0053, 0051, 0044, 0046, 0227, 0144, 0346, 
+  0347, 0041, 0124, 0040, 0024, 0050, 0051, 0350, 0333, 0161, 0331, 0340, 0062, 0310, 0043, 0065, 
+  0247, 0000, 0207, 0021, 0040, 0051, 0374, 0232, 0035, 0223, 0362, 0113, 0113, 0160, 0350, 0006, 
+  0313, 0201, 0265, 0163, 0001, 0000, 0230, 0275, 0105, 0114, 0000, 0050, 0165, 0165, 0141, 0171, 
+  0051, 0155, 0141, 0164, 0145, 0055, 0141, 0160, 0160, 0154, 0145, 0164, 0163, 0057, 0000, 0000, 
+  0003, 0000, 0000, 0000
+} };
+
+static GStaticResource static_resource = { battstat_resource_data.data, sizeof (battstat_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *battstat_get_resource (void);
+GResource *battstat_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * 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.1 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/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CONSTRUCTOR_H__
+#define __G_CONSTRUCTOR_H__
+
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+/*
+ * Only try to include gslist.h if not already included via glib.h,
+ * so that items using gconstructor.h outside of GLib (such as
+ * GResources) continue to build properly.
+ */
+#ifndef __G_LIB_H__
+#include "gslist.h"
+#endif
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+#endif /* __G_CONSTRUCTOR_H__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(battstatresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(battstatresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(battstatresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(battstatresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void battstatresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void battstatresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/100.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/100.html new file mode 100644 index 00000000..df226173 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/100.html @@ -0,0 +1,1577 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * Copyright (C) 2011 Perberos <perberos@gmail.com>
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef __MATE_ABOUT_H__
+#define __MATE_ABOUT_H__
+
+#include <config.h> // autogenerated by ./configure<--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+const char* program_name = N_("MATE Desktop Environment");
+const char* version = PACKAGE_VERSION;
+const char* icon = "mate-desktop";
+const char* website = "https://mate-desktop.org/";
+
+const char* copyright =  N_("Copyright © 1997-2011 GNOME developers\n"
+                            "Copyright © 2011 Perberos\n"
+                            "Copyright © 2012-2024 MATE developers");
+
+/* Increment comments_count if you add other comments. This will be
+ * used to choose a random comment. */
+const int comments_count = 6;
+const char* comments_array[] = {
+    N_("MATE provides an intuitive and attractive desktop to Linux users "
+    "using traditional metaphors."),
+
+    N_("MATE includes most of what you see on your computer, including the file "
+    "manager, document viewer, image viewer, menus, and many applications."),
+
+    N_("MATE is a Free, usable, stable, accessible desktop environment for the Unix-"
+    "like family of operating systems."),
+
+    N_("MATE is the continuation of GNOME 2. Hundreds of people have contributed code to "
+    "GNOME since it was started in 1997; many more have contributed in other "
+    "important ways, including translations, documentation, and quality assurance."),
+
+    N_("GNOME 2 was the most popular Linux desktop but it’s no longer available... "
+    "MATE is here to provide that same desktop to you!"),
+
+    N_("The name “MATE” comes from yerba maté, a species of holly native "
+    "to subtropical South America. Its leaves contain caffeine and are "
+    "used to make infusions and a beverage called mate.")
+};
+
+const char* authors[] = {
+    "MATE:",
+    /* MATE founders */
+    "Perberos <perberos@gmail.com>",
+    "Stefano Karapetsas <stefano@karapetsas.com>",
+    "Steve Zesch <stevezesch2@gmail.com>",
+    "Clement Lefebvre <root@linuxmint.com>",
+    /* MATE developers and contributors */
+    "Scott Balneaves <sbalneav@alburg.net>",
+    "Marcel Dijkstra <marcel.dykstra@gmail.com>",
+    "Jasmine Hassan <jasmine.aura@gmail.com>",
+    "Brent Hull <bhull2010@live.com>",
+    "Steev Klimaszewski <steev@gentoo.org>",
+    "Joseph Krieger <rowen.stipe@gmail.com>",
+    "Nelson Marques <nmo.marques@gmail.com>",
+    "Dan Mashal <dan.mashal@fedoraproject.org>",
+    "Elan Ruusamäe <glen@delfi.ee>",
+    "Yaakov Selkowitz <yselkowitz@users.sourceforge.net>",
+    "Sam Tygier <samtygier@yahoo.co.uk>",
+    "Wolfgang Ulbrich <chat-to-me@raveit.de>",
+    "Sander Sweers <infirit@gmail.com>",
+    "Benjamin Denisart <p.drouand@gmail.com>",
+    "Efstathios Iosifidis <iefstathios@gmail.com>",
+    "Martin Wimpress <code@flexion.org>",
+    "John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>",
+    "Mike Gabriel <sunweaver@debian.org>",
+    "Willy Sudiarto Raharjo <willysr@slackware-id.org>",
+    "Chess Griffin <chess.griffin@gmail.com>",
+    "Vlad Orlov <monsta@inbox.ru>",
+    "Abel McClendon <hcmmac@hosscomm.com>",
+    /* MATE Google Summer of Code students */
+    "Alexander van der Meij <alexandervdm@gliese.me>",
+    "Avishkar Gupta <avishkar_gupta@outlook.com>",
+    "Laszlo Boros <iamsemmu@gmail.com>",
+    "Michal Ratajsky <michal.ratajsky@gmail.com>",
+    "",
+    /* GNOME developers */
+    "GNOME:",
+    "Jérôme Abela",
+    "Rob Adams",
+    "Djihed Afifi",
+    "Sarfraaz Ahmed",
+    "Christopher Aillon",
+    "Lauri Alanko",
+    "Борислав Александров (Borislav Aleksandrov)",
+    "Seth Alves",
+    "Shawn T. Amundson",
+    "Robert Ancell",
+    "Erik Andersen",
+    "Филип Андонов (Filip Andonov)",
+    "Marius Andreiana",
+    "Jon Anhold",
+    "Арангел Ангов (Arangel Angov)",
+    "Никола Антонов (Nikola Antonov)",
+    "Sandy Armstrong",
+    "Frank Arnold",
+    "Arunprakash",
+    "Paolo Bacchilega",
+    "Peter Bach",
+    "Timur I. Bakeyev",
+    "Sébastien Bacher",
+    "Chris Ball",
+    "Szabolcs 'Shooby' Bán",
+    "Lasse Bang Mikkelsen",
+    "Matthew Barnes",
+    "Seba Barto",
+    "Emmanuele Bassi",
+    "Martin Baulig",
+    "Tom Bech",
+    "Andreas Beck",
+    "Carlos Amador Bedolla",
+    "Martijn van Beers",
+    "Frank Belew",
+    "Calum Benson",
+    "Jacob Berkman",
+    "Eckehard Berns",
+    "Žygimantas Beručka",
+    "Runa Bhattacharjee",
+    "Robert Bihlmeyer",
+    "Jonathan Blandford <jrb@redhat.com>",
+    "Christopher Blizzard",
+    "Bruno Boaventura",
+    "Евгени Боевски (Evgeni Boevski)",
+    "Jérôme Bolliet",
+    "Andreas Bolsch",
+    "Wouter Bolsterlee",
+    "David Bolter",
+    "Dave Bordoley",
+    "Paolo Borelli",
+    "James Bowes",
+    "Karsten Bräckelmann",
+    "Hendrik Brandt",
+    "Dario Bressanini",
+    "Emmanuel Briot",
+    "Stephen Browne",
+    "Marcus Brubaker",
+    "Christian Bucher",
+    "Ronald S. Bultje",
+    "Rich Burridge",
+    "Ross Burton",
+    "Jeff Cai",
+    "Brian Cameron",
+    "Dave Camp",
+    "Didier Carlier",
+    "Anders Carlsson",
+    "Luca Cavalli",
+    "Chema Celorio",
+    "Youssef Chahibi",
+    "Gaël Chamoulaud",
+    "Сава Чанков (Sava Chankov)",
+    "Damon Chaplin",
+    "Kevin Charter",
+    "Erwann Chénedé",
+    "張 國 冠",
+    "Павел Чолаков (Pavel Cholakov)",
+    "Kenneth Rohde Christiansen",
+    "Bryan Clark",
+    "Chad Clark",
+    "Matthias Clasen",
+    "Andrew Clausen",
+    "Jason Clinton",
+    "Jules Colding",
+    "Jeremy Collins",
+    "Rusty Conover",
+    "Pat Costello",
+    "Phil Cowans",
+    "Alan Cox",
+    "Dennis Cranston",
+    "Mark Crichton",
+    "Frédéric Crozat",
+    "Andreas Czechanowski",
+    "Виктор Дачев (Victor Dachev)",
+    "Johan Dahlin",
+    "Nalin Dahyabhai",
+    "Dan Damian",
+    "Sayamindu Dasgupta",
+    "Phil Dawes",
+    "Fatih Demir",
+    "Guillaume Desmottes",
+    "Frédéric Devernay",
+    "Joanmarie Diggs",
+    "Feico W. Dillema",
+    "Филип Димитров (Philip Dimitrov)",
+    "Carlos Eduardo Rodrigues Diógenes",
+    "Станимир Джевелеков (Stanimir Djevelekov)",
+    "Петър Добрев (Peter Dobrev)",
+    "Явор Доганов (Yavor Doganov)",
+    "Radek Doulik",
+    "Sebastian Dröge",
+    "Máirín Duffy",
+    "Alex Duggan",
+    "László Dvornik",
+    "Tom Dyas",
+    "Karl Eichwalder",
+    "John Ellis",
+    "Diego Escalante Urrelo",
+    "Behdad Esfahbod",
+    "Arturo Espinosa",
+    "Gus Estrella",
+    "David Etherton",
+    "Larry Ewing",
+    "Marc Ewing",
+    "Gergő Érdi",
+    "Peter Fales",
+    "Ahmad Farghal",
+    "Joaquim Fellmann",
+    "Christophe Fergeau",
+    "Jens Finke",
+    "Mark Finlay",
+    "Dave Finton",
+    "Milon Firikis",
+    "John Fleck",
+    "Raúl Perusquia Flores",
+    "Crispin Flowerday",
+    "Lawrence Foard",
+    "Leonardo Fontenelle",
+    "Glynn Foster",
+    "Ben FrantzDale",
+    "Jeff Freedman",
+    "David Abilleira Freijeiro",
+    "Nat Friedman",
+    "Jochen Friedrich",
+    "Adam Fritzler",
+    "Michael Fulbright",
+    "Christopher R. Gabriel",
+    "Mark Galassi",
+    "Tony Gale",
+    "Carlos García Campos",
+    "Matthew Garrett",
+    "Carlos Garnacho Parro",
+    "Jeff Garzik",
+    "Vincent Geddes",
+    "Владимир Герджиков (Vladimir Gerdjikov)",
+    "Tim Gerla",
+    "Björn Giesler",
+    "Quim Gil",
+    "Evandro Fernandes Giovanini",
+    "Владимира Гиргинова (Vladimira Girginova)",
+    "Dave Glowacki",
+    "Scott Goehring",
+    "Jody Goldberg",
+    "Randy Gordon",
+    "Ted Gould",
+    "Jens Granseuer",
+    "Kenny Graunke",
+    "Alex Graveley",
+    "Jamin Philip Gray",
+    "Dov Grobgeld",
+    "Bertrand Guiheneuf",
+    "Alan Aspuru Guzik",
+    "Telsa Gwynne",
+    "Fredrik Hallenberg",
+    "Mikael Hallendal",
+    "Lars Hamann",
+    "Bill Haneman",
+    "Michael Hanni",
+    "Raja R Harinath",
+    "Heath Harrelson",
+    "Peter Harvey",
+    "Mathias Hasselmann",
+    "Peter Hawkins",
+    "Chris Heath",
+    "Scott Heavner",
+    "Sebastian Heinlein",
+    "Jon K Hellan",
+    "James Henstridge <james@daa.com.au>",
+    "Fernando Herrera",
+    "Richard Hestilow",
+    "Raphael Higino",
+    "Thomas Hinkle",
+    "Iain Holmes",
+    "Adam Hooper",
+    "Alan Horkan",
+    "Khaled Hosny",
+    "Ihar Hrachyshka",
+    "Николай Христов (Nikolay Hristov)",
+    "Irene Huang",
+    "Richard Hughes",
+    "David Huggins-Daines",
+    "Richard Hult",
+    "Andreas Hyden",
+    "Miguel de Icaza <miguel@ximian.com>",
+    "Hiroyuki Ikezoe",
+    "Khandakar Mujahidul Islam",
+    "Johnny Jacob",
+    "Mayank Jain",
+    "Vivek Jain",
+    "Tim Janik",
+    "Stefan Jeske",
+    "王 剑",
+    "Amed Ç. Jiyan",
+    "Michael K. Johnson",
+    "Keld Jørn Simonsen",
+    "Andy Kahn",
+    "Mikkel Kamstrup Erlandsen",
+    "Sami Kananoja",
+    "Янко Канети (Yanko Kaneti)",
+    "Ивелина Кърчева (Ivelina Karcheva)",
+    "Theppitak Karoonboonyanan",
+    "Matt Keenan",
+    "Gábor Kelemen",
+    "Michael Kellen",
+    "Christian Kellner",
+    "Stephen Kiernan",
+    "Spencer Kimball",
+    "Christian Kintner",
+    "Christian Kirbach",
+    "Peter Kirchgessner",
+    "Alexander Kirillov",
+    "Димитър Киров (Dimitar Kirov)",
+    "Andre Klapper",
+    "Helmut Köberle",
+    "Alfredo Kojima",
+    "Атанас Кошаров (Atanas Kosharov)",
+    "Martin Kretzschmar",
+    "Harish Krishnaswamy",
+    "Andrew Kuchling",
+    "Tomas Kuliavas",
+    "Stephan Kulow",
+    "Kaushal Kumar",
+    "Nirmal Kumar",
+    "Praveen Kumar",
+    "Martynas Kunigelis",
+    "Tuomas Kuosmanen",
+    "Olof Kylander",
+    "Mathieu Lacage",
+    "Francis J. Lacoste",
+    "Chris Lahey",
+    "Dom Lachowicz",
+    "Scott Laird",
+    "Birger Langkjer",
+    "Ask Hjorth Larsen",
+    "Alexander Larsson",
+    "Guillaume Laurent",
+    "Ole Laursen",
+    "Michael Lausch",
+    "Will LaShell",
+    "Jens Lautenbacher",
+    "Evan Lawrence",
+    "Garrett LeSage",
+    "Jason Leach",
+    "George Lebl",
+    "Gregory Leblanc",
+    "Elliot Lee <sopwith@redhat.com>",
+    "Marc Lehmann",
+    "Noah Levitt",
+    "Raph Levien",
+    "廖 昭 雄",
+    "Tor Lillqvist",
+    "Matt Loper",
+    "Nick Lopez",
+    "Xan Lopez",
+    "Elixan Loran",
+    "Ryan Lortie",
+    "Harry Lu",
+    "Dirk Lutjens",
+    "Josh MacDonald",
+    "Og Maciel",
+    "David MacKay",
+    "Davyd Madeley",
+    "Mohamed Magdy",
+    "Paolo Maggi",
+    "Sam Magnuson",
+    "Ian Main",
+    "David Malcolm",
+    "Jordi Mallach",
+    "Mandrake",
+    "Daniel Manrique",
+    "Kjartan Maraas",
+    "Matthew Marjanovic",
+    "Heath Martin",
+    "Oliver Maruhn",
+    "Fabio Marzocca",
+    "Dave Mason",
+    "James Mastros",
+    "Peter Mattis",
+    "Gordon Matzigkeit",
+    "Dietmar Maurer <dietmar@ximian.com>",
+    "Justin Maurer",
+    "Shaun McCance",
+    "William Jon McCann",
+    "Callum McKenzie",
+    "Gregory McLean",
+    "Mark McLoughlin",
+    "Michael Meeks",
+    "Federico Mena-Quintero",
+    "Christophe Merlet",
+    "Christian Meyer",
+    "Tim Miao",
+    "Gintautas Miliauskas",
+    "Cesar Miquel",
+    "Julian Missig",
+    "Eric B. Mitchell",
+    "Jaka Mocnik",
+    "Paolo Molaro",
+    "Lynn Monsanto",
+    "David Mosberger",
+    "Rodrigo Moya <rodrigo@ximian.com>",
+    "Dan Mueth",
+    "Thomas Muldowney",
+    "Alexandre Muñiz",
+    "Tim-Philipp Müller",
+    "Sivaiah Nallagatla",
+    "남 성 현",
+    "Deepa Natarajan",
+    "Ales Navicki",
+    "Јован Наумовски (Jovan Naumovski)",
+    "Dave Neary",
+    "Karl Nelson",
+    "Elijah Newren",
+    "Christian Neumair",
+    "Mike Newman",
+    "Seth Nickell",
+    "Asger Alstrup Nielsen",
+    "Kenneth Nielsen",
+    "Nate Nielsen",
+    "Eric Nielson",
+    "Bastien Nocera",
+    "Martin Norbäck",
+    "Joachim Noreiko",
+    "Alexander Nyakhaychyk",
+    "Daniel Nylander",
+    "Padraig O'Briain",
+    "Eskil Olsen",
+    "Jimmy Olsen",
+    "David Orme",
+    "Karl Anders Oygard",
+    "Tomas Ögren",
+    "Keith Packard",
+    "Jay Painter",
+    "Chenthill Palanisamy",
+    "John Palmieri",
+    "Cameron Parish",
+    "Conrad Parker",
+    "Stuart Parmenter",
+    "Guilherme de S. Pastore",
+    "Sankarasivasubramaniam Pasupathilingam",
+    "Данило Шеган",
+    "Mike Pedersen",
+    "Nils Pedersen",
+    "Илия Пенев (Ilia Penev)",
+    "Havoc Pennington",
+    "Ettore Perazzoli",
+    "Carlos Perelló Marín",
+    "Christian Persch",
+    "Marco Pesenti Gritti",
+    "Ian Peters",
+    "Martin Kasper Petersen",
+    "Christof Petig",
+    "Владимир Петков (Vladimir \"Kaladan\" Petkov)",
+    "Joe Pfeiffer",
+    "Ben Pierce",
+    "Chris Pinkham",
+    "Hasbullah Bin Pit",
+    "Sebastian Pölsterl",
+    "Germán Poo-Caamaño",
+    "Пейо Попов (Peio Popov)",
+    "Dick Porter",
+    "Ясен Праматаров (Yasen Pramatarov)",
+    "Tero Pulkkinen",
+    "Атанас Пюскюлев (Atanas Pyuskyulev)",
+    "Sushma Rai",
+    "Ростислав Райков (Rostislav \"zbrox\" Raikov)",
+    "Madhan Raj M.",
+    "Srinivasa Ragavan",
+    "Rajeev Ramanathan",
+    "Jean-François Rameau",
+    "Sriram Ramkrishna",
+    "The Rasterman",
+    "Oliver Rauch",
+    "Lucas Rocha",
+    "Erdal Ronahi",
+    "Andreas Røsdal",
+    "Christian Rose",
+    "Cody Russell",
+    "Reklaw",
+    "Jens Christian Restemeier",
+    "Patrick Reynolds",
+    "Robert Richardson",
+    "Hendrik Richter",
+    "Kristian Rietveld",
+    "Sebastian Rittau",
+    "Alex Roberts",
+    "Michel Roelofs",
+    "Ueli Rutishauser",
+    "Lars Rydlinge",
+    "Peter Ryland",
+    "Claudio Saavedra",
+    "Joseph Sacco",
+    "Bibek Sahu",
+    "Arvind Samptur",
+    "Søren Sandmann",
+    "Damien Sandras",
+    "Pablo Saratxaga",
+    "笹 山 和 宏",
+    "Carsten Schaar",
+    "Christian Schaller",
+    "Wayne Schuller",
+    "Franck Schneider",
+    "Ingo Schneider",
+    "Bernd Schroeder",
+    "John Schulien",
+    "Chris Scobell",
+    "Don Scorgie",
+    "Jens Seidel",
+    "Dodji Seketeli",
+    "Shakti Sen",
+    "Iñigo Serna",
+    "Shaleh",
+    "Devashish Sharma",
+    "Joe Shaw",
+    "Александър Шопов (Alexander Shopov)",
+    "Clytie Siddall",
+    "Alejandro Aguilar Sierra",
+    "Miroslav Silovic",
+    "Manish Singh",
+    "Timo Sirainen",
+    "David F. Skoll",
+    "Jochen Skulj",
+    "Nuke Skyjumper",
+    "Петър Славов (Peter \"Peshka\" Slavov)",
+    "Josh Sled",
+    "John Slee",
+    "Raphaël Slinckx",
+    "Brent Smith",
+    "Garrett Smith",
+    "Suzanna Smith",
+    "Andrew Sobala",
+    "Shreyas Srinivasan",
+    "Maciej Stachowiak",
+    "Stalyn",
+    "Jeffrey Stedfast",
+    "Jakub Steiner",
+    "Ben Stern",
+    "Micah Stetson",
+    "Ray Strode",
+    "Luke Stroven",
+    "Mariano Suárez-Alvarez",
+    "Parthasarathi Susarla",
+    "Nathan Carl Summers",
+    "Istvan Szekeres",
+    "Петър Тахчиев (Peter Tahchiev)",
+    "HideToshi Tajima",
+    "Nigel Tao",
+    "Tristan Tarrant",
+    "Anthony Taylor",
+    "Owen Taylor",
+    "Peter Teichman",
+    "Arturo Tena",
+    "Thomas Thurman",
+    "Kimball Thurston",
+    "András Tímár",
+    "Boyd Timothy",
+    "Rêzan Tovjîn",
+    "Alp Toker",
+    "Chris Toshok",
+    "Christoph Toshok",
+    "Malcolm Tredinnick",
+    "Tom Tromey <tromey@redhat.com>",
+    "David Trowbridge",
+    "Jon Trowbridge",
+    "段 活 文",
+    "Сергей В. Удальцов",
+    "Juan Pablo Ugarte",
+    "Vincent Untz",
+    "Manish Vachharajani",
+    "Neil Vachharajani",
+    "Tristan Van Berkom",
+    "Philip Van Hoof",
+    "Thomas Vander Stichele",
+    "Veerapuram Varadhan",
+    "Васил Василев (Vasil Vasilev)",
+    "Daniel Veillard",
+    "Vendu",
+    "Andrew Veliath",
+    "Юлия Велкова (Julia Velkova)",
+    "Luis Villa",
+    "Olav Vitters",
+    "Marius Vollmer",
+    "Patrick Wade",
+    "Shawn Wagner",
+    "Will Walker",
+    "Hanna Wallach",
+    "Colin Walters",
+    "Matthias Warkus",
+    "Jeff Waugh",
+    "Morten Welinder",
+    "Jonh Wendell",
+    "Bruno Widmann",
+    "Robert Wilhelm",
+    "Sebastian Wilhelmi",
+    "Dan Williams",
+    "James Willcox",
+    "David Winkler",
+    "Dan Winship",
+    "Jeremy Wise",
+    "Roger Wolff",
+    "Ivan Wong",
+    "Frank Worsley",
+    "Rizoyê Xerzî",
+    "Wang Xin",
+    "James Youngman",
+    "Mengjie Yu",
+    "Li Yuan",
+    "Orest Zborowski",
+    "Simon Zheng",
+    "Sascha Ziemann",
+    "Michael Zucchi",
+    "Jason van Zyl",
+    NULL
+};
+
+// documentation
+const char* documenters[] = {
+    "...", // TODO: fillme
+    NULL
+};
+// artists
+const char* artists[] = {
+    "Marcel Dijkstra <marcel.dykstra@gmail.com>",
+    "Rowen Stipe <rowen.stipe@gmail.com>",
+    "Wolfgang Ulbrich <chat-to-me@raveit.de>",
+    NULL
+};
+
+// widget for mate-about window
+GtkAboutDialog* mate_about_dialog = FALSE;
+
+GtkApplication* mate_about_application;
+
+/**
+ * If this value is set to TRUE, then mate_about_dialog will not be called
+ * on the main function.
+ */
+gboolean mate_about_nogui = FALSE;
+// functions
+void mate_about_run(void);
+void mate_about_release_version(void);
+
+static void mate_about_on_activate(GtkApplication* app);
+
+// arguments definitions
+static GOptionEntry command_entries[] = {
+    {"version", 'v', 0, G_OPTION_ARG_NONE, &mate_about_nogui, "Show MATE version", NULL},
+    {NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL}
+};
+
+#endif /* __MATE_ABOUT_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/101.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/101.html new file mode 100644 index 00000000..6dc05d96 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/101.html @@ -0,0 +1,417 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
/*
+ * mate-color.c: MATE color selection tool
+ *
+ * Copyright (C) 2014 Stefano Karapetsas
+ * Copyright (C) 2014-2021 MATE Developers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors:
+ *  Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <libmate-desktop/mate-colorseldialog.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <libmate-desktop/mate-colorsel.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+static gboolean
+copy_color (GtkWidget *widget, GdkEvent  *event, MateColorSelectionDialog *color_dialog)
+{
+    GdkColor color;
+    gchar *color_string;
+
+    mate_color_selection_get_current_color (MATE_COLOR_SELECTION (color_dialog->colorsel), &color);
+    g_object_get (color_dialog->colorsel, "hex-string", &color_string, NULL);
+
+    gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), color_string, -1);
+
+    g_free (color_string);
+    return 0;
+}
+
+int
+main (int argc, char **argv)
+{
+    GtkWidget *color_dialog = NULL;
+    GtkWidget *color_selection;
+    GtkWidget *widget;
+    GtkWidget *image;
+
+    bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
+    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+    textdomain (GETTEXT_PACKAGE);
+
+    /* initialize GTK+ */
+    gtk_init (&argc, &argv);
+    gtk_window_set_default_icon_name ("gtk-select-color");
+
+    color_dialog = mate_color_selection_dialog_new (_("MATE Color Selection"));
+    color_selection = MATE_COLOR_SELECTION_DIALOG (color_dialog)->colorsel;
+    mate_color_selection_set_has_palette (MATE_COLOR_SELECTION (color_selection), TRUE);
+
+    /* quit signal */
+    g_signal_connect (color_dialog, "destroy", gtk_main_quit, NULL);
+
+    widget = gtk_button_new_with_mnemonic (_("_Copy"));
+    image = gtk_image_new_from_icon_name ("edit-copy", GTK_ICON_SIZE_BUTTON);
+    gtk_button_set_image (GTK_BUTTON (widget), image);
+    gtk_dialog_add_action_widget (GTK_DIALOG (color_dialog), widget, GTK_RESPONSE_ACCEPT);
+    g_signal_connect (widget, "button-release-event", G_CALLBACK (copy_color), color_dialog);
+
+    widget = gtk_button_new_with_mnemonic (_("_Close"));
+    image = gtk_image_new_from_icon_name ("window-close", GTK_ICON_SIZE_BUTTON);
+    gtk_button_set_image (GTK_BUTTON (widget), image);
+    gtk_dialog_add_action_widget (GTK_DIALOG (color_dialog), widget, GTK_RESPONSE_CLOSE);
+    g_signal_connect (widget, "button-release-event", gtk_main_quit, NULL);
+
+    gtk_widget_show_all (color_dialog);
+    gtk_widget_hide (MATE_COLOR_SELECTION_DIALOG (color_dialog)->ok_button);
+    gtk_widget_hide (MATE_COLOR_SELECTION_DIALOG (color_dialog)->cancel_button);
+    gtk_widget_hide (MATE_COLOR_SELECTION_DIALOG (color_dialog)->help_button);
+
+    /* start application */
+    gtk_main ();
+    return 0;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/102.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/102.html new file mode 100644 index 00000000..756d88c5 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/102.html @@ -0,0 +1,351 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
/* $Id$ */
+
+/*
+ *  Papadimitriou Spiros <spapadim+@cs.cmu.edu>
+ *
+ *  This code released under the GNU GPL.
+ *  Read the file COPYING for more information.
+ *
+ *  Main applet widget
+ *
+ */
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet-gsettings.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define MATEWEATHER_I_KNOW_THIS_IS_UNSTABLE
+
+#include <libmateweather/mateweather-prefs.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "mateweather.h"
+#include "mateweather-pref.h"
+#include "mateweather-dialog.h"
+#include "mateweather-applet.h"
+
+static gboolean mateweather_applet_new(MatePanelApplet* applet, const gchar* iid, gpointer data)
+{
+	MateWeatherApplet* gw_applet;
+
+	gw_applet = g_new0(MateWeatherApplet, 1);
+
+	gw_applet->applet = applet;
+	gw_applet->mateweather_info = NULL;
+	gw_applet->settings = mate_panel_applet_settings_new (applet, "org.mate.weather");
+
+	mateweather_applet_create(gw_applet);
+
+	mateweather_prefs_load(&gw_applet->mateweather_pref, gw_applet->settings);
+
+	mateweather_update(gw_applet);
+
+	return TRUE;
+}
+
+static gboolean mateweather_applet_factory(MatePanelApplet* applet, const gchar* iid, gpointer data)
+{
+	gboolean retval = FALSE;
+
+	retval = mateweather_applet_new(applet, iid, data);
+
+	return retval;
+}
+
+PANEL_APPLET_FACTORY("MateWeatherAppletFactory", PANEL_TYPE_APPLET, "mateweather", mateweather_applet_factory, NULL)
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/103.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/103.html new file mode 100644 index 00000000..fa78095b --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/103.html @@ -0,0 +1,343 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
#ifndef __MATEWEATHER_H__
+#define __MATEWEATHER_H__
+
+/*
+ *  todd kulesza <fflewddur@dropline.net>
+ *
+ *  This code released under the GNU GPL.
+ *  Read the file COPYING for more information.
+ *
+ * main header file
+ *
+ */
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <libmateweather/mateweather-prefs.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+/* Radar map on by default. */
+#define RADARMAP
+
+G_BEGIN_DECLS
+
+typedef struct _MateWeatherApplet {
+	MatePanelApplet* applet;
+	WeatherInfo* mateweather_info;
+
+	GSettings* settings;
+
+	GtkWidget* container;
+	GtkWidget* box;
+	GtkWidget* label;
+	GtkWidget* image;
+
+	MatePanelAppletOrient orient;
+	guint size;
+	guint timeout_tag;
+	guint suncalc_timeout_tag;
+
+	/* preferences  */
+	MateWeatherPrefs mateweather_pref;
+
+	GtkWidget* pref_dialog;
+
+	/* dialog stuff */
+	GtkWidget* details_dialog;
+} MateWeatherApplet;
+
+G_END_DECLS
+
+#endif
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/104.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/104.html new file mode 100644 index 00000000..3f0fbc9c --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/104.html @@ -0,0 +1,349 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
/* $Id$ */
+
+/*
+ *  Papadimitriou Spiros <spapadim+@cs.cmu.edu>
+ *
+ *  This code released under the GNU GPL.
+ *  Read the file COPYING for more information.
+ *
+ *  Preferences dialog
+ *
+ */
+
+#ifndef __MATEWEATHER_PREF_H_
+#define __MATEWEATHER_PREF_H_
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define MATEWEATHER_I_KNOW_THIS_IS_UNSTABLE
+
+#include "mateweather.h"
+
+G_BEGIN_DECLS
+
+#define MATEWEATHER_TYPE_PREF		(mateweather_pref_get_type ())
+#define MATEWEATHER_PREF(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), MATEWEATHER_TYPE_PREF, MateWeatherPref))
+#define MATEWEATHER_PREF_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), MATEWEATHER_TYPE_PREF, MateWeatherPrefClass))
+#define MATEWEATHER_IS_PREF(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATEWEATHER_TYPE_PREF))
+#define MATEWEATHER_IS_PREF_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), MATEWEATHER_TYPE_PREF))
+#define MATEWEATHER_PREF_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj), MATEWEATHER_TYPE_PREF, MateWeatherPrefClass))
+
+typedef struct _MateWeatherPref MateWeatherPref;
+typedef struct _MateWeatherPrefPrivate MateWeatherPrefPrivate;
+typedef struct _MateWeatherPrefClass MateWeatherPrefClass;
+
+struct _MateWeatherPref
+{
+	GtkDialog parent;
+
+	/* private */
+	MateWeatherPrefPrivate *priv;
+};
+
+struct _MateWeatherPrefClass
+{
+	GtkDialogClass parent_class;
+};
+
+GType		 mateweather_pref_get_type	(void);
+GtkWidget	*mateweather_pref_new	(MateWeatherApplet *applet);
+
+void set_access_namedesc (GtkWidget *widget, const gchar *name, const gchar *desc);
+
+G_END_DECLS
+
+#endif /* __MATEWEATHER_PREF_H */
+
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/105.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/105.html new file mode 100644 index 00000000..2a73603b --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/105.html @@ -0,0 +1,305 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
#ifndef __MATEWEATHER_DIALOG_H_
+#define __MATEWEATHER_DIALOG_H_
+
+/* $Id$ */
+
+/*
+ *  Papadimitriou Spiros <spapadim+@cs.cmu.edu>
+ *
+ *  This code released under the GNU GPL.
+ *  Read the file COPYING for more information.
+ *
+ *  Main status dialog
+ *
+ */
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define MATEWEATHER_I_KNOW_THIS_IS_UNSTABLE
+
+#include "mateweather.h"
+
+G_BEGIN_DECLS
+
+#define MATEWEATHER_TYPE_DIALOG mateweather_dialog_get_type ()
+G_DECLARE_FINAL_TYPE (MateWeatherDialog, mateweather_dialog,
+                      MATEWEATHER, DIALOG, GtkDialog)
+
+GtkWidget        *mateweather_dialog_new                (MateWeatherApplet *applet);
+void              mateweather_dialog_update             (MateWeatherDialog *dialog);
+
+G_END_DECLS
+
+#endif /* __MATEWEATHER_DIALOG_H_ */
+
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/106.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/106.html new file mode 100644 index 00000000..5140331d --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/106.html @@ -0,0 +1,365 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
/* $Id$ */
+
+/*
+ *  Papadimitriou Spiros <spapadim+@cs.cmu.edu>
+ *
+ *  This code released under the GNU GPL.
+ *  Read the file COPYING for more information.
+ *
+ *  About box
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <assert.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define MATEWEATHER_I_KNOW_THIS_IS_UNSTABLE
+
+#include "mateweather.h"
+#include "mateweather-about.h"
+
+void mateweather_about_run(MateWeatherApplet* gw_applet)
+{
+	static const gchar* authors[] = {
+		"Todd Kulesza <fflewddur@dropline.net>",
+		"Philip Langdale <philipl@mail.utexas.edu>",
+		"Ryan Lortie <desrt@desrt.ca>",
+		"Davyd Madeley <davyd@madeley.id.au>",
+		"Spiros Papadimitriou <spapadim+@cs.cmu.edu>",
+		"Kevin Vandersloot <kfv101@psu.edu>",
+		NULL
+	};
+
+	const gchar* documenters[] = {
+		"Dan Mueth <d-mueth@uchicago.edu>",
+		"Spiros Papadimitriou <spapadim+@cs.cmu.edu>",
+		N_("Sun GNOME Documentation Team <gdocteam@sun.com>"),
+		"Davyd Madeley <davyd@madeley.id.au>",
+		N_("MATE Documentation Team"),
+		NULL
+	};
+
+#ifdef ENABLE_NLS
+	const char **p;
+	for (p = documenters; *p; ++p)
+		*p = _(*p);
+#endif
+
+	gtk_show_about_dialog(NULL,
+		"title", _("About Weather Report"),
+		"version", VERSION,
+		"copyright", _("Copyright \xC2\xA9 1999-2005 by S. Papadimitriou and others\n"
+		               "Copyright \xc2\xa9 2012-2021 MATE developers"),
+		"comments", _("A panel application for monitoring local weather conditions."),
+		"authors", authors,
+		"documenters", documenters,
+		"translator-credits", _("translator-credits"),
+		"logo-icon-name", "weather-storm",
+		NULL);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/107.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/107.html new file mode 100644 index 00000000..74f35c77 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/107.html @@ -0,0 +1,1381 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
/* $Id$ */
+
+/*
+ *  Papadimitriou Spiros <spapadim+@cs.cmu.edu>
+ *
+ *  This code released under the GNU GPL.
+ *  Read the file COPYING for more information.
+ *
+ *  Main applet widget
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif /* HAVE_CONFIG_H */
+
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <assert.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <netinet/in.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <arpa/nameser.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <resolv.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet-gsettings.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gdk/gdkkeysyms.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#ifdef HAVE_LIBNOTIFY
+#include <libnotify/notify.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#define MATEWEATHER_I_KNOW_THIS_IS_UNSTABLE
+
+#include "mateweather.h"
+#include "mateweather-about.h"
+#include "mateweather-pref.h"
+#include "mateweather-dialog.h"
+#include "mateweather-applet.h"
+
+#define MAX_CONSECUTIVE_FAULTS (3)
+
+static void about_cb (GtkAction      *action,
+		      MateWeatherApplet *gw_applet)
+{
+
+    mateweather_about_run (gw_applet);
+}
+
+static void help_cb (GtkAction      *action,
+		     MateWeatherApplet *gw_applet)
+{
+    GError *error = NULL;
+
+    gtk_show_uri_on_window (NULL,
+                            "help:mateweather",
+                            gtk_get_current_event_time (),
+                            &error);
+
+    if (error) {
+	GtkWidget *dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+						    _("There was an error displaying help: %s"), error->message);
+	g_signal_connect (dialog, "response",
+	                  G_CALLBACK (gtk_widget_destroy),
+	                  NULL);
+	gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+	gtk_window_set_screen (GTK_WINDOW (dialog), gtk_widget_get_screen (GTK_WIDGET (gw_applet->applet)));
+	gtk_widget_show (dialog);
+        g_error_free (error);
+        error = NULL;
+    }
+}
+
+static void pref_cb (GtkAction      *action,
+		     MateWeatherApplet *gw_applet)
+{
+   if (gw_applet->pref_dialog) {
+	gtk_window_present (GTK_WINDOW (gw_applet->pref_dialog));
+   } else {
+	gw_applet->pref_dialog = mateweather_pref_new(gw_applet);
+	g_object_add_weak_pointer(G_OBJECT(gw_applet->pref_dialog),
+				  (gpointer *)&(gw_applet->pref_dialog));
+	gtk_widget_show_all (gw_applet->pref_dialog);
+   }
+}
+
+static void details_cb (GtkAction      *action,
+			MateWeatherApplet *gw_applet)
+{
+   if (gw_applet->details_dialog) {
+	gtk_window_present (GTK_WINDOW (gw_applet->details_dialog));
+   } else {
+	gw_applet->details_dialog = mateweather_dialog_new(gw_applet);
+	g_object_add_weak_pointer(G_OBJECT(gw_applet->details_dialog),
+				  (gpointer *)&(gw_applet->details_dialog));
+	mateweather_dialog_update (MATEWEATHER_DIALOG (gw_applet->details_dialog));
+	gtk_widget_show (gw_applet->details_dialog);
+   }
+}
+
+static void update_cb (GtkAction      *action,
+		       MateWeatherApplet *gw_applet)
+{
+    mateweather_update (gw_applet);
+}
+
+static const GtkActionEntry weather_applet_menu_actions [] = {
+	{ "Details", NULL, N_("_Details"),
+	  NULL, NULL,
+	  G_CALLBACK (details_cb) },
+	{ "Update", "view-refresh", N_("_Update"),
+	  NULL, NULL,
+	  G_CALLBACK (update_cb) },
+	{ "Props", "document-properties", N_("_Preferences"),
+	  NULL, NULL,
+	  G_CALLBACK (pref_cb) },
+	{ "Help", "help-browser", N_("_Help"),
+	  NULL, NULL,
+	  G_CALLBACK (help_cb) },
+	{ "About", "help-about", N_("_About"),
+	  NULL, NULL,
+	  G_CALLBACK (about_cb) }
+};
+
+static void
+place_widgets (MateWeatherApplet *gw_applet)
+{
+    GtkRequisition req;
+    int total_size = 0;
+    gboolean horizontal = FALSE;
+    int panel_size = (int) gw_applet->size;
+    const gchar *temp = NULL;
+    const gchar *icon_name = NULL;
+
+    switch (gw_applet->orient) {
+	case MATE_PANEL_APPLET_ORIENT_LEFT:
+	case MATE_PANEL_APPLET_ORIENT_RIGHT:
+	    horizontal = FALSE;
+	    break;
+	case MATE_PANEL_APPLET_ORIENT_UP:
+	case MATE_PANEL_APPLET_ORIENT_DOWN:
+	    horizontal = TRUE;
+	    break;
+    }
+
+    /* Create the weather icon */
+    if ((gw_applet->mateweather_info) && ((icon_name = weather_info_get_icon_name (gw_applet->mateweather_info)) != NULL)) {
+        gw_applet->image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
+    } else {
+        gw_applet->image = gtk_image_new_from_icon_name ("weather-storm", GTK_ICON_SIZE_BUTTON);;
+    }
+    gtk_widget_show (gw_applet->image);
+    gtk_widget_get_preferred_size (gw_applet->image, &req, NULL);
+    if (horizontal)
+        total_size += req.height;
+    else
+        total_size += req.width;
+
+    /* Update temperature text */
+    if ((gw_applet->mateweather_info != NULL) && ((temp = weather_info_get_temp_summary (gw_applet->mateweather_info)) != NULL))
+        gw_applet->label = gtk_label_new (temp);
+    else
+        gw_applet->label = gtk_label_new(_("?"));
+
+    /* Check the label size to determine box layout */
+    gtk_widget_show (gw_applet->label);
+    gtk_widget_get_preferred_size (gw_applet->label, &req, NULL);
+    if (horizontal)
+        total_size += req.height;
+    else
+        total_size += req.width;
+
+    /* Pack the box */
+    if (gw_applet->box)
+        gtk_widget_destroy (gw_applet->box);
+
+    if (horizontal && (total_size <= panel_size))
+        gw_applet->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+    else if (horizontal && (total_size > panel_size))
+        gw_applet->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
+    else if (!horizontal && (total_size <= panel_size))
+        gw_applet->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
+    else
+        gw_applet->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+
+    /* better for vertical panels */
+    if (horizontal)
+        gtk_widget_set_valign (gw_applet->box, GTK_ALIGN_CENTER);
+    else
+        gtk_widget_set_halign (gw_applet->box, GTK_ALIGN_CENTER);
+
+    /* Rebuild the applet it's visual area */
+    gtk_container_add (GTK_CONTAINER (gw_applet->applet), gw_applet->box);
+    gtk_box_pack_start (GTK_BOX (gw_applet->box), gw_applet->image, TRUE, TRUE, 0);
+    gtk_box_pack_start (GTK_BOX (gw_applet->box), gw_applet->label, TRUE, TRUE, 0);
+
+    gtk_widget_show_all (GTK_WIDGET (gw_applet->applet));
+}
+
+static void change_orient_cb (MatePanelApplet *w, MatePanelAppletOrient o, gpointer data)
+{
+    MateWeatherApplet *gw_applet = (MateWeatherApplet *)data;
+
+    gw_applet->orient = o;
+    place_widgets(gw_applet);
+    return;
+}
+
+static void size_allocate_cb(MatePanelApplet *w, GtkAllocation *allocation, gpointer data)
+{
+    guint size;
+    MateWeatherApplet *gw_applet = (MateWeatherApplet *)data;
+
+    switch (gw_applet->orient) {
+      case MATE_PANEL_APPLET_ORIENT_LEFT:
+      case MATE_PANEL_APPLET_ORIENT_RIGHT:
+        size = (guint) allocation->width;
+        break;
+
+      default:
+        size = (guint) allocation->height;
+    }
+
+    if (gw_applet->size == size)
+      return;
+
+    gw_applet->size = size;
+    place_widgets (gw_applet);
+}
+
+static gboolean clicked_cb (GtkWidget *widget, GdkEventButton *ev, gpointer data)<--- Parameter 'ev' can be declared as pointer to const
+{
+    MateWeatherApplet *gw_applet = data;
+
+    if ((ev == NULL) || (ev->button != 1))
+        return FALSE;
+
+    if (ev->type == GDK_BUTTON_PRESS) {
+	if (!gw_applet->details_dialog)
+		details_cb (NULL, gw_applet);
+	else
+		gtk_widget_destroy (GTK_WIDGET (gw_applet->details_dialog));
+
+	return TRUE;
+    }
+
+    return FALSE;
+}
+
+static gboolean
+key_press_cb (GtkWidget *widget, GdkEventKey *event, MateWeatherApplet *gw_applet)<--- Parameter 'event' can be declared as pointer to const
+{
+	switch (event->keyval) {
+	case GDK_KEY_u:
+		if (event->state == GDK_CONTROL_MASK) {
+			mateweather_update (gw_applet);
+			return TRUE;
+		}
+		break;
+	case GDK_KEY_d:
+		if (event->state == GDK_CONTROL_MASK) {
+			details_cb (NULL, gw_applet);
+			return TRUE;
+		}
+		break;
+	case GDK_KEY_KP_Enter:
+	case GDK_KEY_ISO_Enter:
+	case GDK_KEY_3270_Enter:
+	case GDK_KEY_Return:
+	case GDK_KEY_space:
+	case GDK_KEY_KP_Space:
+		details_cb (NULL, gw_applet);
+		return TRUE;
+	default:
+		break;
+	}
+
+	return FALSE;
+
+}
+
+static void
+network_changed (GNetworkMonitor *monitor, gboolean available, MateWeatherApplet *gw_applet)
+{
+    if (available) {
+        mateweather_update (gw_applet);
+    }
+}
+
+static void
+applet_destroy (GtkWidget *widget, MateWeatherApplet *gw_applet)
+{
+    GNetworkMonitor *monitor;
+
+    if (gw_applet->pref_dialog)
+       gtk_widget_destroy (gw_applet->pref_dialog);
+
+    if (gw_applet->details_dialog)
+       gtk_widget_destroy (gw_applet->details_dialog);
+
+    if (gw_applet->timeout_tag != 0) {
+       g_source_remove (gw_applet->timeout_tag);
+       gw_applet->timeout_tag = 0;
+    }
+
+    if (gw_applet->suncalc_timeout_tag != 0) {
+       g_source_remove (gw_applet->suncalc_timeout_tag);
+       gw_applet->suncalc_timeout_tag = 0;
+    }
+
+    if (gw_applet->settings) {
+       g_object_unref (gw_applet->settings);
+       gw_applet->settings = NULL;
+    }
+
+    monitor = g_network_monitor_get_default ();
+    g_signal_handlers_disconnect_by_func (monitor,
+                                          G_CALLBACK (network_changed),
+                                          gw_applet);
+
+    weather_info_abort (gw_applet->mateweather_info);
+}
+
+void mateweather_applet_create (MateWeatherApplet *gw_applet)
+{
+    GtkActionGroup *action_group;
+    AtkObject      *atk_obj;
+    GNetworkMonitor*monitor;
+
+    gw_applet->mateweather_pref.location = NULL;
+    gw_applet->mateweather_pref.show_notifications = FALSE;
+    gw_applet->mateweather_pref.update_interval = 1800;
+    gw_applet->mateweather_pref.update_enabled = TRUE;
+    gw_applet->mateweather_pref.detailed = FALSE;
+    gw_applet->mateweather_pref.radar_enabled = TRUE;
+    gw_applet->mateweather_pref.temperature_unit = TEMP_UNIT_INVALID;
+    gw_applet->mateweather_pref.speed_unit = SPEED_UNIT_INVALID;
+    gw_applet->mateweather_pref.pressure_unit = PRESSURE_UNIT_INVALID;
+    gw_applet->mateweather_pref.distance_unit = DISTANCE_UNIT_INVALID;
+
+    mate_panel_applet_set_flags (gw_applet->applet, MATE_PANEL_APPLET_EXPAND_MINOR);
+
+#ifndef ENABLE_IN_PROCESS
+    g_set_application_name (_("Weather Report"));
+#endif
+
+    gtk_window_set_default_icon_name ("weather-storm");
+
+    g_signal_connect (gw_applet->applet, "change-orient",
+                      G_CALLBACK (change_orient_cb),
+                      gw_applet);
+
+    g_signal_connect (gw_applet->applet, "size-allocate",
+                      G_CALLBACK (size_allocate_cb),
+                      gw_applet);
+
+    g_signal_connect (gw_applet->applet, "destroy",
+                      G_CALLBACK (applet_destroy),
+                      gw_applet);
+
+    g_signal_connect (gw_applet->applet, "button-press-event",
+                      G_CALLBACK(clicked_cb),<--- You might need to cast the function pointer here
+                      gw_applet);
+
+    g_signal_connect (gw_applet->applet, "key-press-event",
+                      G_CALLBACK (key_press_cb),<--- You might need to cast the function pointer here
+                      gw_applet);
+
+    gtk_widget_set_tooltip_text (GTK_WIDGET(gw_applet->applet), _("MATE Weather"));
+
+    atk_obj = gtk_widget_get_accessible (GTK_WIDGET (gw_applet->applet));
+    if (GTK_IS_ACCESSIBLE (atk_obj))
+	   atk_object_set_name (atk_obj, _("MATE Weather"));
+
+    gw_applet->size = mate_panel_applet_get_size (gw_applet->applet);
+
+    gw_applet->orient = mate_panel_applet_get_orient (gw_applet->applet);
+
+    action_group = gtk_action_group_new ("MateWeather Applet Actions");
+    gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+    gtk_action_group_add_actions (action_group,
+				  weather_applet_menu_actions,
+				  G_N_ELEMENTS (weather_applet_menu_actions),
+				  gw_applet);
+    mate_panel_applet_setup_menu_from_resource (gw_applet->applet,
+                                                WEATHER_RESOURCE_PATH "mateweather-applet-menu.xml",
+                                                action_group);
+
+    if (mate_panel_applet_get_locked_down (gw_applet->applet)) {
+	    GtkAction *action;
+
+	    action = gtk_action_group_get_action (action_group, "Props");
+	    gtk_action_set_visible (action, FALSE);
+    }
+    g_object_unref (action_group);
+
+    place_widgets(gw_applet);
+
+    monitor = g_network_monitor_get_default();
+    g_signal_connect (monitor, "network-changed",
+                      G_CALLBACK (network_changed),
+                      gw_applet);
+}
+
+gint timeout_cb (gpointer data)
+{
+    MateWeatherApplet *gw_applet = (MateWeatherApplet *)data;
+
+    mateweather_update(gw_applet);
+    return 0;  /* Do not repeat timeout (will be reset by mateweather_update) */
+}
+
+static void
+update_finish (WeatherInfo *info, gpointer data)
+{
+    static int gw_fault_counter = 0;
+#ifdef HAVE_LIBNOTIFY
+    char *message, *detail;
+#endif
+    MateWeatherApplet *gw_applet = (MateWeatherApplet *)data;
+
+    /* Update timer */
+    if (gw_applet->timeout_tag > 0)
+        g_source_remove(gw_applet->timeout_tag);
+    if (gw_applet->mateweather_pref.update_enabled)
+    {
+        gint nxtSunEvent;
+
+        gw_applet->timeout_tag
+            = g_timeout_add_seconds ((guint) gw_applet->mateweather_pref.update_interval,
+                                     timeout_cb, gw_applet);
+
+        if ((info != NULL) && ((nxtSunEvent = weather_info_next_sun_event (info)) >= 0))
+        {
+            gw_applet->suncalc_timeout_tag
+                = g_timeout_add_seconds ((guint) nxtSunEvent,
+                                         suncalc_timeout_cb, gw_applet);
+        }
+    }
+
+    if ((info != NULL) && weather_info_is_valid (info))
+    {
+        char *s;
+
+        gw_fault_counter = 0;
+
+        /* update tooltip */
+        s = weather_info_get_weather_summary (info);
+        gtk_widget_set_tooltip_text (GTK_WIDGET (gw_applet->applet), s);
+        g_free (s);
+
+        /* Update dialog -- if one is present */
+        if (gw_applet->details_dialog)
+            mateweather_dialog_update (MATEWEATHER_DIALOG (gw_applet->details_dialog));
+
+        /* update applet */
+        place_widgets (gw_applet);
+
+#ifdef HAVE_LIBNOTIFY
+        if (gw_applet->mateweather_pref.show_notifications)
+        {
+		    NotifyNotification *n;
+
+		    /* Show notifications if possible */
+	            if (!notify_is_initted ())
+	                notify_init (_("Weather Forecast"));
+
+		    if (notify_is_initted ())
+		    {
+			 GError *error = NULL;
+                         const char *icon;
+
+	           	 /* Show notification */
+	           	 message = g_strdup_printf ("%s: %s",
+					 weather_info_get_location_name (info),
+					 weather_info_get_sky (info));
+	           	 detail = g_strdup_printf (_("City: %s\nSky: %s\nTemperature: %s"),
+			                           weather_info_get_location_name (info),
+			                           weather_info_get_sky (info),
+			                           weather_info_get_temp_summary (info));
+
+			 icon = weather_info_get_icon_name (gw_applet->mateweather_info);
+			 if (icon == NULL)
+				 icon = "stock-unknown";
+
+			 n = notify_notification_new (message, detail, icon);
+
+		   	 notify_notification_show (n, &error);
+			 if (error)
+			 {
+				 g_warning ("%s", error->message);
+				 g_error_free (error);
+			 }
+
+		   	 g_free (message);
+		   	 g_free (detail);
+		    }
+        }
+#endif
+    } else {
+        if (gw_fault_counter >= MAX_CONSECUTIVE_FAULTS) {
+            gw_fault_counter = 0;
+
+            /* Update dialog -- if one is present */
+            if (gw_applet->details_dialog)
+                mateweather_dialog_update (MATEWEATHER_DIALOG (gw_applet->details_dialog));
+
+            /* update applet */
+            place_widgets (gw_applet);
+        } else {
+            /* there has been an error during retrival
+             * just update the fault counter
+             */
+             gw_fault_counter++;
+        }
+    }
+}
+
+gint suncalc_timeout_cb (gpointer data)
+{
+    WeatherInfo *info = ((MateWeatherApplet *)data)->mateweather_info;
+    update_finish(info, data);
+    return 0;  /* Do not repeat timeout (will be reset by update_finish) */
+}
+
+void mateweather_update (MateWeatherApplet *gw_applet)
+{
+    WeatherPrefs prefs;
+
+    gtk_widget_set_tooltip_text (GTK_WIDGET(gw_applet->applet),  _("Updating..."));
+
+    /* Set preferred forecast type */
+    prefs.type = gw_applet->mateweather_pref.detailed ? FORECAST_ZONE : FORECAST_STATE;
+
+    /* Set radar map retrieval option */
+    prefs.radar = gw_applet->mateweather_pref.radar_enabled;
+    prefs.radar_custom_url = (gw_applet->mateweather_pref.use_custom_radar_url &&
+    				gw_applet->mateweather_pref.radar) ?
+				gw_applet->mateweather_pref.radar : NULL;
+
+    /* Set the units */
+    prefs.temperature_unit = gw_applet->mateweather_pref.temperature_unit;
+    prefs.speed_unit = gw_applet->mateweather_pref.speed_unit;
+    prefs.pressure_unit = gw_applet->mateweather_pref.pressure_unit;
+    prefs.distance_unit = gw_applet->mateweather_pref.distance_unit;
+
+    /* Update current conditions */
+    if (gw_applet->mateweather_info &&
+    	weather_location_equal(weather_info_get_location(gw_applet->mateweather_info),
+    			       gw_applet->mateweather_pref.location)) {
+	weather_info_update(gw_applet->mateweather_info, &prefs,
+			    update_finish, gw_applet);
+    } else {
+        weather_info_free(gw_applet->mateweather_info);
+        gw_applet->mateweather_info = weather_info_new(gw_applet->mateweather_pref.location,
+						    &prefs,
+						    update_finish, gw_applet);
+    }
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/108.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/108.html new file mode 100644 index 00000000..59c628f4 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/108.html @@ -0,0 +1,997 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
/* $Id$ */
+
+/*
+ *  Papadimitriou Spiros <spapadim+@cs.cmu.edu>
+ *
+ *  This code released under the GNU GPL.
+ *  Read the file COPYING for more information.
+ *
+ *  Main status dialog
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif /* HAVE_CONFIG_H */
+
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <assert.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define MATEWEATHER_I_KNOW_THIS_IS_UNSTABLE
+
+#include "mateweather.h"
+#include "mateweather-applet.h"
+#include "mateweather-pref.h"
+#include "mateweather-dialog.h"
+
+struct _MateWeatherDialog {
+    GtkDialog  parent;
+
+    GtkWidget *weather_notebook;
+    GtkWidget *cond_location;
+    GtkWidget *cond_update;
+    GtkWidget *cond_cond;
+    GtkWidget *cond_sky;
+    GtkWidget *cond_temp;
+    GtkWidget *cond_dew;
+    GtkWidget *cond_humidity;
+    GtkWidget *cond_wind;
+    GtkWidget *cond_pressure;
+    GtkWidget *cond_vis;
+    GtkWidget *cond_apparent;
+    GtkWidget *cond_sunrise;
+    GtkWidget *cond_sunset;
+    GtkWidget *cond_image;
+    GtkWidget *forecast_text;
+    GtkWidget *radar_image;
+
+    MateWeatherApplet *applet;
+};
+
+enum {
+    PROP_0,
+    PROP_MATEWEATHER_APPLET,
+};
+
+G_DEFINE_TYPE (MateWeatherDialog, mateweather_dialog, GTK_TYPE_DIALOG);
+
+#define MONOSPACE_FONT_SCHEMA  "org.mate.interface"
+#define MONOSPACE_FONT_KEY     "monospace-font-name"
+
+static void
+response_cb (MateWeatherDialog *dialog,
+             gint               id,
+             gpointer           data)
+{
+    if (id == GTK_RESPONSE_OK) {
+        mateweather_update (dialog->applet);
+        mateweather_dialog_update (dialog);
+    } else {
+        gtk_widget_destroy (GTK_WIDGET (dialog));
+    }
+}
+
+static void
+link_cb (GtkButton *button,
+         gpointer   data)
+{
+    gtk_show_uri_on_window (NULL,
+                            "http://www.weather.com/",
+                            gtk_get_current_event_time (),
+                            NULL);
+}
+
+static gchar*
+replace_multiple_new_lines(gchar* s)
+{
+	gchar *prev_s = s;
+	gint count;
+	gint i;
+
+	if (s == NULL) {
+		return s;
+	}
+
+	for (;*s != '\0';s++) {
+
+		count = 0;
+
+		if (*s == '\n') {
+			s++;
+			while (*s == '\n' || *s == ' ') {
+				count++;
+				s++;
+			}
+		}
+		for (i = count; i > 1; i--) {
+			*(s - i) = ' ';
+		}
+	}
+	return prev_s;
+}
+
+static PangoFontDescription* get_system_monospace_font(void)
+{
+    PangoFontDescription *desc = NULL;
+    GSettings *settings;
+    char *name;
+
+    settings = g_settings_new (MONOSPACE_FONT_SCHEMA);
+    name = g_settings_get_string (settings, MONOSPACE_FONT_KEY);
+
+    if (name) {
+    	desc = pango_font_description_from_string (name);
+    	g_free (name);
+    }
+
+    g_object_unref (settings);
+
+    return desc;
+}
+
+static void
+override_widget_font (GtkWidget            *widget,
+                      PangoFontDescription *font)
+{
+    static gboolean provider_added = FALSE;
+    static GtkCssProvider *provider;
+    gchar          *css;
+    gchar          *family;
+    gchar          *weight;
+    const gchar    *style;
+    gchar          *size;
+
+    family = g_strdup_printf ("font-family: %s;", pango_font_description_get_family (font));
+
+    weight = g_strdup_printf ("font-weight: %d;", pango_font_description_get_weight (font));
+
+    if (pango_font_description_get_style (font) == PANGO_STYLE_NORMAL)
+        style = "font-style: normal;";
+    else if (pango_font_description_get_style (font) == PANGO_STYLE_ITALIC)
+        style = "font-style: italic;";
+    else
+        style = "font-style: oblique;";
+
+    size = g_strdup_printf ("font-size: %d%s;",
+                            pango_font_description_get_size (font) / PANGO_SCALE,
+                            pango_font_description_get_size_is_absolute (font) ? "px" : "pt");
+    if (!provider_added)
+        provider = gtk_css_provider_new ();
+
+    gtk_widget_set_name(GTK_WIDGET(widget), "MateWeatherAppletTextView");
+    css = g_strdup_printf ("#MateWeatherAppletTextView { %s %s %s %s }", family, weight, style, size);
+    gtk_css_provider_load_from_data (provider, css, -1, NULL);
+
+    if (!provider_added) {
+        gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (widget),
+                                                   GTK_STYLE_PROVIDER (provider),
+                                                   GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+        provider_added = TRUE;
+    }
+
+    g_free (css);
+    g_free (family);
+    g_free (weight);
+    g_free (size);
+}
+
+void
+mateweather_dialog_update (MateWeatherDialog *dialog)
+{
+    WeatherInfo *info;
+    gchar *forecast;
+    GtkTextBuffer *buffer;
+    PangoFontDescription *font_desc;
+    const gchar *icon_name;
+
+    /* Check for parallel network update in progress */
+    if (dialog->applet->mateweather_info == NULL)
+    	return;
+
+    info = dialog->applet->mateweather_info;
+
+    /* Update icon */
+    icon_name = weather_info_get_icon_name (info);
+    gtk_image_set_from_icon_name (GTK_IMAGE (dialog->cond_image),
+                                  icon_name, GTK_ICON_SIZE_DIALOG);
+
+    /* Update current condition fields and forecast */
+    gtk_label_set_text (GTK_LABEL (dialog->cond_location), weather_info_get_location_name (info));
+    gtk_label_set_text (GTK_LABEL (dialog->cond_update),   weather_info_get_update        (info));
+    gtk_label_set_text (GTK_LABEL (dialog->cond_cond),     weather_info_get_conditions    (info));
+    gtk_label_set_text (GTK_LABEL (dialog->cond_sky),      weather_info_get_sky           (info));
+    gtk_label_set_text (GTK_LABEL (dialog->cond_temp),     weather_info_get_temp          (info));
+    gtk_label_set_text (GTK_LABEL (dialog->cond_apparent), weather_info_get_apparent      (info));
+    gtk_label_set_text (GTK_LABEL (dialog->cond_dew),      weather_info_get_dew           (info));
+    gtk_label_set_text (GTK_LABEL (dialog->cond_humidity), weather_info_get_humidity      (info));
+    gtk_label_set_text (GTK_LABEL (dialog->cond_wind),     weather_info_get_wind          (info));
+    gtk_label_set_text (GTK_LABEL (dialog->cond_pressure), weather_info_get_pressure      (info));
+    gtk_label_set_text (GTK_LABEL (dialog->cond_vis),      weather_info_get_visibility    (info));
+    gtk_label_set_text (GTK_LABEL (dialog->cond_sunrise),  weather_info_get_sunrise       (info));
+    gtk_label_set_text (GTK_LABEL (dialog->cond_sunset),   weather_info_get_sunset        (info));
+
+    /* Update forecast */
+    if (dialog->applet->mateweather_pref.location->zone_valid) {
+	font_desc = get_system_monospace_font ();
+	if (font_desc) {
+            override_widget_font (dialog->forecast_text, font_desc);
+            pango_font_description_free (font_desc);
+	}
+
+        buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->forecast_text));
+        forecast = g_strdup (weather_info_get_forecast (dialog->applet->mateweather_info));
+        if (forecast) {
+            forecast = g_strstrip (replace_multiple_new_lines (forecast));
+            gtk_text_buffer_set_text (buffer, forecast, -1);
+            g_free (forecast);
+        } else {
+            gtk_text_buffer_set_text (buffer, _("Forecast not currently available for this location."), -1);
+        }
+        gtk_widget_show (gtk_notebook_get_nth_page (GTK_NOTEBOOK (dialog->weather_notebook), 1));
+    } else {
+        gtk_widget_hide (gtk_notebook_get_nth_page (GTK_NOTEBOOK (dialog->weather_notebook), 1));
+    }
+
+    /* Update radar map */
+    if (dialog->applet->mateweather_pref.radar_enabled) {
+        GdkPixbufAnimation *radar;
+
+	radar = weather_info_get_radar (info);
+        if (radar) {
+            gtk_image_set_from_animation (GTK_IMAGE (dialog->radar_image), radar);
+        }
+        gtk_widget_show (gtk_notebook_get_nth_page (GTK_NOTEBOOK (dialog->weather_notebook), 2));
+        gtk_window_set_default_size (GTK_WINDOW (dialog), 570, 440);
+    } else {
+        gtk_widget_hide (gtk_notebook_get_nth_page (GTK_NOTEBOOK (dialog->weather_notebook), 2));
+        gtk_window_set_default_size (GTK_WINDOW (dialog), 590, 340);
+    }
+}
+
+static void
+mateweather_dialog_set_property (GObject      *object,
+                                 guint         prop_id,
+                                 const GValue *value,
+                                 GParamSpec   *pspec)
+{
+    MateWeatherDialog *dialog;
+
+    dialog = MATEWEATHER_DIALOG (object);
+
+    switch (prop_id) {
+        case PROP_MATEWEATHER_APPLET:
+            dialog->applet = g_value_get_pointer (value);
+            break;
+        default:
+            /* We don't have any other property... */
+            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+            break;
+    }
+}
+
+static void
+mateweather_dialog_get_property (GObject    *object,
+                                 guint       prop_id,
+                                 GValue     *value,
+                                 GParamSpec *pspec)
+{
+    MateWeatherDialog *dialog;
+
+    dialog = MATEWEATHER_DIALOG (object);
+
+    switch (prop_id) {
+	case PROP_MATEWEATHER_APPLET:
+	    g_value_set_pointer (value, dialog->applet);
+	    break;
+        default:
+            /* We don't have any other property... */
+            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+            break;
+    }
+}
+
+static void
+mateweather_dialog_init (MateWeatherDialog *dialog)
+{
+    gtk_widget_init_template (GTK_WIDGET (dialog));
+}
+
+static GObject*
+mateweather_dialog_constructor (GType                  type,
+                                guint                  n_construct_params,
+                                GObjectConstructParam *construct_params)
+{
+    GObject *object;
+    MateWeatherDialog *self;
+
+    object = G_OBJECT_CLASS (mateweather_dialog_parent_class)->
+        constructor (type, n_construct_params, construct_params);
+    self = MATEWEATHER_DIALOG (object);
+
+    mateweather_dialog_update (self);
+
+    return object;
+}
+
+GtkWidget*
+mateweather_dialog_new (MateWeatherApplet *applet)
+{
+    return g_object_new(MATEWEATHER_TYPE_DIALOG,
+                        "mateweather-applet", applet,
+                        NULL);
+}
+
+static void
+mateweather_dialog_class_init (MateWeatherDialogClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+    GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+    object_class->set_property = mateweather_dialog_set_property;
+    object_class->get_property = mateweather_dialog_get_property;
+    object_class->constructor = mateweather_dialog_constructor;
+
+    /* This becomes an OBJECT property when MateWeatherApplet is redone */
+    g_object_class_install_property (object_class,
+                                     PROP_MATEWEATHER_APPLET,
+                                     g_param_spec_pointer ("mateweather-applet",
+                                                           "MateWeather Applet",
+                                                           "The MateWeather Applet",
+                                                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+    gtk_widget_class_set_template_from_resource (widget_class,
+                                                 WEATHER_RESOURCE_PATH "mateweather-dialog.ui");
+
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, weather_notebook);
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, cond_location);
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, cond_update);
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, cond_cond);
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, cond_sky);
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, cond_temp);
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, cond_dew);
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, cond_humidity);
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, cond_wind);
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, cond_pressure);
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, cond_vis);
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, cond_apparent);
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, cond_sunrise);
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, cond_sunset);
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, cond_image);
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, forecast_text);
+    gtk_widget_class_bind_template_child (widget_class, MateWeatherDialog, radar_image);
+
+    gtk_widget_class_bind_template_callback (widget_class, response_cb);
+    gtk_widget_class_bind_template_callback (widget_class, link_cb);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/109.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/109.html new file mode 100644 index 00000000..9ee1e63b --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/109.html @@ -0,0 +1,2797 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
/* $Id$ */
+
+/*
+ *  Papadimitriou Spiros <spapadim+@cs.cmu.edu>
+ *
+ *  This code released under the GNU GPL.
+ *  Read the file COPYING for more information.
+ *
+ *  Preferences dialog
+ *
+ */
+
+/* Radar map on by default. */
+#define RADARMAP
+
+#ifdef HAVE_CONFIG_H
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <assert.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <ctype.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <locale.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define MATEWEATHER_I_KNOW_THIS_IS_UNSTABLE
+
+#include <libmateweather/mateweather-xml.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "mateweather.h"
+#include "mateweather-pref.h"
+#include "mateweather-applet.h"
+#include "mateweather-dialog.h"
+
+#define NEVER_SENSITIVE "never_sensitive"
+
+struct _MateWeatherPrefPrivate {
+	GtkWidget* notebook;
+
+	GtkWidget* basic_temp_combo;
+	GtkWidget* basic_speed_combo;
+	GtkWidget* basic_dist_combo;
+	GtkWidget* basic_pres_combo;
+	GtkWidget* find_entry;
+	GtkWidget* find_next_btn;
+
+#ifdef RADARMAP
+	GtkWidget* basic_radar_btn;
+	GtkWidget* basic_radar_url_btn;
+	GtkWidget* basic_radar_url_hbox;
+	GtkWidget* basic_radar_url_entry;
+#endif /* RADARMAP */
+
+#ifdef HAVE_LIBNOTIFY
+	GtkWidget* basic_show_notifications_btn;
+#endif /* HAVE_LIBNOTIFY */
+
+	GtkWidget* basic_update_spin;
+	GtkWidget* basic_update_btn;
+	GtkWidget* tree;
+
+	GtkTreeModel* model;
+
+	MateWeatherApplet* applet;
+};
+
+enum {
+	PROP_0,
+	PROP_MATEWEATHER_APPLET,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (MateWeatherPref, mateweather_pref, GTK_TYPE_DIALOG);
+
+/* set sensitive and setup NEVER_SENSITIVE appropriately */
+static void hard_set_sensitive(GtkWidget* w, gboolean sensitivity)
+{
+	gtk_widget_set_sensitive(w, sensitivity);
+	g_object_set_data(G_OBJECT(w), NEVER_SENSITIVE, GINT_TO_POINTER(!sensitivity));
+}
+
+/* set sensitive, but always insensitive if NEVER_SENSITIVE is set */
+static void soft_set_sensitive(GtkWidget* w, gboolean sensitivity)
+{
+	if (g_object_get_data(G_OBJECT(w), NEVER_SENSITIVE))
+	{
+		gtk_widget_set_sensitive(w, FALSE);
+	}
+	else
+	{
+		gtk_widget_set_sensitive(w, sensitivity);
+	}
+}
+
+/* sets up ATK Relation between the widgets */
+static void add_atk_relation(GtkWidget* widget1, GtkWidget* widget2, AtkRelationType type)
+{
+	AtkObject* atk_obj1;
+	AtkObject* atk_obj2;
+	AtkRelationSet* relation_set;
+	AtkRelation* relation;
+
+	atk_obj1 = gtk_widget_get_accessible(widget1);
+
+	if (!GTK_IS_ACCESSIBLE(atk_obj1))
+	{
+		return;
+	}
+
+	atk_obj2 = gtk_widget_get_accessible(widget2);
+
+	relation_set = atk_object_ref_relation_set(atk_obj1);
+	relation = atk_relation_new(&atk_obj2, 1, type);
+	atk_relation_set_add(relation_set, relation);
+	g_object_unref(G_OBJECT(relation));
+}
+
+/* sets accessible name and description */
+void set_access_namedesc(GtkWidget* widget, const gchar* name, const gchar* desc)
+{
+	AtkObject* obj = gtk_widget_get_accessible(widget);
+
+	if (!GTK_IS_ACCESSIBLE(obj))
+	{
+		return;
+	}
+
+	if (desc)
+	{
+		atk_object_set_description(obj, desc);
+	}
+
+	if (name)
+	{
+		atk_object_set_name(obj, name);
+	}
+}
+
+/* sets accessible name, description, CONTROLLED_BY
+ * and CONTROLLER_FOR relations for the components
+ * in mateweather preference dialog.
+ */
+static void mateweather_pref_set_accessibility(MateWeatherPref* pref)
+{
+    /* Relation between components in General page */
+    add_atk_relation(pref->priv->basic_update_btn, pref->priv->basic_update_spin, ATK_RELATION_CONTROLLER_FOR);
+    add_atk_relation(pref->priv->basic_radar_btn, pref->priv->basic_radar_url_btn, ATK_RELATION_CONTROLLER_FOR);
+    add_atk_relation(pref->priv->basic_radar_btn, pref->priv->basic_radar_url_entry, ATK_RELATION_CONTROLLER_FOR);
+
+    add_atk_relation(pref->priv->basic_update_spin, pref->priv->basic_update_btn, ATK_RELATION_CONTROLLED_BY);
+    add_atk_relation(pref->priv->basic_radar_url_btn, pref->priv->basic_radar_btn, ATK_RELATION_CONTROLLED_BY);
+    add_atk_relation(pref->priv->basic_radar_url_entry, pref->priv->basic_radar_btn, ATK_RELATION_CONTROLLED_BY);
+
+    /* Accessible Name and Description for the components in Preference Dialog */
+    set_access_namedesc(pref->priv->tree, _("Location view"), _("Select Location from the list"));
+    set_access_namedesc(pref->priv->basic_update_spin, _("Update spin button"), _("Spinbutton for updating"));
+    set_access_namedesc(pref->priv->basic_radar_url_entry, _("Address Entry"), _("Enter the URL"));
+}
+
+/* Update pref dialog from mateweather_pref */
+static gboolean update_dialog(MateWeatherPref* pref)
+{
+    MateWeatherApplet* gw_applet = pref->priv->applet;
+
+    g_return_val_if_fail(gw_applet->mateweather_pref.location != NULL, FALSE);
+
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(pref->priv->basic_update_spin), gw_applet->mateweather_pref.update_interval / 60);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pref->priv->basic_update_btn), gw_applet->mateweather_pref.update_enabled);
+    soft_set_sensitive(pref->priv->basic_update_spin, gw_applet->mateweather_pref.update_enabled);
+
+    gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->basic_temp_combo),
+                              (gint) gw_applet->mateweather_pref.temperature_unit - 2);
+
+    gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->basic_speed_combo),
+                              (gint) gw_applet->mateweather_pref.speed_unit - 2);
+
+    gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->basic_pres_combo),
+                              (gint) gw_applet->mateweather_pref.pressure_unit - 2);
+
+    gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->basic_dist_combo),
+                              (gint) gw_applet->mateweather_pref.distance_unit - 2);
+
+	#ifdef RADARMAP
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pref->priv->basic_radar_btn), gw_applet->mateweather_pref.radar_enabled);
+
+		soft_set_sensitive(pref->priv->basic_radar_url_btn, gw_applet->mateweather_pref.radar_enabled);
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pref->priv->basic_radar_url_btn), gw_applet->mateweather_pref.use_custom_radar_url);
+		soft_set_sensitive(pref->priv->basic_radar_url_hbox, gw_applet->mateweather_pref.radar_enabled);
+
+		if (gw_applet->mateweather_pref.radar)
+		{
+			gtk_entry_set_text(GTK_ENTRY(pref->priv->basic_radar_url_entry), gw_applet->mateweather_pref.radar);
+		}
+
+	#endif /* RADARMAP */
+
+	#ifdef HAVE_LIBNOTIFY
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pref->priv->basic_show_notifications_btn), gw_applet->mateweather_pref.show_notifications);
+	#endif
+    return TRUE;
+}
+
+static void
+on_row_selected (GtkTreeSelection *selection,
+                 MateWeatherPref  *pref)
+{
+	MateWeatherApplet* gw_applet = pref->priv->applet;
+	GtkTreeModel* model;
+	WeatherLocation* loc = NULL;
+	GtkTreeIter iter;
+
+	if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+		return;
+
+	gtk_tree_model_get(model, &iter, MATEWEATHER_XML_COL_POINTER, &loc, -1);
+
+	if (!loc)
+	{
+		return;
+	}
+
+	g_settings_set_string (gw_applet->settings, "location1", loc->code);
+	g_settings_set_string (gw_applet->settings, "location2", loc->zone);
+	g_settings_set_string (gw_applet->settings, "location3", loc->radar);
+	g_settings_set_string (gw_applet->settings, "location4", loc->name);
+	g_settings_set_string (gw_applet->settings, "coordinates", loc->coordinates);
+
+	if (gw_applet->mateweather_pref.location)
+	{
+		weather_location_free(gw_applet->mateweather_pref.location);
+	}
+
+	gw_applet->mateweather_pref.location =
+		weather_location_new (loc->name, loc->code, loc->zone, loc->radar, loc->coordinates,
+			NULL, NULL);
+
+	mateweather_update(gw_applet);
+}
+
+static gboolean compare_location(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, gpointer user_data)
+{
+    MateWeatherPref* pref = user_data;
+    WeatherLocation* loc;
+    GtkTreeView* view;
+
+    gtk_tree_model_get(model, iter, MATEWEATHER_XML_COL_POINTER, &loc, -1);
+
+    if (!loc)
+    {
+		return FALSE;
+	}
+
+    if (!weather_location_equal(loc, pref->priv->applet->mateweather_pref.location))
+    {
+		return FALSE;
+	}
+
+    view = GTK_TREE_VIEW(pref->priv->tree);
+    gtk_tree_view_expand_to_path(view, path);
+    gtk_tree_view_set_cursor(view, path, NULL, FALSE);
+    gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, 0.5, 0.5);
+
+    return TRUE;
+}
+
+static void load_locations(MateWeatherPref* pref)
+{
+	GtkTreeView* tree = GTK_TREE_VIEW(pref->priv->tree);
+	GtkTreeViewColumn* column;
+	GtkCellRenderer* cell_renderer;
+
+	/* Add a column for the locations */
+	cell_renderer = gtk_cell_renderer_text_new();
+	column = gtk_tree_view_column_new_with_attributes("not used", cell_renderer, "text", MATEWEATHER_XML_COL_LOC, NULL);
+	gtk_tree_view_append_column(tree, column);
+	gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree), column);
+
+	/* load locations from xml file */
+	pref->priv->model = mateweather_xml_load_locations();
+
+	if (!pref->priv->model)
+	{
+		GtkWidget* d = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Failed to load the Locations XML database.  Please report this as a bug."));
+		gtk_dialog_run(GTK_DIALOG(d));
+		gtk_widget_destroy(d);
+	}
+
+	gtk_tree_view_set_model (tree, pref->priv->model);
+
+	if (pref->priv->applet->mateweather_pref.location)
+	{
+		/* Select the current (default) location */
+		gtk_tree_model_foreach(GTK_TREE_MODEL(pref->priv->model), compare_location, pref);
+	}
+}
+
+static void
+on_show_notifications_toggled (GtkToggleButton *button,
+                               MateWeatherPref *pref)
+{
+	MateWeatherApplet* gw_applet = pref->priv->applet;
+
+	gboolean toggled = gtk_toggle_button_get_active(button);
+
+	if (toggled != gw_applet->mateweather_pref.show_notifications)
+	{
+		/* sync with mateweather_pref struct */
+		gw_applet->mateweather_pref.show_notifications = toggled;
+
+		/* sync with gsettings */
+		g_settings_set_boolean (gw_applet->settings, "show-notifications", toggled);
+	}
+}
+
+static void
+on_auto_update_toggled (GtkToggleButton *button,
+                        MateWeatherPref *pref)
+{
+	MateWeatherApplet* gw_applet = pref->priv->applet;
+	gboolean toggled;
+	gint nxtSunEvent;
+
+	toggled = gtk_toggle_button_get_active(button);
+	gw_applet->mateweather_pref.update_enabled = toggled;
+	soft_set_sensitive(pref->priv->basic_update_spin, toggled);
+	g_settings_set_boolean (gw_applet->settings, "auto-update", toggled);
+
+	if (gw_applet->timeout_tag > 0)
+	{
+		g_source_remove(gw_applet->timeout_tag);
+	}
+
+	if (gw_applet->suncalc_timeout_tag > 0)
+	{
+		g_source_remove(gw_applet->suncalc_timeout_tag);
+	}
+
+	if (gw_applet->mateweather_pref.update_enabled)
+	{
+		gw_applet->timeout_tag
+			= g_timeout_add_seconds ((guint) gw_applet->mateweather_pref.update_interval,
+		                                 timeout_cb, gw_applet);
+
+		nxtSunEvent = weather_info_next_sun_event (gw_applet->mateweather_info);
+		if (nxtSunEvent >= 0)
+		{
+			gw_applet->suncalc_timeout_tag
+				= g_timeout_add_seconds ((guint) nxtSunEvent,
+				                         suncalc_timeout_cb, gw_applet);
+		}
+	}
+}
+
+static void
+on_temp_combo_changed (GtkComboBox     *combo,
+                       MateWeatherPref *pref)
+{
+	MateWeatherApplet* gw_applet = pref->priv->applet;
+	TempUnit new_unit, old_unit;
+
+	g_return_if_fail(gw_applet != NULL);
+
+	new_unit = gtk_combo_box_get_active(combo) + 2;
+
+	old_unit = gw_applet->mateweather_pref.temperature_unit;
+
+	if (new_unit == old_unit)
+	{
+		return;
+	}
+
+	gw_applet->mateweather_pref.temperature_unit = new_unit;
+
+	g_settings_set_enum (gw_applet->settings, "temperature-unit", new_unit);
+
+	gtk_label_set_text(GTK_LABEL(gw_applet->label), weather_info_get_temp_summary(gw_applet->mateweather_info));
+
+	if (gw_applet->details_dialog)
+	{
+		mateweather_dialog_update(MATEWEATHER_DIALOG(gw_applet->details_dialog));
+	}
+}
+
+static void
+on_speed_combo_changed (GtkComboBox     *combo,
+                        MateWeatherPref *pref)
+{
+	MateWeatherApplet* gw_applet = pref->priv->applet;
+	SpeedUnit new_unit, old_unit;
+
+	g_return_if_fail(gw_applet != NULL);
+
+	new_unit = gtk_combo_box_get_active(combo) + 2;
+
+	old_unit = gw_applet->mateweather_pref.speed_unit;
+
+	if (new_unit == old_unit)
+	{
+		return;
+	}
+
+	gw_applet->mateweather_pref.speed_unit = new_unit;
+
+	g_settings_set_enum (gw_applet->settings, "speed-unit", new_unit);
+
+	if (gw_applet->details_dialog)
+	{
+		mateweather_dialog_update(MATEWEATHER_DIALOG(gw_applet->details_dialog));
+	}
+}
+
+static void
+on_pres_combo_changed (GtkComboBox     *combo,
+                       MateWeatherPref *pref)
+{
+	MateWeatherApplet* gw_applet = pref->priv->applet;
+	PressureUnit new_unit, old_unit;
+
+	g_return_if_fail(gw_applet != NULL);
+
+	new_unit = gtk_combo_box_get_active(combo) + 2;
+
+	old_unit = gw_applet->mateweather_pref.pressure_unit;
+
+	if (new_unit == old_unit)
+	{
+		return;
+	}
+
+	gw_applet->mateweather_pref.pressure_unit = new_unit;
+
+	g_settings_set_enum (gw_applet->settings, "pressure-unit", new_unit);
+
+	if (gw_applet->details_dialog)
+	{
+		mateweather_dialog_update(MATEWEATHER_DIALOG(gw_applet->details_dialog));
+	}
+}
+
+static void
+on_dist_combo_changed (GtkComboBox     *combo,
+                       MateWeatherPref *pref)
+{
+	MateWeatherApplet* gw_applet = pref->priv->applet;
+	DistanceUnit new_unit, old_unit;
+
+	g_return_if_fail(gw_applet != NULL);
+
+	new_unit = gtk_combo_box_get_active(combo) + 2;
+
+	old_unit = gw_applet->mateweather_pref.distance_unit;
+
+	if (new_unit == old_unit)
+	{
+		return;
+	}
+
+	gw_applet->mateweather_pref.distance_unit = new_unit;
+
+	g_settings_set_enum (gw_applet->settings, "distance-unit", new_unit);
+
+	if (gw_applet->details_dialog)
+	{
+		mateweather_dialog_update(MATEWEATHER_DIALOG(gw_applet->details_dialog));
+	}
+}
+
+static void
+on_radar_toggled (GtkToggleButton *button,
+                  MateWeatherPref *pref)
+{
+    MateWeatherApplet* gw_applet = pref->priv->applet;
+    gboolean toggled;
+
+    toggled = gtk_toggle_button_get_active(button);
+    gw_applet->mateweather_pref.radar_enabled = toggled;
+    g_settings_set_boolean (gw_applet->settings, "enable-radar-map", toggled);
+    soft_set_sensitive(pref->priv->basic_radar_url_btn, toggled);
+
+    if (toggled == FALSE || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (pref->priv->basic_radar_url_btn)) == TRUE)
+    {
+		soft_set_sensitive (pref->priv->basic_radar_url_hbox, toggled);
+	}
+}
+
+static void
+on_use_radar_url_toggled (GtkToggleButton *button,
+                          MateWeatherPref *pref)
+{
+    MateWeatherApplet* gw_applet = pref->priv->applet;
+    gboolean toggled;
+
+    toggled = gtk_toggle_button_get_active(button);
+    gw_applet->mateweather_pref.use_custom_radar_url = toggled;
+    g_settings_set_boolean (gw_applet->settings, "use-custom-radar-url", toggled);
+    soft_set_sensitive(pref->priv->basic_radar_url_hbox, toggled);
+}
+
+static gboolean
+on_radar_url_changed  (GtkWidget       *widget,
+                       GdkEventFocus   *event,
+                       MateWeatherPref *pref)
+{
+	MateWeatherApplet* gw_applet = pref->priv->applet;
+	gchar *text;
+
+	text = gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1);
+
+	if (gw_applet->mateweather_pref.radar)
+	{
+		g_free(gw_applet->mateweather_pref.radar);
+	}
+
+	if (text)
+	{
+		gw_applet->mateweather_pref.radar = g_strdup(text);
+		g_free (text);
+	}
+	else
+	{
+		gw_applet->mateweather_pref.radar = NULL;
+	}
+
+	g_settings_set_string (gw_applet->settings, "radar", gw_applet->mateweather_pref.radar);
+
+	return FALSE;
+}
+
+static void
+on_update_interval_changed (GtkSpinButton   *button,
+                            MateWeatherPref *pref)
+{
+	MateWeatherApplet* gw_applet = pref->priv->applet;
+
+	gw_applet->mateweather_pref.update_interval = gtk_spin_button_get_value_as_int(button)*60;
+	g_settings_set_int (gw_applet->settings, "auto-update-interval", gw_applet->mateweather_pref.update_interval);
+
+	if (gw_applet->timeout_tag > 0)
+	{
+		g_source_remove(gw_applet->timeout_tag);
+	}
+
+	if (gw_applet->mateweather_pref.update_enabled)
+	{
+		gw_applet->timeout_tag
+			= g_timeout_add_seconds ((guint) gw_applet->mateweather_pref.update_interval,
+			                         timeout_cb, gw_applet);
+	}
+}
+
+static gboolean free_data(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, gpointer data)
+{
+	WeatherLocation* location;
+
+	gtk_tree_model_get(model, iter, MATEWEATHER_XML_COL_POINTER, &location, -1);
+
+	if (!location)
+	{
+	   return FALSE;
+	}
+
+	weather_location_free(location);
+
+	return FALSE;
+}
+
+static GtkWidget* create_hig_category(GtkWidget* main_box, gchar* title)
+{
+	GtkWidget* vbox;
+	GtkWidget* vbox2;
+	GtkWidget* hbox;
+	GtkWidget*label;
+	gchar* tmp;
+
+	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+	gtk_box_pack_start (GTK_BOX (main_box), vbox, FALSE, FALSE, 0);
+
+	tmp = g_strdup_printf ("<b>%s</b>", title);
+	label = gtk_label_new (NULL);
+	gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+	gtk_label_set_markup (GTK_LABEL (label), tmp);
+	g_free (tmp);
+	gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, FALSE, 0);
+
+	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+
+	label = gtk_label_new ("    ");
+	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+	vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+	gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
+
+	return vbox2;
+}
+
+static gboolean find_location(GtkTreeModel* model, GtkTreeIter* iter, const gchar* location, gboolean go_parent)
+{
+	GtkTreeIter iter_child;
+	GtkTreeIter iter_parent;
+	gchar* aux_loc;
+	gboolean valid;
+	size_t len;
+
+	if ((len = strlen (location)) == 0)
+		return FALSE;
+
+	do {
+
+		gtk_tree_model_get (model, iter, MATEWEATHER_XML_COL_LOC, &aux_loc, -1);
+
+		if (g_ascii_strncasecmp (aux_loc, location, len) == 0)
+		{
+			g_free (aux_loc);
+			return TRUE;
+		}
+
+		if (gtk_tree_model_iter_has_child(model, iter))
+		{
+			gtk_tree_model_iter_nth_child(model, &iter_child, iter, 0);
+
+			if (find_location (model, &iter_child, location, FALSE))
+			{
+				/* Manual copying of the iter */
+				iter->stamp = iter_child.stamp;
+				iter->user_data = iter_child.user_data;
+				iter->user_data2 = iter_child.user_data2;
+				iter->user_data3 = iter_child.user_data3;
+
+				g_free (aux_loc);
+
+				return TRUE;
+			}
+		}
+
+		g_free (aux_loc);
+
+		valid = gtk_tree_model_iter_next(model, iter);
+
+	} while (valid);
+
+	if (go_parent)
+	{
+		iter_parent = *iter;
+
+		while (gtk_tree_model_iter_parent (model, iter, &iter_parent))
+		{
+			if (gtk_tree_model_iter_next (model, iter))
+			{
+				return find_location (model, iter, location, TRUE);
+			}
+
+			iter_parent = *iter;
+		}
+	}
+
+	return FALSE;
+}
+
+static void
+on_find_next_clicked (GtkButton       *button,
+                      MateWeatherPref *pref)
+{
+	GtkTreeView *tree;
+	GtkTreeModel *model;
+	GtkEntry *entry;
+	GtkTreeSelection *selection;
+	GtkTreeIter iter;
+	GtkTreeIter iter_parent;
+	GtkTreePath *path;
+	const gchar *location;
+
+	tree = GTK_TREE_VIEW (pref->priv->tree);
+	model = gtk_tree_view_get_model (tree);
+	entry = GTK_ENTRY (pref->priv->find_entry);
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
+
+	if (gtk_tree_selection_count_selected_rows (selection) >= 1)
+	{
+		gtk_tree_selection_get_selected (selection, &model, &iter);
+		/* Select next or select parent */
+		if (!gtk_tree_model_iter_next (model, &iter))
+		{
+			iter_parent = iter;
+
+			if (!gtk_tree_model_iter_parent (model, &iter, &iter_parent) || !gtk_tree_model_iter_next (model, &iter))
+			{
+				gtk_tree_model_get_iter_first (model, &iter);
+			}
+		}
+
+	}
+	else
+	{
+		gtk_tree_model_get_iter_first (model, &iter);
+	}
+
+	location = gtk_entry_get_text (entry);
+
+	if (find_location (model, &iter, location, TRUE))
+	{
+		gtk_widget_set_sensitive (pref->priv->find_next_btn, TRUE);
+
+		path = gtk_tree_model_get_path (model, &iter);
+		gtk_tree_view_expand_to_path (tree, path);
+		gtk_tree_selection_select_path (selection, path);
+		gtk_tree_view_scroll_to_cell (tree, path, NULL, TRUE, 0.5, 0);
+
+		gtk_tree_path_free (path);
+	}
+	else
+	{
+		gtk_widget_set_sensitive (pref->priv->find_next_btn, FALSE);
+	}
+}
+
+static void
+find_entry_changed (GtkEditable     *entry,
+                    MateWeatherPref *pref)
+{
+	GtkTreeView *tree;
+	GtkTreeModel *model;
+	GtkTreeSelection *selection;
+	GtkTreeIter iter;
+	GtkTreePath *path;
+	const gchar *location;
+
+	tree = GTK_TREE_VIEW (pref->priv->tree);
+	model = gtk_tree_view_get_model (tree);
+
+	g_return_if_fail (model != NULL);
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
+	gtk_tree_model_get_iter_first (model, &iter);
+
+	location = gtk_entry_get_text (GTK_ENTRY (entry));
+
+	if (find_location (model, &iter, location, TRUE))
+	{
+		gtk_widget_set_sensitive (pref->priv->find_next_btn, TRUE);
+
+		path = gtk_tree_model_get_path (model, &iter);
+		gtk_tree_view_expand_to_path (tree, path);
+		gtk_tree_selection_select_iter (selection, &iter);
+		gtk_tree_view_scroll_to_cell (tree, path, NULL, TRUE, 0.5, 0);
+
+		gtk_tree_path_free (path);
+	}
+	else
+	{
+		gtk_widget_set_sensitive (pref->priv->find_next_btn, FALSE);
+	}
+}
+
+static void help_cb(GtkDialog* dialog, MateWeatherPref* pref)
+{
+	gint current_page;
+	gchar *uri;
+	GError* error = NULL;
+
+	current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (pref->priv->notebook));
+	uri = g_strdup_printf ("help:mateweather/mateweather-prefs#mateweather-%s", (current_page == 0) ? "metric" : "change-location");
+	gtk_show_uri_on_window (GTK_WINDOW (dialog),
+	                        uri,
+	                        gtk_get_current_event_time (),
+	                        &error);
+	g_free (uri);
+
+	if (error)
+	{
+		GtkWidget* error_dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("There was an error displaying help: %s"), error->message);
+		g_signal_connect (error_dialog, "response",
+		                  G_CALLBACK (gtk_widget_destroy),
+		                  NULL);
+		gtk_window_set_resizable (GTK_WINDOW (error_dialog), FALSE);
+		gtk_window_set_screen (GTK_WINDOW (error_dialog), gtk_widget_get_screen (GTK_WIDGET (dialog)));
+		gtk_widget_show (error_dialog);
+		g_error_free (error);
+		error = NULL;
+	}
+}
+
+static void
+on_response (GtkDialog       *dialog,
+             gint             id,
+             MateWeatherPref *pref)
+{
+	if (id == GTK_RESPONSE_HELP)
+	{
+		help_cb(dialog, pref);
+	}
+	else
+	{
+		gtk_widget_destroy(GTK_WIDGET(dialog));
+	}
+}
+
+static void
+mateweather_pref_create (MateWeatherPref* pref)
+{
+	GtkWidget* pref_vbox;
+	#ifdef RADARMAP
+		GtkWidget* radar_toggle_hbox;
+	#endif /* RADARMAP */
+	GtkWidget* pref_basic_update_lbl;
+	GtkWidget* pref_basic_update_hbox;
+	GtkAdjustment* pref_basic_update_spin_adj;
+	GtkWidget* pref_basic_update_sec_lbl;
+	GtkWidget* pref_basic_note_lbl;
+	GtkWidget* pref_loc_hbox;
+	GtkWidget* pref_loc_note_lbl;
+	GtkWidget* scrolled_window;
+	GtkWidget* label;
+	GtkWidget* value_hbox;
+	GtkWidget* tree_label;
+	GtkTreeSelection *selection;
+	GtkWidget* pref_basic_vbox;
+	GtkWidget* vbox;
+	GtkWidget* frame;
+	GtkWidget* temp_label;
+	GtkWidget* temp_combo;
+	GtkWidget* speed_label;
+	GtkWidget* speed_combo;
+	GtkWidget* pres_label;
+	GtkWidget* pres_combo;
+	GtkWidget* dist_label;
+	GtkWidget* dist_combo;
+	GtkWidget* unit_grid;
+	GtkWidget* pref_find_label;
+	GtkWidget* pref_find_hbox;
+	GtkWidget* image;
+
+	g_object_set (pref, "destroy-with-parent", TRUE, NULL);
+	gtk_window_set_title (GTK_WINDOW (pref), _("Weather Preferences"));
+	gtk_dialog_add_buttons (GTK_DIALOG (pref), "gtk-close", GTK_RESPONSE_CLOSE, "gtk-help", GTK_RESPONSE_HELP, NULL);
+	gtk_dialog_set_default_response (GTK_DIALOG (pref), GTK_RESPONSE_CLOSE);
+	gtk_container_set_border_width (GTK_CONTAINER (pref), 5);
+	gtk_window_set_resizable (GTK_WINDOW (pref), TRUE);
+	gtk_window_set_screen (GTK_WINDOW (pref), gtk_widget_get_screen (GTK_WIDGET (pref->priv->applet->applet)));
+
+	pref_vbox = gtk_dialog_get_content_area (GTK_DIALOG (pref));
+	gtk_box_set_spacing (GTK_BOX (pref_vbox), 2);
+	gtk_widget_show (pref_vbox);
+
+	pref->priv->notebook = gtk_notebook_new ();
+	gtk_container_set_border_width (GTK_CONTAINER (pref->priv->notebook), 5);
+	gtk_widget_show (pref->priv->notebook);
+	gtk_box_pack_start (GTK_BOX (pref_vbox), pref->priv->notebook, TRUE, TRUE, 0);
+
+  /*
+   * General settings page.
+   */
+
+	pref_basic_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
+	gtk_container_set_border_width (GTK_CONTAINER (pref_basic_vbox), 12);
+	gtk_container_add (GTK_CONTAINER (pref->priv->notebook), pref_basic_vbox);
+
+	pref->priv->basic_update_btn = gtk_check_button_new_with_mnemonic (_("_Automatically update every:"));
+	gtk_widget_set_halign (pref->priv->basic_update_btn, GTK_ALIGN_START);
+	gtk_widget_set_vexpand (pref->priv->basic_update_btn, TRUE);
+	gtk_widget_show (pref->priv->basic_update_btn);
+
+	if (!g_settings_is_writable (pref->priv->applet->settings, "auto-update"))
+	{
+		hard_set_sensitive (pref->priv->basic_update_btn, FALSE);
+	}
+
+	/*
+	 * Units settings page.
+	 */
+
+	/* Temperature Unit */
+	temp_label = gtk_label_new_with_mnemonic (_("_Temperature unit:"));
+	gtk_label_set_use_markup (GTK_LABEL (temp_label), TRUE);
+	gtk_label_set_justify (GTK_LABEL (temp_label), GTK_JUSTIFY_LEFT);
+	gtk_label_set_xalign (GTK_LABEL (temp_label), 0.0);
+	gtk_widget_show (temp_label);
+
+	temp_combo = gtk_combo_box_text_new ();
+	pref->priv->basic_temp_combo = temp_combo;
+	gtk_label_set_mnemonic_widget (GTK_LABEL (temp_label), temp_combo);
+	//gtk_combo_box_append_text (GTK_COMBO_BOX (temp_combo), _("Default"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (temp_combo), _("Kelvin"));
+	/* TRANSLATORS: Celsius is sometimes referred Centigrade */
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (temp_combo), _("Celsius"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (temp_combo), _("Fahrenheit"));
+	gtk_widget_show (temp_combo);
+
+	if ( ! g_settings_is_writable (pref->priv->applet->settings, "temperature-unit"))
+	{
+		hard_set_sensitive (pref->priv->basic_temp_combo, FALSE);
+	}
+
+	/* Speed Unit */
+	speed_label = gtk_label_new_with_mnemonic (_("_Wind speed unit:"));
+	gtk_label_set_use_markup (GTK_LABEL (speed_label), TRUE);
+	gtk_label_set_justify (GTK_LABEL (speed_label), GTK_JUSTIFY_LEFT);
+	gtk_label_set_xalign (GTK_LABEL (speed_label), 0.0);
+	gtk_widget_show (speed_label);
+
+	speed_combo = gtk_combo_box_text_new ();
+	pref->priv->basic_speed_combo = speed_combo;
+	gtk_label_set_mnemonic_widget (GTK_LABEL (speed_label), speed_combo);
+	//gtk_combo_box_append_text (GTK_COMBO_BOX (speed_combo), _("Default"));
+	/* TRANSLATOR: The wind speed unit "meters per second" */
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (speed_combo), _("m/s"));
+	/* TRANSLATOR: The wind speed unit "kilometers per hour" */
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (speed_combo), _("km/h"));
+	/* TRANSLATOR: The wind speed unit "miles per hour" */
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (speed_combo), _("mph"));
+	/* TRANSLATOR: The wind speed unit "knots" */
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (speed_combo), _("knots"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (speed_combo), _("Beaufort scale"));
+	gtk_widget_show (speed_combo);
+
+	if (!g_settings_is_writable (pref->priv->applet->settings, "speed-unit"))
+	{
+		hard_set_sensitive (pref->priv->basic_speed_combo, FALSE);
+	}
+
+	/* Pressure Unit */
+	pres_label = gtk_label_new_with_mnemonic (_("_Pressure unit:"));
+	gtk_label_set_use_markup (GTK_LABEL (pres_label), TRUE);
+	gtk_label_set_justify (GTK_LABEL (pres_label), GTK_JUSTIFY_LEFT);
+	gtk_label_set_xalign (GTK_LABEL (pres_label), 0.0);
+	gtk_widget_show (pres_label);
+
+	pres_combo = gtk_combo_box_text_new ();
+	pref->priv->basic_pres_combo = pres_combo;
+	gtk_label_set_mnemonic_widget (GTK_LABEL (pres_label), pres_combo);
+	//gtk_combo_box_append_text (GTK_COMBO_BOX (pres_combo), _("Default"));
+	/* TRANSLATOR: The pressure unit "kiloPascals" */
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pres_combo), _("kPa"));
+	/* TRANSLATOR: The pressure unit "hectoPascals" */
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pres_combo), _("hPa"));
+	/* TRANSLATOR: The pressure unit "millibars" */
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pres_combo), _("mb"));
+	/* TRANSLATOR: The pressure unit "millibars of mercury" */
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pres_combo), _("mmHg"));
+	/* TRANSLATOR: The pressure unit "inches of mercury" */
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pres_combo), _("inHg"));
+	/* TRANSLATOR: The pressure unit "atmospheres" */
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pres_combo), _("atm"));
+	gtk_widget_show (pres_combo);
+
+	if (!g_settings_is_writable(pref->priv->applet->settings, "pressure-unit"))
+	{
+		hard_set_sensitive(pref->priv->basic_pres_combo, FALSE);
+	}
+
+	/* Distance Unit */
+	dist_label = gtk_label_new_with_mnemonic (_("_Visibility unit:"));
+	gtk_label_set_use_markup (GTK_LABEL (dist_label), TRUE);
+	gtk_label_set_justify (GTK_LABEL (dist_label), GTK_JUSTIFY_LEFT);
+	gtk_label_set_xalign (GTK_LABEL (dist_label), 0.0);
+	gtk_widget_show (dist_label);
+
+	dist_combo = gtk_combo_box_text_new ();
+	pref->priv->basic_dist_combo = dist_combo;
+	gtk_label_set_mnemonic_widget (GTK_LABEL (dist_label), dist_combo);
+	//gtk_combo_box_append_text (GTK_COMBO_BOX (dist_combo), _("Default"));
+	/* TRANSLATOR: The distance unit "meters" */
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dist_combo), _("meters"));
+	/* TRANSLATOR: The distance unit "kilometers" */
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dist_combo), _("km"));
+	/* TRANSLATOR: The distance unit "miles" */
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dist_combo), _("miles"));
+	gtk_widget_show (dist_combo);
+
+	if ( ! g_settings_is_writable (pref->priv->applet->settings, "distance-unit"))
+		hard_set_sensitive (pref->priv->basic_dist_combo, FALSE);
+
+	unit_grid = gtk_grid_new ();
+	gtk_grid_set_row_spacing(GTK_GRID(unit_grid), 6);
+	gtk_grid_set_column_spacing(GTK_GRID(unit_grid), 12);
+	gtk_widget_set_halign (temp_label, GTK_ALIGN_START);
+	gtk_grid_attach(GTK_GRID(unit_grid), temp_label, 0, 0, 1, 1);
+	gtk_grid_attach(GTK_GRID(unit_grid), temp_combo,  1, 0, 1, 1);
+	gtk_widget_set_halign (speed_label, GTK_ALIGN_START);
+	gtk_grid_attach(GTK_GRID(unit_grid), speed_label, 0, 1, 1, 1);
+	gtk_grid_attach(GTK_GRID(unit_grid), speed_combo, 1, 1, 1, 1);
+	gtk_widget_set_halign (pres_label, GTK_ALIGN_START);
+	gtk_grid_attach(GTK_GRID(unit_grid), pres_label, 0, 2, 1, 1);
+	gtk_grid_attach(GTK_GRID(unit_grid), pres_combo,  1, 2, 1, 1);
+	gtk_widget_set_halign (dist_label, GTK_ALIGN_START);
+	gtk_grid_attach(GTK_GRID(unit_grid), dist_label, 0, 3, 1, 1);
+	gtk_grid_attach(GTK_GRID(unit_grid), dist_combo,  1, 3, 1, 1);
+	gtk_widget_show(unit_grid);
+
+	#ifdef RADARMAP
+		pref->priv->basic_radar_btn = gtk_check_button_new_with_mnemonic (_("Enable _radar map"));
+		gtk_widget_show (pref->priv->basic_radar_btn);
+
+		if (!g_settings_is_writable (pref->priv->applet->settings, "enable-radar-map"))
+		{
+			hard_set_sensitive(pref->priv->basic_radar_btn, FALSE);
+		}
+
+		radar_toggle_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+		gtk_widget_show(radar_toggle_hbox);
+
+		label = gtk_label_new ("    ");
+		gtk_widget_show (label);
+		gtk_box_pack_start (GTK_BOX (radar_toggle_hbox), label, FALSE, FALSE, 0);
+
+		pref->priv->basic_radar_url_btn = gtk_check_button_new_with_mnemonic (_("Use _custom address for radar map"));
+		gtk_widget_show (pref->priv->basic_radar_url_btn);
+		gtk_box_pack_start (GTK_BOX (radar_toggle_hbox), pref->priv->basic_radar_url_btn, FALSE, FALSE, 0);
+
+		if ( ! g_settings_is_writable (pref->priv->applet->settings, "use-custom-radar-url"))
+		{
+			hard_set_sensitive (pref->priv->basic_radar_url_btn, FALSE);
+		}
+
+		pref->priv->basic_radar_url_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+		gtk_widget_show (pref->priv->basic_radar_url_hbox);
+
+		label = gtk_label_new ("    ");
+		gtk_widget_show (label);
+		gtk_box_pack_start (GTK_BOX (pref->priv->basic_radar_url_hbox), label, FALSE, FALSE, 0);
+
+		label = gtk_label_new_with_mnemonic (_("A_ddress:"));
+		gtk_widget_show (label);
+		gtk_box_pack_start (GTK_BOX (pref->priv->basic_radar_url_hbox), label, FALSE, FALSE, 0);
+		pref->priv->basic_radar_url_entry = gtk_entry_new ();
+		gtk_widget_show (pref->priv->basic_radar_url_entry);
+		gtk_box_pack_start (GTK_BOX (pref->priv->basic_radar_url_hbox), pref->priv->basic_radar_url_entry, TRUE, TRUE, 0);
+
+		if ( ! g_settings_is_writable (pref->priv->applet->settings, "radar"))
+		{
+			hard_set_sensitive (pref->priv->basic_radar_url_entry, FALSE);
+		}
+	#endif /* RADARMAP */
+
+#ifdef HAVE_LIBNOTIFY
+	/* setup show-notifications button */
+	pref->priv->basic_show_notifications_btn = gtk_check_button_new_with_mnemonic (_("Show _notifications"));
+
+	if (!g_settings_is_writable (pref->priv->applet->settings, "show-notifications"))
+	{
+		hard_set_sensitive (pref->priv->basic_show_notifications_btn, FALSE);
+	}
+#endif
+
+	frame = create_hig_category (pref_basic_vbox, _("Update"));
+
+	pref_basic_update_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+
+	pref_basic_update_lbl = gtk_label_new_with_mnemonic (_("_Automatically update every:"));
+	gtk_widget_show (pref_basic_update_lbl);
+
+	gtk_widget_show (pref_basic_update_hbox);
+
+	pref_basic_update_spin_adj = gtk_adjustment_new (30, 1, 3600, 5, 25, 1);
+	pref->priv->basic_update_spin = gtk_spin_button_new (pref_basic_update_spin_adj, 1, 0);
+	gtk_widget_show (pref->priv->basic_update_spin);
+
+	gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (pref->priv->basic_update_spin), TRUE);
+	gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (pref->priv->basic_update_spin), GTK_UPDATE_IF_VALID);
+
+	pref_basic_update_sec_lbl = gtk_label_new (_("minutes"));
+	gtk_widget_show (pref_basic_update_sec_lbl);
+
+	if ( ! g_settings_is_writable (pref->priv->applet->settings, "auto-update-interval"))
+	{
+		hard_set_sensitive (pref->priv->basic_update_spin, FALSE);
+		hard_set_sensitive (pref_basic_update_sec_lbl, FALSE);
+	}
+
+	value_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+
+	gtk_box_pack_start (GTK_BOX (pref_basic_update_hbox), pref->priv->basic_update_btn, FALSE, TRUE, 0);
+	gtk_box_pack_start (GTK_BOX (pref_basic_update_hbox), value_hbox, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (value_hbox), pref->priv->basic_update_spin, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (value_hbox), pref_basic_update_sec_lbl, FALSE, FALSE, 0);
+
+	gtk_container_add (GTK_CONTAINER (frame), pref_basic_update_hbox);
+
+	frame = create_hig_category (pref_basic_vbox, _("Display"));
+
+	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+
+	gtk_box_pack_start (GTK_BOX (vbox), unit_grid, TRUE, TRUE, 0);
+
+	#ifdef RADARMAP
+		gtk_box_pack_start (GTK_BOX (vbox), pref->priv->basic_radar_btn, TRUE, TRUE, 0);
+		gtk_box_pack_start (GTK_BOX (vbox), radar_toggle_hbox, TRUE, TRUE, 0);
+		gtk_box_pack_start (GTK_BOX (vbox), pref->priv->basic_radar_url_hbox, TRUE, TRUE, 0);
+	#endif /* RADARMAP */
+
+	#ifdef HAVE_LIBNOTIFY
+		/* add the show-notification toggle button to the vbox of the display section */
+		gtk_box_pack_start (GTK_BOX (vbox), pref->priv->basic_show_notifications_btn, TRUE, TRUE, 0);
+	#endif
+
+	gtk_container_add (GTK_CONTAINER (frame), vbox);
+
+	pref_basic_note_lbl = gtk_label_new (_("General"));
+	gtk_widget_show (pref_basic_note_lbl);
+	gtk_notebook_set_tab_label (GTK_NOTEBOOK (pref->priv->notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (pref->priv->notebook), 0), pref_basic_note_lbl);
+
+  /*
+   * Location page.
+   */
+	pref_loc_hbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+	gtk_container_set_border_width (GTK_CONTAINER (pref_loc_hbox), 12);
+	gtk_container_add (GTK_CONTAINER (pref->priv->notebook), pref_loc_hbox);
+
+	tree_label = gtk_label_new_with_mnemonic (_("_Select a location:"));
+	gtk_label_set_xalign (GTK_LABEL (tree_label), 0.0);
+	gtk_box_pack_start (GTK_BOX (pref_loc_hbox), tree_label, FALSE, FALSE, 0);
+
+	scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+	pref->priv->tree = gtk_tree_view_new ();
+	gtk_label_set_mnemonic_widget (GTK_LABEL (tree_label), GTK_WIDGET (pref->priv->tree));
+	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (pref->priv->tree), FALSE);
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (pref->priv->tree));
+
+	gtk_container_add (GTK_CONTAINER (scrolled_window), pref->priv->tree);
+	gtk_widget_show (pref->priv->tree);
+	gtk_widget_show (scrolled_window);
+	gtk_box_pack_start (GTK_BOX (pref_loc_hbox), scrolled_window, TRUE, TRUE, 0);
+	load_locations(pref);
+
+	pref_find_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+	pref_find_label = gtk_label_new (_("_Find:"));
+	gtk_label_set_use_underline (GTK_LABEL (pref_find_label), TRUE);
+
+	pref->priv->find_entry = gtk_entry_new ();
+	gtk_label_set_mnemonic_widget (GTK_LABEL (pref_find_label), pref->priv->find_entry);
+
+	pref->priv->find_next_btn = gtk_button_new_with_mnemonic (_("Find _Next"));
+	gtk_widget_set_sensitive (pref->priv->find_next_btn, FALSE);
+
+	image = gtk_image_new_from_icon_name ("edit-find", GTK_ICON_SIZE_BUTTON);
+	gtk_button_set_image (GTK_BUTTON (pref->priv->find_next_btn), image);
+
+	gtk_container_set_border_width (GTK_CONTAINER (pref_find_hbox), 0);
+	gtk_box_pack_start (GTK_BOX (pref_find_hbox), pref_find_label, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (pref_find_hbox), pref->priv->find_entry, TRUE, TRUE, 0);
+	gtk_box_pack_start (GTK_BOX (pref_find_hbox), pref->priv->find_next_btn, FALSE, FALSE, 0);
+
+	gtk_box_pack_start (GTK_BOX (pref_loc_hbox), pref_find_hbox, FALSE, FALSE, 0);
+
+	if ( ! g_settings_is_writable (pref->priv->applet->settings, "location0"))
+	{
+		hard_set_sensitive (scrolled_window, FALSE);
+	}
+
+	pref_loc_note_lbl = gtk_label_new (_("Location"));
+	gtk_widget_show (pref_loc_note_lbl);
+	gtk_notebook_set_tab_label (GTK_NOTEBOOK (pref->priv->notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (pref->priv->notebook), 1), pref_loc_note_lbl);
+
+	mateweather_pref_set_accessibility (pref);
+	gtk_label_set_mnemonic_widget (GTK_LABEL (pref_basic_update_sec_lbl), pref->priv->basic_update_spin);
+	gtk_label_set_mnemonic_widget (GTK_LABEL (label), pref->priv->basic_radar_url_entry);
+
+    /* Set the initial values */
+    update_dialog (pref);
+
+    /* signals */
+    g_signal_connect (temp_combo,  "changed", G_CALLBACK (on_temp_combo_changed), pref);
+    g_signal_connect (speed_combo, "changed", G_CALLBACK (on_speed_combo_changed), pref);
+    g_signal_connect (dist_combo,  "changed", G_CALLBACK (on_dist_combo_changed), pref);
+    g_signal_connect (pres_combo,  "changed", G_CALLBACK (on_pres_combo_changed), pref);
+    g_signal_connect (pref->priv->basic_update_btn, "toggled", G_CALLBACK (on_auto_update_toggled), pref);
+#ifdef RADARMAP
+    g_signal_connect (pref->priv->basic_radar_btn, "toggled", G_CALLBACK (on_radar_toggled), pref);
+    g_signal_connect (pref->priv->basic_radar_url_btn, "toggled", G_CALLBACK (on_use_radar_url_toggled), pref);
+    g_signal_connect (pref->priv->basic_radar_url_entry, "focus-out-event", G_CALLBACK (on_radar_url_changed), pref);
+#endif /* RADARMAP */
+#ifdef HAVE_LIBNOTIFY
+    g_signal_connect (pref->priv->basic_show_notifications_btn, "toggled", G_CALLBACK (on_show_notifications_toggled), pref);
+#endif /* HAVE_LIBNOTIFY */
+    g_signal_connect (pref->priv->find_next_btn, "clicked", G_CALLBACK (on_find_next_clicked), pref);
+    g_signal_connect (pref->priv->find_entry, "changed", G_CALLBACK (find_entry_changed), pref);
+    g_signal_connect (selection, "changed", G_CALLBACK (on_row_selected), pref);
+    g_signal_connect (pref->priv->basic_update_spin, "value-changed", G_CALLBACK (on_update_interval_changed), pref);
+    g_signal_connect (pref, "response", G_CALLBACK (on_response), pref);
+}
+
+static void mateweather_pref_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec *pspec)
+{
+    MateWeatherPref* pref = MATEWEATHER_PREF(object);
+
+    switch (prop_id) {
+        case PROP_MATEWEATHER_APPLET:
+            pref->priv->applet = g_value_get_pointer(value);
+            break;
+        default:
+            /* We don't have any other property... */
+            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+            break;
+    }
+}
+
+static void mateweather_pref_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
+{
+    MateWeatherPref* pref = MATEWEATHER_PREF(object);
+
+    switch (prop_id) {
+        case PROP_MATEWEATHER_APPLET:
+            g_value_set_pointer(value, pref->priv->applet);
+            break;
+        default:
+            /* We don't have any other property... */
+            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+            break;
+    }
+}
+
+static void mateweather_pref_init(MateWeatherPref* self)
+{
+	self->priv = mateweather_pref_get_instance_private(self);
+}
+
+static GObject*
+mateweather_pref_constructor (GType                  type,
+                              guint                  n_construct_params,
+                              GObjectConstructParam *construct_params)
+{
+    GObject *object;
+    MateWeatherPref *self;
+
+    object = G_OBJECT_CLASS (mateweather_pref_parent_class)->constructor(type, n_construct_params, construct_params);
+    self = MATEWEATHER_PREF (object);
+
+    mateweather_pref_create (self);
+
+    return object;
+}
+
+GtkWidget* mateweather_pref_new(MateWeatherApplet* applet)
+{
+    return g_object_new(MATEWEATHER_TYPE_PREF, "mateweather-applet", applet, NULL);
+}
+
+static void mateweather_pref_finalize(GObject* object)
+{
+	MateWeatherPref* self = MATEWEATHER_PREF(object);
+
+	gtk_tree_model_foreach(self->priv->model, free_data, NULL);
+	g_object_unref(G_OBJECT(self->priv->model));
+
+	G_OBJECT_CLASS(mateweather_pref_parent_class)->finalize(object);
+}
+
+static void mateweather_pref_class_init(MateWeatherPrefClass* klass)
+{
+    GObjectClass* object_class = G_OBJECT_CLASS(klass);
+
+    mateweather_pref_parent_class = g_type_class_peek_parent(klass);
+
+    object_class->set_property = mateweather_pref_set_property;
+    object_class->get_property = mateweather_pref_get_property;
+    object_class->constructor = mateweather_pref_constructor;
+    object_class->finalize = mateweather_pref_finalize;
+
+    /* This becomes an OBJECT property when MateWeatherApplet is redone */
+    g_object_class_install_property(object_class, PROP_MATEWEATHER_APPLET, g_param_spec_pointer("mateweather-applet", "MateWeather Applet", "The MateWeather Applet", G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/11.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/11.html new file mode 100644 index 00000000..0040d2db --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/11.html @@ -0,0 +1,891 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
/*
+ *  Copyright (C) 2010 by Joachim Breitner <mail@joachim-breitner.de>
+ *
+ * Based on battstat-hal.c:
+ * Copyright (C) 2005 by Ryan Lortie <desrt@desrt.ca>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Id$
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#ifdef HAVE_UPOWER
+
+#include <upower.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <math.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "battstat-upower.h"
+
+static UpClient *upc;
+static void (*status_updated_callback) (void);
+
+/* status_updated_callback () can not be called directly because at the time of
+ * the device-remove signal, the device is not actually removed from the list
+ * of devices known to the up_client object (see libupower-glib/up-client.c in
+ * upower). Waiting for the next idle timer works around this issue and has has
+ * the additionaly benefit of possibly running status_updated_callback only
+ * once when several events happen very soon after each other.
+ */
+static gboolean status_update_scheduled;
+
+static gboolean
+update_status_idle (gpointer junk)
+{
+  if (status_updated_callback)
+    status_updated_callback ();
+
+  return status_update_scheduled = FALSE;
+}
+
+static void
+schedule_status_callback (void)
+{
+  if (status_update_scheduled)
+    return;
+
+  status_update_scheduled = TRUE;
+  g_idle_add (update_status_idle, NULL);
+}
+
+static void
+device_cb (UpClient *client, UpDevice *device, gpointer user_data) {
+  schedule_status_callback ();
+}
+
+static void
+device_removed_cb (UpClient *client, const gchar *object_path, gpointer user_data) {
+  schedule_status_callback ();
+}
+
+/* ---- public functions ---- */
+
+char *
+battstat_upower_initialise (void (*callback) (void))
+{
+  status_updated_callback = callback;
+
+  if (upc != NULL)
+    return g_strdup ("Already initialised!");
+
+  if ((upc = up_client_new ()) == NULL)
+    goto error_out;
+
+  GPtrArray *devices;
+  devices = up_client_get_devices2 (upc);
+  if (!devices) {
+    goto error_shutdownclient;
+  }
+  g_ptr_array_unref (devices);
+
+  g_signal_connect_after (upc, "device-added", G_CALLBACK (device_cb), NULL);
+  g_signal_connect_after (upc, "device-removed", G_CALLBACK (device_removed_cb), NULL);
+
+  return NULL;
+
+error_shutdownclient:
+  g_object_unref (upc);
+  upc = NULL;
+
+error_out:
+  return g_strdup ("Can not initialize upower");
+}
+
+void
+battstat_upower_cleanup (void)
+{
+  if (upc == NULL)
+    return;
+  
+  g_object_unref (upc);
+  upc = NULL;
+}
+
+#include "battstat.h"
+
+/* This function currently exists to allow the multiple batteries supported
+ * by the upower backend to appear as a single composite battery device (since
+ * at the current time this is all that battstat supports).
+ *
+ * This entire function is filled with logic to make multiple batteries
+ * appear as one "composite" battery.  Comments included as appropriate.
+ *
+ * For more information about some of the assumptions made in the following
+ * code please see the following mailing list post and the resulting thread:
+ *
+ *   http://lists.freedesktop.org/archives/hal/2005-July/002841.html
+ */
+void
+battstat_upower_get_battery_info (BatteryStatus *status)
+{
+
+  GPtrArray *devices = up_client_get_devices2 (upc);
+
+  /* The calculation to get overall percentage power remaining is as follows:
+   *
+   *    Sum (Current charges) / Sum (Full Capacities)
+   *
+   * We can't just take an average of all of the percentages since this
+   * doesn't deal with the case that one battery might have a larger
+   * capacity than the other.
+   *
+   * In order to do this calculation, we need to keep a running total of
+   * current charge and full capacities.
+   */
+  double current_charge_total = 0, full_capacity_total = 0;
+
+  /* Record the time remaining as reported by upower.  This is used in the event
+   * that the system has exactly one battery (since, then, upower is capable
+   * of providing an accurate time remaining report and we should trust it.)
+   */
+  gint64 remaining_time = 0;
+
+  /* The total (dis)charge rate of the system is the sum of the rates of
+   * the individual batteries.
+   */
+  double rate_total = 0;
+
+  /* We need to know if we should report the composite battery as present
+   * at all.  The logic is that if at least one actual battery is installed
+   * then the composite battery will be reported to exist.
+   */
+  int present = 0;
+
+  /* We need to know if we are on AC power or not.  Eventually, we can look
+   * at the AC adaptor upower devices to determine that.  For now, we assume that
+   * if any battery is discharging then we must not be on AC power.  Else, by
+   * default, we must be on AC.
+   */
+  int on_ac_power = 1;
+
+  /* Finally, we consider the composite battery to be "charging" if at least
+   * one of the actual batteries in the system is charging.
+   */
+  int charging = 0;
+
+  /* For each physical battery bay... */
+  int i;
+  for (i = 0; i < devices->len; i++)
+  {
+    UpDevice *upd = g_ptr_array_index (devices, i);
+
+    int type, state;
+    double current_charge, full_capacity, rate;
+    gint64 time_to_full, time_to_empty;
+
+    g_object_get (upd,
+      "kind", &type,
+      "state", &state,
+      "energy", &current_charge,
+      "energy-full", &full_capacity,
+      "energy-rate", &rate,
+      "time-to-full", &time_to_full,
+      "time-to-empty", &time_to_empty,
+      NULL);
+
+    /* Only count batteries here */
+
+    if (type != UP_DEVICE_KIND_BATTERY)
+      continue;
+
+    /* At least one battery present -> composite battery is present. */
+    present++;
+
+    /* At least one battery charging -> composite battery is charging. */
+    if (state == UP_DEVICE_STATE_CHARGING)
+      charging = 1;
+
+    /* At least one battery is discharging -> we're not on AC. */
+    if (state == UP_DEVICE_STATE_DISCHARGING)
+      on_ac_power = 0;
+
+    /* Sum the totals for current charge, design capacity, (dis)charge rate. */
+    current_charge_total += current_charge;
+    full_capacity_total += full_capacity;
+    rate_total += rate;
+
+    /* Record remaining time too, incase this is the only battery. */
+    remaining_time = (state == UP_DEVICE_STATE_DISCHARGING ? time_to_empty : time_to_full);
+  }
+
+  if (!present || full_capacity_total <= 0 || (charging && !on_ac_power))
+  {
+    /* Either no battery is present or something has gone horribly wrong.
+     * In either case we must return that the composite battery is not
+     * present.
+     */
+    status->present = FALSE;
+    status->percent = 0;
+    status->minutes = -1;
+    status->on_ac_power = TRUE;
+    status->charging = FALSE;
+
+    g_ptr_array_unref (devices);
+    return;
+  }
+
+  /* Else, our composite battery is present. */
+  status->present = TRUE;
+
+  /* As per above, overall charge is:
+   *
+   *    Sum (Current charges) / Sum (Full Capacities)
+   */
+  status->percent =  (current_charge_total / full_capacity_total) * 100.0 + 0.5;
+
+  if (present == 1)
+  {
+    /* In the case of exactly one battery, report the time remaining figure
+     * from upower directly since it might have come from an authorative source
+     * (ie: the PMU or APM subsystem).
+     *
+     * upower gives remaining time in seconds with a 0 to mean that the
+     * remaining time is unknown.  Battstat uses minutes and -1 for 
+     * unknown time remaining.
+     */
+
+    if (remaining_time == 0)
+      status->minutes = -1;
+    else
+      status->minutes = (remaining_time + 30) / 60;
+  }
+  /* Rest of cases to deal with multiple battery systems... */
+  else if (!on_ac_power && rate_total != 0)
+  {
+    /* Then we're discharging.  Calculate time remaining until at zero. */
+
+    double remaining;
+
+    remaining = current_charge_total;
+    remaining /= rate_total;
+    status->minutes = (int) floor (remaining * 60.0 + 0.5);
+  }
+  else if (charging && rate_total != 0)
+  {
+    /* Calculate time remaining until charged.  For systems with more than
+     * one battery, this code is very approximate.  The assumption is that if
+     * one battery reaches full charge before the other that the other will
+     * start charging faster due to the increase in available power (similar
+     * to how a laptop will charge faster if you're not using it).
+     */
+
+    double remaining;
+
+    remaining = full_capacity_total - current_charge_total;
+    if (remaining < 0)
+      remaining = 0;
+    remaining /= rate_total;
+
+    status->minutes = (int) floor (remaining * 60.0 + 0.5);
+  }
+  else
+  {
+    /* On AC power and not charging -or- rate is unknown. */
+    status->minutes = -1;
+  }
+
+  /* These are simple and well-explained above. */
+  status->charging = charging;
+  status->on_ac_power = on_ac_power;
+  
+  g_ptr_array_unref (devices);
+}
+
+void
+error_dialog (const char *fmt , ...)
+{
+  va_list ap;
+  va_start (ap, fmt);
+  char str[1000];
+  vsprintf (str, fmt, ap);
+  va_end (ap);
+  GtkWidget *dialog;
+
+  dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR,
+                                   GTK_BUTTONS_OK, "%s", str);
+
+  g_signal_connect_swapped (dialog, "response",
+                            G_CALLBACK (gtk_widget_destroy),
+                            G_OBJECT (dialog));
+
+  gtk_widget_show_all (dialog);
+}
+
+#endif /* HAVE_UPOWER */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/110.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/110.html new file mode 100644 index 00000000..989b25b3 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/110.html @@ -0,0 +1,939 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.mateweather"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[2301]; const double alignment; void * const ptr;}  mateweather_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0004, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0103, 0127, 0331, 0131, 
+  0003, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0025, 0000, 0166, 0000, 0000, 0001, 0000, 0000, 
+  0040, 0010, 0000, 0000, 0113, 0120, 0220, 0013, 0002, 0000, 0000, 0000, 0040, 0010, 0000, 0000, 
+  0004, 0000, 0114, 0000, 0044, 0010, 0000, 0000, 0050, 0010, 0000, 0000, 0324, 0265, 0002, 0000, 
+  0377, 0377, 0377, 0377, 0050, 0010, 0000, 0000, 0001, 0000, 0114, 0000, 0054, 0010, 0000, 0000, 
+  0060, 0010, 0000, 0000, 0243, 0336, 0202, 0257, 0006, 0000, 0000, 0000, 0060, 0010, 0000, 0000, 
+  0014, 0000, 0114, 0000, 0074, 0010, 0000, 0000, 0104, 0010, 0000, 0000, 0201, 0321, 0040, 0031, 
+  0001, 0000, 0000, 0000, 0104, 0010, 0000, 0000, 0005, 0000, 0114, 0000, 0114, 0010, 0000, 0000, 
+  0120, 0010, 0000, 0000, 0316, 0203, 0247, 0041, 0003, 0000, 0000, 0000, 0120, 0010, 0000, 0000, 
+  0033, 0000, 0166, 0000, 0160, 0010, 0000, 0000, 0350, 0010, 0000, 0000, 0275, 0342, 0315, 0116, 
+  0004, 0000, 0000, 0000, 0350, 0010, 0000, 0000, 0015, 0000, 0114, 0000, 0370, 0010, 0000, 0000, 
+  0374, 0010, 0000, 0000, 0155, 0141, 0164, 0145, 0167, 0145, 0141, 0164, 0150, 0145, 0162, 0055, 
+  0144, 0151, 0141, 0154, 0157, 0147, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0231, 0154, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0235, 0335, 0163, 0332, 0070, 
+  0020, 0300, 0337, 0373, 0127, 0350, 0374, 0172, 0103, 0010, 0244, 0111, 0077, 0006, 0350, 0334, 
+  0245, 0327, 0316, 0315, 0264, 0167, 0067, 0155, 0332, 0076, 0172, 0204, 0275, 0301, 0072, 0204, 
+  0344, 0223, 0344, 0020, 0356, 0257, 0077, 0311, 0206, 0004, 0212, 0277, 0061, 0265, 0311, 0351, 
+  0045, 0103, 0214, 0264, 0326, 0312, 0277, 0135, 0255, 0044, 0263, 0032, 0275, 0271, 0137, 0120, 
+  0164, 0007, 0102, 0022, 0316, 0306, 0316, 0340, 0354, 0334, 0101, 0300, 0074, 0356, 0023, 0066, 
+  0033, 0073, 0137, 0156, 0336, 0365, 0136, 0072, 0157, 0046, 0317, 0106, 0077, 0365, 0172, 0350, 
+  0075, 0060, 0020, 0130, 0201, 0217, 0226, 0104, 0005, 0150, 0106, 0261, 0017, 0350, 0342, 0354, 
+  0342, 0352, 0354, 0034, 0365, 0172, 0272, 0020, 0141, 0012, 0304, 0055, 0366, 0140, 0362, 0014, 
+  0241, 0221, 0200, 0177, 0042, 0042, 0100, 0042, 0112, 0246, 0143, 0147, 0246, 0346, 0077, 0073, 
+  0217, 0067, 0272, 0070, 0033, 0016, 0235, 0176, 0134, 0216, 0117, 0377, 0006, 0117, 0041, 0217, 
+  0142, 0051, 0307, 0316, 0173, 0065, 0377, 0175, 0201, 0147, 0340, 0040, 0342, 0217, 0035, 0217, 
+  0162, 0011, 0056, 0131, 0314, 0034, 0123, 0124, 0027, 0016, 0005, 0017, 0101, 0250, 0025, 0142, 
+  0170, 0001, 0143, 0347, 0216, 0110, 0062, 0245, 0340, 0114, 0156, 0104, 0004, 0243, 0376, 0346, 
+  0333, 0364, 0302, 0036, 0146, 0356, 0055, 0367, 0042, 0351, 0114, 0336, 0141, 0052, 0013, 0313, 
+  0023, 0217, 0063, 0327, 0174, 0164, 0046, 0113, 0302, 0174, 0276, 0354, 0305, 0315, 0331, 0255, 
+  0066, 0352, 0047, 0355, 0217, 0077, 0053, 0130, 0204, 0124, 0367, 0320, 0106, 0231, 0217, 0372, 
+  0363, 0067, 0300, 0052, 0000, 0361, 0226, 0140, 0312, 0147, 0016, 0012, 0261, 0000, 0246, 0142, 
+  0075, 0327, 0227, 0232, 0151, 0354, 0224, 0013, 0037, 0204, 0273, 0044, 0276, 0012, 0234, 0311, 
+  0140, 0130, 0124, 0136, 0021, 0245, 0373, 0015, 0051, 0201, 0231, 0324, 0115, 0306, 0272, 0027, 
+  0307, 0316, 0012, 0364, 0355, 0336, 0202, 0302, 0204, 0312, 0042, 0001, 0076, 0334, 0342, 0210, 
+  0252, 0315, 0035, 0057, 0137, 0235, 0227, 0255, 0021, 0000, 0231, 0005, 0312, 0231, 0134, 0074, 
+  0057, 0121, 0105, 0052, 0301, 0127, 0256, 0001, 0316, 0115, 0272, 0256, 0334, 0263, 0126, 0253, 
+  0020, 0334, 0200, 0230, 0342, 0176, 0334, 0315, 0173, 0025, 0044, 0231, 0061, 0114, 0327, 0305, 
+  0065, 0246, 0041, 0147, 0122, 0167, 0110, 0200, 0231, 0117, 0101, 0074, 0136, 0162, 0275, 0251, 
+  0203, 0344, 0022, 0207, 0041, 0150, 0040, 0031, 0117, 0250, 0325, 0002, 0274, 0200, 0120, 0037, 
+  0305, 0314, 0153, 0101, 0275, 0370, 0137, 0115, 0344, 0224, 0337, 0257, 0037, 0151, 0032, 0333, 
+  0277, 0156, 0175, 0133, 0375, 0241, 0247, 0325, 0341, 0202, 0350, 0136, 0301, 0112, 0233, 0225, 
+  0063, 0321, 0366, 0245, 0210, 0207, 0151, 0231, 0212, 0062, 0304, 0236, 0266, 0362, 0064, 0130, 
+  0162, 0364, 0303, 0236, 0271, 0223, 0253, 0037, 0005, 0336, 0122, 0044, 0125, 0325, 0110, 0051, 
+  0316, 0166, 0025, 0256, 0253, 0164, 0132, 0075, 0212, 0127, 0074, 0122, 0256, 0124, 0053, 0343, 
+  0000, 0200, 0371, 0231, 0025, 0343, 0246, 0357, 0136, 0313, 0156, 0160, 0342, 0170, 0246, 0361, 
+  0347, 0201, 0363, 0175, 0255, 0264, 0146, 0114, 0201, 0246, 0032, 0222, 0373, 0045, 0364, 0265, 
+  0003, 0310, 0152, 0126, 0145, 0177, 0126, 0262, 0023, 0253, 0126, 0025, 0340, 0001, 0271, 0003, 
+  0351, 0256, 0355, 0263, 0272, 0204, 0110, 0133, 0111, 0304, 0264, 0373, 0241, 0204, 0325, 0150, 
+  0073, 0246, 0113, 0274, 0222, 0256, 0014, 0370, 0122, 0273, 0172, 0343, 0373, 0013, 0104, 0154, 
+  0373, 0334, 0135, 0301, 0330, 0233, 0153, 0244, 0213, 0157, 0011, 0367, 0241, 0266, 0363, 0352, 
+  0115, 0275, 0045, 0224, 0126, 0257, 0025, 0162, 0111, 0022, 0373, 0074, 0317, 0123, 0052, 0265, 
+  0365, 0243, 0176, 0012, 0275, 0365, 0211, 0036, 0036, 0106, 0364, 0365, 0376, 0000, 0330, 0075, 
+  0240, 0115, 0325, 0332, 0054, 0007, 0370, 0000, 0103, 0070, 0334, 0224, 0326, 0374, 0077, 0304, 
+  0075, 0326, 0014, 0217, 0141, 0206, 0203, 0046, 0314, 0060, 0115, 0375, 0164, 0325, 0263, 0324, 
+  0256, 0064, 0334, 0045, 0072, 0127, 0252, 0122, 0350, 0167, 0122, 0224, 0335, 0123, 0164, 0337, 
+  0327, 0354, 0373, 0231, 0077, 0270, 0202, 0051, 0347, 0363, 0304, 0323, 0054, 0223, 0210, 0327, 
+  0145, 0233, 0253, 0371, 0255, 0054, 0345, 0042, 0152, 0272, 0207, 0322, 0216, 0162, 0057, 0112, 
+  0071, 0226, 0063, 0313, 0175, 0200, 0165, 0002, 0373, 0142, 0165, 0323, 0125, 0176, 0057, 0210, 
+  0357, 0244, 0025, 0075, 0100, 0357, 0103, 0165, 0117, 0365, 0251, 0332, 0035, 0075, 0204, 0252, 
+  0127, 0225, 0357, 0316, 0151, 0264, 0140, 0156, 0101, 0254, 0133, 0256, 0017, 0323, 0373, 0361, 
+  0103, 0074, 0132, 0146, 0225, 0077, 0260, 0063, 0233, 0350, 0320, 0364, 0121, 0216, 0352, 0351, 
+  0217, 0063, 0221, 0012, 0013, 0125, 0107, 0100, 0166, 0214, 0160, 0115, 0324, 0352, 0165, 0035, 
+  0221, 0013, 0006, 0013, 0316, 0210, 0327, 0323, 0250, 0317, 0100, 0217, 0235, 0172, 0372, 0355, 
+  0273, 0224, 0173, 0361, 0334, 0246, 0130, 0142, 0326, 0160, 0124, 0074, 0054, 0145, 0052, 0011, 
+  0267, 0312, 0305, 0112, 0141, 0057, 0310, 0015, 0335, 0262, 0045, 0050, 0036, 0126, 0021, 0220, 
+  0061, 0370, 0344, 0306, 0202, 0226, 0333, 0146, 0270, 0375, 0200, 0245, 0102, 0121, 0074, 0143, 
+  0153, 0020, 0337, 0250, 0160, 0012, 0170, 0032, 0360, 0016, 0054, 0274, 0235, 0166, 0272, 0232, 
+  0265, 0070, 0324, 0223, 0015, 0262, 0153, 0376, 0234, 0076, 0271, 0103, 0113, 0156, 0227, 0311, 
+  0375, 0074, 0157, 0062, 0132, 0220, 0363, 0325, 0351, 0023, 0173, 0141, 0211, 0355, 0062, 0261, 
+  0067, 0260, 0010, 0315, 0076, 0130, 0044, 0232, 0014, 0024, 0314, 0326, 0321, 0351, 0243, 0373, 
+  0334, 0242, 0333, 0145, 0164, 0337, 0001, 0120, 0263, 0037, 0073, 0157, 0222, 0134, 0034, 0046, 
+  0033, 0163, 0247, 0117, 0357, 0245, 0245, 0267, 0313, 0364, 0276, 0205, 0045, 0012, 0071, 0141, 
+  0252, 0101, 0170, 0175, 0130, 0236, 0076, 0267, 0127, 0226, 0333, 0056, 0163, 0373, 0011, 0364, 
+  0377, 0344, 0016, 0120, 0020, 0055, 0210, 0337, 0354, 0362, 0330, 0106, 0344, 0351, 0103, 0374, 
+  0302, 0102, 0334, 0145, 0210, 0277, 0021, 0346, 0067, 0310, 0255, 0171, 0241, 0352, 0364, 0231, 
+  0175, 0151, 0231, 0355, 0062, 0263, 0177, 0011, 0220, 0262, 0331, 0151, 0132, 0270, 0026, 0171, 
+  0372, 0354, 0276, 0262, 0354, 0166, 0231, 0335, 0257, 0106, 0077, 0102, 0233, 0215, 0026, 0164, 
+  0247, 0075, 0201, 0255, 0010, 0273, 0221, 0326, 0355, 0025, 0335, 0210, 0011, 0042, 0233, 0164, 
+  0272, 0062, 0221, 0370, 0004, 0320, 0265, 0333, 0150, 0135, 0107, 0127, 0202, 0152, 0226, 0134, 
+  0055, 0360, 0011, 0200, 0333, 0311, 0135, 0264, 0344, 0047, 0042, 0333, 0157, 0211, 0124, 0140, 
+  0131, 0002, 0325, 0062, 0361, 0101, 0070, 0037, 0154, 0017, 0025, 0131, 0076, 0062, 0046, 0203, 
+  0047, 0371, 0212, 0313, 0043, 0045, 0311, 0313, 0030, 0226, 0221, 0126, 0031, 0031, 0164, 0233, 
+  0021, 0363, 0307, 0022, 0322, 0052, 0041, 0035, 0037, 0153, 0344, 0174, 0145, 0001, 0151, 0025, 
+  0220, 0213, 0156, 0003, 0142, 0266, 0362, 0055, 0041, 0255, 0022, 0362, 0274, 0333, 0204, 0154, 
+  0266, 0314, 0055, 0045, 0255, 0122, 0162, 0331, 0155, 0112, 0174, 0130, 0132, 0100, 0132, 0005, 
+  0344, 0252, 0333, 0200, 0154, 0066, 0177, 0055, 0045, 0255, 0122, 0362, 0242, 0333, 0224, 0230, 
+  0255, 0126, 0113, 0110, 0253, 0204, 0274, 0354, 0066, 0041, 0233, 0115, 0115, 0113, 0111, 0253, 
+  0224, 0274, 0352, 0066, 0045, 0372, 0161, 0131, 0100, 0332, 0135, 0072, 0353, 0370, 0372, 0352, 
+  0172, 0237, 0316, 0122, 0322, 0056, 0045, 0203, 0316, 0123, 0042, 0301, 0116, 0175, 0133, 0206, 
+  0344, 0250, 0213, 0254, 0171, 0332, 0347, 0153, 0136, 0067, 0103, 0110, 0132, 0335, 0162, 0131, 
+  0102, 0322, 0152, 0226, 0112, 0330, 0123, 0320, 0105, 0231, 0335, 0123, 0045, 0111, 0303, 0166, 
+  0052, 0074, 0143, 0073, 0353, 0274, 0054, 0335, 0317, 0332, 0160, 0127, 0305, 0134, 0162, 0022, 
+  0357, 0111, 0305, 0275, 0171, 0057, 0142, 0163, 0306, 0227, 0254, 0226, 0034, 0111, 0376, 0205, 
+  0302, 0231, 0174, 0363, 0300, 0326, 0352, 0265, 0046, 0210, 0035, 0064, 0115, 0154, 0172, 0337, 
+  0344, 0344, 0245, 0102, 0046, 0371, 0236, 0166, 0067, 0170, 0352, 0024, 0147, 0136, 0311, 0172, 
+  0005, 0245, 0023, 0271, 0127, 0162, 0176, 0160, 0035, 0011, 0263, 0200, 0213, 0036, 0177, 0170, 
+  0175, 0314, 0074, 0111, 0372, 0316, 0156, 0211, 0374, 0077, 0107, 0112, 0042, 0366, 0104, 0162, 
+  0343, 0324, 0315, 0233, 0130, 0307, 0157, 0177, 0366, 0004, 0247, 0024, 0374, 0157, 0161, 0336, 
+  0320, 0037, 0354, 0260, 0353, 0124, 0227, 0001, 0326, 0015, 0165, 0215, 0345, 0072, 0023, 0302, 
+  0232, 0116, 0222, 0163, 0003, 0367, 0352, 0053, 0201, 0145, 0062, 0224, 0335, 0162, 0001, 0036, 
+  0226, 0312, 0125, 0372, 0162, 0113, 0257, 0237, 0325, 0025, 0001, 0332, 0334, 0223, 0120, 0264, 
+  0366, 0013, 0154, 0161, 0044, 0267, 0300, 0142, 0106, 0130, 0251, 0045, 0346, 0234, 0134, 0234, 
+  0036, 0310, 0165, 0227, 0144, 0326, 0335, 0173, 0034, 0277, 0250, 0371, 0237, 0361, 0205, 0224, 
+  0207, 0321, 0303, 0152, 0236, 0224, 0316, 0225, 0270, 0257, 0323, 0203, 0320, 0327, 0257, 0037, 
+  0133, 0325, 0213, 0307, 0360, 0324, 0037, 0242, 0256, 0157, 0212, 0076, 0101, 0310, 0313, 0275, 
+  0305, 0127, 0376, 0256, 0076, 0110, 0117, 0220, 0060, 0266, 0354, 0324, 0267, 0374, 0000, 0220, 
+  0012, 0000, 0231, 0106, 0134, 0233, 0106, 0144, 0144, 0274, 0255, 0027, 0331, 0027, 0314, 0236, 
+  0212, 0004, 0330, 0250, 0272, 0271, 0030, 0245, 0312, 0020, 0333, 0160, 0162, 0300, 0377, 0123, 
+  0054, 0264, 0061, 0346, 0143, 0106, 0100, 0045, 0343, 0133, 0033, 0070, 0165, 0061, 0160, 0312, 
+  0112, 0074, 0175, 0145, 0303, 0255, 0343, 0204, 0133, 0046, 0324, 0062, 0343, 0152, 0347, 0137, 
+  0355, 0317, 0325, 0253, 0160, 0111, 0104, 0140, 0037, 0213, 0334, 0065, 0221, 0306, 0264, 0155, 
+  0112, 0343, 0124, 0030, 0314, 0032, 0207, 0063, 0231, 0251, 0171, 0157, 0101, 0164, 0014, 0303, 
+  0146, 0275, 0130, 0047, 0033, 0217, 0374, 0117, 0126, 0371, 0266, 0323, 0164, 0047, 0114, 0123, 
+  0302, 0346, 0356, 0124, 0261, 0222, 0256, 0054, 0047, 0143, 0267, 0371, 0035, 0241, 0102, 0353, 
+  0103, 0050, 0316, 0074, 0276, 0250, 0274, 0222, 0327, 0242, 0233, 0254, 0236, 0117, 0073, 0115, 
+  0112, 0305, 0274, 0330, 0261, 0210, 0235, 0323, 0041, 0074, 0112, 0274, 0071, 0370, 0133, 0207, 
+  0103, 0304, 0317, 0047, 0343, 0140, 0210, 0346, 0046, 0157, 0371, 0023, 0267, 0135, 0122, 0112, 
+  0315, 0334, 0016, 0234, 0265, 0125, 0146, 0251, 0271, 0071, 0333, 0265, 0171, 0004, 0110, 0161, 
+  0364, 0233, 0351, 0306, 0152, 0155, 0350, 0220, 0203, 0173, 0352, 0253, 0302, 0365, 0102, 0372, 
+  0241, 0235, 0161, 0125, 0363, 0352, 0237, 0214, 0351, 0243, 0217, 0070, 0374, 0061, 0123, 0256, 
+  0141, 0313, 0123, 0256, 0303, 0063, 0355, 0127, 0111, 0055, 0137, 0154, 0156, 0225, 0315, 0254, 
+  0070, 0317, 0376, 0256, 0212, 0073, 0137, 0216, 0222, 0043, 0167, 0326, 0077, 0054, 0225, 0017, 
+  0065, 0166, 0056, 0243, 0315, 0161, 0105, 0143, 0247, 0167, 0351, 0114, 0326, 0307, 0327, 0214, 
+  0372, 0073, 0205, 0212, 0253, 0276, 0330, 0124, 0035, 0246, 0126, 0375, 0356, 0242, 0334, 0071, 
+  0011, 0151, 0155, 0167, 0346, 0134, 0251, 0051, 0026, 0217, 0147, 0040, 0205, 0024, 0173, 0020, 
+  0160, 0252, 0007, 0340, 0376, 0236, 0172, 0243, 0376, 0346, 0314, 0254, 0311, 0263, 0121, 0177, 
+  0353, 0000, 0261, 0377, 0000, 0307, 0055, 0351, 0321, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 
+  0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0167, 0145, 0141, 0164, 0150, 0145, 0162, 0057, 0005, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0167, 0145, 0141, 0164, 0150, 0145, 0162, 0055, 0141, 0160, 0160, 0154, 
+  0145, 0164, 0055, 0155, 0145, 0156, 0165, 0056, 0170, 0155, 0154, 0000, 0000, 0000, 0000, 0000, 
+  0342, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0263, 0311, 0115, 0315, 0053, 0315, 
+  0054, 0111, 0315, 0125, 0310, 0113, 0314, 0115, 0265, 0125, 0362, 0004, 0061, 0015, 0225, 0024, 
+  0022, 0223, 0113, 0062, 0363, 0363, 0154, 0225, 0134, 0122, 0113, 0022, 0063, 0163, 0212, 0225, 
+  0024, 0364, 0355, 0270, 0154, 0260, 0251, 0065, 0102, 0250, 0015, 0055, 0110, 0111, 0054, 0111, 
+  0205, 0050, 0055, 0116, 0055, 0110, 0054, 0112, 0054, 0311, 0057, 0302, 0245, 0317, 0030, 0241, 
+  0057, 0240, 0050, 0277, 0000, 0217, 0015, 0046, 0010, 0225, 0036, 0251, 0071, 0005, 0270, 0025, 
+  0232, 0042, 0024, 0072, 0046, 0345, 0227, 0226, 0200, 0125, 0162, 0001, 0000, 0351, 0320, 0110, 
+  0262, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 0055, 0141, 0160, 0160, 
+  0154, 0145, 0164, 0163, 0057, 0000, 0000, 0000, 0003, 0000, 0000, 0000
+} };
+
+static GStaticResource static_resource = { mateweather_resource_data.data, sizeof (mateweather_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *mateweather_get_resource (void);
+GResource *mateweather_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * 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.1 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/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CONSTRUCTOR_H__
+#define __G_CONSTRUCTOR_H__
+
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+/*
+ * Only try to include gslist.h if not already included via glib.h,
+ * so that items using gconstructor.h outside of GLib (such as
+ * GResources) continue to build properly.
+ */
+#ifndef __G_LIB_H__
+#include "gslist.h"
+#endif
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+#endif /* __G_CONSTRUCTOR_H__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(mateweatherresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(mateweatherresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(mateweatherresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(mateweatherresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void mateweatherresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void mateweatherresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/111.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/111.html new file mode 100644 index 00000000..ac21f03f --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/111.html @@ -0,0 +1,343 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "autoscaler.h"
+
+/* i wish i could have used C99 initializers instead of writing this function */
+void
+autoscaler_init (AutoScaler *that,
+                 gint64      interval,
+                 guint64     floor)
+{
+    that->update_interval = interval;
+    that->floor = floor;
+    that->max = 0;
+    that->count = 0;
+    that->last_update = 0;
+    that->sum = 0;
+    that->last_average = 0.0f;
+}
+
+guint64
+autoscaler_get_max (AutoScaler *that,
+                    guint64     current)
+{
+    gint64 now;
+
+    that->sum += current;
+    that->count++;
+    now = g_get_monotonic_time ();
+
+    if ((now - that->last_update) > that->update_interval)
+    {
+        float new_average = (float) that->sum / (float) that->count;
+        float average;
+
+        if (new_average < that->last_average)
+            average = ((that->last_average * 0.5f) + new_average) / 1.5f;
+        else
+            average = new_average;
+
+        that->max = (guint64) (average * 1.2f);
+        that->sum = 0;
+        that->count = 0;
+        that->last_update = now;
+        that->last_average = average;
+    }
+
+    that->max = MAX(that->max, current);
+    that->max = MAX(that->max, that->floor);
+#if 0
+    printf("%p max = %u, current = %u, last_average = %f\n", that, that->max, current, that->last_average);
+#endif
+    return that->max;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/112.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/112.html new file mode 100644 index 00000000..c955068c --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/112.html @@ -0,0 +1,281 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
#ifndef MATE_APPLETS_MULTILOAD_AUTOSCALER_H
+#define MATE_APPLETS_MULTILOAD_AUTOSCALER_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+typedef struct _AutoScaler AutoScaler;
+
+struct _AutoScaler
+{
+    gint64 update_interval;
+    gint64 last_update;
+    guint64 floor;
+    guint64 max;
+    guint64 count;
+    guint64 sum;
+    float last_average;
+};
+
+G_GNUC_INTERNAL void    autoscaler_init    (AutoScaler *that, gint64  interval, guint64 floor);
+G_GNUC_INTERNAL guint64 autoscaler_get_max (AutoScaler *that, guint64 current);
+
+#endif /* MATE_APPLETS_MULTILOAD_AUTOSCALER_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/113.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/113.html new file mode 100644 index 00000000..cd772a59 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/113.html @@ -0,0 +1,1097 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
/* From wmload.c, v0.9.2, licensed under the GPL. */
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/statvfs.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <fcntl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glibtop.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glibtop/cpu.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glibtop/mem.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glibtop/swap.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glibtop/loadavg.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glibtop/netload.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glibtop/netlist.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glibtop/mountlist.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glibtop/fsusage.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "linux-proc.h"
+#include "autoscaler.h"
+
+static const unsigned needed_cpu_flags =
+(1 << GLIBTOP_CPU_USER) +
+(1 << GLIBTOP_CPU_IDLE) +
+(1 << GLIBTOP_CPU_SYS) +
+(1 << GLIBTOP_CPU_NICE);
+
+#if 0
+static const unsigned needed_page_flags =
+(1 << GLIBTOP_SWAP_PAGEIN) +
+(1 << GLIBTOP_SWAP_PAGEOUT);
+#endif
+
+static const unsigned needed_mem_flags =
+(1 << GLIBTOP_MEM_USED) +
+(1 << GLIBTOP_MEM_FREE);
+
+static const unsigned needed_swap_flags =
+(1 << GLIBTOP_SWAP_USED) +
+(1 << GLIBTOP_SWAP_FREE);
+
+static const unsigned needed_loadavg_flags =
+(1 << GLIBTOP_LOADAVG_LOADAVG);
+
+static const unsigned needed_netload_flags =
+(1 << GLIBTOP_NETLOAD_IF_FLAGS) +
+(1 << GLIBTOP_NETLOAD_BYTES_TOTAL);
+
+void
+GetLoad (guint64    Maximum,
+         guint64    data [cpuload_n],
+         LoadGraph *g)
+{
+    MultiloadApplet *multiload;
+    glibtop_cpu cpu;
+    guint64 cpu_aux [cpuload_n], used = 0, total = 0;
+    guint64 current_scaled, used_scaled = 0;
+    unsigned i;
+
+    glibtop_get_cpu (&cpu);
+
+    g_return_if_fail ((cpu.flags & needed_cpu_flags) == needed_cpu_flags);
+
+    multiload = g->multiload;
+
+    multiload->cpu_time [cpuload_usr]    = cpu.user;
+    multiload->cpu_time [cpuload_nice]   = cpu.nice;
+    multiload->cpu_time [cpuload_sys]    = cpu.sys;
+    multiload->cpu_time [cpuload_iowait] = cpu.iowait + cpu.irq + cpu.softirq;
+    multiload->cpu_time [cpuload_free]   = cpu.idle;
+
+    if (!multiload->cpu_initialized) {
+        memcpy (multiload->cpu_last, multiload->cpu_time, sizeof (multiload->cpu_last));
+        multiload->cpu_initialized = TRUE;
+    }
+
+    for (i = 0; i < cpuload_n; i++) {
+        cpu_aux [i] = multiload->cpu_time [i] - multiload->cpu_last [i];
+        total += cpu_aux [i];
+    }
+
+    for (i = 0; i < cpuload_free; i++) {
+        used += cpu_aux [i];
+        current_scaled = (guint64) ((float)(cpu_aux [i] * Maximum) / (float)total);
+        used_scaled += current_scaled;
+        data [i] = current_scaled;
+    }
+    data [cpuload_free] = Maximum - used_scaled;
+
+    multiload->cpu_used_ratio = (float)(used) / (float)total;
+
+    memcpy (multiload->cpu_last, multiload->cpu_time, sizeof multiload->cpu_last);
+}
+
+void
+GetDiskLoad (guint64    Maximum,
+             guint64    data [diskload_n],
+             LoadGraph *g)
+{
+    static gboolean first_call = TRUE;
+    static guint64 lastread = 0, lastwrite = 0;
+    static AutoScaler scaler;
+
+    guint64 max;
+    guint64 read, write;
+    guint64 readdiff, writediff;
+    guint   i;
+
+    MultiloadApplet *multiload;
+
+    multiload = g->multiload;
+
+    if(first_call)
+    {
+        autoscaler_init (&scaler, g->speed, 500);
+    }
+
+    read = write = 0;
+
+    if (multiload->nvme_diskstats)
+    {
+        FILE *fdr;
+        char line[255];
+        guint64 s_read, s_write;
+
+        fdr = fopen("/proc/diskstats", "r");
+        if (!fdr)
+        {
+            multiload->nvme_diskstats = FALSE;
+            g_settings_set_boolean (multiload->settings, "diskload-nvme-diskstats", FALSE);
+            return;
+        }
+
+        while (fgets(line, 255, fdr))
+        {
+            /* Match main device, rather than individual partitions (e.g. nvme0n1) */
+            if (!g_regex_match_simple("\\snvme\\d+\\w+\\d+\\s", line, 0, 0))
+            {
+                continue;
+            }
+
+            /*
+               6 - sectors read
+               10 - sectors written
+               */
+            if (sscanf(line, "%*d %*d %*s %*d %*d %ld %*d %*d %*d %ld", &s_read, &s_write) == 2)
+            {
+                read += 512 * s_read;
+                write += 512 * s_write;
+            }
+        }
+        fclose(fdr);
+    }
+    else
+    {
+        glibtop_mountlist mountlist;
+        glibtop_mountentry *mountentries;
+
+        mountentries = glibtop_get_mountlist (&mountlist, FALSE);
+
+        for (i = 0; i < mountlist.number; i++)
+        {
+            struct statvfs statresult;
+            glibtop_fsusage fsusage;
+
+            if (strstr (mountentries[i].devname, "/dev/") == NULL)
+                continue;
+
+            if (strstr (mountentries[i].mountdir, "/media/") != NULL)
+                continue;
+
+            if (statvfs (mountentries[i].mountdir, &statresult) < 0)
+            {
+                g_debug ("Failed to get statistics for mount entry: %s. Reason: %s. Skipping entry.",
+                         mountentries[i].mountdir, strerror(errno));
+                continue;
+            }
+
+            glibtop_get_fsusage(&fsusage, mountentries[i].mountdir);
+            read += fsusage.read;
+            write += fsusage.write;
+        }
+
+        g_free(mountentries);
+    }
+
+    readdiff  = read - lastread;
+    writediff = write - lastwrite;
+
+    lastread  = read;
+    lastwrite = write;
+
+    if(first_call)
+    {
+        first_call = FALSE;
+        memset(data, 0, 3 * sizeof data[0]);
+        return;
+    }
+
+    max = autoscaler_get_max(&scaler, readdiff + writediff);
+
+    multiload->diskload_used_ratio = (float)(readdiff + writediff) / (float)max;
+
+    data [diskload_read]  = (guint64) ((float)Maximum *  (float)readdiff / (float)max);
+    data [diskload_write] = (guint64) ((float)Maximum * (float)writediff / (float)max);
+    data [diskload_free]  = Maximum - (data [0] + data[1]);
+}
+
+/* GNU/Linux:
+ *   aux [memload_user]   = (mem.total - mem.free) - (mem.cached + mem.buffer)
+ *   aux [memload_shared] = mem.shared;
+ *   aux [memload_cached] = mem.cached - mem.shared;
+ *   aux [memload_buffer] = mem.buffer;
+ *
+ * Other operating systems:
+ *   aux [memload_user]   = mem.user;
+ *   aux [memload_shared] = mem.shared;
+ *   aux [memload_cached] = mem.cached;
+ *   aux [memload_buffer] = mem.buffer;
+ */
+void
+GetMemory (guint64    Maximum,
+           guint64    data [memload_n],
+           LoadGraph *g)
+{
+    MultiloadApplet *multiload;
+    glibtop_mem mem;
+    guint64 aux [memload_n], cache = 0;
+    guint64 current_scaled, used_scaled = 0;
+    int i;
+
+    glibtop_get_mem (&mem);
+
+    g_return_if_fail ((mem.flags & needed_mem_flags) == needed_mem_flags);
+
+#ifndef __linux__
+    aux [memload_user]   = mem.user;
+    aux [memload_cached] = mem.cached;
+#else
+    aux [memload_user]   = mem.total - mem.free - mem.buffer - mem.cached;;
+    aux [memload_cached] = mem.cached - mem.shared;
+#endif /* __linux__ */
+    aux [memload_shared] = mem.shared;
+    aux [memload_buffer] = mem.buffer;
+
+    for (i = 0; i < memload_free; i++) {
+        current_scaled = (guint64) ((float)(aux [i] * Maximum) / (float)mem.total);
+        if (i != memload_user) {
+            cache += aux [i];
+        }
+        used_scaled += current_scaled;
+        data [i] = current_scaled;
+    }
+    data [memload_free] = MAX (Maximum - used_scaled, 0);
+
+    multiload = g->multiload;
+    multiload->memload_user  = aux [memload_user];
+    multiload->memload_cache = cache;
+    multiload->memload_total = mem.total;
+}
+
+void
+GetSwap (guint64    Maximum,
+         guint64    data [swapload_n],
+         LoadGraph *g)
+{
+    guint64 used;
+    MultiloadApplet *multiload;
+    glibtop_swap swap;
+
+    glibtop_get_swap (&swap);
+    g_return_if_fail ((swap.flags & needed_swap_flags) == needed_swap_flags);
+
+    multiload = g->multiload;
+
+    if (swap.total == 0) {
+        used = 0;
+        multiload->swapload_used_ratio = 0.0f;
+    }
+    else {
+        float ratio;
+
+        ratio = (float)swap.used / (float)swap.total;
+        used = (guint64) ((float) Maximum * ratio);
+        multiload->swapload_used_ratio = ratio;
+    }
+
+    data [0] = used;
+    data [1] = Maximum - used;
+}
+
+void
+GetLoadAvg (guint64    Maximum,
+            guint64    data [2],
+            LoadGraph *g)
+{
+    glibtop_loadavg loadavg;
+    MultiloadApplet *multiload;
+
+    glibtop_get_loadavg (&loadavg);
+
+    g_return_if_fail ((loadavg.flags & needed_loadavg_flags) == needed_loadavg_flags);
+
+    multiload = g->multiload;
+    multiload->loadavg1 = loadavg.loadavg[0];
+
+    data [0] = (guint64) ((float) Maximum * loadavg.loadavg[0]);
+    data [1] = Maximum - data[0];
+}
+
+/*
+ * Return true if a network device (identified by its name) is virtual
+ * (ie: not corresponding to a physical device). In case it is a physical
+ * device or unknown, returns false.
+ */
+static gboolean
+is_net_device_virtual(char *device)<--- Parameter 'device' can be declared as pointer to const
+{
+    /*
+     * There is not definitive way to find out. On some systems (Linux
+     * kernels ≳ 2.19 without option SYSFS_DEPRECATED), there exist a
+     * directory /sys/devices/virtual/net which only contains virtual
+     * devices.  It's also possible to detect by the fact that virtual
+     * devices do not have a symlink "device" in
+     * /sys/class/net/name-of-dev/ .  This second method is more complex
+     * but more reliable.
+     */
+    gboolean ret = FALSE;
+    char *path = malloc (strlen (device) + strlen ("/sys/class/net//device") + 1);
+
+    if (path == NULL)
+        return FALSE;
+
+    /* Check if /sys/class/net/name-of-dev/ exists (may be old linux kernel
+     * or not linux at all). */
+    do {
+        if (sprintf(path, "/sys/class/net/%s", device) < 0)
+            break;
+        if (access(path, F_OK) != 0)
+            break; /* unknown */
+
+        if (sprintf(path, "/sys/class/net/%s/device", device) < 0)
+            break;
+        if (access(path, F_OK) != 0)
+            ret = TRUE;
+    } while (0);
+
+    free (path);
+    return ret;
+}
+
+void
+GetNet (guint64    Maximum,
+        guint64    data [4],
+        LoadGraph *g)
+{
+    enum Types {
+        IN_COUNT = 0,
+        OUT_COUNT = 1,
+        LOCAL_COUNT = 2,
+        COUNT_TYPES = 3
+    };
+
+    static int ticks = 0;
+    static guint64 past[COUNT_TYPES] = {0};
+
+    guint64 present[COUNT_TYPES] = {0};
+
+    guint i;
+    gchar **devices;
+    glibtop_netlist netlist;
+
+    MultiloadApplet *multiload;
+
+    multiload = g->multiload;
+    devices = glibtop_get_netlist(&netlist);
+
+    for(i = 0; i < netlist.number; ++i)
+    {
+        glibtop_netload netload;
+
+        glibtop_get_netload(&netload, devices[i]);
+
+        g_return_if_fail((netload.flags & needed_netload_flags) == needed_netload_flags);
+
+        if (!(netload.if_flags & (1L << GLIBTOP_IF_FLAGS_UP)))
+            continue;
+
+        if (netload.if_flags & (1L << GLIBTOP_IF_FLAGS_LOOPBACK)) {
+            /* for loopback in and out are identical, so only count in */
+            present[LOCAL_COUNT] += netload.bytes_in;
+            continue;
+        }
+
+        /*
+         * Do not include virtual devices (VPN, PPPOE...) to avoid
+         * counting the same throughput several times.
+         */
+        if (is_net_device_virtual(devices[i]))
+            continue;
+
+        present[IN_COUNT] += netload.bytes_in;
+        present[OUT_COUNT] += netload.bytes_out;
+    }
+
+    g_strfreev(devices);
+    netspeed_add (multiload->netspeed_in, present[IN_COUNT]);
+    netspeed_add (multiload->netspeed_out, present[OUT_COUNT]);
+
+    if(ticks < 2) /* avoid initial spike */
+    {
+        ticks++;
+        memset(data, 0, (COUNT_TYPES + 1) * sizeof data[0]);
+    }
+    else
+    {
+        data[COUNT_TYPES] = 0;
+        float seconds = (float) g->speed / 1000.0f;
+        for (i = 0; i < COUNT_TYPES; i++)
+        {
+            /* protect against weirdness */
+            if (present[i] >= past[i])
+                data[i] = (guint) ((float) (present[i] - past[i]) / seconds);
+            else
+                data[i] = 0;
+            data[COUNT_TYPES] += data[i];
+        }
+    }
+
+    memcpy(past, present, sizeof past);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/114.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/114.html new file mode 100644 index 00000000..eab6309d --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/114.html @@ -0,0 +1,263 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
#ifndef LINUX_PROC_H__
+#define LINUX_PROC_H__
+
+#include <load-graph.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_GNUC_INTERNAL void GetLoad     (guint64 Maximum, guint64 data [cpuload_n],  LoadGraph *g);
+G_GNUC_INTERNAL void GetDiskLoad (guint64 Maximum, guint64 data [diskload_n], LoadGraph *g);
+G_GNUC_INTERNAL void GetMemory   (guint64 Maximum, guint64 data [memload_n],  LoadGraph *g);
+G_GNUC_INTERNAL void GetSwap     (guint64 Maximum, guint64 data [swapload_n], LoadGraph *g);
+G_GNUC_INTERNAL void GetLoadAvg  (guint64 Maximum, guint64 data [2],          LoadGraph *g);
+G_GNUC_INTERNAL void GetNet      (guint64 Maximum, guint64 data [4],          LoadGraph *g);
+
+#endif
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/115.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/115.html new file mode 100644 index 00000000..aae7a471 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/115.html @@ -0,0 +1,1311 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/stat.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <signal.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <dirent.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet-gsettings.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <math.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "global.h"
+
+/*
+  Shifts data right
+
+  data[i+1] = data[i]
+
+  data[i] are int*, so we just move the pointer, not the data.
+  But moving data loses data[n-1], so we save data[n-1] and reuse
+  it as new data[0]. In fact, we rotate data[].
+
+*/
+
+static void
+shift_right(LoadGraph *g)
+{
+    guint64 *last_data;
+    gsize i;
+
+    /* data[g->draw_width - 1] becomes data[0] */
+    last_data = g->data[g->draw_width - 1];
+
+    /* data[i+1] = data[i] */
+    for (i = g->draw_width - 1; i != 0; --i)
+      g->data[i] = g->data[i - 1];
+
+    g->data[0] = last_data;
+}
+
+/* Redraws the backing pixmap for the load graph and updates the window */
+static void
+load_graph_draw (LoadGraph *g)
+{
+  guint i, j, k;
+  cairo_t *cr;
+  MultiloadApplet *multiload;
+
+  multiload = g->multiload;
+
+  /* we might get called before the configure event so that
+   * g->disp->allocation may not have the correct size
+   * (after the user resized the applet in the prop dialog). */
+
+  if (!g->surface)
+    g->surface = gdk_window_create_similar_surface (gtk_widget_get_window (g->disp),
+                                                    CAIRO_CONTENT_COLOR,
+                                                    (int) g->draw_width,
+                                                    (int) g->draw_height);
+
+  cr = cairo_create (g->surface);
+  cairo_set_line_width (cr, 1.0);
+  cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
+  cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
+
+  /* all graphs except Load and Net go this path */
+  switch (g->id) {
+
+  /* This is for network graph */
+  case graph_netload2: {
+    guint64 maxnet = 1;
+    guint64 segments = 1;
+    guint64 net_threshold;
+    guint   level = 0;
+    double  ratio;
+    double  spacing;
+
+    for (i = 0; i < g->draw_width; i++)
+    {
+      g->pos [i] = g->draw_height - 1;
+      if (g->data[i][3] > maxnet)
+        maxnet = g->data[i][3];
+    }
+    //printf("max = %d ", maxnet);
+    if (maxnet > multiload->net_threshold3) {
+      net_threshold = multiload->net_threshold3;
+      level = 3;
+    }
+    else
+      if (maxnet > multiload->net_threshold2) {
+        net_threshold = multiload->net_threshold2;
+        level = 2;
+      }
+      else {
+        net_threshold = multiload->net_threshold1;
+        if (maxnet >= multiload->net_threshold1)
+            level = 1;
+      }
+
+    //printf("level %d maxnet = %d ", level, maxnet);
+    maxnet = maxnet/net_threshold;
+    segments = MAX (maxnet+1,1);
+    ratio = (double) g->draw_height / (double) (net_threshold*segments);
+    //printf("segments %d ratio = %f t1=%ld t2=%ld t3=%ld t=%ld\n", segments, ratio, multiload->net_threshold1, multiload->net_threshold2, multiload->net_threshold3, multiload->net_threshold);
+
+    for (j = 0; j < g->n-1; j++)
+    {
+      gdk_cairo_set_source_rgba (cr, &(g->colors [j]));
+
+      for (i = 0; i < g->draw_width; i++)
+      {
+        double x = (double) (g->draw_width - i) - 0.5;
+        cairo_move_to (cr, x, (double) g->pos[i] + 0.5);
+        cairo_line_to (cr, x, (double) g->pos[i] - 0.5 - (((double) g->data [i][j] * ratio)));
+        g->pos [i] -= (guint64) ((double) g->data [i][j] * ratio);
+      }
+      cairo_stroke (cr);
+    }
+
+    for (j = g->n-1; j < g->n; j++)
+    {
+      gdk_cairo_set_source_rgba (cr, &(g->colors [j]));
+      for (i = 0; i < g->draw_width; i++)
+      {
+          double x = (double) (g->draw_width - i) - 0.5;
+          cairo_move_to (cr, x, (double) g->pos[i] + 0.5);
+          cairo_line_to (cr, x, 0.5);
+      }
+      cairo_stroke (cr);
+    }
+
+    /* draw grid lines if needed */
+    gdk_cairo_set_source_rgba (cr, &(g->colors [4]));
+    for (k = 0; k < segments -1; k++)
+    {
+      spacing = ((double) g->draw_height / (double) segments) * (k+1);
+      cairo_move_to (cr, 0.5, spacing);
+      cairo_line_to (cr, (double) g->draw_width - 0.5, spacing);
+    }
+    cairo_stroke (cr);
+    /* draw indicator if needed */
+    if (level > 0)
+    {
+      gdk_cairo_set_source_rgba (cr, &(g->colors [5]));
+      for (k = 0; k< level; k++ )
+        cairo_rectangle (cr,
+                         0.5, (double) k * 2.0 * (double) g->draw_height / 5.0,
+                         5.0, (double) g->draw_height / 5.0);
+      cairo_fill(cr);
+    }
+    cairo_stroke (cr);
+    break;
+  }
+
+  /* this is Load graph */
+  case graph_loadavg: {
+    double load;
+    guint64 maxload = 1;
+    for (i = 0; i < g->draw_width; i++)
+    {
+      g->pos [i] = g->draw_height - 1;
+      /* find maximum value */
+      if (g->data[i][0] > maxload)
+        maxload = g->data[i][0];
+    }
+    load = ceil ((double) maxload / (double) g->draw_height) + 1.0;
+
+    for (j = 0; j < g->n; j++)
+    {
+      gdk_cairo_set_source_rgba (cr, &(g->colors [j]));
+
+      for (i = 0; i < g->draw_width; i++)
+      {
+        double x = (double) (g->draw_width - i) - 0.5;
+        cairo_move_to (cr, x, (double) g->pos[i] + 0.5);
+        if (j == 0)
+        {
+          cairo_line_to (cr, x, (double) g->pos[i] - (((double) g->data [i][j] - 0.5)/load));
+        }
+        else
+        {
+          cairo_line_to (cr, x, 0.5);
+        }
+        g->pos [i] -= (guint64) ((double) g->data [i][j] / load);
+      }
+      cairo_stroke (cr);
+    }
+
+    /* draw grid lines in Load graph if needed */
+    gdk_cairo_set_source_rgba (cr, &(g->colors [2]));
+
+    double spacing;
+    for (k = 0; k < load - 1; k++)
+    {
+      spacing = ((double) g->draw_height/load) * (k+1);
+      cairo_move_to (cr, 0.5, spacing);
+      cairo_line_to (cr, (double) g->draw_width - 0.5, spacing);
+    }
+
+    cairo_stroke (cr);
+    break;
+  }
+
+  default:
+    for (i = 0; i < g->draw_width; i++)
+      g->pos [i] = g->draw_height - 1;
+
+    for (j = 0; j < g->n; j++)
+    {
+      gdk_cairo_set_source_rgba (cr, &(g->colors [j]));
+
+      for (i = 0; i < g->draw_width; i++)
+      {
+        if (g->data [i][j] != 0)
+        {
+          double x = (double) (g->draw_width - i) - 0.5;
+          cairo_move_to (cr, x, (double) g->pos[i] + 0.5);
+          cairo_line_to (cr, x, (double) g->pos[i] - (double) g->data [i][j] - 0.5);
+        }
+        g->pos [i] -= g->data [i][j];
+      }
+      cairo_stroke (cr);
+    }
+  }
+
+  gtk_widget_queue_draw (g->disp);
+
+  cairo_destroy (cr);
+}
+
+/* Updates the load graph when the timeout expires */
+static gboolean
+load_graph_update (LoadGraph *g)
+{
+    if (g->data == NULL)
+        return TRUE;
+
+    shift_right(g);
+
+    if (g->tooltip_update)
+        multiload_applet_tooltip_update (g);
+
+    g->get_data (g->draw_height, g->data [0], g);
+
+    load_graph_draw (g);
+    return TRUE;
+}
+
+void
+load_graph_unalloc (LoadGraph *g)
+{
+    gsize i;
+
+    if (!g->allocated)
+        return;
+
+    for (i = 0; i < g->draw_width; i++)
+    {
+        g_free (g->data [i]);
+    }
+
+    g_free (g->data);
+    g_free (g->pos);
+
+    g->pos = NULL;
+    g->data = NULL;
+
+    g->size = CLAMP (g_settings_get_uint (g->multiload->settings, GRAPH_SIZE_KEY),
+                     GRAPH_SIZE_MIN,
+                     GRAPH_SIZE_MAX);
+
+    if (g->surface) {
+        cairo_surface_destroy (g->surface);
+        g->surface = NULL;
+    }
+
+    g->allocated = FALSE;
+}
+
+static void
+load_graph_alloc (LoadGraph *g)
+{
+    gsize i;
+    gsize data_size;
+
+    if (g->allocated)
+        return;
+
+    g->data = g_new0 (guint64 *, g->draw_width);
+    g->pos = g_new0 (guint64, g->draw_width);
+
+    data_size = sizeof (guint64) * g->n;
+
+    for (i = 0; i < g->draw_width; i++) {
+        g->data [i] = g_malloc0 (data_size);
+    }
+
+    g->allocated = TRUE;
+}
+
+static gint
+load_graph_configure (GtkWidget *widget, GdkEventConfigure *event,
+                      gpointer data_ptr)
+{
+    GtkAllocation allocation;
+    LoadGraph *c = (LoadGraph *) data_ptr;
+
+    load_graph_unalloc (c);
+
+    gtk_widget_get_allocation (c->disp, &allocation);
+
+    c->draw_width = (gsize) allocation.width;
+    c->draw_height = (guint64) allocation.height;
+    c->draw_width = MAX (c->draw_width, 1);
+    c->draw_height = MAX (c->draw_height, 1);
+
+    load_graph_alloc (c);
+
+    if (!c->surface)
+        c->surface = gdk_window_create_similar_surface (gtk_widget_get_window (c->disp),
+                                                        CAIRO_CONTENT_COLOR,
+                                                        (int) c->draw_width,
+                                                        (int) c->draw_height);
+    gtk_widget_queue_draw (widget);
+
+    return TRUE;
+}
+
+static gint
+load_graph_expose (GtkWidget *widget,
+                   cairo_t *cr,
+                   gpointer data_ptr)
+{
+    LoadGraph *g = (LoadGraph *) data_ptr;
+
+    cairo_set_source_surface (cr, g->surface, 0, 0);
+    cairo_paint (cr);
+
+    return FALSE;
+}
+
+static void
+load_graph_destroy (GtkWidget *widget, gpointer data_ptr)
+{
+    LoadGraph *g = (LoadGraph *) data_ptr;
+
+    load_graph_stop (g);
+
+    gtk_widget_destroy(widget);
+}
+
+static gboolean
+load_graph_clicked (GtkWidget *widget, GdkEventButton *event, LoadGraph *load)
+{
+    load->multiload->last_clicked = load->id;
+
+    return FALSE;
+}
+
+static gboolean
+load_graph_enter_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
+{
+    LoadGraph *graph;
+    graph = (LoadGraph *)data;
+
+    graph->tooltip_update = TRUE;
+    multiload_applet_tooltip_update(graph);
+
+    return TRUE;
+}
+
+static gboolean
+load_graph_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
+{
+    LoadGraph *graph;
+    graph = (LoadGraph *)data;
+
+    graph->tooltip_update = FALSE;
+
+    return TRUE;
+}
+
+static void
+load_graph_load_config (LoadGraph *g)
+{
+    gchar *name, *temp;
+    guint i;
+
+    if (!g->colors)
+        g->colors = g_new0(GdkRGBA, g->n);
+
+    for (i = 0; i < g->n; i++)
+    {
+        name = g_strdup_printf ("%s-color%u", g->name, i);
+        temp = g_settings_get_string(g->multiload->settings, name);
+        if (!temp)
+            temp = g_strdup ("#000000");
+        gdk_rgba_parse(&(g->colors[i]), temp);
+        g_free(temp);
+        g_free(name);
+    }
+}
+
+LoadGraph *
+load_graph_new (MultiloadApplet *ma, guint n, const gchar *label,
+                gint id, guint speed, guint size, gboolean visible,
+                const gchar *name, LoadGraphDataFunc get_data)
+{
+    LoadGraph *g;
+    MatePanelAppletOrient orient;
+
+    g = g_new0 (LoadGraph, 1);
+    g->visible = visible;
+    g->name = name;
+    g->n = n;
+    g->id = id;
+    g->speed = speed;
+    g->size = size;
+    g->pixel_size = mate_panel_applet_get_size (ma->applet);
+    g->tooltip_update = FALSE;
+    g->multiload = ma;
+
+    g->main_widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+
+    g->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+
+    orient = mate_panel_applet_get_orient (g->multiload->applet);
+    switch (orient)
+    {
+    case MATE_PANEL_APPLET_ORIENT_UP:
+    case MATE_PANEL_APPLET_ORIENT_DOWN:
+    {
+        g->orient = FALSE;
+        break;
+    }
+    case MATE_PANEL_APPLET_ORIENT_LEFT:
+    case MATE_PANEL_APPLET_ORIENT_RIGHT:
+    {
+        g->orient = TRUE;
+        break;
+    }
+    default:
+        g_assert_not_reached ();
+    }
+
+    g->frame = gtk_frame_new (NULL);
+    gtk_frame_set_shadow_type (GTK_FRAME (g->frame), GTK_SHADOW_IN);
+    gtk_container_add (GTK_CONTAINER (g->frame), g->box);
+    gtk_box_pack_start (GTK_BOX (g->main_widget), g->frame, TRUE, TRUE, 0);
+
+    load_graph_load_config (g);
+
+    g->get_data = get_data;
+
+    g->timer_index = -1;
+
+    if (g->orient)
+        gtk_widget_set_size_request (g->main_widget, -1, (gint) g->size);
+    else
+        gtk_widget_set_size_request (g->main_widget, (gint) g->size, -1);
+
+    g->disp = gtk_drawing_area_new ();
+    gtk_widget_set_events (g->disp, GDK_EXPOSURE_MASK |
+                                    GDK_ENTER_NOTIFY_MASK |
+                                    GDK_LEAVE_NOTIFY_MASK |
+                                    GDK_BUTTON_PRESS_MASK);
+
+    g_signal_connect (g->disp, "draw",
+                      G_CALLBACK (load_graph_expose), g);
+    g_signal_connect (g->disp, "configure-event",
+                      G_CALLBACK (load_graph_configure), g);
+    g_signal_connect (g->disp, "destroy",
+                      G_CALLBACK (load_graph_destroy), g);
+    g_signal_connect (g->disp, "button-press-event",
+                      G_CALLBACK (load_graph_clicked), g);
+    g_signal_connect (g->disp, "enter-notify-event",
+                      G_CALLBACK(load_graph_enter_cb), g);
+    g_signal_connect (g->disp, "leave-notify-event",
+                      G_CALLBACK(load_graph_leave_cb), g);
+
+    gtk_box_pack_start (GTK_BOX (g->box), g->disp, TRUE, TRUE, 0);
+    gtk_widget_show_all(g->box);
+
+    return g;
+}
+
+void
+load_graph_start (LoadGraph *g)
+{
+    guint event_source_id;
+
+    if (g->timer_index != -1)
+        g_source_remove ((guint) g->timer_index);
+
+    event_source_id = g_timeout_add (g->speed,
+                                    (GSourceFunc) load_graph_update, g);
+
+    g->timer_index = (gint) event_source_id;
+}
+
+void
+load_graph_stop (LoadGraph *g)
+{
+    if (g->timer_index != -1)
+        g_source_remove ((guint) g->timer_index);
+
+    g->timer_index = -1;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/116.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/116.html new file mode 100644 index 00000000..edb9565a --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/116.html @@ -0,0 +1,677 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
#ifndef __GLOBAL_H__
+#define __GLOBAL_H__
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk-pixbuf/gdk-pixbuf.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define KEY_CPULOAD_USR_COLOR         "cpuload-color0"
+#define KEY_CPULOAD_SYS_COLOR         "cpuload-color1"
+#define KEY_CPULOAD_NICE_COLOR        "cpuload-color2"
+#define KEY_CPULOAD_IOWAIT_COLOR      "cpuload-color3"
+#define KEY_CPULOAD_IDLE_COLOR        "cpuload-color4"
+#define KEY_MEMLOAD_USER_COLOR        "memload-color0"
+#define KEY_MEMLOAD_SHARED_COLOR      "memload-color1"
+#define KEY_MEMLOAD_BUFFER_COLOR      "memload-color2"
+#define KEY_MEMLOAD_CACHED_COLOR      "memload-color3"
+#define KEY_MEMLOAD_FREE_COLOR        "memload-color4"
+#define KEY_NETLOAD2_IN_COLOR         "netload2-color0"
+#define KEY_NETLOAD2_OUT_COLOR        "netload2-color1"
+#define KEY_NETLOAD2_LOOPBACK_COLOR   "netload2-color2"
+#define KEY_NETLOAD2_BACKGROUND_COLOR "netload2-color3"
+#define KEY_NETLOAD2_GRIDLINE_COLOR   "netload2-color4"
+#define KEY_NETLOAD2_INDICATOR_COLOR  "netload2-color5"
+#define KEY_SWAPLOAD_USED_COLOR       "swapload-color0"
+#define KEY_SWAPLOAD_FREE_COLOR       "swapload-color1"
+#define KEY_LOADAVG_AVERAGE_COLOR     "loadavg-color0"
+#define KEY_LOADAVG_BACKGROUND_COLOR  "loadavg-color1"
+#define KEY_LOADAVG_GRIDLINE_COLOR    "loadavg-color2"
+#define KEY_DISKLOAD_READ_COLOR       "diskload-color0"
+#define KEY_DISKLOAD_WRITE_COLOR      "diskload-color1"
+#define KEY_DISKLOAD_FREE_COLOR       "diskload-color2"
+
+#define KEY_NET_THRESHOLD1 "netthreshold1"
+#define KEY_NET_THRESHOLD2 "netthreshold2"
+#define KEY_NET_THRESHOLD3 "netthreshold3"
+#define MIN_NET_THRESHOLD1 10
+#define MIN_NET_THRESHOLD2 11
+#define MIN_NET_THRESHOLD3 12
+#define MAX_NET_THRESHOLD1  999999998
+#define MAX_NET_THRESHOLD2  999999999
+#define MAX_NET_THRESHOLD3 1000000000
+
+#define VIEW_CPULOAD_KEY   "view-cpuload"
+#define VIEW_MEMLOAD_KEY   "view-memload"
+#define VIEW_NETLOAD_KEY   "view-netload"
+#define VIEW_SWAPLOAD_KEY  "view-swapload"
+#define VIEW_LOADAVG_KEY   "view-loadavg"
+#define VIEW_DISKLOAD_KEY  "view-diskload"
+
+#define DISKLOAD_NVME_KEY  "diskload-nvme-diskstats"
+
+#define REFRESH_RATE_KEY   "speed"
+#define REFRESH_RATE_MIN   50
+#define REFRESH_RATE_MAX   60000
+
+#define GRAPH_SIZE_KEY     "size"
+#define GRAPH_SIZE_MIN     10
+#define GRAPH_SIZE_MAX     1000
+
+typedef struct _MultiloadApplet MultiloadApplet;
+typedef struct _LoadGraph LoadGraph;
+typedef void (*LoadGraphDataFunc) (guint64, guint64 [], LoadGraph *);
+
+#include "netspeed.h"
+
+typedef enum {
+    graph_cpuload = 0,
+    graph_memload,
+    graph_netload2,
+    graph_swapload,
+    graph_loadavg,
+    graph_diskload,
+    graph_n,
+} E_graph;
+
+typedef enum {
+    cpuload_usr = 0,
+    cpuload_sys,
+    cpuload_nice,
+    cpuload_iowait,
+    cpuload_free,
+    cpuload_n
+} E_cpuload;
+
+typedef enum {
+    memload_user = 0,
+    memload_shared,
+    memload_buffer,
+    memload_cached,
+    memload_free,
+    memload_n
+} E_memload;
+
+typedef enum {
+    netload2_in = 0,
+    netload2_out,
+    netload2_loopback,
+    netload2_background,
+    netload2_gridline,
+    netload2_indicator,
+    netload2_n
+} E_netload2;
+
+typedef enum {
+    swapload_used = 0,
+    swapload_free,
+    swapload_n
+} E_swapload;
+
+typedef enum {
+    loadavg_average = 0,
+    loadavg_background,
+    loadavg_gridline,
+    loadavg_n
+} E_loadavg;
+
+typedef enum {
+    diskload_read = 0,
+    diskload_write,
+    diskload_free,
+    diskload_n
+} E_diskload;
+
+struct _LoadGraph {
+    MultiloadApplet *multiload;
+
+    guint n;
+    gint  id;
+    guint speed, size;
+    guint orient, pixel_size;
+    gsize draw_width;
+    guint64 draw_height;
+    LoadGraphDataFunc get_data;
+
+    guint allocated;
+
+    GdkRGBA *colors;
+    guint64 **data;
+    guint64  *pos;
+
+    GtkWidget *main_widget;
+    GtkWidget *frame, *box, *disp;
+    cairo_surface_t *surface;
+    int timer_index;
+
+    gboolean visible;
+    gboolean tooltip_update;
+    const gchar *name;
+};
+
+struct _MultiloadApplet
+{
+    MatePanelApplet *applet;
+
+    GSettings *settings;
+
+    LoadGraph *graphs [graph_n];
+
+    GtkWidget *box;
+
+    gboolean view_cpuload;
+    gboolean view_memload;
+    gboolean view_netload;
+    gboolean view_swapload;
+    gboolean view_loadavg;
+    gboolean view_diskload;
+
+    GtkWidget *about_dialog;
+    GtkWidget *check_boxes [graph_n];
+    GtkWidget *prop_dialog;
+    GtkWidget *notebook;
+    gint last_clicked;
+
+    float    cpu_used_ratio;
+    guint64  cpu_time [cpuload_n];
+    guint64  cpu_last [cpuload_n];
+    gboolean cpu_initialized;
+
+    double loadavg1;
+
+    guint64 memload_user;
+    guint64 memload_cache;
+    guint64 memload_total;
+
+    float swapload_used_ratio;
+
+    float diskload_used_ratio;
+    gboolean nvme_diskstats;
+
+    NetSpeed *netspeed_in;
+    NetSpeed *netspeed_out;
+    guint64 net_threshold1;
+    guint64 net_threshold2;
+    guint64 net_threshold3;
+};
+
+#include "load-graph.h"
+#include "linux-proc.h"
+
+/* show properties dialog */
+G_GNUC_INTERNAL void
+multiload_properties_cb (GtkAction       *action,
+                         MultiloadApplet *ma);
+
+/* remove the old graphs and rebuild them */
+G_GNUC_INTERNAL void
+multiload_applet_refresh (MultiloadApplet *ma);
+
+/* update the tooltip to the graph's current "used" percentage */
+G_GNUC_INTERNAL void
+multiload_applet_tooltip_update (LoadGraph *g);
+
+G_END_DECLS
+
+#endif
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/117.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/117.html new file mode 100644 index 00000000..939fc573 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/117.html @@ -0,0 +1,267 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
#ifndef H_MULTILOAD_NETSPEED_
+#define H_MULTILOAD_NETSPEED_
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+typedef struct _NetSpeed NetSpeed;
+
+#include "global.h"
+
+NetSpeed* netspeed_new(LoadGraph *graph);
+void netspeed_delete(NetSpeed *ns);
+void netspeed_add(NetSpeed *ns, guint64 tx);
+char* netspeed_get(NetSpeed *ns);
+
+#endif /* H_MULTILOAD_NETSPEED_ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/118.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/118.html new file mode 100644 index 00000000..8c494ea6 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/118.html @@ -0,0 +1,1429 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
/* MATE multiload panel applet
+ * (C) 1997 The Free Software Foundation
+ *
+ * Authors: Tim P. Gerla
+ *          Martin Baulig
+ *          Todd Kulesza
+ *
+ * With code from wmload.c, v0.9.2, apparently by Ryan Land, rland@bc1.com.
+ *
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/stat.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <signal.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <dirent.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glibtop.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkkeysyms.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk-pixbuf/gdk-pixbuf.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gdesktopappinfo.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet-gsettings.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "global.h"
+
+static void
+about_cb (GtkAction       *action,
+          MultiloadApplet *ma)
+{
+    const gchar * const authors[] =
+    {
+        "Martin Baulig <martin@home-of-linux.org>",
+        "Todd Kulesza <fflewddur@dropline.net>",
+        "Benoît Dejean <TazForEver@dlfp.org>",
+        "Davyd Madeley <davyd@madeley.id.au>",
+        NULL
+    };
+
+    const gchar* documenters[] =
+    {
+        "Chee Bin HOH <cbhoh@gnome.org>",
+        N_("Sun GNOME Documentation Team <gdocteam@sun.com>"),
+        N_("MATE Documentation Team"),
+        NULL
+    };
+
+#ifdef ENABLE_NLS
+    const char **p;
+    for (p = documenters; *p; ++p)
+        *p = _(*p);
+#endif
+
+    gtk_show_about_dialog (NULL,
+    "title",                 _("About System Monitor"),
+    "version",               VERSION,
+    "copyright",             _("Copyright \xc2\xa9 1999-2005 Free Software Foundation and others\n"
+                               "Copyright \xc2\xa9 2012-2021 MATE developers"),
+    "comments",              _("A system load monitor capable of displaying graphs "
+                               "for CPU, ram, and swap space use, plus network "
+                               "traffic."),
+    "authors",               authors,
+    "documenters",           documenters,
+    "translator-credits",    _("translator-credits"),
+    "logo-icon-name",        "utilities-system-monitor",
+    NULL);
+}
+
+static void
+help_cb (GtkAction       *action,
+         MultiloadApplet *ma)
+{
+    GError *error = NULL;
+
+    gtk_show_uri_on_window (NULL,
+                            "help:mate-multiload",
+                            gtk_get_current_event_time (),
+                            &error);
+
+    if (error) { /* FIXME: the user needs to see this */
+        g_warning ("help error: %s\n", error->message);
+        g_error_free (error);
+        error = NULL;
+    }
+}
+
+/* run the full-scale system process monitor */
+
+static void
+start_procman (MultiloadApplet *ma)
+{
+    GError *error = NULL;
+    GDesktopAppInfo *appinfo;
+    gchar *monitor;
+    GdkAppLaunchContext *launch_context;
+    GdkDisplay *display;
+    GAppInfo *app_info;
+    GdkScreen *screen;
+
+    g_return_if_fail (ma != NULL);
+
+    monitor = g_settings_get_string (ma->settings, "system-monitor");
+    if (monitor == NULL)
+        monitor = g_strdup ("mate-system-monitor.desktop");
+
+    screen = gtk_widget_get_screen (GTK_WIDGET (ma->applet));
+    appinfo = g_desktop_app_info_new (monitor);
+    if (appinfo) {
+        GdkAppLaunchContext *context;
+        display = gdk_screen_get_display (screen);
+        context = gdk_display_get_app_launch_context (display);
+        gdk_app_launch_context_set_screen (context, screen);
+        g_app_info_launch (G_APP_INFO (appinfo), NULL, G_APP_LAUNCH_CONTEXT (context), &error);
+        g_object_unref (context);
+        g_object_unref (appinfo);
+    }
+    else {
+        app_info = g_app_info_create_from_commandline ("mate-system-monitor",
+                                                       _("Start system-monitor"),
+                                                       G_APP_INFO_CREATE_NONE,
+                                                       &error);
+
+        if (!error) {
+            display = gdk_screen_get_display (screen);
+            launch_context = gdk_display_get_app_launch_context (display);
+            gdk_app_launch_context_set_screen (launch_context, screen);
+            g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error);
+
+            g_object_unref (launch_context);
+        }
+    }
+    g_free (monitor);
+
+    if (error) {
+        GtkWidget *dialog;
+
+        dialog = gtk_message_dialog_new (NULL,
+                                         GTK_DIALOG_DESTROY_WITH_PARENT,
+                                         GTK_MESSAGE_ERROR,
+                                         GTK_BUTTONS_OK,
+                                         _("There was an error executing '%s': %s"),
+                                         "mate-system-monitor",
+                                         error->message);
+
+        g_signal_connect (dialog, "response",
+                          G_CALLBACK (gtk_widget_destroy),
+                          NULL);
+
+        gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+        gtk_window_set_screen (GTK_WINDOW (dialog), screen);
+
+        gtk_widget_show (dialog);
+
+        g_error_free (error);
+    }
+}
+
+static void
+start_procman_cb (GtkAction       *action,
+                  MultiloadApplet *ma)
+{
+    start_procman (ma);
+}
+
+static void
+multiload_change_size_cb(MatePanelApplet *applet, gint size, gpointer data)
+{
+    MultiloadApplet *ma = (MultiloadApplet *)data;
+
+    multiload_applet_refresh(ma);
+
+    return;
+}
+
+static void
+multiload_change_orient_cb(MatePanelApplet *applet, gint arg1, gpointer data)
+{
+    MultiloadApplet *ma = data;
+    multiload_applet_refresh((MultiloadApplet *)data);
+    gtk_widget_show (GTK_WIDGET (ma->applet));
+    return;
+}
+
+static void
+multiload_destroy_cb(GtkWidget *widget, gpointer data)
+{
+    guint i;
+    MultiloadApplet *ma = data;
+
+    for (i = 0; i < graph_n; i++)
+    {
+        load_graph_stop(ma->graphs[i]);
+        if (ma->graphs[i]->colors)
+        {
+            g_free (ma->graphs[i]->colors);
+            ma->graphs[i]->colors = NULL;
+        }
+        gtk_widget_destroy(ma->graphs[i]->main_widget);
+
+        load_graph_unalloc(ma->graphs[i]);
+        g_free(ma->graphs[i]);
+    }
+
+    netspeed_delete (ma->netspeed_in);
+    netspeed_delete (ma->netspeed_out);
+
+    if (ma->about_dialog)
+        gtk_widget_destroy (ma->about_dialog);
+
+    if (ma->prop_dialog)
+        gtk_widget_destroy (ma->prop_dialog);
+
+    gtk_widget_destroy(GTK_WIDGET(ma->applet));
+
+    g_free (ma);
+
+    return;
+}
+
+static gboolean
+multiload_button_press_event_cb (GtkWidget *widget, GdkEventButton *event, MultiloadApplet *ma)<--- Parameter 'event' can be declared as pointer to const
+{
+    g_return_val_if_fail (event != NULL, FALSE);
+    g_return_val_if_fail (ma != NULL, FALSE);
+
+    if (event->button == 1 && event->type == GDK_BUTTON_PRESS) {
+        start_procman (ma);
+        return TRUE;
+    }
+    return FALSE;
+}
+
+static gboolean
+multiload_key_press_event_cb (GtkWidget *widget, GdkEventKey *event, MultiloadApplet *ma)<--- Parameter 'event' can be declared as pointer to const
+{
+    g_return_val_if_fail (event != NULL, FALSE);
+    g_return_val_if_fail (ma != NULL, FALSE);
+
+    switch (event->keyval) {
+    /* this list of keyvals taken from mixer applet, which seemed to have
+       a good list of keys to use */
+    case GDK_KEY_KP_Enter:
+    case GDK_KEY_ISO_Enter:
+    case GDK_KEY_3270_Enter:
+    case GDK_KEY_Return:
+    case GDK_KEY_space:
+    case GDK_KEY_KP_Space:
+        /* activate */
+        start_procman (ma);
+        return TRUE;
+
+    default:
+        break;
+    }
+
+    return FALSE;
+}
+
+/* update the tooltip to the graph's current "used" percentage */
+void
+multiload_applet_tooltip_update(LoadGraph *g)
+{
+    gchar *tooltip_text;
+    MultiloadApplet *multiload;
+    const char *tooltip_label [graph_n] = {
+        [graph_cpuload]  = N_("Processor"),
+        [graph_memload]  = N_("Memory"),
+        [graph_netload2] = N_("Network"),
+        [graph_swapload] = N_("Swap Space"),
+        [graph_loadavg]  = N_("Load Average"),
+        [graph_diskload] = N_("Disk")
+    };
+    const char *name;
+
+    g_assert(g);
+
+    multiload = g->multiload;
+
+    /* label the tooltip intuitively */
+    name = gettext (tooltip_label [g->id]);
+
+    switch (g->id) {
+        case graph_memload: {
+            float user_percent, cache_percent;
+
+            user_percent  = MIN ((float)(100 * multiload->memload_user)  / (float)(multiload->memload_total), 100.0f);
+            cache_percent = MIN ((float)(100 * multiload->memload_cache) / (float)(multiload->memload_total), 100.0f);
+            tooltip_text = g_strdup_printf (_("%s:\n"
+                                              "%.01f%% in use by programs\n"
+                                              "%.01f%% in use as cache"),
+                                            name,
+                                            user_percent,
+                                            cache_percent);
+            break;
+        }
+        case graph_loadavg: {
+            tooltip_text = g_strdup_printf (_("The system load average is %0.02f"),
+                                            multiload->loadavg1);
+            break;
+        }
+        case graph_netload2: {
+            char *tx_in, *tx_out;
+
+            tx_in = netspeed_get(multiload->netspeed_in);
+            tx_out = netspeed_get(multiload->netspeed_out);
+            /* xgettext: same as in graphic tab of g-s-m */
+            tooltip_text = g_strdup_printf(_("%s:\n"
+                                           "Receiving %s\n"
+                                           "Sending %s"),
+                                           name, tx_in, tx_out);
+            g_free(tx_in);
+            g_free(tx_out);
+            break;
+        }
+        default: {
+            float ratio;
+            float percent;
+
+            if (g->id == graph_cpuload)
+                ratio = multiload->cpu_used_ratio;
+            else if (g->id == graph_swapload)
+                ratio = multiload->swapload_used_ratio;
+            else if (g->id == graph_diskload)
+                ratio = multiload->diskload_used_ratio;
+            else
+                g_assert_not_reached ();
+
+            percent = CLAMP (ratio * 100.0f, 0.0f, 100.0f);
+            tooltip_text = g_strdup_printf(_("%s:\n"
+                                           "%.01f%% in use"),
+                                           name,
+                                           percent);
+        }
+    }
+
+    gtk_widget_set_tooltip_text(g->disp, tooltip_text);
+
+    g_free(tooltip_text);
+}
+
+static void
+multiload_create_graphs(MultiloadApplet *ma)
+{
+    struct { const char *label;
+             const char *visibility_key;
+             const char *name;
+             guint num_colours;
+             LoadGraphDataFunc callback;
+           } graph_types [graph_n] = {
+             [graph_cpuload]  = { _("CPU Load"),     VIEW_CPULOAD_KEY,  "cpuload",  cpuload_n,  GetLoad },
+             [graph_memload]  = { _("Memory Load"),  VIEW_MEMLOAD_KEY,  "memload",  memload_n,  GetMemory },
+             [graph_netload2] = { _("Net Load"),     VIEW_NETLOAD_KEY,  "netload2", 6,          GetNet },
+             [graph_swapload] = { _("Swap Load"),    VIEW_SWAPLOAD_KEY, "swapload", swapload_n, GetSwap },
+             [graph_loadavg]  = { _("Load Average"), VIEW_LOADAVG_KEY,  "loadavg",  3,          GetLoadAvg },
+             [graph_diskload] = { _("Disk Load"),    VIEW_DISKLOAD_KEY, "diskload", diskload_n, GetDiskLoad }
+           };
+
+    guint size;
+    guint speed;
+    guint64 net_threshold1;
+    guint64 net_threshold2;
+    guint64 net_threshold3;
+    gint i;
+
+    speed = CLAMP (g_settings_get_uint (ma->settings, REFRESH_RATE_KEY), REFRESH_RATE_MIN, REFRESH_RATE_MAX);
+    size = CLAMP (g_settings_get_uint (ma->settings, GRAPH_SIZE_KEY), GRAPH_SIZE_MIN, GRAPH_SIZE_MAX);
+    net_threshold1  = CLAMP (g_settings_get_uint64 (ma->settings, KEY_NET_THRESHOLD1), MIN_NET_THRESHOLD1, MAX_NET_THRESHOLD1);
+    net_threshold2  = CLAMP (g_settings_get_uint64 (ma->settings, KEY_NET_THRESHOLD2), MIN_NET_THRESHOLD2, MAX_NET_THRESHOLD2);
+    net_threshold3  = CLAMP (g_settings_get_uint64 (ma->settings, KEY_NET_THRESHOLD3), MIN_NET_THRESHOLD3, MAX_NET_THRESHOLD3);
+    if (net_threshold1 >= net_threshold2)
+    {
+       net_threshold1 = net_threshold2 - 1;
+    }
+    if (net_threshold2 >= net_threshold3)
+    {
+       net_threshold3 = net_threshold2 + 1;
+    }
+
+    for (i = 0; i < graph_n; i++)
+    {
+        ma->graphs[i] = load_graph_new (ma,
+                                        graph_types[i].num_colours,
+                                        graph_types[i].label,
+                                        i,
+                                        speed,
+                                        size,
+                                        g_settings_get_boolean (ma->settings, graph_types[i].visibility_key),
+                                        graph_types[i].name,
+                                        graph_types[i].callback);
+    }
+    ma->nvme_diskstats = g_settings_get_boolean (ma->settings, "diskload-nvme-diskstats");
+    /* for Network graph, colors[4] is grid line color, it should not be used in loop in load-graph.c */
+    /* for Network graph, colors[5] is indicator color, it should not be used in loop in load-graph.c */
+    ma->graphs[graph_netload2]->n = 4;
+    ma->net_threshold1 = net_threshold1;
+    ma->net_threshold2 = net_threshold2;
+    ma->net_threshold3 = net_threshold3;
+    ma->netspeed_in = netspeed_new (ma->graphs [graph_netload2]);
+    ma->netspeed_out = netspeed_new (ma->graphs [graph_netload2]);
+    /* for Load graph, colors[2] is grid line color, it should not be used in loop in load-graph.c */
+    ma->graphs[graph_loadavg]->n = 2;
+}
+
+/* remove the old graphs and rebuild them */
+void
+multiload_applet_refresh(MultiloadApplet *ma)
+{
+    guint i;
+    MatePanelAppletOrient orientation;
+
+    /* stop and free the old graphs */
+    for (i = 0; i < graph_n; i++)
+    {
+        if (!ma->graphs[i])
+            continue;
+
+        load_graph_stop(ma->graphs[i]);
+        gtk_widget_destroy(ma->graphs[i]->main_widget);
+
+        load_graph_unalloc(ma->graphs[i]);
+        g_free(ma->graphs[i]);
+    }
+
+    if (ma->box)
+        gtk_widget_destroy(ma->box);
+
+    orientation = mate_panel_applet_get_orient(ma->applet);
+
+    if ( (orientation == MATE_PANEL_APPLET_ORIENT_UP) ||
+        (orientation == MATE_PANEL_APPLET_ORIENT_DOWN) ) {
+        ma->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+    }
+    else
+        ma->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+
+    gtk_container_add(GTK_CONTAINER(ma->applet), ma->box);
+
+    /* create the N graphs, passing in their user-configurable properties with gsettings. */
+    multiload_create_graphs (ma);
+
+    /* only start and display the graphs the user has turned on */
+
+    for (i = 0; i < graph_n; i++) {
+        gtk_box_pack_start(GTK_BOX(ma->box),
+                           ma->graphs[i]->main_widget,
+                           TRUE, TRUE, 1);
+        if (ma->graphs[i]->visible) {
+            gtk_widget_show_all (ma->graphs[i]->main_widget);
+        load_graph_start(ma->graphs[i]);
+        }
+    }
+    gtk_widget_show (ma->box);
+
+    return;
+}
+
+static const GtkActionEntry multiload_menu_actions [] = {
+    { "MultiLoadProperties", "document-properties", N_("_Preferences"),
+        NULL, NULL,
+        G_CALLBACK (multiload_properties_cb) },
+    { "MultiLoadRunProcman", "system-run", N_("_Open System Monitor"),
+        NULL, NULL,
+        G_CALLBACK (start_procman_cb) },
+    { "MultiLoadHelp", "help-browser", N_("_Help"),
+        NULL, NULL,
+        G_CALLBACK (help_cb) },
+    { "MultiLoadAbout", "help-about", N_("_About"),
+        NULL, NULL,
+        G_CALLBACK (about_cb) }
+};
+
+/* create a box and stuff the load graphs inside of it */
+static gboolean
+multiload_applet_new(MatePanelApplet *applet, const gchar *iid, gpointer data)
+{
+    GtkStyleContext *context;
+    MultiloadApplet *ma;
+    GSettings *lockdown_settings;
+    GtkActionGroup *action_group;
+    AtkObject      *atk_obj;
+
+    context = gtk_widget_get_style_context (GTK_WIDGET (applet));
+    gtk_style_context_add_class (context, "multiload-applet");
+
+    ma = g_new0(MultiloadApplet, 1);
+
+    ma->applet = applet;
+
+    ma->about_dialog = NULL;
+    ma->prop_dialog = NULL;
+        ma->last_clicked = 0;
+
+#ifndef ENABLE_IN_PROCESS
+    g_set_application_name (_("System Monitor"));
+#endif
+
+    gtk_window_set_default_icon_name ("utilities-system-monitor");
+
+    ma->settings = mate_panel_applet_settings_new (applet, "org.mate.panel.applet.multiload");
+    mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR);
+
+    action_group = gtk_action_group_new ("Multiload Applet Actions");
+    gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+    gtk_action_group_add_actions (action_group,
+                                  multiload_menu_actions,
+                                  G_N_ELEMENTS (multiload_menu_actions),
+                                  ma);
+    mate_panel_applet_setup_menu_from_resource (applet,
+                                                MULTILOAD_RESOURCE_PATH "multiload-applet-menu.xml",
+                                                action_group);
+
+    if (mate_panel_applet_get_locked_down (applet)) {
+        GtkAction *action;
+
+        action = gtk_action_group_get_action (action_group, "MultiLoadProperties");
+        gtk_action_set_visible (action, FALSE);
+    }
+
+    lockdown_settings = g_settings_new ("org.mate.lockdown");
+    if (g_settings_get_boolean (lockdown_settings, "disable-command-line") ||
+        mate_panel_applet_get_locked_down (applet)) {
+        GtkAction *action;
+
+        /* When the panel is locked down or when the command line is inhibited,
+           it seems very likely that running the procman would be at least harmful */
+        action = gtk_action_group_get_action (action_group, "MultiLoadRunProcman");
+        gtk_action_set_visible (action, FALSE);
+    }
+    g_object_unref (lockdown_settings);
+
+    g_object_unref (action_group);
+
+    g_signal_connect (applet, "change-size",
+                      G_CALLBACK (multiload_change_size_cb), ma);
+    g_signal_connect (applet, "change-orient",
+                      G_CALLBACK (multiload_change_orient_cb), ma);
+    g_signal_connect (applet, "destroy",
+                      G_CALLBACK (multiload_destroy_cb), ma);
+    g_signal_connect (applet, "button-press-event",
+                      G_CALLBACK (multiload_button_press_event_cb), ma);<--- You might need to cast the function pointer here
+    g_signal_connect (applet, "key-press-event",
+                      G_CALLBACK (multiload_key_press_event_cb), ma);<--- You might need to cast the function pointer here
+
+    atk_obj = gtk_widget_get_accessible (GTK_WIDGET (applet));
+
+    if (GTK_IS_ACCESSIBLE (atk_obj)) {
+        atk_object_set_name (atk_obj, _("System Monitor"));
+        atk_object_set_description (atk_obj,
+            _("A system load monitor capable of displaying graphs "
+              "for CPU, ram, and swap space use, plus network "
+              "traffic."));
+    }
+
+    multiload_applet_refresh (ma);
+
+    gtk_widget_show(GTK_WIDGET(applet));
+
+    return TRUE;
+}
+
+static gboolean
+multiload_factory (MatePanelApplet *applet,
+                   const gchar *iid,
+                   gpointer data)
+{
+    gboolean retval = FALSE;
+
+    glibtop_init();
+
+    retval = multiload_applet_new(applet, iid, data);
+
+    return retval;
+}
+
+PANEL_APPLET_FACTORY ("MultiLoadAppletFactory",
+                      PANEL_TYPE_APPLET,
+                      "multiload",
+                      multiload_factory,
+                      NULL)
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/119.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/119.html new file mode 100644 index 00000000..350ada8a --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/119.html @@ -0,0 +1,1179 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.multiload"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[4221]; const double alignment; void * const ptr;}  multiload_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 
+  0002, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 
+  0354, 0000, 0000, 0000, 0066, 0335, 0220, 0161, 0005, 0000, 0000, 0000, 0354, 0000, 0000, 0000, 
+  0031, 0000, 0166, 0000, 0010, 0001, 0000, 0000, 0213, 0001, 0000, 0000, 0324, 0265, 0002, 0000, 
+  0377, 0377, 0377, 0377, 0213, 0001, 0000, 0000, 0001, 0000, 0114, 0000, 0214, 0001, 0000, 0000, 
+  0220, 0001, 0000, 0000, 0160, 0343, 0145, 0016, 0005, 0000, 0000, 0000, 0220, 0001, 0000, 0000, 
+  0015, 0000, 0166, 0000, 0240, 0001, 0000, 0000, 0111, 0020, 0000, 0000, 0201, 0321, 0040, 0031, 
+  0000, 0000, 0000, 0000, 0111, 0020, 0000, 0000, 0005, 0000, 0114, 0000, 0120, 0020, 0000, 0000, 
+  0124, 0020, 0000, 0000, 0027, 0202, 0331, 0277, 0006, 0000, 0000, 0000, 0124, 0020, 0000, 0000, 
+  0012, 0000, 0114, 0000, 0140, 0020, 0000, 0000, 0150, 0020, 0000, 0000, 0275, 0342, 0315, 0116, 
+  0004, 0000, 0000, 0000, 0150, 0020, 0000, 0000, 0015, 0000, 0114, 0000, 0170, 0020, 0000, 0000, 
+  0174, 0020, 0000, 0000, 0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 0155, 0165, 0154, 0164, 
+  0151, 0154, 0157, 0141, 0144, 0055, 0141, 0160, 0160, 0154, 0145, 0164, 0055, 0155, 0145, 0156, 
+  0165, 0056, 0170, 0155, 0154, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0263, 0311, 0115, 0315, 0053, 0315, 0054, 0111, 0315, 0125, 0310, 0113, 0314, 0115, 
+  0265, 0125, 0012, 0050, 0312, 0117, 0316, 0115, 0314, 0123, 0360, 0004, 0012, 0051, 0051, 0044, 
+  0046, 0227, 0144, 0346, 0347, 0331, 0052, 0371, 0226, 0346, 0224, 0144, 0372, 0344, 0047, 0246, 
+  0004, 0225, 0346, 0101, 0125, 0050, 0051, 0350, 0333, 0161, 0331, 0024, 0247, 0026, 0044, 0026, 
+  0045, 0226, 0344, 0027, 0201, 0070, 0230, 0106, 0025, 0244, 0026, 0225, 0144, 0246, 0026, 0343, 
+  0062, 0015, 0241, 0002, 0142, 0032, 0232, 0001, 0036, 0251, 0071, 0005, 0130, 0164, 0101, 0204, 
+  0261, 0250, 0167, 0114, 0312, 0057, 0055, 0301, 0145, 0027, 0130, 0022, 0254, 0215, 0013, 0000, 
+  0051, 0270, 0124, 0137, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0057, 0000, 0000, 0000, 0000, 
+  0160, 0162, 0157, 0160, 0145, 0162, 0164, 0151, 0145, 0163, 0056, 0165, 0151, 0000, 0000, 0000, 
+  0211, 0130, 0001, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0135, 0133, 0163, 0333, 0066, 
+  0026, 0176, 0357, 0257, 0340, 0362, 0165, 0207, 0161, 0044, 0305, 0275, 0215, 0255, 0116, 0232, 
+  0235, 0244, 0235, 0111, 0322, 0116, 0235, 0154, 0037, 0071, 0020, 0011, 0113, 0210, 0051, 0202, 
+  0013, 0100, 0226, 0325, 0137, 0277, 0040, 0045, 0137, 0044, 0002, 0044, 0101, 0122, 0066, 0100, 
+  0235, 0074, 0305, 0026, 0001, 0001, 0070, 0227, 0357, 0073, 0070, 0347, 0320, 0027, 0277, 0334, 
+  0055, 0023, 0357, 0026, 0063, 0116, 0150, 0172, 0351, 0217, 0136, 0275, 0366, 0075, 0234, 0106, 
+  0064, 0046, 0351, 0374, 0322, 0377, 0372, 0345, 0175, 0360, 0243, 0377, 0313, 0364, 0273, 0213, 
+  0177, 0005, 0201, 0367, 0001, 0247, 0230, 0041, 0201, 0143, 0157, 0115, 0304, 0302, 0233, 0047, 
+  0050, 0306, 0336, 0344, 0325, 0344, 0307, 0127, 0143, 0057, 0010, 0344, 0103, 0044, 0025, 0230, 
+  0135, 0243, 0010, 0117, 0277, 0363, 0274, 0013, 0206, 0377, 0267, 0042, 0014, 0163, 0057, 0041, 
+  0263, 0113, 0177, 0056, 0156, 0376, 0355, 0077, 0176, 0321, 0344, 0325, 0170, 0354, 0237, 0025, 
+  0317, 0321, 0331, 0067, 0034, 0011, 0057, 0112, 0020, 0347, 0227, 0376, 0007, 0161, 0363, 0373, 
+  0022, 0315, 0261, 0357, 0221, 0370, 0322, 0217, 0022, 0312, 0161, 0070, 0133, 0011, 0101, 0323, 
+  0220, 0054, 0347, 0176, 0076, 0102, 0216, 0311, 0030, 0315, 0060, 0023, 0033, 0057, 0105, 0113, 
+  0174, 0351, 0337, 0022, 0116, 0146, 0011, 0366, 0247, 0137, 0330, 0012, 0137, 0234, 0335, 0177, 
+  0252, 0176, 0070, 0102, 0151, 0160, 0115, 0243, 0025, 0367, 0247, 0357, 0121, 0302, 0153, 0237, 
+  0047, 0021, 0115, 0203, 0374, 0277, 0376, 0164, 0115, 0322, 0230, 0256, 0203, 0142, 0125, 0373, 
+  0303, 0056, 0316, 0266, 0333, 0120, 0357, 0350, 0155, 0374, 0155, 0305, 0305, 0022, 0247, 0142, 
+  0273, 0255, 0071, 0103, 0331, 0042, 0344, 0344, 0037, 0034, 0362, 0214, 0244, 0367, 0033, 0104, 
+  0361, 0067, 0315, 0006, 0023, 0272, 0306, 0314, 0237, 0216, 0136, 0327, 0055, 0166, 0225, 0145, 
+  0333, 0007, 0137, 0327, 0076, 0172, 0213, 0222, 0225, 0334, 0323, 0233, 0332, 0007, 0271, 0300, 
+  0131, 0100, 0322, 0210, 0341, 0142, 0007, 0323, 0121, 0335, 0200, 0114, 0312, 0357, 0351, 0200, 
+  0163, 0223, 0263, 0172, 0042, 0375, 0005, 0116, 0062, 0173, 0204, 0237, 0257, 0046, 0230, 0061, 
+  0272, 0346, 0230, 0165, 0021, 0176, 0212, 0105, 0050, 0026, 0322, 0060, 0026, 0064, 0211, 0107, 
+  0107, 0122, 0200, 0237, 0166, 0377, 0176, 0154, 0250, 0005, 0271, 0302, 0064, 0320, 0231, 0103, 
+  0125, 0070, 0257, 0037, 0162, 0250, 0014, 0145, 0325, 0354, 0160, 0174, 0143, 0303, 0343, 0033, 
+  0031, 0036, 0337, 0117, 0256, 0035, 0310, 0304, 0360, 0100, 0306, 0006, 0016, 0305, 0031, 0025, 
+  0341, 0031, 0306, 0261, 0331, 0101, 0234, 0067, 0065, 0254, 0357, 0137, 0067, 0167, 0255, 0347, 
+  0346, 0247, 0065, 0152, 0163, 0130, 0046, 0147, 0365, 0037, 0202, 0022, 0072, 0337, 0236, 0323, 
+  0156, 0024, 0301, 0074, 0214, 0267, 0277, 0356, 0307, 0151, 0316, 0050, 0213, 0061, 0013, 0326, 
+  0044, 0026, 0213, 0046, 0072, 0046, 0210, 0220, 0376, 0333, 0023, 0014, 0245, 0074, 0101, 0002, 
+  0111, 0157, 0176, 0351, 0157, 0260, 0374, 0272, 0253, 0215, 0074, 0240, 0245, 0367, 0211, 0246, 
+  0104, 0120, 0346, 0375, 0311, 0360, 0065, 0146, 0222, 0237, 0140, 0136, 0067, 0247, 0264, 0007, 
+  0362, 0017, 0052, 0160, 0301, 0324, 0321, 0257, 0004, 0111, 0110, 0176, 0052, 0001, 0057, 0276, 
+  0076, 0130, 0156, 0277, 0276, 0166, 0033, 0233, 0014, 0007, 0013, 0222, 0013, 0145, 0173, 0234, 
+  0245, 0001, 0234, 0314, 0123, 0224, 0074, 0256, 0060, 0243, 0051, 0227, 0033, 0137, 0240, 0064, 
+  0116, 0060, 0273, 0364, 0245, 0246, 0226, 0144, 0022, 0076, 0076, 0307, 0327, 0110, 0052, 0141, 
+  0156, 0362, 0164, 0313, 0235, 0344, 0224, 0321, 0202, 0044, 0261, 0127, 0060, 0057, 0071, 0165, 
+  0120, 0374, 0050, 0025, 0160, 0106, 0357, 0166, 0302, 0124, 0051, 0301, 0257, 0117, 0076, 0065, 
+  0027, 0267, 0152, 0014, 0145, 0104, 0152, 0043, 0022, 0222, 0334, 0371, 0323, 0333, 0174, 0003, 
+  0021, 0112, 0232, 0014, 0344, 0031, 0212, 0044, 0327, 0364, 0247, 0143, 0345, 0323, 0352, 0355, 
+  0241, 0050, 0377, 0242, 0020, 0061, 0214, 0236, 0354, 0103, 0271, 0323, 0302, 0376, 0367, 0367, 
+  0333, 0166, 0317, 0112, 0367, 0201, 0066, 0164, 0045, 0002, 0056, 0066, 0271, 0246, 0341, 0064, 
+  0326, 0016, 0054, 0226, 0276, 0377, 0073, 0375, 0202, 0113, 0374, 0307, 0077, 0034, 0251, 0132, 
+  0312, 0014, 0047, 0112, 0053, 0012, 0177, 0223, 0023, 0351, 0026, 0146, 0114, 0251, 0032, 0036, 
+  0243, 0351, 0120, 0206, 0043, 0114, 0156, 0245, 0321, 0305, 0370, 0032, 0255, 0022, 0141, 0076, 
+  0003, 0051, 0230, 0343, 0364, 0200, 0065, 0232, 0314, 0260, 0342, 0070, 0130, 0245, 0322, 0167, 
+  0045, 0044, 0155, 0261, 0173, 0224, 0254, 0321, 0106, 0172, 0215, 0205, 0214, 0021, 0166, 0213, 
+  0251, 0236, 0342, 0251, 0253, 0336, 0237, 0030, 0105, 0067, 0322, 0052, 0352, 0277, 0022, 0337, 
+  0145, 0322, 0171, 0230, 0057, 0365, 0232, 0044, 0211, 0371, 0250, 0214, 0162, 0262, 0065, 0361, 
+  0327, 0125, 0233, 0122, 0256, 0376, 0342, 0114, 0141, 0001, 0155, 0254, 0342, 0151, 0114, 0330, 
+  0315, 0054, 0336, 0225, 0343, 0070, 0373, 0354, 0042, 0037, 0332, 0332, 0044, 0026, 0250, 0203, 
+  0075, 0365, 0146, 0221, 0207, 0121, 0074, 0230, 0344, 0061, 0114, 0162, 0324, 0207, 0111, 0252, 
+  0266, 0257, 0336, 0272, 0156, 0333, 0106, 0360, 0271, 0335, 0263, 0321, 0220, 0132, 0037, 0244, 
+  0330, 0154, 0151, 0243, 0145, 0277, 0123, 0107, 0222, 0132, 0273, 0203, 0276, 0230, 0106, 0143, 
+  0206, 0125, 0311, 0262, 0106, 0343, 0256, 0004, 0345, 0075, 0053, 0110, 0362, 0263, 0370, 0312, 
+  0312, 0003, 0322, 0072, 0373, 0340, 0016, 0045, 0222, 0150, 0127, 0202, 0224, 0342, 0210, 0026, 
+  0050, 0277, 0333, 0313, 0111, 0274, 0077, 0115, 0151, 0132, 0375, 0275, 0312, 0303, 0122, 0037, 
+  0330, 0333, 0174, 0061, 0333, 0130, 0115, 0361, 0174, 0207, 0203, 0353, 0172, 0170, 0312, 0003, 
+  0304, 0327, 0042, 0310, 0120, 0034, 0327, 0150, 0113, 0375, 0101, 0064, 0065, 0252, 0336, 0216, 
+  0242, 0217, 0343, 0120, 0315, 0261, 0104, 0154, 0116, 0322, 0100, 0320, 0114, 0106, 0377, 0155, 
+  0046, 0170, 0060, 0276, 0146, 0243, 0053, 0117, 0124, 0175, 0252, 0357, 0026, 0070, 0332, 0343, 
+  0110, 0333, 0013, 0346, 0050, 0133, 0045, 0024, 0305, 0141, 0224, 0177, 0074, 0253, 0074, 0171, 
+  0103, 0346, 0364, 0047, 0243, 0062, 0006, 0347, 0345, 0230, 0370, 0150, 0222, 0355, 0310, 0252, 
+  0314, 0170, 0116, 0143, 0135, 0121, 0163, 0256, 0255, 0367, 0341, 0002, 0061, 0321, 0166, 0022, 
+  0103, 0332, 0123, 0065, 0125, 0314, 0220, 0344, 0076, 0151, 0054, 0361, 0102, 0120, 0146, 0070, 
+  0327, 0336, 0215, 0205, 0240, 0363, 0171, 0202, 0343, 0375, 0013, 0013, 0265, 0252, 0205, 0017, 
+  0317, 0052, 0056, 0055, 0064, 0337, 0245, 0141, 0136, 0315, 0130, 0130, 0147, 0152, 0322, 0017, 
+  0075, 0353, 0034, 0075, 0065, 0240, 0155, 0265, 0121, 0325, 0221, 0334, 0311, 0022, 0057, 0217, 
+  0344, 0116, 0076, 0341, 0045, 0145, 0033, 0360, 0045, 0340, 0113, 0124, 0172, 0006, 0276, 0244, 
+  0145, 0330, 0147, 0261, 0057, 0111, 0261, 0310, 0145, 0074, 0076, 0202, 0063, 0371, 0214, 0305, 
+  0232, 0262, 0033, 0360, 0046, 0340, 0115, 0224, 0232, 0006, 0356, 0244, 0312, 0235, 0214, 0235, 
+  0164, 0047, 0271, 0044, 0217, 0303, 0115, 0256, 0102, 0071, 0265, 0167, 0045, 0167, 0213, 0301, 
+  0243, 0200, 0107, 0121, 0052, 0033, 0170, 0224, 0052, 0217, 0062, 0161, 0322, 0243, 0344, 0002, 
+  0106, 0267, 0363, 0043, 0360, 0223, 0217, 0162, 0146, 0160, 0045, 0340, 0112, 0124, 0132, 0006, 
+  0236, 0244, 0312, 0223, 0274, 0161, 0322, 0223, 0304, 0204, 0337, 0034, 0351, 0336, 0344, 0067, 
+  0304, 0342, 0174, 0172, 0160, 0047, 0340, 0116, 0224, 0252, 0006, 0376, 0244, 0312, 0237, 0234, 
+  0077, 0227, 0077, 0251, 0076, 0323, 0212, 0301, 0372, 0201, 0332, 0101, 0273, 0222, 0271, 0074, 
+  0217, 0171, 0357, 0073, 0232, 0345, 0051, 0077, 0152, 0237, 0265, 0055, 0107, 0251, 0165, 0210, 
+  0273, 0072, 0121, 0034, 0173, 0177, 0141, 0116, 0127, 0114, 0121, 0047, 0132, 0232, 0034, 0011, 
+  0301, 0310, 0154, 0045, 0060, 0327, 0112, 0357, 0341, 0221, 0335, 0002, 0326, 0230, 0314, 0027, 
+  0302, 0367, 0212, 0062, 0337, 0274, 0334, 0065, 0211, 0165, 0066, 0165, 0161, 0126, 0075, 0277, 
+  0261, 0200, 0373, 0253, 0117, 0061, 0116, 0256, 0073, 0126, 0063, 0006, 0205, 0012, 0120, 0250, 
+  0320, 0270, 0120, 0041, 0357, 0157, 0113, 0203, 0210, 0046, 0253, 0145, 0312, 0057, 0047, 0362, 
+  0377, 0171, 0243, 0317, 0345, 0266, 0261, 0255, 0051, 0001, 0374, 0300, 0110, 0174, 0162, 0325, 
+  0015, 0362, 0234, 0002, 0303, 0012, 0207, 0303, 0155, 0024, 0247, 0036, 0064, 0250, 0121, 0352, 
+  0312, 0320, 0267, 0020, 0127, 0325, 0202, 0227, 0124, 0200, 0340, 0163, 0261, 0350, 0227, 0347, 
+  0275, 0025, 0327, 0241, 0333, 0206, 0214, 0145, 0270, 0353, 0310, 0050, 0172, 0074, 0176, 0266, 
+  0200, 0137, 0057, 0123, 0234, 0267, 0151, 0104, 0171, 0327, 0311, 0034, 0113, 0027, 0246, 0026, 
+  0160, 0123, 0306, 0167, 0054, 0016, 0134, 0270, 0055, 0111, 0011, 0120, 0264, 0150, 0134, 0006, 
+  0240, 0350, 0064, 0241, 0231, 0351, 0044, 0057, 0025, 0024, 0137, 0311, 0263, 0127, 0334, 0327, 
+  0037, 0210, 0305, 0167, 0067, 0156, 0355, 0305, 0340, 0012, 0063, 0012, 0242, 0005, 0142, 0274, 
+  0161, 0130, 0242, 0050, 0166, 0176, 0354, 0203, 0233, 0352, 0133, 0214, 0333, 0105, 0235, 0005, 
+  0327, 0315, 0127, 0230, 0316, 0065, 0267, 0342, 0207, 0137, 0125, 0214, 0010, 0037, 0106, 0130, 
+  0020, 0200, 0356, 0031, 0337, 0350, 0004, 0214, 0357, 0043, 0240, 0131, 0045, 0232, 0145, 0344, 
+  0016, 0047, 0334, 0052, 0114, 0030, 0203, 0132, 0002, 0311, 0332, 0360, 0260, 0140, 0131, 0073, 
+  0222, 0265, 0312, 0142, 0044, 0360, 0266, 0013, 0122, 0172, 0125, 0053, 0351, 0126, 0251, 0347, 
+  0172, 0170, 0114, 0153, 0344, 0026, 0323, 0052, 0111, 0004, 0110, 0126, 0337, 0044, 0113, 0371, 
+  0242, 0201, 0336, 0371, 0125, 0371, 0133, 0116, 0201, 0132, 0215, 0000, 0303, 0134, 0306, 0260, 
+  0045, 0111, 0022, 0302, 0161, 0104, 0323, 0170, 0200, 0004, 0153, 0004, 0231, 0243, 0141, 0145, 
+  0216, 0376, 0310, 0362, 0034, 0005, 0144, 0213, 0354, 0311, 0026, 0215, 0040, 0133, 0004, 0331, 
+  0042, 0127, 0332, 0132, 0077, 0123, 0201, 0147, 0224, 0336, 0354, 0336, 0310, 0165, 0377, 0323, 
+  0313, 0344, 0202, 0332, 0116, 0141, 0236, 0012, 0252, 0347, 0115, 0373, 0171, 0265, 0363, 0046, 
+  0171, 0265, 0126, 0271, 0065, 0353, 0351, 0126, 0335, 0073, 0261, 0216, 0227, 0156, 0353, 0057, 
+  0345, 0126, 0061, 0323, 0202, 0056, 0351, 0034, 0247, 0230, 0032, 0107, 0172, 0265, 0072, 0244, 
+  0051, 0266, 0243, 0011, 0145, 0173, 0257, 0205, 0331, 0165, 0240, 0256, 0070, 0013, 0243, 0374, 
+  0303, 0146, 0121, 0157, 0157, 0212, 0323, 0143, 0364, 0333, 0254, 0074, 0256, 0353, 0214, 0367, 
+  0001, 0100, 0204, 0363, 0173, 0045, 0243, 0231, 0366, 0042, 0327, 0342, 0260, 0003, 0216, 0305, 
+  0176, 0324, 0252, 0223, 0307, 0356, 0207, 0342, 0371, 0306, 0201, 0353, 0075, 0265, 0212, 0362, 
+  0256, 0163, 0062, 0313, 0337, 0317, 0326, 0140, 0235, 0305, 0113, 0150, 0223, 0342, 0225, 0031, 
+  0117, 0131, 0155, 0202, 0343, 0140, 0266, 0221, 0064, 0120, 0372, 0073, 0054, 0364, 0232, 0263, 
+  0113, 0006, 0067, 0131, 0330, 0231, 0321, 0312, 0232, 0104, 0072, 0315, 0243, 0235, 0376, 0056, 
+  0277, 0172, 0272, 0126, 0156, 0030, 0371, 0064, 0012, 0315, 0217, 0342, 0042, 0370, 0206, 0203, 
+  0213, 0260, 0310, 0105, 0034, 0312, 0303, 0136, 0027, 0121, 0132, 0351, 0100, 0134, 0304, 0010, 
+  0134, 0304, 0276, 0213, 0110, 0111, 0204, 0301, 0107, 0130, 0344, 0043, 0112, 0002, 0261, 0327, 
+  0111, 0224, 0227, 0072, 0020, 0057, 0061, 0006, 0057, 0261, 0357, 0045, 0010, 0135, 0043, 0042, 
+  0300, 0117, 0130, 0344, 0047, 0024, 0042, 0261, 0327, 0123, 0250, 0026, 0073, 0020, 0137, 0061, 
+  0001, 0137, 0261, 0357, 0053, 0256, 0031, 0006, 0106, 0141, 0223, 0247, 0050, 0011, 0304, 0136, 
+  0077, 0121, 0136, 0352, 0100, 0274, 0304, 0233, 0023, 0365, 0022, 0117, 0032, 0021, 0152, 0156, 
+  0237, 0354, 0160, 0022, 0106, 0127, 0337, 0146, 0231, 0327, 0360, 0053, 0067, 0064, 0362, 0376, 
+  0252, 0332, 0224, 0131, 0220, 0303, 0312, 0066, 0235, 0200, 0114, 0064, 0316, 0315, 0373, 0276, 
+  0221, 0363, 0106, 0245, 0271, 0257, 0031, 0274, 0121, 0135, 0205, 0105, 0237, 0216, 0013, 0146, 
+  0165, 0050, 0042, 0153, 0315, 0152, 0004, 0146, 0125, 0167, 0303, 0061, 0170, 0273, 0372, 0034, 
+  0222, 0010, 0273, 0140, 0125, 0045, 0011, 0131, 0153, 0126, 0143, 0060, 0253, 0372, 0353, 0200, 
+  0301, 0033, 0326, 0357, 0341, 0037, 0177, 0313, 0275, 0273, 0140, 0132, 0012, 0051, 0131, 0153, 
+  0134, 0023, 0060, 0256, 0272, 0030, 0372, 0004, 0114, 0053, 0116, 0234, 0300, 0254, 0222, 0204, 
+  0254, 0065, 0253, 0067, 0116, 0233, 0125, 0375, 0141, 0065, 0354, 0230, 0330, 0135, 0135, 0111, 
+  0145, 0363, 0117, 0254, 0171, 0102, 0157, 0155, 0206, 0177, 0031, 0343, 0170, 0115, 0017, 0162, 
+  0121, 0101, 0203, 0077, 0257, 0144, 0254, 0144, 0175, 0164, 0323, 0100, 0125, 0050, 0124, 0205, 
+  0076, 0117, 0366, 0345, 0376, 0157, 0011, 0110, 0014, 0203, 0262, 0120, 0033, 0262, 0057, 0132, 
+  0201, 0330, 0227, 0175, 0321, 0057, 0025, 0012, 0103, 0207, 0222, 0175, 0251, 0223, 0061, 0244, 
+  0137, 0136, 0072, 0072, 0320, 0112, 0010, 0362, 0057, 0266, 0227, 0076, 0334, 0213, 0216, 0057, 
+  0020, 0303, 0061, 0300, 0257, 0105, 0360, 0253, 0020, 0211, 0275, 0000, 0254, 0132, 0054, 0024, 
+  0136, 0017, 0015, 0202, 0365, 0122, 0036, 0176, 0272, 0166, 0021, 0346, 0173, 0167, 0001, 0206, 
+  0025, 0122, 0202, 0214, 0255, 0053, 0100, 0074, 0133, 0135, 0137, 0103, 0034, 0154, 0025, 0020, 
+  0053, 0104, 0142, 0057, 0020, 0253, 0026, 0013, 0275, 0015, 0103, 0003, 0142, 0275, 0224, 0207, 
+  0037, 0015, 0377, 0132, 0354, 0235, 0273, 0200, 0304, 0012, 0061, 0101, 0221, 0207, 0053, 0110, 
+  0034, 0311, 0335, 0100, 0110, 0154, 0025, 0022, 0053, 0104, 0142, 0057, 0022, 0253, 0026, 0013, 
+  0235, 0103, 0103, 0103, 0142, 0275, 0224, 0007, 0217, 0304, 0357, 0344, 0326, 0103, 0067, 0102, 
+  0142, 0205, 0224, 0240, 0040, 0314, 0025, 0040, 0206, 0266, 0074, 0313, 0140, 0330, 0201, 0266, 
+  0074, 0375, 0122, 0241, 0055, 0157, 0150, 0020, 0174, 0262, 0145, 0243, 0357, 0103, 0271, 0163, 
+  0027, 0340, 0027, 0312, 0106, 0237, 0307, 0254, 0216, 0127, 0252, 0330, 0350, 0245, 0257, 0206, 
+  0233, 0202, 0022, 0326, 0326, 0226, 0377, 0111, 0032, 0032, 0333, 0274, 0164, 0375, 0252, 0261, 
+  0122, 0270, 0134, 0002, 0373, 0075, 0224, 0300, 0102, 0011, 0354, 0221, 0042, 0235, 0024, 0213, 
+  0034, 0047, 0307, 0041, 0111, 0041, 0320, 0261, 0040, 0320, 0321, 0311, 0303, 0276, 0070, 0107, 
+  0273, 0122, 0250, 0177, 0035, 0112, 0230, 0123, 0043, 0342, 0341, 0047, 0374, 0176, 0117, 0155, 
+  0216, 0161, 0164, 0342, 0201, 0332, 0127, 0333, 0357, 0027, 0037, 0044, 0107, 0127, 0360, 0202, 
+  0100, 0253, 0140, 0367, 0120, 0040, 0026, 0343, 0156, 0151, 0251, 0120, 0365, 0072, 0070, 0340, 
+  0325, 0310, 0170, 0370, 0310, 0373, 0307, 0112, 0070, 0001, 0275, 0207, 0002, 0202, 0162, 0127, 
+  0147, 0260, 0067, 0241, 0064, 0233, 0311, 0365, 0001, 0000, 0333, 0004, 0300, 0112, 0251, 0130, 
+  0214, 0302, 0352, 0365, 0102, 0335, 0353, 0340, 0240, 0270, 0112, 0320, 0303, 0307, 0343, 0217, 
+  0064, 0102, 0211, 0023, 0210, 0254, 0224, 0023, 0324, 0276, 0072, 0003, 0313, 0271, 0354, 0346, 
+  0214, 0112, 0135, 0001, 0140, 0266, 0011, 0230, 0065, 0162, 0261, 0030, 0232, 0165, 0053, 0206, 
+  0122, 0330, 0301, 0201, 0163, 0265, 0250, 0117, 0240, 0063, 0345, 0141, 0377, 0116, 0140, 0264, 
+  0106, 0134, 0120, 0030, 0353, 0014, 0112, 0317, 0031, 0211, 0163, 0055, 0001, 0214, 0266, 0011, 
+  0243, 0225, 0122, 0261, 0030, 0241, 0325, 0353, 0205, 0072, 0331, 0301, 0341, 0163, 0225, 0240, 
+  0207, 0217, 0316, 0037, 0166, 0273, 0167, 0002, 0233, 0225, 0242, 0202, 0252, 0131, 0147, 0220, 
+  0231, 0244, 0061, 0211, 0220, 0240, 0360, 0046, 0007, 0253, 0240, 0131, 0055, 0026, 0253, 0313, 
+  0272, 0224, 0013, 0036, 0010, 0070, 0237, 0003, 0070, 0067, 0223, 0364, 0051, 0024, 0171, 0355, 
+  0266, 0357, 0110, 0255, 0227, 0112, 0130, 0326, 0342, 0363, 0071, 0164, 0265, 0050, 0267, 0366, 
+  0330, 0300, 0060, 0206, 0256, 0226, 0143, 0071, 0002, 0203, 0077, 0335, 0203, 0305, 0232, 0262, 
+  0033, 0173, 0332, 0132, 0306, 0303, 0157, 0153, 0031, 0103, 0133, 0013, 0264, 0265, 0034, 0051, 
+  0032, 0312, 0271, 0364, 0375, 0213, 0201, 0041, 0217, 0150, 0103, 0040, 0244, 0227, 0210, 0175, 
+  0061, 0120, 0305, 0132, 0241, 0271, 0145, 0050, 0341, 0117, 0255, 0220, 0117, 0342, 0355, 0356, 
+  0126, 0347, 0013, 0365, 0042, 0202, 0026, 0027, 0333, 0357, 0043, 0037, 0144, 0007, 0357, 0320, 
+  0261, 0015, 0201, 0035, 0170, 0211, 0116, 0305, 0132, 0241, 0313, 0145, 0160, 0010, 0174, 0262, 
+  0257, 0321, 0011, 0337, 0133, 0376, 0032, 0035, 0275, 0210, 0240, 0321, 0305, 0331, 0033, 0307, 
+  0011, 0334, 0070, 0276, 0374, 0215, 0343, 0225, 0264, 0054, 0357, 0112, 0236, 0060, 0266, 0347, 
+  0322, 0161, 0062, 0374, 0113, 0307, 0011, 0134, 0072, 0302, 0245, 0343, 0221, 0102, 0236, 0034, 
+  0050, 0321, 0355, 0074, 0104, 0267, 0230, 0241, 0071, 0004, 0075, 0066, 0004, 0075, 0125, 0062, 
+  0261, 0057, 0354, 0251, 0134, 0055, 0134, 0075, 0016, 0045, 0360, 0151, 0040, 0346, 0341, 0207, 
+  0076, 0157, 0267, 0233, 0267, 0071, 0372, 0251, 0222, 0023, 0334, 0100, 0332, 0176, 0003, 0171, 
+  0057, 0075, 0150, 0050, 0264, 0022, 0221, 0235, 0351, 0047, 0254, 0133, 0060, 0134, 0110, 0016, 
+  0015, 0227, 0241, 0233, 0320, 0205, 0156, 0302, 0032, 0151, 0301, 0005, 0245, 0053, 0000, 0015, 
+  0275, 0204, 0026, 0302, 0263, 0043, 0255, 0204, 0325, 0313, 0205, 0327, 0360, 0014, 0015, 0232, 
+  0241, 0221, 0320, 0366, 0106, 0302, 0112, 0111, 0301, 0173, 0170, 0234, 0315, 0032, 0276, 0201, 
+  0254, 0341, 0313, 0147, 0015, 0077, 0112, 0343, 0262, 0047, 0137, 0370, 0146, 0210, 0371, 0302, 
+  0222, 0072, 0375, 0112, 0357, 0040, 0355, 0047, 0271, 0041, 0043, 0222, 0161, 0242, 0255, 0344, 
+  0157, 0345, 0007, 0304, 0340, 0215, 0160, 0207, 0223, 0265, 0111, 0373, 0065, 0043, 0021, 0055, 
+  0323, 0275, 0255, 0123, 0276, 0316, 0320, 0212, 0166, 0151, 0333, 0176, 0123, 0267, 0307, 0110, 
+  0337, 0066, 0327, 0215, 0206, 0141, 0151, 0114, 0370, 0115, 0121, 0363, 0304, 0060, 0062, 0276, 
+  0062, 0356, 0125, 0035, 0172, 0216, 0115, 0217, 0023, 0237, 0366, 0033, 0243, 0066, 0216, 0123, 
+  0365, 0122, 0352, 0020, 0244, 0266, 0013, 0124, 0033, 0007, 0253, 0025, 0153, 0156, 0034, 0251, 
+  0266, 0210, 0126, 0115, 0350, 0264, 0031, 0245, 0356, 0067, 0031, 0325, 0143, 0364, 0152, 0100, 
+  0257, 0033, 0107, 0261, 0135, 0035, 0315, 0223, 0150, 0266, 0126, 0021, 0354, 0162, 0064, 0306, 
+  0330, 0143, 0030, 0326, 0376, 0205, 0121, 0334, 0165, 0372, 0216, 0141, 0155, 0243, 0320, 0126, 
+  0057, 0066, 0123, 0315, 0164, 0337, 0030, 0107, 0156, 0033, 0243, 0036, 0365, 0327, 0214, 0010, 
+  0014, 0260, 0157, 0073, 0354, 0227, 0305, 0344, 0000, 0356, 0053, 0026, 0075, 0120, 0340, 0037, 
+  0001, 0360, 0127, 0002, 0277, 0126, 0023, 0116, 0013, 0371, 0377, 0316, 0217, 0301, 0051, 0350, 
+  0057, 0013, 0316, 0011, 0354, 0037, 0001, 0366, 0067, 0300, 0376, 0066, 0275, 0252, 0000, 0375, 
+  0317, 0015, 0375, 0175, 0366, 0257, 0076, 0027, 0362, 0167, 0350, 0143, 0165, 0013, 0370, 0307, 
+  0000, 0374, 0225, 0300, 0337, 0276, 0327, 0165, 0110, 0270, 0337, 0256, 0302, 0354, 0305, 0301, 
+  0277, 0103, 0027, 0354, 0120, 0114, 0362, 0305, 0261, 0377, 0370, 0205, 0001, 0370, 0056, 0223, 
+  0260, 0323, 0103, 0312, 0145, 0233, 0342, 0354, 0232, 0004, 0172, 0314, 0267, 0072, 0126, 0276, 
+  0363, 0156, 0201, 0243, 0233, 0275, 0167, 0024, 0337, 0056, 0245, 0371, 0344, 0277, 0235, 0325, 
+  0346, 0124, 0315, 0034, 0312, 0127, 0216, 0275, 0334, 0112, 0271, 0100, 0202, 0173, 0327, 0224, 
+  0171, 0341, 0347, 0377, 0176, 0352, 0164, 0354, 0156, 0124, 0023, 0166, 0326, 0321, 0173, 0342, 
+  0046, 0117, 0216, 0331, 0364, 0047, 0067, 0143, 0206, 0326, 0301, 0303, 0313, 0116, 0133, 0314, 
+  0267, 0107, 0051, 0005, 0235, 0317, 0045, 0067, 0073, 0170, 0067, 0363, 0123, 0165, 0014, 0037, 
+  0036, 0061, 0142, 0220, 0047, 0354, 0215, 0006, 0133, 0351, 0164, 0016, 0225, 0116, 0317, 0125, 
+  0234, 0242, 0367, 0350, 0277, 0041, 0026, 0347, 0036, 0335, 0236, 0152, 0247, 0163, 0307, 0252, 
+  0235, 0252, 0317, 0244, 0142, 0260, 0176, 0240, 0166, 0320, 0236, 0036, 0353, 0003, 0032, 0063, 
+  0015, 0356, 0244, 0271, 0135, 0065, 0266, 0271, 0246, 0026, 0327, 0111, 0274, 0166, 0076, 0111, 
+  0240, 0031, 0221, 0121, 0003, 0346, 0132, 0201, 0075, 0074, 0262, 0373, 0316, 0065, 0046, 0363, 
+  0205, 0360, 0275, 0133, 0224, 0254, 0212, 0112, 0256, 0044, 0326, 0041, 0322, 0305, 0131, 0365, 
+  0374, 0306, 0062, 0325, 0015, 0320, 0133, 0121, 0153, 0340, 0152, 0007, 0124, 0255, 0336, 0235, 
+  0254, 0261, 0052, 0345, 0031, 0250, 0151, 0157, 0131, 0205, 0337, 0063, 0371, 0375, 0176, 0375, 
+  0002, 0033, 0253, 0157, 0027, 0325, 0125, 0252, 0155, 0160, 0267, 0043, 0171, 0257, 0115, 0206, 
+  0362, 0005, 0212, 0351, 0072, 0310, 0155, 0332, 0237, 0246, 0264, 0272, 0352, 0134, 0037, 0043, 
+  0224, 0017, 0354, 0155, 0276, 0230, 0045, 0116, 0205, 0023, 0166, 0237, 0107, 0322, 0031, 0222, 
+  0130, 0324, 0254, 0324, 0255, 0072, 0130, 0322, 0225, 0047, 0116, 0052, 0312, 0023, 0215, 0313, 
+  0022, 0073, 0043, 0176, 0037, 0150, 0137, 0272, 0124, 0101, 0154, 0116, 0322, 0100, 0320, 0254, 
+  0141, 0365, 0141, 0367, 0372, 0305, 0176, 0352, 0026, 0333, 0224, 0014, 0073, 0317, 0313, 0132, 
+  0105, 0205, 0315, 0041, 0363, 0313, 0202, 0141, 0276, 0220, 0160, 0346, 0205, 0243, 0237, 0333, 
+  0116, 0337, 0072, 0340, 0074, 0036, 0131, 0154, 0127, 0156, 0323, 0303, 0015, 0370, 0113, 0325, 
+  0306, 0137, 0145, 0044, 0075, 0370, 0053, 0124, 0241, 0270, 0027, 0356, 0050, 0344, 0362, 0343, 
+  0146, 0231, 0264, 0143, 0133, 0103, 0227, 0151, 0172, 0061, 0206, 0242, 0376, 0076, 0210, 0026, 
+  0210, 0311, 0325, 0214, 0132, 0353, 0006, 0212, 0277, 0255, 0270, 0330, 0202, 0247, 0376, 0260, 
+  0103, 0371, 0130, 0333, 0157, 0110, 0127, 0113, 0314, 0110, 0324, 0355, 0310, 0012, 0306, 0232, 
+  0357, 0263, 0370, 0327, 0170, 0226, 0275, 0073, 0233, 0142, 0216, 0374, 0304, 0322, 0171, 0351, 
+  0346, 0106, 0277, 0363, 0142, 0124, 0370, 0060, 0252, 0361, 0145, 0316, 0063, 0071, 0205, 0321, 
+  0011, 0070, 0005, 0100, 0277, 0152, 0364, 0233, 0155, 0144, 0220, 0146, 0025, 0124, 0215, 0101, 
+  0053, 0201, 0223, 0075, 0162, 0262, 0061, 0160, 0262, 0036, 0122, 0240, 0126, 0162, 0262, 0061, 
+  0160, 0262, 0347, 0343, 0144, 0143, 0213, 0071, 0331, 0221, 0111, 0331, 0370, 0344, 0110, 0331, 
+  0010, 0340, 0017, 0110, 0231, 0165, 0244, 0014, 0264, 0162, 0050, 0244, 0154, 0002, 0244, 0254, 
+  0112, 0321, 0307, 0016, 0223, 0262, 0011, 0220, 0262, 0347, 0043, 0145, 0223, 0227, 0045, 0145, 
+  0255, 0330, 0324, 0344, 0344, 0330, 0324, 0030, 0160, 0013, 0330, 0224, 0165, 0154, 0152, 0014, 
+  0265, 0073, 0303, 0252, 0335, 0331, 0375, 0335, 0157, 0217, 0147, 0030, 0313, 0043, 0270, 0367, 
+  0267, 0120, 0315, 0143, 0117, 0065, 0317, 0244, 0217, 0152, 0036, 0325, 0376, 0325, 0173, 0157, 
+  0265, 0157, 0363, 0075, 0033, 0227, 0325, 0052, 0366, 0172, 0260, 0317, 0375, 0075, 0356, 0175, 
+  0170, 0201, 0242, 0174, 0362, 0135, 0103, 0313, 0203, 0112, 0355, 0377, 0332, 0223, 0312, 0237, 
+  0321, 0224, 0313, 0325, 0004, 0243, 0221, 0077, 0135, 0340, 0044, 0173, 0150, 0163, 0331, 0173, 
+  0262, 0176, 0374, 0017, 0376, 0064, 0112, 0050, 0307, 0125, 0343, 0017, 0176, 0131, 0254, 0352, 
+  0161, 0017, 0027, 0147, 0044, 0357, 0044, 0274, 0106, 0021, 0236, 0176, 0367, 0177, 0172, 0041, 
+  0115, 0337, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 0057, 0000, 0000, 
+  0006, 0000, 0000, 0000, 0155, 0165, 0154, 0164, 0151, 0154, 0157, 0141, 0144, 0057, 0000, 0000, 
+  0001, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0155, 0141, 0164, 0145, 0055, 0141, 0160, 0160, 
+  0154, 0145, 0164, 0163, 0057, 0000, 0000, 0000, 0005, 0000, 0000, 0000
+} };
+
+static GStaticResource static_resource = { multiload_resource_data.data, sizeof (multiload_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *multiload_get_resource (void);
+GResource *multiload_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * 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.1 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/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CONSTRUCTOR_H__
+#define __G_CONSTRUCTOR_H__
+
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+/*
+ * Only try to include gslist.h if not already included via glib.h,
+ * so that items using gconstructor.h outside of GLib (such as
+ * GResources) continue to build properly.
+ */
+#ifndef __G_LIB_H__
+#include "gslist.h"
+#endif
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+#endif /* __G_CONSTRUCTOR_H__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(multiloadresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(multiloadresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(multiloadresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(multiloadresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void multiloadresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void multiloadresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/12.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/12.html new file mode 100644 index 00000000..5910b339 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/12.html @@ -0,0 +1,2699 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
/* battstat        A MATE battery meter for laptops.
+ * Copyright (C) 2000 by Jörgen Pehrson <jp@spektr.eu.org>
+ * Copyright (C) 2002 Free Software Foundation
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/wait.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#ifdef HAVE_ERR_H
+#include <err.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet-gsettings.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#ifdef HAVE_LIBNOTIFY
+#include <libnotify/notify.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include "battstat.h"
+#include "battstat-preferences.h"
+
+#define BATTSTAT_SCHEMA "org.mate.panel.applet.battstat"
+
+static gboolean check_for_updates (gpointer data);
+
+static void about_cb (GtkAction *, ProgressData *);
+
+static void help_cb (GtkAction *, ProgressData *);
+
+static const GtkActionEntry battstat_menu_actions [] = {
+    { "BattstatProperties", "document-properties", N_("_Preferences"),
+        NULL, NULL,
+        G_CALLBACK (prop_cb) },
+    { "BattstatHelp", "help-browser", N_("_Help"),
+        NULL, NULL,
+        G_CALLBACK (help_cb) },
+    { "BattstatAbout", "help-about", N_("_About"),
+        NULL, NULL,
+        G_CALLBACK (about_cb) }
+};
+
+#define AC_POWER_STRING _("System is running on AC power")
+#define DC_POWER_STRING _("System is running on battery power")
+
+/* Our backends may be either event driven or poll-based.
+ * If they are event driven then we know this the first time we
+ * receive an event.
+ */
+static gboolean event_driven = FALSE;
+static GSList *instances;
+
+static void
+status_change_callback (void)
+{
+    GSList *instance;
+
+    for (instance = instances; instance; instance = instance->next)
+    {
+        ProgressData *battstat = instance->data;
+
+        if (battstat->timeout_id)
+        {
+            g_source_remove (battstat->timeout_id);
+            battstat->timeout_id = 0;
+        }
+
+        check_for_updates (battstat);
+    }
+
+    event_driven = TRUE;
+}
+
+/* The following two functions keep track of how many instances of the applet
+   are currently running.  When the first instance is started, some global
+   initialisation is done.  When the last instance exits, cleanup occurs.
+
+   The teardown code here isn't entirely complete (for example, it doesn't
+   deallocate the GdkColors or free the GdkPixmaps.  This is OK so long
+   as the process quits immediately when the last applet is removed (which
+   it does.)
+*/
+static const char *
+static_global_initialisation (ProgressData *battstat)
+{
+    gboolean first_time;
+    const char *err;
+
+    first_time = !instances;
+
+    instances = g_slist_prepend (instances, battstat);
+
+    if (!first_time)
+        return NULL;
+
+    err = power_management_initialise (status_change_callback);
+
+    return err;
+}
+
+static void
+static_global_teardown (ProgressData *battstat)
+{
+    instances = g_slist_remove (instances, battstat);
+
+    /* remaining instances... */
+    if (instances)
+        return;
+
+    /* instances == 0 */
+
+    power_management_cleanup ();
+}
+
+/* Pop up an error dialog on the same screen as 'applet' saying 'msg'.
+ */
+static void
+battstat_error_dialog (GtkWidget  *applet,
+                       const char *msg)
+{
+    GtkWidget *dialog;
+
+    dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR,
+                                     GTK_BUTTONS_OK, "%s", msg);
+
+    gtk_window_set_screen (GTK_WINDOW (dialog),
+                           gtk_widget_get_screen (GTK_WIDGET (applet)));
+
+    g_signal_connect_swapped (dialog, "response",
+                              G_CALLBACK (gtk_widget_destroy),
+                              G_OBJECT (dialog));
+
+    gtk_widget_show_all (dialog);
+}
+
+/* Format a string describing how much time is left to fully (dis)charge
+   the battery. The return value must be g_free ()d.
+*/
+static char *
+get_remaining (BatteryStatus *info)
+{
+    int hours;
+    int mins;
+
+    hours = info->minutes / 60;
+    mins = info->minutes % 60;
+
+    if (info->on_ac_power && !info->charging)
+        return g_strdup_printf (_("Battery charged (%d%%)"), info->percent);
+    else if (info->minutes < 0 && !info->on_ac_power)
+        return g_strdup_printf (_("Unknown time (%d%%) remaining"), info->percent);
+    else if (info->minutes < 0 && info->on_ac_power)
+        return g_strdup_printf (_("Unknown time (%d%%) until charged"), info->percent);
+    else
+        if (hours == 0)
+            if (!info->on_ac_power)
+                return g_strdup_printf (ngettext ("%d minute (%d%%) remaining",
+                                                  "%d minutes (%d%%) remaining",
+                                                  mins),
+                                        mins, info->percent);
+            else
+                return g_strdup_printf (ngettext ("%d minute until charged (%d%%)",
+                                                  "%d minutes until charged (%d%%)",
+                                                  mins),
+                                        mins, info->percent);
+        else if (mins == 0)
+            if (!info->on_ac_power)
+                return g_strdup_printf (ngettext ("%d hour (%d%%) remaining",
+                                                  "%d hours (%d%%) remaining",
+                                                  hours),
+                                        hours, info->percent);
+            else
+                return g_strdup_printf (ngettext ("%d hour until charged (%d%%)",
+                                                  "%d hours until charged (%d%%)",
+                                                  hours),
+                                        hours, info->percent);
+        else
+            if (!info->on_ac_power)
+                /* TRANSLATOR: "%d %s %d %s" are "%d hours %d minutes"
+                 * Swap order with "%2$s %2$d %1$s %1$d if needed */
+                return g_strdup_printf (_("%d %s %d %s (%d%%) remaining"),
+                                        hours, ngettext ("hour", "hours", hours),
+                                        mins, ngettext ("minute", "minutes", mins),
+                                        info->percent);
+            else
+                /* TRANSLATOR: "%d %s %d %s" are "%d hours %d minutes"
+                 * Swap order with "%2$s %2$d %1$s %1$d if needed */
+                return g_strdup_printf (_("%d %s %d %s until charged (%d%%)"),
+                                        hours, ngettext ("hour", "hours", hours),
+                                        mins, ngettext ("minute", "minutes", mins),
+                                        info->percent);
+}
+
+static gboolean
+battery_full_notify (GtkWidget *applet)
+{
+#ifdef HAVE_LIBNOTIFY
+    GError *error = NULL;
+    GdkPixbuf *icon;
+    gboolean result;
+
+    if (!notify_is_initted () && !notify_init (_("Battery Monitor")))
+        return FALSE;
+
+    icon = gtk_icon_theme_load_icon_for_scale (gtk_icon_theme_get_default (),
+                                               "battery",
+                                               48,
+                                               gtk_widget_get_scale_factor (applet),
+                                               GTK_ICON_LOOKUP_USE_BUILTIN,
+                                               NULL);
+
+    NotifyNotification *n = notify_notification_new (_("Your battery is now fully recharged"),
+                                                     "", /* "battery" */ NULL);
+
+    notify_notification_set_image_from_pixbuf (n, icon);
+    g_object_unref (icon);
+
+    result = notify_notification_show (n, &error);
+
+    if (error)
+    {
+        g_warning ("%s", error->message);
+        g_error_free (error);
+    }
+
+    g_object_unref (G_OBJECT (n));
+
+    return result;
+#else
+    return FALSE;
+#endif
+}
+
+/* Show a dialog notifying the user that their battery is done charging. */
+static void
+battery_full_dialog (GtkWidget *applet)
+{
+  /* first attempt to use libnotify */
+    if (battery_full_notify (applet))
+        return;
+
+    GtkWidget *dialog, *hbox, *image, *label;
+    cairo_surface_t *surface;
+
+    gchar *new_label;
+    dialog = gtk_dialog_new_with_buttons (_("Battery Notice"),
+                                          NULL,
+                                          GTK_DIALOG_DESTROY_WITH_PARENT,
+                                          "gtk-ok",
+                                          GTK_RESPONSE_ACCEPT,
+                                          NULL);
+    g_signal_connect_swapped (dialog, "response",
+                              G_CALLBACK (gtk_widget_destroy),
+                              dialog);
+
+    gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
+    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+    surface = gtk_icon_theme_load_surface (gtk_icon_theme_get_default (),
+                                           "battery",
+                                           48,
+                                           gtk_widget_get_scale_factor (applet),
+                                           NULL,
+                                           GTK_ICON_LOOKUP_USE_BUILTIN,
+                                           NULL);
+
+    image = gtk_image_new_from_surface (surface);
+    cairo_surface_destroy (surface);
+    gtk_box_pack_start (GTK_BOX (hbox), image, TRUE, TRUE, 6);
+    new_label = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>",
+                                 _("Your battery is now fully recharged"));
+
+    label = gtk_label_new (new_label);
+    g_free (new_label);
+    gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+    gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+    gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 6);
+    gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
+                       hbox);
+    gtk_window_set_keep_above (GTK_WINDOW (dialog), TRUE);
+    gtk_window_stick (GTK_WINDOW (dialog));
+    gtk_window_set_skip_pager_hint (GTK_WINDOW (dialog), TRUE);
+    gtk_window_set_focus_on_map (GTK_WINDOW (dialog), FALSE);
+    gtk_widget_show_all (dialog);
+}
+
+/* Destroy the low battery notification dialog and mark it as such.
+ */
+static void
+battery_low_dialog_destroy (ProgressData *battstat)
+{
+    gtk_widget_destroy (battstat->battery_low_dialog);
+    battstat->battery_low_dialog = NULL;
+    battstat->battery_low_label = NULL;
+}
+
+/* Determine if suspend is unsupported.  For the time being this involves
+ * distribution-specific magic :(
+ */
+/* #define HAVE_PMI */
+static gboolean
+is_suspend_unavailable (void)
+{
+#ifdef HAVE_PMI
+    int status;
+
+    status = system ("pmi query suspend");
+
+    /* -1 - fail (pmi unavailable?).     return 'false' since we don't know.
+     * 0  - success (can suspend).       return 'false' since not unavailable.
+     * 1  - success (cannot suspend).    return 'true' since unavailable.
+     */
+    if (WEXITSTATUS (status) == 1 )
+        return TRUE;
+    else
+        return FALSE;
+#else
+    return FALSE; /* return 'false' since we don't know. */
+#endif
+}
+
+/* Update the text label in the battery low dialog.
+ */
+static void
+battery_low_update_text (ProgressData  *battstat,
+                         BatteryStatus *info)
+{
+    const char *suggest;
+    gchar *remaining, *new_label;
+    GtkRequisition size;
+
+    /* If we're not displaying the dialog then don't update it. */
+    if (battstat->battery_low_label == NULL ||
+        battstat->battery_low_dialog == NULL)
+        return;
+
+    gtk_widget_get_preferred_size (GTK_WIDGET (battstat->battery_low_label), NULL, &size);
+
+    /* If the label has never been set before, the width will be 0.  If it
+       has been set before (width > 0) then we want to keep the size of
+       the old widget (to keep the dialog from changing sizes) so we set it
+       explicitly here.
+     */
+    if (size.width > 0)
+        gtk_widget_set_size_request (GTK_WIDGET (battstat->battery_low_label),
+                                     size.width, size.height);
+
+    if (info->minutes < 0 && !info->on_ac_power)
+    {
+        /* we don't know the remaining time */
+        remaining = g_strdup_printf (_("You have %d%% of your total battery "
+                                       "capacity remaining."), info->percent);
+    }
+    else
+    {
+      remaining = g_strdup_printf (ngettext ("You have %d minute of battery power "
+                                             "remaining (%d%% of the total capacity).",
+                                             "You have %d minutes of battery power "
+                                             "remaining (%d%% of the total capacity).",
+                                             info->minutes),
+                                   info->minutes,
+                                   info->percent);
+    }
+
+    if (is_suspend_unavailable ())
+    /* TRANSLATORS: this is a list, it is left as a single string
+     * to allow you to make it appear like a list would in your
+     * locale.  This is if the laptop does not support suspend. */
+        suggest = _("To avoid losing your work:\n"
+                    " \xE2\x80\xA2 plug your laptop into external power, or\n"
+                    " \xE2\x80\xA2 save open documents and shut your laptop down.");
+    else
+    /* TRANSLATORS: this is a list, it is left as a single string
+     * to allow you to make it appear like a list would in your
+     * locale.  This is if the laptop supports suspend. */
+        suggest = _("To avoid losing your work:\n"
+                    " \xE2\x80\xA2 suspend your laptop to save power,\n"
+                    " \xE2\x80\xA2 plug your laptop into external power, or\n"
+                    " \xE2\x80\xA2 save open documents and shut your laptop down.");
+
+    new_label = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s\n\n%s",
+                                 _("Your battery is running low"), remaining, suggest);
+
+    gtk_label_set_markup (battstat->battery_low_label, new_label);
+    g_free (remaining);
+    g_free (new_label);
+}
+
+/* Show a dialog notifying the user that their battery is running low.
+ */
+static void
+battery_low_dialog (ProgressData  *battery,
+                    BatteryStatus *info)
+{
+    GtkWidget *hbox, *image, *label;
+    GtkWidget *vbox;
+    cairo_surface_t *surface;
+
+    /* If the dialog is already displayed then don't display it again. */
+    if (battery->battery_low_dialog != NULL)
+        return;
+
+    battery->battery_low_dialog =
+            gtk_dialog_new_with_buttons (_("Battery Notice"),
+                                         NULL,
+                                         GTK_DIALOG_DESTROY_WITH_PARENT,
+                                         "gtk-ok",
+                                         GTK_RESPONSE_ACCEPT,
+                                         NULL);
+
+    gtk_dialog_set_default_response (GTK_DIALOG (battery->battery_low_dialog),
+                                     GTK_RESPONSE_ACCEPT);
+
+    g_signal_connect_swapped (battery->battery_low_dialog, "response",
+                              G_CALLBACK (battery_low_dialog_destroy),
+                              battery);
+
+    gtk_container_set_border_width (GTK_CONTAINER (battery->battery_low_dialog),
+                                    6);
+
+    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+    gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
+    surface = gtk_icon_theme_load_surface (gtk_icon_theme_get_default (),
+                                           "battery",
+                                           48,
+                                           gtk_widget_get_scale_factor (GTK_WIDGET (hbox)),
+                                           NULL,
+                                           GTK_ICON_LOOKUP_USE_BUILTIN,
+                                           NULL);
+
+    image = gtk_image_new_from_surface (surface);
+    cairo_surface_destroy (surface);
+    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+    gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 6);
+    gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, FALSE, 0);
+    label = gtk_label_new ("");
+    battery->battery_low_label = GTK_LABEL (label);
+    gtk_label_set_line_wrap (battery->battery_low_label, TRUE);
+    gtk_label_set_selectable (battery->battery_low_label, TRUE);
+    gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 6);
+    gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (battery->battery_low_dialog))),
+                       hbox);
+
+    gtk_window_set_keep_above (GTK_WINDOW (battery->battery_low_dialog), TRUE);
+    gtk_window_stick (GTK_WINDOW (battery->battery_low_dialog));
+    gtk_window_set_focus_on_map (GTK_WINDOW (battery->battery_low_dialog),
+                                 FALSE);
+    gtk_window_set_skip_pager_hint (GTK_WINDOW (battery->battery_low_dialog),
+                                    TRUE);
+
+    battery_low_update_text (battery, info);
+
+    gtk_window_set_position (GTK_WINDOW (battery->battery_low_dialog),
+                             GTK_WIN_POS_CENTER);
+    gtk_widget_show_all (battery->battery_low_dialog);
+}
+
+/* Update the text of the tooltip from the provided info.
+ */
+static void
+update_tooltip (ProgressData  *battstat,
+                BatteryStatus *info)
+{
+    gchar *powerstring;
+    gchar *remaining;
+    gchar *tiptext;
+
+    if (info->present)
+    {
+        if (info->on_ac_power)
+            powerstring = AC_POWER_STRING;
+        else
+            powerstring = DC_POWER_STRING;
+
+        remaining = get_remaining (info);
+
+        tiptext = g_strdup_printf ("%s\n%s", powerstring, remaining);
+        g_free (remaining);
+    }
+    else
+    {
+        if (info->on_ac_power)
+            tiptext = g_strdup_printf ("%s\n%s", AC_POWER_STRING,
+                                       _("No battery present"));
+        else
+            tiptext = g_strdup_printf ("%s\n%s", DC_POWER_STRING,
+                                       _("Battery status unknown"));
+    }
+
+    gtk_widget_set_tooltip_text (battstat->applet, tiptext);
+    g_free (tiptext);
+}
+
+/* Update the text label that either shows the percentage of time left.
+ */
+static void
+update_percent_label (ProgressData  *battstat,
+                      BatteryStatus *info)
+{
+    gchar *new_label;
+
+    if (info->present && battstat->showtext == APPLET_SHOW_PERCENT)
+      new_label = g_strdup_printf ("%d%%", info->percent);
+    else if (info->present && battstat->showtext == APPLET_SHOW_TIME)
+    {
+        /* Fully charged or unknown (-1) time remaining display none */
+        if ((info->on_ac_power && info->percent == 100) || info->minutes < 0)
+            new_label = g_strdup ("");
+        else
+        {
+            int time;
+            time = info->minutes;
+            new_label = g_strdup_printf ("%d:%02d", time/60, time%60);
+        }
+    }
+    else
+        new_label = g_strdup (_("N/A"));
+
+    gtk_label_set_text (GTK_LABEL (battstat->percent), new_label);
+    g_free (new_label);
+}
+
+/* Determine what status icon we ought to be displaying and change the
+   status icon to display it if it is different from what we are currently
+   showing.
+ */
+static void
+possibly_update_status_icon (ProgressData  *battstat,
+                             BatteryStatus *info )
+{
+    GtkIconTheme *theme;
+    cairo_surface_t *surface;
+    gint icon_size, icon_scale;
+    gchar *icon_name;
+    int batt_life;
+
+    batt_life = !battstat->red_value_is_time ? info->percent : info->minutes;
+
+    if (batt_life <= battstat->red_val)
+    {
+        if (info->charging)
+            icon_name = "battery-caution-charging";
+        else
+            icon_name = "battery-caution";
+    }
+    else if (batt_life <= battstat->orange_val)
+    {
+        if (info->charging)
+            icon_name = "battery-low-charging";
+        else
+            icon_name = "battery-low";
+    }
+    else if (batt_life <= battstat->yellow_val)
+    {
+        if (info->charging)
+            icon_name = "battery-good-charging";
+        else
+            icon_name = "battery-good";
+    }
+    else if (info->on_ac_power)
+    {
+        if (info->charging)
+            icon_name = "battery-full-charging";
+        else
+            icon_name = "battery-full-charged";
+    }
+    else
+    {
+        icon_name = "battery-full";
+    }
+
+    theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (battstat->applet)));
+
+    icon_size = mate_panel_applet_get_size (MATE_PANEL_APPLET (battstat->applet));
+    icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (battstat->applet));
+
+    surface = gtk_icon_theme_load_surface (theme, icon_name,
+                                           icon_size,
+                                           icon_scale,
+                                           NULL, 0, NULL);
+
+    gtk_image_set_from_surface (GTK_IMAGE (battstat->status),
+                                surface);
+    cairo_surface_destroy (surface);
+}
+
+/* Gets called as a gtk_timeout once per second.  Checks for updates and
+   makes any changes as appropriate.
+ */
+static gboolean
+check_for_updates (gpointer data)
+{
+    ProgressData *battstat = data;
+    BatteryStatus info;
+    const char *err;
+
+    if (DEBUG) g_print ("check_for_updates ()\n");
+
+    if ((err = power_management_getinfo (&info)))
+        battstat_error_dialog (battstat->applet, err);
+
+    if (!event_driven)
+    {
+        int timeout;
+
+      /* if on AC and not event driven scale back the polls to once every 10 */
+      if (info.on_ac_power)
+          timeout = 10;
+      else
+          timeout = 2;
+
+      if (timeout != battstat->timeout)
+      {
+          battstat->timeout = timeout;
+
+          if (battstat->timeout_id)
+              g_source_remove (battstat->timeout_id);
+
+          battstat->timeout_id = g_timeout_add_seconds (battstat->timeout,
+                                                        check_for_updates,
+                                                        battstat);
+      }
+    }
+
+    possibly_update_status_icon (battstat, &info);
+
+    if (!info.on_ac_power &&
+        battstat->last_batt_life != 1000 &&
+        (
+            /* if percentage drops below red_val */
+            (!battstat->red_value_is_time &&
+             battstat->last_batt_life > battstat->red_val &&
+             info.percent <= battstat->red_val) ||
+            /* if time drops below red_val */
+            (battstat->red_value_is_time &&
+             battstat->last_minutes > battstat->red_val &&
+             info.minutes <= battstat->red_val)
+        )
+        && info.present)
+    {
+        /* Warn that battery dropped below red_val */
+        if (battstat->lowbattnotification)
+        {
+            battery_low_dialog (battstat, &info);
+
+            if (battstat->beep)
+                gdk_display_beep (gdk_display_get_default ());
+        }
+    }
+
+    if (battstat->last_charging &&
+        battstat->last_acline_status == POWER_STATUS_ON &&
+        !info.charging &&
+        info.on_ac_power &&
+        info.present &&
+        info.percent > 99)
+    {
+        /* Inform that battery now fully charged */
+        if (battstat->fullbattnot)
+        {
+            battery_full_dialog (battstat->applet);
+
+            if (battstat->beep)
+                gdk_display_beep (gdk_display_get_default ());
+        }
+    }
+
+    /* If the warning dialog is displayed and we just got plugged in then
+       stop displaying it.
+     */
+    if (battstat->battery_low_dialog && info.on_ac_power)
+        battery_low_dialog_destroy (battstat);
+
+    if (info.on_ac_power != battstat->last_acline_status ||
+        info.percent != battstat->last_batt_life ||
+        info.minutes != battstat->last_minutes ||
+        info.charging != battstat->last_charging)
+    {
+        /* Update the tooltip */
+        update_tooltip (battstat, &info);
+
+        /* If the warning dialog box is currently displayed, update that too. */
+        if (battstat->battery_low_dialog != NULL)
+            battery_low_update_text (battstat, &info);
+    }
+
+    if ((battstat->showtext == APPLET_SHOW_PERCENT &&
+         battstat->last_batt_life != info.percent) ||
+        (battstat->showtext == APPLET_SHOW_TIME &&
+         battstat->last_minutes != info.minutes) ||
+        battstat->last_acline_status != info.on_ac_power ||
+        battstat->last_present != info.present ||
+        battstat->refresh_label) /* set by properties dialog */
+    {
+        /* Update the label */
+        update_percent_label (battstat, &info);
+
+        /* done */
+        battstat->refresh_label = FALSE;
+    }
+
+    battstat->last_charging = info.charging;
+    battstat->last_batt_life = info.percent;
+    battstat->last_minutes = info.minutes;
+    battstat->last_acline_status = info.on_ac_power;
+    battstat->last_present = info.present;
+
+    return TRUE;
+}
+
+/* Gets called when the user removes the applet from the panel.  Clean up
+   all instance-specific data and call the global teardown function to
+   decrease our applet count (and possibly perform global cleanup)
+ */
+static void
+destroy_applet (GtkWidget    *widget,
+                ProgressData *battstat)
+{
+    if (DEBUG) g_print ("destroy_applet ()\n");
+
+    if (battstat->prop_win)
+        gtk_widget_destroy (GTK_WIDGET (battstat->prop_win));
+
+    if (battstat->battery_low_dialog)
+        battery_low_dialog_destroy (battstat);
+
+    if (battstat->timeout_id)
+        g_source_remove (battstat->timeout_id);
+
+    g_object_unref (G_OBJECT (battstat->status));
+    g_object_unref (G_OBJECT (battstat->percent));
+    g_object_unref (battstat->settings);
+
+    static_global_teardown (battstat);
+
+    g_free (battstat);
+}
+
+/* Common function invoked by the 'Help' context menu item and the 'Help'
+ * button in the preferences dialog.
+ */
+void
+battstat_show_help (ProgressData *battstat,
+                    const char   *section)
+{
+    GError *error = NULL;
+    char *uri;
+
+    if (section)
+        uri = g_strdup_printf ("help:mate-battstat/%s", section);
+    else
+        uri = g_strdup ("help:mate-battstat");
+
+    gtk_show_uri_on_window (NULL,
+                            uri,
+                            gtk_get_current_event_time (),
+                            &error);
+
+    g_free (uri);
+
+    if (error)
+    {
+        char *message;
+
+        message = g_strdup_printf (_("There was an error displaying help: %s"),
+                                   error->message );
+        battstat_error_dialog (battstat->applet, message);
+        g_error_free (error);
+        g_free (message);
+    }
+}
+
+/* Called when the user selects the 'help' menu item.
+ */
+static void
+help_cb (GtkAction    *action,
+         ProgressData *battstat)
+{
+    battstat_show_help (battstat, NULL);
+}
+
+/* Called when the user selects the 'about' menu item.
+ */
+static void
+about_cb (GtkAction *action, ProgressData *battstat)
+{
+    const gchar *authors[] = {
+        "J\xC3\xB6rgen Pehrson <jp@spektr.eu.org>",
+        "Lennart Poettering <lennart@poettering.de> (Linux ACPI support)",
+        "Seth Nickell <snickell@stanford.edu> (GNOME2 port)",
+        "Davyd Madeley <davyd@madeley.id.au>",
+        "Ryan Lortie <desrt@desrt.ca>",
+        "Joe Marcus Clarke <marcus@FreeBSD.org> (FreeBSD ACPI support)",
+        NULL
+    };
+
+    const gchar *documenters[] = {
+        "J\xC3\xB6rgen Pehrson <jp@spektr.eu.org>",
+        "Trevor Curtis <tcurtis@somaradio.ca>",
+        "Davyd Madeley <davyd@madeley.id.au>",
+        N_("MATE Documentation Team"),
+        NULL
+    };
+
+    char *comments = g_strdup_printf ("%s\n\n%s",
+                                      _("This utility shows the status of your laptop battery."),
+                                      power_management_using_upower () ?
+                                      /* true */ _("upower backend enabled.") :
+                                      /* false */ _("Legacy backend enabled."));
+
+#ifdef ENABLE_NLS
+    const char **p;
+    for (p = documenters; *p; ++p)
+        *p = _(*p);
+#endif
+
+    gtk_show_about_dialog (NULL,
+                           "title",              _("About Battery Charge Monitor"),
+                           "version",            VERSION,
+                           "copyright",          _("Copyright \xc2\xa9 2000 The Gnulix Society\n"
+                                                   "Copyright \xc2\xa9 2002-2005 Free Software Foundation and others\n"
+                                                   "Copyright \xc2\xa9 2012-2021 MATE developers"),
+                           "comments",           comments,
+                           "authors",            authors,
+                           "documenters",        documenters,
+                           "translator-credits", _("translator-credits"),
+                           "logo-icon-name",     "battery",
+                           NULL);
+
+    g_free (comments);
+}
+
+/* Rotate text on side panels.  Called on initial startup and when the
+ * orientation changes (ie: the panel we were on moved or we moved to
+ * another panel).
+ */
+static void
+setup_text_orientation (ProgressData *battstat)
+{
+    if (battstat->orienttype == MATE_PANEL_APPLET_ORIENT_RIGHT)
+        gtk_label_set_angle (GTK_LABEL (battstat->percent), 90);
+    else if (battstat->orienttype == MATE_PANEL_APPLET_ORIENT_LEFT)
+        gtk_label_set_angle (GTK_LABEL (battstat->percent), 270);
+    else
+        gtk_label_set_angle (GTK_LABEL (battstat->percent), 0);
+}
+
+/* This signal is delivered by the panel when the orientation of the applet
+   has changed.  This is either because the applet has just been created,
+   has just been moved to a new panel or the panel that the applet was on
+   has changed orientation.
+*/
+static void
+change_orient (MatePanelApplet       *applet,
+               MatePanelAppletOrient  orient,
+               ProgressData          *battstat)
+{
+    if (DEBUG) g_print ("change_orient ()\n");
+
+    /* Ignore the update if we already know. */
+    if (orient != battstat->orienttype)
+    {
+        battstat->orienttype = orient;
+
+        /* The applet changing orientation very likely involves the layout
+           being changed to better fit the new shape of the panel.
+        */
+        setup_text_orientation (battstat);
+        reconfigure_layout (battstat);
+    }
+}
+
+/* This is delivered when our size has changed.  This happens when the applet
+   is just created or if the size of the panel has changed.
+*/
+static void
+size_allocate (MatePanelApplet *applet,
+               GtkAllocation   *allocation,<--- Parameter 'allocation' can be declared as pointer to const
+               ProgressData    *battstat)
+{
+    if (DEBUG) g_print ("applet_change_pixel_size ()\n");
+
+    /* Ignore the update if we already know. */
+    if (battstat->width == allocation->width &&
+        battstat->height == allocation->height)
+        return;
+
+    battstat->width = allocation->width;
+    battstat->height = allocation->height;
+
+    /* The applet changing size could result in the layout changing. */
+    reconfigure_layout (battstat);
+}
+
+/* Get our settings out of gsettings.
+ */
+static void
+load_preferences (ProgressData *battstat)
+{
+    GSettings *settings = battstat->settings;
+    gdouble red_val;
+
+    if (DEBUG) g_print ("load_preferences ()\n");
+
+    battstat->red_val = g_settings_get_int (settings, "red-value");
+    battstat->red_val = MIN (battstat->red_val, 100);
+    battstat->red_value_is_time = g_settings_get_boolean (settings, "red-value-is-time");
+
+    /* automatically calculate orangle and yellow values from the red value */
+    red_val = (gdouble) battstat->red_val;
+
+    battstat->orange_val = (guint) (ORANGE_MULTIPLIER * red_val);
+    battstat->orange_val = MIN (battstat->orange_val, 100);
+
+    battstat->yellow_val = (guint) (YELLOW_MULTIPLIER * red_val);
+    battstat->yellow_val = MIN (battstat->yellow_val, 100);
+
+    battstat->lowbattnotification = g_settings_get_boolean (settings, "low-battery-notification");
+    battstat->fullbattnot = g_settings_get_boolean (settings, "full-battery-notification");
+    battstat->beep = g_settings_get_boolean (settings, "beep");
+    battstat->showtext = g_settings_get_int (settings, "show-text");
+}
+
+/* Convenience function to attach a child widget to a GtkGrid in the
+   position indicated by 'loc'.  This is very special-purpose for 3x3
+   gridss and only supports positions that are used in this applet.
+ */
+static void
+grid_layout_attach (GtkGrid        *grid,
+                    LayoutLocation  loc,
+                    GtkWidget      *child)
+{
+    switch (loc)
+    {
+        case LAYOUT_LONG:
+            gtk_grid_attach (grid, child, 1, 0, 1, 2);
+            break;
+
+        case LAYOUT_TOPLEFT:
+            gtk_grid_attach (grid, child, 0, 0, 1, 1);
+            break;
+
+        case LAYOUT_TOP:
+            gtk_grid_attach (grid, child, 1, 0, 1, 1);
+            break;
+
+        case LAYOUT_LEFT:
+            gtk_grid_attach (grid, child, 0, 1, 1, 1);
+            break;
+
+        case LAYOUT_CENTRE:
+            gtk_grid_attach (grid, child, 1, 1, 1, 1);
+            break;
+
+        case LAYOUT_RIGHT:
+            gtk_grid_attach (grid, child, 2, 1, 1, 1);
+            break;
+
+        case LAYOUT_BOTTOM:
+            gtk_grid_attach (grid, child, 1, 2, 1, 1);
+            break;
+
+        default:
+            break;
+    }
+}
+
+/* The layout has (maybe) changed.  Calculate what layout we ought to be
+   using and update some things if anything has changed.  This is called
+   from size/orientation change callbacks and from the preferences dialog
+   when elements get added or removed.
+ */
+void
+reconfigure_layout (ProgressData *battstat)
+{
+    LayoutConfiguration c;
+
+    /* Default to no elements being displayed. */
+    c.status = c.text = LAYOUT_NONE;
+
+    switch (battstat->orienttype)
+    {
+      case MATE_PANEL_APPLET_ORIENT_UP:
+      case MATE_PANEL_APPLET_ORIENT_DOWN:
+          /* Stack horizontally for top and bottom panels. */
+          c.status = LAYOUT_LEFT;
+          if (battstat->showtext)
+              c.text = LAYOUT_RIGHT;
+          break;
+
+      case MATE_PANEL_APPLET_ORIENT_LEFT:
+      case MATE_PANEL_APPLET_ORIENT_RIGHT:
+          /* Stack vertically for left and right panels. */
+          c.status = LAYOUT_TOP;
+          if (battstat->showtext)
+              c.text = LAYOUT_BOTTOM;
+          break;
+    }
+
+    if (memcmp (&c, &battstat->layout, sizeof (LayoutConfiguration)))
+    {
+        /* Something in the layout has changed.  Rebuild. */
+
+        /* Start by removing any elements in the grid from the grid. */
+        if (battstat->layout.text)
+            gtk_container_remove (GTK_CONTAINER (battstat->grid),
+                                  battstat->percent);
+        if (battstat->layout.status)
+            gtk_container_remove (GTK_CONTAINER (battstat->grid),
+                                  battstat->status);
+
+        /* Attach the elements to their new locations. */
+        grid_layout_attach (GTK_GRID (battstat->grid),
+                            c.status, battstat->status);
+        grid_layout_attach (GTK_GRID (battstat->grid),
+                            c.text, battstat->percent);
+
+        gtk_widget_show_all (battstat->applet);
+    }
+
+    battstat->layout = c;
+
+    /* Check for generic updates. This is required, for example, to make sure
+       the text label is immediately updated to show the time remaining or
+       percentage.
+    */
+    check_for_updates (battstat);
+}
+
+/* Allocate the widgets for the applet and connect our signals.
+ */
+static gint
+create_layout (ProgressData *battstat)
+{
+    if (DEBUG) g_print ("create_layout ()\n");
+
+    /* Allocate the four widgets that we need. */
+    battstat->grid = gtk_grid_new ();
+    battstat->percent = gtk_label_new ("");
+    battstat->status = gtk_image_new ();
+
+    /* When you first get a pointer to a newly created GtkWidget it has one
+       'floating' reference.  When you first add this widget to a container
+       the container adds a real reference and removes the floating reference
+       if one exists.  Since we insert/remove these widgets from the table
+       when our layout is reconfigured, we need to keep our own 'real'
+       reference to each widget.  This adds a real reference to each widget
+       and "sinks" the floating reference.
+    */
+    g_object_ref (battstat->status);
+    g_object_ref (battstat->percent);
+    g_object_ref_sink (G_OBJECT (battstat->status));
+    g_object_ref_sink (G_OBJECT (battstat->percent));
+
+    /* Let reconfigure_layout know that the grid is currently empty. */
+    battstat->layout.status = LAYOUT_NONE;
+    battstat->layout.text = LAYOUT_NONE;
+
+    /* Put the grid directly inside the applet and show everything. */
+    gtk_widget_set_halign (battstat->grid, GTK_ALIGN_CENTER);
+    gtk_widget_set_valign (battstat->grid, GTK_ALIGN_CENTER);
+    gtk_container_add (GTK_CONTAINER (battstat->applet), battstat->grid);
+    gtk_widget_show_all (battstat->applet);
+
+    /* Attach all sorts of signals to the applet. */
+    g_signal_connect (battstat->applet, "destroy",
+                      G_CALLBACK (destroy_applet),
+                      battstat);
+
+    g_signal_connect (battstat->applet, "change-orient",
+                      G_CALLBACK (change_orient),
+                      battstat);
+
+    g_signal_connect (battstat->applet, "size-allocate",
+                      G_CALLBACK (size_allocate),<--- You might need to cast the function pointer here
+                      battstat);
+
+    return FALSE;
+}
+
+void
+prop_cb (GtkAction    *action,
+         ProgressData *battstat)
+{
+    if (battstat->prop_win) {
+        gtk_window_set_screen (GTK_WINDOW (battstat->prop_win),
+                               gtk_widget_get_screen (battstat->applet));
+        gtk_window_present (GTK_WINDOW (battstat->prop_win));
+    } else {
+        battstat->prop_win = battstat_preferences_new (battstat);
+        gtk_widget_show_all (GTK_WIDGET (battstat->prop_win));
+    }
+}
+
+/* Called by the factory to fill in the fields for the applet.
+ */
+static gboolean
+battstat_applet_fill (MatePanelApplet *applet)
+{
+    ProgressData *battstat;
+    AtkObject *atk_widget;
+    GtkActionGroup *action_group;
+    const char *err;
+
+    if (DEBUG) g_print ("main ()\n");
+
+#ifndef ENABLE_IN_PROCESS
+    g_set_application_name (_("Battery Charge Monitor"));
+#endif
+
+    gtk_window_set_default_icon_name ("battery");
+
+    mate_panel_applet_set_flags (applet,
+                                 MATE_PANEL_APPLET_EXPAND_MINOR);
+
+    battstat = g_new0 (ProgressData, 1);
+    battstat->settings = mate_panel_applet_settings_new (applet,
+                                                         BATTSTAT_SCHEMA);
+
+    /* Some starting values... */
+    battstat->applet = GTK_WIDGET (applet);
+    battstat->refresh_label = TRUE;
+    battstat->last_batt_life = 1000;
+    battstat->last_acline_status = POWER_STATUS_UNKNOWN;
+    battstat->last_charging = POWER_STATUS_UNKNOWN;
+    battstat->orienttype = mate_panel_applet_get_orient (applet);
+    battstat->battery_low_dialog = NULL;
+    battstat->battery_low_label = NULL;
+    battstat->timeout = -1;
+    battstat->timeout_id = 0;
+
+    /* The first received size_allocate event will cause a reconfigure. */
+    battstat->height = -1;
+    battstat->width = -1;
+
+    load_preferences (battstat);
+    create_layout (battstat);
+    setup_text_orientation (battstat);
+
+    action_group = gtk_action_group_new ("Battstat Applet Actions");
+    gtk_action_group_set_translation_domain (action_group,
+                                             GETTEXT_PACKAGE);
+    gtk_action_group_add_actions (action_group,
+                                  battstat_menu_actions,
+                                  G_N_ELEMENTS (battstat_menu_actions),
+                                  battstat);
+
+    mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (battstat->applet),
+                                                BATTSTAT_RESOURCE_PATH "battstat-applet-menu.xml",
+                                                action_group);
+
+    if (mate_panel_applet_get_locked_down (MATE_PANEL_APPLET (battstat->applet))) {
+        GtkAction *action;
+
+        action = gtk_action_group_get_action (action_group,
+                                              "BattstatProperties");
+        gtk_action_set_visible (action, FALSE);
+    }
+    g_object_unref (action_group);
+
+    atk_widget = gtk_widget_get_accessible (battstat->applet);
+    if (GTK_IS_ACCESSIBLE (atk_widget)) {
+        atk_object_set_name (atk_widget,
+                             _("Battery Charge Monitor"));
+        atk_object_set_description (atk_widget,
+                                    _("Monitor a laptop's remaining power"));
+    }
+
+    if ((err = static_global_initialisation (battstat)))
+        battstat_error_dialog (GTK_WIDGET (applet), err);
+
+    return TRUE;
+}
+
+/* Boilerplate... */
+static gboolean
+battstat_applet_factory (MatePanelApplet *applet,
+                         const gchar     *iid,
+                         gpointer         data)
+{
+    gboolean retval = FALSE;
+
+    if (!strcmp (iid, "BattstatApplet"))
+        retval = battstat_applet_fill (applet);
+
+    return retval;
+}
+
+PANEL_APPLET_FACTORY ("BattstatAppletFactory",
+                      PANEL_TYPE_APPLET,
+                      "battstat",
+                      battstat_applet_factory,
+                      NULL)
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/120.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/120.html new file mode 100644 index 00000000..4f4cbaaa --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/120.html @@ -0,0 +1,365 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "netspeed.h"
+
+enum { N_STATES = 4 };
+
+struct _NetSpeed
+{
+    LoadGraph *graph;
+    guint64 states[N_STATES];
+    size_t cur;
+};
+
+NetSpeed*
+netspeed_new (LoadGraph *g)
+{
+    NetSpeed *ns = g_new0 (NetSpeed, 1);
+    ns->graph = g;
+    return ns;
+}
+
+void netspeed_delete(NetSpeed *ns)
+{
+    g_free(ns);
+}
+
+void
+netspeed_add (NetSpeed *ns,
+              guint64   tx)
+{
+    ns->cur = (ns->cur + 1) % N_STATES;
+    ns->states[ns->cur] = tx;
+}
+
+char*
+netspeed_get (NetSpeed *ns)
+{
+    guint64  older;
+    guint64  newer;
+    guint64  rate;
+    char    *bytes;
+    char    *text;
+
+    newer = ns->states[ns->cur];
+    older = ns->states[(ns->cur + 1) % N_STATES];
+
+    if ((older != 0) && (newer > older))
+        rate = (newer - older) * 1000 / ((N_STATES - 1) * ns->graph->speed);
+    else
+        /* We end up here if we haven't got enough data yet or the
+        network interface has jumped back (or there has never
+        been any activity on any interface). A value of 0 is
+        likely to be accurate, but if it is wrong it will be
+        clearly wrong. In any event, it should fix itself in a
+        few seconds. */
+        rate = 0;
+
+    bytes = g_format_size (rate);
+    text = g_strdup_printf (_("%s/s"), bytes);
+    g_free (bytes);
+
+    return text;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/121.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/121.html new file mode 100644 index 00000000..690de2df --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/121.html @@ -0,0 +1,1609 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
/* MATE cpuload/memload panel applet
+ * (C) 2002 The Free Software Foundation
+ *
+ * Authors:
+ *          Todd Kulesza
+ *
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet-gsettings.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "global.h"
+
+#define NEVER_SENSITIVE       "never_sensitive"
+
+/* set sensitive and setup NEVER_SENSITIVE appropriately */
+static void
+hard_set_sensitive (GtkWidget *w, gboolean sensitivity)
+{
+    gtk_widget_set_sensitive (w, sensitivity);
+    g_object_set_data (G_OBJECT (w), NEVER_SENSITIVE,
+                       GINT_TO_POINTER ( ! sensitivity));
+}
+
+/* set sensitive, but always insensitive if NEVER_SENSITIVE is set */
+static void
+soft_set_sensitive (GtkWidget *w, gboolean sensitivity)
+{
+    if (g_object_get_data (G_OBJECT (w), NEVER_SENSITIVE))
+        gtk_widget_set_sensitive (w, FALSE);
+    else
+        gtk_widget_set_sensitive (w, sensitivity);
+}
+
+static void
+properties_set_insensitive(MultiloadApplet *ma)
+{
+    guint total_graphs = 0;
+    guint last_graph = 0;
+    guint i;
+
+    for (i = 0; i < graph_n; i++)
+        if (ma->graphs[i]->visible)
+        {
+            last_graph = i;
+            total_graphs++;
+        }
+
+    if (total_graphs < 2)
+        soft_set_sensitive (ma->check_boxes[last_graph], FALSE);
+}
+
+static void
+on_properties_dialog_response (GtkWidget       *widget,
+                               gint             arg,
+                               MultiloadApplet *ma)
+{
+    GError *error = NULL;
+
+    switch (arg) {
+        case GTK_RESPONSE_HELP:
+
+            gtk_show_uri_on_window (NULL,
+                                    "help:mate-multiload/multiload-prefs",
+                                    gtk_get_current_event_time (),
+                                    &error);
+
+            if (error) { /* FIXME: the user needs to see this */
+                g_warning ("help error: %s\n", error->message);
+                g_error_free (error);
+            }
+            break;
+
+        case GTK_RESPONSE_CLOSE:
+        default:
+            gtk_widget_destroy (widget);
+            ma->prop_dialog = NULL;
+    }
+}
+
+static void
+on_speed_spin_button_value_changed (GtkSpinButton *spin_button,
+                                    gpointer       user_data)
+{
+    MultiloadApplet *ma = user_data;
+    gint value;
+    guint i;
+
+    value = gtk_spin_button_get_value_as_int (spin_button);
+    g_settings_set_uint (ma->settings, REFRESH_RATE_KEY, (guint) value);
+    for (i = 0; i < graph_n; i++) {
+        load_graph_stop (ma->graphs[i]);
+        ma->graphs[i]->speed = (guint) value;
+        if (ma->graphs[i]->visible)
+            load_graph_start (ma->graphs[i]);
+    }
+}
+
+static void
+on_graph_size_spin_button_value_changed (GtkSpinButton *spin_button,
+                                         gpointer       user_data)
+{
+    MultiloadApplet *ma = user_data;
+    gint value;
+    guint i;
+
+    value = gtk_spin_button_get_value_as_int (spin_button);
+    g_settings_set_uint (ma->settings, GRAPH_SIZE_KEY, (guint) value);
+    for (i = 0; i < graph_n; i++) {
+        ma->graphs[i]->size = (guint) value;
+        if (ma->graphs[i]->orient) {
+            gtk_widget_set_size_request (ma->graphs[i]->main_widget,
+                                         (gint) ma->graphs[i]->pixel_size,
+                                         (gint) ma->graphs[i]->size);
+        } else {
+            gtk_widget_set_size_request (ma->graphs[i]->main_widget,
+                                         (gint) ma->graphs[i]->size,
+                                         (gint) ma->graphs[i]->pixel_size);
+        }
+    }
+}
+
+static void
+on_net_threshold1_spin_button_value_changed (GtkSpinButton *spin_button,
+                                             gpointer       user_data)
+{
+    MultiloadApplet *ma = user_data;
+    gdouble temp;
+
+    temp = gtk_spin_button_get_value (spin_button);
+    ma->net_threshold1 = (guint64) temp;
+    if (ma->net_threshold1 >= ma->net_threshold2) {
+        ma->net_threshold1 = ma->net_threshold2 - 1;
+        gtk_spin_button_set_value (spin_button, (gdouble) ma->net_threshold1);
+    }
+    g_settings_set_uint64 (ma->settings, KEY_NET_THRESHOLD1, ma->net_threshold1);
+}
+
+static void
+on_net_threshold2_spin_button_value_changed (GtkSpinButton *spin_button,
+                                             gpointer       user_data)
+{
+    MultiloadApplet *ma = user_data;
+    gdouble temp;
+
+    temp = gtk_spin_button_get_value (spin_button);
+    ma->net_threshold2 = (guint64) temp;
+    if (ma->net_threshold2 >= ma->net_threshold3) {
+        ma->net_threshold2 = ma->net_threshold3 - 1;
+        gtk_spin_button_set_value (spin_button, (gdouble) ma->net_threshold2);
+    } else if (ma->net_threshold2 <= ma->net_threshold1) {
+        ma->net_threshold2 = ma->net_threshold1 + 1;
+        gtk_spin_button_set_value (spin_button, (gdouble) ma->net_threshold2);
+    }
+    g_settings_set_uint64 (ma->settings, KEY_NET_THRESHOLD2, ma->net_threshold2);
+}
+
+static void
+on_net_threshold3_spin_button_value_changed (GtkSpinButton *spin_button,
+                                             gpointer       user_data)
+{
+    MultiloadApplet *ma = user_data;
+    gdouble temp;
+
+    temp = gtk_spin_button_get_value (spin_button);
+    ma->net_threshold3 = (guint64) temp;
+    if (ma->net_threshold3 <= ma->net_threshold2) {
+        ma->net_threshold3 = ma->net_threshold2 + 1;
+        gtk_spin_button_set_value (spin_button, (gdouble) ma->net_threshold3);
+    }
+    g_settings_set_uint64 (ma->settings, KEY_NET_THRESHOLD3, ma->net_threshold3);
+}
+
+static void
+color_button_set (GtkColorChooser *button,
+                  GSettings       *settings,
+                  const char      *key,
+                  GdkRGBA         *color)
+{
+    gchar   *color_string;
+
+    gtk_color_chooser_get_rgba (button, color);
+    color_string = gdk_rgba_to_string (color);
+    g_settings_set_string (settings, key, color_string);
+    g_free (color_string);
+}
+
+static void
+on_cpuload_usr_color_button_color_set (GtkColorButton  *button,
+                                       MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_CPULOAD_USR_COLOR,
+                      &(ma->graphs[graph_cpuload]->colors[cpuload_usr]));
+}
+
+static void
+on_cpuload_sys_color_button_color_set (GtkColorButton  *button,
+                                       MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_CPULOAD_SYS_COLOR,
+                      &(ma->graphs[graph_cpuload]->colors[cpuload_sys]));
+}
+
+static void
+on_cpuload_nice_color_button_color_set (GtkColorButton  *button,
+                                        MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_CPULOAD_NICE_COLOR,
+                      &(ma->graphs[graph_cpuload]->colors[cpuload_nice]));
+}
+
+static void
+on_cpuload_iowait_color_button_color_set (GtkColorButton  *button,
+                                          MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_CPULOAD_IOWAIT_COLOR,
+                      &(ma->graphs[graph_cpuload]->colors[cpuload_iowait]));
+}
+
+static void
+on_cpuload_free_color_button_color_set (GtkColorButton *button,
+                                        MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_CPULOAD_IDLE_COLOR,
+                      &(ma->graphs[graph_cpuload]->colors[cpuload_free]));
+}
+
+static void
+on_memload_user_color_button_color_set (GtkColorButton  *button,
+                                        MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_MEMLOAD_USER_COLOR,
+                      &(ma->graphs[graph_memload]->colors[memload_user]));
+}
+
+static void
+on_memload_shared_color_button_color_set (GtkColorButton  *button,
+                                          MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_MEMLOAD_SHARED_COLOR,
+                      &(ma->graphs[graph_memload]->colors[memload_shared]));
+}
+
+static void
+on_memload_buffer_color_button_color_set (GtkColorButton  *button,
+                                          MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_MEMLOAD_BUFFER_COLOR,
+                      &(ma->graphs[graph_memload]->colors[memload_buffer]));
+}
+
+static void
+on_memload_cached_color_button_color_set (GtkColorButton  *button,
+                                          MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_MEMLOAD_CACHED_COLOR,
+                      &(ma->graphs[graph_memload]->colors[memload_cached]));
+}
+
+static void
+on_memload_free_color_button_color_set (GtkColorButton  *button,
+                                        MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_MEMLOAD_FREE_COLOR,
+                      &(ma->graphs[graph_memload]->colors[memload_free]));
+}
+
+static void
+on_netload2_in_color_button_color_set (GtkColorButton  *button,
+                                       MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_NETLOAD2_IN_COLOR,
+                      &(ma->graphs[graph_netload2]->colors[netload2_in]));
+}
+
+static void
+on_netload2_out_color_button_color_set (GtkColorButton  *button,
+                                        MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_NETLOAD2_OUT_COLOR,
+                      &(ma->graphs[graph_netload2]->colors[netload2_out]));
+}
+
+static void
+on_netload2_loopback_color_button_color_set (GtkColorButton  *button,
+                                             MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_NETLOAD2_LOOPBACK_COLOR,
+                      &(ma->graphs[graph_netload2]->colors[netload2_loopback]));
+}
+
+static void
+on_netload2_background_color_button_color_set (GtkColorButton  *button,
+                                               MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_NETLOAD2_BACKGROUND_COLOR,
+                      &(ma->graphs[graph_netload2]->colors[netload2_background]));
+}
+
+static void
+on_netload2_gridline_color_button_color_set (GtkColorButton  *button,
+                                             MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_NETLOAD2_GRIDLINE_COLOR,
+                      &(ma->graphs[graph_netload2]->colors[netload2_gridline]));
+}
+
+static void
+on_netload2_indicator_color_button_color_set (GtkColorButton  *button,
+                                              MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_NETLOAD2_INDICATOR_COLOR,
+                      &(ma->graphs[graph_netload2]->colors[netload2_indicator]));
+}
+
+static void
+on_swapload_used_color_button_color_set (GtkColorButton  *button,
+                                         MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_SWAPLOAD_USED_COLOR,
+                      &(ma->graphs[graph_swapload]->colors[swapload_used]));
+}
+
+static void
+on_swapload_free_color_button_color_set (GtkColorButton  *button,
+                                         MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_SWAPLOAD_FREE_COLOR,
+                      &(ma->graphs[graph_swapload]->colors[swapload_free]));
+}
+
+static void
+on_loadavg_average_color_button_color_set (GtkColorButton  *button,
+                                           MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_LOADAVG_AVERAGE_COLOR,
+                      &(ma->graphs[graph_loadavg]->colors[loadavg_average]));
+}
+
+static void
+on_loadavg_background_color_button_color_set (GtkColorButton  *button,
+                                              MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_LOADAVG_BACKGROUND_COLOR,
+                      &(ma->graphs[graph_loadavg]->colors[loadavg_background]));
+}
+
+static void
+on_loadavg_gridline_color_button_color_set (GtkColorButton  *button,
+                                            MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_LOADAVG_GRIDLINE_COLOR,
+                      &(ma->graphs[graph_loadavg]->colors[loadavg_gridline]));
+}
+
+static void
+on_diskload_read_color_button_color_set (GtkColorButton  *button,
+                                         MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_DISKLOAD_READ_COLOR,
+                      &(ma->graphs[graph_diskload]->colors[diskload_read]));
+}
+
+static void
+on_diskload_write_color_button_color_set (GtkColorButton  *button,
+                                          MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_DISKLOAD_WRITE_COLOR,
+                      &(ma->graphs[graph_diskload]->colors[diskload_write]));
+}
+
+static void
+on_diskload_free_color_button_color_set (GtkColorButton  *button,
+                                         MultiloadApplet *ma)
+{
+    color_button_set (GTK_COLOR_CHOOSER (button),
+                      ma->settings, KEY_DISKLOAD_FREE_COLOR,
+                      &(ma->graphs[graph_diskload]->colors[diskload_free]));
+}
+
+static void
+graph_set_active (MultiloadApplet *ma,
+                  LoadGraph       *graph,
+                  gboolean         active)
+{
+    graph->visible = active;
+    if (active) {
+        guint i;
+
+        for (i = 0; i < graph_n; i++)
+            soft_set_sensitive(ma->check_boxes[i], TRUE);
+        gtk_widget_show_all (graph->main_widget);
+        load_graph_start (graph);
+    } else {
+	load_graph_stop (graph);
+        gtk_widget_hide (graph->main_widget);
+        properties_set_insensitive (ma);
+    }
+}
+
+#define GRAPH_ACTIVE_SET(x) graph_set_active (ma, ma->graphs[(x)], \
+    gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)))
+
+static void
+on_graph_cpuload_checkbox_toggled (GtkCheckButton  *checkbox,
+                                   MultiloadApplet *ma)
+{
+    GRAPH_ACTIVE_SET (graph_cpuload);
+}
+
+static void
+on_graph_memload_checkbox_toggled (GtkCheckButton  *checkbox,
+                                   MultiloadApplet *ma)
+{
+    GRAPH_ACTIVE_SET (graph_memload);
+}
+
+static void
+on_graph_netload2_checkbox_toggled (GtkCheckButton  *checkbox,
+                                    MultiloadApplet *ma)
+{
+    GRAPH_ACTIVE_SET (graph_netload2);
+}
+
+static void
+on_graph_swapload_checkbox_toggled (GtkCheckButton  *checkbox,
+                                    MultiloadApplet *ma)
+{
+    GRAPH_ACTIVE_SET (graph_swapload);
+}
+
+static void
+on_graph_loadavg_checkbox_toggled (GtkCheckButton  *checkbox,
+                                   MultiloadApplet *ma)
+{
+    GRAPH_ACTIVE_SET (graph_loadavg);
+}
+
+static void
+on_graph_diskload_checkbox_toggled (GtkCheckButton  *checkbox,
+                                    MultiloadApplet *ma)
+{
+    GRAPH_ACTIVE_SET (graph_diskload);
+}
+
+/* save the checkbox option to gsettings and apply it on the applet */
+static void
+on_nvme_checkbox_toggled (GtkCheckButton  *checkbox,
+                          MultiloadApplet *ma)
+{
+    ma->nvme_diskstats = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
+}
+
+static void
+read_spin_uint_button (GtkWidget    *widget,
+                       GSettings    *settings,
+                       const char   *key,
+                       guint         min,
+                       guint         max)
+{
+    guint value;
+
+    value = CLAMP (g_settings_get_uint (settings, key), min, max);
+    gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), (gdouble) value);
+    if (!g_settings_is_writable (settings, key))
+        hard_set_sensitive (widget, FALSE);
+}
+
+static void
+read_spin_uint64_button (GtkWidget    *widget,
+                         GSettings    *settings,
+                         const char   *key,
+                         guint         min,
+                         guint         max)
+{
+    guint64 value;
+
+    value = CLAMP (g_settings_get_uint64 (settings, key), min, max);
+    gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), (gdouble) value);
+
+    if (!g_settings_is_writable (settings, key))
+        hard_set_sensitive (widget, FALSE);
+}
+
+static void
+read_color_button (GtkWidget    *widget,
+                   GSettings    *settings,
+                   const char   *key)
+{
+    GdkRGBA color;
+    gchar *color_string;
+
+    color_string = g_settings_get_string (settings, key);
+    if (*color_string != '\0') {
+        gdk_rgba_parse (&color, color_string);
+    } else {
+        gdk_rgba_parse (&color, "#000000");
+    }
+    g_free (color_string);
+    gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (widget), &color);
+
+    if (!g_settings_is_writable (settings, key))
+        hard_set_sensitive (widget, FALSE);
+}
+
+/* show properties dialog */
+void
+multiload_properties_cb (GtkAction       *action,
+                         MultiloadApplet *ma)
+{
+    GtkBuilder *builder;
+    GtkWidget  *dialog = NULL;
+    GtkWidget  *graph_size_spin_button_label;
+    const char *graph_size_spin_button_label_txt;
+    MatePanelAppletOrient orient;
+
+    if (ma->prop_dialog) {
+        dialog = ma->prop_dialog;
+
+        gtk_window_set_screen (GTK_WINDOW (dialog),
+                               gtk_widget_get_screen (GTK_WIDGET (ma->applet)));
+
+        gtk_notebook_set_current_page (GTK_NOTEBOOK (ma->notebook),
+                                       ma->last_clicked);
+        gtk_window_present (GTK_WINDOW (dialog));
+        return;
+    }
+
+    builder = gtk_builder_new_from_resource (MULTILOAD_RESOURCE_PATH "properties.ui");
+    gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
+
+    #define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
+
+    ma->prop_dialog = GET_WIDGET ("properties_dialog");
+
+    read_color_button (GET_WIDGET ("cpuload_free_color_button"), ma->settings, KEY_CPULOAD_IDLE_COLOR);
+    read_color_button (GET_WIDGET ("cpuload_iowait_color_button"), ma->settings, KEY_CPULOAD_IOWAIT_COLOR);
+    read_color_button (GET_WIDGET ("cpuload_nice_color_button"), ma->settings, KEY_CPULOAD_NICE_COLOR);
+    read_color_button (GET_WIDGET ("cpuload_sys_color_button"), ma->settings, KEY_CPULOAD_SYS_COLOR);
+    read_color_button (GET_WIDGET ("cpuload_usr_color_button"), ma->settings, KEY_CPULOAD_USR_COLOR);
+    read_color_button (GET_WIDGET ("diskload_free_color_button"), ma->settings, KEY_DISKLOAD_FREE_COLOR);
+    read_color_button (GET_WIDGET ("diskload_read_color_button"), ma->settings, KEY_DISKLOAD_READ_COLOR);
+    read_color_button (GET_WIDGET ("diskload_write_color_button"), ma->settings, KEY_DISKLOAD_WRITE_COLOR);
+    read_color_button (GET_WIDGET ("loadavg_average_color_button"), ma->settings, KEY_LOADAVG_AVERAGE_COLOR);
+    read_color_button (GET_WIDGET ("loadavg_background_color_button"), ma->settings, KEY_LOADAVG_BACKGROUND_COLOR);
+    read_color_button (GET_WIDGET ("loadavg_gridline_color_button"), ma->settings, KEY_LOADAVG_GRIDLINE_COLOR);
+    read_color_button (GET_WIDGET ("memload_buffer_color_button"), ma->settings, KEY_MEMLOAD_BUFFER_COLOR);
+    read_color_button (GET_WIDGET ("memload_cached_color_button"), ma->settings, KEY_MEMLOAD_CACHED_COLOR);
+    read_color_button (GET_WIDGET ("memload_free_color_button"), ma->settings, KEY_MEMLOAD_FREE_COLOR);
+    read_color_button (GET_WIDGET ("memload_shared_color_button"), ma->settings, KEY_MEMLOAD_SHARED_COLOR);
+    read_color_button (GET_WIDGET ("memload_user_color_button"), ma->settings, KEY_MEMLOAD_USER_COLOR);
+    read_color_button (GET_WIDGET ("netload2_background_color_button"), ma->settings, KEY_NETLOAD2_BACKGROUND_COLOR);
+    read_color_button (GET_WIDGET ("netload2_gridline_color_button"), ma->settings, KEY_NETLOAD2_GRIDLINE_COLOR);
+    read_color_button (GET_WIDGET ("netload2_in_color_button"), ma->settings, KEY_NETLOAD2_IN_COLOR);
+    read_color_button (GET_WIDGET ("netload2_indicator_color_button"), ma->settings, KEY_NETLOAD2_INDICATOR_COLOR);
+    read_color_button (GET_WIDGET ("netload2_loopback_color_button"), ma->settings, KEY_NETLOAD2_LOOPBACK_COLOR);
+    read_color_button (GET_WIDGET ("netload2_out_color_button"), ma->settings, KEY_NETLOAD2_OUT_COLOR);
+    read_color_button (GET_WIDGET ("swapload_free_color_button"), ma->settings, KEY_SWAPLOAD_FREE_COLOR);
+    read_color_button (GET_WIDGET ("swapload_used_color_button"), ma->settings, KEY_SWAPLOAD_USED_COLOR);
+
+    graph_size_spin_button_label = GET_WIDGET ("graph_size_spin_button_label");
+    orient = mate_panel_applet_get_orient(ma->applet);
+    switch (orient) {
+        case MATE_PANEL_APPLET_ORIENT_UP:
+        case MATE_PANEL_APPLET_ORIENT_DOWN:
+            graph_size_spin_button_label_txt = _("System m_onitor width:");
+            break;
+        default:
+            graph_size_spin_button_label_txt = _("System m_onitor height:");
+    }
+    gtk_label_set_text_with_mnemonic (GTK_LABEL (graph_size_spin_button_label), graph_size_spin_button_label_txt);
+
+    read_spin_uint_button (GET_WIDGET ("graph_size_spin_button"), ma->settings, GRAPH_SIZE_KEY, GRAPH_SIZE_MIN, GRAPH_SIZE_MAX);
+    read_spin_uint_button (GET_WIDGET ("speed_spin_button"), ma->settings, REFRESH_RATE_KEY, REFRESH_RATE_MIN, REFRESH_RATE_MAX);
+
+    read_spin_uint64_button (GET_WIDGET ("net_threshold1_spin_button"), ma->settings, KEY_NET_THRESHOLD1, MIN_NET_THRESHOLD1, MAX_NET_THRESHOLD1);
+    read_spin_uint64_button (GET_WIDGET ("net_threshold2_spin_button"), ma->settings, KEY_NET_THRESHOLD2, MIN_NET_THRESHOLD2, MAX_NET_THRESHOLD2);
+    read_spin_uint64_button (GET_WIDGET ("net_threshold3_spin_button"), ma->settings, KEY_NET_THRESHOLD3, MIN_NET_THRESHOLD3, MAX_NET_THRESHOLD3);
+
+    ma->notebook = GET_WIDGET ("notebook");
+
+    ma->check_boxes[graph_cpuload]  = GET_WIDGET ("graph_cpuload_checkbox");
+    ma->check_boxes[graph_memload]  = GET_WIDGET ("graph_memload_checkbox");
+    ma->check_boxes[graph_netload2] = GET_WIDGET ("graph_netload2_checkbox");
+    ma->check_boxes[graph_swapload] = GET_WIDGET ("graph_swapload_checkbox");
+    ma->check_boxes[graph_loadavg]  = GET_WIDGET ("graph_loadavg_checkbox");
+    ma->check_boxes[graph_diskload] = GET_WIDGET ("graph_diskload_checkbox");
+
+    g_settings_bind (ma->settings, VIEW_CPULOAD_KEY,  ma->check_boxes[graph_cpuload],  "active", G_SETTINGS_BIND_DEFAULT);
+    g_settings_bind (ma->settings, VIEW_MEMLOAD_KEY,  ma->check_boxes[graph_memload],  "active", G_SETTINGS_BIND_DEFAULT);
+    g_settings_bind (ma->settings, VIEW_NETLOAD_KEY,  ma->check_boxes[graph_netload2], "active", G_SETTINGS_BIND_DEFAULT);
+    g_settings_bind (ma->settings, VIEW_SWAPLOAD_KEY, ma->check_boxes[graph_swapload], "active", G_SETTINGS_BIND_DEFAULT);
+    g_settings_bind (ma->settings, VIEW_LOADAVG_KEY,  ma->check_boxes[graph_loadavg],  "active", G_SETTINGS_BIND_DEFAULT);
+    g_settings_bind (ma->settings, VIEW_DISKLOAD_KEY, ma->check_boxes[graph_diskload], "active", G_SETTINGS_BIND_DEFAULT);
+
+    g_settings_bind (ma->settings, DISKLOAD_NVME_KEY, GET_WIDGET ("nvme_checkbox"), "active", G_SETTINGS_BIND_DEFAULT);
+
+    #undef GET_WIDGET
+
+    properties_set_insensitive (ma);
+
+    gtk_builder_add_callback_symbols (builder,
+                                      "on_cpuload_usr_color_button_color_set",         G_CALLBACK (on_cpuload_usr_color_button_color_set),
+                                      "on_cpuload_sys_color_button_color_set",         G_CALLBACK (on_cpuload_sys_color_button_color_set),
+                                      "on_cpuload_nice_color_button_color_set",        G_CALLBACK (on_cpuload_nice_color_button_color_set),
+                                      "on_cpuload_iowait_color_button_color_set",      G_CALLBACK (on_cpuload_iowait_color_button_color_set),
+                                      "on_cpuload_free_color_button_color_set",        G_CALLBACK (on_cpuload_free_color_button_color_set),
+                                      "on_memload_user_color_button_color_set",        G_CALLBACK (on_memload_user_color_button_color_set),
+                                      "on_memload_shared_color_button_color_set",      G_CALLBACK (on_memload_shared_color_button_color_set),
+                                      "on_memload_buffer_color_button_color_set",      G_CALLBACK (on_memload_buffer_color_button_color_set),
+                                      "on_memload_cached_color_button_color_set",      G_CALLBACK (on_memload_cached_color_button_color_set),
+                                      "on_memload_free_color_button_color_set",        G_CALLBACK (on_memload_free_color_button_color_set),
+                                      "on_netload2_in_color_button_color_set",         G_CALLBACK (on_netload2_in_color_button_color_set),
+                                      "on_netload2_out_color_button_color_set",        G_CALLBACK (on_netload2_out_color_button_color_set),
+                                      "on_netload2_loopback_color_button_color_set",   G_CALLBACK (on_netload2_loopback_color_button_color_set),
+                                      "on_netload2_background_color_button_color_set", G_CALLBACK (on_netload2_background_color_button_color_set),
+                                      "on_netload2_gridline_color_button_color_set",   G_CALLBACK (on_netload2_gridline_color_button_color_set),
+                                      "on_netload2_indicator_color_button_color_set",  G_CALLBACK (on_netload2_indicator_color_button_color_set),
+                                      "on_swapload_used_color_button_color_set",       G_CALLBACK (on_swapload_used_color_button_color_set),
+                                      "on_swapload_free_color_button_color_set",       G_CALLBACK (on_swapload_free_color_button_color_set),
+                                      "on_loadavg_average_color_button_color_set",     G_CALLBACK (on_loadavg_average_color_button_color_set),
+                                      "on_loadavg_background_color_button_color_set",  G_CALLBACK (on_loadavg_background_color_button_color_set),
+                                      "on_loadavg_gridline_color_button_color_set",    G_CALLBACK (on_loadavg_gridline_color_button_color_set),
+                                      "on_diskload_read_color_button_color_set",       G_CALLBACK (on_diskload_read_color_button_color_set),
+                                      "on_diskload_write_color_button_color_set",      G_CALLBACK (on_diskload_write_color_button_color_set),
+                                      "on_diskload_free_color_button_color_set",       G_CALLBACK (on_diskload_free_color_button_color_set),
+                                      "on_properties_dialog_response",                 G_CALLBACK (on_properties_dialog_response),
+                                      "on_graph_cpuload_checkbox_toggled",             G_CALLBACK (on_graph_cpuload_checkbox_toggled),
+                                      "on_graph_memload_checkbox_toggled",             G_CALLBACK (on_graph_memload_checkbox_toggled),
+                                      "on_graph_netload2_checkbox_toggled",            G_CALLBACK (on_graph_netload2_checkbox_toggled),
+                                      "on_graph_swapload_checkbox_toggled",            G_CALLBACK (on_graph_swapload_checkbox_toggled),
+                                      "on_graph_loadavg_checkbox_toggled",             G_CALLBACK (on_graph_loadavg_checkbox_toggled),
+                                      "on_graph_diskload_checkbox_toggled",            G_CALLBACK (on_graph_diskload_checkbox_toggled),
+                                      "on_nvme_checkbox_toggled",                      G_CALLBACK (on_nvme_checkbox_toggled),
+                                      "on_graph_size_spin_button_value_changed",       G_CALLBACK (on_graph_size_spin_button_value_changed),
+                                      "on_speed_spin_button_value_changed",            G_CALLBACK (on_speed_spin_button_value_changed),
+                                      "on_net_threshold1_spin_button_value_changed",   G_CALLBACK (on_net_threshold1_spin_button_value_changed),
+                                      "on_net_threshold2_spin_button_value_changed",   G_CALLBACK (on_net_threshold2_spin_button_value_changed),
+                                      "on_net_threshold3_spin_button_value_changed",   G_CALLBACK (on_net_threshold3_spin_button_value_changed),
+                                      NULL);
+
+    gtk_builder_connect_signals (builder, ma);
+
+    g_object_unref (builder);
+
+    gtk_window_set_screen (GTK_WINDOW (ma->prop_dialog),
+                           gtk_widget_get_screen (GTK_WIDGET (ma->applet)));
+
+    gtk_widget_show_all (ma->prop_dialog);
+
+    gtk_notebook_set_current_page (GTK_NOTEBOOK (ma->notebook),
+                                   ma->last_clicked);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/122.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/122.html new file mode 100644 index 00000000..4a695f33 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/122.html @@ -0,0 +1,1997 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
/*  backend.c
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Netspeed Applet was writen by Jörgen Scheibengruber <mfcn@gmx.de>
+ *
+ *  Mate Netspeed Applet migrated by Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"<--- Include file: "config.h" not found.
+#endif
+
+#if defined(sun) && defined(__SVR4)
+#include <sys/sockio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include <sys/socket.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <ifaddrs.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <netinet/in.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <arpa/inet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glibtop/netlist.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glibtop/netload.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "backend.h"
+
+#ifdef HAVE_IW
+#include <iwlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif /* HAVE_IW */
+
+#ifdef HAVE_NL
+
+#include <errno.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <linux/netlink.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <netlink/genl/genl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <netlink/genl/family.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <netlink/genl/ctrl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <netlink/attr.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <netlink/msg.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "nl80211.h"
+#include "ieee80211.h"
+
+struct nl80211_state {
+    struct nl_sock *sock;
+    int nl80211_id;
+};
+
+#endif /* HAVE_NL */
+
+gboolean
+is_dummy_device (const char* device)
+{
+    glibtop_netload netload;
+    glibtop_get_netload (&netload, device);
+
+    if (netload.if_flags & (1 << GLIBTOP_IF_FLAGS_LOOPBACK))
+        return TRUE;
+
+    /* Skip interfaces without any IPv4/IPv6 address (or
+       those with only a LINK ipv6 addr) However we need to
+       be able to exclude these while still keeping the
+       value so when they get online (with NetworkManager
+       for example) we don't get a suddent peak.  Once we're
+       able to get this, ignoring down interfaces will be
+       possible too.  */
+    if (!(netload.flags & (1 << GLIBTOP_NETLOAD_ADDRESS6)
+        && netload.scope6 != GLIBTOP_IF_IN6_SCOPE_LINK)
+        && !(netload.flags & (1 << GLIBTOP_NETLOAD_ADDRESS)))
+        return TRUE;
+
+    return FALSE;
+}
+
+/* Check for all available devices. This really should be
+ * portable for at least all plattforms using the gnu c lib
+ * TODO: drop it, use glibtop_get_netlist directly / gchar**
+ */
+GList*
+get_available_devices (void)
+{
+    glibtop_netlist buf;
+    char **devices, **dev;
+    GList *device_glist = NULL;
+
+    devices = glibtop_get_netlist (&buf);
+
+    for (dev = devices; *dev; ++dev) {
+        device_glist = g_list_prepend (device_glist, g_strdup (*dev));
+    }
+    device_glist = g_list_sort (device_glist, (GCompareFunc) g_strcmp0);
+
+    g_strfreev (devices);
+
+    return device_glist;
+}
+
+GSList*
+get_ip_address_list (const char *iface_name,
+                     gboolean    ipv4)
+{
+    GSList *list = NULL;
+    struct ifaddrs *ifaces;
+
+    if (getifaddrs (&ifaces) != -1) {
+        int family;
+        char ip[INET6_ADDRSTRLEN];
+
+        family = ipv4 ? AF_INET : AF_INET6;
+        for (struct ifaddrs *iface = ifaces; iface != NULL; iface = iface->ifa_next) {
+            if (iface->ifa_addr == NULL)
+                continue;
+
+            if ((iface->ifa_addr->sa_family == family) &&
+                !g_strcmp0 (iface->ifa_name, iface_name))
+            {
+                unsigned int netmask = 0;
+                void *sinx_addr = NULL;
+
+                if (iface->ifa_addr->sa_family == AF_INET6) {
+                    struct sockaddr_in6 ip6_addr;
+                    struct sockaddr_in6 ip6_network;
+                    uint32_t ip6_netmask = 0;<--- Variable 'ip6_netmask' is assigned a value that is never used.
+                    const char *scope;
+                    int i;
+
+                    memcpy (&ip6_addr, iface->ifa_addr, sizeof (struct sockaddr_in6));
+                    memcpy (&ip6_network, iface->ifa_netmask, sizeof (struct sockaddr_in6));
+
+                    /* get network scope */
+                    if (IN6_IS_ADDR_LINKLOCAL (&ip6_addr.sin6_addr)) {
+                        scope = _("link-local");
+                    } else if (IN6_IS_ADDR_SITELOCAL (&ip6_addr.sin6_addr)) {
+                        scope = _("site-local");
+                    } else if (IN6_IS_ADDR_V4MAPPED (&ip6_addr.sin6_addr)) {
+                        scope = _("v4mapped");
+                    } else if (IN6_IS_ADDR_V4COMPAT (&ip6_addr.sin6_addr)) {
+                        scope = _("v4compat");
+                    } else if (IN6_IS_ADDR_LOOPBACK (&ip6_addr.sin6_addr)) {
+                        scope = _("host");
+                    } else if (IN6_IS_ADDR_UNSPECIFIED (&ip6_addr.sin6_addr)) {
+                        scope = _("unspecified");
+                    } else {
+                        scope = _("global");
+                    }
+
+                    /* get network ip */
+                    sinx_addr = &ip6_addr.sin6_addr;
+                    inet_ntop (iface->ifa_addr->sa_family, sinx_addr, ip, sizeof (ip));
+
+                    /* get network mask length */
+                    for (i = 0; i < 4; i++) {
+                        ip6_netmask = ntohl (((uint32_t*)(&ip6_network.sin6_addr))[i]);
+                        while (ip6_netmask) {
+                            netmask++;
+                            ip6_netmask <<= 1;
+                        }
+                    }
+
+                    list = g_slist_prepend (list,
+                                            g_strdup_printf ("%s/%u (%s)",
+                                                             ip, netmask, scope));
+                } else {
+                    struct sockaddr_in ip4_addr;
+                    struct sockaddr_in ip4_network;
+                    in_addr_t ip4_netmask = 0;
+
+                    memcpy (&ip4_addr, iface->ifa_addr, sizeof (struct sockaddr_in));
+                    memcpy (&ip4_network, iface->ifa_netmask, sizeof (struct sockaddr_in));
+
+                    /* get network ip */
+                    sinx_addr = &ip4_addr.sin_addr;
+                    inet_ntop (iface->ifa_addr->sa_family, sinx_addr, ip, sizeof (ip));
+
+                    /* get network mask length */
+                    ip4_netmask = ntohl (ip4_network.sin_addr.s_addr);
+                    while (ip4_netmask) {
+                        netmask++;
+                        ip4_netmask <<= 1;
+                    }
+
+                    list = g_slist_prepend (list,
+                                            g_strdup_printf ("%s/%u", ip, netmask));
+                }
+            }
+        }
+        if (list != NULL)
+            list = g_slist_sort (list, (GCompareFunc) g_strcmp0);
+        freeifaddrs (ifaces);
+    }
+    return list;
+}
+
+GSList*
+get_ip6_address_list (const char *iface_name)
+{
+    GSList *list = NULL;
+    struct ifaddrs *ifaces;
+
+    if (getifaddrs (&ifaces) != -1) {
+        char ip6[INET6_ADDRSTRLEN];
+
+        for (struct ifaddrs *iface = ifaces; iface != NULL; iface = iface->ifa_next) {
+            if ((iface->ifa_addr == NULL) || (iface->ifa_addr->sa_family != AF_INET6))
+                continue;
+
+            if (!g_strcmp0 (iface->ifa_name, iface_name)) {
+                void *sinx_addr = NULL;
+
+                struct sockaddr_in6 ip6_addr;
+
+                memcpy (&ip6_addr, iface->ifa_addr, sizeof (struct sockaddr_in6));
+
+                /* get network ip */
+                sinx_addr = &ip6_addr.sin6_addr;
+                inet_ntop (iface->ifa_addr->sa_family, sinx_addr, ip6, sizeof (ip6));
+
+                list = g_slist_prepend (list, g_strdup (ip6));
+            }
+        }
+
+        if (list != NULL)
+            list = g_slist_sort (list, (GCompareFunc) g_strcmp0);
+        freeifaddrs (ifaces);
+    }
+    return list;
+}
+
+const gchar*
+get_default_route (void)
+{
+    FILE *fp;
+    static char device[50];
+
+    fp = fopen ("/proc/net/route", "r");
+
+    if (fp == NULL) return NULL;
+
+    while (!feof (fp)) {
+        char buffer[1024];
+        unsigned int ip, gw, flags, ref, use, metric, mask, mtu, window, irtt;
+        int retval;
+        char *rv;<--- Variable 'rv' can be declared as pointer to const
+
+        rv = fgets (buffer, 1024, fp);
+        if (!rv) {
+            break;
+        }
+
+        retval = sscanf (buffer, "%49s %x %x %x %u %u %u %x %u %u %u",
+                         device, &ip, &gw, &flags, &ref, &use, &metric,
+                         &mask, &mtu, &window, &irtt);
+
+        if (retval != 11) continue;
+
+        if (ip == 0 && !is_dummy_device (device)) {
+            fclose (fp);
+            return device;
+        }
+    }
+    fclose (fp);
+    return NULL;
+}
+
+/* Frees a DevInfo struct and all the stuff it contains
+ */
+void
+free_device_info (DevInfo *devinfo)
+{
+    g_free (devinfo->name);
+    g_free (devinfo->essid);
+#ifdef HAVE_NL
+    g_free (devinfo->tx_bitrate);
+    g_free (devinfo->rx_bitrate);
+    g_free (devinfo->channel);
+#endif /* HAVE_NL */
+    g_free (devinfo);
+}
+
+/* TODO:
+   these stuff are not portable because of ioctl
+*/
+static void
+get_ptp_info (DevInfo *devinfo)
+{
+    int fd = -1;
+    struct ifreq request = {};
+
+    g_strlcpy (request.ifr_name, devinfo->name, sizeof request.ifr_name);
+
+    if ((fd = socket (AF_INET, SOCK_STREAM, 0)) < 0)
+        return;
+
+    if (ioctl (fd, SIOCGIFDSTADDR, &request) >= 0) {
+        struct sockaddr_in* addr;
+        addr = (struct sockaddr_in*)&request.ifr_dstaddr;
+        devinfo->ptpip = addr->sin_addr.s_addr;
+    }
+
+    close (fd);
+}
+
+void
+get_device_info (const char  *device,
+                 DevInfo    **info)
+{
+    DevInfo *devinfo;
+    glibtop_netload netload;
+    gboolean ptp = FALSE;
+
+    g_assert (device);
+
+    *info = g_new0 (DevInfo, 1);
+    devinfo = *info;
+
+    devinfo->name = g_strdup (device);
+    devinfo->type = DEV_UNKNOWN;
+
+    glibtop_get_netload (&netload, device);
+
+    devinfo->up = (netload.if_flags & (1L << GLIBTOP_IF_FLAGS_UP) ? TRUE : FALSE);
+    devinfo->running = (netload.if_flags & (1L << GLIBTOP_IF_FLAGS_RUNNING) ? TRUE : FALSE);
+
+    if (netload.if_flags & (1L << GLIBTOP_IF_FLAGS_LOOPBACK)) {
+        devinfo->type = DEV_LO;
+    }
+    else if (netload.if_flags & (1L << GLIBTOP_IF_FLAGS_WIRELESS)) {
+        devinfo->type = DEV_WIRELESS;
+    }
+    else if (netload.if_flags & (1L << GLIBTOP_IF_FLAGS_POINTOPOINT)) {
+        if (g_str_has_prefix (device, "plip")) {
+            devinfo->type = DEV_PLIP;
+        }
+        else if (g_str_has_prefix (device, "sl")) {
+            devinfo->type = DEV_SLIP;
+        }
+        else {
+            devinfo->type = DEV_PPP;
+        }
+        ptp = TRUE;
+    }
+    else {
+        devinfo->type = DEV_ETHERNET;
+    }
+
+    switch (devinfo->type) {
+#if defined (HAVE_NL)
+        case DEV_WIRELESS:
+            get_wireless_info (devinfo);
+            break;
+#endif /* HAVE_NL */
+        case DEV_LO:
+            break;
+#if defined (HAVE_IW)
+        case DEV_WIRELESS:
+            get_wireless_info (devinfo);
+#endif /* HAVE_IW */
+        default:
+            memcpy (devinfo->hwaddr, netload.hwaddress, 8);
+            break;
+    }
+
+    if (devinfo->running) {
+        devinfo->ip = netload.address;
+        devinfo->netmask = netload.subnet;
+#if defined (HAVE_NL)
+        if (devinfo->type != DEV_WIRELESS) {
+            devinfo->tx = netload.bytes_out;
+            devinfo->rx = netload.bytes_in;
+            if (ptp)
+                get_ptp_info (devinfo);
+        }
+#else
+        devinfo->tx = netload.bytes_out;
+        devinfo->rx = netload.bytes_in;
+        if (ptp)
+            get_ptp_info (devinfo);
+#endif /* HAVE_NL */
+    }
+}
+
+gboolean
+compare_device_info (const DevInfo *a,
+                     const DevInfo *b)
+{
+    g_assert (a && b);
+    g_assert (a->name && b->name);
+
+    if (!g_str_equal (a->name, b->name))
+        return TRUE;
+    if (a->ip != b->ip)
+        return TRUE;
+    /* Ignore hwaddr, ptpip and netmask... I think this is ok */
+    if (a->up != b->up)
+        return TRUE;
+    if (a->running != b->running)
+        return TRUE;
+
+    return FALSE;
+}
+#ifdef HAVE_IW
+void
+get_wireless_info (DevInfo *devinfo)
+{
+    int fd;
+    int newqual;
+    wireless_info info = {0};
+
+    fd = iw_sockets_open ();
+
+    if (fd < 0)
+        return;
+
+    if (iw_get_basic_config (fd, devinfo->name, &info.b) < 0)
+        goto out;
+
+    if (info.b.has_essid) {
+        if ((!devinfo->essid) || (strcmp (devinfo->essid, info.b.essid) != 0)) {
+            devinfo->essid = g_strdup (info.b.essid);
+        }
+    } else {
+        devinfo->essid = NULL;
+    }
+
+    if (iw_get_stats (fd, devinfo->name, &info.stats, &info.range, info.has_range) >= 0)
+        info.has_stats = 1;
+
+    if (info.has_stats) {
+        if ((iw_get_range_info (fd, devinfo->name, &info.range) >= 0) && (info.range.max_qual.qual > 0)) {
+            newqual = 0.5f + (100.0f * info.stats.qual.qual) / (1.0f * info.range.max_qual.qual);
+        } else {
+            newqual = info.stats.qual.qual;
+        }
+
+        newqual = CLAMP (newqual, 0, 100);
+        if (devinfo->qual != newqual)<--- Condition 'devinfo->qual!=newqual' is redundant
+            devinfo->qual = newqual;<--- Assignment 'devinfo->qual=newqual'
+
+    } else {
+        devinfo->qual = 0;
+    }
+
+    goto out;
+out:
+    if (fd != -1)
+        close (fd);
+}
+#endif /* HAVE_IW */
+
+#ifdef HAVE_NL
+int iw_debug = 0;
+
+static int
+nl80211_init (struct nl80211_state *state)
+{
+    int err;
+
+    state->sock = nl_socket_alloc ();
+    if (!state->sock) {
+        g_warning ("Failed to allocate netlink socket");
+        return -ENOMEM;
+    }
+
+    if (genl_connect (state->sock)) {
+        g_warning ("Failed to connect to generic netlink");
+        err = -ENOLINK;
+        goto out_handle_destroy;
+    }
+
+    nl_socket_set_buffer_size (state->sock, 8192, 8192);
+
+    /* try to set NETLINK_EXT_ACK to 1, ignoring errors */
+    err = 1;
+    setsockopt (nl_socket_get_fd (state->sock), SOL_NETLINK,
+                NETLINK_EXT_ACK, &err, sizeof (err));
+
+    state->nl80211_id = genl_ctrl_resolve (state->sock, "nl80211");
+    if (state->nl80211_id < 0) {
+        g_warning ("nl80211 not found");
+        err = -ENOENT;
+        goto out_handle_destroy;
+    }
+
+    return 0;
+
+out_handle_destroy:
+    nl_socket_free (state->sock);
+    return err;
+}
+
+static void
+nl80211_cleanup (struct nl80211_state *state)
+{
+    nl_socket_free (state->sock);
+}
+
+static int
+scan_cb (struct nl_msg  *msg,
+         void           *arg)
+{
+    DevInfo *devinfo = (DevInfo*) arg;
+    struct genlmsghdr *gnlh = nlmsg_data (nlmsg_hdr (msg));
+    struct nlattr *tb[NL80211_ATTR_MAX + 1];
+    struct nlattr *bss[NL80211_BSS_MAX + 1];
+    static struct nla_policy bss_policy[NL80211_BSS_MAX + 1] = {
+        [NL80211_BSS_TSF] = { .type = NLA_U64 },
+        [NL80211_BSS_FREQUENCY] = { .type = NLA_U32 },
+        [NL80211_BSS_BSSID] = { },
+        [NL80211_BSS_BEACON_INTERVAL] = { .type = NLA_U16 },
+        [NL80211_BSS_CAPABILITY] = { .type = NLA_U16 },
+        [NL80211_BSS_INFORMATION_ELEMENTS] = { },
+        [NL80211_BSS_SIGNAL_MBM] = { .type = NLA_U32 },
+        [NL80211_BSS_SIGNAL_UNSPEC] = { .type = NLA_U8 },
+        [NL80211_BSS_STATUS] = { .type = NLA_U32 },
+        [NL80211_BSS_SEEN_MS_AGO] = { .type = NLA_U32 },
+        [NL80211_BSS_BEACON_IES] = { },
+    };
+
+    /* Parse and error check. */
+    nla_parse (tb, NL80211_ATTR_MAX, genlmsg_attrdata (gnlh, 0), genlmsg_attrlen (gnlh, 0), NULL);
+    if (!tb[NL80211_ATTR_BSS]) {
+        g_warning ("bss info missing!");
+        return NL_SKIP;
+    }
+    if (nla_parse_nested (bss, NL80211_BSS_MAX, tb[NL80211_ATTR_BSS], bss_policy)) {
+        g_warning ("failed to parse nested attributes!");
+        return NL_SKIP;
+    }
+    if (!bss[NL80211_BSS_BSSID])
+        return NL_SKIP;
+    if (!bss[NL80211_BSS_STATUS])
+        return NL_SKIP;
+
+    if (nla_get_u32 (bss[NL80211_BSS_STATUS]) != NL80211_BSS_STATUS_ASSOCIATED)
+        return NL_SKIP;
+
+    memcpy (devinfo->station_mac_addr, nla_data (bss[NL80211_BSS_BSSID]), ETH_ALEN);
+
+    return NL_SKIP;
+}
+
+static void
+parse_bitrate (struct nlattr *bitrate_attr,
+               char          *buf,
+               int            buflen)
+{
+    int rate = 0;
+    char *pos = buf;
+    struct nlattr *rinfo[NL80211_RATE_INFO_MAX + 1];
+    static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = {
+        [NL80211_RATE_INFO_BITRATE] = { .type = NLA_U16 },
+        [NL80211_RATE_INFO_BITRATE32] = { .type = NLA_U32 },
+        [NL80211_RATE_INFO_MCS] = { .type = NLA_U8 },
+        [NL80211_RATE_INFO_40_MHZ_WIDTH] = { .type = NLA_FLAG },
+        [NL80211_RATE_INFO_SHORT_GI] = { .type = NLA_FLAG },
+    };
+
+    if (nla_parse_nested (rinfo, NL80211_RATE_INFO_MAX,
+                          bitrate_attr, rate_policy)) {
+        g_warning ("failed to parse nested rate attributes!");
+        return;
+    }
+
+    if (rinfo[NL80211_RATE_INFO_BITRATE32])
+        rate = nla_get_u32 (rinfo[NL80211_RATE_INFO_BITRATE32]);
+    else if (rinfo[NL80211_RATE_INFO_BITRATE])
+        rate = nla_get_u16 (rinfo[NL80211_RATE_INFO_BITRATE]);
+    if (rate > 0)
+        pos += snprintf (pos, buflen - (pos - buf),
+                         _("%d.%d MBit/s"), rate / 10, rate % 10);
+    else
+        pos += snprintf (pos, buflen - (pos - buf), _("(unknown)"));
+
+    if (rinfo[NL80211_RATE_INFO_MCS])
+        pos += snprintf (pos, buflen - (pos - buf),
+                         _(" MCS %d"), nla_get_u8 (rinfo[NL80211_RATE_INFO_MCS]));
+    if (rinfo[NL80211_RATE_INFO_VHT_MCS])
+        pos += snprintf (pos, buflen - (pos - buf),
+                         _(" VHT-MCS %d"), nla_get_u8 (rinfo[NL80211_RATE_INFO_VHT_MCS]));
+    if (rinfo[NL80211_RATE_INFO_40_MHZ_WIDTH])
+        pos += snprintf (pos, buflen - (pos - buf), _(" 40MHz"));
+    if (rinfo[NL80211_RATE_INFO_80_MHZ_WIDTH])
+        pos += snprintf (pos, buflen - (pos - buf), _(" 80MHz"));
+    if (rinfo[NL80211_RATE_INFO_80P80_MHZ_WIDTH])
+        pos += snprintf (pos, buflen - (pos - buf), _(" 80P80MHz"));
+    if (rinfo[NL80211_RATE_INFO_160_MHZ_WIDTH])
+        pos += snprintf (pos, buflen - (pos - buf), _(" 160MHz"));
+    if (rinfo[NL80211_RATE_INFO_SHORT_GI])
+        pos += snprintf (pos, buflen - (pos - buf), _(" short GI)"));
+    if (rinfo[NL80211_RATE_INFO_VHT_NSS])
+        pos += snprintf (pos, buflen - (pos - buf),
+                         _(" VHT-NSS %d"), nla_get_u8 (rinfo[NL80211_RATE_INFO_VHT_NSS]));
+    if (rinfo[NL80211_RATE_INFO_HE_MCS])
+        pos += snprintf (pos, buflen - (pos - buf),
+                         _(" HE-MCS %d"), nla_get_u8 (rinfo[NL80211_RATE_INFO_HE_MCS]));
+    if (rinfo[NL80211_RATE_INFO_HE_NSS])
+        pos += snprintf (pos, buflen - (pos - buf),
+                        _(" HE-NSS %d"), nla_get_u8 (rinfo[NL80211_RATE_INFO_HE_NSS]));
+    if (rinfo[NL80211_RATE_INFO_HE_GI])
+        pos += snprintf (pos, buflen - (pos - buf),
+                        _(" HE-GI %d"), nla_get_u8 (rinfo[NL80211_RATE_INFO_HE_GI]));
+    if (rinfo[NL80211_RATE_INFO_HE_DCM])
+        snprintf (pos, buflen - (pos - buf),
+                  _(" HE-DCM %d"), nla_get_u8 (rinfo[NL80211_RATE_INFO_HE_DCM]));
+}
+
+static int
+station_cb (struct nl_msg *msg,
+            void          *arg)
+{
+    DevInfo *devinfo = (DevInfo*) arg;
+    struct nlattr *tb[NL80211_ATTR_MAX + 1];
+    struct genlmsghdr *gnlh = nlmsg_data (nlmsg_hdr (msg));
+    struct nlattr *sinfo[NL80211_STA_INFO_MAX + 1];
+    static struct nla_policy stats_policy[NL80211_STA_INFO_MAX + 1] = {
+        [NL80211_STA_INFO_INACTIVE_TIME] = { .type = NLA_U32 },
+        [NL80211_STA_INFO_RX_BYTES] = { .type = NLA_U32 },
+        [NL80211_STA_INFO_TX_BYTES] = { .type = NLA_U32 },
+        [NL80211_STA_INFO_RX_PACKETS] = { .type = NLA_U32 },
+        [NL80211_STA_INFO_TX_PACKETS] = { .type = NLA_U32 },
+        [NL80211_STA_INFO_SIGNAL] = { .type = NLA_U8 },
+        [NL80211_STA_INFO_RX_BITRATE] = { .type = NLA_NESTED },
+        [NL80211_STA_INFO_TX_BITRATE] = { .type = NLA_NESTED },
+        [NL80211_STA_INFO_LLID] = { .type = NLA_U16 },
+        [NL80211_STA_INFO_PLID] = { .type = NLA_U16 },
+        [NL80211_STA_INFO_PLINK_STATE] = { .type = NLA_U8 },
+    };
+
+    nla_parse (tb, NL80211_ATTR_MAX, genlmsg_attrdata (gnlh, 0),
+               genlmsg_attrlen (gnlh, 0), NULL);
+
+    if (!tb[NL80211_ATTR_STA_INFO]) {
+        g_warning ("sta stats missing!");
+        return NL_SKIP;
+    }
+    if (nla_parse_nested (sinfo, NL80211_STA_INFO_MAX,
+                          tb[NL80211_ATTR_STA_INFO],
+                          stats_policy)) {
+        g_warning ("failed to parse nested attributes!\n");
+        return NL_SKIP;
+    }
+
+    if (sinfo[NL80211_STA_INFO_RX_BYTES] && sinfo[NL80211_STA_INFO_RX_PACKETS]) {
+        guint32 rx_bytes = nla_get_u32 (sinfo[NL80211_STA_INFO_RX_BYTES]);
+        devinfo->rx = (guint64) rx_bytes;
+        g_debug ("RX: %" G_GUINT32_FORMAT " bytes (%" G_GUINT32_FORMAT " packets)",<--- There is an unknown macro here somewhere. Configuration is required. If G_GUINT32_FORMAT is a macro then please configure it.
+                 rx_bytes,
+                 nla_get_u32 (sinfo[NL80211_STA_INFO_RX_PACKETS]));
+    }
+    if (sinfo[NL80211_STA_INFO_TX_BYTES] && sinfo[NL80211_STA_INFO_TX_PACKETS]) {
+        guint32 tx_bytes = nla_get_u32 (sinfo[NL80211_STA_INFO_TX_BYTES]);
+        devinfo->tx = (guint64) tx_bytes;
+        g_debug ("TX: %" G_GUINT32_FORMAT " bytes (%" G_GUINT32_FORMAT " packets)",
+                 tx_bytes,
+                 nla_get_u32 (sinfo[NL80211_STA_INFO_TX_PACKETS]));
+    }
+    if (sinfo[NL80211_STA_INFO_SIGNAL]) {
+        int8_t dBm = (int8_t)nla_get_u8 (sinfo[NL80211_STA_INFO_SIGNAL]);
+        g_debug ("signal: %d dBm", dBm);
+        devinfo->rssi = dBm;
+        devinfo->qual =  CLAMP (2 * ((int)dBm + 100), 1, 100);
+    }
+    if (sinfo[NL80211_STA_INFO_RX_BITRATE]) {
+        char buf[100];
+        parse_bitrate (sinfo[NL80211_STA_INFO_RX_BITRATE], buf, sizeof (buf));
+        g_debug ("rx bitrate: %s", buf);
+        devinfo->rx_bitrate = g_strdup (buf);
+    }
+    if (sinfo[NL80211_STA_INFO_TX_BITRATE]) {
+        char buf[100];
+        parse_bitrate (sinfo[NL80211_STA_INFO_TX_BITRATE], buf, sizeof (buf));
+        g_debug ("tx bitrate: %s", buf);
+        devinfo->tx_bitrate = g_strdup (buf);
+    }
+    if (sinfo[NL80211_STA_INFO_CONNECTED_TIME]) {
+        devinfo->connected_time = nla_get_u32 (sinfo[NL80211_STA_INFO_CONNECTED_TIME]);
+        g_debug ("connected time: %" G_GUINT32_FORMAT " seconds", devinfo->connected_time);
+    }
+
+    return NL_SKIP;
+}
+
+static char *
+channel_width_name (enum nl80211_chan_width width)
+{
+    switch (width) {
+        case NL80211_CHAN_WIDTH_20_NOHT:
+            return _("20 MHz (no HT)");
+        case NL80211_CHAN_WIDTH_20:
+            return _("20 MHz");
+        case NL80211_CHAN_WIDTH_40:
+            return _("40 MHz");
+        case NL80211_CHAN_WIDTH_80:
+            return _("80 MHz");
+        case NL80211_CHAN_WIDTH_80P80:
+            return _("80+80 MHz");
+        case NL80211_CHAN_WIDTH_160:
+            return _("160 MHz");
+        case NL80211_CHAN_WIDTH_5:
+            return _("5 MHz");
+        case NL80211_CHAN_WIDTH_10:
+            return _("10 MHz");
+        default:
+            return _("unknown");
+    }
+}
+
+static int
+ieee80211_frequency_to_channel (int freq)
+{
+    /* see 802.11-2007 17.3.8.3.2 and Annex J */
+    if (freq == 2484)
+        return 14;
+    else if (freq < 2484)
+        return (freq - 2407) / 5;
+    else if (freq >= 4910 && freq <= 4980)
+        return (freq - 4000) / 5;
+    else if (freq <= 45000) /* DMG band lower limit */
+        return (freq - 5000) / 5;
+    else if (freq >= 58320 && freq <= 64800)
+        return (freq - 56160) / 2160;
+    else
+        return 0;
+}
+
+static int
+iface_cb (struct nl_msg *msg,
+          void          *arg)
+{
+    DevInfo *devinfo = (DevInfo*) arg;
+    struct genlmsghdr *gnlh = nlmsg_data (nlmsg_hdr (msg));
+    struct nlattr *tb_msg[NL80211_ATTR_MAX + 1];
+
+    nla_parse (tb_msg, NL80211_ATTR_MAX, genlmsg_attrdata (gnlh, 0),
+               genlmsg_attrlen (gnlh, 0), NULL);
+
+    if (tb_msg[NL80211_ATTR_MAC]) {
+        memcpy (devinfo->hwaddr, nla_data (tb_msg[NL80211_ATTR_MAC]), ETH_ALEN);
+    }
+
+    if (tb_msg[NL80211_ATTR_SSID]) {
+        char buf[G_MAXUINT8];
+        int len = nla_len (tb_msg[NL80211_ATTR_SSID]);
+        memcpy (buf, nla_data (tb_msg[NL80211_ATTR_SSID]), len);
+        buf [len] = '\0';
+        devinfo->essid = g_strescape (buf, NULL);
+        g_debug ("ssid: %s", buf);
+    }
+
+    if (tb_msg[NL80211_ATTR_WIPHY_FREQ]) {
+        uint32_t freq = nla_get_u32 (tb_msg[NL80211_ATTR_WIPHY_FREQ]);
+        char buf[100];
+        char *pos = buf;
+
+        pos += sprintf (pos, _("%d (%d MHz)"),
+                        ieee80211_frequency_to_channel (freq), freq);
+
+        if (tb_msg[NL80211_ATTR_CHANNEL_WIDTH])
+            sprintf (pos, _(", width: %s"),
+                     channel_width_name (nla_get_u32 (tb_msg[NL80211_ATTR_CHANNEL_WIDTH])));
+
+        devinfo->channel = g_strdup (buf);
+    }
+
+    return NL_SKIP;
+}
+
+void
+get_wireless_info (DevInfo *devinfo)
+{
+    struct nl80211_state nlstate = {.sock = NULL, .nl80211_id = -1};
+    int err, ret;
+    struct nl_msg *msg;
+    signed long long devidx = 0;
+
+    err = nl80211_init (&nlstate);
+    if (err || (nlstate.nl80211_id < 0)) {
+        g_warning ("failed to init netlink");
+        return;
+    }
+
+    devidx = if_nametoindex (devinfo->name);
+
+    /* Get MAC, SSID & channel info from interface message */
+    msg = nlmsg_alloc ();
+    if (!msg) {
+        g_warning ("failed to allocate netlink message");
+        goto cleanup;
+    }
+    genlmsg_put (msg, 0, 0, nlstate.nl80211_id, 0, NLM_F_DUMP, NL80211_CMD_GET_INTERFACE, 0);
+    /* Add message attribute, which interface to use */
+    nla_put_u32 (msg, NL80211_ATTR_IFINDEX, devidx);
+    /* Add the callback */
+    nl_socket_modify_cb (nlstate.sock, NL_CB_VALID, NL_CB_CUSTOM, iface_cb, devinfo);
+    /* Send the message */
+    ret = nl_send_auto (nlstate.sock, msg);
+    g_debug ("NL80211_CMD_GET_INTERFACE sent %d bytes to the kernel", ret);
+    /* Retrieve the kernel's answer */
+    ret = nl_recvmsgs_default (nlstate.sock);
+    nlmsg_free (msg);
+    if (ret < 0) {
+        g_warning ("failed to receive netlink message");
+    }
+
+    if (!devinfo->running)
+        goto cleanup;
+
+    /* Get station MAC from scan message */
+    msg = nlmsg_alloc ();
+    if (!msg) {
+        g_warning ("failed to allocate netlink message");
+        goto cleanup;
+    }
+    genlmsg_put (msg, 0, 0, nlstate.nl80211_id, 0, NLM_F_DUMP, NL80211_CMD_GET_SCAN, 0);
+    /* Add message attribute, which interface to use */
+    nla_put_u32 (msg, NL80211_ATTR_IFINDEX, devidx);
+    /* Add the callback */
+    nl_socket_modify_cb (nlstate.sock, NL_CB_VALID, NL_CB_CUSTOM, scan_cb, devinfo);
+    /* Send the message */
+    ret = nl_send_auto (nlstate.sock, msg);
+    g_debug ("NL80211_CMD_GET_SCAN sent %d bytes to the kernel", ret);
+    /* Retrieve the kernel's answer */
+    ret = nl_recvmsgs_default (nlstate.sock);
+    nlmsg_free (msg);
+    if (ret < 0) {
+        g_warning ("failed to receive netlink message");
+        goto cleanup;
+    }
+
+    if (!devinfo->running)
+        goto cleanup;
+
+    /* Get in/out bitrate/rate/total, signal quality from station message */
+    msg = nlmsg_alloc ();
+    if (!msg) {
+        g_warning ("failed to allocate netlink message");
+        goto cleanup;
+    }
+    genlmsg_put (msg, 0, 0, nlstate.nl80211_id, 0, NLM_F_DUMP, NL80211_CMD_GET_STATION, 0);
+    /* Add message attribute, which interface to use */
+    nla_put (msg, NL80211_ATTR_MAC, ETH_ALEN, devinfo->station_mac_addr);
+    nla_put_u32 (msg, NL80211_ATTR_IFINDEX, devidx);
+    /* Add the callback */
+    nl_socket_modify_cb (nlstate.sock, NL_CB_VALID, NL_CB_CUSTOM, station_cb, devinfo);
+    /* Send the message */
+    ret = nl_send_auto (nlstate.sock, msg);
+    g_debug ("NL80211_CMD_GET_STATION sent %d bytes to the kernel", ret);
+    /* Retrieve the kernel's answer */
+    ret = nl_recvmsgs_default (nlstate.sock);
+    nlmsg_free (msg);
+    if (ret < 0) {
+        g_warning ("failed to receive netlink message");
+    }
+
+ cleanup:
+    nl80211_cleanup (&nlstate);
+}
+#endif /* HAVE_NL */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/123.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/123.html new file mode 100644 index 00000000..e40b30ba --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/123.html @@ -0,0 +1,457 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
/*  backend.h
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Netspeed Applet was writen by Jörgen Scheibengruber <mfcn@gmx.de>
+ */
+
+#ifndef _BACKEND_H
+#define _BACKEND_H
+
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <ctype.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/socket.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <netinet/in.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <arpa/inet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <net/if.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/ioctl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glibtop/netload.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+/* copied from <linux/wireless.h> */
+#define SIOCGIWNAME     0x8B01          /* get name == wireless protocol */
+#define SIOCGIWENCODE	0x8B2B		    /* get encoding token & mode */
+
+#define ETH_ALEN        6
+#define ETH_LEN         20
+#define MAX_FORMAT_SIZE 15
+
+/* Different types of interfaces */
+typedef enum {
+    DEV_LO,
+    DEV_ETHERNET,
+    DEV_WIRELESS,
+    DEV_PPP,
+    DEV_PLIP,
+    DEV_SLIP,
+    DEV_UNKNOWN	// this has to be the last one
+} DevType;
+
+/* Some information about the selected network device
+ */
+typedef struct {
+    DevType        type;
+    char          *name;
+    guint32        ip;
+    guint32        netmask;
+    guint32        ptpip;
+    guint8         hwaddr [8]; /* EUI-48 or EUI-64 */
+    char          *essid;
+    gboolean       up;
+    gboolean       running;
+    guint64        tx;
+    guint64        rx;
+    int            qual;
+    char           rx_rate [MAX_FORMAT_SIZE];
+    char           tx_rate [MAX_FORMAT_SIZE];
+    char           sum_rate [MAX_FORMAT_SIZE];
+#ifdef HAVE_NL
+    int            rssi;
+    char          *tx_bitrate;
+    char          *rx_bitrate;
+    char          *channel;
+    guint32        connected_time;
+    unsigned char  station_mac_addr [ETH_ALEN];
+#endif /* HAVE_NL */
+} DevInfo;
+
+GList*
+get_available_devices (void);
+
+const gchar*
+get_default_route (void);
+
+gboolean
+is_dummy_device (const char* device);
+
+void
+free_device_info (DevInfo *devinfo);
+
+void
+get_device_info (const char *device, DevInfo **info);
+
+gboolean
+compare_device_info (const DevInfo *a, const DevInfo *b);
+
+void
+get_wireless_info (DevInfo *devinfo);
+
+GSList*
+get_ip_address_list (const char *ifa_name, gboolean ipv4);
+
+GSList*
+get_ip6_address_list (const char *ifa_name);
+
+#endif /* _BACKEND_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/124.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/124.html new file mode 100644 index 00000000..fb31c4fc --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/124.html @@ -0,0 +1,13329 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+1545
+1546
+1547
+1548
+1549
+1550
+1551
+1552
+1553
+1554
+1555
+1556
+1557
+1558
+1559
+1560
+1561
+1562
+1563
+1564
+1565
+1566
+1567
+1568
+1569
+1570
+1571
+1572
+1573
+1574
+1575
+1576
+1577
+1578
+1579
+1580
+1581
+1582
+1583
+1584
+1585
+1586
+1587
+1588
+1589
+1590
+1591
+1592
+1593
+1594
+1595
+1596
+1597
+1598
+1599
+1600
+1601
+1602
+1603
+1604
+1605
+1606
+1607
+1608
+1609
+1610
+1611
+1612
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+1631
+1632
+1633
+1634
+1635
+1636
+1637
+1638
+1639
+1640
+1641
+1642
+1643
+1644
+1645
+1646
+1647
+1648
+1649
+1650
+1651
+1652
+1653
+1654
+1655
+1656
+1657
+1658
+1659
+1660
+1661
+1662
+1663
+1664
+1665
+1666
+1667
+1668
+1669
+1670
+1671
+1672
+1673
+1674
+1675
+1676
+1677
+1678
+1679
+1680
+1681
+1682
+1683
+1684
+1685
+1686
+1687
+1688
+1689
+1690
+1691
+1692
+1693
+1694
+1695
+1696
+1697
+1698
+1699
+1700
+1701
+1702
+1703
+1704
+1705
+1706
+1707
+1708
+1709
+1710
+1711
+1712
+1713
+1714
+1715
+1716
+1717
+1718
+1719
+1720
+1721
+1722
+1723
+1724
+1725
+1726
+1727
+1728
+1729
+1730
+1731
+1732
+1733
+1734
+1735
+1736
+1737
+1738
+1739
+1740
+1741
+1742
+1743
+1744
+1745
+1746
+1747
+1748
+1749
+1750
+1751
+1752
+1753
+1754
+1755
+1756
+1757
+1758
+1759
+1760
+1761
+1762
+1763
+1764
+1765
+1766
+1767
+1768
+1769
+1770
+1771
+1772
+1773
+1774
+1775
+1776
+1777
+1778
+1779
+1780
+1781
+1782
+1783
+1784
+1785
+1786
+1787
+1788
+1789
+1790
+1791
+1792
+1793
+1794
+1795
+1796
+1797
+1798
+1799
+1800
+1801
+1802
+1803
+1804
+1805
+1806
+1807
+1808
+1809
+1810
+1811
+1812
+1813
+1814
+1815
+1816
+1817
+1818
+1819
+1820
+1821
+1822
+1823
+1824
+1825
+1826
+1827
+1828
+1829
+1830
+1831
+1832
+1833
+1834
+1835
+1836
+1837
+1838
+1839
+1840
+1841
+1842
+1843
+1844
+1845
+1846
+1847
+1848
+1849
+1850
+1851
+1852
+1853
+1854
+1855
+1856
+1857
+1858
+1859
+1860
+1861
+1862
+1863
+1864
+1865
+1866
+1867
+1868
+1869
+1870
+1871
+1872
+1873
+1874
+1875
+1876
+1877
+1878
+1879
+1880
+1881
+1882
+1883
+1884
+1885
+1886
+1887
+1888
+1889
+1890
+1891
+1892
+1893
+1894
+1895
+1896
+1897
+1898
+1899
+1900
+1901
+1902
+1903
+1904
+1905
+1906
+1907
+1908
+1909
+1910
+1911
+1912
+1913
+1914
+1915
+1916
+1917
+1918
+1919
+1920
+1921
+1922
+1923
+1924
+1925
+1926
+1927
+1928
+1929
+1930
+1931
+1932
+1933
+1934
+1935
+1936
+1937
+1938
+1939
+1940
+1941
+1942
+1943
+1944
+1945
+1946
+1947
+1948
+1949
+1950
+1951
+1952
+1953
+1954
+1955
+1956
+1957
+1958
+1959
+1960
+1961
+1962
+1963
+1964
+1965
+1966
+1967
+1968
+1969
+1970
+1971
+1972
+1973
+1974
+1975
+1976
+1977
+1978
+1979
+1980
+1981
+1982
+1983
+1984
+1985
+1986
+1987
+1988
+1989
+1990
+1991
+1992
+1993
+1994
+1995
+1996
+1997
+1998
+1999
+2000
+2001
+2002
+2003
+2004
+2005
+2006
+2007
+2008
+2009
+2010
+2011
+2012
+2013
+2014
+2015
+2016
+2017
+2018
+2019
+2020
+2021
+2022
+2023
+2024
+2025
+2026
+2027
+2028
+2029
+2030
+2031
+2032
+2033
+2034
+2035
+2036
+2037
+2038
+2039
+2040
+2041
+2042
+2043
+2044
+2045
+2046
+2047
+2048
+2049
+2050
+2051
+2052
+2053
+2054
+2055
+2056
+2057
+2058
+2059
+2060
+2061
+2062
+2063
+2064
+2065
+2066
+2067
+2068
+2069
+2070
+2071
+2072
+2073
+2074
+2075
+2076
+2077
+2078
+2079
+2080
+2081
+2082
+2083
+2084
+2085
+2086
+2087
+2088
+2089
+2090
+2091
+2092
+2093
+2094
+2095
+2096
+2097
+2098
+2099
+2100
+2101
+2102
+2103
+2104
+2105
+2106
+2107
+2108
+2109
+2110
+2111
+2112
+2113
+2114
+2115
+2116
+2117
+2118
+2119
+2120
+2121
+2122
+2123
+2124
+2125
+2126
+2127
+2128
+2129
+2130
+2131
+2132
+2133
+2134
+2135
+2136
+2137
+2138
+2139
+2140
+2141
+2142
+2143
+2144
+2145
+2146
+2147
+2148
+2149
+2150
+2151
+2152
+2153
+2154
+2155
+2156
+2157
+2158
+2159
+2160
+2161
+2162
+2163
+2164
+2165
+2166
+2167
+2168
+2169
+2170
+2171
+2172
+2173
+2174
+2175
+2176
+2177
+2178
+2179
+2180
+2181
+2182
+2183
+2184
+2185
+2186
+2187
+2188
+2189
+2190
+2191
+2192
+2193
+2194
+2195
+2196
+2197
+2198
+2199
+2200
+2201
+2202
+2203
+2204
+2205
+2206
+2207
+2208
+2209
+2210
+2211
+2212
+2213
+2214
+2215
+2216
+2217
+2218
+2219
+2220
+2221
+2222
+2223
+2224
+2225
+2226
+2227
+2228
+2229
+2230
+2231
+2232
+2233
+2234
+2235
+2236
+2237
+2238
+2239
+2240
+2241
+2242
+2243
+2244
+2245
+2246
+2247
+2248
+2249
+2250
+2251
+2252
+2253
+2254
+2255
+2256
+2257
+2258
+2259
+2260
+2261
+2262
+2263
+2264
+2265
+2266
+2267
+2268
+2269
+2270
+2271
+2272
+2273
+2274
+2275
+2276
+2277
+2278
+2279
+2280
+2281
+2282
+2283
+2284
+2285
+2286
+2287
+2288
+2289
+2290
+2291
+2292
+2293
+2294
+2295
+2296
+2297
+2298
+2299
+2300
+2301
+2302
+2303
+2304
+2305
+2306
+2307
+2308
+2309
+2310
+2311
+2312
+2313
+2314
+2315
+2316
+2317
+2318
+2319
+2320
+2321
+2322
+2323
+2324
+2325
+2326
+2327
+2328
+2329
+2330
+2331
+2332
+2333
+2334
+2335
+2336
+2337
+2338
+2339
+2340
+2341
+2342
+2343
+2344
+2345
+2346
+2347
+2348
+2349
+2350
+2351
+2352
+2353
+2354
+2355
+2356
+2357
+2358
+2359
+2360
+2361
+2362
+2363
+2364
+2365
+2366
+2367
+2368
+2369
+2370
+2371
+2372
+2373
+2374
+2375
+2376
+2377
+2378
+2379
+2380
+2381
+2382
+2383
+2384
+2385
+2386
+2387
+2388
+2389
+2390
+2391
+2392
+2393
+2394
+2395
+2396
+2397
+2398
+2399
+2400
+2401
+2402
+2403
+2404
+2405
+2406
+2407
+2408
+2409
+2410
+2411
+2412
+2413
+2414
+2415
+2416
+2417
+2418
+2419
+2420
+2421
+2422
+2423
+2424
+2425
+2426
+2427
+2428
+2429
+2430
+2431
+2432
+2433
+2434
+2435
+2436
+2437
+2438
+2439
+2440
+2441
+2442
+2443
+2444
+2445
+2446
+2447
+2448
+2449
+2450
+2451
+2452
+2453
+2454
+2455
+2456
+2457
+2458
+2459
+2460
+2461
+2462
+2463
+2464
+2465
+2466
+2467
+2468
+2469
+2470
+2471
+2472
+2473
+2474
+2475
+2476
+2477
+2478
+2479
+2480
+2481
+2482
+2483
+2484
+2485
+2486
+2487
+2488
+2489
+2490
+2491
+2492
+2493
+2494
+2495
+2496
+2497
+2498
+2499
+2500
+2501
+2502
+2503
+2504
+2505
+2506
+2507
+2508
+2509
+2510
+2511
+2512
+2513
+2514
+2515
+2516
+2517
+2518
+2519
+2520
+2521
+2522
+2523
+2524
+2525
+2526
+2527
+2528
+2529
+2530
+2531
+2532
+2533
+2534
+2535
+2536
+2537
+2538
+2539
+2540
+2541
+2542
+2543
+2544
+2545
+2546
+2547
+2548
+2549
+2550
+2551
+2552
+2553
+2554
+2555
+2556
+2557
+2558
+2559
+2560
+2561
+2562
+2563
+2564
+2565
+2566
+2567
+2568
+2569
+2570
+2571
+2572
+2573
+2574
+2575
+2576
+2577
+2578
+2579
+2580
+2581
+2582
+2583
+2584
+2585
+2586
+2587
+2588
+2589
+2590
+2591
+2592
+2593
+2594
+2595
+2596
+2597
+2598
+2599
+2600
+2601
+2602
+2603
+2604
+2605
+2606
+2607
+2608
+2609
+2610
+2611
+2612
+2613
+2614
+2615
+2616
+2617
+2618
+2619
+2620
+2621
+2622
+2623
+2624
+2625
+2626
+2627
+2628
+2629
+2630
+2631
+2632
+2633
+2634
+2635
+2636
+2637
+2638
+2639
+2640
+2641
+2642
+2643
+2644
+2645
+2646
+2647
+2648
+2649
+2650
+2651
+2652
+2653
+2654
+2655
+2656
+2657
+2658
+2659
+2660
+2661
+2662
+2663
+2664
+2665
+2666
+2667
+2668
+2669
+2670
+2671
+2672
+2673
+2674
+2675
+2676
+2677
+2678
+2679
+2680
+2681
+2682
+2683
+2684
+2685
+2686
+2687
+2688
+2689
+2690
+2691
+2692
+2693
+2694
+2695
+2696
+2697
+2698
+2699
+2700
+2701
+2702
+2703
+2704
+2705
+2706
+2707
+2708
+2709
+2710
+2711
+2712
+2713
+2714
+2715
+2716
+2717
+2718
+2719
+2720
+2721
+2722
+2723
+2724
+2725
+2726
+2727
+2728
+2729
+2730
+2731
+2732
+2733
+2734
+2735
+2736
+2737
+2738
+2739
+2740
+2741
+2742
+2743
+2744
+2745
+2746
+2747
+2748
+2749
+2750
+2751
+2752
+2753
+2754
+2755
+2756
+2757
+2758
+2759
+2760
+2761
+2762
+2763
+2764
+2765
+2766
+2767
+2768
+2769
+2770
+2771
+2772
+2773
+2774
+2775
+2776
+2777
+2778
+2779
+2780
+2781
+2782
+2783
+2784
+2785
+2786
+2787
+2788
+2789
+2790
+2791
+2792
+2793
+2794
+2795
+2796
+2797
+2798
+2799
+2800
+2801
+2802
+2803
+2804
+2805
+2806
+2807
+2808
+2809
+2810
+2811
+2812
+2813
+2814
+2815
+2816
+2817
+2818
+2819
+2820
+2821
+2822
+2823
+2824
+2825
+2826
+2827
+2828
+2829
+2830
+2831
+2832
+2833
+2834
+2835
+2836
+2837
+2838
+2839
+2840
+2841
+2842
+2843
+2844
+2845
+2846
+2847
+2848
+2849
+2850
+2851
+2852
+2853
+2854
+2855
+2856
+2857
+2858
+2859
+2860
+2861
+2862
+2863
+2864
+2865
+2866
+2867
+2868
+2869
+2870
+2871
+2872
+2873
+2874
+2875
+2876
+2877
+2878
+2879
+2880
+2881
+2882
+2883
+2884
+2885
+2886
+2887
+2888
+2889
+2890
+2891
+2892
+2893
+2894
+2895
+2896
+2897
+2898
+2899
+2900
+2901
+2902
+2903
+2904
+2905
+2906
+2907
+2908
+2909
+2910
+2911
+2912
+2913
+2914
+2915
+2916
+2917
+2918
+2919
+2920
+2921
+2922
+2923
+2924
+2925
+2926
+2927
+2928
+2929
+2930
+2931
+2932
+2933
+2934
+2935
+2936
+2937
+2938
+2939
+2940
+2941
+2942
+2943
+2944
+2945
+2946
+2947
+2948
+2949
+2950
+2951
+2952
+2953
+2954
+2955
+2956
+2957
+2958
+2959
+2960
+2961
+2962
+2963
+2964
+2965
+2966
+2967
+2968
+2969
+2970
+2971
+2972
+2973
+2974
+2975
+2976
+2977
+2978
+2979
+2980
+2981
+2982
+2983
+2984
+2985
+2986
+2987
+2988
+2989
+2990
+2991
+2992
+2993
+2994
+2995
+2996
+2997
+2998
+2999
+3000
+3001
+3002
+3003
+3004
+3005
+3006
+3007
+3008
+3009
+3010
+3011
+3012
+3013
+3014
+3015
+3016
+3017
+3018
+3019
+3020
+3021
+3022
+3023
+3024
+3025
+3026
+3027
+3028
+3029
+3030
+3031
+3032
+3033
+3034
+3035
+3036
+3037
+3038
+3039
+3040
+3041
+3042
+3043
+3044
+3045
+3046
+3047
+3048
+3049
+3050
+3051
+3052
+3053
+3054
+3055
+3056
+3057
+3058
+3059
+3060
+3061
+3062
+3063
+3064
+3065
+3066
+3067
+3068
+3069
+3070
+3071
+3072
+3073
+3074
+3075
+3076
+3077
+3078
+3079
+3080
+3081
+3082
+3083
+3084
+3085
+3086
+3087
+3088
+3089
+3090
+3091
+3092
+3093
+3094
+3095
+3096
+3097
+3098
+3099
+3100
+3101
+3102
+3103
+3104
+3105
+3106
+3107
+3108
+3109
+3110
+3111
+3112
+3113
+3114
+3115
+3116
+3117
+3118
+3119
+3120
+3121
+3122
+3123
+3124
+3125
+3126
+3127
+3128
+3129
+3130
+3131
+3132
+3133
+3134
+3135
+3136
+3137
+3138
+3139
+3140
+3141
+3142
+3143
+3144
+3145
+3146
+3147
+3148
+3149
+3150
+3151
+3152
+3153
+3154
+3155
+3156
+3157
+3158
+3159
+3160
+3161
+3162
+3163
+3164
+3165
+3166
+3167
+3168
+3169
+3170
+3171
+3172
+3173
+3174
+3175
+3176
+3177
+3178
+3179
+3180
+3181
+3182
+3183
+3184
+3185
+3186
+3187
+3188
+3189
+3190
+3191
+3192
+3193
+3194
+3195
+3196
+3197
+3198
+3199
+3200
+3201
+3202
+3203
+3204
+3205
+3206
+3207
+3208
+3209
+3210
+3211
+3212
+3213
+3214
+3215
+3216
+3217
+3218
+3219
+3220
+3221
+3222
+3223
+3224
+3225
+3226
+3227
+3228
+3229
+3230
+3231
+3232
+3233
+3234
+3235
+3236
+3237
+3238
+3239
+3240
+3241
+3242
+3243
+3244
+3245
+3246
+3247
+3248
+3249
+3250
+3251
+3252
+3253
+3254
+3255
+3256
+3257
+3258
+3259
+3260
+3261
+3262
+3263
+3264
+3265
+3266
+3267
+3268
+3269
+3270
+3271
+3272
+3273
+3274
+3275
+3276
+3277
+3278
+3279
+3280
+3281
+3282
+3283
+3284
+3285
+3286
+3287
+3288
+3289
+3290
+3291
+3292
+3293
+3294
+3295
+3296
+3297
+3298
+3299
+3300
+3301
+3302
+3303
+3304
+3305
+3306
+3307
+3308
+3309
+3310
+3311
+3312
+3313
+3314
+3315
+3316
+3317
+3318
+3319
+3320
+3321
+3322
+3323
+3324
+3325
+3326
+3327
+3328
+3329
+3330
+3331
+3332
+3333
+3334
+3335
+3336
+3337
+3338
+3339
+3340
+3341
+3342
+3343
+3344
+3345
+3346
+3347
+3348
+3349
+3350
+3351
+3352
+3353
+3354
+3355
+3356
+3357
+3358
+3359
+3360
+3361
+3362
+3363
+3364
+3365
+3366
+3367
+3368
+3369
+3370
+3371
+3372
+3373
+3374
+3375
+3376
+3377
+3378
+3379
+3380
+3381
+3382
+3383
+3384
+3385
+3386
+3387
+3388
+3389
+3390
+3391
+3392
+3393
+3394
+3395
+3396
+3397
+3398
+3399
+3400
+3401
+3402
+3403
+3404
+3405
+3406
+3407
+3408
+3409
+3410
+3411
+3412
+3413
+3414
+3415
+3416
+3417
+3418
+3419
+3420
+3421
+3422
+3423
+3424
+3425
+3426
+3427
+3428
+3429
+3430
+3431
+3432
+3433
+3434
+3435
+3436
+3437
+3438
+3439
+3440
+3441
+3442
+3443
+3444
+3445
+3446
+3447
+3448
+3449
+3450
+3451
+3452
+3453
+3454
+3455
+3456
+3457
+3458
+3459
+3460
+3461
+3462
+3463
+3464
+3465
+3466
+3467
+3468
+3469
+3470
+3471
+3472
+3473
+3474
+3475
+3476
+3477
+3478
+3479
+3480
+3481
+3482
+3483
+3484
+3485
+3486
+3487
+3488
+3489
+3490
+3491
+3492
+3493
+3494
+3495
+3496
+3497
+3498
+3499
+3500
+3501
+3502
+3503
+3504
+3505
+3506
+3507
+3508
+3509
+3510
+3511
+3512
+3513
+3514
+3515
+3516
+3517
+3518
+3519
+3520
+3521
+3522
+3523
+3524
+3525
+3526
+3527
+3528
+3529
+3530
+3531
+3532
+3533
+3534
+3535
+3536
+3537
+3538
+3539
+3540
+3541
+3542
+3543
+3544
+3545
+3546
+3547
+3548
+3549
+3550
+3551
+3552
+3553
+3554
+3555
+3556
+3557
+3558
+3559
+3560
+3561
+3562
+3563
+3564
+3565
+3566
+3567
+3568
+3569
+3570
+3571
+3572
+3573
+3574
+3575
+3576
+3577
+3578
+3579
+3580
+3581
+3582
+3583
+3584
+3585
+3586
+3587
+3588
+3589
+3590
+3591
+3592
+3593
+3594
+3595
+3596
+3597
+3598
+3599
+3600
+3601
+3602
+3603
+3604
+3605
+3606
+3607
+3608
+3609
+3610
+3611
+3612
+3613
+3614
+3615
+3616
+3617
+3618
+3619
+3620
+3621
+3622
+3623
+3624
+3625
+3626
+3627
+3628
+3629
+3630
+3631
+3632
+3633
+3634
+3635
+3636
+3637
+3638
+3639
+3640
+3641
+3642
+3643
+3644
+3645
+3646
+3647
+3648
+3649
+3650
+3651
+3652
+3653
+3654
+3655
+3656
+3657
+3658
+3659
+3660
+3661
+3662
+3663
+3664
+3665
+3666
+3667
+3668
+3669
+3670
+3671
+3672
+3673
+3674
+3675
+3676
+3677
+3678
+3679
+3680
+3681
+3682
+3683
+3684
+3685
+3686
+3687
+3688
+3689
+3690
+3691
+3692
+3693
+3694
+3695
+3696
+3697
+3698
+3699
+3700
+3701
+3702
+3703
+3704
+3705
+3706
+3707
+3708
+3709
+3710
+3711
+3712
+3713
+3714
+3715
+3716
+3717
+3718
+3719
+3720
+3721
+3722
+3723
+3724
+3725
+3726
+3727
+3728
+3729
+3730
+3731
+3732
+3733
+3734
+3735
+3736
+3737
+3738
+3739
+3740
+3741
+3742
+3743
+3744
+3745
+3746
+3747
+3748
+3749
+3750
+3751
+3752
+3753
+3754
+3755
+3756
+3757
+3758
+3759
+3760
+3761
+3762
+3763
+3764
+3765
+3766
+3767
+3768
+3769
+3770
+3771
+3772
+3773
+3774
+3775
+3776
+3777
+3778
+3779
+3780
+3781
+3782
+3783
+3784
+3785
+3786
+3787
+3788
+3789
+3790
+3791
+3792
+3793
+3794
+3795
+3796
+3797
+3798
+3799
+3800
+3801
+3802
+3803
+3804
+3805
+3806
+3807
+3808
+3809
+3810
+3811
+3812
+3813
+3814
+3815
+3816
+3817
+3818
+3819
+3820
+3821
+3822
+3823
+3824
+3825
+3826
+3827
+3828
+3829
+3830
+3831
+3832
+3833
+3834
+3835
+3836
+3837
+3838
+3839
+3840
+3841
+3842
+3843
+3844
+3845
+3846
+3847
+3848
+3849
+3850
+3851
+3852
+3853
+3854
+3855
+3856
+3857
+3858
+3859
+3860
+3861
+3862
+3863
+3864
+3865
+3866
+3867
+3868
+3869
+3870
+3871
+3872
+3873
+3874
+3875
+3876
+3877
+3878
+3879
+3880
+3881
+3882
+3883
+3884
+3885
+3886
+3887
+3888
+3889
+3890
+3891
+3892
+3893
+3894
+3895
+3896
+3897
+3898
+3899
+3900
+3901
+3902
+3903
+3904
+3905
+3906
+3907
+3908
+3909
+3910
+3911
+3912
+3913
+3914
+3915
+3916
+3917
+3918
+3919
+3920
+3921
+3922
+3923
+3924
+3925
+3926
+3927
+3928
+3929
+3930
+3931
+3932
+3933
+3934
+3935
+3936
+3937
+3938
+3939
+3940
+3941
+3942
+3943
+3944
+3945
+3946
+3947
+3948
+3949
+3950
+3951
+3952
+3953
+3954
+3955
+3956
+3957
+3958
+3959
+3960
+3961
+3962
+3963
+3964
+3965
+3966
+3967
+3968
+3969
+3970
+3971
+3972
+3973
+3974
+3975
+3976
+3977
+3978
+3979
+3980
+3981
+3982
+3983
+3984
+3985
+3986
+3987
+3988
+3989
+3990
+3991
+3992
+3993
+3994
+3995
+3996
+3997
+3998
+3999
+4000
+4001
+4002
+4003
+4004
+4005
+4006
+4007
+4008
+4009
+4010
+4011
+4012
+4013
+4014
+4015
+4016
+4017
+4018
+4019
+4020
+4021
+4022
+4023
+4024
+4025
+4026
+4027
+4028
+4029
+4030
+4031
+4032
+4033
+4034
+4035
+4036
+4037
+4038
+4039
+4040
+4041
+4042
+4043
+4044
+4045
+4046
+4047
+4048
+4049
+4050
+4051
+4052
+4053
+4054
+4055
+4056
+4057
+4058
+4059
+4060
+4061
+4062
+4063
+4064
+4065
+4066
+4067
+4068
+4069
+4070
+4071
+4072
+4073
+4074
+4075
+4076
+4077
+4078
+4079
+4080
+4081
+4082
+4083
+4084
+4085
+4086
+4087
+4088
+4089
+4090
+4091
+4092
+4093
+4094
+4095
+4096
+4097
+4098
+4099
+4100
+4101
+4102
+4103
+4104
+4105
+4106
+4107
+4108
+4109
+4110
+4111
+4112
+4113
+4114
+4115
+4116
+4117
+4118
+4119
+4120
+4121
+4122
+4123
+4124
+4125
+4126
+4127
+4128
+4129
+4130
+4131
+4132
+4133
+4134
+4135
+4136
+4137
+4138
+4139
+4140
+4141
+4142
+4143
+4144
+4145
+4146
+4147
+4148
+4149
+4150
+4151
+4152
+4153
+4154
+4155
+4156
+4157
+4158
+4159
+4160
+4161
+4162
+4163
+4164
+4165
+4166
+4167
+4168
+4169
+4170
+4171
+4172
+4173
+4174
+4175
+4176
+4177
+4178
+4179
+4180
+4181
+4182
+4183
+4184
+4185
+4186
+4187
+4188
+4189
+4190
+4191
+4192
+4193
+4194
+4195
+4196
+4197
+4198
+4199
+4200
+4201
+4202
+4203
+4204
+4205
+4206
+4207
+4208
+4209
+4210
+4211
+4212
+4213
+4214
+4215
+4216
+4217
+4218
+4219
+4220
+4221
+4222
+4223
+4224
+4225
+4226
+4227
+4228
+4229
+4230
+4231
+4232
+4233
+4234
+4235
+4236
+4237
+4238
+4239
+4240
+4241
+4242
+4243
+4244
+4245
+4246
+4247
+4248
+4249
+4250
+4251
+4252
+4253
+4254
+4255
+4256
+4257
+4258
+4259
+4260
+4261
+4262
+4263
+4264
+4265
+4266
+4267
+4268
+4269
+4270
+4271
+4272
+4273
+4274
+4275
+4276
+4277
+4278
+4279
+4280
+4281
+4282
+4283
+4284
+4285
+4286
+4287
+4288
+4289
+4290
+4291
+4292
+4293
+4294
+4295
+4296
+4297
+4298
+4299
+4300
+4301
+4302
+4303
+4304
+4305
+4306
+4307
+4308
+4309
+4310
+4311
+4312
+4313
+4314
+4315
+4316
+4317
+4318
+4319
+4320
+4321
+4322
+4323
+4324
+4325
+4326
+4327
+4328
+4329
+4330
+4331
+4332
+4333
+4334
+4335
+4336
+4337
+4338
+4339
+4340
+4341
+4342
+4343
+4344
+4345
+4346
+4347
+4348
+4349
+4350
+4351
+4352
+4353
+4354
+4355
+4356
+4357
+4358
+4359
+4360
+4361
+4362
+4363
+4364
+4365
+4366
+4367
+4368
+4369
+4370
+4371
+4372
+4373
+4374
+4375
+4376
+4377
+4378
+4379
+4380
+4381
+4382
+4383
+4384
+4385
+4386
+4387
+4388
+4389
+4390
+4391
+4392
+4393
+4394
+4395
+4396
+4397
+4398
+4399
+4400
+4401
+4402
+4403
+4404
+4405
+4406
+4407
+4408
+4409
+4410
+4411
+4412
+4413
+4414
+4415
+4416
+4417
+4418
+4419
+4420
+4421
+4422
+4423
+4424
+4425
+4426
+4427
+4428
+4429
+4430
+4431
+4432
+4433
+4434
+4435
+4436
+4437
+4438
+4439
+4440
+4441
+4442
+4443
+4444
+4445
+4446
+4447
+4448
+4449
+4450
+4451
+4452
+4453
+4454
+4455
+4456
+4457
+4458
+4459
+4460
+4461
+4462
+4463
+4464
+4465
+4466
+4467
+4468
+4469
+4470
+4471
+4472
+4473
+4474
+4475
+4476
+4477
+4478
+4479
+4480
+4481
+4482
+4483
+4484
+4485
+4486
+4487
+4488
+4489
+4490
+4491
+4492
+4493
+4494
+4495
+4496
+4497
+4498
+4499
+4500
+4501
+4502
+4503
+4504
+4505
+4506
+4507
+4508
+4509
+4510
+4511
+4512
+4513
+4514
+4515
+4516
+4517
+4518
+4519
+4520
+4521
+4522
+4523
+4524
+4525
+4526
+4527
+4528
+4529
+4530
+4531
+4532
+4533
+4534
+4535
+4536
+4537
+4538
+4539
+4540
+4541
+4542
+4543
+4544
+4545
+4546
+4547
+4548
+4549
+4550
+4551
+4552
+4553
+4554
+4555
+4556
+4557
+4558
+4559
+4560
+4561
+4562
+4563
+4564
+4565
+4566
+4567
+4568
+4569
+4570
+4571
+4572
+4573
+4574
+4575
+4576
+4577
+4578
+4579
+4580
+4581
+4582
+4583
+4584
+4585
+4586
+4587
+4588
+4589
+4590
+4591
+4592
+4593
+4594
+4595
+4596
+4597
+4598
+4599
+4600
+4601
+4602
+4603
+4604
+4605
+4606
+4607
+4608
+4609
+4610
+4611
+4612
+4613
+4614
+4615
+4616
+4617
+4618
+4619
+4620
+4621
+4622
+4623
+4624
+4625
+4626
+4627
+4628
+4629
+4630
+4631
+4632
+4633
+4634
+4635
+4636
+4637
+4638
+4639
+4640
+4641
+4642
+4643
+4644
+4645
+4646
+4647
+4648
+4649
+4650
+4651
+4652
+4653
+4654
+4655
+4656
+4657
+4658
+4659
+4660
+4661
+4662
+4663
+4664
+4665
+4666
+4667
+4668
+4669
+4670
+4671
+4672
+4673
+4674
+4675
+4676
+4677
+4678
+4679
+4680
+4681
+4682
+4683
+4684
+4685
+4686
+4687
+4688
+4689
+4690
+4691
+4692
+4693
+4694
+4695
+4696
+4697
+4698
+4699
+4700
+4701
+4702
+4703
+4704
+4705
+4706
+4707
+4708
+4709
+4710
+4711
+4712
+4713
+4714
+4715
+4716
+4717
+4718
+4719
+4720
+4721
+4722
+4723
+4724
+4725
+4726
+4727
+4728
+4729
+4730
+4731
+4732
+4733
+4734
+4735
+4736
+4737
+4738
+4739
+4740
+4741
+4742
+4743
+4744
+4745
+4746
+4747
+4748
+4749
+4750
+4751
+4752
+4753
+4754
+4755
+4756
+4757
+4758
+4759
+4760
+4761
+4762
+4763
+4764
+4765
+4766
+4767
+4768
+4769
+4770
+4771
+4772
+4773
+4774
+4775
+4776
+4777
+4778
+4779
+4780
+4781
+4782
+4783
+4784
+4785
+4786
+4787
+4788
+4789
+4790
+4791
+4792
+4793
+4794
+4795
+4796
+4797
+4798
+4799
+4800
+4801
+4802
+4803
+4804
+4805
+4806
+4807
+4808
+4809
+4810
+4811
+4812
+4813
+4814
+4815
+4816
+4817
+4818
+4819
+4820
+4821
+4822
+4823
+4824
+4825
+4826
+4827
+4828
+4829
+4830
+4831
+4832
+4833
+4834
+4835
+4836
+4837
+4838
+4839
+4840
+4841
+4842
+4843
+4844
+4845
+4846
+4847
+4848
+4849
+4850
+4851
+4852
+4853
+4854
+4855
+4856
+4857
+4858
+4859
+4860
+4861
+4862
+4863
+4864
+4865
+4866
+4867
+4868
+4869
+4870
+4871
+4872
+4873
+4874
+4875
+4876
+4877
+4878
+4879
+4880
+4881
+4882
+4883
+4884
+4885
+4886
+4887
+4888
+4889
+4890
+4891
+4892
+4893
+4894
+4895
+4896
+4897
+4898
+4899
+4900
+4901
+4902
+4903
+4904
+4905
+4906
+4907
+4908
+4909
+4910
+4911
+4912
+4913
+4914
+4915
+4916
+4917
+4918
+4919
+4920
+4921
+4922
+4923
+4924
+4925
+4926
+4927
+4928
+4929
+4930
+4931
+4932
+4933
+4934
+4935
+4936
+4937
+4938
+4939
+4940
+4941
+4942
+4943
+4944
+4945
+4946
+4947
+4948
+4949
+4950
+4951
+4952
+4953
+4954
+4955
+4956
+4957
+4958
+4959
+4960
+4961
+4962
+4963
+4964
+4965
+4966
+4967
+4968
+4969
+4970
+4971
+4972
+4973
+4974
+4975
+4976
+4977
+4978
+4979
+4980
+4981
+4982
+4983
+4984
+4985
+4986
+4987
+4988
+4989
+4990
+4991
+4992
+4993
+4994
+4995
+4996
+4997
+4998
+4999
+5000
+5001
+5002
+5003
+5004
+5005
+5006
+5007
+5008
+5009
+5010
+5011
+5012
+5013
+5014
+5015
+5016
+5017
+5018
+5019
+5020
+5021
+5022
+5023
+5024
+5025
+5026
+5027
+5028
+5029
+5030
+5031
+5032
+5033
+5034
+5035
+5036
+5037
+5038
+5039
+5040
+5041
+5042
+5043
+5044
+5045
+5046
+5047
+5048
+5049
+5050
+5051
+5052
+5053
+5054
+5055
+5056
+5057
+5058
+5059
+5060
+5061
+5062
+5063
+5064
+5065
+5066
+5067
+5068
+5069
+5070
+5071
+5072
+5073
+5074
+5075
+5076
+5077
+5078
+5079
+5080
+5081
+5082
+5083
+5084
+5085
+5086
+5087
+5088
+5089
+5090
+5091
+5092
+5093
+5094
+5095
+5096
+5097
+5098
+5099
+5100
+5101
+5102
+5103
+5104
+5105
+5106
+5107
+5108
+5109
+5110
+5111
+5112
+5113
+5114
+5115
+5116
+5117
+5118
+5119
+5120
+5121
+5122
+5123
+5124
+5125
+5126
+5127
+5128
+5129
+5130
+5131
+5132
+5133
+5134
+5135
+5136
+5137
+5138
+5139
+5140
+5141
+5142
+5143
+5144
+5145
+5146
+5147
+5148
+5149
+5150
+5151
+5152
+5153
+5154
+5155
+5156
+5157
+5158
+5159
+5160
+5161
+5162
+5163
+5164
+5165
+5166
+5167
+5168
+5169
+5170
+5171
+5172
+5173
+5174
+5175
+5176
+5177
+5178
+5179
+5180
+5181
+5182
+5183
+5184
+5185
+5186
+5187
+5188
+5189
+5190
+5191
+5192
+5193
+5194
+5195
+5196
+5197
+5198
+5199
+5200
+5201
+5202
+5203
+5204
+5205
+5206
+5207
+5208
+5209
+5210
+5211
+5212
+5213
+5214
+5215
+5216
+5217
+5218
+5219
+5220
+5221
+5222
+5223
+5224
+5225
+5226
+5227
+5228
+5229
+5230
+5231
+5232
+5233
+5234
+5235
+5236
+5237
+5238
+5239
+5240
+5241
+5242
+5243
+5244
+5245
+5246
+5247
+5248
+5249
+5250
+5251
+5252
+5253
+5254
+5255
+5256
+5257
+5258
+5259
+5260
+5261
+5262
+5263
+5264
+5265
+5266
+5267
+5268
+5269
+5270
+5271
+5272
+5273
+5274
+5275
+5276
+5277
+5278
+5279
+5280
+5281
+5282
+5283
+5284
+5285
+5286
+5287
+5288
+5289
+5290
+5291
+5292
+5293
+5294
+5295
+5296
+5297
+5298
+5299
+5300
+5301
+5302
+5303
+5304
+5305
+5306
+5307
+5308
+5309
+5310
+5311
+5312
+5313
+5314
+5315
+5316
+5317
+5318
+5319
+5320
+5321
+5322
+5323
+5324
+5325
+5326
+5327
+5328
+5329
+5330
+5331
+5332
+5333
+5334
+5335
+5336
+5337
+5338
+5339
+5340
+5341
+5342
+5343
+5344
+5345
+5346
+5347
+5348
+5349
+5350
+5351
+5352
+5353
+5354
+5355
+5356
+5357
+5358
+5359
+5360
+5361
+5362
+5363
+5364
+5365
+5366
+5367
+5368
+5369
+5370
+5371
+5372
+5373
+5374
+5375
+5376
+5377
+5378
+5379
+5380
+5381
+5382
+5383
+5384
+5385
+5386
+5387
+5388
+5389
+5390
+5391
+5392
+5393
+5394
+5395
+5396
+5397
+5398
+5399
+5400
+5401
+5402
+5403
+5404
+5405
+5406
+5407
+5408
+5409
+5410
+5411
+5412
+5413
+5414
+5415
+5416
+5417
+5418
+5419
+5420
+5421
+5422
+5423
+5424
+5425
+5426
+5427
+5428
+5429
+5430
+5431
+5432
+5433
+5434
+5435
+5436
+5437
+5438
+5439
+5440
+5441
+5442
+5443
+5444
+5445
+5446
+5447
+5448
+5449
+5450
+5451
+5452
+5453
+5454
+5455
+5456
+5457
+5458
+5459
+5460
+5461
+5462
+5463
+5464
+5465
+5466
+5467
+5468
+5469
+5470
+5471
+5472
+5473
+5474
+5475
+5476
+5477
+5478
+5479
+5480
+5481
+5482
+5483
+5484
+5485
+5486
+5487
+5488
+5489
+5490
+5491
+5492
+5493
+5494
+5495
+5496
+5497
+5498
+5499
+5500
+5501
+5502
+5503
+5504
+5505
+5506
+5507
+5508
+5509
+5510
+5511
+5512
+5513
+5514
+5515
+5516
+5517
+5518
+5519
+5520
+5521
+5522
+5523
+5524
+5525
+5526
+5527
+5528
+5529
+5530
+5531
+5532
+5533
+5534
+5535
+5536
+5537
+5538
+5539
+5540
+5541
+5542
+5543
+5544
+5545
+5546
+5547
+5548
+5549
+5550
+5551
+5552
+5553
+5554
+5555
+5556
+5557
+5558
+5559
+5560
+5561
+5562
+5563
+5564
+5565
+5566
+5567
+5568
+5569
+5570
+5571
+5572
+5573
+5574
+5575
+5576
+5577
+5578
+5579
+5580
+5581
+5582
+5583
+5584
+5585
+5586
+5587
+5588
+5589
+5590
+5591
+5592
+5593
+5594
+5595
+5596
+5597
+5598
+5599
+5600
+5601
+5602
+5603
+5604
+5605
+5606
+5607
+5608
+5609
+5610
+5611
+5612
+5613
+5614
+5615
+5616
+5617
+5618
+5619
+5620
+5621
+5622
+5623
+5624
+5625
+5626
+5627
+5628
+5629
+5630
+5631
+5632
+5633
+5634
+5635
+5636
+5637
+5638
+5639
+5640
+5641
+5642
+5643
+5644
+5645
+5646
+5647
+5648
+5649
+5650
+5651
+5652
+5653
+5654
+5655
+5656
+5657
+5658
+5659
+5660
+5661
+5662
+5663
+5664
+5665
+5666
+5667
+5668
+5669
+5670
+5671
+5672
+5673
+5674
+5675
+5676
+5677
+5678
+5679
+5680
+5681
+5682
+5683
+5684
+5685
+5686
+5687
+5688
+5689
+5690
+5691
+5692
+5693
+5694
+5695
+5696
+5697
+5698
+5699
+5700
+5701
+5702
+5703
+5704
+5705
+5706
+5707
+5708
+5709
+5710
+5711
+5712
+5713
+5714
+5715
+5716
+5717
+5718
+5719
+5720
+5721
+5722
+5723
+5724
+5725
+5726
+5727
+5728
+5729
+5730
+5731
+5732
+5733
+5734
+5735
+5736
+5737
+5738
+5739
+5740
+5741
+5742
+5743
+5744
+5745
+5746
+5747
+5748
+5749
+5750
+5751
+5752
+5753
+5754
+5755
+5756
+5757
+5758
+5759
+5760
+5761
+5762
+5763
+5764
+5765
+5766
+5767
+5768
+5769
+5770
+5771
+5772
+5773
+5774
+5775
+5776
+5777
+5778
+5779
+5780
+5781
+5782
+5783
+5784
+5785
+5786
+5787
+5788
+5789
+5790
+5791
+5792
+5793
+5794
+5795
+5796
+5797
+5798
+5799
+5800
+5801
+5802
+5803
+5804
+5805
+5806
+5807
+5808
+5809
+5810
+5811
+5812
+5813
+5814
+5815
+5816
+5817
+5818
+5819
+5820
+5821
+5822
+5823
+5824
+5825
+5826
+5827
+5828
+5829
+5830
+5831
+5832
+5833
+5834
+5835
+5836
+5837
+5838
+5839
+5840
+5841
+5842
+5843
+5844
+5845
+5846
+5847
+5848
+5849
+5850
+5851
+5852
+5853
+5854
+5855
+5856
+5857
+5858
+5859
+5860
+5861
+5862
+5863
+5864
+5865
+5866
+5867
+5868
+5869
+5870
+5871
+5872
+5873
+5874
+5875
+5876
+5877
+5878
+5879
+5880
+5881
+5882
+5883
+5884
+5885
+5886
+5887
+5888
+5889
+5890
+5891
+5892
+5893
+5894
+5895
+5896
+5897
+5898
+5899
+5900
+5901
+5902
+5903
+5904
+5905
+5906
+5907
+5908
+5909
+5910
+5911
+5912
+5913
+5914
+5915
+5916
+5917
+5918
+5919
+5920
+5921
+5922
+5923
+5924
+5925
+5926
+5927
+5928
+5929
+5930
+5931
+5932
+5933
+5934
+5935
+5936
+5937
+5938
+5939
+5940
+5941
+5942
+5943
+5944
+5945
+5946
+5947
+5948
+5949
+5950
+5951
+5952
+5953
+5954
+5955
+5956
+5957
+5958
+5959
+5960
+5961
+5962
+5963
+5964
+5965
+5966
+5967
+5968
+5969
+5970
+5971
+5972
+5973
+5974
+5975
+5976
+5977
+5978
+5979
+5980
+5981
+5982
+5983
+5984
+5985
+5986
+5987
+5988
+5989
+5990
+5991
+5992
+5993
+5994
+5995
+5996
+5997
+5998
+5999
+6000
+6001
+6002
+6003
+6004
+6005
+6006
+6007
+6008
+6009
+6010
+6011
+6012
+6013
+6014
+6015
+6016
+6017
+6018
+6019
+6020
+6021
+6022
+6023
+6024
+6025
+6026
+6027
+6028
+6029
+6030
+6031
+6032
+6033
+6034
+6035
+6036
+6037
+6038
+6039
+6040
+6041
+6042
+6043
+6044
+6045
+6046
+6047
+6048
+6049
+6050
+6051
+6052
+6053
+6054
+6055
+6056
+6057
+6058
+6059
+6060
+6061
+6062
+6063
+6064
+6065
+6066
+6067
+6068
+6069
+6070
+6071
+6072
+6073
+6074
+6075
+6076
+6077
+6078
+6079
+6080
+6081
+6082
+6083
+6084
+6085
+6086
+6087
+6088
+6089
+6090
+6091
+6092
+6093
+6094
+6095
+6096
+6097
+6098
+6099
+6100
+6101
+6102
+6103
+6104
+6105
+6106
+6107
+6108
+6109
+6110
+6111
+6112
+6113
+6114
+6115
+6116
+6117
+6118
+6119
+6120
+6121
+6122
+6123
+6124
+6125
+6126
+6127
+6128
+6129
+6130
+6131
+6132
+6133
+6134
+6135
+6136
+6137
+6138
+6139
+6140
+6141
+6142
+6143
+6144
+6145
+6146
+6147
+6148
+6149
+6150
+6151
+6152
+6153
+6154
+6155
+6156
+6157
+6158
+6159
+6160
+6161
+6162
+6163
+6164
+6165
+6166
+6167
+6168
+6169
+6170
+6171
+6172
+6173
+6174
+6175
+6176
+6177
+6178
+6179
+6180
+6181
+6182
+6183
+6184
+6185
+6186
+6187
+6188
+6189
+6190
+6191
+6192
+6193
+6194
+6195
+6196
+6197
+6198
+6199
+6200
+6201
+6202
+6203
+6204
+6205
+6206
+6207
+6208
+6209
+6210
+6211
+6212
+6213
+6214
+6215
+6216
+6217
+6218
+6219
+6220
+6221
+6222
+6223
+6224
+6225
+6226
+6227
+6228
+6229
+6230
+6231
+6232
+6233
+6234
+6235
+6236
+6237
+6238
+6239
+6240
+6241
+6242
+6243
+6244
+6245
+6246
+6247
+6248
+6249
+6250
+6251
+6252
+6253
+6254
+6255
+6256
+6257
+6258
+6259
+6260
+6261
+6262
+6263
+6264
+6265
+6266
+6267
+6268
+6269
+6270
+6271
+6272
+6273
+6274
+6275
+6276
+6277
+6278
+6279
+6280
+6281
+6282
+6283
+6284
+6285
+6286
+6287
+6288
+6289
+6290
+6291
+6292
+6293
+6294
+6295
+6296
+6297
+6298
+6299
+6300
+6301
+6302
+6303
+6304
+6305
+6306
+6307
+6308
+6309
+6310
+6311
+6312
+6313
+6314
+6315
+6316
+6317
+6318
+6319
+6320
+6321
+6322
+6323
+6324
+6325
+6326
+6327
+6328
+6329
+6330
+6331
+6332
+6333
+6334
+6335
+6336
+6337
+6338
+6339
+6340
+6341
+6342
+6343
+6344
+6345
+6346
+6347
+6348
+6349
+6350
+6351
+6352
+6353
+6354
+6355
+6356
+6357
+6358
+6359
+6360
+6361
+6362
+6363
+6364
+6365
+6366
+6367
+6368
+6369
+6370
+6371
+6372
+6373
+6374
+6375
+6376
+6377
+6378
+6379
+6380
+6381
+6382
+6383
+6384
+6385
+6386
+6387
+6388
+6389
+6390
+6391
+6392
+6393
+6394
+6395
+6396
+6397
+6398
+6399
+6400
+6401
+6402
+6403
+6404
+6405
+6406
+6407
+6408
+6409
+6410
+6411
+6412
+6413
+6414
+6415
+6416
+6417
+6418
+6419
+6420
+6421
+6422
+6423
+6424
+6425
+6426
+6427
+6428
+6429
+6430
+6431
+6432
+6433
+6434
+6435
+6436
+6437
+6438
+6439
+6440
+6441
+6442
+6443
+6444
+6445
+6446
+6447
+6448
+6449
+6450
+6451
+6452
+6453
+6454
+6455
+6456
+6457
+6458
+6459
+6460
+6461
+6462
+6463
+6464
+6465
+6466
+6467
+6468
+6469
+6470
+6471
+6472
+6473
+6474
+6475
+6476
+6477
+6478
+6479
+6480
+6481
+6482
+6483
+6484
+6485
+6486
+6487
+6488
+6489
+6490
+6491
+6492
+6493
+6494
+6495
+6496
+6497
+6498
+6499
+6500
+6501
+6502
+6503
+6504
+6505
+6506
+6507
+6508
+6509
+6510
+6511
+6512
+6513
+6514
+6515
+6516
+6517
+6518
+6519
+6520
+6521
+6522
+6523
+6524
+6525
+6526
+6527
+6528
+6529
+6530
+6531
+6532
+6533
+6534
+6535
+6536
+6537
+6538
+6539
+6540
+6541
+6542
+6543
+6544
+6545
+6546
#ifndef __LINUX_NL80211_H
+#define __LINUX_NL80211_H
+/*
+ * 802.11 netlink interface public header
+ *
+ * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2008 Michael Wu <flamingice@sourmilk.net>
+ * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com>
+ * Copyright 2008 Michael Buesch <m@bues.ch>
+ * Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com>
+ * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
+ * Copyright 2008 Colin McCabe <colin@cozybit.com>
+ * Copyright 2015-2017 Intel Deutschland GmbH
+ * Copyright (C) 2018-2019 Intel Corporation
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+ * This header file defines the userspace API to the wireless stack. Please
+ * be careful not to break things - i.e. don't move anything around or so
+ * unless you can demonstrate that it breaks neither API nor ABI.
+ *
+ * Additions to the API should be accompanied by actual implementations in
+ * an upstream driver, so that example implementations exist in case there
+ * are ever concerns about the precise semantics of the API or changes are
+ * needed, and to ensure that code for dead (no longer implemented) API
+ * can actually be identified and removed.
+ * Nonetheless, semantics should also be documented carefully in this file.
+ */
+
+#include <linux/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define NL80211_GENL_NAME "nl80211"
+
+#define NL80211_MULTICAST_GROUP_CONFIG     "config"
+#define NL80211_MULTICAST_GROUP_SCAN       "scan"
+#define NL80211_MULTICAST_GROUP_REG        "regulatory"
+#define NL80211_MULTICAST_GROUP_MLME       "mlme"
+#define NL80211_MULTICAST_GROUP_VENDOR     "vendor"
+#define NL80211_MULTICAST_GROUP_NAN        "nan"
+#define NL80211_MULTICAST_GROUP_TESTMODE   "testmode"
+
+#define NL80211_EDMG_BW_CONFIG_MIN   4
+#define NL80211_EDMG_BW_CONFIG_MAX   15
+#define NL80211_EDMG_CHANNELS_MIN    1
+#define NL80211_EDMG_CHANNELS_MAX    0x3c /* 0b00111100 */
+
+/**
+ * DOC: Station handling
+ *
+ * Stations are added per interface, but a special case exists with VLAN
+ * interfaces. When a station is bound to an AP interface, it may be moved
+ * into a VLAN identified by a VLAN interface index (%NL80211_ATTR_STA_VLAN).
+ * The station is still assumed to belong to the AP interface it was added
+ * to.
+ *
+ * Station handling varies per interface type and depending on the driver's
+ * capabilities.
+ *
+ * For drivers supporting TDLS with external setup (WIPHY_FLAG_SUPPORTS_TDLS
+ * and WIPHY_FLAG_TDLS_EXTERNAL_SETUP), the station lifetime is as follows:
+ *  - a setup station entry is added, not yet authorized, without any rate
+ *    or capability information, this just exists to avoid race conditions
+ *  - when the TDLS setup is done, a single NL80211_CMD_SET_STATION is valid
+ *    to add rate and capability information to the station and at the same
+ *    time mark it authorized.
+ *  - %NL80211_TDLS_ENABLE_LINK is then used
+ *  - after this, the only valid operation is to remove it by tearing down
+ *    the TDLS link (%NL80211_TDLS_DISABLE_LINK)
+ *
+ * TODO: need more info for other interface types
+ */
+
+/**
+ * DOC: Frame transmission/registration support
+ *
+ * Frame transmission and registration support exists to allow userspace
+ * management entities such as wpa_supplicant react to management frames
+ * that are not being handled by the kernel. This includes, for example,
+ * certain classes of action frames that cannot be handled in the kernel
+ * for various reasons.
+ *
+ * Frame registration is done on a per-interface basis and registrations
+ * cannot be removed other than by closing the socket. It is possible to
+ * specify a registration filter to register, for example, only for a
+ * certain type of action frame. In particular with action frames, those
+ * that userspace registers for will not be returned as unhandled by the
+ * driver, so that the registered application has to take responsibility
+ * for doing that.
+ *
+ * The type of frame that can be registered for is also dependent on the
+ * driver and interface type. The frame types are advertised in wiphy
+ * attributes so applications know what to expect.
+ *
+ * NOTE: When an interface changes type while registrations are active,
+ *       these registrations are ignored until the interface type is
+ *       changed again. This means that changing the interface type can
+ *       lead to a situation that couldn't otherwise be produced, but
+ *       any such registrations will be dormant in the sense that they
+ *       will not be serviced, i.e. they will not receive any frames.
+ *
+ * Frame transmission allows userspace to send for example the required
+ * responses to action frames. It is subject to some sanity checking,
+ * but many frames can be transmitted. When a frame was transmitted, its
+ * status is indicated to the sending socket.
+ *
+ * For more technical details, see the corresponding command descriptions
+ * below.
+ */
+
+/**
+ * DOC: Virtual interface / concurrency capabilities
+ *
+ * Some devices are able to operate with virtual MACs, they can have
+ * more than one virtual interface. The capability handling for this
+ * is a bit complex though, as there may be a number of restrictions
+ * on the types of concurrency that are supported.
+ *
+ * To start with, each device supports the interface types listed in
+ * the %NL80211_ATTR_SUPPORTED_IFTYPES attribute, but by listing the
+ * types there no concurrency is implied.
+ *
+ * Once concurrency is desired, more attributes must be observed:
+ * To start with, since some interface types are purely managed in
+ * software, like the AP-VLAN type in mac80211 for example, there's
+ * an additional list of these, they can be added at any time and
+ * are only restricted by some semantic restrictions (e.g. AP-VLAN
+ * cannot be added without a corresponding AP interface). This list
+ * is exported in the %NL80211_ATTR_SOFTWARE_IFTYPES attribute.
+ *
+ * Further, the list of supported combinations is exported. This is
+ * in the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute. Basically,
+ * it exports a list of "groups", and at any point in time the
+ * interfaces that are currently active must fall into any one of
+ * the advertised groups. Within each group, there are restrictions
+ * on the number of interfaces of different types that are supported
+ * and also the number of different channels, along with potentially
+ * some other restrictions. See &enum nl80211_if_combination_attrs.
+ *
+ * All together, these attributes define the concurrency of virtual
+ * interfaces that a given device supports.
+ */
+
+/**
+ * DOC: packet coalesce support
+ *
+ * In most cases, host that receives IPv4 and IPv6 multicast/broadcast
+ * packets does not do anything with these packets. Therefore the
+ * reception of these unwanted packets causes unnecessary processing
+ * and power consumption.
+ *
+ * Packet coalesce feature helps to reduce number of received interrupts
+ * to host by buffering these packets in firmware/hardware for some
+ * predefined time. Received interrupt will be generated when one of the
+ * following events occur.
+ * a) Expiration of hardware timer whose expiration time is set to maximum
+ * coalescing delay of matching coalesce rule.
+ * b) Coalescing buffer in hardware reaches it's limit.
+ * c) Packet doesn't match any of the configured coalesce rules.
+ *
+ * User needs to configure following parameters for creating a coalesce
+ * rule.
+ * a) Maximum coalescing delay
+ * b) List of packet patterns which needs to be matched
+ * c) Condition for coalescence. pattern 'match' or 'no match'
+ * Multiple such rules can be created.
+ */
+
+/**
+ * DOC: WPA/WPA2 EAPOL handshake offload
+ *
+ * By setting @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK flag drivers
+ * can indicate they support offloading EAPOL handshakes for WPA/WPA2
+ * preshared key authentication. In %NL80211_CMD_CONNECT the preshared
+ * key should be specified using %NL80211_ATTR_PMK. Drivers supporting
+ * this offload may reject the %NL80211_CMD_CONNECT when no preshared
+ * key material is provided, for example when that driver does not
+ * support setting the temporal keys through %CMD_NEW_KEY.
+ *
+ * Similarly @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X flag can be
+ * set by drivers indicating offload support of the PTK/GTK EAPOL
+ * handshakes during 802.1X authentication. In order to use the offload
+ * the %NL80211_CMD_CONNECT should have %NL80211_ATTR_WANT_1X_4WAY_HS
+ * attribute flag. Drivers supporting this offload may reject the
+ * %NL80211_CMD_CONNECT when the attribute flag is not present.
+ *
+ * For 802.1X the PMK or PMK-R0 are set by providing %NL80211_ATTR_PMK
+ * using %NL80211_CMD_SET_PMK. For offloaded FT support also
+ * %NL80211_ATTR_PMKR0_NAME must be provided.
+ */
+
+/**
+ * DOC: FILS shared key authentication offload
+ *
+ * FILS shared key authentication offload can be advertized by drivers by
+ * setting @NL80211_EXT_FEATURE_FILS_SK_OFFLOAD flag. The drivers that support
+ * FILS shared key authentication offload should be able to construct the
+ * authentication and association frames for FILS shared key authentication and
+ * eventually do a key derivation as per IEEE 802.11ai. The below additional
+ * parameters should be given to driver in %NL80211_CMD_CONNECT and/or in
+ * %NL80211_CMD_UPDATE_CONNECT_PARAMS.
+ *    %NL80211_ATTR_FILS_ERP_USERNAME - used to construct keyname_nai
+ *    %NL80211_ATTR_FILS_ERP_REALM - used to construct keyname_nai
+ *    %NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM - used to construct erp message
+ *    %NL80211_ATTR_FILS_ERP_RRK - used to generate the rIK and rMSK
+ * rIK should be used to generate an authentication tag on the ERP message and
+ * rMSK should be used to derive a PMKSA.
+ * rIK, rMSK should be generated and keyname_nai, sequence number should be used
+ * as specified in IETF RFC 6696.
+ *
+ * When FILS shared key authentication is completed, driver needs to provide the
+ * below additional parameters to userspace, which can be either after setting
+ * up a connection or after roaming.
+ *    %NL80211_ATTR_FILS_KEK - used for key renewal
+ *    %NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM - used in further EAP-RP exchanges
+ *    %NL80211_ATTR_PMKID - used to identify the PMKSA used/generated
+ *    %Nl80211_ATTR_PMK - used to update PMKSA cache in userspace
+ * The PMKSA can be maintained in userspace persistently so that it can be used
+ * later after reboots or wifi turn off/on also.
+ *
+ * %NL80211_ATTR_FILS_CACHE_ID is the cache identifier advertized by a FILS
+ * capable AP supporting PMK caching. It specifies the scope within which the
+ * PMKSAs are cached in an ESS. %NL80211_CMD_SET_PMKSA and
+ * %NL80211_CMD_DEL_PMKSA are enhanced to allow support for PMKSA caching based
+ * on FILS cache identifier. Additionally %NL80211_ATTR_PMK is used with
+ * %NL80211_SET_PMKSA to specify the PMK corresponding to a PMKSA for driver to
+ * use in a FILS shared key connection with PMKSA caching.
+ */
+
+/**
+ * DOC: SAE authentication offload
+ *
+ * By setting @NL80211_EXT_FEATURE_SAE_OFFLOAD flag drivers can indicate they
+ * support offloading SAE authentication for WPA3-Personal networks. In
+ * %NL80211_CMD_CONNECT the password for SAE should be specified using
+ * %NL80211_ATTR_SAE_PASSWORD.
+ */
+
+/**
+ * enum nl80211_commands - supported nl80211 commands
+ *
+ * @NL80211_CMD_UNSPEC: unspecified command to catch errors
+ *
+ * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request
+ *    to get a list of all present wiphys.
+ * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
+ *    %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
+ *    %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ (and the
+ *    attributes determining the channel width; this is used for setting
+ *    monitor mode channel),  %NL80211_ATTR_WIPHY_RETRY_SHORT,
+ *    %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
+ *    and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD.
+ *    However, for setting the channel, see %NL80211_CMD_SET_CHANNEL
+ *    instead, the support here is for backward compatibility only.
+ * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
+ *    or rename notification. Has attributes %NL80211_ATTR_WIPHY and
+ *    %NL80211_ATTR_WIPHY_NAME.
+ * @NL80211_CMD_DEL_WIPHY: Wiphy deleted. Has attributes
+ *    %NL80211_ATTR_WIPHY and %NL80211_ATTR_WIPHY_NAME.
+ *
+ * @NL80211_CMD_GET_INTERFACE: Request an interface's configuration;
+ *    either a dump request for all interfaces or a specific get with a
+ *    single %NL80211_ATTR_IFINDEX is supported.
+ * @NL80211_CMD_SET_INTERFACE: Set type of a virtual interface, requires
+ *    %NL80211_ATTR_IFINDEX and %NL80211_ATTR_IFTYPE.
+ * @NL80211_CMD_NEW_INTERFACE: Newly created virtual interface or response
+ *    to %NL80211_CMD_GET_INTERFACE. Has %NL80211_ATTR_IFINDEX,
+ *    %NL80211_ATTR_WIPHY and %NL80211_ATTR_IFTYPE attributes. Can also
+ *    be sent from userspace to request creation of a new virtual interface,
+ *    then requires attributes %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFTYPE and
+ *    %NL80211_ATTR_IFNAME.
+ * @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes
+ *    %NL80211_ATTR_IFINDEX and %NL80211_ATTR_WIPHY. Can also be sent from
+ *    userspace to request deletion of a virtual interface, then requires
+ *    attribute %NL80211_ATTR_IFINDEX.
+ *
+ * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified
+ *    by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC.
+ * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT,
+ *    %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD.
+ * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA,
+ *    %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER,
+ *    and %NL80211_ATTR_KEY_SEQ attributes.
+ * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX
+ *    or %NL80211_ATTR_MAC.
+ *
+ * @NL80211_CMD_GET_BEACON: (not used)
+ * @NL80211_CMD_SET_BEACON: change the beacon on an access point interface
+ *    using the %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL
+ *    attributes. For drivers that generate the beacon and probe responses
+ *    internally, the following attributes must be provided: %NL80211_ATTR_IE,
+ *    %NL80211_ATTR_IE_PROBE_RESP and %NL80211_ATTR_IE_ASSOC_RESP.
+ * @NL80211_CMD_START_AP: Start AP operation on an AP interface, parameters
+ *    are like for %NL80211_CMD_SET_BEACON, and additionally parameters that
+ *    do not change are used, these include %NL80211_ATTR_BEACON_INTERVAL,
+ *    %NL80211_ATTR_DTIM_PERIOD, %NL80211_ATTR_SSID,
+ *    %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE,
+ *    %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS,
+ *    %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY,
+ *    %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_INACTIVITY_TIMEOUT,
+ *    %NL80211_ATTR_ACL_POLICY and %NL80211_ATTR_MAC_ADDRS.
+ *    The channel to use can be set on the interface or be given using the
+ *    %NL80211_ATTR_WIPHY_FREQ and the attributes determining channel width.
+ * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP
+ * @NL80211_CMD_STOP_AP: Stop AP operation on the given interface
+ * @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP
+ *
+ * @NL80211_CMD_GET_STATION: Get station attributes for station identified by
+ *    %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX.
+ * @NL80211_CMD_SET_STATION: Set station attributes for station identified by
+ *    %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX.
+ * @NL80211_CMD_NEW_STATION: Add a station with given attributes to the
+ *    the interface identified by %NL80211_ATTR_IFINDEX.
+ * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC
+ *    or, if no MAC address given, all stations, on the interface identified
+ *    by %NL80211_ATTR_IFINDEX. %NL80211_ATTR_MGMT_SUBTYPE and
+ *    %NL80211_ATTR_REASON_CODE can optionally be used to specify which type
+ *    of disconnection indication should be sent to the station
+ *    (Deauthentication or Disassociation frame and reason code for that
+ *    frame).
+ *
+ * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to
+ *     destination %NL80211_ATTR_MAC on the interface identified by
+ *     %NL80211_ATTR_IFINDEX.
+ * @NL80211_CMD_SET_MPATH:  Set mesh path attributes for mesh path to
+ *     destination %NL80211_ATTR_MAC on the interface identified by
+ *     %NL80211_ATTR_IFINDEX.
+ * @NL80211_CMD_NEW_MPATH: Create a new mesh path for the destination given by
+ *    %NL80211_ATTR_MAC via %NL80211_ATTR_MPATH_NEXT_HOP.
+ * @NL80211_CMD_DEL_MPATH: Delete a mesh path to the destination given by
+ *    %NL80211_ATTR_MAC.
+ * @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the
+ *    the interface identified by %NL80211_ATTR_IFINDEX.
+ * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC
+ *    or, if no MAC address given, all mesh paths, on the interface identified
+ *    by %NL80211_ATTR_IFINDEX.
+ * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by
+ *    %NL80211_ATTR_IFINDEX.
+ *
+ * @NL80211_CMD_GET_REG: ask the wireless core to send us its currently set
+ *    regulatory domain. If %NL80211_ATTR_WIPHY is specified and the device
+ *    has a private regulatory domain, it will be returned. Otherwise, the
+ *    global regdomain will be returned.
+ *    A device will have a private regulatory domain if it uses the
+ *    regulatory_hint() API. Even when a private regdomain is used the channel
+ *    information will still be mended according to further hints from
+ *    the regulatory core to help with compliance. A dump version of this API
+ *    is now available which will returns the global regdomain as well as
+ *    all private regdomains of present wiphys (for those that have it).
+ *    If a wiphy is self-managed (%NL80211_ATTR_WIPHY_SELF_MANAGED_REG), then
+ *    its private regdomain is the only valid one for it. The regulatory
+ *    core is not used to help with compliance in this case.
+ * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command
+ *    after being queried by the kernel. CRDA replies by sending a regulatory
+ *    domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our
+ *    current alpha2 if it found a match. It also provides
+ *    NL80211_ATTR_REG_RULE_FLAGS, and a set of regulatory rules. Each
+ *    regulatory rule is a nested set of attributes  given by
+ *    %NL80211_ATTR_REG_RULE_FREQ_[START|END] and
+ *    %NL80211_ATTR_FREQ_RANGE_MAX_BW with an attached power rule given by
+ *    %NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and
+ *    %NL80211_ATTR_REG_RULE_POWER_MAX_EIRP.
+ * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain
+ *    to the specified ISO/IEC 3166-1 alpha2 country code. The core will
+ *    store this as a valid request and then query userspace for it.
+ *
+ * @NL80211_CMD_GET_MESH_CONFIG: Get mesh networking properties for the
+ *    interface identified by %NL80211_ATTR_IFINDEX
+ *
+ * @NL80211_CMD_SET_MESH_CONFIG: Set mesh networking properties for the
+ *    interface identified by %NL80211_ATTR_IFINDEX
+ *
+ * @NL80211_CMD_SET_MGMT_EXTRA_IE: Set extra IEs for management frames. The
+ *    interface is identified with %NL80211_ATTR_IFINDEX and the management
+ *    frame subtype with %NL80211_ATTR_MGMT_SUBTYPE. The extra IE data to be
+ *    added to the end of the specified management frame is specified with
+ *    %NL80211_ATTR_IE. If the command succeeds, the requested data will be
+ *    added to all specified management frames generated by
+ *    kernel/firmware/driver.
+ *    Note: This command has been removed and it is only reserved at this
+ *    point to avoid re-using existing command number. The functionality this
+ *    command was planned for has been provided with cleaner design with the
+ *    option to specify additional IEs in NL80211_CMD_TRIGGER_SCAN,
+ *    NL80211_CMD_AUTHENTICATE, NL80211_CMD_ASSOCIATE,
+ *    NL80211_CMD_DEAUTHENTICATE, and NL80211_CMD_DISASSOCIATE.
+ *
+ * @NL80211_CMD_GET_SCAN: get scan results
+ * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
+ *    %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
+ *    probe requests at CCK rate or not. %NL80211_ATTR_BSSID can be used to
+ *    specify a BSSID to scan for; if not included, the wildcard BSSID will
+ *    be used.
+ * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
+ *    NL80211_CMD_GET_SCAN and on the "scan" multicast group)
+ * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
+ *    partial scan results may be available
+ *
+ * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain
+ *    intervals and certain number of cycles, as specified by
+ *    %NL80211_ATTR_SCHED_SCAN_PLANS. If %NL80211_ATTR_SCHED_SCAN_PLANS is
+ *    not specified and only %NL80211_ATTR_SCHED_SCAN_INTERVAL is specified,
+ *    scheduled scan will run in an infinite loop with the specified interval.
+ *    These attributes are mutually exculsive,
+ *    i.e. NL80211_ATTR_SCHED_SCAN_INTERVAL must not be passed if
+ *    NL80211_ATTR_SCHED_SCAN_PLANS is defined.
+ *    If for some reason scheduled scan is aborted by the driver, all scan
+ *    plans are canceled (including scan plans that did not start yet).
+ *    Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS)
+ *    are passed, they are used in the probe requests.  For
+ *    broadcast, a broadcast SSID must be passed (ie. an empty
+ *    string).  If no SSID is passed, no probe requests are sent and
+ *    a passive scan is performed.  %NL80211_ATTR_SCAN_FREQUENCIES,
+ *    if passed, define which channels should be scanned; if not
+ *    passed, all channels allowed for the current regulatory domain
+ *    are used.  Extra IEs can also be passed from the userspace by
+ *    using the %NL80211_ATTR_IE attribute.  The first cycle of the
+ *    scheduled scan can be delayed by %NL80211_ATTR_SCHED_SCAN_DELAY
+ *    is supplied. If the device supports multiple concurrent scheduled
+ *    scans, it will allow such when the caller provides the flag attribute
+ *    %NL80211_ATTR_SCHED_SCAN_MULTI to indicate user-space support for it.
+ * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT if
+ *    scheduled scan is not running. The caller may assume that as soon
+ *    as the call returns, it is safe to start a new scheduled scan again.
+ * @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan
+ *    results available.
+ * @NL80211_CMD_SCHED_SCAN_STOPPED: indicates that the scheduled scan has
+ *    stopped.  The driver may issue this event at any time during a
+ *    scheduled scan.  One reason for stopping the scan is if the hardware
+ *    does not support starting an association or a normal scan while running
+ *    a scheduled scan.  This event is also sent when the
+ *    %NL80211_CMD_STOP_SCHED_SCAN command is received or when the interface
+ *    is brought down while a scheduled scan was running.
+ *
+ * @NL80211_CMD_GET_SURVEY: get survey resuls, e.g. channel occupation
+ *      or noise level
+ * @NL80211_CMD_NEW_SURVEY_RESULTS: survey data notification (as a reply to
+ *    NL80211_CMD_GET_SURVEY and on the "scan" multicast group)
+ *
+ * @NL80211_CMD_SET_PMKSA: Add a PMKSA cache entry using %NL80211_ATTR_MAC
+ *    (for the BSSID), %NL80211_ATTR_PMKID, and optionally %NL80211_ATTR_PMK
+ *    (PMK is used for PTKSA derivation in case of FILS shared key offload) or
+ *    using %NL80211_ATTR_SSID, %NL80211_ATTR_FILS_CACHE_ID,
+ *    %NL80211_ATTR_PMKID, and %NL80211_ATTR_PMK in case of FILS
+ *    authentication where %NL80211_ATTR_FILS_CACHE_ID is the identifier
+ *    advertized by a FILS capable AP identifying the scope of PMKSA in an
+ *    ESS.
+ * @NL80211_CMD_DEL_PMKSA: Delete a PMKSA cache entry, using %NL80211_ATTR_MAC
+ *    (for the BSSID) and %NL80211_ATTR_PMKID or using %NL80211_ATTR_SSID,
+ *    %NL80211_ATTR_FILS_CACHE_ID, and %NL80211_ATTR_PMKID in case of FILS
+ *    authentication.
+ * @NL80211_CMD_FLUSH_PMKSA: Flush all PMKSA cache entries.
+ *
+ * @NL80211_CMD_REG_CHANGE: indicates to userspace the regulatory domain
+ *     has been changed and provides details of the request information
+ *     that caused the change such as who initiated the regulatory request
+ *     (%NL80211_ATTR_REG_INITIATOR), the wiphy_idx
+ *     (%NL80211_ATTR_REG_ALPHA2) on which the request was made from if
+ *     the initiator was %NL80211_REGDOM_SET_BY_COUNTRY_IE or
+ *     %NL80211_REGDOM_SET_BY_DRIVER, the type of regulatory domain
+ *     set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is
+ *     %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on
+ *     to (%NL80211_ATTR_REG_ALPHA2).
+ * @NL80211_CMD_REG_BEACON_HINT: indicates to userspace that an AP beacon
+ *     has been found while world roaming thus enabling active scan or
+ *     any mode of operation that initiates TX (beacons) on a channel
+ *     where we would not have been able to do either before. As an example
+ *     if you are world roaming (regulatory domain set to world or if your
+ *     driver is using a custom world roaming regulatory domain) and while
+ *     doing a passive scan on the 5 GHz band you find an AP there (if not
+ *     on a DFS channel) you will now be able to actively scan for that AP
+ *     or use AP mode on your card on that same channel. Note that this will
+ *     never be used for channels 1-11 on the 2 GHz band as they are always
+ *     enabled world wide. This beacon hint is only sent if your device had
+ *     either disabled active scanning or beaconing on a channel. We send to
+ *     userspace the wiphy on which we removed a restriction from
+ *     (%NL80211_ATTR_WIPHY) and the channel on which this occurred
+ *     before (%NL80211_ATTR_FREQ_BEFORE) and after (%NL80211_ATTR_FREQ_AFTER)
+ *     the beacon hint was processed.
+ *
+ * @NL80211_CMD_AUTHENTICATE: authentication request and notification.
+ *    This command is used both as a command (request to authenticate) and
+ *    as an event on the "mlme" multicast group indicating completion of the
+ *    authentication process.
+ *    When used as a command, %NL80211_ATTR_IFINDEX is used to identify the
+ *    interface. %NL80211_ATTR_MAC is used to specify PeerSTAAddress (and
+ *    BSSID in case of station mode). %NL80211_ATTR_SSID is used to specify
+ *    the SSID (mainly for association, but is included in authentication
+ *    request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ is used
+ *    to specify the frequence of the channel in MHz. %NL80211_ATTR_AUTH_TYPE
+ *    is used to specify the authentication type. %NL80211_ATTR_IE is used to
+ *    define IEs (VendorSpecificInfo, but also including RSN IE and FT IEs)
+ *    to be added to the frame.
+ *    When used as an event, this reports reception of an Authentication
+ *    frame in station and IBSS modes when the local MLME processed the
+ *    frame, i.e., it was for the local STA and was received in correct
+ *    state. This is similar to MLME-AUTHENTICATE.confirm primitive in the
+ *    MLME SAP interface (kernel providing MLME, userspace SME). The
+ *    included %NL80211_ATTR_FRAME attribute contains the management frame
+ *    (including both the header and frame body, but not FCS). This event is
+ *    also used to indicate if the authentication attempt timed out. In that
+ *    case the %NL80211_ATTR_FRAME attribute is replaced with a
+ *    %NL80211_ATTR_TIMED_OUT flag (and %NL80211_ATTR_MAC to indicate which
+ *    pending authentication timed out).
+ * @NL80211_CMD_ASSOCIATE: association request and notification; like
+ *    NL80211_CMD_AUTHENTICATE but for Association and Reassociation
+ *    (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
+ *    MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). The
+ *    %NL80211_ATTR_PREV_BSSID attribute is used to specify whether the
+ *    request is for the initial association to an ESS (that attribute not
+ *    included) or for reassociation within the ESS (that attribute is
+ *    included).
+ * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like
+ *    NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to
+ *    MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication
+ *    primitives).
+ * @NL80211_CMD_DISASSOCIATE: disassociation request and notification; like
+ *    NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to
+ *    MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives).
+ *
+ * @NL80211_CMD_MICHAEL_MIC_FAILURE: notification of a locally detected Michael
+ *    MIC (part of TKIP) failure; sent on the "mlme" multicast group; the
+ *    event includes %NL80211_ATTR_MAC to describe the source MAC address of
+ *    the frame with invalid MIC, %NL80211_ATTR_KEY_TYPE to show the key
+ *    type, %NL80211_ATTR_KEY_IDX to indicate the key identifier, and
+ *    %NL80211_ATTR_KEY_SEQ to indicate the TSC value of the frame; this
+ *    event matches with MLME-MICHAELMICFAILURE.indication() primitive
+ *
+ * @NL80211_CMD_JOIN_IBSS: Join a new IBSS -- given at least an SSID and a
+ *    FREQ attribute (for the initial frequency if no peer can be found)
+ *    and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those
+ *    should be fixed rather than automatically determined. Can only be
+ *    executed on a network interface that is UP, and fixed BSSID/FREQ
+ *    may be rejected. Another optional parameter is the beacon interval,
+ *    given in the %NL80211_ATTR_BEACON_INTERVAL attribute, which if not
+ *    given defaults to 100 TU (102.4ms).
+ * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is
+ *    determined by the network interface.
+ *
+ * @NL80211_CMD_TESTMODE: testmode command, takes a wiphy (or ifindex) attribute
+ *    to identify the device, and the TESTDATA blob attribute to pass through
+ *    to the driver.
+ *
+ * @NL80211_CMD_CONNECT: connection request and notification; this command
+ *    requests to connect to a specified network but without separating
+ *    auth and assoc steps. For this, you need to specify the SSID in a
+ *    %NL80211_ATTR_SSID attribute, and can optionally specify the association
+ *    IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_USE_MFP,
+ *    %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT,
+ *    %NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
+ *    %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT,
+ *    %NL80211_ATTR_CONTROL_PORT_OVER_NL80211, %NL80211_ATTR_MAC_HINT, and
+ *    %NL80211_ATTR_WIPHY_FREQ_HINT.
+ *    If included, %NL80211_ATTR_MAC and %NL80211_ATTR_WIPHY_FREQ are
+ *    restrictions on BSS selection, i.e., they effectively prevent roaming
+ *    within the ESS. %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT
+ *    can be included to provide a recommendation of the initial BSS while
+ *    allowing the driver to roam to other BSSes within the ESS and also to
+ *    ignore this recommendation if the indicated BSS is not ideal. Only one
+ *    set of BSSID,frequency parameters is used (i.e., either the enforcing
+ *    %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
+ *    %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
+ *    %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within
+ *    the ESS in case the device is already associated and an association with
+ *    a different BSS is desired.
+ *    Background scan period can optionally be
+ *    specified in %NL80211_ATTR_BG_SCAN_PERIOD,
+ *    if not specified default background scan configuration
+ *    in driver is used and if period value is 0, bg scan will be disabled.
+ *    This attribute is ignored if driver does not support roam scan.
+ *    It is also sent as an event, with the BSSID and response IEs when the
+ *    connection is established or failed to be established. This can be
+ *    determined by the %NL80211_ATTR_STATUS_CODE attribute (0 = success,
+ *    non-zero = failure). If %NL80211_ATTR_TIMED_OUT is included in the
+ *    event, the connection attempt failed due to not being able to initiate
+ *    authentication/association or not receiving a response from the AP.
+ *    Non-zero %NL80211_ATTR_STATUS_CODE value is indicated in that case as
+ *    well to remain backwards compatible.
+ *    When establishing a security association, drivers that support 4 way
+ *    handshake offload should send %NL80211_CMD_PORT_AUTHORIZED event when
+ *    the 4 way handshake is completed successfully.
+ * @NL80211_CMD_ROAM: Notification indicating the card/driver roamed by itself.
+ *    When a security association was established with the new AP (e.g. if
+ *    the FT protocol was used for roaming or the driver completed the 4 way
+ *    handshake), this event should be followed by an
+ *    %NL80211_CMD_PORT_AUTHORIZED event.
+ * @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify
+ *    userspace that a connection was dropped by the AP or due to other
+ *    reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and
+ *    %NL80211_ATTR_REASON_CODE attributes are used.
+ *
+ * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices
+ *    associated with this wiphy must be down and will follow.
+ *
+ * @NL80211_CMD_REMAIN_ON_CHANNEL: Request to remain awake on the specified
+ *    channel for the specified amount of time. This can be used to do
+ *    off-channel operations like transmit a Public Action frame and wait for
+ *    a response while being associated to an AP on another channel.
+ *    %NL80211_ATTR_IFINDEX is used to specify which interface (and thus
+ *    radio) is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the
+ *    frequency for the operation.
+ *    %NL80211_ATTR_DURATION is used to specify the duration in milliseconds
+ *    to remain on the channel. This command is also used as an event to
+ *    notify when the requested duration starts (it may take a while for the
+ *    driver to schedule this time due to other concurrent needs for the
+ *    radio).
+ *    When called, this operation returns a cookie (%NL80211_ATTR_COOKIE)
+ *    that will be included with any events pertaining to this request;
+ *    the cookie is also used to cancel the request.
+ * @NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL: This command can be used to cancel a
+ *    pending remain-on-channel duration if the desired operation has been
+ *    completed prior to expiration of the originally requested duration.
+ *    %NL80211_ATTR_WIPHY or %NL80211_ATTR_IFINDEX is used to specify the
+ *    radio. The %NL80211_ATTR_COOKIE attribute must be given as well to
+ *    uniquely identify the request.
+ *    This command is also used as an event to notify when a requested
+ *    remain-on-channel duration has expired.
+ *
+ * @NL80211_CMD_SET_TX_BITRATE_MASK: Set the mask of rates to be used in TX
+ *    rate selection. %NL80211_ATTR_IFINDEX is used to specify the interface
+ *    and @NL80211_ATTR_TX_RATES the set of allowed rates.
+ *
+ * @NL80211_CMD_REGISTER_FRAME: Register for receiving certain mgmt frames
+ *    (via @NL80211_CMD_FRAME) for processing in userspace. This command
+ *    requires an interface index, a frame type attribute (optional for
+ *    backward compatibility reasons, if not given assumes action frames)
+ *    and a match attribute containing the first few bytes of the frame
+ *    that should match, e.g. a single byte for only a category match or
+ *    four bytes for vendor frames including the OUI. The registration
+ *    cannot be dropped, but is removed automatically when the netlink
+ *    socket is closed. Multiple registrations can be made.
+ * @NL80211_CMD_REGISTER_ACTION: Alias for @NL80211_CMD_REGISTER_FRAME for
+ *    backward compatibility
+ * @NL80211_CMD_FRAME: Management frame TX request and RX notification. This
+ *    command is used both as a request to transmit a management frame and
+ *    as an event indicating reception of a frame that was not processed in
+ *    kernel code, but is for us (i.e., which may need to be processed in a
+ *    user space application). %NL80211_ATTR_FRAME is used to specify the
+ *    frame contents (including header). %NL80211_ATTR_WIPHY_FREQ is used
+ *    to indicate on which channel the frame is to be transmitted or was
+ *    received. If this channel is not the current channel (remain-on-channel
+ *    or the operational channel) the device will switch to the given channel
+ *    and transmit the frame, optionally waiting for a response for the time
+ *    specified using %NL80211_ATTR_DURATION. When called, this operation
+ *    returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the
+ *    TX status event pertaining to the TX request.
+ *    %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
+ *    management frames at CCK rate or not in 2GHz band.
+ *    %NL80211_ATTR_CSA_C_OFFSETS_TX is an array of offsets to CSA
+ *    counters which will be updated to the current value. This attribute
+ *    is used during CSA period.
+ * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this
+ *    command may be used with the corresponding cookie to cancel the wait
+ *    time if it is known that it is no longer necessary.  This command is
+ *    also sent as an event whenever the driver has completed the off-channel
+ *    wait time.
+ * @NL80211_CMD_ACTION: Alias for @NL80211_CMD_FRAME for backward compatibility.
+ * @NL80211_CMD_FRAME_TX_STATUS: Report TX status of a management frame
+ *    transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies
+ *    the TX command and %NL80211_ATTR_FRAME includes the contents of the
+ *    frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged
+ *    the frame.
+ * @NL80211_CMD_ACTION_TX_STATUS: Alias for @NL80211_CMD_FRAME_TX_STATUS for
+ *    backward compatibility.
+ *
+ * @NL80211_CMD_SET_POWER_SAVE: Set powersave, using %NL80211_ATTR_PS_STATE
+ * @NL80211_CMD_GET_POWER_SAVE: Get powersave status in %NL80211_ATTR_PS_STATE
+ *
+ * @NL80211_CMD_SET_CQM: Connection quality monitor configuration. This command
+ *    is used to configure connection quality monitoring notification trigger
+ *    levels.
+ * @NL80211_CMD_NOTIFY_CQM: Connection quality monitor notification. This
+ *    command is used as an event to indicate the that a trigger level was
+ *    reached.
+ * @NL80211_CMD_SET_CHANNEL: Set the channel (using %NL80211_ATTR_WIPHY_FREQ
+ *    and the attributes determining channel width) the given interface
+ *    (identifed by %NL80211_ATTR_IFINDEX) shall operate on.
+ *    In case multiple channels are supported by the device, the mechanism
+ *    with which it switches channels is implementation-defined.
+ *    When a monitor interface is given, it can only switch channel while
+ *    no other interfaces are operating to avoid disturbing the operation
+ *    of any other interfaces, and other interfaces will again take
+ *    precedence when they are used.
+ *
+ * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface.
+ *
+ * @NL80211_CMD_SET_MULTICAST_TO_UNICAST: Configure if this AP should perform
+ *    multicast to unicast conversion. When enabled, all multicast packets
+ *    with ethertype ARP, IPv4 or IPv6 (possibly within an 802.1Q header)
+ *    will be sent out to each station once with the destination (multicast)
+ *    MAC address replaced by the station's MAC address. Note that this may
+ *    break certain expectations of the receiver, e.g. the ability to drop
+ *    unicast IP packets encapsulated in multicast L2 frames, or the ability
+ *    to not send destination unreachable messages in such cases.
+ *    This can only be toggled per BSS. Configure this on an interface of
+ *    type %NL80211_IFTYPE_AP. It applies to all its VLAN interfaces
+ *    (%NL80211_IFTYPE_AP_VLAN), except for those in 4addr (WDS) mode.
+ *    If %NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED is not present with this
+ *    command, the feature is disabled.
+ *
+ * @NL80211_CMD_JOIN_MESH: Join a mesh. The mesh ID must be given, and initial
+ *    mesh config parameters may be given.
+ * @NL80211_CMD_LEAVE_MESH: Leave the mesh network -- no special arguments, the
+ *    network is determined by the network interface.
+ *
+ * @NL80211_CMD_UNPROT_DEAUTHENTICATE: Unprotected deauthentication frame
+ *    notification. This event is used to indicate that an unprotected
+ *    deauthentication frame was dropped when MFP is in use.
+ * @NL80211_CMD_UNPROT_DISASSOCIATE: Unprotected disassociation frame
+ *    notification. This event is used to indicate that an unprotected
+ *    disassociation frame was dropped when MFP is in use.
+ *
+ * @NL80211_CMD_NEW_PEER_CANDIDATE: Notification on the reception of a
+ *    beacon or probe response from a compatible mesh peer.  This is only
+ *    sent while no station information (sta_info) exists for the new peer
+ *    candidate and when @NL80211_MESH_SETUP_USERSPACE_AUTH,
+ *    @NL80211_MESH_SETUP_USERSPACE_AMPE, or
+ *    @NL80211_MESH_SETUP_USERSPACE_MPM is set.  On reception of this
+ *    notification, userspace may decide to create a new station
+ *    (@NL80211_CMD_NEW_STATION).  To stop this notification from
+ *    reoccurring, the userspace authentication daemon may want to create the
+ *    new station with the AUTHENTICATED flag unset and maybe change it later
+ *    depending on the authentication result.
+ *
+ * @NL80211_CMD_GET_WOWLAN: get Wake-on-Wireless-LAN (WoWLAN) settings.
+ * @NL80211_CMD_SET_WOWLAN: set Wake-on-Wireless-LAN (WoWLAN) settings.
+ *    Since wireless is more complex than wired ethernet, it supports
+ *    various triggers. These triggers can be configured through this
+ *    command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For
+ *    more background information, see
+ *    http://wireless.kernel.org/en/users/Documentation/WoWLAN.
+ *    The @NL80211_CMD_SET_WOWLAN command can also be used as a notification
+ *    from the driver reporting the wakeup reason. In this case, the
+ *    @NL80211_ATTR_WOWLAN_TRIGGERS attribute will contain the reason
+ *    for the wakeup, if it was caused by wireless. If it is not present
+ *    in the wakeup notification, the wireless device didn't cause the
+ *    wakeup but reports that it was woken up.
+ *
+ * @NL80211_CMD_SET_REKEY_OFFLOAD: This command is used give the driver
+ *    the necessary information for supporting GTK rekey offload. This
+ *    feature is typically used during WoWLAN. The configuration data
+ *    is contained in %NL80211_ATTR_REKEY_DATA (which is nested and
+ *    contains the data in sub-attributes). After rekeying happened,
+ *    this command may also be sent by the driver as an MLME event to
+ *    inform userspace of the new replay counter.
+ *
+ * @NL80211_CMD_PMKSA_CANDIDATE: This is used as an event to inform userspace
+ *    of PMKSA caching dandidates.
+ *
+ * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup).
+ *    In addition, this can be used as an event to request userspace to take
+ *    actions on TDLS links (set up a new link or tear down an existing one).
+ *    In such events, %NL80211_ATTR_TDLS_OPERATION indicates the requested
+ *    operation, %NL80211_ATTR_MAC contains the peer MAC address, and
+ *    %NL80211_ATTR_REASON_CODE the reason code to be used (only with
+ *    %NL80211_TDLS_TEARDOWN).
+ * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame. The
+ *    %NL80211_ATTR_TDLS_ACTION attribute determines the type of frame to be
+ *    sent. Public Action codes (802.11-2012 8.1.5.1) will be sent as
+ *    802.11 management frames, while TDLS action codes (802.11-2012
+ *    8.5.13.1) will be encapsulated and sent as data frames. The currently
+ *    supported Public Action code is %WLAN_PUB_ACTION_TDLS_DISCOVER_RES
+ *    and the currently supported TDLS actions codes are given in
+ *    &enum ieee80211_tdls_actioncode.
+ *
+ * @NL80211_CMD_UNEXPECTED_FRAME: Used by an application controlling an AP
+ *    (or GO) interface (i.e. hostapd) to ask for unexpected frames to
+ *    implement sending deauth to stations that send unexpected class 3
+ *    frames. Also used as the event sent by the kernel when such a frame
+ *    is received.
+ *    For the event, the %NL80211_ATTR_MAC attribute carries the TA and
+ *    other attributes like the interface index are present.
+ *    If used as the command it must have an interface index and you can
+ *    only unsubscribe from the event by closing the socket. Subscription
+ *    is also for %NL80211_CMD_UNEXPECTED_4ADDR_FRAME events.
+ *
+ * @NL80211_CMD_UNEXPECTED_4ADDR_FRAME: Sent as an event indicating that the
+ *    associated station identified by %NL80211_ATTR_MAC sent a 4addr frame
+ *    and wasn't already in a 4-addr VLAN. The event will be sent similarly
+ *    to the %NL80211_CMD_UNEXPECTED_FRAME event, to the same listener.
+ *
+ * @NL80211_CMD_PROBE_CLIENT: Probe an associated station on an AP interface
+ *    by sending a null data frame to it and reporting when the frame is
+ *    acknowleged. This is used to allow timing out inactive clients. Uses
+ *    %NL80211_ATTR_IFINDEX and %NL80211_ATTR_MAC. The command returns a
+ *    direct reply with an %NL80211_ATTR_COOKIE that is later used to match
+ *    up the event with the request. The event includes the same data and
+ *    has %NL80211_ATTR_ACK set if the frame was ACKed.
+ *
+ * @NL80211_CMD_REGISTER_BEACONS: Register this socket to receive beacons from
+ *    other BSSes when any interfaces are in AP mode. This helps implement
+ *    OLBC handling in hostapd. Beacons are reported in %NL80211_CMD_FRAME
+ *    messages. Note that per PHY only one application may register.
+ *
+ * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether
+ *    No Acknowledgement Policy should be applied.
+ *
+ * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels
+ *    independently of the userspace SME, send this event indicating
+ *    %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ and the
+ *    attributes determining channel width.  This indication may also be
+ *    sent when a remotely-initiated switch (e.g., when a STA receives a CSA
+ *    from the remote AP) is completed;
+ *
+ * @NL80211_CMD_CH_SWITCH_STARTED_NOTIFY: Notify that a channel switch
+ *    has been started on an interface, regardless of the initiator
+ *    (ie. whether it was requested from a remote device or
+ *    initiated on our own).  It indicates that
+ *    %NL80211_ATTR_IFINDEX will be on %NL80211_ATTR_WIPHY_FREQ
+ *    after %NL80211_ATTR_CH_SWITCH_COUNT TBTT's.  The userspace may
+ *    decide to react to this indication by requesting other
+ *    interfaces to change channel as well.
+ *
+ * @NL80211_CMD_START_P2P_DEVICE: Start the given P2P Device, identified by
+ *    its %NL80211_ATTR_WDEV identifier. It must have been created with
+ *    %NL80211_CMD_NEW_INTERFACE previously. After it has been started, the
+ *    P2P Device can be used for P2P operations, e.g. remain-on-channel and
+ *    public action frame TX.
+ * @NL80211_CMD_STOP_P2P_DEVICE: Stop the given P2P Device, identified by
+ *    its %NL80211_ATTR_WDEV identifier.
+ *
+ * @NL80211_CMD_CONN_FAILED: connection request to an AP failed; used to
+ *    notify userspace that AP has rejected the connection request from a
+ *    station, due to particular reason. %NL80211_ATTR_CONN_FAILED_REASON
+ *    is used for this.
+ *
+ * @NL80211_CMD_SET_MCAST_RATE: Change the rate used to send multicast frames
+ *    for IBSS or MESH vif.
+ *
+ * @NL80211_CMD_SET_MAC_ACL: sets ACL for MAC address based access control.
+ *    This is to be used with the drivers advertising the support of MAC
+ *    address based access control. List of MAC addresses is passed in
+ *    %NL80211_ATTR_MAC_ADDRS and ACL policy is passed in
+ *    %NL80211_ATTR_ACL_POLICY. Driver will enable ACL with this list, if it
+ *    is not already done. The new list will replace any existing list. Driver
+ *    will clear its ACL when the list of MAC addresses passed is empty. This
+ *    command is used in AP/P2P GO mode. Driver has to make sure to clear its
+ *    ACL list during %NL80211_CMD_STOP_AP.
+ *
+ * @NL80211_CMD_RADAR_DETECT: Start a Channel availability check (CAC). Once
+ *    a radar is detected or the channel availability scan (CAC) has finished
+ *    or was aborted, or a radar was detected, usermode will be notified with
+ *    this event. This command is also used to notify userspace about radars
+ *    while operating on this channel.
+ *    %NL80211_ATTR_RADAR_EVENT is used to inform about the type of the
+ *    event.
+ *
+ * @NL80211_CMD_GET_PROTOCOL_FEATURES: Get global nl80211 protocol features,
+ *    i.e. features for the nl80211 protocol rather than device features.
+ *    Returns the features in the %NL80211_ATTR_PROTOCOL_FEATURES bitmap.
+ *
+ * @NL80211_CMD_UPDATE_FT_IES: Pass down the most up-to-date Fast Transition
+ *    Information Element to the WLAN driver
+ *
+ * @NL80211_CMD_FT_EVENT: Send a Fast transition event from the WLAN driver
+ *    to the supplicant. This will carry the target AP's MAC address along
+ *    with the relevant Information Elements. This event is used to report
+ *    received FT IEs (MDIE, FTIE, RSN IE, TIE, RICIE).
+ *
+ * @NL80211_CMD_CRIT_PROTOCOL_START: Indicates user-space will start running
+ *    a critical protocol that needs more reliability in the connection to
+ *    complete.
+ *
+ * @NL80211_CMD_CRIT_PROTOCOL_STOP: Indicates the connection reliability can
+ *    return back to normal.
+ *
+ * @NL80211_CMD_GET_COALESCE: Get currently supported coalesce rules.
+ * @NL80211_CMD_SET_COALESCE: Configure coalesce rules or clear existing rules.
+ *
+ * @NL80211_CMD_CHANNEL_SWITCH: Perform a channel switch by announcing the
+ *    the new channel information (Channel Switch Announcement - CSA)
+ *    in the beacon for some time (as defined in the
+ *    %NL80211_ATTR_CH_SWITCH_COUNT parameter) and then change to the
+ *    new channel. Userspace provides the new channel information (using
+ *    %NL80211_ATTR_WIPHY_FREQ and the attributes determining channel
+ *    width). %NL80211_ATTR_CH_SWITCH_BLOCK_TX may be supplied to inform
+ *    other station that transmission must be blocked until the channel
+ *    switch is complete.
+ *
+ * @NL80211_CMD_VENDOR: Vendor-specified command/event. The command is specified
+ *    by the %NL80211_ATTR_VENDOR_ID attribute and a sub-command in
+ *    %NL80211_ATTR_VENDOR_SUBCMD. Parameter(s) can be transported in
+ *    %NL80211_ATTR_VENDOR_DATA.
+ *    For feature advertisement, the %NL80211_ATTR_VENDOR_DATA attribute is
+ *    used in the wiphy data as a nested attribute containing descriptions
+ *    (&struct nl80211_vendor_cmd_info) of the supported vendor commands.
+ *    This may also be sent as an event with the same attributes.
+ *
+ * @NL80211_CMD_SET_QOS_MAP: Set Interworking QoS mapping for IP DSCP values.
+ *    The QoS mapping information is included in %NL80211_ATTR_QOS_MAP. If
+ *    that attribute is not included, QoS mapping is disabled. Since this
+ *    QoS mapping is relevant for IP packets, it is only valid during an
+ *    association. This is cleared on disassociation and AP restart.
+ *
+ * @NL80211_CMD_ADD_TX_TS: Ask the kernel to add a traffic stream for the given
+ *    %NL80211_ATTR_TSID and %NL80211_ATTR_MAC with %NL80211_ATTR_USER_PRIO
+ *    and %NL80211_ATTR_ADMITTED_TIME parameters.
+ *    Note that the action frame handshake with the AP shall be handled by
+ *    userspace via the normal management RX/TX framework, this only sets
+ *    up the TX TS in the driver/device.
+ *    If the admitted time attribute is not added then the request just checks
+ *    if a subsequent setup could be successful, the intent is to use this to
+ *    avoid setting up a session with the AP when local restrictions would
+ *    make that impossible. However, the subsequent "real" setup may still
+ *    fail even if the check was successful.
+ * @NL80211_CMD_DEL_TX_TS: Remove an existing TS with the %NL80211_ATTR_TSID
+ *    and %NL80211_ATTR_MAC parameters. It isn't necessary to call this
+ *    before removing a station entry entirely, or before disassociating
+ *    or similar, cleanup will happen in the driver/device in this case.
+ *
+ * @NL80211_CMD_GET_MPP: Get mesh path attributes for mesh proxy path to
+ *    destination %NL80211_ATTR_MAC on the interface identified by
+ *    %NL80211_ATTR_IFINDEX.
+ *
+ * @NL80211_CMD_JOIN_OCB: Join the OCB network. The center frequency and
+ *    bandwidth of a channel must be given.
+ * @NL80211_CMD_LEAVE_OCB: Leave the OCB network -- no special arguments, the
+ *    network is determined by the network interface.
+ *
+ * @NL80211_CMD_TDLS_CHANNEL_SWITCH: Start channel-switching with a TDLS peer,
+ *    identified by the %NL80211_ATTR_MAC parameter. A target channel is
+ *    provided via %NL80211_ATTR_WIPHY_FREQ and other attributes determining
+ *    channel width/type. The target operating class is given via
+ *    %NL80211_ATTR_OPER_CLASS.
+ *    The driver is responsible for continually initiating channel-switching
+ *    operations and returning to the base channel for communication with the
+ *    AP.
+ * @NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH: Stop channel-switching with a TDLS
+ *    peer given by %NL80211_ATTR_MAC. Both peers must be on the base channel
+ *    when this command completes.
+ *
+ * @NL80211_CMD_WIPHY_REG_CHANGE: Similar to %NL80211_CMD_REG_CHANGE, but used
+ *    as an event to indicate changes for devices with wiphy-specific regdom
+ *    management.
+ *
+ * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is
+ *    not running. The driver indicates the status of the scan through
+ *    cfg80211_scan_done().
+ *
+ * @NL80211_CMD_START_NAN: Start NAN operation, identified by its
+ *    %NL80211_ATTR_WDEV interface. This interface must have been
+ *    previously created with %NL80211_CMD_NEW_INTERFACE. After it
+ *    has been started, the NAN interface will create or join a
+ *    cluster. This command must have a valid
+ *    %NL80211_ATTR_NAN_MASTER_PREF attribute and optional
+ *    %NL80211_ATTR_BANDS attributes.  If %NL80211_ATTR_BANDS is
+ *    omitted or set to 0, it means don't-care and the device will
+ *    decide what to use.  After this command NAN functions can be
+ *    added.
+ * @NL80211_CMD_STOP_NAN: Stop the NAN operation, identified by
+ *    its %NL80211_ATTR_WDEV interface.
+ * @NL80211_CMD_ADD_NAN_FUNCTION: Add a NAN function. The function is defined
+ *    with %NL80211_ATTR_NAN_FUNC nested attribute. When called, this
+ *    operation returns the strictly positive and unique instance id
+ *    (%NL80211_ATTR_NAN_FUNC_INST_ID) and a cookie (%NL80211_ATTR_COOKIE)
+ *    of the function upon success.
+ *    Since instance ID's can be re-used, this cookie is the right
+ *    way to identify the function. This will avoid races when a termination
+ *    event is handled by the user space after it has already added a new
+ *    function that got the same instance id from the kernel as the one
+ *    which just terminated.
+ *    This cookie may be used in NAN events even before the command
+ *    returns, so userspace shouldn't process NAN events until it processes
+ *    the response to this command.
+ *    Look at %NL80211_ATTR_SOCKET_OWNER as well.
+ * @NL80211_CMD_DEL_NAN_FUNCTION: Delete a NAN function by cookie.
+ *    This command is also used as a notification sent when a NAN function is
+ *    terminated. This will contain a %NL80211_ATTR_NAN_FUNC_INST_ID
+ *    and %NL80211_ATTR_COOKIE attributes.
+ * @NL80211_CMD_CHANGE_NAN_CONFIG: Change current NAN
+ *    configuration. NAN must be operational (%NL80211_CMD_START_NAN
+ *    was executed).  It must contain at least one of the following
+ *    attributes: %NL80211_ATTR_NAN_MASTER_PREF,
+ *    %NL80211_ATTR_BANDS.  If %NL80211_ATTR_BANDS is omitted, the
+ *    current configuration is not changed.  If it is present but
+ *    set to zero, the configuration is changed to don't-care
+ *    (i.e. the device can decide what to do).
+ * @NL80211_CMD_NAN_FUNC_MATCH: Notification sent when a match is reported.
+ *    This will contain a %NL80211_ATTR_NAN_MATCH nested attribute and
+ *    %NL80211_ATTR_COOKIE.
+ *
+ * @NL80211_CMD_UPDATE_CONNECT_PARAMS: Update one or more connect parameters
+ *    for subsequent roaming cases if the driver or firmware uses internal
+ *    BSS selection. This command can be issued only while connected and it
+ *    does not result in a change for the current association. Currently,
+ *    only the %NL80211_ATTR_IE data is used and updated with this command.
+ *
+ * @NL80211_CMD_SET_PMK: For offloaded 4-Way handshake, set the PMK or PMK-R0
+ *    for the given authenticator address (specified with %NL80211_ATTR_MAC).
+ *    When %NL80211_ATTR_PMKR0_NAME is set, %NL80211_ATTR_PMK specifies the
+ *    PMK-R0, otherwise it specifies the PMK.
+ * @NL80211_CMD_DEL_PMK: For offloaded 4-Way handshake, delete the previously
+ *    configured PMK for the authenticator address identified by
+ *    %NL80211_ATTR_MAC.
+ * @NL80211_CMD_PORT_AUTHORIZED: An event that indicates that the 4 way
+ *    handshake was completed successfully by the driver. The BSSID is
+ *    specified with %NL80211_ATTR_MAC. Drivers that support 4 way handshake
+ *    offload should send this event after indicating 802.11 association with
+ *    %NL80211_CMD_CONNECT or %NL80211_CMD_ROAM. If the 4 way handshake failed
+ *    %NL80211_CMD_DISCONNECT should be indicated instead.
+ *
+ * @NL80211_CMD_CONTROL_PORT_FRAME: Control Port (e.g. PAE) frame TX request
+ *    and RX notification.  This command is used both as a request to transmit
+ *    a control port frame and as a notification that a control port frame
+ *    has been received. %NL80211_ATTR_FRAME is used to specify the
+ *    frame contents.  The frame is the raw EAPoL data, without ethernet or
+ *    802.11 headers.
+ *    When used as an event indication %NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
+ *    %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT and %NL80211_ATTR_MAC are added
+ *    indicating the protocol type of the received frame; whether the frame
+ *    was received unencrypted and the MAC address of the peer respectively.
+ *
+ * @NL80211_CMD_RELOAD_REGDB: Request that the regdb firmware file is reloaded.
+ *
+ * @NL80211_CMD_EXTERNAL_AUTH: This interface is exclusively defined for host
+ *    drivers that do not define separate commands for authentication and
+ *    association, but rely on user space for the authentication to happen.
+ *    This interface acts both as the event request (driver to user space)
+ *    to trigger the authentication and command response (userspace to
+ *    driver) to indicate the authentication status.
+ *
+ *    User space uses the %NL80211_CMD_CONNECT command to the host driver to
+ *    trigger a connection. The host driver selects a BSS and further uses
+ *    this interface to offload only the authentication part to the user
+ *    space. Authentication frames are passed between the driver and user
+ *    space through the %NL80211_CMD_FRAME interface. Host driver proceeds
+ *    further with the association after getting successful authentication
+ *    status. User space indicates the authentication status through
+ *    %NL80211_ATTR_STATUS_CODE attribute in %NL80211_CMD_EXTERNAL_AUTH
+ *    command interface.
+ *
+ *    Host driver reports this status on an authentication failure to the
+ *    user space through the connect result as the user space would have
+ *    initiated the connection through the connect request.
+ *
+ * @NL80211_CMD_STA_OPMODE_CHANGED: An event that notify station's
+ *    ht opmode or vht opmode changes using any of %NL80211_ATTR_SMPS_MODE,
+ *    %NL80211_ATTR_CHANNEL_WIDTH,%NL80211_ATTR_NSS attributes with its
+ *    address(specified in %NL80211_ATTR_MAC).
+ *
+ * @NL80211_CMD_GET_FTM_RESPONDER_STATS: Retrieve FTM responder statistics, in
+ *    the %NL80211_ATTR_FTM_RESPONDER_STATS attribute.
+ *
+ * @NL80211_CMD_PEER_MEASUREMENT_START: start a (set of) peer measurement(s)
+ *    with the given parameters, which are encapsulated in the nested
+ *    %NL80211_ATTR_PEER_MEASUREMENTS attribute. Optionally, MAC address
+ *    randomization may be enabled and configured by specifying the
+ *    %NL80211_ATTR_MAC and %NL80211_ATTR_MAC_MASK attributes.
+ *    If a timeout is requested, use the %NL80211_ATTR_TIMEOUT attribute.
+ *    A u64 cookie for further %NL80211_ATTR_COOKIE use is is returned in
+ *    the netlink extended ack message.
+ *
+ *    To cancel a measurement, close the socket that requested it.
+ *
+ *    Measurement results are reported to the socket that requested the
+ *    measurement using @NL80211_CMD_PEER_MEASUREMENT_RESULT when they
+ *    become available, so applications must ensure a large enough socket
+ *    buffer size.
+ *
+ *    Depending on driver support it may or may not be possible to start
+ *    multiple concurrent measurements.
+ * @NL80211_CMD_PEER_MEASUREMENT_RESULT: This command number is used for the
+ *    result notification from the driver to the requesting socket.
+ * @NL80211_CMD_PEER_MEASUREMENT_COMPLETE: Notification only, indicating that
+ *    the measurement completed, using the measurement cookie
+ *    (%NL80211_ATTR_COOKIE).
+ *
+ * @NL80211_CMD_NOTIFY_RADAR: Notify the kernel that a radar signal was
+ *    detected and reported by a neighboring device on the channel
+ *    indicated by %NL80211_ATTR_WIPHY_FREQ and other attributes
+ *    determining the width and type.
+ *
+ * @NL80211_CMD_UPDATE_OWE_INFO: This interface allows the host driver to
+ *    offload OWE processing to user space. This intends to support
+ *    OWE AKM by the host drivers that implement SME but rely
+ *    on the user space for the cryptographic/DH IE processing in AP mode.
+ *
+ * @NL80211_CMD_PROBE_MESH_LINK: The requirement for mesh link metric
+ *    refreshing, is that from one mesh point we be able to send some data
+ *    frames to other mesh points which are not currently selected as a
+ *    primary traffic path, but which are only 1 hop away. The absence of
+ *    the primary path to the chosen node makes it necessary to apply some
+ *    form of marking on a chosen packet stream so that the packets can be
+ *    properly steered to the selected node for testing, and not by the
+ *    regular mesh path lookup. Further, the packets must be of type data
+ *    so that the rate control (often embedded in firmware) is used for
+ *    rate selection.
+ *
+ *    Here attribute %NL80211_ATTR_MAC is used to specify connected mesh
+ *    peer MAC address and %NL80211_ATTR_FRAME is used to specify the frame
+ *    content. The frame is ethernet data.
+ *
+ * @NL80211_CMD_MAX: highest used command number
+ * @__NL80211_CMD_AFTER_LAST: internal use
+ */
+enum nl80211_commands {
+/* don't change the order or add anything between, this is ABI! */
+    NL80211_CMD_UNSPEC,
+
+    NL80211_CMD_GET_WIPHY,        /* can dump */
+    NL80211_CMD_SET_WIPHY,
+    NL80211_CMD_NEW_WIPHY,
+    NL80211_CMD_DEL_WIPHY,
+
+    NL80211_CMD_GET_INTERFACE,    /* can dump */
+    NL80211_CMD_SET_INTERFACE,
+    NL80211_CMD_NEW_INTERFACE,
+    NL80211_CMD_DEL_INTERFACE,
+
+    NL80211_CMD_GET_KEY,
+    NL80211_CMD_SET_KEY,
+    NL80211_CMD_NEW_KEY,
+    NL80211_CMD_DEL_KEY,
+
+    NL80211_CMD_GET_BEACON,
+    NL80211_CMD_SET_BEACON,
+    NL80211_CMD_START_AP,
+    NL80211_CMD_NEW_BEACON = NL80211_CMD_START_AP,
+    NL80211_CMD_STOP_AP,
+    NL80211_CMD_DEL_BEACON = NL80211_CMD_STOP_AP,
+
+    NL80211_CMD_GET_STATION,
+    NL80211_CMD_SET_STATION,
+    NL80211_CMD_NEW_STATION,
+    NL80211_CMD_DEL_STATION,
+
+    NL80211_CMD_GET_MPATH,
+    NL80211_CMD_SET_MPATH,
+    NL80211_CMD_NEW_MPATH,
+    NL80211_CMD_DEL_MPATH,
+
+    NL80211_CMD_SET_BSS,
+
+    NL80211_CMD_SET_REG,
+    NL80211_CMD_REQ_SET_REG,
+
+    NL80211_CMD_GET_MESH_CONFIG,
+    NL80211_CMD_SET_MESH_CONFIG,
+
+    NL80211_CMD_SET_MGMT_EXTRA_IE /* reserved; not used */,
+
+    NL80211_CMD_GET_REG,
+
+    NL80211_CMD_GET_SCAN,
+    NL80211_CMD_TRIGGER_SCAN,
+    NL80211_CMD_NEW_SCAN_RESULTS,
+    NL80211_CMD_SCAN_ABORTED,
+
+    NL80211_CMD_REG_CHANGE,
+
+    NL80211_CMD_AUTHENTICATE,
+    NL80211_CMD_ASSOCIATE,
+    NL80211_CMD_DEAUTHENTICATE,
+    NL80211_CMD_DISASSOCIATE,
+
+    NL80211_CMD_MICHAEL_MIC_FAILURE,
+
+    NL80211_CMD_REG_BEACON_HINT,
+
+    NL80211_CMD_JOIN_IBSS,
+    NL80211_CMD_LEAVE_IBSS,
+
+    NL80211_CMD_TESTMODE,
+
+    NL80211_CMD_CONNECT,
+    NL80211_CMD_ROAM,
+    NL80211_CMD_DISCONNECT,
+
+    NL80211_CMD_SET_WIPHY_NETNS,
+
+    NL80211_CMD_GET_SURVEY,
+    NL80211_CMD_NEW_SURVEY_RESULTS,
+
+    NL80211_CMD_SET_PMKSA,
+    NL80211_CMD_DEL_PMKSA,
+    NL80211_CMD_FLUSH_PMKSA,
+
+    NL80211_CMD_REMAIN_ON_CHANNEL,
+    NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL,
+
+    NL80211_CMD_SET_TX_BITRATE_MASK,
+
+    NL80211_CMD_REGISTER_FRAME,
+    NL80211_CMD_REGISTER_ACTION = NL80211_CMD_REGISTER_FRAME,
+    NL80211_CMD_FRAME,
+    NL80211_CMD_ACTION = NL80211_CMD_FRAME,
+    NL80211_CMD_FRAME_TX_STATUS,
+    NL80211_CMD_ACTION_TX_STATUS = NL80211_CMD_FRAME_TX_STATUS,
+
+    NL80211_CMD_SET_POWER_SAVE,
+    NL80211_CMD_GET_POWER_SAVE,
+
+    NL80211_CMD_SET_CQM,
+    NL80211_CMD_NOTIFY_CQM,
+
+    NL80211_CMD_SET_CHANNEL,
+    NL80211_CMD_SET_WDS_PEER,
+
+    NL80211_CMD_FRAME_WAIT_CANCEL,
+
+    NL80211_CMD_JOIN_MESH,
+    NL80211_CMD_LEAVE_MESH,
+
+    NL80211_CMD_UNPROT_DEAUTHENTICATE,
+    NL80211_CMD_UNPROT_DISASSOCIATE,
+
+    NL80211_CMD_NEW_PEER_CANDIDATE,
+
+    NL80211_CMD_GET_WOWLAN,
+    NL80211_CMD_SET_WOWLAN,
+
+    NL80211_CMD_START_SCHED_SCAN,
+    NL80211_CMD_STOP_SCHED_SCAN,
+    NL80211_CMD_SCHED_SCAN_RESULTS,
+    NL80211_CMD_SCHED_SCAN_STOPPED,
+
+    NL80211_CMD_SET_REKEY_OFFLOAD,
+
+    NL80211_CMD_PMKSA_CANDIDATE,
+
+    NL80211_CMD_TDLS_OPER,
+    NL80211_CMD_TDLS_MGMT,
+
+    NL80211_CMD_UNEXPECTED_FRAME,
+
+    NL80211_CMD_PROBE_CLIENT,
+
+    NL80211_CMD_REGISTER_BEACONS,
+
+    NL80211_CMD_UNEXPECTED_4ADDR_FRAME,
+
+    NL80211_CMD_SET_NOACK_MAP,
+
+    NL80211_CMD_CH_SWITCH_NOTIFY,
+
+    NL80211_CMD_START_P2P_DEVICE,
+    NL80211_CMD_STOP_P2P_DEVICE,
+
+    NL80211_CMD_CONN_FAILED,
+
+    NL80211_CMD_SET_MCAST_RATE,
+
+    NL80211_CMD_SET_MAC_ACL,
+
+    NL80211_CMD_RADAR_DETECT,
+
+    NL80211_CMD_GET_PROTOCOL_FEATURES,
+
+    NL80211_CMD_UPDATE_FT_IES,
+    NL80211_CMD_FT_EVENT,
+
+    NL80211_CMD_CRIT_PROTOCOL_START,
+    NL80211_CMD_CRIT_PROTOCOL_STOP,
+
+    NL80211_CMD_GET_COALESCE,
+    NL80211_CMD_SET_COALESCE,
+
+    NL80211_CMD_CHANNEL_SWITCH,
+
+    NL80211_CMD_VENDOR,
+
+    NL80211_CMD_SET_QOS_MAP,
+
+    NL80211_CMD_ADD_TX_TS,
+    NL80211_CMD_DEL_TX_TS,
+
+    NL80211_CMD_GET_MPP,
+
+    NL80211_CMD_JOIN_OCB,
+    NL80211_CMD_LEAVE_OCB,
+
+    NL80211_CMD_CH_SWITCH_STARTED_NOTIFY,
+
+    NL80211_CMD_TDLS_CHANNEL_SWITCH,
+    NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH,
+
+    NL80211_CMD_WIPHY_REG_CHANGE,
+
+    NL80211_CMD_ABORT_SCAN,
+
+    NL80211_CMD_START_NAN,
+    NL80211_CMD_STOP_NAN,
+    NL80211_CMD_ADD_NAN_FUNCTION,
+    NL80211_CMD_DEL_NAN_FUNCTION,
+    NL80211_CMD_CHANGE_NAN_CONFIG,
+    NL80211_CMD_NAN_MATCH,
+
+    NL80211_CMD_SET_MULTICAST_TO_UNICAST,
+
+    NL80211_CMD_UPDATE_CONNECT_PARAMS,
+
+    NL80211_CMD_SET_PMK,
+    NL80211_CMD_DEL_PMK,
+
+    NL80211_CMD_PORT_AUTHORIZED,
+
+    NL80211_CMD_RELOAD_REGDB,
+
+    NL80211_CMD_EXTERNAL_AUTH,
+
+    NL80211_CMD_STA_OPMODE_CHANGED,
+
+    NL80211_CMD_CONTROL_PORT_FRAME,
+
+    NL80211_CMD_GET_FTM_RESPONDER_STATS,
+
+    NL80211_CMD_PEER_MEASUREMENT_START,
+    NL80211_CMD_PEER_MEASUREMENT_RESULT,
+    NL80211_CMD_PEER_MEASUREMENT_COMPLETE,
+
+    NL80211_CMD_NOTIFY_RADAR,
+
+    NL80211_CMD_UPDATE_OWE_INFO,
+
+    NL80211_CMD_PROBE_MESH_LINK,
+
+    /* add new commands above here */
+
+    /* used to define NL80211_CMD_MAX below */
+    __NL80211_CMD_AFTER_LAST,
+    NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
+};
+
+/*
+ * Allow user space programs to use #ifdef on new commands by defining them
+ * here
+ */
+#define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS
+#define NL80211_CMD_SET_MGMT_EXTRA_IE NL80211_CMD_SET_MGMT_EXTRA_IE
+#define NL80211_CMD_REG_CHANGE NL80211_CMD_REG_CHANGE
+#define NL80211_CMD_AUTHENTICATE NL80211_CMD_AUTHENTICATE
+#define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE
+#define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE
+#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE
+#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT
+
+#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
+
+/* source-level API compatibility */
+#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG
+#define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG
+#define NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE NL80211_MESH_SETUP_IE
+
+/**
+ * enum nl80211_attrs - nl80211 netlink attributes
+ *
+ * @NL80211_ATTR_UNSPEC: unspecified attribute to catch errors
+ *
+ * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf.
+ *    /sys/class/ieee80211/<phyname>/index
+ * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming)
+ * @NL80211_ATTR_WIPHY_TXQ_PARAMS: a nested array of TX queue parameters
+ * @NL80211_ATTR_WIPHY_FREQ: frequency of the selected channel in MHz,
+ *    defines the channel together with the (deprecated)
+ *    %NL80211_ATTR_WIPHY_CHANNEL_TYPE attribute or the attributes
+ *    %NL80211_ATTR_CHANNEL_WIDTH and if needed %NL80211_ATTR_CENTER_FREQ1
+ *    and %NL80211_ATTR_CENTER_FREQ2
+ * @NL80211_ATTR_CHANNEL_WIDTH: u32 attribute containing one of the values
+ *    of &enum nl80211_chan_width, describing the channel width. See the
+ *    documentation of the enum for more information.
+ * @NL80211_ATTR_CENTER_FREQ1: Center frequency of the first part of the
+ *    channel, used for anything but 20 MHz bandwidth
+ * @NL80211_ATTR_CENTER_FREQ2: Center frequency of the second part of the
+ *    channel, used only for 80+80 MHz bandwidth
+ * @NL80211_ATTR_WIPHY_CHANNEL_TYPE: included with NL80211_ATTR_WIPHY_FREQ
+ *    if HT20 or HT40 are to be used (i.e., HT disabled if not included):
+ *    NL80211_CHAN_NO_HT = HT not allowed (i.e., same as not including
+ *        this attribute)
+ *    NL80211_CHAN_HT20 = HT20 only
+ *    NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel
+ *    NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel
+ *    This attribute is now deprecated.
+ * @NL80211_ATTR_WIPHY_RETRY_SHORT: TX retry limit for frames whose length is
+ *    less than or equal to the RTS threshold; allowed range: 1..255;
+ *    dot11ShortRetryLimit; u8
+ * @NL80211_ATTR_WIPHY_RETRY_LONG: TX retry limit for frames whose length is
+ *    greater than the RTS threshold; allowed range: 1..255;
+ *    dot11ShortLongLimit; u8
+ * @NL80211_ATTR_WIPHY_FRAG_THRESHOLD: fragmentation threshold, i.e., maximum
+ *    length in octets for frames; allowed range: 256..8000, disable
+ *    fragmentation with (u32)-1; dot11FragmentationThreshold; u32
+ * @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length
+ *    larger than or equal to this use RTS/CTS handshake); allowed range:
+ *    0..65536, disable with (u32)-1; dot11RTSThreshold; u32
+ * @NL80211_ATTR_WIPHY_COVERAGE_CLASS: Coverage Class as defined by IEEE 802.11
+ *    section 7.3.2.9; dot11CoverageClass; u8
+ *
+ * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on
+ * @NL80211_ATTR_IFNAME: network interface name
+ * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype
+ *
+ * @NL80211_ATTR_WDEV: wireless device identifier, used for pseudo-devices
+ *    that don't have a netdev (u64)
+ *
+ * @NL80211_ATTR_MAC: MAC address (various uses)
+ *
+ * @NL80211_ATTR_KEY_DATA: (temporal) key data; for TKIP this consists of
+ *    16 bytes encryption key followed by 8 bytes each for TX and RX MIC
+ *    keys
+ * @NL80211_ATTR_KEY_IDX: key ID (u8, 0-3)
+ * @NL80211_ATTR_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11
+ *    section 7.3.2.25.1, e.g. 0x000FAC04)
+ * @NL80211_ATTR_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and
+ *    CCMP keys, each six bytes in little endian
+ * @NL80211_ATTR_KEY_DEFAULT: Flag attribute indicating the key is default key
+ * @NL80211_ATTR_KEY_DEFAULT_MGMT: Flag attribute indicating the key is the
+ *    default management key
+ * @NL80211_ATTR_CIPHER_SUITES_PAIRWISE: For crypto settings for connect or
+ *    other commands, indicates which pairwise cipher suites are used
+ * @NL80211_ATTR_CIPHER_SUITE_GROUP: For crypto settings for connect or
+ *    other commands, indicates which group cipher suite is used
+ *
+ * @NL80211_ATTR_BEACON_INTERVAL: beacon interval in TU
+ * @NL80211_ATTR_DTIM_PERIOD: DTIM period for beaconing
+ * @NL80211_ATTR_BEACON_HEAD: portion of the beacon before the TIM IE
+ * @NL80211_ATTR_BEACON_TAIL: portion of the beacon after the TIM IE
+ *
+ * @NL80211_ATTR_STA_AID: Association ID for the station (u16)
+ * @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of
+ *    &enum nl80211_sta_flags (deprecated, use %NL80211_ATTR_STA_FLAGS2)
+ * @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by
+ *    IEEE 802.11 7.3.1.6 (u16).
+ * @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported
+ *    rates as defined by IEEE 802.11 7.3.2.2 but without the length
+ *    restriction (at most %NL80211_MAX_SUPP_RATES).
+ * @NL80211_ATTR_STA_VLAN: interface index of VLAN interface to move station
+ *    to, or the AP interface the station was originally added to to.
+ * @NL80211_ATTR_STA_INFO: information about a station, part of station info
+ *    given for %NL80211_CMD_GET_STATION, nested attribute containing
+ *    info as possible, see &enum nl80211_sta_info.
+ *
+ * @NL80211_ATTR_WIPHY_BANDS: Information about an operating bands,
+ *    consisting of a nested array.
+ *
+ * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes).
+ * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link
+ *    (see &enum nl80211_plink_action).
+ * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path.
+ * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path
+ *    info given for %NL80211_CMD_GET_MPATH, nested attribute described at
+ *    &enum nl80211_mpath_info.
+ *
+ * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of
+ *    &enum nl80211_mntr_flags.
+ *
+ * @NL80211_ATTR_REG_ALPHA2: an ISO-3166-alpha2 country code for which the
+ *    current regulatory domain should be set to or is already set to.
+ *    For example, 'CR', for Costa Rica. This attribute is used by the kernel
+ *    to query the CRDA to retrieve one regulatory domain. This attribute can
+ *    also be used by userspace to query the kernel for the currently set
+ *    regulatory domain. We chose an alpha2 as that is also used by the
+ *    IEEE-802.11 country information element to identify a country.
+ *    Users can also simply ask the wireless core to set regulatory domain
+ *    to a specific alpha2.
+ * @NL80211_ATTR_REG_RULES: a nested array of regulatory domain regulatory
+ *    rules.
+ *
+ * @NL80211_ATTR_BSS_CTS_PROT: whether CTS protection is enabled (u8, 0 or 1)
+ * @NL80211_ATTR_BSS_SHORT_PREAMBLE: whether short preamble is enabled
+ *    (u8, 0 or 1)
+ * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled
+ *    (u8, 0 or 1)
+ * @NL80211_ATTR_BSS_BASIC_RATES: basic rates, array of basic
+ *    rates in format defined by IEEE 802.11 7.3.2.2 but without the length
+ *    restriction (at most %NL80211_MAX_SUPP_RATES).
+ *
+ * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from
+ *    association request when used with NL80211_CMD_NEW_STATION)
+ *
+ * @NL80211_ATTR_SUPPORTED_IFTYPES: nested attribute containing all
+ *    supported interface types, each a flag attribute with the number
+ *    of the interface mode.
+ *
+ * @NL80211_ATTR_MGMT_SUBTYPE: Management frame subtype for
+ *    %NL80211_CMD_SET_MGMT_EXTRA_IE.
+ *
+ * @NL80211_ATTR_IE: Information element(s) data (used, e.g., with
+ *    %NL80211_CMD_SET_MGMT_EXTRA_IE).
+ *
+ * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with
+ *    a single scan request, a wiphy attribute.
+ * @NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS: number of SSIDs you can
+ *    scan with a single scheduled scan request, a wiphy attribute.
+ * @NL80211_ATTR_MAX_SCAN_IE_LEN: maximum length of information elements
+ *    that can be added to a scan request
+ * @NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN: maximum length of information
+ *    elements that can be added to a scheduled scan request
+ * @NL80211_ATTR_MAX_MATCH_SETS: maximum number of sets that can be
+ *    used with @NL80211_ATTR_SCHED_SCAN_MATCH, a wiphy attribute.
+ *
+ * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
+ * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
+ *    scanning and include a zero-length SSID (wildcard) for wildcard scan
+ * @NL80211_ATTR_BSS: scan result BSS
+ *
+ * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain
+ *    currently in effect. This could be any of the %NL80211_REGDOM_SET_BY_*
+ * @NL80211_ATTR_REG_TYPE: indicates the type of the regulatory domain currently
+ *    set. This can be one of the nl80211_reg_type (%NL80211_REGDOM_TYPE_*)
+ *
+ * @NL80211_ATTR_SUPPORTED_COMMANDS: wiphy attribute that specifies
+ *    an array of command numbers (i.e. a mapping index to command number)
+ *    that the driver for the given wiphy supports.
+ *
+ * @NL80211_ATTR_FRAME: frame data (binary attribute), including frame header
+ *    and body, but not FCS; used, e.g., with NL80211_CMD_AUTHENTICATE and
+ *    NL80211_CMD_ASSOCIATE events
+ * @NL80211_ATTR_SSID: SSID (binary attribute, 0..32 octets)
+ * @NL80211_ATTR_AUTH_TYPE: AuthenticationType, see &enum nl80211_auth_type,
+ *    represented as a u32
+ * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and
+ *    %NL80211_CMD_DISASSOCIATE, u16
+ *
+ * @NL80211_ATTR_KEY_TYPE: Key Type, see &enum nl80211_key_type, represented as
+ *    a u32
+ *
+ * @NL80211_ATTR_FREQ_BEFORE: A channel which has suffered a regulatory change
+ *    due to considerations from a beacon hint. This attribute reflects
+ *    the state of the channel _before_ the beacon hint processing. This
+ *    attributes consists of a nested attribute containing
+ *    NL80211_FREQUENCY_ATTR_*
+ * @NL80211_ATTR_FREQ_AFTER: A channel which has suffered a regulatory change
+ *    due to considerations from a beacon hint. This attribute reflects
+ *    the state of the channel _after_ the beacon hint processing. This
+ *    attributes consists of a nested attribute containing
+ *    NL80211_FREQUENCY_ATTR_*
+ *
+ * @NL80211_ATTR_CIPHER_SUITES: a set of u32 values indicating the supported
+ *    cipher suites
+ *
+ * @NL80211_ATTR_FREQ_FIXED: a flag indicating the IBSS should not try to look
+ *    for other networks on different channels
+ *
+ * @NL80211_ATTR_TIMED_OUT: a flag indicating than an operation timed out; this
+ *    is used, e.g., with %NL80211_CMD_AUTHENTICATE event
+ *
+ * @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is
+ *    used for the association (&enum nl80211_mfp, represented as a u32);
+ *    this attribute can be used with %NL80211_CMD_ASSOCIATE and
+ *    %NL80211_CMD_CONNECT requests. %NL80211_MFP_OPTIONAL is not allowed for
+ *    %NL80211_CMD_ASSOCIATE since user space SME is expected and hence, it
+ *    must have decided whether to use management frame protection or not.
+ *    Setting %NL80211_MFP_OPTIONAL with a %NL80211_CMD_CONNECT request will
+ *    let the driver (or the firmware) decide whether to use MFP or not.
+ *
+ * @NL80211_ATTR_STA_FLAGS2: Attribute containing a
+ *    &struct nl80211_sta_flag_update.
+ *
+ * @NL80211_ATTR_CONTROL_PORT: A flag indicating whether user space controls
+ *    IEEE 802.1X port, i.e., sets/clears %NL80211_STA_FLAG_AUTHORIZED, in
+ *    station mode. If the flag is included in %NL80211_CMD_ASSOCIATE
+ *    request, the driver will assume that the port is unauthorized until
+ *    authorized by user space. Otherwise, port is marked authorized by
+ *    default in station mode.
+ * @NL80211_ATTR_CONTROL_PORT_ETHERTYPE: A 16-bit value indicating the
+ *    ethertype that will be used for key negotiation. It can be
+ *    specified with the associate and connect commands. If it is not
+ *    specified, the value defaults to 0x888E (PAE, 802.1X). This
+ *    attribute is also used as a flag in the wiphy information to
+ *    indicate that protocols other than PAE are supported.
+ * @NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT: When included along with
+ *    %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, indicates that the custom
+ *    ethertype frames used for key negotiation must not be encrypted.
+ * @NL80211_ATTR_CONTROL_PORT_OVER_NL80211: A flag indicating whether control
+ *    port frames (e.g. of type given in %NL80211_ATTR_CONTROL_PORT_ETHERTYPE)
+ *    will be sent directly to the network interface or sent via the NL80211
+ *    socket.  If this attribute is missing, then legacy behavior of sending
+ *    control port frames directly to the network interface is used.  If the
+ *    flag is included, then control port frames are sent over NL80211 instead
+ *    using %CMD_CONTROL_PORT_FRAME.  If control port routing over NL80211 is
+ *    to be used then userspace must also use the %NL80211_ATTR_SOCKET_OWNER
+ *    flag.
+ *
+ * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver.
+ *    We recommend using nested, driver-specific attributes within this.
+ *
+ * @NL80211_ATTR_DISCONNECTED_BY_AP: A flag indicating that the DISCONNECT
+ *    event was due to the AP disconnecting the station, and not due to
+ *    a local disconnect request.
+ * @NL80211_ATTR_STATUS_CODE: StatusCode for the %NL80211_CMD_CONNECT
+ *    event (u16)
+ * @NL80211_ATTR_PRIVACY: Flag attribute, used with connect(), indicating
+ *    that protected APs should be used. This is also used with NEW_BEACON to
+ *    indicate that the BSS is to use protection.
+ *
+ * @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT, ASSOCIATE, and NEW_BEACON
+ *    to indicate which unicast key ciphers will be used with the connection
+ *    (an array of u32).
+ * @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT, ASSOCIATE, and NEW_BEACON to
+ *    indicate which group key cipher will be used with the connection (a
+ *    u32).
+ * @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT, ASSOCIATE, and NEW_BEACON to
+ *    indicate which WPA version(s) the AP we want to associate with is using
+ *    (a u32 with flags from &enum nl80211_wpa_versions).
+ * @NL80211_ATTR_AKM_SUITES: Used with CONNECT, ASSOCIATE, and NEW_BEACON to
+ *    indicate which key management algorithm(s) to use (an array of u32).
+ *    This attribute is also sent in response to @NL80211_CMD_GET_WIPHY,
+ *    indicating the supported AKM suites, intended for specific drivers which
+ *    implement SME and have constraints on which AKMs are supported and also
+ *    the cases where an AKM support is offloaded to the driver/firmware.
+ *    If there is no such notification from the driver, user space should
+ *    assume the driver supports all the AKM suites.
+ *
+ * @NL80211_ATTR_REQ_IE: (Re)association request information elements as
+ *    sent out by the card, for ROAM and successful CONNECT events.
+ * @NL80211_ATTR_RESP_IE: (Re)association response information elements as
+ *    sent by peer, for ROAM and successful CONNECT events.
+ *
+ * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used in ASSOCIATE and CONNECT
+ *    commands to specify a request to reassociate within an ESS, i.e., to use
+ *    Reassociate Request frame (with the value of this attribute in the
+ *    Current AP address field) instead of Association Request frame which is
+ *    used for the initial association to an ESS.
+ *
+ * @NL80211_ATTR_KEY: key information in a nested attribute with
+ *    %NL80211_KEY_* sub-attributes
+ * @NL80211_ATTR_KEYS: array of keys for static WEP keys for connect()
+ *    and join_ibss(), key information is in a nested attribute each
+ *    with %NL80211_KEY_* sub-attributes
+ *
+ * @NL80211_ATTR_PID: Process ID of a network namespace.
+ *
+ * @NL80211_ATTR_GENERATION: Used to indicate consistent snapshots for
+ *    dumps. This number increases whenever the object list being
+ *    dumped changes, and as such userspace can verify that it has
+ *    obtained a complete and consistent snapshot by verifying that
+ *    all dump messages contain the same generation number. If it
+ *    changed then the list changed and the dump should be repeated
+ *    completely from scratch.
+ *
+ * @NL80211_ATTR_4ADDR: Use 4-address frames on a virtual interface
+ *
+ * @NL80211_ATTR_SURVEY_INFO: survey information about a channel, part of
+ *    the survey response for %NL80211_CMD_GET_SURVEY, nested attribute
+ *    containing info as possible, see &enum survey_info.
+ *
+ * @NL80211_ATTR_PMKID: PMK material for PMKSA caching.
+ * @NL80211_ATTR_MAX_NUM_PMKIDS: maximum number of PMKIDs a firmware can
+ *    cache, a wiphy attribute.
+ *
+ * @NL80211_ATTR_DURATION: Duration of an operation in milliseconds, u32.
+ * @NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION: Device attribute that
+ *    specifies the maximum duration that can be requested with the
+ *    remain-on-channel operation, in milliseconds, u32.
+ *
+ * @NL80211_ATTR_COOKIE: Generic 64-bit cookie to identify objects.
+ *
+ * @NL80211_ATTR_TX_RATES: Nested set of attributes
+ *    (enum nl80211_tx_rate_attributes) describing TX rates per band. The
+ *    enum nl80211_band value is used as the index (nla_type() of the nested
+ *    data. If a band is not included, it will be configured to allow all
+ *    rates based on negotiated supported rates information. This attribute
+ *    is used with %NL80211_CMD_SET_TX_BITRATE_MASK and with starting AP,
+ *    and joining mesh networks (not IBSS yet). In the later case, it must
+ *    specify just a single bitrate, which is to be used for the beacon.
+ *    The driver must also specify support for this with the extended
+ *    features NL80211_EXT_FEATURE_BEACON_RATE_LEGACY,
+ *    NL80211_EXT_FEATURE_BEACON_RATE_HT and
+ *    NL80211_EXT_FEATURE_BEACON_RATE_VHT.
+ *
+ * @NL80211_ATTR_FRAME_MATCH: A binary attribute which typically must contain
+ *    at least one byte, currently used with @NL80211_CMD_REGISTER_FRAME.
+ * @NL80211_ATTR_FRAME_TYPE: A u16 indicating the frame type/subtype for the
+ *    @NL80211_CMD_REGISTER_FRAME command.
+ * @NL80211_ATTR_TX_FRAME_TYPES: wiphy capability attribute, which is a
+ *    nested attribute of %NL80211_ATTR_FRAME_TYPE attributes, containing
+ *    information about which frame types can be transmitted with
+ *    %NL80211_CMD_FRAME.
+ * @NL80211_ATTR_RX_FRAME_TYPES: wiphy capability attribute, which is a
+ *    nested attribute of %NL80211_ATTR_FRAME_TYPE attributes, containing
+ *    information about which frame types can be registered for RX.
+ *
+ * @NL80211_ATTR_ACK: Flag attribute indicating that the frame was
+ *    acknowledged by the recipient.
+ *
+ * @NL80211_ATTR_PS_STATE: powersave state, using &enum nl80211_ps_state values.
+ *
+ * @NL80211_ATTR_CQM: connection quality monitor configuration in a
+ *    nested attribute with %NL80211_ATTR_CQM_* sub-attributes.
+ *
+ * @NL80211_ATTR_LOCAL_STATE_CHANGE: Flag attribute to indicate that a command
+ *    is requesting a local authentication/association state change without
+ *    invoking actual management frame exchange. This can be used with
+ *    NL80211_CMD_AUTHENTICATE, NL80211_CMD_DEAUTHENTICATE,
+ *    NL80211_CMD_DISASSOCIATE.
+ *
+ * @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations
+ *    connected to this BSS.
+ *
+ * @NL80211_ATTR_WIPHY_TX_POWER_SETTING: Transmit power setting type. See
+ *    &enum nl80211_tx_power_setting for possible values.
+ * @NL80211_ATTR_WIPHY_TX_POWER_LEVEL: Transmit power level in signed mBm units.
+ *    This is used in association with @NL80211_ATTR_WIPHY_TX_POWER_SETTING
+ *    for non-automatic settings.
+ *
+ * @NL80211_ATTR_SUPPORT_IBSS_RSN: The device supports IBSS RSN, which mostly
+ *    means support for per-station GTKs.
+ *
+ * @NL80211_ATTR_WIPHY_ANTENNA_TX: Bitmap of allowed antennas for transmitting.
+ *    This can be used to mask out antennas which are not attached or should
+ *    not be used for transmitting. If an antenna is not selected in this
+ *    bitmap the hardware is not allowed to transmit on this antenna.
+ *
+ *    Each bit represents one antenna, starting with antenna 1 at the first
+ *    bit. Depending on which antennas are selected in the bitmap, 802.11n
+ *    drivers can derive which chainmasks to use (if all antennas belonging to
+ *    a particular chain are disabled this chain should be disabled) and if
+ *    a chain has diversity antennas wether diversity should be used or not.
+ *    HT capabilities (STBC, TX Beamforming, Antenna selection) can be
+ *    derived from the available chains after applying the antenna mask.
+ *    Non-802.11n drivers can derive wether to use diversity or not.
+ *    Drivers may reject configurations or RX/TX mask combinations they cannot
+ *    support by returning -EINVAL.
+ *
+ * @NL80211_ATTR_WIPHY_ANTENNA_RX: Bitmap of allowed antennas for receiving.
+ *    This can be used to mask out antennas which are not attached or should
+ *    not be used for receiving. If an antenna is not selected in this bitmap
+ *    the hardware should not be configured to receive on this antenna.
+ *    For a more detailed description see @NL80211_ATTR_WIPHY_ANTENNA_TX.
+ *
+ * @NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX: Bitmap of antennas which are available
+ *    for configuration as TX antennas via the above parameters.
+ *
+ * @NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX: Bitmap of antennas which are available
+ *    for configuration as RX antennas via the above parameters.
+ *
+ * @NL80211_ATTR_MCAST_RATE: Multicast tx rate (in 100 kbps) for IBSS
+ *
+ * @NL80211_ATTR_OFFCHANNEL_TX_OK: For management frame TX, the frame may be
+ *    transmitted on another channel when the channel given doesn't match
+ *    the current channel. If the current channel doesn't match and this
+ *    flag isn't set, the frame will be rejected. This is also used as an
+ *    nl80211 capability flag.
+ *
+ * @NL80211_ATTR_BSS_HT_OPMODE: HT operation mode (u16)
+ *
+ * @NL80211_ATTR_KEY_DEFAULT_TYPES: A nested attribute containing flags
+ *    attributes, specifying what a key should be set as default as.
+ *    See &enum nl80211_key_default_types.
+ *
+ * @NL80211_ATTR_MESH_SETUP: Optional mesh setup parameters.  These cannot be
+ *    changed once the mesh is active.
+ * @NL80211_ATTR_MESH_CONFIG: Mesh configuration parameters, a nested attribute
+ *    containing attributes from &enum nl80211_meshconf_params.
+ * @NL80211_ATTR_SUPPORT_MESH_AUTH: Currently, this means the underlying driver
+ *    allows auth frames in a mesh to be passed to userspace for processing via
+ *    the @NL80211_MESH_SETUP_USERSPACE_AUTH flag.
+ * @NL80211_ATTR_STA_PLINK_STATE: The state of a mesh peer link as defined in
+ *    &enum nl80211_plink_state. Used when userspace is driving the peer link
+ *    management state machine.  @NL80211_MESH_SETUP_USERSPACE_AMPE or
+ *    @NL80211_MESH_SETUP_USERSPACE_MPM must be enabled.
+ *
+ * @NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED: indicates, as part of the wiphy
+ *    capabilities, the supported WoWLAN triggers
+ * @NL80211_ATTR_WOWLAN_TRIGGERS: used by %NL80211_CMD_SET_WOWLAN to
+ *    indicate which WoW triggers should be enabled. This is also
+ *    used by %NL80211_CMD_GET_WOWLAN to get the currently enabled WoWLAN
+ *    triggers.
+ *
+ * @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan
+ *    cycles, in msecs.
+ *
+ * @NL80211_ATTR_SCHED_SCAN_MATCH: Nested attribute with one or more
+ *    sets of attributes to match during scheduled scans.  Only BSSs
+ *    that match any of the sets will be reported.  These are
+ *    pass-thru filter rules.
+ *    For a match to succeed, the BSS must match all attributes of a
+ *    set.  Since not every hardware supports matching all types of
+ *    attributes, there is no guarantee that the reported BSSs are
+ *    fully complying with the match sets and userspace needs to be
+ *    able to ignore them by itself.
+ *    Thus, the implementation is somewhat hardware-dependent, but
+ *    this is only an optimization and the userspace application
+ *    needs to handle all the non-filtered results anyway.
+ *    If the match attributes don't make sense when combined with
+ *    the values passed in @NL80211_ATTR_SCAN_SSIDS (eg. if an SSID
+ *    is included in the probe request, but the match attributes
+ *    will never let it go through), -EINVAL may be returned.
+ *    If omitted, no filtering is done.
+ *
+ * @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported
+ *    interface combinations. In each nested item, it contains attributes
+ *    defined in &enum nl80211_if_combination_attrs.
+ * @NL80211_ATTR_SOFTWARE_IFTYPES: Nested attribute (just like
+ *    %NL80211_ATTR_SUPPORTED_IFTYPES) containing the interface types that
+ *    are managed in software: interfaces of these types aren't subject to
+ *    any restrictions in their number or combinations.
+ *
+ * @NL80211_ATTR_REKEY_DATA: nested attribute containing the information
+ *    necessary for GTK rekeying in the device, see &enum nl80211_rekey_data.
+ *
+ * @NL80211_ATTR_SCAN_SUPP_RATES: rates per to be advertised as supported in scan,
+ *    nested array attribute containing an entry for each band, with the entry
+ *    being a list of supported rates as defined by IEEE 802.11 7.3.2.2 but
+ *    without the length restriction (at most %NL80211_MAX_SUPP_RATES).
+ *
+ * @NL80211_ATTR_HIDDEN_SSID: indicates whether SSID is to be hidden from Beacon
+ *    and Probe Response (when response to wildcard Probe Request); see
+ *    &enum nl80211_hidden_ssid, represented as a u32
+ *
+ * @NL80211_ATTR_IE_PROBE_RESP: Information element(s) for Probe Response frame.
+ *    This is used with %NL80211_CMD_NEW_BEACON and %NL80211_CMD_SET_BEACON to
+ *    provide extra IEs (e.g., WPS/P2P IE) into Probe Response frames when the
+ *    driver (or firmware) replies to Probe Request frames.
+ * @NL80211_ATTR_IE_ASSOC_RESP: Information element(s) for (Re)Association
+ *    Response frames. This is used with %NL80211_CMD_NEW_BEACON and
+ *    %NL80211_CMD_SET_BEACON to provide extra IEs (e.g., WPS/P2P IE) into
+ *    (Re)Association Response frames when the driver (or firmware) replies to
+ *    (Re)Association Request frames.
+ *
+ * @NL80211_ATTR_STA_WME: Nested attribute containing the wme configuration
+ *    of the station, see &enum nl80211_sta_wme_attr.
+ * @NL80211_ATTR_SUPPORT_AP_UAPSD: the device supports uapsd when working
+ *    as AP.
+ *
+ * @NL80211_ATTR_ROAM_SUPPORT: Indicates whether the firmware is capable of
+ *    roaming to another AP in the same ESS if the signal lever is low.
+ *
+ * @NL80211_ATTR_PMKSA_CANDIDATE: Nested attribute containing the PMKSA caching
+ *    candidate information, see &enum nl80211_pmksa_candidate_attr.
+ *
+ * @NL80211_ATTR_TX_NO_CCK_RATE: Indicates whether to use CCK rate or not
+ *    for management frames transmission. In order to avoid p2p probe/action
+ *    frames are being transmitted at CCK rate in 2GHz band, the user space
+ *    applications use this attribute.
+ *    This attribute is used with %NL80211_CMD_TRIGGER_SCAN and
+ *    %NL80211_CMD_FRAME commands.
+ *
+ * @NL80211_ATTR_TDLS_ACTION: Low level TDLS action code (e.g. link setup
+ *    request, link setup confirm, link teardown, etc.). Values are
+ *    described in the TDLS (802.11z) specification.
+ * @NL80211_ATTR_TDLS_DIALOG_TOKEN: Non-zero token for uniquely identifying a
+ *    TDLS conversation between two devices.
+ * @NL80211_ATTR_TDLS_OPERATION: High level TDLS operation; see
+ *    &enum nl80211_tdls_operation, represented as a u8.
+ * @NL80211_ATTR_TDLS_SUPPORT: A flag indicating the device can operate
+ *    as a TDLS peer sta.
+ * @NL80211_ATTR_TDLS_EXTERNAL_SETUP: The TDLS discovery/setup and teardown
+ *    procedures should be performed by sending TDLS packets via
+ *    %NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be
+ *    used for asking the driver to perform a TDLS operation.
+ *
+ * @NL80211_ATTR_DEVICE_AP_SME: This u32 attribute may be listed for devices
+ *    that have AP support to indicate that they have the AP SME integrated
+ *    with support for the features listed in this attribute, see
+ *    &enum nl80211_ap_sme_features.
+ *
+ * @NL80211_ATTR_DONT_WAIT_FOR_ACK: Used with %NL80211_CMD_FRAME, this tells
+ *    the driver to not wait for an acknowledgement. Note that due to this,
+ *    it will also not give a status callback nor return a cookie. This is
+ *    mostly useful for probe responses to save airtime.
+ *
+ * @NL80211_ATTR_FEATURE_FLAGS: This u32 attribute contains flags from
+ *    &enum nl80211_feature_flags and is advertised in wiphy information.
+ * @NL80211_ATTR_PROBE_RESP_OFFLOAD: Indicates that the HW responds to probe
+ *    requests while operating in AP-mode.
+ *    This attribute holds a bitmap of the supported protocols for
+ *    offloading (see &enum nl80211_probe_resp_offload_support_attr).
+ *
+ * @NL80211_ATTR_PROBE_RESP: Probe Response template data. Contains the entire
+ *    probe-response frame. The DA field in the 802.11 header is zero-ed out,
+ *    to be filled by the FW.
+ * @NL80211_ATTR_DISABLE_HT:  Force HT capable interfaces to disable
+ *    this feature.  Currently, only supported in mac80211 drivers.
+ * @NL80211_ATTR_HT_CAPABILITY_MASK: Specify which bits of the
+ *    ATTR_HT_CAPABILITY to which attention should be paid.
+ *    Currently, only mac80211 NICs support this feature.
+ *    The values that may be configured are:
+ *    MCS rates, MAX-AMSDU, HT-20-40 and HT_CAP_SGI_40
+ *    AMPDU density and AMPDU factor.
+ *    All values are treated as suggestions and may be ignored
+ *    by the driver as required.  The actual values may be seen in
+ *    the station debugfs ht_caps file.
+ *
+ * @NL80211_ATTR_DFS_REGION: region for regulatory rules which this country
+ *    abides to when initiating radiation on DFS channels. A country maps
+ *    to one DFS region.
+ *
+ * @NL80211_ATTR_NOACK_MAP: This u16 bitmap contains the No Ack Policy of
+ *      up to 16 TIDs.
+ *
+ * @NL80211_ATTR_INACTIVITY_TIMEOUT: timeout value in seconds, this can be
+ *    used by the drivers which has MLME in firmware and does not have support
+ *    to report per station tx/rx activity to free up the station entry from
+ *    the list. This needs to be used when the driver advertises the
+ *    capability to timeout the stations.
+ *
+ * @NL80211_ATTR_RX_SIGNAL_DBM: signal strength in dBm (as a 32-bit int);
+ *    this attribute is (depending on the driver capabilities) added to
+ *    received frames indicated with %NL80211_CMD_FRAME.
+ *
+ * @NL80211_ATTR_BG_SCAN_PERIOD: Background scan period in seconds
+ *      or 0 to disable background scan.
+ *
+ * @NL80211_ATTR_USER_REG_HINT_TYPE: type of regulatory hint passed from
+ *    userspace. If unset it is assumed the hint comes directly from
+ *    a user. If set code could specify exactly what type of source
+ *    was used to provide the hint. For the different types of
+ *    allowed user regulatory hints see nl80211_user_reg_hint_type.
+ *
+ * @NL80211_ATTR_CONN_FAILED_REASON: The reason for which AP has rejected
+ *    the connection request from a station. nl80211_connect_failed_reason
+ *    enum has different reasons of connection failure.
+ *
+ * @NL80211_ATTR_AUTH_DATA: Fields and elements in Authentication frames.
+ *    This contains the authentication frame body (non-IE and IE data),
+ *    excluding the Authentication algorithm number, i.e., starting at the
+ *    Authentication transaction sequence number field. It is used with
+ *    authentication algorithms that need special fields to be added into
+ *    the frames (SAE and FILS). Currently, only the SAE cases use the
+ *    initial two fields (Authentication transaction sequence number and
+ *    Status code). However, those fields are included in the attribute data
+ *    for all authentication algorithms to keep the attribute definition
+ *    consistent.
+ *
+ * @NL80211_ATTR_VHT_CAPABILITY: VHT Capability information element (from
+ *    association request when used with NL80211_CMD_NEW_STATION)
+ *
+ * @NL80211_ATTR_SCAN_FLAGS: scan request control flags (u32)
+ *
+ * @NL80211_ATTR_P2P_CTWINDOW: P2P GO Client Traffic Window (u8), used with
+ *    the START_AP and SET_BSS commands
+ * @NL80211_ATTR_P2P_OPPPS: P2P GO opportunistic PS (u8), used with the
+ *    START_AP and SET_BSS commands. This can have the values 0 or 1;
+ *    if not given in START_AP 0 is assumed, if not given in SET_BSS
+ *    no change is made.
+ *
+ * @NL80211_ATTR_LOCAL_MESH_POWER_MODE: local mesh STA link-specific power mode
+ *    defined in &enum nl80211_mesh_power_mode.
+ *
+ * @NL80211_ATTR_ACL_POLICY: ACL policy, see &enum nl80211_acl_policy,
+ *    carried in a u32 attribute
+ *
+ * @NL80211_ATTR_MAC_ADDRS: Array of nested MAC addresses, used for
+ *    MAC ACL.
+ *
+ * @NL80211_ATTR_MAC_ACL_MAX: u32 attribute to advertise the maximum
+ *    number of MAC addresses that a device can support for MAC
+ *    ACL.
+ *
+ * @NL80211_ATTR_RADAR_EVENT: Type of radar event for notification to userspace,
+ *    contains a value of enum nl80211_radar_event (u32).
+ *
+ * @NL80211_ATTR_EXT_CAPA: 802.11 extended capabilities that the kernel driver
+ *    has and handles. The format is the same as the IE contents. See
+ *    802.11-2012 8.4.2.29 for more information.
+ * @NL80211_ATTR_EXT_CAPA_MASK: Extended capabilities that the kernel driver
+ *    has set in the %NL80211_ATTR_EXT_CAPA value, for multibit fields.
+ *
+ * @NL80211_ATTR_STA_CAPABILITY: Station capabilities (u16) are advertised to
+ *    the driver, e.g., to enable TDLS power save (PU-APSD).
+ *
+ * @NL80211_ATTR_STA_EXT_CAPABILITY: Station extended capabilities are
+ *    advertised to the driver, e.g., to enable TDLS off channel operations
+ *    and PU-APSD.
+ *
+ * @NL80211_ATTR_PROTOCOL_FEATURES: global nl80211 feature flags, see
+ *    &enum nl80211_protocol_features, the attribute is a u32.
+ *
+ * @NL80211_ATTR_SPLIT_WIPHY_DUMP: flag attribute, userspace supports
+ *    receiving the data for a single wiphy split across multiple
+ *    messages, given with wiphy dump message
+ *
+ * @NL80211_ATTR_MDID: Mobility Domain Identifier
+ *
+ * @NL80211_ATTR_IE_RIC: Resource Information Container Information
+ *    Element
+ *
+ * @NL80211_ATTR_CRIT_PROT_ID: critical protocol identifier requiring increased
+ *    reliability, see &enum nl80211_crit_proto_id (u16).
+ * @NL80211_ATTR_MAX_CRIT_PROT_DURATION: duration in milliseconds in which
+ *    the connection should have increased reliability (u16).
+ *
+ * @NL80211_ATTR_PEER_AID: Association ID for the peer TDLS station (u16).
+ *    This is similar to @NL80211_ATTR_STA_AID but with a difference of being
+ *    allowed to be used with the first @NL80211_CMD_SET_STATION command to
+ *    update a TDLS peer STA entry.
+ *
+ * @NL80211_ATTR_COALESCE_RULE: Coalesce rule information.
+ *
+ * @NL80211_ATTR_CH_SWITCH_COUNT: u32 attribute specifying the number of TBTT's
+ *    until the channel switch event.
+ * @NL80211_ATTR_CH_SWITCH_BLOCK_TX: flag attribute specifying that transmission
+ *    must be blocked on the current channel (before the channel switch
+ *    operation).
+ * @NL80211_ATTR_CSA_IES: Nested set of attributes containing the IE information
+ *    for the time while performing a channel switch.
+ * @NL80211_ATTR_CSA_C_OFF_BEACON: An array of offsets (u16) to the channel
+ *    switch counters in the beacons tail (%NL80211_ATTR_BEACON_TAIL).
+ * @NL80211_ATTR_CSA_C_OFF_PRESP: An array of offsets (u16) to the channel
+ *    switch counters in the probe response (%NL80211_ATTR_PROBE_RESP).
+ *
+ * @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32.
+ *    As specified in the &enum nl80211_rxmgmt_flags.
+ *
+ * @NL80211_ATTR_STA_SUPPORTED_CHANNELS: array of supported channels.
+ *
+ * @NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES: array of supported
+ *    supported operating classes.
+ *
+ * @NL80211_ATTR_HANDLE_DFS: A flag indicating whether user space
+ *    controls DFS operation in IBSS mode. If the flag is included in
+ *    %NL80211_CMD_JOIN_IBSS request, the driver will allow use of DFS
+ *    channels and reports radar events to userspace. Userspace is required
+ *    to react to radar events, e.g. initiate a channel switch or leave the
+ *    IBSS network.
+ *
+ * @NL80211_ATTR_SUPPORT_5_MHZ: A flag indicating that the device supports
+ *    5 MHz channel bandwidth.
+ * @NL80211_ATTR_SUPPORT_10_MHZ: A flag indicating that the device supports
+ *    10 MHz channel bandwidth.
+ *
+ * @NL80211_ATTR_OPMODE_NOTIF: Operating mode field from Operating Mode
+ *    Notification Element based on association request when used with
+ *    %NL80211_CMD_NEW_STATION or %NL80211_CMD_SET_STATION (only when
+ *    %NL80211_FEATURE_FULL_AP_CLIENT_STATE is supported, or with TDLS);
+ *    u8 attribute.
+ *
+ * @NL80211_ATTR_VENDOR_ID: The vendor ID, either a 24-bit OUI or, if
+ *    %NL80211_VENDOR_ID_IS_LINUX is set, a special Linux ID (not used yet)
+ * @NL80211_ATTR_VENDOR_SUBCMD: vendor sub-command
+ * @NL80211_ATTR_VENDOR_DATA: data for the vendor command, if any; this
+ *    attribute is also used for vendor command feature advertisement
+ * @NL80211_ATTR_VENDOR_EVENTS: used for event list advertising in the wiphy
+ *    info, containing a nested array of possible events
+ *
+ * @NL80211_ATTR_QOS_MAP: IP DSCP mapping for Interworking QoS mapping. This
+ *    data is in the format defined for the payload of the QoS Map Set element
+ *    in IEEE Std 802.11-2012, 8.4.2.97.
+ *
+ * @NL80211_ATTR_MAC_HINT: MAC address recommendation as initial BSS
+ * @NL80211_ATTR_WIPHY_FREQ_HINT: frequency of the recommended initial BSS
+ *
+ * @NL80211_ATTR_MAX_AP_ASSOC_STA: Device attribute that indicates how many
+ *    associated stations are supported in AP mode (including P2P GO); u32.
+ *    Since drivers may not have a fixed limit on the maximum number (e.g.,
+ *    other concurrent operations may affect this), drivers are allowed to
+ *    advertise values that cannot always be met. In such cases, an attempt
+ *    to add a new station entry with @NL80211_CMD_NEW_STATION may fail.
+ *
+ * @NL80211_ATTR_CSA_C_OFFSETS_TX: An array of csa counter offsets (u16) which
+ *    should be updated when the frame is transmitted.
+ * @NL80211_ATTR_MAX_CSA_COUNTERS: U8 attribute used to advertise the maximum
+ *    supported number of csa counters.
+ *
+ * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32.
+ *    As specified in the &enum nl80211_tdls_peer_capability.
+ *
+ * @NL80211_ATTR_SOCKET_OWNER: Flag attribute, if set during interface
+ *    creation then the new interface will be owned by the netlink socket
+ *    that created it and will be destroyed when the socket is closed.
+ *    If set during scheduled scan start then the new scan req will be
+ *    owned by the netlink socket that created it and the scheduled scan will
+ *    be stopped when the socket is closed.
+ *    If set during configuration of regulatory indoor operation then the
+ *    regulatory indoor configuration would be owned by the netlink socket
+ *    that configured the indoor setting, and the indoor operation would be
+ *    cleared when the socket is closed.
+ *    If set during NAN interface creation, the interface will be destroyed
+ *    if the socket is closed just like any other interface. Moreover, NAN
+ *    notifications will be sent in unicast to that socket. Without this
+ *    attribute, the notifications will be sent to the %NL80211_MCGRP_NAN
+ *    multicast group.
+ *    If set during %NL80211_CMD_ASSOCIATE or %NL80211_CMD_CONNECT the
+ *    station will deauthenticate when the socket is closed.
+ *    If set during %NL80211_CMD_JOIN_IBSS the IBSS will be automatically
+ *    torn down when the socket is closed.
+ *    If set during %NL80211_CMD_JOIN_MESH the mesh setup will be
+ *    automatically torn down when the socket is closed.
+ *    If set during %NL80211_CMD_START_AP the AP will be automatically
+ *    disabled when the socket is closed.
+ *
+ * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
+ *    the TDLS link initiator.
+ *
+ * @NL80211_ATTR_USE_RRM: flag for indicating whether the current connection
+ *    shall support Radio Resource Measurements (11k). This attribute can be
+ *    used with %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests.
+ *    User space applications are expected to use this flag only if the
+ *    underlying device supports these minimal RRM features:
+ *        %NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES,
+ *        %NL80211_FEATURE_QUIET,
+ *    Or, if global RRM is supported, see:
+ *        %NL80211_EXT_FEATURE_RRM
+ *    If this flag is used, driver must add the Power Capabilities IE to the
+ *    association request. In addition, it must also set the RRM capability
+ *    flag in the association request's Capability Info field.
+ *
+ * @NL80211_ATTR_WIPHY_DYN_ACK: flag attribute used to enable ACK timeout
+ *    estimation algorithm (dynack). In order to activate dynack
+ *    %NL80211_FEATURE_ACKTO_ESTIMATION feature flag must be set by lower
+ *    drivers to indicate dynack capability. Dynack is automatically disabled
+ *    setting valid value for coverage class.
+ *
+ * @NL80211_ATTR_TSID: a TSID value (u8 attribute)
+ * @NL80211_ATTR_USER_PRIO: user priority value (u8 attribute)
+ * @NL80211_ATTR_ADMITTED_TIME: admitted time in units of 32 microseconds
+ *    (per second) (u16 attribute)
+ *
+ * @NL80211_ATTR_SMPS_MODE: SMPS mode to use (ap mode). see
+ *    &enum nl80211_smps_mode.
+ *
+ * @NL80211_ATTR_OPER_CLASS: operating class
+ *
+ * @NL80211_ATTR_MAC_MASK: MAC address mask
+ *
+ * @NL80211_ATTR_WIPHY_SELF_MANAGED_REG: flag attribute indicating this device
+ *    is self-managing its regulatory information and any regulatory domain
+ *    obtained from it is coming from the device's wiphy and not the global
+ *    cfg80211 regdomain.
+ *
+ * @NL80211_ATTR_EXT_FEATURES: extended feature flags contained in a byte
+ *    array. The feature flags are identified by their bit index (see &enum
+ *    nl80211_ext_feature_index). The bit index is ordered starting at the
+ *    least-significant bit of the first byte in the array, ie. bit index 0
+ *    is located at bit 0 of byte 0. bit index 25 would be located at bit 1
+ *    of byte 3 (u8 array).
+ *
+ * @NL80211_ATTR_SURVEY_RADIO_STATS: Request overall radio statistics to be
+ *    returned along with other survey data. If set, @NL80211_CMD_GET_SURVEY
+ *    may return a survey entry without a channel indicating global radio
+ *    statistics (only some values are valid and make sense.)
+ *    For devices that don't return such an entry even then, the information
+ *    should be contained in the result as the sum of the respective counters
+ *    over all channels.
+ *
+ * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before the first cycle of a
+ *    scheduled scan is started.  Or the delay before a WoWLAN
+ *    net-detect scan is started, counting from the moment the
+ *    system is suspended.  This value is a u32, in seconds.
+
+ * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
+ *      is operating in an indoor environment.
+ *
+ * @NL80211_ATTR_MAX_NUM_SCHED_SCAN_PLANS: maximum number of scan plans for
+ *    scheduled scan supported by the device (u32), a wiphy attribute.
+ * @NL80211_ATTR_MAX_SCAN_PLAN_INTERVAL: maximum interval (in seconds) for
+ *    a scan plan (u32), a wiphy attribute.
+ * @NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS: maximum number of iterations in
+ *    a scan plan (u32), a wiphy attribute.
+ * @NL80211_ATTR_SCHED_SCAN_PLANS: a list of scan plans for scheduled scan.
+ *    Each scan plan defines the number of scan iterations and the interval
+ *    between scans. The last scan plan will always run infinitely,
+ *    thus it must not specify the number of iterations, only the interval
+ *    between scans. The scan plans are executed sequentially.
+ *    Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
+ * @NL80211_ATTR_PBSS: flag attribute. If set it means operate
+ *    in a PBSS. Specified in %NL80211_CMD_CONNECT to request
+ *    connecting to a PCP, and in %NL80211_CMD_START_AP to start
+ *    a PCP instead of AP. Relevant for DMG networks only.
+ * @NL80211_ATTR_BSS_SELECT: nested attribute for driver supporting the
+ *    BSS selection feature. When used with %NL80211_CMD_GET_WIPHY it contains
+ *    attributes according &enum nl80211_bss_select_attr to indicate what
+ *    BSS selection behaviours are supported. When used with %NL80211_CMD_CONNECT
+ *    it contains the behaviour-specific attribute containing the parameters for
+ *    BSS selection to be done by driver and/or firmware.
+ *
+ * @NL80211_ATTR_STA_SUPPORT_P2P_PS: whether P2P PS mechanism supported
+ *    or not. u8, one of the values of &enum nl80211_sta_p2p_ps_status
+ *
+ * @NL80211_ATTR_PAD: attribute used for padding for 64-bit alignment
+ *
+ * @NL80211_ATTR_IFTYPE_EXT_CAPA: Nested attribute of the following attributes:
+ *    %NL80211_ATTR_IFTYPE, %NL80211_ATTR_EXT_CAPA,
+ *    %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per
+ *    interface type.
+ *
+ * @NL80211_ATTR_MU_MIMO_GROUP_DATA: array of 24 bytes that defines a MU-MIMO
+ *    groupID for monitor mode.
+ *    The first 8 bytes are a mask that defines the membership in each
+ *    group (there are 64 groups, group 0 and 63 are reserved),
+ *    each bit represents a group and set to 1 for being a member in
+ *    that group and 0 for not being a member.
+ *    The remaining 16 bytes define the position in each group: 2 bits for
+ *    each group.
+ *    (smaller group numbers represented on most significant bits and bigger
+ *    group numbers on least significant bits.)
+ *    This attribute is used only if all interfaces are in monitor mode.
+ *    Set this attribute in order to monitor packets using the given MU-MIMO
+ *    groupID data.
+ *    to turn off that feature set all the bits of the groupID to zero.
+ * @NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR: mac address for the sniffer to follow
+ *    when using MU-MIMO air sniffer.
+ *    to turn that feature off set an invalid mac address
+ *    (e.g. FF:FF:FF:FF:FF:FF)
+ *
+ * @NL80211_ATTR_SCAN_START_TIME_TSF: The time at which the scan was actually
+ *    started (u64). The time is the TSF of the BSS the interface that
+ *    requested the scan is connected to (if available, otherwise this
+ *    attribute must not be included).
+ * @NL80211_ATTR_SCAN_START_TIME_TSF_BSSID: The BSS according to which
+ *    %NL80211_ATTR_SCAN_START_TIME_TSF is set.
+ * @NL80211_ATTR_MEASUREMENT_DURATION: measurement duration in TUs (u16). If
+ *    %NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY is not set, this is the
+ *    maximum measurement duration allowed. This attribute is used with
+ *    measurement requests. It can also be used with %NL80211_CMD_TRIGGER_SCAN
+ *    if the scan is used for beacon report radio measurement.
+ * @NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY: flag attribute that indicates
+ *    that the duration specified with %NL80211_ATTR_MEASUREMENT_DURATION is
+ *    mandatory. If this flag is not set, the duration is the maximum duration
+ *    and the actual measurement duration may be shorter.
+ *
+ * @NL80211_ATTR_MESH_PEER_AID: Association ID for the mesh peer (u16). This is
+ *    used to pull the stored data for mesh peer in power save state.
+ *
+ * @NL80211_ATTR_NAN_MASTER_PREF: the master preference to be used by
+ *    %NL80211_CMD_START_NAN and optionally with
+ *    %NL80211_CMD_CHANGE_NAN_CONFIG. Its type is u8 and it can't be 0.
+ *    Also, values 1 and 255 are reserved for certification purposes and
+ *    should not be used during a normal device operation.
+ * @NL80211_ATTR_BANDS: operating bands configuration.  This is a u32
+ *    bitmask of BIT(NL80211_BAND_*) as described in %enum
+ *    nl80211_band.  For instance, for NL80211_BAND_2GHZ, bit 0
+ *    would be set.  This attribute is used with
+ *    %NL80211_CMD_START_NAN and %NL80211_CMD_CHANGE_NAN_CONFIG, and
+ *    it is optional.  If no bands are set, it means don't-care and
+ *    the device will decide what to use.
+ * @NL80211_ATTR_NAN_FUNC: a function that can be added to NAN. See
+ *    &enum nl80211_nan_func_attributes for description of this nested
+ *    attribute.
+ * @NL80211_ATTR_NAN_MATCH: used to report a match. This is a nested attribute.
+ *    See &enum nl80211_nan_match_attributes.
+ * @NL80211_ATTR_FILS_KEK: KEK for FILS (Re)Association Request/Response frame
+ *    protection.
+ * @NL80211_ATTR_FILS_NONCES: Nonces (part of AAD) for FILS (Re)Association
+ *    Request/Response frame protection. This attribute contains the 16 octet
+ *    STA Nonce followed by 16 octets of AP Nonce.
+ *
+ * @NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED: Indicates whether or not multicast
+ *    packets should be send out as unicast to all stations (flag attribute).
+ *
+ * @NL80211_ATTR_BSSID: The BSSID of the AP. Note that %NL80211_ATTR_MAC is also
+ *    used in various commands/events for specifying the BSSID.
+ *
+ * @NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI: Relative RSSI threshold by which
+ *    other BSSs has to be better or slightly worse than the current
+ *    connected BSS so that they get reported to user space.
+ *    This will give an opportunity to userspace to consider connecting to
+ *    other matching BSSs which have better or slightly worse RSSI than
+ *    the current connected BSS by using an offloaded operation to avoid
+ *    unnecessary wakeups.
+ *
+ * @NL80211_ATTR_SCHED_SCAN_RSSI_ADJUST: When present the RSSI level for BSSs in
+ *    the specified band is to be adjusted before doing
+ *    %NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI based comparison to figure out
+ *    better BSSs. The attribute value is a packed structure
+ *    value as specified by &struct nl80211_bss_select_rssi_adjust.
+ *
+ * @NL80211_ATTR_TIMEOUT_REASON: The reason for which an operation timed out.
+ *    u32 attribute with an &enum nl80211_timeout_reason value. This is used,
+ *    e.g., with %NL80211_CMD_CONNECT event.
+ *
+ * @NL80211_ATTR_FILS_ERP_USERNAME: EAP Re-authentication Protocol (ERP)
+ *    username part of NAI used to refer keys rRK and rIK. This is used with
+ *    %NL80211_CMD_CONNECT.
+ *
+ * @NL80211_ATTR_FILS_ERP_REALM: EAP Re-authentication Protocol (ERP) realm part
+ *    of NAI specifying the domain name of the ER server. This is used with
+ *    %NL80211_CMD_CONNECT.
+ *
+ * @NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM: Unsigned 16-bit ERP next sequence number
+ *    to use in ERP messages. This is used in generating the FILS wrapped data
+ *    for FILS authentication and is used with %NL80211_CMD_CONNECT.
+ *
+ * @NL80211_ATTR_FILS_ERP_RRK: ERP re-authentication Root Key (rRK) for the
+ *    NAI specified by %NL80211_ATTR_FILS_ERP_USERNAME and
+ *    %NL80211_ATTR_FILS_ERP_REALM. This is used for generating rIK and rMSK
+ *    from successful FILS authentication and is used with
+ *    %NL80211_CMD_CONNECT.
+ *
+ * @NL80211_ATTR_FILS_CACHE_ID: A 2-octet identifier advertized by a FILS AP
+ *    identifying the scope of PMKSAs. This is used with
+ *    @NL80211_CMD_SET_PMKSA and @NL80211_CMD_DEL_PMKSA.
+ *
+ * @NL80211_ATTR_PMK: attribute for passing PMK key material. Used with
+ *    %NL80211_CMD_SET_PMKSA for the PMKSA identified by %NL80211_ATTR_PMKID.
+ *    For %NL80211_CMD_CONNECT it is used to provide PSK for offloading 4-way
+ *    handshake for WPA/WPA2-PSK networks. For 802.1X authentication it is
+ *    used with %NL80211_CMD_SET_PMK. For offloaded FT support this attribute
+ *    specifies the PMK-R0 if NL80211_ATTR_PMKR0_NAME is included as well.
+ *
+ * @NL80211_ATTR_SCHED_SCAN_MULTI: flag attribute which user-space shall use to
+ *    indicate that it supports multiple active scheduled scan requests.
+ * @NL80211_ATTR_SCHED_SCAN_MAX_REQS: indicates maximum number of scheduled
+ *    scan request that may be active for the device (u32).
+ *
+ * @NL80211_ATTR_WANT_1X_4WAY_HS: flag attribute which user-space can include
+ *    in %NL80211_CMD_CONNECT to indicate that for 802.1X authentication it
+ *    wants to use the supported offload of the 4-way handshake.
+ * @NL80211_ATTR_PMKR0_NAME: PMK-R0 Name for offloaded FT.
+ * @NL80211_ATTR_PORT_AUTHORIZED: (reserved)
+ *
+ * @NL80211_ATTR_EXTERNAL_AUTH_ACTION: Identify the requested external
+ *    authentication operation (u32 attribute with an
+ *    &enum nl80211_external_auth_action value). This is used with the
+ *    %NL80211_CMD_EXTERNAL_AUTH request event.
+ * @NL80211_ATTR_EXTERNAL_AUTH_SUPPORT: Flag attribute indicating that the user
+ *    space supports external authentication. This attribute shall be used
+ *    with %NL80211_CMD_CONNECT and %NL80211_CMD_START_AP request. The driver
+ *    may offload authentication processing to user space if this capability
+ *    is indicated in the respective requests from the user space.
+ *
+ * @NL80211_ATTR_NSS: Station's New/updated  RX_NSS value notified using this
+ *    u8 attribute. This is used with %NL80211_CMD_STA_OPMODE_CHANGED.
+ *
+ * @NL80211_ATTR_TXQ_STATS: TXQ statistics (nested attribute, see &enum
+ *      nl80211_txq_stats)
+ * @NL80211_ATTR_TXQ_LIMIT: Total packet limit for the TXQ queues for this phy.
+ *      The smaller of this and the memory limit is enforced.
+ * @NL80211_ATTR_TXQ_MEMORY_LIMIT: Total memory memory limit (in bytes) for the
+ *    TXQ queues for this phy. The smaller of this and the packet limit is
+ *    enforced.
+ * @NL80211_ATTR_TXQ_QUANTUM: TXQ scheduler quantum (bytes). Number of bytes
+ *    a flow is assigned on each round of the DRR scheduler.
+ * @NL80211_ATTR_HE_CAPABILITY: HE Capability information element (from
+ *    association request when used with NL80211_CMD_NEW_STATION). Can be set
+ *    only if %NL80211_STA_FLAG_WME is set.
+ *
+ * @NL80211_ATTR_FTM_RESPONDER: nested attribute which user-space can include
+ *    in %NL80211_CMD_START_AP or %NL80211_CMD_SET_BEACON for fine timing
+ *    measurement (FTM) responder functionality and containing parameters as
+ *    possible, see &enum nl80211_ftm_responder_attr
+ *
+ * @NL80211_ATTR_FTM_RESPONDER_STATS: Nested attribute with FTM responder
+ *    statistics, see &enum nl80211_ftm_responder_stats.
+ *
+ * @NL80211_ATTR_TIMEOUT: Timeout for the given operation in milliseconds (u32),
+ *    if the attribute is not given no timeout is requested. Note that 0 is an
+ *    invalid value.
+ *
+ * @NL80211_ATTR_PEER_MEASUREMENTS: peer measurements request (and result)
+ *    data, uses nested attributes specified in
+ *    &enum nl80211_peer_measurement_attrs.
+ *    This is also used for capability advertisement in the wiphy information,
+ *    with the appropriate sub-attributes.
+ *
+ * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime
+ *    scheduler.
+ *
+ * @NL80211_ATTR_STA_TX_POWER_SETTING: Transmit power setting type (u8) for
+ *    station associated with the AP. See &enum nl80211_tx_power_setting for
+ *    possible values.
+ * @NL80211_ATTR_STA_TX_POWER: Transmit power level (s16) in dBm units. This
+ *    allows to set Tx power for a station. If this attribute is not included,
+ *    the default per-interface tx power setting will be overriding. Driver
+ *    should be picking up the lowest tx power, either tx power per-interface
+ *    or per-station.
+ *
+ * @NL80211_ATTR_SAE_PASSWORD: attribute for passing SAE password material. It
+ *    is used with %NL80211_CMD_CONNECT to provide password for offloading
+ *    SAE authentication for WPA3-Personal networks.
+ *
+ * @NL80211_ATTR_TWT_RESPONDER: Enable target wait time responder support.
+ *
+ * @NL80211_ATTR_HE_OBSS_PD: nested attribute for OBSS Packet Detection
+ *    functionality.
+ *
+ * @NL80211_ATTR_WIPHY_EDMG_CHANNELS: bitmap that indicates the 2.16 GHz
+ *    channel(s) that are allowed to be used for EDMG transmissions.
+ *    Defined by IEEE P802.11ay/D4.0 section 9.4.2.251. (u8 attribute)
+ * @NL80211_ATTR_WIPHY_EDMG_BW_CONFIG: Channel BW Configuration subfield encodes
+ *    the allowed channel bandwidth configurations. (u8 attribute)
+ *    Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13.
+ *
+ * @NUM_NL80211_ATTR: total number of nl80211_attrs available
+ * @NL80211_ATTR_MAX: highest attribute number currently defined
+ * @__NL80211_ATTR_AFTER_LAST: internal use
+ */
+enum nl80211_attrs {
+/* don't change the order or add anything between, this is ABI! */
+    NL80211_ATTR_UNSPEC,
+
+    NL80211_ATTR_WIPHY,
+    NL80211_ATTR_WIPHY_NAME,
+
+    NL80211_ATTR_IFINDEX,
+    NL80211_ATTR_IFNAME,
+    NL80211_ATTR_IFTYPE,
+
+    NL80211_ATTR_MAC,
+
+    NL80211_ATTR_KEY_DATA,
+    NL80211_ATTR_KEY_IDX,
+    NL80211_ATTR_KEY_CIPHER,
+    NL80211_ATTR_KEY_SEQ,
+    NL80211_ATTR_KEY_DEFAULT,
+
+    NL80211_ATTR_BEACON_INTERVAL,
+    NL80211_ATTR_DTIM_PERIOD,
+    NL80211_ATTR_BEACON_HEAD,
+    NL80211_ATTR_BEACON_TAIL,
+
+    NL80211_ATTR_STA_AID,
+    NL80211_ATTR_STA_FLAGS,
+    NL80211_ATTR_STA_LISTEN_INTERVAL,
+    NL80211_ATTR_STA_SUPPORTED_RATES,
+    NL80211_ATTR_STA_VLAN,
+    NL80211_ATTR_STA_INFO,
+
+    NL80211_ATTR_WIPHY_BANDS,
+
+    NL80211_ATTR_MNTR_FLAGS,
+
+    NL80211_ATTR_MESH_ID,
+    NL80211_ATTR_STA_PLINK_ACTION,
+    NL80211_ATTR_MPATH_NEXT_HOP,
+    NL80211_ATTR_MPATH_INFO,
+
+    NL80211_ATTR_BSS_CTS_PROT,
+    NL80211_ATTR_BSS_SHORT_PREAMBLE,
+    NL80211_ATTR_BSS_SHORT_SLOT_TIME,
+
+    NL80211_ATTR_HT_CAPABILITY,
+
+    NL80211_ATTR_SUPPORTED_IFTYPES,
+
+    NL80211_ATTR_REG_ALPHA2,
+    NL80211_ATTR_REG_RULES,
+
+    NL80211_ATTR_MESH_CONFIG,
+
+    NL80211_ATTR_BSS_BASIC_RATES,
+
+    NL80211_ATTR_WIPHY_TXQ_PARAMS,
+    NL80211_ATTR_WIPHY_FREQ,
+    NL80211_ATTR_WIPHY_CHANNEL_TYPE,
+
+    NL80211_ATTR_KEY_DEFAULT_MGMT,
+
+    NL80211_ATTR_MGMT_SUBTYPE,
+    NL80211_ATTR_IE,
+
+    NL80211_ATTR_MAX_NUM_SCAN_SSIDS,
+
+    NL80211_ATTR_SCAN_FREQUENCIES,
+    NL80211_ATTR_SCAN_SSIDS,
+    NL80211_ATTR_GENERATION, /* replaces old SCAN_GENERATION */
+    NL80211_ATTR_BSS,
+
+    NL80211_ATTR_REG_INITIATOR,
+    NL80211_ATTR_REG_TYPE,
+
+    NL80211_ATTR_SUPPORTED_COMMANDS,
+
+    NL80211_ATTR_FRAME,
+    NL80211_ATTR_SSID,
+    NL80211_ATTR_AUTH_TYPE,
+    NL80211_ATTR_REASON_CODE,
+
+    NL80211_ATTR_KEY_TYPE,
+
+    NL80211_ATTR_MAX_SCAN_IE_LEN,
+    NL80211_ATTR_CIPHER_SUITES,
+
+    NL80211_ATTR_FREQ_BEFORE,
+    NL80211_ATTR_FREQ_AFTER,
+
+    NL80211_ATTR_FREQ_FIXED,
+
+    NL80211_ATTR_WIPHY_RETRY_SHORT,
+    NL80211_ATTR_WIPHY_RETRY_LONG,
+    NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
+    NL80211_ATTR_WIPHY_RTS_THRESHOLD,
+
+    NL80211_ATTR_TIMED_OUT,
+
+    NL80211_ATTR_USE_MFP,
+
+    NL80211_ATTR_STA_FLAGS2,
+
+    NL80211_ATTR_CONTROL_PORT,
+
+    NL80211_ATTR_TESTDATA,
+
+    NL80211_ATTR_PRIVACY,
+
+    NL80211_ATTR_DISCONNECTED_BY_AP,
+    NL80211_ATTR_STATUS_CODE,
+
+    NL80211_ATTR_CIPHER_SUITES_PAIRWISE,
+    NL80211_ATTR_CIPHER_SUITE_GROUP,
+    NL80211_ATTR_WPA_VERSIONS,
+    NL80211_ATTR_AKM_SUITES,
+
+    NL80211_ATTR_REQ_IE,
+    NL80211_ATTR_RESP_IE,
+
+    NL80211_ATTR_PREV_BSSID,
+
+    NL80211_ATTR_KEY,
+    NL80211_ATTR_KEYS,
+
+    NL80211_ATTR_PID,
+
+    NL80211_ATTR_4ADDR,
+
+    NL80211_ATTR_SURVEY_INFO,
+
+    NL80211_ATTR_PMKID,
+    NL80211_ATTR_MAX_NUM_PMKIDS,
+
+    NL80211_ATTR_DURATION,
+
+    NL80211_ATTR_COOKIE,
+
+    NL80211_ATTR_WIPHY_COVERAGE_CLASS,
+
+    NL80211_ATTR_TX_RATES,
+
+    NL80211_ATTR_FRAME_MATCH,
+
+    NL80211_ATTR_ACK,
+
+    NL80211_ATTR_PS_STATE,
+
+    NL80211_ATTR_CQM,
+
+    NL80211_ATTR_LOCAL_STATE_CHANGE,
+
+    NL80211_ATTR_AP_ISOLATE,
+
+    NL80211_ATTR_WIPHY_TX_POWER_SETTING,
+    NL80211_ATTR_WIPHY_TX_POWER_LEVEL,
+
+    NL80211_ATTR_TX_FRAME_TYPES,
+    NL80211_ATTR_RX_FRAME_TYPES,
+    NL80211_ATTR_FRAME_TYPE,
+
+    NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
+    NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT,
+
+    NL80211_ATTR_SUPPORT_IBSS_RSN,
+
+    NL80211_ATTR_WIPHY_ANTENNA_TX,
+    NL80211_ATTR_WIPHY_ANTENNA_RX,
+
+    NL80211_ATTR_MCAST_RATE,
+
+    NL80211_ATTR_OFFCHANNEL_TX_OK,
+
+    NL80211_ATTR_BSS_HT_OPMODE,
+
+    NL80211_ATTR_KEY_DEFAULT_TYPES,
+
+    NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION,
+
+    NL80211_ATTR_MESH_SETUP,
+
+    NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX,
+    NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX,
+
+    NL80211_ATTR_SUPPORT_MESH_AUTH,
+    NL80211_ATTR_STA_PLINK_STATE,
+
+    NL80211_ATTR_WOWLAN_TRIGGERS,
+    NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED,
+
+    NL80211_ATTR_SCHED_SCAN_INTERVAL,
+
+    NL80211_ATTR_INTERFACE_COMBINATIONS,
+    NL80211_ATTR_SOFTWARE_IFTYPES,
+
+    NL80211_ATTR_REKEY_DATA,
+
+    NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS,
+    NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN,
+
+    NL80211_ATTR_SCAN_SUPP_RATES,
+
+    NL80211_ATTR_HIDDEN_SSID,
+
+    NL80211_ATTR_IE_PROBE_RESP,
+    NL80211_ATTR_IE_ASSOC_RESP,
+
+    NL80211_ATTR_STA_WME,
+    NL80211_ATTR_SUPPORT_AP_UAPSD,
+
+    NL80211_ATTR_ROAM_SUPPORT,
+
+    NL80211_ATTR_SCHED_SCAN_MATCH,
+    NL80211_ATTR_MAX_MATCH_SETS,
+
+    NL80211_ATTR_PMKSA_CANDIDATE,
+
+    NL80211_ATTR_TX_NO_CCK_RATE,
+
+    NL80211_ATTR_TDLS_ACTION,
+    NL80211_ATTR_TDLS_DIALOG_TOKEN,
+    NL80211_ATTR_TDLS_OPERATION,
+    NL80211_ATTR_TDLS_SUPPORT,
+    NL80211_ATTR_TDLS_EXTERNAL_SETUP,
+
+    NL80211_ATTR_DEVICE_AP_SME,
+
+    NL80211_ATTR_DONT_WAIT_FOR_ACK,
+
+    NL80211_ATTR_FEATURE_FLAGS,
+
+    NL80211_ATTR_PROBE_RESP_OFFLOAD,
+
+    NL80211_ATTR_PROBE_RESP,
+
+    NL80211_ATTR_DFS_REGION,
+
+    NL80211_ATTR_DISABLE_HT,
+    NL80211_ATTR_HT_CAPABILITY_MASK,
+
+    NL80211_ATTR_NOACK_MAP,
+
+    NL80211_ATTR_INACTIVITY_TIMEOUT,
+
+    NL80211_ATTR_RX_SIGNAL_DBM,
+
+    NL80211_ATTR_BG_SCAN_PERIOD,
+
+    NL80211_ATTR_WDEV,
+
+    NL80211_ATTR_USER_REG_HINT_TYPE,
+
+    NL80211_ATTR_CONN_FAILED_REASON,
+
+    NL80211_ATTR_AUTH_DATA,
+
+    NL80211_ATTR_VHT_CAPABILITY,
+
+    NL80211_ATTR_SCAN_FLAGS,
+
+    NL80211_ATTR_CHANNEL_WIDTH,
+    NL80211_ATTR_CENTER_FREQ1,
+    NL80211_ATTR_CENTER_FREQ2,
+
+    NL80211_ATTR_P2P_CTWINDOW,
+    NL80211_ATTR_P2P_OPPPS,
+
+    NL80211_ATTR_LOCAL_MESH_POWER_MODE,
+
+    NL80211_ATTR_ACL_POLICY,
+
+    NL80211_ATTR_MAC_ADDRS,
+
+    NL80211_ATTR_MAC_ACL_MAX,
+
+    NL80211_ATTR_RADAR_EVENT,
+
+    NL80211_ATTR_EXT_CAPA,
+    NL80211_ATTR_EXT_CAPA_MASK,
+
+    NL80211_ATTR_STA_CAPABILITY,
+    NL80211_ATTR_STA_EXT_CAPABILITY,
+
+    NL80211_ATTR_PROTOCOL_FEATURES,
+    NL80211_ATTR_SPLIT_WIPHY_DUMP,
+
+    NL80211_ATTR_DISABLE_VHT,
+    NL80211_ATTR_VHT_CAPABILITY_MASK,
+
+    NL80211_ATTR_MDID,
+    NL80211_ATTR_IE_RIC,
+
+    NL80211_ATTR_CRIT_PROT_ID,
+    NL80211_ATTR_MAX_CRIT_PROT_DURATION,
+
+    NL80211_ATTR_PEER_AID,
+
+    NL80211_ATTR_COALESCE_RULE,
+
+    NL80211_ATTR_CH_SWITCH_COUNT,
+    NL80211_ATTR_CH_SWITCH_BLOCK_TX,
+    NL80211_ATTR_CSA_IES,
+    NL80211_ATTR_CSA_C_OFF_BEACON,
+    NL80211_ATTR_CSA_C_OFF_PRESP,
+
+    NL80211_ATTR_RXMGMT_FLAGS,
+
+    NL80211_ATTR_STA_SUPPORTED_CHANNELS,
+
+    NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES,
+
+    NL80211_ATTR_HANDLE_DFS,
+
+    NL80211_ATTR_SUPPORT_5_MHZ,
+    NL80211_ATTR_SUPPORT_10_MHZ,
+
+    NL80211_ATTR_OPMODE_NOTIF,
+
+    NL80211_ATTR_VENDOR_ID,
+    NL80211_ATTR_VENDOR_SUBCMD,
+    NL80211_ATTR_VENDOR_DATA,
+    NL80211_ATTR_VENDOR_EVENTS,
+
+    NL80211_ATTR_QOS_MAP,
+
+    NL80211_ATTR_MAC_HINT,
+    NL80211_ATTR_WIPHY_FREQ_HINT,
+
+    NL80211_ATTR_MAX_AP_ASSOC_STA,
+
+    NL80211_ATTR_TDLS_PEER_CAPABILITY,
+
+    NL80211_ATTR_SOCKET_OWNER,
+
+    NL80211_ATTR_CSA_C_OFFSETS_TX,
+    NL80211_ATTR_MAX_CSA_COUNTERS,
+
+    NL80211_ATTR_TDLS_INITIATOR,
+
+    NL80211_ATTR_USE_RRM,
+
+    NL80211_ATTR_WIPHY_DYN_ACK,
+
+    NL80211_ATTR_TSID,
+    NL80211_ATTR_USER_PRIO,
+    NL80211_ATTR_ADMITTED_TIME,
+
+    NL80211_ATTR_SMPS_MODE,
+
+    NL80211_ATTR_OPER_CLASS,
+
+    NL80211_ATTR_MAC_MASK,
+
+    NL80211_ATTR_WIPHY_SELF_MANAGED_REG,
+
+    NL80211_ATTR_EXT_FEATURES,
+
+    NL80211_ATTR_SURVEY_RADIO_STATS,
+
+    NL80211_ATTR_NETNS_FD,
+
+    NL80211_ATTR_SCHED_SCAN_DELAY,
+
+    NL80211_ATTR_REG_INDOOR,
+
+    NL80211_ATTR_MAX_NUM_SCHED_SCAN_PLANS,
+    NL80211_ATTR_MAX_SCAN_PLAN_INTERVAL,
+    NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
+    NL80211_ATTR_SCHED_SCAN_PLANS,
+
+    NL80211_ATTR_PBSS,
+
+    NL80211_ATTR_BSS_SELECT,
+
+    NL80211_ATTR_STA_SUPPORT_P2P_PS,
+
+    NL80211_ATTR_PAD,
+
+    NL80211_ATTR_IFTYPE_EXT_CAPA,
+
+    NL80211_ATTR_MU_MIMO_GROUP_DATA,
+    NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR,
+
+    NL80211_ATTR_SCAN_START_TIME_TSF,
+    NL80211_ATTR_SCAN_START_TIME_TSF_BSSID,
+    NL80211_ATTR_MEASUREMENT_DURATION,
+    NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY,
+
+    NL80211_ATTR_MESH_PEER_AID,
+
+    NL80211_ATTR_NAN_MASTER_PREF,
+    NL80211_ATTR_BANDS,
+    NL80211_ATTR_NAN_FUNC,
+    NL80211_ATTR_NAN_MATCH,
+
+    NL80211_ATTR_FILS_KEK,
+    NL80211_ATTR_FILS_NONCES,
+
+    NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED,
+
+    NL80211_ATTR_BSSID,
+
+    NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI,
+    NL80211_ATTR_SCHED_SCAN_RSSI_ADJUST,
+
+    NL80211_ATTR_TIMEOUT_REASON,
+
+    NL80211_ATTR_FILS_ERP_USERNAME,
+    NL80211_ATTR_FILS_ERP_REALM,
+    NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM,
+    NL80211_ATTR_FILS_ERP_RRK,
+    NL80211_ATTR_FILS_CACHE_ID,
+
+    NL80211_ATTR_PMK,
+
+    NL80211_ATTR_SCHED_SCAN_MULTI,
+    NL80211_ATTR_SCHED_SCAN_MAX_REQS,
+
+    NL80211_ATTR_WANT_1X_4WAY_HS,
+    NL80211_ATTR_PMKR0_NAME,
+    NL80211_ATTR_PORT_AUTHORIZED,
+
+    NL80211_ATTR_EXTERNAL_AUTH_ACTION,
+    NL80211_ATTR_EXTERNAL_AUTH_SUPPORT,
+
+    NL80211_ATTR_NSS,
+    NL80211_ATTR_ACK_SIGNAL,
+
+    NL80211_ATTR_CONTROL_PORT_OVER_NL80211,
+
+    NL80211_ATTR_TXQ_STATS,
+    NL80211_ATTR_TXQ_LIMIT,
+    NL80211_ATTR_TXQ_MEMORY_LIMIT,
+    NL80211_ATTR_TXQ_QUANTUM,
+
+    NL80211_ATTR_HE_CAPABILITY,
+
+    NL80211_ATTR_FTM_RESPONDER,
+
+    NL80211_ATTR_FTM_RESPONDER_STATS,
+
+    NL80211_ATTR_TIMEOUT,
+
+    NL80211_ATTR_PEER_MEASUREMENTS,
+
+    NL80211_ATTR_AIRTIME_WEIGHT,
+    NL80211_ATTR_STA_TX_POWER_SETTING,
+    NL80211_ATTR_STA_TX_POWER,
+
+    NL80211_ATTR_SAE_PASSWORD,
+
+    NL80211_ATTR_TWT_RESPONDER,
+
+    NL80211_ATTR_HE_OBSS_PD,
+
+    NL80211_ATTR_WIPHY_EDMG_CHANNELS,
+    NL80211_ATTR_WIPHY_EDMG_BW_CONFIG,
+
+    /* add attributes here, update the policy in nl80211.c */
+
+    __NL80211_ATTR_AFTER_LAST,
+    NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST,
+    NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
+};
+
+/* source-level API compatibility */
+#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION
+#define NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG
+#define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER
+#define NL80211_ATTR_SAE_DATA NL80211_ATTR_AUTH_DATA
+
+/*
+ * Allow user space programs to use #ifdef on new attributes by defining them
+ * here
+ */
+#define NL80211_CMD_CONNECT NL80211_CMD_CONNECT
+#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY
+#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
+#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS
+#define NL80211_ATTR_WIPHY_FREQ NL80211_ATTR_WIPHY_FREQ
+#define NL80211_ATTR_WIPHY_CHANNEL_TYPE NL80211_ATTR_WIPHY_CHANNEL_TYPE
+#define NL80211_ATTR_MGMT_SUBTYPE NL80211_ATTR_MGMT_SUBTYPE
+#define NL80211_ATTR_IE NL80211_ATTR_IE
+#define NL80211_ATTR_REG_INITIATOR NL80211_ATTR_REG_INITIATOR
+#define NL80211_ATTR_REG_TYPE NL80211_ATTR_REG_TYPE
+#define NL80211_ATTR_FRAME NL80211_ATTR_FRAME
+#define NL80211_ATTR_SSID NL80211_ATTR_SSID
+#define NL80211_ATTR_AUTH_TYPE NL80211_ATTR_AUTH_TYPE
+#define NL80211_ATTR_REASON_CODE NL80211_ATTR_REASON_CODE
+#define NL80211_ATTR_CIPHER_SUITES_PAIRWISE NL80211_ATTR_CIPHER_SUITES_PAIRWISE
+#define NL80211_ATTR_CIPHER_SUITE_GROUP NL80211_ATTR_CIPHER_SUITE_GROUP
+#define NL80211_ATTR_WPA_VERSIONS NL80211_ATTR_WPA_VERSIONS
+#define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES
+#define NL80211_ATTR_KEY NL80211_ATTR_KEY
+#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS
+#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
+
+#define NL80211_WIPHY_NAME_MAXLEN        64
+
+#define NL80211_MAX_SUPP_RATES            32
+#define NL80211_MAX_SUPP_HT_RATES        77
+#define NL80211_MAX_SUPP_REG_RULES        128
+#define NL80211_TKIP_DATA_OFFSET_ENCR_KEY    0
+#define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY    16
+#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY    24
+#define NL80211_HT_CAPABILITY_LEN        26
+#define NL80211_VHT_CAPABILITY_LEN        12
+#define NL80211_HE_MIN_CAPABILITY_LEN           16
+#define NL80211_HE_MAX_CAPABILITY_LEN           54
+#define NL80211_MAX_NR_CIPHER_SUITES        5
+#define NL80211_MAX_NR_AKM_SUITES        2
+
+#define NL80211_MIN_REMAIN_ON_CHANNEL_TIME    10
+
+/* default RSSI threshold for scan results if none specified. */
+#define NL80211_SCAN_RSSI_THOLD_OFF        -300
+
+#define NL80211_CQM_TXE_MAX_INTVL        1800
+
+/**
+ * enum nl80211_iftype - (virtual) interface types
+ *
+ * @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides
+ * @NL80211_IFTYPE_ADHOC: independent BSS member
+ * @NL80211_IFTYPE_STATION: managed BSS member
+ * @NL80211_IFTYPE_AP: access point
+ * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points; VLAN interfaces
+ *    are a bit special in that they must always be tied to a pre-existing
+ *    AP type interface.
+ * @NL80211_IFTYPE_WDS: wireless distribution interface
+ * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
+ * @NL80211_IFTYPE_MESH_POINT: mesh point
+ * @NL80211_IFTYPE_P2P_CLIENT: P2P client
+ * @NL80211_IFTYPE_P2P_GO: P2P group owner
+ * @NL80211_IFTYPE_P2P_DEVICE: P2P device interface type, this is not a netdev
+ *    and therefore can't be created in the normal ways, use the
+ *    %NL80211_CMD_START_P2P_DEVICE and %NL80211_CMD_STOP_P2P_DEVICE
+ *    commands to create and destroy one
+ * @NL80211_IF_TYPE_OCB: Outside Context of a BSS
+ *    This mode corresponds to the MIB variable dot11OCBActivated=true
+ * @NL80211_IFTYPE_NAN: NAN device interface type (not a netdev)
+ * @NL80211_IFTYPE_MAX: highest interface type number currently defined
+ * @NUM_NL80211_IFTYPES: number of defined interface types
+ *
+ * These values are used with the %NL80211_ATTR_IFTYPE
+ * to set the type of an interface.
+ *
+ */
+enum nl80211_iftype {
+    NL80211_IFTYPE_UNSPECIFIED,
+    NL80211_IFTYPE_ADHOC,
+    NL80211_IFTYPE_STATION,
+    NL80211_IFTYPE_AP,
+    NL80211_IFTYPE_AP_VLAN,
+    NL80211_IFTYPE_WDS,
+    NL80211_IFTYPE_MONITOR,
+    NL80211_IFTYPE_MESH_POINT,
+    NL80211_IFTYPE_P2P_CLIENT,
+    NL80211_IFTYPE_P2P_GO,
+    NL80211_IFTYPE_P2P_DEVICE,
+    NL80211_IFTYPE_OCB,
+    NL80211_IFTYPE_NAN,
+
+    /* keep last */
+    NUM_NL80211_IFTYPES,
+    NL80211_IFTYPE_MAX = NUM_NL80211_IFTYPES - 1
+};
+
+/**
+ * enum nl80211_sta_flags - station flags
+ *
+ * Station flags. When a station is added to an AP interface, it is
+ * assumed to be already associated (and hence authenticated.)
+ *
+ * @__NL80211_STA_FLAG_INVALID: attribute number 0 is reserved
+ * @NL80211_STA_FLAG_AUTHORIZED: station is authorized (802.1X)
+ * @NL80211_STA_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
+ *    with short barker preamble
+ * @NL80211_STA_FLAG_WME: station is WME/QoS capable
+ * @NL80211_STA_FLAG_MFP: station uses management frame protection
+ * @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated
+ * @NL80211_STA_FLAG_TDLS_PEER: station is a TDLS peer -- this flag should
+ *    only be used in managed mode (even in the flags mask). Note that the
+ *    flag can't be changed, it is only valid while adding a station, and
+ *    attempts to change it will silently be ignored (rather than rejected
+ *    as errors.)
+ * @NL80211_STA_FLAG_ASSOCIATED: station is associated; used with drivers
+ *    that support %NL80211_FEATURE_FULL_AP_CLIENT_STATE to transition a
+ *    previously added station into associated state
+ * @NL80211_STA_FLAG_MAX: highest station flag number currently defined
+ * @__NL80211_STA_FLAG_AFTER_LAST: internal use
+ */
+enum nl80211_sta_flags {
+    __NL80211_STA_FLAG_INVALID,
+    NL80211_STA_FLAG_AUTHORIZED,
+    NL80211_STA_FLAG_SHORT_PREAMBLE,
+    NL80211_STA_FLAG_WME,
+    NL80211_STA_FLAG_MFP,
+    NL80211_STA_FLAG_AUTHENTICATED,
+    NL80211_STA_FLAG_TDLS_PEER,
+    NL80211_STA_FLAG_ASSOCIATED,
+
+    /* keep last */
+    __NL80211_STA_FLAG_AFTER_LAST,
+    NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_sta_p2p_ps_status - station support of P2P PS
+ *
+ * @NL80211_P2P_PS_UNSUPPORTED: station doesn't support P2P PS mechanism
+ * @@NL80211_P2P_PS_SUPPORTED: station supports P2P PS mechanism
+ * @NUM_NL80211_P2P_PS_STATUS: number of values
+ */
+enum nl80211_sta_p2p_ps_status {
+    NL80211_P2P_PS_UNSUPPORTED = 0,
+    NL80211_P2P_PS_SUPPORTED,
+
+    NUM_NL80211_P2P_PS_STATUS,
+};
+
+#define NL80211_STA_FLAG_MAX_OLD_API    NL80211_STA_FLAG_TDLS_PEER
+
+/**
+ * struct nl80211_sta_flag_update - station flags mask/set
+ * @mask: mask of station flags to set
+ * @set: which values to set them to
+ *
+ * Both mask and set contain bits as per &enum nl80211_sta_flags.
+ */
+struct nl80211_sta_flag_update {
+    __u32 mask;
+    __u32 set;
+} __attribute__((packed));
+
+/**
+ * enum nl80211_he_gi - HE guard interval
+ * @NL80211_RATE_INFO_HE_GI_0_8: 0.8 usec
+ * @NL80211_RATE_INFO_HE_GI_1_6: 1.6 usec
+ * @NL80211_RATE_INFO_HE_GI_3_2: 3.2 usec
+ */
+enum nl80211_he_gi {
+    NL80211_RATE_INFO_HE_GI_0_8,
+    NL80211_RATE_INFO_HE_GI_1_6,
+    NL80211_RATE_INFO_HE_GI_3_2,
+};
+
+/**
+ * enum nl80211_he_ru_alloc - HE RU allocation values
+ * @NL80211_RATE_INFO_HE_RU_ALLOC_26: 26-tone RU allocation
+ * @NL80211_RATE_INFO_HE_RU_ALLOC_52: 52-tone RU allocation
+ * @NL80211_RATE_INFO_HE_RU_ALLOC_106: 106-tone RU allocation
+ * @NL80211_RATE_INFO_HE_RU_ALLOC_242: 242-tone RU allocation
+ * @NL80211_RATE_INFO_HE_RU_ALLOC_484: 484-tone RU allocation
+ * @NL80211_RATE_INFO_HE_RU_ALLOC_996: 996-tone RU allocation
+ * @NL80211_RATE_INFO_HE_RU_ALLOC_2x996: 2x996-tone RU allocation
+ */
+enum nl80211_he_ru_alloc {
+    NL80211_RATE_INFO_HE_RU_ALLOC_26,
+    NL80211_RATE_INFO_HE_RU_ALLOC_52,
+    NL80211_RATE_INFO_HE_RU_ALLOC_106,
+    NL80211_RATE_INFO_HE_RU_ALLOC_242,
+    NL80211_RATE_INFO_HE_RU_ALLOC_484,
+    NL80211_RATE_INFO_HE_RU_ALLOC_996,
+    NL80211_RATE_INFO_HE_RU_ALLOC_2x996,
+};
+
+/**
+ * enum nl80211_rate_info - bitrate information
+ *
+ * These attribute types are used with %NL80211_STA_INFO_TXRATE
+ * when getting information about the bitrate of a station.
+ * There are 2 attributes for bitrate, a legacy one that represents
+ * a 16-bit value, and new one that represents a 32-bit value.
+ * If the rate value fits into 16 bit, both attributes are reported
+ * with the same value. If the rate is too high to fit into 16 bits
+ * (>6.5535Gbps) only 32-bit attribute is included.
+ * User space tools encouraged to use the 32-bit attribute and fall
+ * back to the 16-bit one for compatibility with older kernels.
+ *
+ * @__NL80211_RATE_INFO_INVALID: attribute number 0 is reserved
+ * @NL80211_RATE_INFO_BITRATE: total bitrate (u16, 100kbit/s)
+ * @NL80211_RATE_INFO_MCS: mcs index for 802.11n (u8)
+ * @NL80211_RATE_INFO_40_MHZ_WIDTH: 40 MHz dualchannel bitrate
+ * @NL80211_RATE_INFO_SHORT_GI: 400ns guard interval
+ * @NL80211_RATE_INFO_BITRATE32: total bitrate (u32, 100kbit/s)
+ * @NL80211_RATE_INFO_MAX: highest rate_info number currently defined
+ * @NL80211_RATE_INFO_VHT_MCS: MCS index for VHT (u8)
+ * @NL80211_RATE_INFO_VHT_NSS: number of streams in VHT (u8)
+ * @NL80211_RATE_INFO_80_MHZ_WIDTH: 80 MHz VHT rate
+ * @NL80211_RATE_INFO_80P80_MHZ_WIDTH: unused - 80+80 is treated the
+ *    same as 160 for purposes of the bitrates
+ * @NL80211_RATE_INFO_160_MHZ_WIDTH: 160 MHz VHT rate
+ * @NL80211_RATE_INFO_10_MHZ_WIDTH: 10 MHz width - note that this is
+ *    a legacy rate and will be reported as the actual bitrate, i.e.
+ *    half the base (20 MHz) rate
+ * @NL80211_RATE_INFO_5_MHZ_WIDTH: 5 MHz width - note that this is
+ *    a legacy rate and will be reported as the actual bitrate, i.e.
+ *    a quarter of the base (20 MHz) rate
+ * @NL80211_RATE_INFO_HE_MCS: HE MCS index (u8, 0-11)
+ * @NL80211_RATE_INFO_HE_NSS: HE NSS value (u8, 1-8)
+ * @NL80211_RATE_INFO_HE_GI: HE guard interval identifier
+ *    (u8, see &enum nl80211_he_gi)
+ * @NL80211_RATE_INFO_HE_DCM: HE DCM value (u8, 0/1)
+ * @NL80211_RATE_INFO_RU_ALLOC: HE RU allocation, if not present then
+ *    non-OFDMA was used (u8, see &enum nl80211_he_ru_alloc)
+ * @__NL80211_RATE_INFO_AFTER_LAST: internal use
+ */
+enum nl80211_rate_info {
+    __NL80211_RATE_INFO_INVALID,
+    NL80211_RATE_INFO_BITRATE,
+    NL80211_RATE_INFO_MCS,
+    NL80211_RATE_INFO_40_MHZ_WIDTH,
+    NL80211_RATE_INFO_SHORT_GI,
+    NL80211_RATE_INFO_BITRATE32,
+    NL80211_RATE_INFO_VHT_MCS,
+    NL80211_RATE_INFO_VHT_NSS,
+    NL80211_RATE_INFO_80_MHZ_WIDTH,
+    NL80211_RATE_INFO_80P80_MHZ_WIDTH,
+    NL80211_RATE_INFO_160_MHZ_WIDTH,
+    NL80211_RATE_INFO_10_MHZ_WIDTH,
+    NL80211_RATE_INFO_5_MHZ_WIDTH,
+    NL80211_RATE_INFO_HE_MCS,
+    NL80211_RATE_INFO_HE_NSS,
+    NL80211_RATE_INFO_HE_GI,
+    NL80211_RATE_INFO_HE_DCM,
+    NL80211_RATE_INFO_HE_RU_ALLOC,
+
+    /* keep last */
+    __NL80211_RATE_INFO_AFTER_LAST,
+    NL80211_RATE_INFO_MAX = __NL80211_RATE_INFO_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_sta_bss_param - BSS information collected by STA
+ *
+ * These attribute types are used with %NL80211_STA_INFO_BSS_PARAM
+ * when getting information about the bitrate of a station.
+ *
+ * @__NL80211_STA_BSS_PARAM_INVALID: attribute number 0 is reserved
+ * @NL80211_STA_BSS_PARAM_CTS_PROT: whether CTS protection is enabled (flag)
+ * @NL80211_STA_BSS_PARAM_SHORT_PREAMBLE:  whether short preamble is enabled
+ *    (flag)
+ * @NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME:  whether short slot time is enabled
+ *    (flag)
+ * @NL80211_STA_BSS_PARAM_DTIM_PERIOD: DTIM period for beaconing (u8)
+ * @NL80211_STA_BSS_PARAM_BEACON_INTERVAL: Beacon interval (u16)
+ * @NL80211_STA_BSS_PARAM_MAX: highest sta_bss_param number currently defined
+ * @__NL80211_STA_BSS_PARAM_AFTER_LAST: internal use
+ */
+enum nl80211_sta_bss_param {
+    __NL80211_STA_BSS_PARAM_INVALID,
+    NL80211_STA_BSS_PARAM_CTS_PROT,
+    NL80211_STA_BSS_PARAM_SHORT_PREAMBLE,
+    NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME,
+    NL80211_STA_BSS_PARAM_DTIM_PERIOD,
+    NL80211_STA_BSS_PARAM_BEACON_INTERVAL,
+
+    /* keep last */
+    __NL80211_STA_BSS_PARAM_AFTER_LAST,
+    NL80211_STA_BSS_PARAM_MAX = __NL80211_STA_BSS_PARAM_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_sta_info - station information
+ *
+ * These attribute types are used with %NL80211_ATTR_STA_INFO
+ * when getting information about a station.
+ *
+ * @__NL80211_STA_INFO_INVALID: attribute number 0 is reserved
+ * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs)
+ * @NL80211_STA_INFO_RX_BYTES: total received bytes (MPDU length)
+ *    (u32, from this station)
+ * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (MPDU length)
+ *    (u32, to this station)
+ * @NL80211_STA_INFO_RX_BYTES64: total received bytes (MPDU length)
+ *    (u64, from this station)
+ * @NL80211_STA_INFO_TX_BYTES64: total transmitted bytes (MPDU length)
+ *    (u64, to this station)
+ * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm)
+ * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute
+ *     containing info as possible, see &enum nl80211_rate_info
+ * @NL80211_STA_INFO_RX_PACKETS: total received packet (MSDUs and MMPDUs)
+ *    (u32, from this station)
+ * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (MSDUs and MMPDUs)
+ *    (u32, to this station)
+ * @NL80211_STA_INFO_TX_RETRIES: total retries (MPDUs) (u32, to this station)
+ * @NL80211_STA_INFO_TX_FAILED: total failed packets (MPDUs)
+ *    (u32, to this station)
+ * @NL80211_STA_INFO_SIGNAL_AVG: signal strength average (u8, dBm)
+ * @NL80211_STA_INFO_LLID: the station's mesh LLID
+ * @NL80211_STA_INFO_PLID: the station's mesh PLID
+ * @NL80211_STA_INFO_PLINK_STATE: peer link state for the station
+ *    (see %enum nl80211_plink_state)
+ * @NL80211_STA_INFO_RX_BITRATE: last unicast data frame rx rate, nested
+ *    attribute, like NL80211_STA_INFO_TX_BITRATE.
+ * @NL80211_STA_INFO_BSS_PARAM: current station's view of BSS, nested attribute
+ *     containing info as possible, see &enum nl80211_sta_bss_param
+ * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected
+ * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update.
+ * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32)
+ * @NL80211_STA_INFO_T_OFFSET: timing offset with respect to this STA (s64)
+ * @NL80211_STA_INFO_LOCAL_PM: local mesh STA link-specific power mode
+ * @NL80211_STA_INFO_PEER_PM: peer mesh STA link-specific power mode
+ * @NL80211_STA_INFO_NONPEER_PM: neighbor mesh STA power save mode towards
+ *    non-peer STA
+ * @NL80211_STA_INFO_CHAIN_SIGNAL: per-chain signal strength of last PPDU
+ *    Contains a nested array of signal strength attributes (u8, dBm)
+ * @NL80211_STA_INFO_CHAIN_SIGNAL_AVG: per-chain signal strength average
+ *    Same format as NL80211_STA_INFO_CHAIN_SIGNAL.
+ * @NL80211_STA_EXPECTED_THROUGHPUT: expected throughput considering also the
+ *    802.11 header (u32, kbps)
+ * @NL80211_STA_INFO_RX_DROP_MISC: RX packets dropped for unspecified reasons
+ *    (u64)
+ * @NL80211_STA_INFO_BEACON_RX: number of beacons received from this peer (u64)
+ * @NL80211_STA_INFO_BEACON_SIGNAL_AVG: signal strength average
+ *    for beacons only (u8, dBm)
+ * @NL80211_STA_INFO_TID_STATS: per-TID statistics (see &enum nl80211_tid_stats)
+ *    This is a nested attribute where each the inner attribute number is the
+ *    TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
+ *    each one of those is again nested with &enum nl80211_tid_stats
+ *    attributes carrying the actual values.
+ * @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration for all frames
+ *    received from the station (u64, usec)
+ * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment
+ * @NL80211_STA_INFO_ACK_SIGNAL: signal strength of the last ACK frame(u8, dBm)
+ * @NL80211_STA_INFO_ACK_SIGNAL_AVG: avg signal strength of ACK frames (s8, dBm)
+ * @NL80211_STA_INFO_RX_MPDUS: total number of received packets (MPDUs)
+ *    (u32, from this station)
+ * @NL80211_STA_INFO_FCS_ERROR_COUNT: total number of packets (MPDUs) received
+ *    with an FCS error (u32, from this station). This count may not include
+ *    some packets with an FCS error due to TA corruption. Hence this counter
+ *    might not be fully accurate.
+ * @NL80211_STA_INFO_CONNECTED_TO_GATE: set to true if STA has a path to a
+ *    mesh gate (u8, 0 or 1)
+ * @NL80211_STA_INFO_TX_DURATION: aggregate PPDU duration for all frames
+ *    sent to the station (u64, usec)
+ * @NL80211_STA_INFO_AIRTIME_WEIGHT: current airtime weight for station (u16)
+ * @NL80211_STA_INFO_AIRTIME_LINK_METRIC: airtime link metric for mesh station
+ * @NL80211_STA_INFO_ASSOC_AT_BOOTTIME: Timestamp (CLOCK_BOOTTIME, nanoseconds)
+ *    of STA's association
+ * @__NL80211_STA_INFO_AFTER_LAST: internal
+ * @NL80211_STA_INFO_MAX: highest possible station info attribute
+ */
+enum nl80211_sta_info {
+    __NL80211_STA_INFO_INVALID,
+    NL80211_STA_INFO_INACTIVE_TIME,
+    NL80211_STA_INFO_RX_BYTES,
+    NL80211_STA_INFO_TX_BYTES,
+    NL80211_STA_INFO_LLID,
+    NL80211_STA_INFO_PLID,
+    NL80211_STA_INFO_PLINK_STATE,
+    NL80211_STA_INFO_SIGNAL,
+    NL80211_STA_INFO_TX_BITRATE,
+    NL80211_STA_INFO_RX_PACKETS,
+    NL80211_STA_INFO_TX_PACKETS,
+    NL80211_STA_INFO_TX_RETRIES,
+    NL80211_STA_INFO_TX_FAILED,
+    NL80211_STA_INFO_SIGNAL_AVG,
+    NL80211_STA_INFO_RX_BITRATE,
+    NL80211_STA_INFO_BSS_PARAM,
+    NL80211_STA_INFO_CONNECTED_TIME,
+    NL80211_STA_INFO_STA_FLAGS,
+    NL80211_STA_INFO_BEACON_LOSS,
+    NL80211_STA_INFO_T_OFFSET,
+    NL80211_STA_INFO_LOCAL_PM,
+    NL80211_STA_INFO_PEER_PM,
+    NL80211_STA_INFO_NONPEER_PM,
+    NL80211_STA_INFO_RX_BYTES64,
+    NL80211_STA_INFO_TX_BYTES64,
+    NL80211_STA_INFO_CHAIN_SIGNAL,
+    NL80211_STA_INFO_CHAIN_SIGNAL_AVG,
+    NL80211_STA_INFO_EXPECTED_THROUGHPUT,
+    NL80211_STA_INFO_RX_DROP_MISC,
+    NL80211_STA_INFO_BEACON_RX,
+    NL80211_STA_INFO_BEACON_SIGNAL_AVG,
+    NL80211_STA_INFO_TID_STATS,
+    NL80211_STA_INFO_RX_DURATION,
+    NL80211_STA_INFO_PAD,
+    NL80211_STA_INFO_ACK_SIGNAL,
+    NL80211_STA_INFO_ACK_SIGNAL_AVG,
+    NL80211_STA_INFO_RX_MPDUS,
+    NL80211_STA_INFO_FCS_ERROR_COUNT,
+    NL80211_STA_INFO_CONNECTED_TO_GATE,
+    NL80211_STA_INFO_TX_DURATION,
+    NL80211_STA_INFO_AIRTIME_WEIGHT,
+    NL80211_STA_INFO_AIRTIME_LINK_METRIC,
+    NL80211_STA_INFO_ASSOC_AT_BOOTTIME,
+
+    /* keep last */
+    __NL80211_STA_INFO_AFTER_LAST,
+    NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1
+};
+
+/* we renamed this - stay compatible */
+#define NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG NL80211_STA_INFO_ACK_SIGNAL_AVG
+
+/**
+ * enum nl80211_tid_stats - per TID statistics attributes
+ * @__NL80211_TID_STATS_INVALID: attribute number 0 is reserved
+ * @NL80211_TID_STATS_RX_MSDU: number of MSDUs received (u64)
+ * @NL80211_TID_STATS_TX_MSDU: number of MSDUs transmitted (or
+ *    attempted to transmit; u64)
+ * @NL80211_TID_STATS_TX_MSDU_RETRIES: number of retries for
+ *    transmitted MSDUs (not counting the first attempt; u64)
+ * @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted
+ *    MSDUs (u64)
+ * @NL80211_TID_STATS_PAD: attribute used for padding for 64-bit alignment
+ * @NL80211_TID_STATS_TXQ_STATS: TXQ stats (nested attribute)
+ * @NUM_NL80211_TID_STATS: number of attributes here
+ * @NL80211_TID_STATS_MAX: highest numbered attribute here
+ */
+enum nl80211_tid_stats {
+    __NL80211_TID_STATS_INVALID,
+    NL80211_TID_STATS_RX_MSDU,
+    NL80211_TID_STATS_TX_MSDU,
+    NL80211_TID_STATS_TX_MSDU_RETRIES,
+    NL80211_TID_STATS_TX_MSDU_FAILED,
+    NL80211_TID_STATS_PAD,
+    NL80211_TID_STATS_TXQ_STATS,
+
+    /* keep last */
+    NUM_NL80211_TID_STATS,
+    NL80211_TID_STATS_MAX = NUM_NL80211_TID_STATS - 1
+};
+
+/**
+ * enum nl80211_txq_stats - per TXQ statistics attributes
+ * @__NL80211_TXQ_STATS_INVALID: attribute number 0 is reserved
+ * @NUM_NL80211_TXQ_STATS: number of attributes here
+ * @NL80211_TXQ_STATS_BACKLOG_BYTES: number of bytes currently backlogged
+ * @NL80211_TXQ_STATS_BACKLOG_PACKETS: number of packets currently
+ *    backlogged
+ * @NL80211_TXQ_STATS_FLOWS: total number of new flows seen
+ * @NL80211_TXQ_STATS_DROPS: total number of packet drops
+ * @NL80211_TXQ_STATS_ECN_MARKS: total number of packet ECN marks
+ * @NL80211_TXQ_STATS_OVERLIMIT: number of drops due to queue space overflow
+ * @NL80211_TXQ_STATS_OVERMEMORY: number of drops due to memory limit overflow
+ *    (only for per-phy stats)
+ * @NL80211_TXQ_STATS_COLLISIONS: number of hash collisions
+ * @NL80211_TXQ_STATS_TX_BYTES: total number of bytes dequeued from TXQ
+ * @NL80211_TXQ_STATS_TX_PACKETS: total number of packets dequeued from TXQ
+ * @NL80211_TXQ_STATS_MAX_FLOWS: number of flow buckets for PHY
+ * @NL80211_TXQ_STATS_MAX: highest numbered attribute here
+ */
+enum nl80211_txq_stats {
+    __NL80211_TXQ_STATS_INVALID,
+    NL80211_TXQ_STATS_BACKLOG_BYTES,
+    NL80211_TXQ_STATS_BACKLOG_PACKETS,
+    NL80211_TXQ_STATS_FLOWS,
+    NL80211_TXQ_STATS_DROPS,
+    NL80211_TXQ_STATS_ECN_MARKS,
+    NL80211_TXQ_STATS_OVERLIMIT,
+    NL80211_TXQ_STATS_OVERMEMORY,
+    NL80211_TXQ_STATS_COLLISIONS,
+    NL80211_TXQ_STATS_TX_BYTES,
+    NL80211_TXQ_STATS_TX_PACKETS,
+    NL80211_TXQ_STATS_MAX_FLOWS,
+
+    /* keep last */
+    NUM_NL80211_TXQ_STATS,
+    NL80211_TXQ_STATS_MAX = NUM_NL80211_TXQ_STATS - 1
+};
+
+/**
+ * enum nl80211_mpath_flags - nl80211 mesh path flags
+ *
+ * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active
+ * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running
+ * @NL80211_MPATH_FLAG_SN_VALID: the mesh path contains a valid SN
+ * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set
+ * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded
+ */
+enum nl80211_mpath_flags {
+    NL80211_MPATH_FLAG_ACTIVE =    1<<0,
+    NL80211_MPATH_FLAG_RESOLVING =    1<<1,
+    NL80211_MPATH_FLAG_SN_VALID =    1<<2,
+    NL80211_MPATH_FLAG_FIXED =    1<<3,
+    NL80211_MPATH_FLAG_RESOLVED =    1<<4,
+};
+
+/**
+ * enum nl80211_mpath_info - mesh path information
+ *
+ * These attribute types are used with %NL80211_ATTR_MPATH_INFO when getting
+ * information about a mesh path.
+ *
+ * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved
+ * @NL80211_MPATH_INFO_FRAME_QLEN: number of queued frames for this destination
+ * @NL80211_MPATH_INFO_SN: destination sequence number
+ * @NL80211_MPATH_INFO_METRIC: metric (cost) of this mesh path
+ * @NL80211_MPATH_INFO_EXPTIME: expiration time for the path, in msec from now
+ * @NL80211_MPATH_INFO_FLAGS: mesh path flags, enumerated in
+ *     &enum nl80211_mpath_flags;
+ * @NL80211_MPATH_INFO_DISCOVERY_TIMEOUT: total path discovery timeout, in msec
+ * @NL80211_MPATH_INFO_DISCOVERY_RETRIES: mesh path discovery retries
+ * @NL80211_MPATH_INFO_HOP_COUNT: hop count to destination
+ * @NL80211_MPATH_INFO_PATH_CHANGE: total number of path changes to destination
+ * @NL80211_MPATH_INFO_MAX: highest mesh path information attribute number
+ *    currently defined
+ * @__NL80211_MPATH_INFO_AFTER_LAST: internal use
+ */
+enum nl80211_mpath_info {
+    __NL80211_MPATH_INFO_INVALID,
+    NL80211_MPATH_INFO_FRAME_QLEN,
+    NL80211_MPATH_INFO_SN,
+    NL80211_MPATH_INFO_METRIC,
+    NL80211_MPATH_INFO_EXPTIME,
+    NL80211_MPATH_INFO_FLAGS,
+    NL80211_MPATH_INFO_DISCOVERY_TIMEOUT,
+    NL80211_MPATH_INFO_DISCOVERY_RETRIES,
+    NL80211_MPATH_INFO_HOP_COUNT,
+    NL80211_MPATH_INFO_PATH_CHANGE,
+
+    /* keep last */
+    __NL80211_MPATH_INFO_AFTER_LAST,
+    NL80211_MPATH_INFO_MAX = __NL80211_MPATH_INFO_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_band_iftype_attr - Interface type data attributes
+ *
+ * @__NL80211_BAND_IFTYPE_ATTR_INVALID: attribute number 0 is reserved
+ * @NL80211_BAND_IFTYPE_ATTR_IFTYPES: nested attribute containing a flag attribute
+ *     for each interface type that supports the band data
+ * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC: HE MAC capabilities as in HE
+ *     capabilities IE
+ * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY: HE PHY capabilities as in HE
+ *     capabilities IE
+ * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET: HE supported NSS/MCS as in HE
+ *     capabilities IE
+ * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE: HE PPE thresholds information as
+ *     defined in HE capabilities IE
+ * @NL80211_BAND_IFTYPE_ATTR_MAX: highest band HE capability attribute currently
+ *     defined
+ * @__NL80211_BAND_IFTYPE_ATTR_AFTER_LAST: internal use
+ */
+enum nl80211_band_iftype_attr {
+    __NL80211_BAND_IFTYPE_ATTR_INVALID,
+
+    NL80211_BAND_IFTYPE_ATTR_IFTYPES,
+    NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC,
+    NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY,
+    NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET,
+    NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE,
+
+    /* keep last */
+    __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST,
+    NL80211_BAND_IFTYPE_ATTR_MAX = __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_band_attr - band attributes
+ * @__NL80211_BAND_ATTR_INVALID: attribute number 0 is reserved
+ * @NL80211_BAND_ATTR_FREQS: supported frequencies in this band,
+ *    an array of nested frequency attributes
+ * @NL80211_BAND_ATTR_RATES: supported bitrates in this band,
+ *    an array of nested bitrate attributes
+ * @NL80211_BAND_ATTR_HT_MCS_SET: 16-byte attribute containing the MCS set as
+ *    defined in 802.11n
+ * @NL80211_BAND_ATTR_HT_CAPA: HT capabilities, as in the HT information IE
+ * @NL80211_BAND_ATTR_HT_AMPDU_FACTOR: A-MPDU factor, as in 11n
+ * @NL80211_BAND_ATTR_HT_AMPDU_DENSITY: A-MPDU density, as in 11n
+ * @NL80211_BAND_ATTR_VHT_MCS_SET: 32-byte attribute containing the MCS set as
+ *    defined in 802.11ac
+ * @NL80211_BAND_ATTR_VHT_CAPA: VHT capabilities, as in the HT information IE
+ * @NL80211_BAND_ATTR_IFTYPE_DATA: nested array attribute, with each entry using
+ *    attributes from &enum nl80211_band_iftype_attr
+ * @NL80211_BAND_ATTR_EDMG_CHANNELS: bitmap that indicates the 2.16 GHz
+ *    channel(s) that are allowed to be used for EDMG transmissions.
+ *    Defined by IEEE P802.11ay/D4.0 section 9.4.2.251.
+ * @NL80211_BAND_ATTR_EDMG_BW_CONFIG: Channel BW Configuration subfield encodes
+ *    the allowed channel bandwidth configurations.
+ *    Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13.
+ * @NL80211_BAND_ATTR_MAX: highest band attribute currently defined
+ * @__NL80211_BAND_ATTR_AFTER_LAST: internal use
+ */
+enum nl80211_band_attr {
+    __NL80211_BAND_ATTR_INVALID,
+    NL80211_BAND_ATTR_FREQS,
+    NL80211_BAND_ATTR_RATES,
+
+    NL80211_BAND_ATTR_HT_MCS_SET,
+    NL80211_BAND_ATTR_HT_CAPA,
+    NL80211_BAND_ATTR_HT_AMPDU_FACTOR,
+    NL80211_BAND_ATTR_HT_AMPDU_DENSITY,
+
+    NL80211_BAND_ATTR_VHT_MCS_SET,
+    NL80211_BAND_ATTR_VHT_CAPA,
+    NL80211_BAND_ATTR_IFTYPE_DATA,
+
+    NL80211_BAND_ATTR_EDMG_CHANNELS,
+    NL80211_BAND_ATTR_EDMG_BW_CONFIG,
+
+    /* keep last */
+    __NL80211_BAND_ATTR_AFTER_LAST,
+    NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1
+};
+
+#define NL80211_BAND_ATTR_HT_CAPA NL80211_BAND_ATTR_HT_CAPA
+
+/**
+ * enum nl80211_wmm_rule - regulatory wmm rule
+ *
+ * @__NL80211_WMMR_INVALID: attribute number 0 is reserved
+ * @NL80211_WMMR_CW_MIN: Minimum contention window slot.
+ * @NL80211_WMMR_CW_MAX: Maximum contention window slot.
+ * @NL80211_WMMR_AIFSN: Arbitration Inter Frame Space.
+ * @NL80211_WMMR_TXOP: Maximum allowed tx operation time.
+ * @nl80211_WMMR_MAX: highest possible wmm rule.
+ * @__NL80211_WMMR_LAST: Internal use.
+ */
+enum nl80211_wmm_rule {
+    __NL80211_WMMR_INVALID,
+    NL80211_WMMR_CW_MIN,
+    NL80211_WMMR_CW_MAX,
+    NL80211_WMMR_AIFSN,
+    NL80211_WMMR_TXOP,
+
+    /* keep last */
+    __NL80211_WMMR_LAST,
+    NL80211_WMMR_MAX = __NL80211_WMMR_LAST - 1
+};
+
+/**
+ * enum nl80211_frequency_attr - frequency attributes
+ * @__NL80211_FREQUENCY_ATTR_INVALID: attribute number 0 is reserved
+ * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz
+ * @NL80211_FREQUENCY_ATTR_DISABLED: Channel is disabled in current
+ *    regulatory domain.
+ * @NL80211_FREQUENCY_ATTR_NO_IR: no mechanisms that initiate radiation
+ *     are permitted on this channel, this includes sending probe
+ *     requests, or modes of operation that require beaconing.
+ * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory
+ *    on this channel in current regulatory domain.
+ * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm
+ *    (100 * dBm).
+ * @NL80211_FREQUENCY_ATTR_DFS_STATE: current state for DFS
+ *    (enum nl80211_dfs_state)
+ * @NL80211_FREQUENCY_ATTR_DFS_TIME: time in miliseconds for how long
+ *    this channel is in this DFS state.
+ * @NL80211_FREQUENCY_ATTR_NO_HT40_MINUS: HT40- isn't possible with this
+ *    channel as the control channel
+ * @NL80211_FREQUENCY_ATTR_NO_HT40_PLUS: HT40+ isn't possible with this
+ *    channel as the control channel
+ * @NL80211_FREQUENCY_ATTR_NO_80MHZ: any 80 MHz channel using this channel
+ *    as the primary or any of the secondary channels isn't possible,
+ *    this includes 80+80 channels
+ * @NL80211_FREQUENCY_ATTR_NO_160MHZ: any 160 MHz (but not 80+80) channel
+ *    using this channel as the primary or any of the secondary channels
+ *    isn't possible
+ * @NL80211_FREQUENCY_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds.
+ * @NL80211_FREQUENCY_ATTR_INDOOR_ONLY: Only indoor use is permitted on this
+ *    channel. A channel that has the INDOOR_ONLY attribute can only be
+ *    used when there is a clear assessment that the device is operating in
+ *    an indoor surroundings, i.e., it is connected to AC power (and not
+ *    through portable DC inverters) or is under the control of a master
+ *    that is acting as an AP and is connected to AC power.
+ * @NL80211_FREQUENCY_ATTR_IR_CONCURRENT: IR operation is allowed on this
+ *    channel if it's connected concurrently to a BSS on the same channel on
+ *    the 2 GHz band or to a channel in the same UNII band (on the 5 GHz
+ *    band), and IEEE80211_CHAN_RADAR is not set. Instantiating a GO or TDLS
+ *    off-channel on a channel that has the IR_CONCURRENT attribute set can be
+ *    done when there is a clear assessment that the device is operating under
+ *    the guidance of an authorized master, i.e., setting up a GO or TDLS
+ *    off-channel while the device is also connected to an AP with DFS and
+ *    radar detection on the UNII band (it is up to user-space, i.e.,
+ *    wpa_supplicant to perform the required verifications). Using this
+ *    attribute for IR is disallowed for master interfaces (IBSS, AP).
+ * @NL80211_FREQUENCY_ATTR_NO_20MHZ: 20 MHz operation is not allowed
+ *    on this channel in current regulatory domain.
+ * @NL80211_FREQUENCY_ATTR_NO_10MHZ: 10 MHz operation is not allowed
+ *    on this channel in current regulatory domain.
+ * @NL80211_FREQUENCY_ATTR_WMM: this channel has wmm limitations.
+ *    This is a nested attribute that contains the wmm limitation per AC.
+ *    (see &enum nl80211_wmm_rule)
+ * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
+ *    currently defined
+ * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
+ *
+ * See https://apps.fcc.gov/eas/comments/GetPublishedDocument.html?id=327&tn=528122
+ * for more information on the FCC description of the relaxations allowed
+ * by NL80211_FREQUENCY_ATTR_INDOOR_ONLY and
+ * NL80211_FREQUENCY_ATTR_IR_CONCURRENT.
+ */
+enum nl80211_frequency_attr {
+    __NL80211_FREQUENCY_ATTR_INVALID,
+    NL80211_FREQUENCY_ATTR_FREQ,
+    NL80211_FREQUENCY_ATTR_DISABLED,
+    NL80211_FREQUENCY_ATTR_NO_IR,
+    __NL80211_FREQUENCY_ATTR_NO_IBSS,
+    NL80211_FREQUENCY_ATTR_RADAR,
+    NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
+    NL80211_FREQUENCY_ATTR_DFS_STATE,
+    NL80211_FREQUENCY_ATTR_DFS_TIME,
+    NL80211_FREQUENCY_ATTR_NO_HT40_MINUS,
+    NL80211_FREQUENCY_ATTR_NO_HT40_PLUS,
+    NL80211_FREQUENCY_ATTR_NO_80MHZ,
+    NL80211_FREQUENCY_ATTR_NO_160MHZ,
+    NL80211_FREQUENCY_ATTR_DFS_CAC_TIME,
+    NL80211_FREQUENCY_ATTR_INDOOR_ONLY,
+    NL80211_FREQUENCY_ATTR_IR_CONCURRENT,
+    NL80211_FREQUENCY_ATTR_NO_20MHZ,
+    NL80211_FREQUENCY_ATTR_NO_10MHZ,
+    NL80211_FREQUENCY_ATTR_WMM,
+
+    /* keep last */
+    __NL80211_FREQUENCY_ATTR_AFTER_LAST,
+    NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1
+};
+
+#define NL80211_FREQUENCY_ATTR_MAX_TX_POWER NL80211_FREQUENCY_ATTR_MAX_TX_POWER
+#define NL80211_FREQUENCY_ATTR_PASSIVE_SCAN    NL80211_FREQUENCY_ATTR_NO_IR
+#define NL80211_FREQUENCY_ATTR_NO_IBSS        NL80211_FREQUENCY_ATTR_NO_IR
+#define NL80211_FREQUENCY_ATTR_NO_IR        NL80211_FREQUENCY_ATTR_NO_IR
+#define NL80211_FREQUENCY_ATTR_GO_CONCURRENT \
+                    NL80211_FREQUENCY_ATTR_IR_CONCURRENT
+
+/**
+ * enum nl80211_bitrate_attr - bitrate attributes
+ * @__NL80211_BITRATE_ATTR_INVALID: attribute number 0 is reserved
+ * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps
+ * @NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE: Short preamble supported
+ *    in 2.4 GHz band.
+ * @NL80211_BITRATE_ATTR_MAX: highest bitrate attribute number
+ *    currently defined
+ * @__NL80211_BITRATE_ATTR_AFTER_LAST: internal use
+ */
+enum nl80211_bitrate_attr {
+    __NL80211_BITRATE_ATTR_INVALID,
+    NL80211_BITRATE_ATTR_RATE,
+    NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE,
+
+    /* keep last */
+    __NL80211_BITRATE_ATTR_AFTER_LAST,
+    NL80211_BITRATE_ATTR_MAX = __NL80211_BITRATE_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_initiator - Indicates the initiator of a reg domain request
+ * @NL80211_REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world
+ *     regulatory domain.
+ * @NL80211_REGDOM_SET_BY_USER: User asked the wireless core to set the
+ *     regulatory domain.
+ * @NL80211_REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the
+ *     wireless core it thinks its knows the regulatory domain we should be in.
+ * @NL80211_REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an
+ *     802.11 country information element with regulatory information it
+ *     thinks we should consider. cfg80211 only processes the country
+ *    code from the IE, and relies on the regulatory domain information
+ *    structure passed by userspace (CRDA) from our wireless-regdb.
+ *    If a channel is enabled but the country code indicates it should
+ *    be disabled we disable the channel and re-enable it upon disassociation.
+ */
+enum nl80211_reg_initiator {
+    NL80211_REGDOM_SET_BY_CORE,
+    NL80211_REGDOM_SET_BY_USER,
+    NL80211_REGDOM_SET_BY_DRIVER,
+    NL80211_REGDOM_SET_BY_COUNTRY_IE,
+};
+
+/**
+ * enum nl80211_reg_type - specifies the type of regulatory domain
+ * @NL80211_REGDOM_TYPE_COUNTRY: the regulatory domain set is one that pertains
+ *    to a specific country. When this is set you can count on the
+ *    ISO / IEC 3166 alpha2 country code being valid.
+ * @NL80211_REGDOM_TYPE_WORLD: the regulatory set domain is the world regulatory
+ *     domain.
+ * @NL80211_REGDOM_TYPE_CUSTOM_WORLD: the regulatory domain set is a custom
+ *     driver specific world regulatory domain. These do not apply system-wide
+ *     and are only applicable to the individual devices which have requested
+ *     them to be applied.
+ * @NL80211_REGDOM_TYPE_INTERSECTION: the regulatory domain set is the product
+ *    of an intersection between two regulatory domains -- the previously
+ *    set regulatory domain on the system and the last accepted regulatory
+ *    domain request to be processed.
+ */
+enum nl80211_reg_type {
+    NL80211_REGDOM_TYPE_COUNTRY,
+    NL80211_REGDOM_TYPE_WORLD,
+    NL80211_REGDOM_TYPE_CUSTOM_WORLD,
+    NL80211_REGDOM_TYPE_INTERSECTION,
+};
+
+/**
+ * enum nl80211_reg_rule_attr - regulatory rule attributes
+ * @__NL80211_REG_RULE_ATTR_INVALID: attribute number 0 is reserved
+ * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional
+ *     considerations for a given frequency range. These are the
+ *     &enum nl80211_reg_rule_flags.
+ * @NL80211_ATTR_FREQ_RANGE_START: starting frequencry for the regulatory
+ *     rule in KHz. This is not a center of frequency but an actual regulatory
+ *     band edge.
+ * @NL80211_ATTR_FREQ_RANGE_END: ending frequency for the regulatory rule
+ *     in KHz. This is not a center a frequency but an actual regulatory
+ *     band edge.
+ * @NL80211_ATTR_FREQ_RANGE_MAX_BW: maximum allowed bandwidth for this
+ *    frequency range, in KHz.
+ * @NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN: the maximum allowed antenna gain
+ *     for a given frequency range. The value is in mBi (100 * dBi).
+ *     If you don't have one then don't send this.
+ * @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for
+ *     a given frequency range. The value is in mBm (100 * dBm).
+ * @NL80211_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds.
+ *    If not present or 0 default CAC time will be used.
+ * @NL80211_REG_RULE_ATTR_MAX: highest regulatory rule attribute number
+ *    currently defined
+ * @__NL80211_REG_RULE_ATTR_AFTER_LAST: internal use
+ */
+enum nl80211_reg_rule_attr {
+    __NL80211_REG_RULE_ATTR_INVALID,
+    NL80211_ATTR_REG_RULE_FLAGS,
+
+    NL80211_ATTR_FREQ_RANGE_START,
+    NL80211_ATTR_FREQ_RANGE_END,
+    NL80211_ATTR_FREQ_RANGE_MAX_BW,
+
+    NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN,
+    NL80211_ATTR_POWER_RULE_MAX_EIRP,
+
+    NL80211_ATTR_DFS_CAC_TIME,
+
+    /* keep last */
+    __NL80211_REG_RULE_ATTR_AFTER_LAST,
+    NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_sched_scan_match_attr - scheduled scan match attributes
+ * @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved
+ * @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching,
+ *    only report BSS with matching SSID.
+ *    (This cannot be used together with BSSID.)
+ * @NL80211_SCHED_SCAN_MATCH_ATTR_RSSI: RSSI threshold (in dBm) for reporting a
+ *    BSS in scan results. Filtering is turned off if not specified. Note that
+ *    if this attribute is in a match set of its own, then it is treated as
+ *    the default value for all matchsets with an SSID, rather than being a
+ *    matchset of its own without an RSSI filter. This is due to problems with
+ *    how this API was implemented in the past. Also, due to the same problem,
+ *    the only way to create a matchset with only an RSSI filter (with this
+ *    attribute) is if there's only a single matchset with the RSSI attribute.
+ * @NL80211_SCHED_SCAN_MATCH_ATTR_RELATIVE_RSSI: Flag indicating whether
+ *    %NL80211_SCHED_SCAN_MATCH_ATTR_RSSI to be used as absolute RSSI or
+ *    relative to current bss's RSSI.
+ * @NL80211_SCHED_SCAN_MATCH_ATTR_RSSI_ADJUST: When present the RSSI level for
+ *    BSS-es in the specified band is to be adjusted before doing
+ *    RSSI-based BSS selection. The attribute value is a packed structure
+ *    value as specified by &struct nl80211_bss_select_rssi_adjust.
+ * @NL80211_SCHED_SCAN_MATCH_ATTR_BSSID: BSSID to be used for matching
+ *    (this cannot be used together with SSID).
+ * @NL80211_SCHED_SCAN_MATCH_PER_BAND_RSSI: Nested attribute that carries the
+ *    band specific minimum rssi thresholds for the bands defined in
+ *    enum nl80211_band. The minimum rssi threshold value(s32) specific to a
+ *    band shall be encapsulated in attribute with type value equals to one
+ *    of the NL80211_BAND_* defined in enum nl80211_band. For example, the
+ *    minimum rssi threshold value for 2.4GHZ band shall be encapsulated
+ *    within an attribute of type NL80211_BAND_2GHZ. And one or more of such
+ *    attributes will be nested within this attribute.
+ * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter
+ *    attribute number currently defined
+ * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use
+ */
+enum nl80211_sched_scan_match_attr {
+    __NL80211_SCHED_SCAN_MATCH_ATTR_INVALID,
+
+    NL80211_SCHED_SCAN_MATCH_ATTR_SSID,
+    NL80211_SCHED_SCAN_MATCH_ATTR_RSSI,
+    NL80211_SCHED_SCAN_MATCH_ATTR_RELATIVE_RSSI,
+    NL80211_SCHED_SCAN_MATCH_ATTR_RSSI_ADJUST,
+    NL80211_SCHED_SCAN_MATCH_ATTR_BSSID,
+    NL80211_SCHED_SCAN_MATCH_PER_BAND_RSSI,
+
+    /* keep last */
+    __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST,
+    NL80211_SCHED_SCAN_MATCH_ATTR_MAX =
+        __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST - 1
+};
+
+/* only for backward compatibility */
+#define NL80211_ATTR_SCHED_SCAN_MATCH_SSID NL80211_SCHED_SCAN_MATCH_ATTR_SSID
+
+/**
+ * enum nl80211_reg_rule_flags - regulatory rule flags
+ *
+ * @NL80211_RRF_NO_OFDM: OFDM modulation not allowed
+ * @NL80211_RRF_NO_CCK: CCK modulation not allowed
+ * @NL80211_RRF_NO_INDOOR: indoor operation not allowed
+ * @NL80211_RRF_NO_OUTDOOR: outdoor operation not allowed
+ * @NL80211_RRF_DFS: DFS support is required to be used
+ * @NL80211_RRF_PTP_ONLY: this is only for Point To Point links
+ * @NL80211_RRF_PTMP_ONLY: this is only for Point To Multi Point links
+ * @NL80211_RRF_NO_IR: no mechanisms that initiate radiation are allowed,
+ *    this includes probe requests or modes of operation that require
+ *    beaconing.
+ * @NL80211_RRF_AUTO_BW: maximum available bandwidth should be calculated
+ *    base on contiguous rules and wider channels will be allowed to cross
+ *    multiple contiguous/overlapping frequency ranges.
+ * @NL80211_RRF_IR_CONCURRENT: See %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
+ * @NL80211_RRF_NO_HT40MINUS: channels can't be used in HT40- operation
+ * @NL80211_RRF_NO_HT40PLUS: channels can't be used in HT40+ operation
+ * @NL80211_RRF_NO_80MHZ: 80MHz operation not allowed
+ * @NL80211_RRF_NO_160MHZ: 160MHz operation not allowed
+ */
+enum nl80211_reg_rule_flags {
+    NL80211_RRF_NO_OFDM        = 1<<0,
+    NL80211_RRF_NO_CCK        = 1<<1,
+    NL80211_RRF_NO_INDOOR        = 1<<2,
+    NL80211_RRF_NO_OUTDOOR        = 1<<3,
+    NL80211_RRF_DFS            = 1<<4,
+    NL80211_RRF_PTP_ONLY        = 1<<5,
+    NL80211_RRF_PTMP_ONLY        = 1<<6,
+    NL80211_RRF_NO_IR        = 1<<7,
+    __NL80211_RRF_NO_IBSS        = 1<<8,
+    NL80211_RRF_AUTO_BW        = 1<<11,
+    NL80211_RRF_IR_CONCURRENT    = 1<<12,
+    NL80211_RRF_NO_HT40MINUS    = 1<<13,
+    NL80211_RRF_NO_HT40PLUS        = 1<<14,
+    NL80211_RRF_NO_80MHZ        = 1<<15,
+    NL80211_RRF_NO_160MHZ        = 1<<16,
+};
+
+#define NL80211_RRF_PASSIVE_SCAN   NL80211_RRF_NO_IR
+#define NL80211_RRF_NO_IBSS        NL80211_RRF_NO_IR
+#define NL80211_RRF_NO_IR          NL80211_RRF_NO_IR
+#define NL80211_RRF_NO_HT40        (NL80211_RRF_NO_HT40MINUS |\
+                                    NL80211_RRF_NO_HT40PLUS)
+#define NL80211_RRF_GO_CONCURRENT  NL80211_RRF_IR_CONCURRENT
+
+/* For backport compatibility with older userspace */
+#define NL80211_RRF_NO_IR_ALL      (NL80211_RRF_NO_IR | __NL80211_RRF_NO_IBSS)
+
+/**
+ * enum nl80211_dfs_regions - regulatory DFS regions
+ *
+ * @NL80211_DFS_UNSET: Country has no DFS master region specified
+ * @NL80211_DFS_FCC: Country follows DFS master rules from FCC
+ * @NL80211_DFS_ETSI: Country follows DFS master rules from ETSI
+ * @NL80211_DFS_JP: Country follows DFS master rules from JP/MKK/Telec
+ */
+enum nl80211_dfs_regions {
+    NL80211_DFS_UNSET    = 0,
+    NL80211_DFS_FCC        = 1,
+    NL80211_DFS_ETSI    = 2,
+    NL80211_DFS_JP        = 3,
+};
+
+/**
+ * enum nl80211_user_reg_hint_type - type of user regulatory hint
+ *
+ * @NL80211_USER_REG_HINT_USER: a user sent the hint. This is always
+ *    assumed if the attribute is not set.
+ * @NL80211_USER_REG_HINT_CELL_BASE: the hint comes from a cellular
+ *    base station. Device drivers that have been tested to work
+ *    properly to support this type of hint can enable these hints
+ *    by setting the NL80211_FEATURE_CELL_BASE_REG_HINTS feature
+ *    capability on the struct wiphy. The wireless core will
+ *    ignore all cell base station hints until at least one device
+ *    present has been registered with the wireless core that
+ *    has listed NL80211_FEATURE_CELL_BASE_REG_HINTS as a
+ *    supported feature.
+ * @NL80211_USER_REG_HINT_INDOOR: a user sent an hint indicating that the
+ *    platform is operating in an indoor environment.
+ */
+enum nl80211_user_reg_hint_type {
+    NL80211_USER_REG_HINT_USER    = 0,
+    NL80211_USER_REG_HINT_CELL_BASE = 1,
+    NL80211_USER_REG_HINT_INDOOR    = 2,
+};
+
+/**
+ * enum nl80211_survey_info - survey information
+ *
+ * These attribute types are used with %NL80211_ATTR_SURVEY_INFO
+ * when getting information about a survey.
+ *
+ * @__NL80211_SURVEY_INFO_INVALID: attribute number 0 is reserved
+ * @NL80211_SURVEY_INFO_FREQUENCY: center frequency of channel
+ * @NL80211_SURVEY_INFO_NOISE: noise level of channel (u8, dBm)
+ * @NL80211_SURVEY_INFO_IN_USE: channel is currently being used
+ * @NL80211_SURVEY_INFO_TIME: amount of time (in ms) that the radio
+ *    was turned on (on channel or globally)
+ * @NL80211_SURVEY_INFO_TIME_BUSY: amount of the time the primary
+ *    channel was sensed busy (either due to activity or energy detect)
+ * @NL80211_SURVEY_INFO_TIME_EXT_BUSY: amount of time the extension
+ *    channel was sensed busy
+ * @NL80211_SURVEY_INFO_TIME_RX: amount of time the radio spent
+ *    receiving data (on channel or globally)
+ * @NL80211_SURVEY_INFO_TIME_TX: amount of time the radio spent
+ *    transmitting data (on channel or globally)
+ * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan
+ *    (on this channel or globally)
+ * @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment
+ * @NL80211_SURVEY_INFO_TIME_BSS_RX: amount of time the radio spent
+ *    receiving frames destined to the local BSS
+ * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
+ *    currently defined
+ * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
+ */
+enum nl80211_survey_info {
+    __NL80211_SURVEY_INFO_INVALID,
+    NL80211_SURVEY_INFO_FREQUENCY,
+    NL80211_SURVEY_INFO_NOISE,
+    NL80211_SURVEY_INFO_IN_USE,
+    NL80211_SURVEY_INFO_TIME,
+    NL80211_SURVEY_INFO_TIME_BUSY,
+    NL80211_SURVEY_INFO_TIME_EXT_BUSY,
+    NL80211_SURVEY_INFO_TIME_RX,
+    NL80211_SURVEY_INFO_TIME_TX,
+    NL80211_SURVEY_INFO_TIME_SCAN,
+    NL80211_SURVEY_INFO_PAD,
+    NL80211_SURVEY_INFO_TIME_BSS_RX,
+
+    /* keep last */
+    __NL80211_SURVEY_INFO_AFTER_LAST,
+    NL80211_SURVEY_INFO_MAX = __NL80211_SURVEY_INFO_AFTER_LAST - 1
+};
+
+/* keep old names for compatibility */
+#define NL80211_SURVEY_INFO_CHANNEL_TIME            NL80211_SURVEY_INFO_TIME
+#define NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY       NL80211_SURVEY_INFO_TIME_BUSY
+#define NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY   NL80211_SURVEY_INFO_TIME_EXT_BUSY
+#define NL80211_SURVEY_INFO_CHANNEL_TIME_RX         NL80211_SURVEY_INFO_TIME_RX
+#define NL80211_SURVEY_INFO_CHANNEL_TIME_TX         NL80211_SURVEY_INFO_TIME_TX
+
+/**
+ * enum nl80211_mntr_flags - monitor configuration flags
+ *
+ * Monitor configuration flags.
+ *
+ * @__NL80211_MNTR_FLAG_INVALID: reserved
+ *
+ * @NL80211_MNTR_FLAG_FCSFAIL: pass frames with bad FCS
+ * @NL80211_MNTR_FLAG_PLCPFAIL: pass frames with bad PLCP
+ * @NL80211_MNTR_FLAG_CONTROL: pass control frames
+ * @NL80211_MNTR_FLAG_OTHER_BSS: disable BSSID filtering
+ * @NL80211_MNTR_FLAG_COOK_FRAMES: report frames after processing.
+ *    overrides all other flags.
+ * @NL80211_MNTR_FLAG_ACTIVE: use the configured MAC address
+ *    and ACK incoming unicast packets.
+ *
+ * @__NL80211_MNTR_FLAG_AFTER_LAST: internal use
+ * @NL80211_MNTR_FLAG_MAX: highest possible monitor flag
+ */
+enum nl80211_mntr_flags {
+    __NL80211_MNTR_FLAG_INVALID,
+    NL80211_MNTR_FLAG_FCSFAIL,
+    NL80211_MNTR_FLAG_PLCPFAIL,
+    NL80211_MNTR_FLAG_CONTROL,
+    NL80211_MNTR_FLAG_OTHER_BSS,
+    NL80211_MNTR_FLAG_COOK_FRAMES,
+    NL80211_MNTR_FLAG_ACTIVE,
+
+    /* keep last */
+    __NL80211_MNTR_FLAG_AFTER_LAST,
+    NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_mesh_power_mode - mesh power save modes
+ *
+ * @NL80211_MESH_POWER_UNKNOWN: The mesh power mode of the mesh STA is
+ *    not known or has not been set yet.
+ * @NL80211_MESH_POWER_ACTIVE: Active mesh power mode. The mesh STA is
+ *    in Awake state all the time.
+ * @NL80211_MESH_POWER_LIGHT_SLEEP: Light sleep mode. The mesh STA will
+ *    alternate between Active and Doze states, but will wake up for
+ *    neighbor's beacons.
+ * @NL80211_MESH_POWER_DEEP_SLEEP: Deep sleep mode. The mesh STA will
+ *    alternate between Active and Doze states, but may not wake up
+ *    for neighbor's beacons.
+ *
+ * @__NL80211_MESH_POWER_AFTER_LAST - internal use
+ * @NL80211_MESH_POWER_MAX - highest possible power save level
+ */
+
+enum nl80211_mesh_power_mode {
+    NL80211_MESH_POWER_UNKNOWN,
+    NL80211_MESH_POWER_ACTIVE,
+    NL80211_MESH_POWER_LIGHT_SLEEP,
+    NL80211_MESH_POWER_DEEP_SLEEP,
+
+    __NL80211_MESH_POWER_AFTER_LAST,
+    NL80211_MESH_POWER_MAX = __NL80211_MESH_POWER_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_meshconf_params - mesh configuration parameters
+ *
+ * Mesh configuration parameters. These can be changed while the mesh is
+ * active.
+ *
+ * @__NL80211_MESHCONF_INVALID: internal use
+ *
+ * @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in
+ *    millisecond units, used by the Peer Link Open message
+ *
+ * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the initial confirm timeout, in
+ *    millisecond units, used by the peer link management to close a peer link
+ *
+ * @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in
+ *    millisecond units
+ *
+ * @NL80211_MESHCONF_MAX_PEER_LINKS: maximum number of peer links allowed
+ *    on this mesh interface
+ *
+ * @NL80211_MESHCONF_MAX_RETRIES: specifies the maximum number of peer link
+ *    open retries that can be sent to establish a new peer link instance in a
+ *    mesh
+ *
+ * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh
+ *    point.
+ *
+ * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically open
+ *    peer links when we detect compatible mesh peers. Disabled if
+ *    @NL80211_MESH_SETUP_USERSPACE_MPM or @NL80211_MESH_SETUP_USERSPACE_AMPE are
+ *    set.
+ *
+ * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames
+ *    containing a PREQ that an MP can send to a particular destination (path
+ *    target)
+ *
+ * @NL80211_MESHCONF_PATH_REFRESH_TIME: how frequently to refresh mesh paths
+ *    (in milliseconds)
+ *
+ * @NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT: minimum length of time to wait
+ *    until giving up on a path discovery (in milliseconds)
+ *
+ * @NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT: The time (in TUs) for which mesh
+ *    points receiving a PREQ shall consider the forwarding information from
+ *    the root to be valid. (TU = time unit)
+ *
+ * @NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL: The minimum interval of time (in
+ *    TUs) during which an MP can send only one action frame containing a PREQ
+ *    reference element
+ *
+ * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs)
+ *    that it takes for an HWMP information element to propagate across the
+ *    mesh
+ *
+ * @NL80211_MESHCONF_HWMP_ROOTMODE: whether root mode is enabled or not
+ *
+ * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a
+ *    source mesh point for path selection elements.
+ *
+ * @NL80211_MESHCONF_HWMP_RANN_INTERVAL:  The interval of time (in TUs) between
+ *    root announcements are transmitted.
+ *
+ * @NL80211_MESHCONF_GATE_ANNOUNCEMENTS: Advertise that this mesh station has
+ *    access to a broader network beyond the MBSS.  This is done via Root
+ *    Announcement frames.
+ *
+ * @NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL: The minimum interval of time (in
+ *    TUs) during which a mesh STA can send only one Action frame containing a
+ *    PERR element.
+ *
+ * @NL80211_MESHCONF_FORWARDING: set Mesh STA as forwarding or non-forwarding
+ *    or forwarding entity (default is TRUE - forwarding entity)
+ *
+ * @NL80211_MESHCONF_RSSI_THRESHOLD: RSSI threshold in dBm. This specifies the
+ *    threshold for average signal strength of candidate station to establish
+ *    a peer link.
+ *
+ * @NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR: maximum number of neighbors
+ *    to synchronize to for 11s default synchronization method
+ *    (see 11C.12.2.2)
+ *
+ * @NL80211_MESHCONF_HT_OPMODE: set mesh HT protection mode.
+ *
+ * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
+ *
+ * @NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT: The time (in TUs) for
+ *    which mesh STAs receiving a proactive PREQ shall consider the forwarding
+ *    information to the root mesh STA to be valid.
+ *
+ * @NL80211_MESHCONF_HWMP_ROOT_INTERVAL: The interval of time (in TUs) between
+ *    proactive PREQs are transmitted.
+ *
+ * @NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL: The minimum interval of time
+ *    (in TUs) during which a mesh STA can send only one Action frame
+ *    containing a PREQ element for root path confirmation.
+ *
+ * @NL80211_MESHCONF_POWER_MODE: Default mesh power mode for new peer links.
+ *    type &enum nl80211_mesh_power_mode (u32)
+ *
+ * @NL80211_MESHCONF_AWAKE_WINDOW: awake window duration (in TUs)
+ *
+ * @NL80211_MESHCONF_PLINK_TIMEOUT: If no tx activity is seen from a STA we've
+ *    established peering with for longer than this time (in seconds), then
+ *    remove it from the STA's list of peers. You may set this to 0 to disable
+ *    the removal of the STA. Default is 30 minutes.
+ *
+ * @NL80211_MESHCONF_CONNECTED_TO_GATE: If set to true then this mesh STA
+ *    will advertise that it is connected to a gate in the mesh formation
+ *    field.  If left unset then the mesh formation field will only
+ *    advertise such if there is an active root mesh path.
+ *
+ * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
+ */
+enum nl80211_meshconf_params {
+    __NL80211_MESHCONF_INVALID,
+    NL80211_MESHCONF_RETRY_TIMEOUT,
+    NL80211_MESHCONF_CONFIRM_TIMEOUT,
+    NL80211_MESHCONF_HOLDING_TIMEOUT,
+    NL80211_MESHCONF_MAX_PEER_LINKS,
+    NL80211_MESHCONF_MAX_RETRIES,
+    NL80211_MESHCONF_TTL,
+    NL80211_MESHCONF_AUTO_OPEN_PLINKS,
+    NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES,
+    NL80211_MESHCONF_PATH_REFRESH_TIME,
+    NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT,
+    NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT,
+    NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL,
+    NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
+    NL80211_MESHCONF_HWMP_ROOTMODE,
+    NL80211_MESHCONF_ELEMENT_TTL,
+    NL80211_MESHCONF_HWMP_RANN_INTERVAL,
+    NL80211_MESHCONF_GATE_ANNOUNCEMENTS,
+    NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL,
+    NL80211_MESHCONF_FORWARDING,
+    NL80211_MESHCONF_RSSI_THRESHOLD,
+    NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR,
+    NL80211_MESHCONF_HT_OPMODE,
+    NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT,
+    NL80211_MESHCONF_HWMP_ROOT_INTERVAL,
+    NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL,
+    NL80211_MESHCONF_POWER_MODE,
+    NL80211_MESHCONF_AWAKE_WINDOW,
+    NL80211_MESHCONF_PLINK_TIMEOUT,
+    NL80211_MESHCONF_CONNECTED_TO_GATE,
+
+    /* keep last */
+    __NL80211_MESHCONF_ATTR_AFTER_LAST,
+    NL80211_MESHCONF_ATTR_MAX = __NL80211_MESHCONF_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_mesh_setup_params - mesh setup parameters
+ *
+ * Mesh setup parameters.  These are used to start/join a mesh and cannot be
+ * changed while the mesh is active.
+ *
+ * @__NL80211_MESH_SETUP_INVALID: Internal use
+ *
+ * @NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL: Enable this option to use a
+ *    vendor specific path selection algorithm or disable it to use the
+ *    default HWMP.
+ *
+ * @NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC: Enable this option to use a
+ *    vendor specific path metric or disable it to use the default Airtime
+ *    metric.
+ *
+ * @NL80211_MESH_SETUP_IE: Information elements for this mesh, for instance, a
+ *    robust security network ie, or a vendor specific information element
+ *    that vendors will use to identify the path selection methods and
+ *    metrics in use.
+ *
+ * @NL80211_MESH_SETUP_USERSPACE_AUTH: Enable this option if an authentication
+ *    daemon will be authenticating mesh candidates.
+ *
+ * @NL80211_MESH_SETUP_USERSPACE_AMPE: Enable this option if an authentication
+ *    daemon will be securing peer link frames.  AMPE is a secured version of
+ *    Mesh Peering Management (MPM) and is implemented with the assistance of
+ *    a userspace daemon.  When this flag is set, the kernel will send peer
+ *    management frames to a userspace daemon that will implement AMPE
+ *    functionality (security capabilities selection, key confirmation, and
+ *    key management).  When the flag is unset (default), the kernel can
+ *    autonomously complete (unsecured) mesh peering without the need of a
+ *    userspace daemon.
+ *
+ * @NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC: Enable this option to use a
+ *    vendor specific synchronization method or disable it to use the default
+ *    neighbor offset synchronization
+ *
+ * @NL80211_MESH_SETUP_USERSPACE_MPM: Enable this option if userspace will
+ *    implement an MPM which handles peer allocation and state.
+ *
+ * @NL80211_MESH_SETUP_AUTH_PROTOCOL: Inform the kernel of the authentication
+ *    method (u8, as defined in IEEE 8.4.2.100.6, e.g. 0x1 for SAE).
+ *    Default is no authentication method required.
+ *
+ * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number
+ *
+ * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use
+ */
+enum nl80211_mesh_setup_params {
+    __NL80211_MESH_SETUP_INVALID,
+    NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL,
+    NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC,
+    NL80211_MESH_SETUP_IE,
+    NL80211_MESH_SETUP_USERSPACE_AUTH,
+    NL80211_MESH_SETUP_USERSPACE_AMPE,
+    NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC,
+    NL80211_MESH_SETUP_USERSPACE_MPM,
+    NL80211_MESH_SETUP_AUTH_PROTOCOL,
+
+    /* keep last */
+    __NL80211_MESH_SETUP_ATTR_AFTER_LAST,
+    NL80211_MESH_SETUP_ATTR_MAX = __NL80211_MESH_SETUP_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_txq_attr - TX queue parameter attributes
+ * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved
+ * @NL80211_TXQ_ATTR_AC: AC identifier (NL80211_AC_*)
+ * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning
+ *    disabled
+ * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form
+ *    2^n-1 in the range 1..32767]
+ * @NL80211_TXQ_ATTR_CWMAX: Maximum contention window [a value of the form
+ *    2^n-1 in the range 1..32767]
+ * @NL80211_TXQ_ATTR_AIFS: Arbitration interframe space [0..255]
+ * @__NL80211_TXQ_ATTR_AFTER_LAST: Internal
+ * @NL80211_TXQ_ATTR_MAX: Maximum TXQ attribute number
+ */
+enum nl80211_txq_attr {
+    __NL80211_TXQ_ATTR_INVALID,
+    NL80211_TXQ_ATTR_AC,
+    NL80211_TXQ_ATTR_TXOP,
+    NL80211_TXQ_ATTR_CWMIN,
+    NL80211_TXQ_ATTR_CWMAX,
+    NL80211_TXQ_ATTR_AIFS,
+
+    /* keep last */
+    __NL80211_TXQ_ATTR_AFTER_LAST,
+    NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1
+};
+
+enum nl80211_ac {
+    NL80211_AC_VO,
+    NL80211_AC_VI,
+    NL80211_AC_BE,
+    NL80211_AC_BK,
+    NL80211_NUM_ACS
+};
+
+/* backward compat */
+#define NL80211_TXQ_ATTR_QUEUE    NL80211_TXQ_ATTR_AC
+#define NL80211_TXQ_Q_VO    NL80211_AC_VO
+#define NL80211_TXQ_Q_VI    NL80211_AC_VI
+#define NL80211_TXQ_Q_BE    NL80211_AC_BE
+#define NL80211_TXQ_Q_BK    NL80211_AC_BK
+
+/**
+ * enum nl80211_channel_type - channel type
+ * @NL80211_CHAN_NO_HT: 20 MHz, non-HT channel
+ * @NL80211_CHAN_HT20: 20 MHz HT channel
+ * @NL80211_CHAN_HT40MINUS: HT40 channel, secondary channel
+ *    below the control channel
+ * @NL80211_CHAN_HT40PLUS: HT40 channel, secondary channel
+ *    above the control channel
+ */
+enum nl80211_channel_type {
+    NL80211_CHAN_NO_HT,
+    NL80211_CHAN_HT20,
+    NL80211_CHAN_HT40MINUS,
+    NL80211_CHAN_HT40PLUS
+};
+
+/**
+ * enum nl80211_key_mode - Key mode
+ *
+ * @NL80211_KEY_RX_TX: (Default)
+ *    Key can be used for Rx and Tx immediately
+ *
+ * The following modes can only be selected for unicast keys and when the
+ * driver supports @NL80211_EXT_FEATURE_EXT_KEY_ID:
+ *
+ * @NL80211_KEY_NO_TX: Only allowed in combination with @NL80211_CMD_NEW_KEY:
+ *    Unicast key can only be used for Rx, Tx not allowed, yet
+ * @NL80211_KEY_SET_TX: Only allowed in combination with @NL80211_CMD_SET_KEY:
+ *    The unicast key identified by idx and mac is cleared for Tx and becomes
+ *    the preferred Tx key for the station.
+ */
+enum nl80211_key_mode {
+    NL80211_KEY_RX_TX,
+    NL80211_KEY_NO_TX,
+    NL80211_KEY_SET_TX
+};
+
+/**
+ * enum nl80211_chan_width - channel width definitions
+ *
+ * These values are used with the %NL80211_ATTR_CHANNEL_WIDTH
+ * attribute.
+ *
+ * @NL80211_CHAN_WIDTH_20_NOHT: 20 MHz, non-HT channel
+ * @NL80211_CHAN_WIDTH_20: 20 MHz HT channel
+ * @NL80211_CHAN_WIDTH_40: 40 MHz channel, the %NL80211_ATTR_CENTER_FREQ1
+ *    attribute must be provided as well
+ * @NL80211_CHAN_WIDTH_80: 80 MHz channel, the %NL80211_ATTR_CENTER_FREQ1
+ *    attribute must be provided as well
+ * @NL80211_CHAN_WIDTH_80P80: 80+80 MHz channel, the %NL80211_ATTR_CENTER_FREQ1
+ *    and %NL80211_ATTR_CENTER_FREQ2 attributes must be provided as well
+ * @NL80211_CHAN_WIDTH_160: 160 MHz channel, the %NL80211_ATTR_CENTER_FREQ1
+ *    attribute must be provided as well
+ * @NL80211_CHAN_WIDTH_5: 5 MHz OFDM channel
+ * @NL80211_CHAN_WIDTH_10: 10 MHz OFDM channel
+ */
+enum nl80211_chan_width {
+    NL80211_CHAN_WIDTH_20_NOHT,
+    NL80211_CHAN_WIDTH_20,
+    NL80211_CHAN_WIDTH_40,
+    NL80211_CHAN_WIDTH_80,
+    NL80211_CHAN_WIDTH_80P80,
+    NL80211_CHAN_WIDTH_160,
+    NL80211_CHAN_WIDTH_5,
+    NL80211_CHAN_WIDTH_10,
+};
+
+/**
+ * enum nl80211_bss_scan_width - control channel width for a BSS
+ *
+ * These values are used with the %NL80211_BSS_CHAN_WIDTH attribute.
+ *
+ * @NL80211_BSS_CHAN_WIDTH_20: control channel is 20 MHz wide or compatible
+ * @NL80211_BSS_CHAN_WIDTH_10: control channel is 10 MHz wide
+ * @NL80211_BSS_CHAN_WIDTH_5: control channel is 5 MHz wide
+ */
+enum nl80211_bss_scan_width {
+    NL80211_BSS_CHAN_WIDTH_20,
+    NL80211_BSS_CHAN_WIDTH_10,
+    NL80211_BSS_CHAN_WIDTH_5,
+};
+
+/**
+ * enum nl80211_bss - netlink attributes for a BSS
+ *
+ * @__NL80211_BSS_INVALID: invalid
+ * @NL80211_BSS_BSSID: BSSID of the BSS (6 octets)
+ * @NL80211_BSS_FREQUENCY: frequency in MHz (u32)
+ * @NL80211_BSS_TSF: TSF of the received probe response/beacon (u64)
+ *    (if @NL80211_BSS_PRESP_DATA is present then this is known to be
+ *    from a probe response, otherwise it may be from the same beacon
+ *    that the NL80211_BSS_BEACON_TSF will be from)
+ * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16)
+ * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16)
+ * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the
+ *    raw information elements from the probe response/beacon (bin);
+ *    if the %NL80211_BSS_BEACON_IES attribute is present and the data is
+ *    different then the IEs here are from a Probe Response frame; otherwise
+ *    they are from a Beacon frame.
+ *    However, if the driver does not indicate the source of the IEs, these
+ *    IEs may be from either frame subtype.
+ *    If present, the @NL80211_BSS_PRESP_DATA attribute indicates that the
+ *    data here is known to be from a probe response, without any heuristics.
+ * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon
+ *    in mBm (100 * dBm) (s32)
+ * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon
+ *    in unspecified units, scaled to 0..100 (u8)
+ * @NL80211_BSS_STATUS: status, if this BSS is "used"
+ * @NL80211_BSS_SEEN_MS_AGO: age of this BSS entry in ms
+ * @NL80211_BSS_BEACON_IES: binary attribute containing the raw information
+ *    elements from a Beacon frame (bin); not present if no Beacon frame has
+ *    yet been received
+ * @NL80211_BSS_CHAN_WIDTH: channel width of the control channel
+ *    (u32, enum nl80211_bss_scan_width)
+ * @NL80211_BSS_BEACON_TSF: TSF of the last received beacon (u64)
+ *    (not present if no beacon frame has been received yet)
+ * @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and
+ *    @NL80211_BSS_TSF is known to be from a probe response (flag attribute)
+ * @NL80211_BSS_LAST_SEEN_BOOTTIME: CLOCK_BOOTTIME timestamp when this entry
+ *    was last updated by a received frame. The value is expected to be
+ *    accurate to about 10ms. (u64, nanoseconds)
+ * @NL80211_BSS_PAD: attribute used for padding for 64-bit alignment
+ * @NL80211_BSS_PARENT_TSF: the time at the start of reception of the first
+ *    octet of the timestamp field of the last beacon/probe received for
+ *    this BSS. The time is the TSF of the BSS specified by
+ *    @NL80211_BSS_PARENT_BSSID. (u64).
+ * @NL80211_BSS_PARENT_BSSID: the BSS according to which @NL80211_BSS_PARENT_TSF
+ *    is set.
+ * @NL80211_BSS_CHAIN_SIGNAL: per-chain signal strength of last BSS update.
+ *    Contains a nested array of signal strength attributes (u8, dBm),
+ *    using the nesting index as the antenna number.
+ * @__NL80211_BSS_AFTER_LAST: internal
+ * @NL80211_BSS_MAX: highest BSS attribute
+ */
+enum nl80211_bss {
+    __NL80211_BSS_INVALID,
+    NL80211_BSS_BSSID,
+    NL80211_BSS_FREQUENCY,
+    NL80211_BSS_TSF,
+    NL80211_BSS_BEACON_INTERVAL,
+    NL80211_BSS_CAPABILITY,
+    NL80211_BSS_INFORMATION_ELEMENTS,
+    NL80211_BSS_SIGNAL_MBM,
+    NL80211_BSS_SIGNAL_UNSPEC,
+    NL80211_BSS_STATUS,
+    NL80211_BSS_SEEN_MS_AGO,
+    NL80211_BSS_BEACON_IES,
+    NL80211_BSS_CHAN_WIDTH,
+    NL80211_BSS_BEACON_TSF,
+    NL80211_BSS_PRESP_DATA,
+    NL80211_BSS_LAST_SEEN_BOOTTIME,
+    NL80211_BSS_PAD,
+    NL80211_BSS_PARENT_TSF,
+    NL80211_BSS_PARENT_BSSID,
+    NL80211_BSS_CHAIN_SIGNAL,
+
+    /* keep last */
+    __NL80211_BSS_AFTER_LAST,
+    NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_bss_status - BSS "status"
+ * @NL80211_BSS_STATUS_AUTHENTICATED: Authenticated with this BSS.
+ *    Note that this is no longer used since cfg80211 no longer
+ *    keeps track of whether or not authentication was done with
+ *    a given BSS.
+ * @NL80211_BSS_STATUS_ASSOCIATED: Associated with this BSS.
+ * @NL80211_BSS_STATUS_IBSS_JOINED: Joined to this IBSS.
+ *
+ * The BSS status is a BSS attribute in scan dumps, which
+ * indicates the status the interface has wrt. this BSS.
+ */
+enum nl80211_bss_status {
+    NL80211_BSS_STATUS_AUTHENTICATED,
+    NL80211_BSS_STATUS_ASSOCIATED,
+    NL80211_BSS_STATUS_IBSS_JOINED,
+};
+
+/**
+ * enum nl80211_auth_type - AuthenticationType
+ *
+ * @NL80211_AUTHTYPE_OPEN_SYSTEM: Open System authentication
+ * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only)
+ * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r)
+ * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP)
+ * @NL80211_AUTHTYPE_SAE: Simultaneous authentication of equals
+ * @NL80211_AUTHTYPE_FILS_SK: Fast Initial Link Setup shared key
+ * @NL80211_AUTHTYPE_FILS_SK_PFS: Fast Initial Link Setup shared key with PFS
+ * @NL80211_AUTHTYPE_FILS_PK: Fast Initial Link Setup public key
+ * @__NL80211_AUTHTYPE_NUM: internal
+ * @NL80211_AUTHTYPE_MAX: maximum valid auth algorithm
+ * @NL80211_AUTHTYPE_AUTOMATIC: determine automatically (if necessary by
+ *    trying multiple times); this is invalid in netlink -- leave out
+ *    the attribute for this on CONNECT commands.
+ */
+enum nl80211_auth_type {
+    NL80211_AUTHTYPE_OPEN_SYSTEM,
+    NL80211_AUTHTYPE_SHARED_KEY,
+    NL80211_AUTHTYPE_FT,
+    NL80211_AUTHTYPE_NETWORK_EAP,
+    NL80211_AUTHTYPE_SAE,
+    NL80211_AUTHTYPE_FILS_SK,
+    NL80211_AUTHTYPE_FILS_SK_PFS,
+    NL80211_AUTHTYPE_FILS_PK,
+
+    /* keep last */
+    __NL80211_AUTHTYPE_NUM,
+    NL80211_AUTHTYPE_MAX = __NL80211_AUTHTYPE_NUM - 1,
+    NL80211_AUTHTYPE_AUTOMATIC
+};
+
+/**
+ * enum nl80211_key_type - Key Type
+ * @NL80211_KEYTYPE_GROUP: Group (broadcast/multicast) key
+ * @NL80211_KEYTYPE_PAIRWISE: Pairwise (unicast/individual) key
+ * @NL80211_KEYTYPE_PEERKEY: PeerKey (DLS)
+ * @NUM_NL80211_KEYTYPES: number of defined key types
+ */
+enum nl80211_key_type {
+    NL80211_KEYTYPE_GROUP,
+    NL80211_KEYTYPE_PAIRWISE,
+    NL80211_KEYTYPE_PEERKEY,
+
+    NUM_NL80211_KEYTYPES
+};
+
+/**
+ * enum nl80211_mfp - Management frame protection state
+ * @NL80211_MFP_NO: Management frame protection not used
+ * @NL80211_MFP_REQUIRED: Management frame protection required
+ * @NL80211_MFP_OPTIONAL: Management frame protection is optional
+ */
+enum nl80211_mfp {
+    NL80211_MFP_NO,
+    NL80211_MFP_REQUIRED,
+    NL80211_MFP_OPTIONAL,
+};
+
+enum nl80211_wpa_versions {
+    NL80211_WPA_VERSION_1 = 1 << 0,
+    NL80211_WPA_VERSION_2 = 1 << 1,
+    NL80211_WPA_VERSION_3 = 1 << 2,
+};
+
+/**
+ * enum nl80211_key_default_types - key default types
+ * @__NL80211_KEY_DEFAULT_TYPE_INVALID: invalid
+ * @NL80211_KEY_DEFAULT_TYPE_UNICAST: key should be used as default
+ *    unicast key
+ * @NL80211_KEY_DEFAULT_TYPE_MULTICAST: key should be used as default
+ *    multicast key
+ * @NUM_NL80211_KEY_DEFAULT_TYPES: number of default types
+ */
+enum nl80211_key_default_types {
+    __NL80211_KEY_DEFAULT_TYPE_INVALID,
+    NL80211_KEY_DEFAULT_TYPE_UNICAST,
+    NL80211_KEY_DEFAULT_TYPE_MULTICAST,
+
+    NUM_NL80211_KEY_DEFAULT_TYPES
+};
+
+/**
+ * enum nl80211_key_attributes - key attributes
+ * @__NL80211_KEY_INVALID: invalid
+ * @NL80211_KEY_DATA: (temporal) key data; for TKIP this consists of
+ *    16 bytes encryption key followed by 8 bytes each for TX and RX MIC
+ *    keys
+ * @NL80211_KEY_IDX: key ID (u8, 0-3)
+ * @NL80211_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11
+ *    section 7.3.2.25.1, e.g. 0x000FAC04)
+ * @NL80211_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and
+ *    CCMP keys, each six bytes in little endian
+ * @NL80211_KEY_DEFAULT: flag indicating default key
+ * @NL80211_KEY_DEFAULT_MGMT: flag indicating default management key
+ * @NL80211_KEY_TYPE: the key type from enum nl80211_key_type, if not
+ *    specified the default depends on whether a MAC address was
+ *    given with the command using the key or not (u32)
+ * @NL80211_KEY_DEFAULT_TYPES: A nested attribute containing flags
+ *    attributes, specifying what a key should be set as default as.
+ *    See &enum nl80211_key_default_types.
+ * @NL80211_KEY_MODE: the mode from enum nl80211_key_mode.
+ *    Defaults to @NL80211_KEY_RX_TX.
+ *
+ * @__NL80211_KEY_AFTER_LAST: internal
+ * @NL80211_KEY_MAX: highest key attribute
+ */
+enum nl80211_key_attributes {
+    __NL80211_KEY_INVALID,
+    NL80211_KEY_DATA,
+    NL80211_KEY_IDX,
+    NL80211_KEY_CIPHER,
+    NL80211_KEY_SEQ,
+    NL80211_KEY_DEFAULT,
+    NL80211_KEY_DEFAULT_MGMT,
+    NL80211_KEY_TYPE,
+    NL80211_KEY_DEFAULT_TYPES,
+    NL80211_KEY_MODE,
+
+    /* keep last */
+    __NL80211_KEY_AFTER_LAST,
+    NL80211_KEY_MAX = __NL80211_KEY_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_tx_rate_attributes - TX rate set attributes
+ * @__NL80211_TXRATE_INVALID: invalid
+ * @NL80211_TXRATE_LEGACY: Legacy (non-MCS) rates allowed for TX rate selection
+ *    in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with
+ *    1 = 500 kbps) but without the IE length restriction (at most
+ *    %NL80211_MAX_SUPP_RATES in a single array).
+ * @NL80211_TXRATE_HT: HT (MCS) rates allowed for TX rate selection
+ *    in an array of MCS numbers.
+ * @NL80211_TXRATE_VHT: VHT rates allowed for TX rate selection,
+ *    see &struct nl80211_txrate_vht
+ * @NL80211_TXRATE_GI: configure GI, see &enum nl80211_txrate_gi
+ * @__NL80211_TXRATE_AFTER_LAST: internal
+ * @NL80211_TXRATE_MAX: highest TX rate attribute
+ */
+enum nl80211_tx_rate_attributes {
+    __NL80211_TXRATE_INVALID,
+    NL80211_TXRATE_LEGACY,
+    NL80211_TXRATE_HT,
+    NL80211_TXRATE_VHT,
+    NL80211_TXRATE_GI,
+
+    /* keep last */
+    __NL80211_TXRATE_AFTER_LAST,
+    NL80211_TXRATE_MAX = __NL80211_TXRATE_AFTER_LAST - 1
+};
+
+#define NL80211_TXRATE_MCS NL80211_TXRATE_HT
+#define NL80211_VHT_NSS_MAX        8
+
+/**
+ * struct nl80211_txrate_vht - VHT MCS/NSS txrate bitmap
+ * @mcs: MCS bitmap table for each NSS (array index 0 for 1 stream, etc.)
+ */
+struct nl80211_txrate_vht {
+    __u16 mcs[NL80211_VHT_NSS_MAX];
+};
+
+enum nl80211_txrate_gi {
+    NL80211_TXRATE_DEFAULT_GI,
+    NL80211_TXRATE_FORCE_SGI,
+    NL80211_TXRATE_FORCE_LGI,
+};
+
+/**
+ * enum nl80211_band - Frequency band
+ * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
+ * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
+ * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 69.12 GHz)
+ * @NL80211_BAND_6GHZ: around 6 GHz band (5.9 - 7.2 GHz)
+ * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace
+ *    since newer kernel versions may support more bands
+ */
+enum nl80211_band {
+    NL80211_BAND_2GHZ,
+    NL80211_BAND_5GHZ,
+    NL80211_BAND_60GHZ,
+    NL80211_BAND_6GHZ,
+
+    NUM_NL80211_BANDS,
+};
+
+/**
+ * enum nl80211_ps_state - powersave state
+ * @NL80211_PS_DISABLED: powersave is disabled
+ * @NL80211_PS_ENABLED: powersave is enabled
+ */
+enum nl80211_ps_state {
+    NL80211_PS_DISABLED,
+    NL80211_PS_ENABLED,
+};
+
+/**
+ * enum nl80211_attr_cqm - connection quality monitor attributes
+ * @__NL80211_ATTR_CQM_INVALID: invalid
+ * @NL80211_ATTR_CQM_RSSI_THOLD: RSSI threshold in dBm. This value specifies
+ *    the threshold for the RSSI level at which an event will be sent. Zero
+ *    to disable.  Alternatively, if %NL80211_EXT_FEATURE_CQM_RSSI_LIST is
+ *    set, multiple values can be supplied as a low-to-high sorted array of
+ *    threshold values in dBm.  Events will be sent when the RSSI value
+ *    crosses any of the thresholds.
+ * @NL80211_ATTR_CQM_RSSI_HYST: RSSI hysteresis in dBm. This value specifies
+ *    the minimum amount the RSSI level must change after an event before a
+ *    new event may be issued (to reduce effects of RSSI oscillation).
+ * @NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT: RSSI threshold event
+ * @NL80211_ATTR_CQM_PKT_LOSS_EVENT: a u32 value indicating that this many
+ *    consecutive packets were not acknowledged by the peer
+ * @NL80211_ATTR_CQM_TXE_RATE: TX error rate in %. Minimum % of TX failures
+ *    during the given %NL80211_ATTR_CQM_TXE_INTVL before an
+ *    %NL80211_CMD_NOTIFY_CQM with reported %NL80211_ATTR_CQM_TXE_RATE and
+ *    %NL80211_ATTR_CQM_TXE_PKTS is generated.
+ * @NL80211_ATTR_CQM_TXE_PKTS: number of attempted packets in a given
+ *    %NL80211_ATTR_CQM_TXE_INTVL before %NL80211_ATTR_CQM_TXE_RATE is
+ *    checked.
+ * @NL80211_ATTR_CQM_TXE_INTVL: interval in seconds. Specifies the periodic
+ *    interval in which %NL80211_ATTR_CQM_TXE_PKTS and
+ *    %NL80211_ATTR_CQM_TXE_RATE must be satisfied before generating an
+ *    %NL80211_CMD_NOTIFY_CQM. Set to 0 to turn off TX error reporting.
+ * @NL80211_ATTR_CQM_BEACON_LOSS_EVENT: flag attribute that's set in a beacon
+ *    loss event
+ * @NL80211_ATTR_CQM_RSSI_LEVEL: the RSSI value in dBm that triggered the
+ *    RSSI threshold event.
+ * @__NL80211_ATTR_CQM_AFTER_LAST: internal
+ * @NL80211_ATTR_CQM_MAX: highest key attribute
+ */
+enum nl80211_attr_cqm {
+    __NL80211_ATTR_CQM_INVALID,
+    NL80211_ATTR_CQM_RSSI_THOLD,
+    NL80211_ATTR_CQM_RSSI_HYST,
+    NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT,
+    NL80211_ATTR_CQM_PKT_LOSS_EVENT,
+    NL80211_ATTR_CQM_TXE_RATE,
+    NL80211_ATTR_CQM_TXE_PKTS,
+    NL80211_ATTR_CQM_TXE_INTVL,
+    NL80211_ATTR_CQM_BEACON_LOSS_EVENT,
+    NL80211_ATTR_CQM_RSSI_LEVEL,
+
+    /* keep last */
+    __NL80211_ATTR_CQM_AFTER_LAST,
+    NL80211_ATTR_CQM_MAX = __NL80211_ATTR_CQM_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_cqm_rssi_threshold_event - RSSI threshold event
+ * @NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW: The RSSI level is lower than the
+ *    configured threshold
+ * @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH: The RSSI is higher than the
+ *    configured threshold
+ * @NL80211_CQM_RSSI_BEACON_LOSS_EVENT: (reserved, never sent)
+ */
+enum nl80211_cqm_rssi_threshold_event {
+    NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
+    NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
+    NL80211_CQM_RSSI_BEACON_LOSS_EVENT,
+};
+
+/**
+ * enum nl80211_tx_power_setting - TX power adjustment
+ * @NL80211_TX_POWER_AUTOMATIC: automatically determine transmit power
+ * @NL80211_TX_POWER_LIMITED: limit TX power by the mBm parameter
+ * @NL80211_TX_POWER_FIXED: fix TX power to the mBm parameter
+ */
+enum nl80211_tx_power_setting {
+    NL80211_TX_POWER_AUTOMATIC,
+    NL80211_TX_POWER_LIMITED,
+    NL80211_TX_POWER_FIXED,
+};
+
+/**
+ * enum nl80211_packet_pattern_attr - packet pattern attribute
+ * @__NL80211_PKTPAT_INVALID: invalid number for nested attribute
+ * @NL80211_PKTPAT_PATTERN: the pattern, values where the mask has
+ *    a zero bit are ignored
+ * @NL80211_PKTPAT_MASK: pattern mask, must be long enough to have
+ *    a bit for each byte in the pattern. The lowest-order bit corresponds
+ *    to the first byte of the pattern, but the bytes of the pattern are
+ *    in a little-endian-like format, i.e. the 9th byte of the pattern
+ *    corresponds to the lowest-order bit in the second byte of the mask.
+ *    For example: The match 00:xx:00:00:xx:00:00:00:00:xx:xx:xx (where
+ *    xx indicates "don't care") would be represented by a pattern of
+ *    twelve zero bytes, and a mask of "0xed,0x01".
+ *    Note that the pattern matching is done as though frames were not
+ *    802.11 frames but 802.3 frames, i.e. the frame is fully unpacked
+ *    first (including SNAP header unpacking) and then matched.
+ * @NL80211_PKTPAT_OFFSET: packet offset, pattern is matched after
+ *    these fixed number of bytes of received packet
+ * @NUM_NL80211_PKTPAT: number of attributes
+ * @MAX_NL80211_PKTPAT: max attribute number
+ */
+enum nl80211_packet_pattern_attr {
+    __NL80211_PKTPAT_INVALID,
+    NL80211_PKTPAT_MASK,
+    NL80211_PKTPAT_PATTERN,
+    NL80211_PKTPAT_OFFSET,
+
+    NUM_NL80211_PKTPAT,
+    MAX_NL80211_PKTPAT = NUM_NL80211_PKTPAT - 1,
+};
+
+/**
+ * struct nl80211_pattern_support - packet pattern support information
+ * @max_patterns: maximum number of patterns supported
+ * @min_pattern_len: minimum length of each pattern
+ * @max_pattern_len: maximum length of each pattern
+ * @max_pkt_offset: maximum Rx packet offset
+ *
+ * This struct is carried in %NL80211_WOWLAN_TRIG_PKT_PATTERN when
+ * that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED or in
+ * %NL80211_ATTR_COALESCE_RULE_PKT_PATTERN when that is part of
+ * %NL80211_ATTR_COALESCE_RULE in the capability information given
+ * by the kernel to userspace.
+ */
+struct nl80211_pattern_support {
+    __u32 max_patterns;
+    __u32 min_pattern_len;
+    __u32 max_pattern_len;
+    __u32 max_pkt_offset;
+} __attribute__((packed));
+
+/* only for backward compatibility */
+#define __NL80211_WOWLAN_PKTPAT_INVALID __NL80211_PKTPAT_INVALID
+#define NL80211_WOWLAN_PKTPAT_MASK NL80211_PKTPAT_MASK
+#define NL80211_WOWLAN_PKTPAT_PATTERN NL80211_PKTPAT_PATTERN
+#define NL80211_WOWLAN_PKTPAT_OFFSET NL80211_PKTPAT_OFFSET
+#define NUM_NL80211_WOWLAN_PKTPAT NUM_NL80211_PKTPAT
+#define MAX_NL80211_WOWLAN_PKTPAT MAX_NL80211_PKTPAT
+#define nl80211_wowlan_pattern_support nl80211_pattern_support
+
+/**
+ * enum nl80211_wowlan_triggers - WoWLAN trigger definitions
+ * @__NL80211_WOWLAN_TRIG_INVALID: invalid number for nested attributes
+ * @NL80211_WOWLAN_TRIG_ANY: wake up on any activity, do not really put
+ *    the chip into a special state -- works best with chips that have
+ *    support for low-power operation already (flag)
+ *    Note that this mode is incompatible with all of the others, if
+ *    any others are even supported by the device.
+ * @NL80211_WOWLAN_TRIG_DISCONNECT: wake up on disconnect, the way disconnect
+ *    is detected is implementation-specific (flag)
+ * @NL80211_WOWLAN_TRIG_MAGIC_PKT: wake up on magic packet (6x 0xff, followed
+ *    by 16 repetitions of MAC addr, anywhere in payload) (flag)
+ * @NL80211_WOWLAN_TRIG_PKT_PATTERN: wake up on the specified packet patterns
+ *    which are passed in an array of nested attributes, each nested attribute
+ *    defining a with attributes from &struct nl80211_wowlan_trig_pkt_pattern.
+ *    Each pattern defines a wakeup packet. Packet offset is associated with
+ *    each pattern which is used while matching the pattern. The matching is
+ *    done on the MSDU, i.e. as though the packet was an 802.3 packet, so the
+ *    pattern matching is done after the packet is converted to the MSDU.
+ *
+ *    In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute
+ *    carrying a &struct nl80211_pattern_support.
+ *
+ *    When reporting wakeup. it is a u32 attribute containing the 0-based
+ *    index of the pattern that caused the wakeup, in the patterns passed
+ *    to the kernel when configuring.
+ * @NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED: Not a real trigger, and cannot be
+ *    used when setting, used only to indicate that GTK rekeying is supported
+ *    by the device (flag)
+ * @NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE: wake up on GTK rekey failure (if
+ *    done by the device) (flag)
+ * @NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST: wake up on EAP Identity Request
+ *    packet (flag)
+ * @NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE: wake up on 4-way handshake (flag)
+ * @NL80211_WOWLAN_TRIG_RFKILL_RELEASE: wake up when rfkill is released
+ *    (on devices that have rfkill in the device) (flag)
+ * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211: For wakeup reporting only, contains
+ *    the 802.11 packet that caused the wakeup, e.g. a deauth frame. The frame
+ *    may be truncated, the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN
+ *    attribute contains the original length.
+ * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN: Original length of the 802.11
+ *    packet, may be bigger than the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211
+ *    attribute if the packet was truncated somewhere.
+ * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023: For wakeup reporting only, contains the
+ *    802.11 packet that caused the wakeup, e.g. a magic packet. The frame may
+ *    be truncated, the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN attribute
+ *    contains the original length.
+ * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN: Original length of the 802.3
+ *    packet, may be bigger than the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023
+ *    attribute if the packet was truncated somewhere.
+ * @NL80211_WOWLAN_TRIG_TCP_CONNECTION: TCP connection wake, see DOC section
+ *    "TCP connection wakeup" for more details. This is a nested attribute
+ *    containing the exact information for establishing and keeping alive
+ *    the TCP connection.
+ * @NL80211_WOWLAN_TRIG_TCP_WAKEUP_MATCH: For wakeup reporting only, the
+ *    wakeup packet was received on the TCP connection
+ * @NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST: For wakeup reporting only, the
+ *    TCP connection was lost or failed to be established
+ * @NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS: For wakeup reporting only,
+ *    the TCP connection ran out of tokens to use for data to send to the
+ *    service
+ * @NL80211_WOWLAN_TRIG_NET_DETECT: wake up when a configured network
+ *    is detected.  This is a nested attribute that contains the
+ *    same attributes used with @NL80211_CMD_START_SCHED_SCAN.  It
+ *    specifies how the scan is performed (e.g. the interval, the
+ *    channels to scan and the initial delay) as well as the scan
+ *    results that will trigger a wake (i.e. the matchsets).  This
+ *    attribute is also sent in a response to
+ *    @NL80211_CMD_GET_WIPHY, indicating the number of match sets
+ *    supported by the driver (u32).
+ * @NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS: nested attribute
+ *    containing an array with information about what triggered the
+ *    wake up.  If no elements are present in the array, it means
+ *    that the information is not available.  If more than one
+ *    element is present, it means that more than one match
+ *    occurred.
+ *    Each element in the array is a nested attribute that contains
+ *    one optional %NL80211_ATTR_SSID attribute and one optional
+ *    %NL80211_ATTR_SCAN_FREQUENCIES attribute.  At least one of
+ *    these attributes must be present.  If
+ *    %NL80211_ATTR_SCAN_FREQUENCIES contains more than one
+ *    frequency, it means that the match occurred in more than one
+ *    channel.
+ * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers
+ * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number
+ *
+ * These nested attributes are used to configure the wakeup triggers and
+ * to report the wakeup reason(s).
+ */
+enum nl80211_wowlan_triggers {
+    __NL80211_WOWLAN_TRIG_INVALID,
+    NL80211_WOWLAN_TRIG_ANY,
+    NL80211_WOWLAN_TRIG_DISCONNECT,
+    NL80211_WOWLAN_TRIG_MAGIC_PKT,
+    NL80211_WOWLAN_TRIG_PKT_PATTERN,
+    NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED,
+    NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE,
+    NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST,
+    NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE,
+    NL80211_WOWLAN_TRIG_RFKILL_RELEASE,
+    NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211,
+    NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN,
+    NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023,
+    NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN,
+    NL80211_WOWLAN_TRIG_TCP_CONNECTION,
+    NL80211_WOWLAN_TRIG_WAKEUP_TCP_MATCH,
+    NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST,
+    NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS,
+    NL80211_WOWLAN_TRIG_NET_DETECT,
+    NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS,
+
+    /* keep last */
+    NUM_NL80211_WOWLAN_TRIG,
+    MAX_NL80211_WOWLAN_TRIG = NUM_NL80211_WOWLAN_TRIG - 1
+};
+
+/**
+ * DOC: TCP connection wakeup
+ *
+ * Some devices can establish a TCP connection in order to be woken up by a
+ * packet coming in from outside their network segment, or behind NAT. If
+ * configured, the device will establish a TCP connection to the given
+ * service, and periodically send data to that service. The first data
+ * packet is usually transmitted after SYN/ACK, also ACKing the SYN/ACK.
+ * The data packets can optionally include a (little endian) sequence
+ * number (in the TCP payload!) that is generated by the device, and, also
+ * optionally, a token from a list of tokens. This serves as a keep-alive
+ * with the service, and for NATed connections, etc.
+ *
+ * During this keep-alive period, the server doesn't send any data to the
+ * client. When receiving data, it is compared against the wakeup pattern
+ * (and mask) and if it matches, the host is woken up. Similarly, if the
+ * connection breaks or cannot be established to start with, the host is
+ * also woken up.
+ *
+ * Developer's note: ARP offload is required for this, otherwise TCP
+ * response packets might not go through correctly.
+ */
+
+/**
+ * struct nl80211_wowlan_tcp_data_seq - WoWLAN TCP data sequence
+ * @start: starting value
+ * @offset: offset of sequence number in packet
+ * @len: length of the sequence value to write, 1 through 4
+ *
+ * Note: don't confuse with the TCP sequence number(s), this is for the
+ * keepalive packet payload. The actual value is written into the packet
+ * in little endian.
+ */
+struct nl80211_wowlan_tcp_data_seq {
+    __u32 start, offset, len;
+};
+
+/**
+ * struct nl80211_wowlan_tcp_data_token - WoWLAN TCP data token config
+ * @offset: offset of token in packet
+ * @len: length of each token
+ * @token_stream: stream of data to be used for the tokens, the length must
+ *    be a multiple of @len for this to make sense
+ */
+struct nl80211_wowlan_tcp_data_token {
+    __u32 offset, len;
+    __u8 token_stream[];
+};
+
+/**
+ * struct nl80211_wowlan_tcp_data_token_feature - data token features
+ * @min_len: minimum token length
+ * @max_len: maximum token length
+ * @bufsize: total available token buffer size (max size of @token_stream)
+ */
+struct nl80211_wowlan_tcp_data_token_feature {
+    __u32 min_len, max_len, bufsize;
+};
+
+/**
+ * enum nl80211_wowlan_tcp_attrs - WoWLAN TCP connection parameters
+ * @__NL80211_WOWLAN_TCP_INVALID: invalid number for nested attributes
+ * @NL80211_WOWLAN_TCP_SRC_IPV4: source IPv4 address (in network byte order)
+ * @NL80211_WOWLAN_TCP_DST_IPV4: destination IPv4 address
+ *    (in network byte order)
+ * @NL80211_WOWLAN_TCP_DST_MAC: destination MAC address, this is given because
+ *    route lookup when configured might be invalid by the time we suspend,
+ *    and doing a route lookup when suspending is no longer possible as it
+ *    might require ARP querying.
+ * @NL80211_WOWLAN_TCP_SRC_PORT: source port (u16); optional, if not given a
+ *    socket and port will be allocated
+ * @NL80211_WOWLAN_TCP_DST_PORT: destination port (u16)
+ * @NL80211_WOWLAN_TCP_DATA_PAYLOAD: data packet payload, at least one byte.
+ *    For feature advertising, a u32 attribute holding the maximum length
+ *    of the data payload.
+ * @NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ: data packet sequence configuration
+ *    (if desired), a &struct nl80211_wowlan_tcp_data_seq. For feature
+ *    advertising it is just a flag
+ * @NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN: data packet token configuration,
+ *    see &struct nl80211_wowlan_tcp_data_token and for advertising see
+ *    &struct nl80211_wowlan_tcp_data_token_feature.
+ * @NL80211_WOWLAN_TCP_DATA_INTERVAL: data interval in seconds, maximum
+ *    interval in feature advertising (u32)
+ * @NL80211_WOWLAN_TCP_WAKE_PAYLOAD: wake packet payload, for advertising a
+ *    u32 attribute holding the maximum length
+ * @NL80211_WOWLAN_TCP_WAKE_MASK: Wake packet payload mask, not used for
+ *    feature advertising. The mask works like @NL80211_PKTPAT_MASK
+ *    but on the TCP payload only.
+ * @NUM_NL80211_WOWLAN_TCP: number of TCP attributes
+ * @MAX_NL80211_WOWLAN_TCP: highest attribute number
+ */
+enum nl80211_wowlan_tcp_attrs {
+    __NL80211_WOWLAN_TCP_INVALID,
+    NL80211_WOWLAN_TCP_SRC_IPV4,
+    NL80211_WOWLAN_TCP_DST_IPV4,
+    NL80211_WOWLAN_TCP_DST_MAC,
+    NL80211_WOWLAN_TCP_SRC_PORT,
+    NL80211_WOWLAN_TCP_DST_PORT,
+    NL80211_WOWLAN_TCP_DATA_PAYLOAD,
+    NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ,
+    NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN,
+    NL80211_WOWLAN_TCP_DATA_INTERVAL,
+    NL80211_WOWLAN_TCP_WAKE_PAYLOAD,
+    NL80211_WOWLAN_TCP_WAKE_MASK,
+
+    /* keep last */
+    NUM_NL80211_WOWLAN_TCP,
+    MAX_NL80211_WOWLAN_TCP = NUM_NL80211_WOWLAN_TCP - 1
+};
+
+/**
+ * struct nl80211_coalesce_rule_support - coalesce rule support information
+ * @max_rules: maximum number of rules supported
+ * @pat: packet pattern support information
+ * @max_delay: maximum supported coalescing delay in msecs
+ *
+ * This struct is carried in %NL80211_ATTR_COALESCE_RULE in the
+ * capability information given by the kernel to userspace.
+ */
+struct nl80211_coalesce_rule_support {
+    __u32 max_rules;
+    struct nl80211_pattern_support pat;
+    __u32 max_delay;
+} __attribute__((packed));
+
+/**
+ * enum nl80211_attr_coalesce_rule - coalesce rule attribute
+ * @__NL80211_COALESCE_RULE_INVALID: invalid number for nested attribute
+ * @NL80211_ATTR_COALESCE_RULE_DELAY: delay in msecs used for packet coalescing
+ * @NL80211_ATTR_COALESCE_RULE_CONDITION: condition for packet coalescence,
+ *    see &enum nl80211_coalesce_condition.
+ * @NL80211_ATTR_COALESCE_RULE_PKT_PATTERN: packet offset, pattern is matched
+ *    after these fixed number of bytes of received packet
+ * @NUM_NL80211_ATTR_COALESCE_RULE: number of attributes
+ * @NL80211_ATTR_COALESCE_RULE_MAX: max attribute number
+ */
+enum nl80211_attr_coalesce_rule {
+    __NL80211_COALESCE_RULE_INVALID,
+    NL80211_ATTR_COALESCE_RULE_DELAY,
+    NL80211_ATTR_COALESCE_RULE_CONDITION,
+    NL80211_ATTR_COALESCE_RULE_PKT_PATTERN,
+
+    /* keep last */
+    NUM_NL80211_ATTR_COALESCE_RULE,
+    NL80211_ATTR_COALESCE_RULE_MAX = NUM_NL80211_ATTR_COALESCE_RULE - 1
+};
+
+/**
+ * enum nl80211_coalesce_condition - coalesce rule conditions
+ * @NL80211_COALESCE_CONDITION_MATCH: coalaesce Rx packets when patterns
+ *    in a rule are matched.
+ * @NL80211_COALESCE_CONDITION_NO_MATCH: coalesce Rx packets when patterns
+ *    in a rule are not matched.
+ */
+enum nl80211_coalesce_condition {
+    NL80211_COALESCE_CONDITION_MATCH,
+    NL80211_COALESCE_CONDITION_NO_MATCH
+};
+
+/**
+ * enum nl80211_iface_limit_attrs - limit attributes
+ * @NL80211_IFACE_LIMIT_UNSPEC: (reserved)
+ * @NL80211_IFACE_LIMIT_MAX: maximum number of interfaces that
+ *    can be chosen from this set of interface types (u32)
+ * @NL80211_IFACE_LIMIT_TYPES: nested attribute containing a
+ *    flag attribute for each interface type in this set
+ * @NUM_NL80211_IFACE_LIMIT: number of attributes
+ * @MAX_NL80211_IFACE_LIMIT: highest attribute number
+ */
+enum nl80211_iface_limit_attrs {
+    NL80211_IFACE_LIMIT_UNSPEC,
+    NL80211_IFACE_LIMIT_MAX,
+    NL80211_IFACE_LIMIT_TYPES,
+
+    /* keep last */
+    NUM_NL80211_IFACE_LIMIT,
+    MAX_NL80211_IFACE_LIMIT = NUM_NL80211_IFACE_LIMIT - 1
+};
+
+/**
+ * enum nl80211_if_combination_attrs -- interface combination attributes
+ *
+ * @NL80211_IFACE_COMB_UNSPEC: (reserved)
+ * @NL80211_IFACE_COMB_LIMITS: Nested attributes containing the limits
+ *    for given interface types, see &enum nl80211_iface_limit_attrs.
+ * @NL80211_IFACE_COMB_MAXNUM: u32 attribute giving the total number of
+ *    interfaces that can be created in this group. This number doesn't
+ *    apply to interfaces purely managed in software, which are listed
+ *    in a separate attribute %NL80211_ATTR_INTERFACES_SOFTWARE.
+ * @NL80211_IFACE_COMB_STA_AP_BI_MATCH: flag attribute specifying that
+ *    beacon intervals within this group must be all the same even for
+ *    infrastructure and AP/GO combinations, i.e. the GO(s) must adopt
+ *    the infrastructure network's beacon interval.
+ * @NL80211_IFACE_COMB_NUM_CHANNELS: u32 attribute specifying how many
+ *    different channels may be used within this group.
+ * @NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS: u32 attribute containing the bitmap
+ *    of supported channel widths for radar detection.
+ * @NL80211_IFACE_COMB_RADAR_DETECT_REGIONS: u32 attribute containing the bitmap
+ *    of supported regulatory regions for radar detection.
+ * @NL80211_IFACE_COMB_BI_MIN_GCD: u32 attribute specifying the minimum GCD of
+ *    different beacon intervals supported by all the interface combinations
+ *    in this group (if not present, all beacon intervals be identical).
+ * @NUM_NL80211_IFACE_COMB: number of attributes
+ * @MAX_NL80211_IFACE_COMB: highest attribute number
+ *
+ * Examples:
+ *    limits = [ #{STA} <= 1, #{AP} <= 1 ], matching BI, channels = 1, max = 2
+ *    => allows an AP and a STA that must match BIs
+ *
+ *    numbers = [ #{AP, P2P-GO} <= 8 ], BI min gcd, channels = 1, max = 8,
+ *    => allows 8 of AP/GO that can have BI gcd >= min gcd
+ *
+ *    numbers = [ #{STA} <= 2 ], channels = 2, max = 2
+ *    => allows two STAs on different channels
+ *
+ *    numbers = [ #{STA} <= 1, #{P2P-client,P2P-GO} <= 3 ], max = 4
+ *    => allows a STA plus three P2P interfaces
+ *
+ * The list of these four possibilities could completely be contained
+ * within the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute to indicate
+ * that any of these groups must match.
+ *
+ * "Combinations" of just a single interface will not be listed here,
+ * a single interface of any valid interface type is assumed to always
+ * be possible by itself. This means that implicitly, for each valid
+ * interface type, the following group always exists:
+ *    numbers = [ #{<type>} <= 1 ], channels = 1, max = 1
+ */
+enum nl80211_if_combination_attrs {
+    NL80211_IFACE_COMB_UNSPEC,
+    NL80211_IFACE_COMB_LIMITS,
+    NL80211_IFACE_COMB_MAXNUM,
+    NL80211_IFACE_COMB_STA_AP_BI_MATCH,
+    NL80211_IFACE_COMB_NUM_CHANNELS,
+    NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS,
+    NL80211_IFACE_COMB_RADAR_DETECT_REGIONS,
+    NL80211_IFACE_COMB_BI_MIN_GCD,
+
+    /* keep last */
+    NUM_NL80211_IFACE_COMB,
+    MAX_NL80211_IFACE_COMB = NUM_NL80211_IFACE_COMB - 1
+};
+
+/**
+ * enum nl80211_plink_state - state of a mesh peer link finite state machine
+ *
+ * @NL80211_PLINK_LISTEN: initial state, considered the implicit
+ *    state of non existent mesh peer links
+ * @NL80211_PLINK_OPN_SNT: mesh plink open frame has been sent to
+ *    this mesh peer
+ * @NL80211_PLINK_OPN_RCVD: mesh plink open frame has been received
+ *    from this mesh peer
+ * @NL80211_PLINK_CNF_RCVD: mesh plink confirm frame has been
+ *    received from this mesh peer
+ * @NL80211_PLINK_ESTAB: mesh peer link is established
+ * @NL80211_PLINK_HOLDING: mesh peer link is being closed or cancelled
+ * @NL80211_PLINK_BLOCKED: all frames transmitted from this mesh
+ *    plink are discarded
+ * @NUM_NL80211_PLINK_STATES: number of peer link states
+ * @MAX_NL80211_PLINK_STATES: highest numerical value of plink states
+ */
+enum nl80211_plink_state {
+    NL80211_PLINK_LISTEN,
+    NL80211_PLINK_OPN_SNT,
+    NL80211_PLINK_OPN_RCVD,
+    NL80211_PLINK_CNF_RCVD,
+    NL80211_PLINK_ESTAB,
+    NL80211_PLINK_HOLDING,
+    NL80211_PLINK_BLOCKED,
+
+    /* keep last */
+    NUM_NL80211_PLINK_STATES,
+    MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1
+};
+
+/**
+ * enum nl80211_plink_action - actions to perform in mesh peers
+ *
+ * @NL80211_PLINK_ACTION_NO_ACTION: perform no action
+ * @NL80211_PLINK_ACTION_OPEN: start mesh peer link establishment
+ * @NL80211_PLINK_ACTION_BLOCK: block traffic from this mesh peer
+ * @NUM_NL80211_PLINK_ACTIONS: number of possible actions
+ */
+enum plink_actions {
+    NL80211_PLINK_ACTION_NO_ACTION,
+    NL80211_PLINK_ACTION_OPEN,
+    NL80211_PLINK_ACTION_BLOCK,
+
+    NUM_NL80211_PLINK_ACTIONS,
+};
+
+#define NL80211_KCK_LEN            16
+#define NL80211_KEK_LEN            16
+#define NL80211_REPLAY_CTR_LEN        8
+
+/**
+ * enum nl80211_rekey_data - attributes for GTK rekey offload
+ * @__NL80211_REKEY_DATA_INVALID: invalid number for nested attributes
+ * @NL80211_REKEY_DATA_KEK: key encryption key (binary)
+ * @NL80211_REKEY_DATA_KCK: key confirmation key (binary)
+ * @NL80211_REKEY_DATA_REPLAY_CTR: replay counter (binary)
+ * @NUM_NL80211_REKEY_DATA: number of rekey attributes (internal)
+ * @MAX_NL80211_REKEY_DATA: highest rekey attribute (internal)
+ */
+enum nl80211_rekey_data {
+    __NL80211_REKEY_DATA_INVALID,
+    NL80211_REKEY_DATA_KEK,
+    NL80211_REKEY_DATA_KCK,
+    NL80211_REKEY_DATA_REPLAY_CTR,
+
+    /* keep last */
+    NUM_NL80211_REKEY_DATA,
+    MAX_NL80211_REKEY_DATA = NUM_NL80211_REKEY_DATA - 1
+};
+
+/**
+ * enum nl80211_hidden_ssid - values for %NL80211_ATTR_HIDDEN_SSID
+ * @NL80211_HIDDEN_SSID_NOT_IN_USE: do not hide SSID (i.e., broadcast it in
+ *    Beacon frames)
+ * @NL80211_HIDDEN_SSID_ZERO_LEN: hide SSID by using zero-length SSID element
+ *    in Beacon frames
+ * @NL80211_HIDDEN_SSID_ZERO_CONTENTS: hide SSID by using correct length of SSID
+ *    element in Beacon frames but zero out each byte in the SSID
+ */
+enum nl80211_hidden_ssid {
+    NL80211_HIDDEN_SSID_NOT_IN_USE,
+    NL80211_HIDDEN_SSID_ZERO_LEN,
+    NL80211_HIDDEN_SSID_ZERO_CONTENTS
+};
+
+/**
+ * enum nl80211_sta_wme_attr - station WME attributes
+ * @__NL80211_STA_WME_INVALID: invalid number for nested attribute
+ * @NL80211_STA_WME_UAPSD_QUEUES: bitmap of uapsd queues. the format
+ *    is the same as the AC bitmap in the QoS info field.
+ * @NL80211_STA_WME_MAX_SP: max service period. the format is the same
+ *    as the MAX_SP field in the QoS info field (but already shifted down).
+ * @__NL80211_STA_WME_AFTER_LAST: internal
+ * @NL80211_STA_WME_MAX: highest station WME attribute
+ */
+enum nl80211_sta_wme_attr {
+    __NL80211_STA_WME_INVALID,
+    NL80211_STA_WME_UAPSD_QUEUES,
+    NL80211_STA_WME_MAX_SP,
+
+    /* keep last */
+    __NL80211_STA_WME_AFTER_LAST,
+    NL80211_STA_WME_MAX = __NL80211_STA_WME_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_pmksa_candidate_attr - attributes for PMKSA caching candidates
+ * @__NL80211_PMKSA_CANDIDATE_INVALID: invalid number for nested attributes
+ * @NL80211_PMKSA_CANDIDATE_INDEX: candidate index (u32; the smaller, the higher
+ *    priority)
+ * @NL80211_PMKSA_CANDIDATE_BSSID: candidate BSSID (6 octets)
+ * @NL80211_PMKSA_CANDIDATE_PREAUTH: RSN pre-authentication supported (flag)
+ * @NUM_NL80211_PMKSA_CANDIDATE: number of PMKSA caching candidate attributes
+ *    (internal)
+ * @MAX_NL80211_PMKSA_CANDIDATE: highest PMKSA caching candidate attribute
+ *    (internal)
+ */
+enum nl80211_pmksa_candidate_attr {
+    __NL80211_PMKSA_CANDIDATE_INVALID,
+    NL80211_PMKSA_CANDIDATE_INDEX,
+    NL80211_PMKSA_CANDIDATE_BSSID,
+    NL80211_PMKSA_CANDIDATE_PREAUTH,
+
+    /* keep last */
+    NUM_NL80211_PMKSA_CANDIDATE,
+    MAX_NL80211_PMKSA_CANDIDATE = NUM_NL80211_PMKSA_CANDIDATE - 1
+};
+
+/**
+ * enum nl80211_tdls_operation - values for %NL80211_ATTR_TDLS_OPERATION
+ * @NL80211_TDLS_DISCOVERY_REQ: Send a TDLS discovery request
+ * @NL80211_TDLS_SETUP: Setup TDLS link
+ * @NL80211_TDLS_TEARDOWN: Teardown a TDLS link which is already established
+ * @NL80211_TDLS_ENABLE_LINK: Enable TDLS link
+ * @NL80211_TDLS_DISABLE_LINK: Disable TDLS link
+ */
+enum nl80211_tdls_operation {
+    NL80211_TDLS_DISCOVERY_REQ,
+    NL80211_TDLS_SETUP,
+    NL80211_TDLS_TEARDOWN,
+    NL80211_TDLS_ENABLE_LINK,
+    NL80211_TDLS_DISABLE_LINK,
+};
+
+/*
+ * enum nl80211_ap_sme_features - device-integrated AP features
+ * Reserved for future use, no bits are defined in
+ * NL80211_ATTR_DEVICE_AP_SME yet.
+enum nl80211_ap_sme_features {
+};
+ */
+
+/**
+ * enum nl80211_feature_flags - device/driver features
+ * @NL80211_FEATURE_SK_TX_STATUS: This driver supports reflecting back
+ *    TX status to the socket error queue when requested with the
+ *    socket option.
+ * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates.
+ * @NL80211_FEATURE_INACTIVITY_TIMER: This driver takes care of freeing up
+ *    the connected inactive stations in AP mode.
+ * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested
+ *    to work properly to suppport receiving regulatory hints from
+ *    cellular base stations.
+ * @NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL: (no longer available, only
+ *    here to reserve the value for API/ABI compatibility)
+ * @NL80211_FEATURE_SAE: This driver supports simultaneous authentication of
+ *    equals (SAE) with user space SME (NL80211_CMD_AUTHENTICATE) in station
+ *    mode
+ * @NL80211_FEATURE_LOW_PRIORITY_SCAN: This driver supports low priority scan
+ * @NL80211_FEATURE_SCAN_FLUSH: Scan flush is supported
+ * @NL80211_FEATURE_AP_SCAN: Support scanning using an AP vif
+ * @NL80211_FEATURE_VIF_TXPOWER: The driver supports per-vif TX power setting
+ * @NL80211_FEATURE_NEED_OBSS_SCAN: The driver expects userspace to perform
+ *    OBSS scans and generate 20/40 BSS coex reports. This flag is used only
+ *    for drivers implementing the CONNECT API, for AUTH/ASSOC it is implied.
+ * @NL80211_FEATURE_P2P_GO_CTWIN: P2P GO implementation supports CT Window
+ *    setting
+ * @NL80211_FEATURE_P2P_GO_OPPPS: P2P GO implementation supports opportunistic
+ *    powersave
+ * @NL80211_FEATURE_FULL_AP_CLIENT_STATE: The driver supports full state
+ *    transitions for AP clients. Without this flag (and if the driver
+ *    doesn't have the AP SME in the device) the driver supports adding
+ *    stations only when they're associated and adds them in associated
+ *    state (to later be transitioned into authorized), with this flag
+ *    they should be added before even sending the authentication reply
+ *    and then transitioned into authenticated, associated and authorized
+ *    states using station flags.
+ *    Note that even for drivers that support this, the default is to add
+ *    stations in authenticated/associated state, so to add unauthenticated
+ *    stations the authenticated/associated bits have to be set in the mask.
+ * @NL80211_FEATURE_ADVERTISE_CHAN_LIMITS: cfg80211 advertises channel limits
+ *    (HT40, VHT 80/160 MHz) if this flag is set
+ * @NL80211_FEATURE_USERSPACE_MPM: This driver supports a userspace Mesh
+ *    Peering Management entity which may be implemented by registering for
+ *    beacons or NL80211_CMD_NEW_PEER_CANDIDATE events. The mesh beacon is
+ *    still generated by the driver.
+ * @NL80211_FEATURE_ACTIVE_MONITOR: This driver supports an active monitor
+ *    interface. An active monitor interface behaves like a normal monitor
+ *    interface, but gets added to the driver. It ensures that incoming
+ *    unicast packets directed at the configured interface address get ACKed.
+ * @NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE: This driver supports dynamic
+ *    channel bandwidth change (e.g., HT 20 <-> 40 MHz channel) during the
+ *    lifetime of a BSS.
+ * @NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES: This device adds a DS Parameter
+ *    Set IE to probe requests.
+ * @NL80211_FEATURE_WFA_TPC_IE_IN_PROBES: This device adds a WFA TPC Report IE
+ *    to probe requests.
+ * @NL80211_FEATURE_QUIET: This device, in client mode, supports Quiet Period
+ *    requests sent to it by an AP.
+ * @NL80211_FEATURE_TX_POWER_INSERTION: This device is capable of inserting the
+ *    current tx power value into the TPC Report IE in the spectrum
+ *    management TPC Report action frame, and in the Radio Measurement Link
+ *    Measurement Report action frame.
+ * @NL80211_FEATURE_ACKTO_ESTIMATION: This driver supports dynamic ACK timeout
+ *    estimation (dynack). %NL80211_ATTR_WIPHY_DYN_ACK flag attribute is used
+ *    to enable dynack.
+ * @NL80211_FEATURE_STATIC_SMPS: Device supports static spatial
+ *    multiplexing powersave, ie. can turn off all but one chain
+ *    even on HT connections that should be using more chains.
+ * @NL80211_FEATURE_DYNAMIC_SMPS: Device supports dynamic spatial
+ *    multiplexing powersave, ie. can turn off all but one chain
+ *    and then wake the rest up as required after, for example,
+ *    rts/cts handshake.
+ * @NL80211_FEATURE_SUPPORTS_WMM_ADMISSION: the device supports setting up WMM
+ *    TSPEC sessions (TID aka TSID 0-7) with the %NL80211_CMD_ADD_TX_TS
+ *    command. Standard IEEE 802.11 TSPEC setup is not yet supported, it
+ *    needs to be able to handle Block-Ack agreements and other things.
+ * @NL80211_FEATURE_MAC_ON_CREATE: Device supports configuring
+ *    the vif's MAC address upon creation.
+ *    See 'macaddr' field in the vif_params (cfg80211.h).
+ * @NL80211_FEATURE_TDLS_CHANNEL_SWITCH: Driver supports channel switching when
+ *    operating as a TDLS peer.
+ * @NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR: This device/driver supports using a
+ *    random MAC address during scan (if the device is unassociated); the
+ *    %NL80211_SCAN_FLAG_RANDOM_ADDR flag may be set for scans and the MAC
+ *    address mask/value will be used.
+ * @NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR: This device/driver supports
+ *    using a random MAC address for every scan iteration during scheduled
+ *    scan (while not associated), the %NL80211_SCAN_FLAG_RANDOM_ADDR may
+ *    be set for scheduled scan and the MAC address mask/value will be used.
+ * @NL80211_FEATURE_ND_RANDOM_MAC_ADDR: This device/driver supports using a
+ *    random MAC address for every scan iteration during "net detect", i.e.
+ *    scan in unassociated WoWLAN, the %NL80211_SCAN_FLAG_RANDOM_ADDR may
+ *    be set for scheduled scan and the MAC address mask/value will be used.
+ */
+enum nl80211_feature_flags {
+    NL80211_FEATURE_SK_TX_STATUS            = 1 << 0,
+    NL80211_FEATURE_HT_IBSS                = 1 << 1,
+    NL80211_FEATURE_INACTIVITY_TIMER        = 1 << 2,
+    NL80211_FEATURE_CELL_BASE_REG_HINTS        = 1 << 3,
+    NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL    = 1 << 4,
+    NL80211_FEATURE_SAE                = 1 << 5,
+    NL80211_FEATURE_LOW_PRIORITY_SCAN        = 1 << 6,
+    NL80211_FEATURE_SCAN_FLUSH            = 1 << 7,
+    NL80211_FEATURE_AP_SCAN                = 1 << 8,
+    NL80211_FEATURE_VIF_TXPOWER            = 1 << 9,
+    NL80211_FEATURE_NEED_OBSS_SCAN            = 1 << 10,
+    NL80211_FEATURE_P2P_GO_CTWIN            = 1 << 11,
+    NL80211_FEATURE_P2P_GO_OPPPS            = 1 << 12,
+    /* bit 13 is reserved */
+    NL80211_FEATURE_ADVERTISE_CHAN_LIMITS        = 1 << 14,
+    NL80211_FEATURE_FULL_AP_CLIENT_STATE        = 1 << 15,
+    NL80211_FEATURE_USERSPACE_MPM            = 1 << 16,
+    NL80211_FEATURE_ACTIVE_MONITOR            = 1 << 17,
+    NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE    = 1 << 18,
+    NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES    = 1 << 19,
+    NL80211_FEATURE_WFA_TPC_IE_IN_PROBES        = 1 << 20,
+    NL80211_FEATURE_QUIET                = 1 << 21,
+    NL80211_FEATURE_TX_POWER_INSERTION        = 1 << 22,
+    NL80211_FEATURE_ACKTO_ESTIMATION        = 1 << 23,
+    NL80211_FEATURE_STATIC_SMPS            = 1 << 24,
+    NL80211_FEATURE_DYNAMIC_SMPS            = 1 << 25,
+    NL80211_FEATURE_SUPPORTS_WMM_ADMISSION        = 1 << 26,
+    NL80211_FEATURE_MAC_ON_CREATE            = 1 << 27,
+    NL80211_FEATURE_TDLS_CHANNEL_SWITCH        = 1 << 28,
+    NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR        = 1 << 29,
+    NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR    = 1 << 30,
+    NL80211_FEATURE_ND_RANDOM_MAC_ADDR        = 1U << 31,
+};
+
+/**
+ * enum nl80211_ext_feature_index - bit index of extended features.
+ * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates.
+ * @NL80211_EXT_FEATURE_RRM: This driver supports RRM. When featured, user can
+ *    can request to use RRM (see %NL80211_ATTR_USE_RRM) with
+ *    %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests, which will set
+ *    the ASSOC_REQ_USE_RRM flag in the association request even if
+ *    NL80211_FEATURE_QUIET is not advertized.
+ * @NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER: This device supports MU-MIMO air
+ *    sniffer which means that it can be configured to hear packets from
+ *    certain groups which can be configured by the
+ *    %NL80211_ATTR_MU_MIMO_GROUP_DATA attribute,
+ *    or can be configured to follow a station by configuring the
+ *    %NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR attribute.
+ * @NL80211_EXT_FEATURE_SCAN_START_TIME: This driver includes the actual
+ *    time the scan started in scan results event. The time is the TSF of
+ *    the BSS that the interface that requested the scan is connected to
+ *    (if available).
+ * @NL80211_EXT_FEATURE_BSS_PARENT_TSF: Per BSS, this driver reports the
+ *    time the last beacon/probe was received. The time is the TSF of the
+ *    BSS that the interface that requested the scan is connected to
+ *    (if available).
+ * @NL80211_EXT_FEATURE_SET_SCAN_DWELL: This driver supports configuration of
+ *    channel dwell time.
+ * @NL80211_EXT_FEATURE_BEACON_RATE_LEGACY: Driver supports beacon rate
+ *    configuration (AP/mesh), supporting a legacy (non HT/VHT) rate.
+ * @NL80211_EXT_FEATURE_BEACON_RATE_HT: Driver supports beacon rate
+ *    configuration (AP/mesh) with HT rates.
+ * @NL80211_EXT_FEATURE_BEACON_RATE_VHT: Driver supports beacon rate
+ *    configuration (AP/mesh) with VHT rates.
+ * @NL80211_EXT_FEATURE_FILS_STA: This driver supports Fast Initial Link Setup
+ *    with user space SME (NL80211_CMD_AUTHENTICATE) in station mode.
+ * @NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA: This driver supports randomized TA
+ *    in @NL80211_CMD_FRAME while not associated.
+ * @NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED: This driver supports
+ *    randomized TA in @NL80211_CMD_FRAME while associated.
+ * @NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI: The driver supports sched_scan
+ *    for reporting BSSs with better RSSI than the current connected BSS
+ *    (%NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI).
+ * @NL80211_EXT_FEATURE_CQM_RSSI_LIST: With this driver the
+ *    %NL80211_ATTR_CQM_RSSI_THOLD attribute accepts a list of zero or more
+ *    RSSI threshold values to monitor rather than exactly one threshold.
+ * @NL80211_EXT_FEATURE_FILS_SK_OFFLOAD: Driver SME supports FILS shared key
+ *    authentication with %NL80211_CMD_CONNECT.
+ * @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK: Device wants to do 4-way
+ *    handshake with PSK in station mode (PSK is passed as part of the connect
+ *    and associate commands), doing it in the host might not be supported.
+ * @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X: Device wants to do doing 4-way
+ *    handshake with 802.1X in station mode (will pass EAP frames to the host
+ *    and accept the set_pmk/del_pmk commands), doing it in the host might not
+ *    be supported.
+ * @NL80211_EXT_FEATURE_FILS_MAX_CHANNEL_TIME: Driver is capable of overriding
+ *    the max channel attribute in the FILS request params IE with the
+ *    actual dwell time.
+ * @NL80211_EXT_FEATURE_ACCEPT_BCAST_PROBE_RESP: Driver accepts broadcast probe
+ *    response
+ * @NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE: Driver supports sending
+ *    the first probe request in each channel at rate of at least 5.5Mbps.
+ * @NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION: Driver supports
+ *    probe request tx deferral and suppression
+ * @NL80211_EXT_FEATURE_MFP_OPTIONAL: Driver supports the %NL80211_MFP_OPTIONAL
+ *    value in %NL80211_ATTR_USE_MFP.
+ * @NL80211_EXT_FEATURE_LOW_SPAN_SCAN: Driver supports low span scan.
+ * @NL80211_EXT_FEATURE_LOW_POWER_SCAN: Driver supports low power scan.
+ * @NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN: Driver supports high accuracy scan.
+ * @NL80211_EXT_FEATURE_DFS_OFFLOAD: HW/driver will offload DFS actions.
+ *    Device or driver will do all DFS-related actions by itself,
+ *    informing user-space about CAC progress, radar detection event,
+ *    channel change triggered by radar detection event.
+ *    No need to start CAC from user-space, no need to react to
+ *    "radar detected" event.
+ * @NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211: Driver supports sending and
+ *    receiving control port frames over nl80211 instead of the netdevice.
+ * @NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT: This driver/device supports
+ *    (average) ACK signal strength reporting.
+ * @NL80211_EXT_FEATURE_TXQS: Driver supports FQ-CoDel-enabled intermediate
+ *      TXQs.
+ * @NL80211_EXT_FEATURE_SCAN_RANDOM_SN: Driver/device supports randomizing the
+ *    SN in probe request frames if requested by %NL80211_SCAN_FLAG_RANDOM_SN.
+ * @NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT: Driver/device can omit all data
+ *    except for supported rates from the probe request content if requested
+ *    by the %NL80211_SCAN_FLAG_MIN_PREQ_CONTENT flag.
+ * @NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER: Driver supports enabling fine
+ *    timing measurement responder role.
+ *
+ * @NL80211_EXT_FEATURE_CAN_REPLACE_PTK0: Driver/device confirm that they are
+ *    able to rekey an in-use key correctly. Userspace must not rekey PTK keys
+ *    if this flag is not set. Ignoring this can leak clear text packets and/or
+ *    freeze the connection.
+ * @NL80211_EXT_FEATURE_EXT_KEY_ID: Driver supports "Extended Key ID for
+ *      Individually Addressed Frames" from IEEE802.11-2016.
+ *
+ * @NL80211_EXT_FEATURE_AIRTIME_FAIRNESS: Driver supports getting airtime
+ *    fairness for transmitted packets and has enabled airtime fairness
+ *    scheduling.
+ *
+ * @NL80211_EXT_FEATURE_AP_PMKSA_CACHING: Driver/device supports PMKSA caching
+ *    (set/del PMKSA operations) in AP mode.
+ *
+ * @NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD: Driver supports
+ *    filtering of sched scan results using band specific RSSI thresholds.
+ *
+ * @NL80211_EXT_FEATURE_STA_TX_PWR: This driver supports controlling tx power
+ *    to a station.
+ *
+ * @NL80211_EXT_FEATURE_SAE_OFFLOAD: Device wants to do SAE authentication in
+ *    station mode (SAE password is passed as part of the connect command).
+ *
+ * @NUM_NL80211_EXT_FEATURES: number of extended features.
+ * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
+ */
+enum nl80211_ext_feature_index {
+    NL80211_EXT_FEATURE_VHT_IBSS,
+    NL80211_EXT_FEATURE_RRM,
+    NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER,
+    NL80211_EXT_FEATURE_SCAN_START_TIME,
+    NL80211_EXT_FEATURE_BSS_PARENT_TSF,
+    NL80211_EXT_FEATURE_SET_SCAN_DWELL,
+    NL80211_EXT_FEATURE_BEACON_RATE_LEGACY,
+    NL80211_EXT_FEATURE_BEACON_RATE_HT,
+    NL80211_EXT_FEATURE_BEACON_RATE_VHT,
+    NL80211_EXT_FEATURE_FILS_STA,
+    NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA,
+    NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED,
+    NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI,
+    NL80211_EXT_FEATURE_CQM_RSSI_LIST,
+    NL80211_EXT_FEATURE_FILS_SK_OFFLOAD,
+    NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK,
+    NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X,
+    NL80211_EXT_FEATURE_FILS_MAX_CHANNEL_TIME,
+    NL80211_EXT_FEATURE_ACCEPT_BCAST_PROBE_RESP,
+    NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE,
+    NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION,
+    NL80211_EXT_FEATURE_MFP_OPTIONAL,
+    NL80211_EXT_FEATURE_LOW_SPAN_SCAN,
+    NL80211_EXT_FEATURE_LOW_POWER_SCAN,
+    NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN,
+    NL80211_EXT_FEATURE_DFS_OFFLOAD,
+    NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211,
+    NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT,
+    /* we renamed this - stay compatible */
+    NL80211_EXT_FEATURE_DATA_ACK_SIGNAL_SUPPORT = NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT,
+    NL80211_EXT_FEATURE_TXQS,
+    NL80211_EXT_FEATURE_SCAN_RANDOM_SN,
+    NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT,
+    NL80211_EXT_FEATURE_CAN_REPLACE_PTK0,
+    NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER,
+    NL80211_EXT_FEATURE_AIRTIME_FAIRNESS,
+    NL80211_EXT_FEATURE_AP_PMKSA_CACHING,
+    NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD,
+    NL80211_EXT_FEATURE_EXT_KEY_ID,
+    NL80211_EXT_FEATURE_STA_TX_PWR,
+    NL80211_EXT_FEATURE_SAE_OFFLOAD,
+
+    /* add new features before the definition below */
+    NUM_NL80211_EXT_FEATURES,
+    MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1
+};
+
+/**
+ * enum nl80211_probe_resp_offload_support_attr - optional supported
+ *    protocols for probe-response offloading by the driver/FW.
+ *    To be used with the %NL80211_ATTR_PROBE_RESP_OFFLOAD attribute.
+ *    Each enum value represents a bit in the bitmap of supported
+ *    protocols. Typically a subset of probe-requests belonging to a
+ *    supported protocol will be excluded from offload and uploaded
+ *    to the host.
+ *
+ * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS: Support for WPS ver. 1
+ * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2: Support for WPS ver. 2
+ * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P: Support for P2P
+ * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U: Support for 802.11u
+ */
+enum nl80211_probe_resp_offload_support_attr {
+    NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS =    1<<0,
+    NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 =   1<<1,
+    NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P =    1<<2,
+    NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U = 1<<3,
+};
+
+/**
+ * enum nl80211_connect_failed_reason - connection request failed reasons
+ * @NL80211_CONN_FAIL_MAX_CLIENTS: Maximum number of clients that can be
+ *    handled by the AP is reached.
+ * @NL80211_CONN_FAIL_BLOCKED_CLIENT: Connection request is rejected due to ACL.
+ */
+enum nl80211_connect_failed_reason {
+    NL80211_CONN_FAIL_MAX_CLIENTS,
+    NL80211_CONN_FAIL_BLOCKED_CLIENT,
+};
+
+/**
+ * enum nl80211_timeout_reason - timeout reasons
+ *
+ * @NL80211_TIMEOUT_UNSPECIFIED: Timeout reason unspecified.
+ * @NL80211_TIMEOUT_SCAN: Scan (AP discovery) timed out.
+ * @NL80211_TIMEOUT_AUTH: Authentication timed out.
+ * @NL80211_TIMEOUT_ASSOC: Association timed out.
+ */
+enum nl80211_timeout_reason {
+    NL80211_TIMEOUT_UNSPECIFIED,
+    NL80211_TIMEOUT_SCAN,
+    NL80211_TIMEOUT_AUTH,
+    NL80211_TIMEOUT_ASSOC,
+};
+
+/**
+ * enum nl80211_scan_flags -  scan request control flags
+ *
+ * Scan request control flags are used to control the handling
+ * of NL80211_CMD_TRIGGER_SCAN and NL80211_CMD_START_SCHED_SCAN
+ * requests.
+ *
+ * NL80211_SCAN_FLAG_LOW_SPAN, NL80211_SCAN_FLAG_LOW_POWER, and
+ * NL80211_SCAN_FLAG_HIGH_ACCURACY flags are exclusive of each other, i.e., only
+ * one of them can be used in the request.
+ *
+ * @NL80211_SCAN_FLAG_LOW_PRIORITY: scan request has low priority
+ * @NL80211_SCAN_FLAG_FLUSH: flush cache before scanning
+ * @NL80211_SCAN_FLAG_AP: force a scan even if the interface is configured
+ *    as AP and the beaconing has already been configured. This attribute is
+ *    dangerous because will destroy stations performance as a lot of frames
+ *    will be lost while scanning off-channel, therefore it must be used only
+ *    when really needed
+ * @NL80211_SCAN_FLAG_RANDOM_ADDR: use a random MAC address for this scan (or
+ *    for scheduled scan: a different one for every scan iteration). When the
+ *    flag is set, depending on device capabilities the @NL80211_ATTR_MAC and
+ *    @NL80211_ATTR_MAC_MASK attributes may also be given in which case only
+ *    the masked bits will be preserved from the MAC address and the remainder
+ *    randomised. If the attributes are not given full randomisation (46 bits,
+ *    locally administered 1, multicast 0) is assumed.
+ *    This flag must not be requested when the feature isn't supported, check
+ *    the nl80211 feature flags for the device.
+ * @NL80211_SCAN_FLAG_FILS_MAX_CHANNEL_TIME: fill the dwell time in the FILS
+ *    request parameters IE in the probe request
+ * @NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP: accept broadcast probe responses
+ * @NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE: send probe request frames at
+ *    rate of at least 5.5M. In case non OCE AP is discovered in the channel,
+ *    only the first probe req in the channel will be sent in high rate.
+ * @NL80211_SCAN_FLAG_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION: allow probe request
+ *    tx deferral (dot11FILSProbeDelay shall be set to 15ms)
+ *    and suppression (if it has received a broadcast Probe Response frame,
+ *    Beacon frame or FILS Discovery frame from an AP that the STA considers
+ *    a suitable candidate for (re-)association - suitable in terms of
+ *    SSID and/or RSSI.
+ * @NL80211_SCAN_FLAG_LOW_SPAN: Span corresponds to the total time taken to
+ *    accomplish the scan. Thus, this flag intends the driver to perform the
+ *    scan request with lesser span/duration. It is specific to the driver
+ *    implementations on how this is accomplished. Scan accuracy may get
+ *    impacted with this flag.
+ * @NL80211_SCAN_FLAG_LOW_POWER: This flag intends the scan attempts to consume
+ *    optimal possible power. Drivers can resort to their specific means to
+ *    optimize the power. Scan accuracy may get impacted with this flag.
+ * @NL80211_SCAN_FLAG_HIGH_ACCURACY: Accuracy here intends to the extent of scan
+ *    results obtained. Thus HIGH_ACCURACY scan flag aims to get maximum
+ *    possible scan results. This flag hints the driver to use the best
+ *    possible scan configuration to improve the accuracy in scanning.
+ *    Latency and power use may get impacted with this flag.
+ * @NL80211_SCAN_FLAG_RANDOM_SN: randomize the sequence number in probe
+ *    request frames from this scan to avoid correlation/tracking being
+ *    possible.
+ * @NL80211_SCAN_FLAG_MIN_PREQ_CONTENT: minimize probe request content to
+ *    only have supported rates and no additional capabilities (unless
+ *    added by userspace explicitly.)
+ */
+enum nl80211_scan_flags {
+    NL80211_SCAN_FLAG_LOW_PRIORITY                = 1<<0,
+    NL80211_SCAN_FLAG_FLUSH                    = 1<<1,
+    NL80211_SCAN_FLAG_AP                    = 1<<2,
+    NL80211_SCAN_FLAG_RANDOM_ADDR                = 1<<3,
+    NL80211_SCAN_FLAG_FILS_MAX_CHANNEL_TIME            = 1<<4,
+    NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP        = 1<<5,
+    NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE        = 1<<6,
+    NL80211_SCAN_FLAG_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION    = 1<<7,
+    NL80211_SCAN_FLAG_LOW_SPAN                = 1<<8,
+    NL80211_SCAN_FLAG_LOW_POWER                = 1<<9,
+    NL80211_SCAN_FLAG_HIGH_ACCURACY                = 1<<10,
+    NL80211_SCAN_FLAG_RANDOM_SN                = 1<<11,
+    NL80211_SCAN_FLAG_MIN_PREQ_CONTENT            = 1<<12,
+};
+
+/**
+ * enum nl80211_acl_policy - access control policy
+ *
+ * Access control policy is applied on a MAC list set by
+ * %NL80211_CMD_START_AP and %NL80211_CMD_SET_MAC_ACL, to
+ * be used with %NL80211_ATTR_ACL_POLICY.
+ *
+ * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are
+ *    listed in ACL, i.e. allow all the stations which are not listed
+ *    in ACL to authenticate.
+ * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow the stations which are listed
+ *    in ACL, i.e. deny all the stations which are not listed in ACL.
+ */
+enum nl80211_acl_policy {
+    NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED,
+    NL80211_ACL_POLICY_DENY_UNLESS_LISTED,
+};
+
+/**
+ * enum nl80211_smps_mode - SMPS mode
+ *
+ * Requested SMPS mode (for AP mode)
+ *
+ * @NL80211_SMPS_OFF: SMPS off (use all antennas).
+ * @NL80211_SMPS_STATIC: static SMPS (use a single antenna)
+ * @NL80211_SMPS_DYNAMIC: dynamic smps (start with a single antenna and
+ *    turn on other antennas after CTS/RTS).
+ */
+enum nl80211_smps_mode {
+    NL80211_SMPS_OFF,
+    NL80211_SMPS_STATIC,
+    NL80211_SMPS_DYNAMIC,
+
+    __NL80211_SMPS_AFTER_LAST,
+    NL80211_SMPS_MAX = __NL80211_SMPS_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_radar_event - type of radar event for DFS operation
+ *
+ * Type of event to be used with NL80211_ATTR_RADAR_EVENT to inform userspace
+ * about detected radars or success of the channel available check (CAC)
+ *
+ * @NL80211_RADAR_DETECTED: A radar pattern has been detected. The channel is
+ *    now unusable.
+ * @NL80211_RADAR_CAC_FINISHED: Channel Availability Check has been finished,
+ *    the channel is now available.
+ * @NL80211_RADAR_CAC_ABORTED: Channel Availability Check has been aborted, no
+ *    change to the channel status.
+ * @NL80211_RADAR_NOP_FINISHED: The Non-Occupancy Period for this channel is
+ *    over, channel becomes usable.
+ * @NL80211_RADAR_PRE_CAC_EXPIRED: Channel Availability Check done on this
+ *    non-operating channel is expired and no longer valid. New CAC must
+ *    be done on this channel before starting the operation. This is not
+ *    applicable for ETSI dfs domain where pre-CAC is valid for ever.
+ * @NL80211_RADAR_CAC_STARTED: Channel Availability Check has been started,
+ *    should be generated by HW if NL80211_EXT_FEATURE_DFS_OFFLOAD is enabled.
+ */
+enum nl80211_radar_event {
+    NL80211_RADAR_DETECTED,
+    NL80211_RADAR_CAC_FINISHED,
+    NL80211_RADAR_CAC_ABORTED,
+    NL80211_RADAR_NOP_FINISHED,
+    NL80211_RADAR_PRE_CAC_EXPIRED,
+    NL80211_RADAR_CAC_STARTED,
+};
+
+/**
+ * enum nl80211_dfs_state - DFS states for channels
+ *
+ * Channel states used by the DFS code.
+ *
+ * @NL80211_DFS_USABLE: The channel can be used, but channel availability
+ *    check (CAC) must be performed before using it for AP or IBSS.
+ * @NL80211_DFS_UNAVAILABLE: A radar has been detected on this channel, it
+ *    is therefore marked as not available.
+ * @NL80211_DFS_AVAILABLE: The channel has been CAC checked and is available.
+ */
+enum nl80211_dfs_state {
+    NL80211_DFS_USABLE,
+    NL80211_DFS_UNAVAILABLE,
+    NL80211_DFS_AVAILABLE,
+};
+
+/**
+ * enum enum nl80211_protocol_features - nl80211 protocol features
+ * @NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP: nl80211 supports splitting
+ *    wiphy dumps (if requested by the application with the attribute
+ *    %NL80211_ATTR_SPLIT_WIPHY_DUMP. Also supported is filtering the
+ *    wiphy dump by %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFINDEX or
+ *    %NL80211_ATTR_WDEV.
+ */
+enum nl80211_protocol_features {
+    NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP =    1 << 0,
+};
+
+/**
+ * enum nl80211_crit_proto_id - nl80211 critical protocol identifiers
+ *
+ * @NL80211_CRIT_PROTO_UNSPEC: protocol unspecified.
+ * @NL80211_CRIT_PROTO_DHCP: BOOTP or DHCPv6 protocol.
+ * @NL80211_CRIT_PROTO_EAPOL: EAPOL protocol.
+ * @NL80211_CRIT_PROTO_APIPA: APIPA protocol.
+ * @NUM_NL80211_CRIT_PROTO: must be kept last.
+ */
+enum nl80211_crit_proto_id {
+    NL80211_CRIT_PROTO_UNSPEC,
+    NL80211_CRIT_PROTO_DHCP,
+    NL80211_CRIT_PROTO_EAPOL,
+    NL80211_CRIT_PROTO_APIPA,
+    /* add other protocols before this one */
+    NUM_NL80211_CRIT_PROTO
+};
+
+/* maximum duration for critical protocol measures */
+#define NL80211_CRIT_PROTO_MAX_DURATION        5000 /* msec */
+
+/**
+ * enum nl80211_rxmgmt_flags - flags for received management frame.
+ *
+ * Used by cfg80211_rx_mgmt()
+ *
+ * @NL80211_RXMGMT_FLAG_ANSWERED: frame was answered by device/driver.
+ * @NL80211_RXMGMT_FLAG_EXTERNAL_AUTH: Host driver intends to offload
+ *    the authentication. Exclusively defined for host drivers that
+ *    advertises the SME functionality but would like the userspace
+ *    to handle certain authentication algorithms (e.g. SAE).
+ */
+enum nl80211_rxmgmt_flags {
+    NL80211_RXMGMT_FLAG_ANSWERED = 1 << 0,
+    NL80211_RXMGMT_FLAG_EXTERNAL_AUTH = 1 << 1,
+};
+
+/*
+ * If this flag is unset, the lower 24 bits are an OUI, if set
+ * a Linux nl80211 vendor ID is used (no such IDs are allocated
+ * yet, so that's not valid so far)
+ */
+#define NL80211_VENDOR_ID_IS_LINUX    0x80000000
+
+/**
+ * struct nl80211_vendor_cmd_info - vendor command data
+ * @vendor_id: If the %NL80211_VENDOR_ID_IS_LINUX flag is clear, then the
+ *    value is a 24-bit OUI; if it is set then a separately allocated ID
+ *    may be used, but no such IDs are allocated yet. New IDs should be
+ *    added to this file when needed.
+ * @subcmd: sub-command ID for the command
+ */
+struct nl80211_vendor_cmd_info {
+    __u32 vendor_id;
+    __u32 subcmd;
+};
+
+/**
+ * enum nl80211_tdls_peer_capability - TDLS peer flags.
+ *
+ * Used by tdls_mgmt() to determine which conditional elements need
+ * to be added to TDLS Setup frames.
+ *
+ * @NL80211_TDLS_PEER_HT: TDLS peer is HT capable.
+ * @NL80211_TDLS_PEER_VHT: TDLS peer is VHT capable.
+ * @NL80211_TDLS_PEER_WMM: TDLS peer is WMM capable.
+ */
+enum nl80211_tdls_peer_capability {
+    NL80211_TDLS_PEER_HT = 1<<0,
+    NL80211_TDLS_PEER_VHT = 1<<1,
+    NL80211_TDLS_PEER_WMM = 1<<2,
+};
+
+/**
+ * enum nl80211_sched_scan_plan - scanning plan for scheduled scan
+ * @__NL80211_SCHED_SCAN_PLAN_INVALID: attribute number 0 is reserved
+ * @NL80211_SCHED_SCAN_PLAN_INTERVAL: interval between scan iterations. In
+ *    seconds (u32).
+ * @NL80211_SCHED_SCAN_PLAN_ITERATIONS: number of scan iterations in this
+ *    scan plan (u32). The last scan plan must not specify this attribute
+ *    because it will run infinitely. A value of zero is invalid as it will
+ *    make the scan plan meaningless.
+ * @NL80211_SCHED_SCAN_PLAN_MAX: highest scheduled scan plan attribute number
+ *    currently defined
+ * @__NL80211_SCHED_SCAN_PLAN_AFTER_LAST: internal use
+ */
+enum nl80211_sched_scan_plan {
+    __NL80211_SCHED_SCAN_PLAN_INVALID,
+    NL80211_SCHED_SCAN_PLAN_INTERVAL,
+    NL80211_SCHED_SCAN_PLAN_ITERATIONS,
+
+    /* keep last */
+    __NL80211_SCHED_SCAN_PLAN_AFTER_LAST,
+    NL80211_SCHED_SCAN_PLAN_MAX =
+        __NL80211_SCHED_SCAN_PLAN_AFTER_LAST - 1
+};
+
+/**
+ * struct nl80211_bss_select_rssi_adjust - RSSI adjustment parameters.
+ *
+ * @band: band of BSS that must match for RSSI value adjustment. The value
+ *    of this field is according to &enum nl80211_band.
+ * @delta: value used to adjust the RSSI value of matching BSS in dB.
+ */
+struct nl80211_bss_select_rssi_adjust {
+    __u8 band;
+    __s8 delta;
+} __attribute__((packed));
+
+/**
+ * enum nl80211_bss_select_attr - attributes for bss selection.
+ *
+ * @__NL80211_BSS_SELECT_ATTR_INVALID: reserved.
+ * @NL80211_BSS_SELECT_ATTR_RSSI: Flag indicating only RSSI-based BSS selection
+ *    is requested.
+ * @NL80211_BSS_SELECT_ATTR_BAND_PREF: attribute indicating BSS
+ *    selection should be done such that the specified band is preferred.
+ *    When there are multiple BSS-es in the preferred band, the driver
+ *    shall use RSSI-based BSS selection as a second step. The value of
+ *    this attribute is according to &enum nl80211_band (u32).
+ * @NL80211_BSS_SELECT_ATTR_RSSI_ADJUST: When present the RSSI level for
+ *    BSS-es in the specified band is to be adjusted before doing
+ *    RSSI-based BSS selection. The attribute value is a packed structure
+ *    value as specified by &struct nl80211_bss_select_rssi_adjust.
+ * @NL80211_BSS_SELECT_ATTR_MAX: highest bss select attribute number.
+ * @__NL80211_BSS_SELECT_ATTR_AFTER_LAST: internal use.
+ *
+ * One and only one of these attributes are found within %NL80211_ATTR_BSS_SELECT
+ * for %NL80211_CMD_CONNECT. It specifies the required BSS selection behaviour
+ * which the driver shall use.
+ */
+enum nl80211_bss_select_attr {
+    __NL80211_BSS_SELECT_ATTR_INVALID,
+    NL80211_BSS_SELECT_ATTR_RSSI,
+    NL80211_BSS_SELECT_ATTR_BAND_PREF,
+    NL80211_BSS_SELECT_ATTR_RSSI_ADJUST,
+
+    /* keep last */
+    __NL80211_BSS_SELECT_ATTR_AFTER_LAST,
+    NL80211_BSS_SELECT_ATTR_MAX = __NL80211_BSS_SELECT_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_nan_function_type - NAN function type
+ *
+ * Defines the function type of a NAN function
+ *
+ * @NL80211_NAN_FUNC_PUBLISH: function is publish
+ * @NL80211_NAN_FUNC_SUBSCRIBE: function is subscribe
+ * @NL80211_NAN_FUNC_FOLLOW_UP: function is follow-up
+ */
+enum nl80211_nan_function_type {
+    NL80211_NAN_FUNC_PUBLISH,
+    NL80211_NAN_FUNC_SUBSCRIBE,
+    NL80211_NAN_FUNC_FOLLOW_UP,
+
+    /* keep last */
+    __NL80211_NAN_FUNC_TYPE_AFTER_LAST,
+    NL80211_NAN_FUNC_MAX_TYPE = __NL80211_NAN_FUNC_TYPE_AFTER_LAST - 1,
+};
+
+/**
+ * enum nl80211_nan_publish_type - NAN publish tx type
+ *
+ * Defines how to send publish Service Discovery Frames
+ *
+ * @NL80211_NAN_SOLICITED_PUBLISH: publish function is solicited
+ * @NL80211_NAN_UNSOLICITED_PUBLISH: publish function is unsolicited
+ */
+enum nl80211_nan_publish_type {
+    NL80211_NAN_SOLICITED_PUBLISH = 1 << 0,
+    NL80211_NAN_UNSOLICITED_PUBLISH = 1 << 1,
+};
+
+/**
+ * enum nl80211_nan_func_term_reason - NAN functions termination reason
+ *
+ * Defines termination reasons of a NAN function
+ *
+ * @NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST: requested by user
+ * @NL80211_NAN_FUNC_TERM_REASON_TTL_EXPIRED: timeout
+ * @NL80211_NAN_FUNC_TERM_REASON_ERROR: errored
+ */
+enum nl80211_nan_func_term_reason {
+    NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST,
+    NL80211_NAN_FUNC_TERM_REASON_TTL_EXPIRED,
+    NL80211_NAN_FUNC_TERM_REASON_ERROR,
+};
+
+#define NL80211_NAN_FUNC_SERVICE_ID_LEN 6
+#define NL80211_NAN_FUNC_SERVICE_SPEC_INFO_MAX_LEN 0xff
+#define NL80211_NAN_FUNC_SRF_MAX_LEN 0xff
+
+/**
+ * enum nl80211_nan_func_attributes - NAN function attributes
+ * @__NL80211_NAN_FUNC_INVALID: invalid
+ * @NL80211_NAN_FUNC_TYPE: &enum nl80211_nan_function_type (u8).
+ * @NL80211_NAN_FUNC_SERVICE_ID: 6 bytes of the service ID hash as
+ *    specified in NAN spec. This is a binary attribute.
+ * @NL80211_NAN_FUNC_PUBLISH_TYPE: relevant if the function's type is
+ *    publish. Defines the transmission type for the publish Service Discovery
+ *    Frame, see &enum nl80211_nan_publish_type. Its type is u8.
+ * @NL80211_NAN_FUNC_PUBLISH_BCAST: relevant if the function is a solicited
+ *    publish. Should the solicited publish Service Discovery Frame be sent to
+ *    the NAN Broadcast address. This is a flag.
+ * @NL80211_NAN_FUNC_SUBSCRIBE_ACTIVE: relevant if the function's type is
+ *    subscribe. Is the subscribe active. This is a flag.
+ * @NL80211_NAN_FUNC_FOLLOW_UP_ID: relevant if the function's type is follow up.
+ *    The instance ID for the follow up Service Discovery Frame. This is u8.
+ * @NL80211_NAN_FUNC_FOLLOW_UP_REQ_ID: relevant if the function's type
+ *    is follow up. This is a u8.
+ *    The requestor instance ID for the follow up Service Discovery Frame.
+ * @NL80211_NAN_FUNC_FOLLOW_UP_DEST: the MAC address of the recipient of the
+ *    follow up Service Discovery Frame. This is a binary attribute.
+ * @NL80211_NAN_FUNC_CLOSE_RANGE: is this function limited for devices in a
+ *    close range. The range itself (RSSI) is defined by the device.
+ *    This is a flag.
+ * @NL80211_NAN_FUNC_TTL: strictly positive number of DWs this function should
+ *    stay active. If not present infinite TTL is assumed. This is a u32.
+ * @NL80211_NAN_FUNC_SERVICE_INFO: array of bytes describing the service
+ *    specific info. This is a binary attribute.
+ * @NL80211_NAN_FUNC_SRF: Service Receive Filter. This is a nested attribute.
+ *    See &enum nl80211_nan_srf_attributes.
+ * @NL80211_NAN_FUNC_RX_MATCH_FILTER: Receive Matching filter. This is a nested
+ *    attribute. It is a list of binary values.
+ * @NL80211_NAN_FUNC_TX_MATCH_FILTER: Transmit Matching filter. This is a
+ *    nested attribute. It is a list of binary values.
+ * @NL80211_NAN_FUNC_INSTANCE_ID: The instance ID of the function.
+ *    Its type is u8 and it cannot be 0.
+ * @NL80211_NAN_FUNC_TERM_REASON: NAN function termination reason.
+ *    See &enum nl80211_nan_func_term_reason.
+ *
+ * @NUM_NL80211_NAN_FUNC_ATTR: internal
+ * @NL80211_NAN_FUNC_ATTR_MAX: highest NAN function attribute
+ */
+enum nl80211_nan_func_attributes {
+    __NL80211_NAN_FUNC_INVALID,
+    NL80211_NAN_FUNC_TYPE,
+    NL80211_NAN_FUNC_SERVICE_ID,
+    NL80211_NAN_FUNC_PUBLISH_TYPE,
+    NL80211_NAN_FUNC_PUBLISH_BCAST,
+    NL80211_NAN_FUNC_SUBSCRIBE_ACTIVE,
+    NL80211_NAN_FUNC_FOLLOW_UP_ID,
+    NL80211_NAN_FUNC_FOLLOW_UP_REQ_ID,
+    NL80211_NAN_FUNC_FOLLOW_UP_DEST,
+    NL80211_NAN_FUNC_CLOSE_RANGE,
+    NL80211_NAN_FUNC_TTL,
+    NL80211_NAN_FUNC_SERVICE_INFO,
+    NL80211_NAN_FUNC_SRF,
+    NL80211_NAN_FUNC_RX_MATCH_FILTER,
+    NL80211_NAN_FUNC_TX_MATCH_FILTER,
+    NL80211_NAN_FUNC_INSTANCE_ID,
+    NL80211_NAN_FUNC_TERM_REASON,
+
+    /* keep last */
+    NUM_NL80211_NAN_FUNC_ATTR,
+    NL80211_NAN_FUNC_ATTR_MAX = NUM_NL80211_NAN_FUNC_ATTR - 1
+};
+
+/**
+ * enum nl80211_nan_srf_attributes - NAN Service Response filter attributes
+ * @__NL80211_NAN_SRF_INVALID: invalid
+ * @NL80211_NAN_SRF_INCLUDE: present if the include bit of the SRF set.
+ *    This is a flag.
+ * @NL80211_NAN_SRF_BF: Bloom Filter. Present if and only if
+ *    %NL80211_NAN_SRF_MAC_ADDRS isn't present. This attribute is binary.
+ * @NL80211_NAN_SRF_BF_IDX: index of the Bloom Filter. Mandatory if
+ *    %NL80211_NAN_SRF_BF is present. This is a u8.
+ * @NL80211_NAN_SRF_MAC_ADDRS: list of MAC addresses for the SRF. Present if
+ *    and only if %NL80211_NAN_SRF_BF isn't present. This is a nested
+ *    attribute. Each nested attribute is a MAC address.
+ * @NUM_NL80211_NAN_SRF_ATTR: internal
+ * @NL80211_NAN_SRF_ATTR_MAX: highest NAN SRF attribute
+ */
+enum nl80211_nan_srf_attributes {
+    __NL80211_NAN_SRF_INVALID,
+    NL80211_NAN_SRF_INCLUDE,
+    NL80211_NAN_SRF_BF,
+    NL80211_NAN_SRF_BF_IDX,
+    NL80211_NAN_SRF_MAC_ADDRS,
+
+    /* keep last */
+    NUM_NL80211_NAN_SRF_ATTR,
+    NL80211_NAN_SRF_ATTR_MAX = NUM_NL80211_NAN_SRF_ATTR - 1,
+};
+
+/**
+ * enum nl80211_nan_match_attributes - NAN match attributes
+ * @__NL80211_NAN_MATCH_INVALID: invalid
+ * @NL80211_NAN_MATCH_FUNC_LOCAL: the local function that had the
+ *    match. This is a nested attribute.
+ *    See &enum nl80211_nan_func_attributes.
+ * @NL80211_NAN_MATCH_FUNC_PEER: the peer function
+ *    that caused the match. This is a nested attribute.
+ *    See &enum nl80211_nan_func_attributes.
+ *
+ * @NUM_NL80211_NAN_MATCH_ATTR: internal
+ * @NL80211_NAN_MATCH_ATTR_MAX: highest NAN match attribute
+ */
+enum nl80211_nan_match_attributes {
+    __NL80211_NAN_MATCH_INVALID,
+    NL80211_NAN_MATCH_FUNC_LOCAL,
+    NL80211_NAN_MATCH_FUNC_PEER,
+
+    /* keep last */
+    NUM_NL80211_NAN_MATCH_ATTR,
+    NL80211_NAN_MATCH_ATTR_MAX = NUM_NL80211_NAN_MATCH_ATTR - 1
+};
+
+/**
+ * nl80211_external_auth_action - Action to perform with external
+ *    authentication request. Used by NL80211_ATTR_EXTERNAL_AUTH_ACTION.
+ * @NL80211_EXTERNAL_AUTH_START: Start the authentication.
+ * @NL80211_EXTERNAL_AUTH_ABORT: Abort the ongoing authentication.
+ */
+enum nl80211_external_auth_action {
+    NL80211_EXTERNAL_AUTH_START,
+    NL80211_EXTERNAL_AUTH_ABORT,
+};
+
+/**
+ * enum nl80211_ftm_responder_attributes - fine timing measurement
+ *    responder attributes
+ * @__NL80211_FTM_RESP_ATTR_INVALID: Invalid
+ * @NL80211_FTM_RESP_ATTR_ENABLED: FTM responder is enabled
+ * @NL80211_FTM_RESP_ATTR_LCI: The content of Measurement Report Element
+ *    (9.4.2.22 in 802.11-2016) with type 8 - LCI (9.4.2.22.10),
+ *    i.e. starting with the measurement token
+ * @NL80211_FTM_RESP_ATTR_CIVIC: The content of Measurement Report Element
+ *    (9.4.2.22 in 802.11-2016) with type 11 - Civic (Section 9.4.2.22.13),
+ *    i.e. starting with the measurement token
+ * @__NL80211_FTM_RESP_ATTR_LAST: Internal
+ * @NL80211_FTM_RESP_ATTR_MAX: highest FTM responder attribute.
+ */
+enum nl80211_ftm_responder_attributes {
+    __NL80211_FTM_RESP_ATTR_INVALID,
+
+    NL80211_FTM_RESP_ATTR_ENABLED,
+    NL80211_FTM_RESP_ATTR_LCI,
+    NL80211_FTM_RESP_ATTR_CIVICLOC,
+
+    /* keep last */
+    __NL80211_FTM_RESP_ATTR_LAST,
+    NL80211_FTM_RESP_ATTR_MAX = __NL80211_FTM_RESP_ATTR_LAST - 1,
+};
+
+/*
+ * enum nl80211_ftm_responder_stats - FTM responder statistics
+ *
+ * These attribute types are used with %NL80211_ATTR_FTM_RESPONDER_STATS
+ * when getting FTM responder statistics.
+ *
+ * @__NL80211_FTM_STATS_INVALID: attribute number 0 is reserved
+ * @NL80211_FTM_STATS_SUCCESS_NUM: number of FTM sessions in which all frames
+ *    were ssfully answered (u32)
+ * @NL80211_FTM_STATS_PARTIAL_NUM: number of FTM sessions in which part of the
+ *    frames were successfully answered (u32)
+ * @NL80211_FTM_STATS_FAILED_NUM: number of failed FTM sessions (u32)
+ * @NL80211_FTM_STATS_ASAP_NUM: number of ASAP sessions (u32)
+ * @NL80211_FTM_STATS_NON_ASAP_NUM: number of non-ASAP sessions (u32)
+ * @NL80211_FTM_STATS_TOTAL_DURATION_MSEC: total sessions durations - gives an
+ *    indication of how much time the responder was busy (u64, msec)
+ * @NL80211_FTM_STATS_UNKNOWN_TRIGGERS_NUM: number of unknown FTM triggers -
+ *    triggers from initiators that didn't finish successfully the negotiation
+ *    phase with the responder (u32)
+ * @NL80211_FTM_STATS_RESCHEDULE_REQUESTS_NUM: number of FTM reschedule requests
+ *    - initiator asks for a new scheduling although it already has scheduled
+ *    FTM slot (u32)
+ * @NL80211_FTM_STATS_OUT_OF_WINDOW_TRIGGERS_NUM: number of FTM triggers out of
+ *    scheduled window (u32)
+ * @NL80211_FTM_STATS_PAD: used for padding, ignore
+ * @__NL80211_TXQ_ATTR_AFTER_LAST: Internal
+ * @NL80211_FTM_STATS_MAX: highest possible FTM responder stats attribute
+ */
+enum nl80211_ftm_responder_stats {
+    __NL80211_FTM_STATS_INVALID,
+    NL80211_FTM_STATS_SUCCESS_NUM,
+    NL80211_FTM_STATS_PARTIAL_NUM,
+    NL80211_FTM_STATS_FAILED_NUM,
+    NL80211_FTM_STATS_ASAP_NUM,
+    NL80211_FTM_STATS_NON_ASAP_NUM,
+    NL80211_FTM_STATS_TOTAL_DURATION_MSEC,
+    NL80211_FTM_STATS_UNKNOWN_TRIGGERS_NUM,
+    NL80211_FTM_STATS_RESCHEDULE_REQUESTS_NUM,
+    NL80211_FTM_STATS_OUT_OF_WINDOW_TRIGGERS_NUM,
+    NL80211_FTM_STATS_PAD,
+
+    /* keep last */
+    __NL80211_FTM_STATS_AFTER_LAST,
+    NL80211_FTM_STATS_MAX = __NL80211_FTM_STATS_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_preamble - frame preamble types
+ * @NL80211_PREAMBLE_LEGACY: legacy (HR/DSSS, OFDM, ERP PHY) preamble
+ * @NL80211_PREAMBLE_HT: HT preamble
+ * @NL80211_PREAMBLE_VHT: VHT preamble
+ * @NL80211_PREAMBLE_DMG: DMG preamble
+ */
+enum nl80211_preamble {
+    NL80211_PREAMBLE_LEGACY,
+    NL80211_PREAMBLE_HT,
+    NL80211_PREAMBLE_VHT,
+    NL80211_PREAMBLE_DMG,
+};
+
+/**
+ * enum nl80211_peer_measurement_type - peer measurement types
+ * @NL80211_PMSR_TYPE_INVALID: invalid/unused, needed as we use
+ *    these numbers also for attributes
+ *
+ * @NL80211_PMSR_TYPE_FTM: flight time measurement
+ *
+ * @NUM_NL80211_PMSR_TYPES: internal
+ * @NL80211_PMSR_TYPE_MAX: highest type number
+ */
+enum nl80211_peer_measurement_type {
+    NL80211_PMSR_TYPE_INVALID,
+
+    NL80211_PMSR_TYPE_FTM,
+
+    NUM_NL80211_PMSR_TYPES,
+    NL80211_PMSR_TYPE_MAX = NUM_NL80211_PMSR_TYPES - 1
+};
+
+/**
+ * enum nl80211_peer_measurement_status - peer measurement status
+ * @NL80211_PMSR_STATUS_SUCCESS: measurement completed successfully
+ * @NL80211_PMSR_STATUS_REFUSED: measurement was locally refused
+ * @NL80211_PMSR_STATUS_TIMEOUT: measurement timed out
+ * @NL80211_PMSR_STATUS_FAILURE: measurement failed, a type-dependent
+ *    reason may be available in the response data
+ */
+enum nl80211_peer_measurement_status {
+    NL80211_PMSR_STATUS_SUCCESS,
+    NL80211_PMSR_STATUS_REFUSED,
+    NL80211_PMSR_STATUS_TIMEOUT,
+    NL80211_PMSR_STATUS_FAILURE,
+};
+
+/**
+ * enum nl80211_peer_measurement_req - peer measurement request attributes
+ * @__NL80211_PMSR_REQ_ATTR_INVALID: invalid
+ *
+ * @NL80211_PMSR_REQ_ATTR_DATA: This is a nested attribute with measurement
+ *    type-specific request data inside. The attributes used are from the
+ *    enums named nl80211_peer_measurement_<type>_req.
+ * @NL80211_PMSR_REQ_ATTR_GET_AP_TSF: include AP TSF timestamp, if supported
+ *    (flag attribute)
+ *
+ * @NUM_NL80211_PMSR_REQ_ATTRS: internal
+ * @NL80211_PMSR_REQ_ATTR_MAX: highest attribute number
+ */
+enum nl80211_peer_measurement_req {
+    __NL80211_PMSR_REQ_ATTR_INVALID,
+
+    NL80211_PMSR_REQ_ATTR_DATA,
+    NL80211_PMSR_REQ_ATTR_GET_AP_TSF,
+
+    /* keep last */
+    NUM_NL80211_PMSR_REQ_ATTRS,
+    NL80211_PMSR_REQ_ATTR_MAX = NUM_NL80211_PMSR_REQ_ATTRS - 1
+};
+
+/**
+ * enum nl80211_peer_measurement_resp - peer measurement response attributes
+ * @__NL80211_PMSR_RESP_ATTR_INVALID: invalid
+ *
+ * @NL80211_PMSR_RESP_ATTR_DATA: This is a nested attribute with measurement
+ *    type-specific results inside. The attributes used are from the enums
+ *    named nl80211_peer_measurement_<type>_resp.
+ * @NL80211_PMSR_RESP_ATTR_STATUS: u32 value with the measurement status
+ *    (using values from &enum nl80211_peer_measurement_status.)
+ * @NL80211_PMSR_RESP_ATTR_HOST_TIME: host time (%CLOCK_BOOTTIME) when the
+ *    result was measured; this value is not expected to be accurate to
+ *    more than 20ms. (u64, nanoseconds)
+ * @NL80211_PMSR_RESP_ATTR_AP_TSF: TSF of the AP that the interface
+ *    doing the measurement is connected to when the result was measured.
+ *    This shall be accurately reported if supported and requested
+ *    (u64, usec)
+ * @NL80211_PMSR_RESP_ATTR_FINAL: If results are sent to the host partially
+ *    (*e.g. with FTM per-burst data) this flag will be cleared on all but
+ *    the last result; if all results are combined it's set on the single
+ *    result.
+ * @NL80211_PMSR_RESP_ATTR_PAD: padding for 64-bit attributes, ignore
+ *
+ * @NUM_NL80211_PMSR_RESP_ATTRS: internal
+ * @NL80211_PMSR_RESP_ATTR_MAX: highest attribute number
+ */
+enum nl80211_peer_measurement_resp {
+    __NL80211_PMSR_RESP_ATTR_INVALID,
+
+    NL80211_PMSR_RESP_ATTR_DATA,
+    NL80211_PMSR_RESP_ATTR_STATUS,
+    NL80211_PMSR_RESP_ATTR_HOST_TIME,
+    NL80211_PMSR_RESP_ATTR_AP_TSF,
+    NL80211_PMSR_RESP_ATTR_FINAL,
+    NL80211_PMSR_RESP_ATTR_PAD,
+
+    /* keep last */
+    NUM_NL80211_PMSR_RESP_ATTRS,
+    NL80211_PMSR_RESP_ATTR_MAX = NUM_NL80211_PMSR_RESP_ATTRS - 1
+};
+
+/**
+ * enum nl80211_peer_measurement_peer_attrs - peer attributes for measurement
+ * @__NL80211_PMSR_PEER_ATTR_INVALID: invalid
+ *
+ * @NL80211_PMSR_PEER_ATTR_ADDR: peer's MAC address
+ * @NL80211_PMSR_PEER_ATTR_CHAN: channel definition, nested, using top-level
+ *    attributes like %NL80211_ATTR_WIPHY_FREQ etc.
+ * @NL80211_PMSR_PEER_ATTR_REQ: This is a nested attribute indexed by
+ *    measurement type, with attributes from the
+ *    &enum nl80211_peer_measurement_req inside.
+ * @NL80211_PMSR_PEER_ATTR_RESP: This is a nested attribute indexed by
+ *    measurement type, with attributes from the
+ *    &enum nl80211_peer_measurement_resp inside.
+ *
+ * @NUM_NL80211_PMSR_PEER_ATTRS: internal
+ * @NL80211_PMSR_PEER_ATTR_MAX: highest attribute number
+ */
+enum nl80211_peer_measurement_peer_attrs {
+    __NL80211_PMSR_PEER_ATTR_INVALID,
+
+    NL80211_PMSR_PEER_ATTR_ADDR,
+    NL80211_PMSR_PEER_ATTR_CHAN,
+    NL80211_PMSR_PEER_ATTR_REQ,
+    NL80211_PMSR_PEER_ATTR_RESP,
+
+    /* keep last */
+    NUM_NL80211_PMSR_PEER_ATTRS,
+    NL80211_PMSR_PEER_ATTR_MAX = NUM_NL80211_PMSR_PEER_ATTRS - 1,
+};
+
+/**
+ * enum nl80211_peer_measurement_attrs - peer measurement attributes
+ * @__NL80211_PMSR_ATTR_INVALID: invalid
+ *
+ * @NL80211_PMSR_ATTR_MAX_PEERS: u32 attribute used for capability
+ *    advertisement only, indicates the maximum number of peers
+ *    measurements can be done with in a single request
+ * @NL80211_PMSR_ATTR_REPORT_AP_TSF: flag attribute in capability
+ *    indicating that the connected AP's TSF can be reported in
+ *    measurement results
+ * @NL80211_PMSR_ATTR_RANDOMIZE_MAC_ADDR: flag attribute in capability
+ *    indicating that MAC address randomization is supported.
+ * @NL80211_PMSR_ATTR_TYPE_CAPA: capabilities reported by the device,
+ *    this contains a nesting indexed by measurement type, and
+ *    type-specific capabilities inside, which are from the enums
+ *    named nl80211_peer_measurement_<type>_capa.
+ * @NL80211_PMSR_ATTR_PEERS: nested attribute, the nesting index is
+ *    meaningless, just a list of peers to measure with, with the
+ *    sub-attributes taken from
+ *    &enum nl80211_peer_measurement_peer_attrs.
+ *
+ * @NUM_NL80211_PMSR_ATTR: internal
+ * @NL80211_PMSR_ATTR_MAX: highest attribute number
+ */
+enum nl80211_peer_measurement_attrs {
+    __NL80211_PMSR_ATTR_INVALID,
+
+    NL80211_PMSR_ATTR_MAX_PEERS,
+    NL80211_PMSR_ATTR_REPORT_AP_TSF,
+    NL80211_PMSR_ATTR_RANDOMIZE_MAC_ADDR,
+    NL80211_PMSR_ATTR_TYPE_CAPA,
+    NL80211_PMSR_ATTR_PEERS,
+
+    /* keep last */
+    NUM_NL80211_PMSR_ATTR,
+    NL80211_PMSR_ATTR_MAX = NUM_NL80211_PMSR_ATTR - 1
+};
+
+/**
+ * enum nl80211_peer_measurement_ftm_capa - FTM capabilities
+ * @__NL80211_PMSR_FTM_CAPA_ATTR_INVALID: invalid
+ *
+ * @NL80211_PMSR_FTM_CAPA_ATTR_ASAP: flag attribute indicating ASAP mode
+ *    is supported
+ * @NL80211_PMSR_FTM_CAPA_ATTR_NON_ASAP: flag attribute indicating non-ASAP
+ *    mode is supported
+ * @NL80211_PMSR_FTM_CAPA_ATTR_REQ_LCI: flag attribute indicating if LCI
+ *    data can be requested during the measurement
+ * @NL80211_PMSR_FTM_CAPA_ATTR_REQ_CIVICLOC: flag attribute indicating if civic
+ *    location data can be requested during the measurement
+ * @NL80211_PMSR_FTM_CAPA_ATTR_PREAMBLES: u32 bitmap attribute of bits
+ *    from &enum nl80211_preamble.
+ * @NL80211_PMSR_FTM_CAPA_ATTR_BANDWIDTHS: bitmap of values from
+ *    &enum nl80211_chan_width indicating the supported channel
+ *    bandwidths for FTM. Note that a higher channel bandwidth may be
+ *    configured to allow for other measurements types with different
+ *    bandwidth requirement in the same measurement.
+ * @NL80211_PMSR_FTM_CAPA_ATTR_MAX_BURSTS_EXPONENT: u32 attribute indicating
+ *    the maximum bursts exponent that can be used (if not present anything
+ *    is valid)
+ * @NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST: u32 attribute indicating
+ *    the maximum FTMs per burst (if not present anything is valid)
+ *
+ * @NUM_NL80211_PMSR_FTM_CAPA_ATTR: internal
+ * @NL80211_PMSR_FTM_CAPA_ATTR_MAX: highest attribute number
+ */
+enum nl80211_peer_measurement_ftm_capa {
+    __NL80211_PMSR_FTM_CAPA_ATTR_INVALID,
+
+    NL80211_PMSR_FTM_CAPA_ATTR_ASAP,
+    NL80211_PMSR_FTM_CAPA_ATTR_NON_ASAP,
+    NL80211_PMSR_FTM_CAPA_ATTR_REQ_LCI,
+    NL80211_PMSR_FTM_CAPA_ATTR_REQ_CIVICLOC,
+    NL80211_PMSR_FTM_CAPA_ATTR_PREAMBLES,
+    NL80211_PMSR_FTM_CAPA_ATTR_BANDWIDTHS,
+    NL80211_PMSR_FTM_CAPA_ATTR_MAX_BURSTS_EXPONENT,
+    NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST,
+
+    /* keep last */
+    NUM_NL80211_PMSR_FTM_CAPA_ATTR,
+    NL80211_PMSR_FTM_CAPA_ATTR_MAX = NUM_NL80211_PMSR_FTM_CAPA_ATTR - 1
+};
+
+/**
+ * enum nl80211_peer_measurement_ftm_req - FTM request attributes
+ * @__NL80211_PMSR_FTM_REQ_ATTR_INVALID: invalid
+ *
+ * @NL80211_PMSR_FTM_REQ_ATTR_ASAP: ASAP mode requested (flag)
+ * @NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE: preamble type (see
+ *    &enum nl80211_preamble), optional for DMG (u32)
+ * @NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP: number of bursts exponent as in
+ *    802.11-2016 9.4.2.168 "Fine Timing Measurement Parameters element"
+ *    (u8, 0-15, optional with default 15 i.e. "no preference")
+ * @NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD: interval between bursts in units
+ *    of 100ms (u16, optional with default 0)
+ * @NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION: burst duration, as in 802.11-2016
+ *    Table 9-257 "Burst Duration field encoding" (u8, 0-15, optional with
+ *    default 15 i.e. "no preference")
+ * @NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST: number of successful FTM frames
+ *    requested per burst
+ *    (u8, 0-31, optional with default 0 i.e. "no preference")
+ * @NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES: number of FTMR frame retries
+ *    (u8, default 3)
+ * @NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI: request LCI data (flag)
+ * @NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC: request civic location data
+ *    (flag)
+ *
+ * @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal
+ * @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number
+ */
+enum nl80211_peer_measurement_ftm_req {
+    __NL80211_PMSR_FTM_REQ_ATTR_INVALID,
+
+    NL80211_PMSR_FTM_REQ_ATTR_ASAP,
+    NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE,
+    NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP,
+    NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD,
+    NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION,
+    NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST,
+    NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES,
+    NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI,
+    NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC,
+
+    /* keep last */
+    NUM_NL80211_PMSR_FTM_REQ_ATTR,
+    NL80211_PMSR_FTM_REQ_ATTR_MAX = NUM_NL80211_PMSR_FTM_REQ_ATTR - 1
+};
+
+/**
+ * enum nl80211_peer_measurement_ftm_failure_reasons - FTM failure reasons
+ * @NL80211_PMSR_FTM_FAILURE_UNSPECIFIED: unspecified failure, not used
+ * @NL80211_PMSR_FTM_FAILURE_NO_RESPONSE: no response from the FTM responder
+ * @NL80211_PMSR_FTM_FAILURE_REJECTED: FTM responder rejected measurement
+ * @NL80211_PMSR_FTM_FAILURE_WRONG_CHANNEL: we already know the peer is
+ *    on a different channel, so can't measure (if we didn't know, we'd
+ *    try and get no response)
+ * @NL80211_PMSR_FTM_FAILURE_PEER_NOT_CAPABLE: peer can't actually do FTM
+ * @NL80211_PMSR_FTM_FAILURE_INVALID_TIMESTAMP: invalid T1/T4 timestamps
+ *    received
+ * @NL80211_PMSR_FTM_FAILURE_PEER_BUSY: peer reports busy, you may retry
+ *    later (see %NL80211_PMSR_FTM_RESP_ATTR_BUSY_RETRY_TIME)
+ * @NL80211_PMSR_FTM_FAILURE_BAD_CHANGED_PARAMS: parameters were changed
+ *    by the peer and are no longer supported
+ */
+enum nl80211_peer_measurement_ftm_failure_reasons {
+    NL80211_PMSR_FTM_FAILURE_UNSPECIFIED,
+    NL80211_PMSR_FTM_FAILURE_NO_RESPONSE,
+    NL80211_PMSR_FTM_FAILURE_REJECTED,
+    NL80211_PMSR_FTM_FAILURE_WRONG_CHANNEL,
+    NL80211_PMSR_FTM_FAILURE_PEER_NOT_CAPABLE,
+    NL80211_PMSR_FTM_FAILURE_INVALID_TIMESTAMP,
+    NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
+    NL80211_PMSR_FTM_FAILURE_BAD_CHANGED_PARAMS,
+};
+
+/**
+ * enum nl80211_peer_measurement_ftm_resp - FTM response attributes
+ * @__NL80211_PMSR_FTM_RESP_ATTR_INVALID: invalid
+ *
+ * @NL80211_PMSR_FTM_RESP_ATTR_FAIL_REASON: FTM-specific failure reason
+ *    (u32, optional)
+ * @NL80211_PMSR_FTM_RESP_ATTR_BURST_INDEX: optional, if bursts are reported
+ *    as separate results then it will be the burst index 0...(N-1) and
+ *    the top level will indicate partial results (u32)
+ * @NL80211_PMSR_FTM_RESP_ATTR_NUM_FTMR_ATTEMPTS: number of FTM Request frames
+ *    transmitted (u32, optional)
+ * @NL80211_PMSR_FTM_RESP_ATTR_NUM_FTMR_SUCCESSES: number of FTM Request frames
+ *    that were acknowleged (u32, optional)
+ * @NL80211_PMSR_FTM_RESP_ATTR_BUSY_RETRY_TIME: retry time received from the
+ *    busy peer (u32, seconds)
+ * @NL80211_PMSR_FTM_RESP_ATTR_NUM_BURSTS_EXP: actual number of bursts exponent
+ *    used by the responder (similar to request, u8)
+ * @NL80211_PMSR_FTM_RESP_ATTR_BURST_DURATION: actual burst duration used by
+ *    the responder (similar to request, u8)
+ * @NL80211_PMSR_FTM_RESP_ATTR_FTMS_PER_BURST: actual FTMs per burst used
+ *    by the responder (similar to request, u8)
+ * @NL80211_PMSR_FTM_RESP_ATTR_RSSI_AVG: average RSSI across all FTM action
+ *    frames (optional, s32, 1/2 dBm)
+ * @NL80211_PMSR_FTM_RESP_ATTR_RSSI_SPREAD: RSSI spread across all FTM action
+ *    frames (optional, s32, 1/2 dBm)
+ * @NL80211_PMSR_FTM_RESP_ATTR_TX_RATE: bitrate we used for the response to the
+ *    FTM action frame (optional, nested, using &enum nl80211_rate_info
+ *    attributes)
+ * @NL80211_PMSR_FTM_RESP_ATTR_RX_RATE: bitrate the responder used for the FTM
+ *    action frame (optional, nested, using &enum nl80211_rate_info attrs)
+ * @NL80211_PMSR_FTM_RESP_ATTR_RTT_AVG: average RTT (s64, picoseconds, optional
+ *    but one of RTT/DIST must be present)
+ * @NL80211_PMSR_FTM_RESP_ATTR_RTT_VARIANCE: RTT variance (u64, ps^2, note that
+ *    standard deviation is the square root of variance, optional)
+ * @NL80211_PMSR_FTM_RESP_ATTR_RTT_SPREAD: RTT spread (u64, picoseconds,
+ *    optional)
+ * @NL80211_PMSR_FTM_RESP_ATTR_DIST_AVG: average distance (s64, mm, optional
+ *    but one of RTT/DIST must be present)
+ * @NL80211_PMSR_FTM_RESP_ATTR_DIST_VARIANCE: distance variance (u64, mm^2, note
+ *    that standard deviation is the square root of variance, optional)
+ * @NL80211_PMSR_FTM_RESP_ATTR_DIST_SPREAD: distance spread (u64, mm, optional)
+ * @NL80211_PMSR_FTM_RESP_ATTR_LCI: LCI data from peer (binary, optional);
+ *    this is the contents of the Measurement Report Element (802.11-2016
+ *    9.4.2.22.1) starting with the Measurement Token, with Measurement
+ *    Type 8.
+ * @NL80211_PMSR_FTM_RESP_ATTR_CIVICLOC: civic location data from peer
+ *    (binary, optional);
+ *    this is the contents of the Measurement Report Element (802.11-2016
+ *    9.4.2.22.1) starting with the Measurement Token, with Measurement
+ *    Type 11.
+ * @NL80211_PMSR_FTM_RESP_ATTR_PAD: ignore, for u64/s64 padding only
+ *
+ * @NUM_NL80211_PMSR_FTM_RESP_ATTR: internal
+ * @NL80211_PMSR_FTM_RESP_ATTR_MAX: highest attribute number
+ */
+enum nl80211_peer_measurement_ftm_resp {
+    __NL80211_PMSR_FTM_RESP_ATTR_INVALID,
+
+    NL80211_PMSR_FTM_RESP_ATTR_FAIL_REASON,
+    NL80211_PMSR_FTM_RESP_ATTR_BURST_INDEX,
+    NL80211_PMSR_FTM_RESP_ATTR_NUM_FTMR_ATTEMPTS,
+    NL80211_PMSR_FTM_RESP_ATTR_NUM_FTMR_SUCCESSES,
+    NL80211_PMSR_FTM_RESP_ATTR_BUSY_RETRY_TIME,
+    NL80211_PMSR_FTM_RESP_ATTR_NUM_BURSTS_EXP,
+    NL80211_PMSR_FTM_RESP_ATTR_BURST_DURATION,
+    NL80211_PMSR_FTM_RESP_ATTR_FTMS_PER_BURST,
+    NL80211_PMSR_FTM_RESP_ATTR_RSSI_AVG,
+    NL80211_PMSR_FTM_RESP_ATTR_RSSI_SPREAD,
+    NL80211_PMSR_FTM_RESP_ATTR_TX_RATE,
+    NL80211_PMSR_FTM_RESP_ATTR_RX_RATE,
+    NL80211_PMSR_FTM_RESP_ATTR_RTT_AVG,
+    NL80211_PMSR_FTM_RESP_ATTR_RTT_VARIANCE,
+    NL80211_PMSR_FTM_RESP_ATTR_RTT_SPREAD,
+    NL80211_PMSR_FTM_RESP_ATTR_DIST_AVG,
+    NL80211_PMSR_FTM_RESP_ATTR_DIST_VARIANCE,
+    NL80211_PMSR_FTM_RESP_ATTR_DIST_SPREAD,
+    NL80211_PMSR_FTM_RESP_ATTR_LCI,
+    NL80211_PMSR_FTM_RESP_ATTR_CIVICLOC,
+    NL80211_PMSR_FTM_RESP_ATTR_PAD,
+
+    /* keep last */
+    NUM_NL80211_PMSR_FTM_RESP_ATTR,
+    NL80211_PMSR_FTM_RESP_ATTR_MAX = NUM_NL80211_PMSR_FTM_RESP_ATTR - 1
+};
+
+/**
+ * enum nl80211_obss_pd_attributes - OBSS packet detection attributes
+ * @__NL80211_HE_OBSS_PD_ATTR_INVALID: Invalid
+ *
+ * @NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET: the OBSS PD minimum tx power offset.
+ * @NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET: the OBSS PD maximum tx power offset.
+ *
+ * @__NL80211_HE_OBSS_PD_ATTR_LAST: Internal
+ * @NL80211_HE_OBSS_PD_ATTR_MAX: highest OBSS PD attribute.
+ */
+enum nl80211_obss_pd_attributes {
+    __NL80211_HE_OBSS_PD_ATTR_INVALID,
+
+    NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET,
+    NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET,
+
+    /* keep last */
+    __NL80211_HE_OBSS_PD_ATTR_LAST,
+    NL80211_HE_OBSS_PD_ATTR_MAX = __NL80211_HE_OBSS_PD_ATTR_LAST - 1,
+};
+
+#endif /* __LINUX_NL80211_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/125.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/125.html new file mode 100644 index 00000000..3c00885d --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/125.html @@ -0,0 +1,743 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
/*
+ * Copyright (C) 2020 MATE Development Team
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"<--- Include file: "config.h" not found.
+#endif
+
+#include <glib/gi18n-lib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "backend.h"
+#include "netspeed-preferences.h"
+
+struct _NetspeedPreferences
+{
+  GtkDialog parent;
+
+  NetspeedApplet *netspeed;
+
+  GSettings *settings;
+  GtkWidget *network_device_combo;
+  GtkWidget *show_all_addresses_checkbutton;
+  GtkWidget *show_sum_checkbutton;
+  GtkWidget *show_bits_checkbutton;
+  GtkWidget *show_icon_checkbutton;
+  GtkWidget *show_quality_icon_checkbutton;
+  GtkWidget *change_icon_checkbutton;
+
+  GList *devices;
+};
+
+typedef enum
+{
+  PROP_NETSPEED_APPLET = 1,
+  N_PROPERTIES
+} NetspeedPreferencesProperty;
+
+G_DEFINE_TYPE (NetspeedPreferences, netspeed_preferences, GTK_TYPE_DIALOG)
+
+static void
+netspeed_preferences_init (NetspeedPreferences *preferences)
+{
+  gtk_widget_init_template (GTK_WIDGET (preferences));
+}
+
+static void
+netspeed_preferences_set_property (GObject      *object,
+                                   guint         property_id,
+                                   const GValue *value,
+                                   GParamSpec   *pspec)
+{
+  NetspeedPreferences *self = NETSPEED_PREFERENCES (object);
+
+  switch ((NetspeedPreferencesProperty) property_id) {
+    case PROP_NETSPEED_APPLET:
+      self->netspeed = g_value_get_pointer (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+static void
+netspeed_preferences_get_property (GObject    *object,
+                                   guint       property_id,
+                                   GValue     *value,
+                                   GParamSpec *pspec)
+{
+  NetspeedPreferences *self = NETSPEED_PREFERENCES (object);
+
+  switch ((NetspeedPreferencesProperty) property_id) {
+    case PROP_NETSPEED_APPLET:
+      g_value_set_pointer (value, self->netspeed);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+static void
+netspeed_preferences_response (GtkDialog *dialog,
+                               gint       response_id)
+{
+  NetspeedPreferences *preferences;
+
+  preferences = NETSPEED_PREFERENCES (dialog);
+
+  switch (response_id) {
+    case GTK_RESPONSE_HELP:
+      netspeed_applet_display_help (GTK_WIDGET (dialog),
+                                    "netspeed_applet-settings");
+      break;
+    default:
+      gtk_widget_destroy (GTK_WIDGET (preferences));
+  }
+}
+
+static void
+on_network_device_combo_changed (GtkComboBox         *combo,
+                                 NetspeedPreferences *preferences)
+{
+  gint active;
+  gboolean old_auto_change_device, auto_change_device;
+
+  active = gtk_combo_box_get_active (combo);
+  g_assert (active > -1);
+
+  old_auto_change_device = auto_change_device = g_settings_get_boolean (preferences->settings,
+                                                                        "auto-change-device");
+  if (0 == active) {
+    if (auto_change_device)
+      return;
+    auto_change_device = TRUE;
+  } else {
+    const gchar *current_device_name;
+    const gchar *selected_device_name;
+
+    current_device_name = netspeed_applet_get_current_device_name (preferences->netspeed);
+    auto_change_device = FALSE;
+    selected_device_name = g_list_nth_data (preferences->devices, (guint) (active - 1));
+    if (!g_strcmp0 (selected_device_name, current_device_name))
+      return;
+    g_settings_set_string (preferences->settings,
+                           "device", selected_device_name);
+  }
+  if (old_auto_change_device != auto_change_device)
+    g_settings_set_boolean (preferences->settings,
+                            "auto-change-device", auto_change_device);
+}
+
+static void
+netspeed_preferences_finalize (GObject *object)
+{
+  NetspeedPreferences *preferences = NETSPEED_PREFERENCES (object);
+
+  g_list_free_full (preferences->devices, g_free);
+  G_OBJECT_CLASS (netspeed_preferences_parent_class)->finalize (object);
+}
+
+static void
+netspeed_preferences_class_init (NetspeedPreferencesClass *klass)
+{
+  GObjectClass   *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+  GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass);
+
+  object_class->finalize = netspeed_preferences_finalize;
+  object_class->set_property = netspeed_preferences_set_property;
+  object_class->get_property = netspeed_preferences_get_property;
+
+  dialog_class->response = netspeed_preferences_response;
+
+  g_object_class_install_property (object_class,
+                                   PROP_NETSPEED_APPLET,
+                                   g_param_spec_pointer ("netspeed-applet",
+                                                         "Netspeed Applet",
+                                                         "The Netspeed Applet",
+                                                         G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+  gtk_widget_class_set_template_from_resource (widget_class, NETSPEED_RESOURCE_PATH "netspeed-preferences.ui");
+
+  gtk_widget_class_bind_template_child (widget_class, NetspeedPreferences, network_device_combo);
+  gtk_widget_class_bind_template_child (widget_class, NetspeedPreferences, show_all_addresses_checkbutton);
+  gtk_widget_class_bind_template_child (widget_class, NetspeedPreferences, show_sum_checkbutton);
+  gtk_widget_class_bind_template_child (widget_class, NetspeedPreferences, show_bits_checkbutton);
+  gtk_widget_class_bind_template_child (widget_class, NetspeedPreferences, show_icon_checkbutton);
+  gtk_widget_class_bind_template_child (widget_class, NetspeedPreferences, show_quality_icon_checkbutton);
+  gtk_widget_class_bind_template_child (widget_class, NetspeedPreferences, change_icon_checkbutton);
+
+  gtk_widget_class_bind_template_callback (widget_class, on_network_device_combo_changed);
+}
+
+static void
+fill_device_combo (NetspeedPreferences *preferences, GSettings *settings)
+{
+  GList *ptr;
+  int i, active = -1;
+  const gchar *current_device_name;
+  gboolean auto_change_device;
+
+  /* Default means device with default route set */
+  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (preferences->network_device_combo),
+                                  _("Default"));
+  ptr = preferences->devices = get_available_devices ();
+  current_device_name = netspeed_applet_get_current_device_name (preferences->netspeed);
+  auto_change_device = g_settings_get_boolean (settings, "auto-change-device");
+  for (i = 0; ptr; ptr = g_list_next (ptr)) {
+    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (preferences->network_device_combo),
+                                    ptr->data);
+    if (g_str_equal (ptr->data, current_device_name))
+      active = (i + 1);
+    ++i;
+  }
+  if (active < 0 || auto_change_device)
+    active = 0;
+  gtk_combo_box_set_active (GTK_COMBO_BOX (preferences->network_device_combo), active);
+}
+
+GtkWidget *
+netspeed_preferences_new (NetspeedApplet *netspeed)
+{
+  NetspeedPreferences *preferences;
+  GSettings *settings;
+
+  preferences = g_object_new (NETSPEED_TYPE_PREFERENCES,
+                              "netspeed-applet", netspeed,
+                              NULL);
+
+  preferences->settings = settings = netspeed_applet_get_settings (preferences->netspeed);
+
+  fill_device_combo (preferences, settings);
+
+  g_settings_bind (settings, "show-all-addresses",
+                   preferences->show_all_addresses_checkbutton, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind (settings, "show-sum",
+                   preferences->show_sum_checkbutton, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind (settings, "show-bits",
+                   preferences->show_bits_checkbutton, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind (settings, "show-icon",
+                   preferences->show_icon_checkbutton, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind (settings, "show-quality-icon",
+                   preferences->show_quality_icon_checkbutton, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind (settings, "change-icon",
+                   preferences->change_icon_checkbutton, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  return GTK_WIDGET (preferences);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/126.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/126.html new file mode 100644 index 00000000..b5df1bb7 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/126.html @@ -0,0 +1,299 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
/*
+ * Copyright (C) 2020 MATE Development Team
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NETSPEED_PREFERENCES_H
+#define NETSPEED_PREFERENCES_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "netspeed.h"
+
+#define NETSPEED_TYPE_PREFERENCES netspeed_preferences_get_type ()
+G_DECLARE_FINAL_TYPE (NetspeedPreferences, netspeed_preferences,
+                      NETSPEED, PREFERENCES, GtkDialog)
+
+GtkWidget *netspeed_preferences_new (NetspeedApplet *netspeed);
+
+#endif
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/127.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/127.html new file mode 100644 index 00000000..062be1f0 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/127.html @@ -0,0 +1,307 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
/*
+ * Copyright (C) 2020 MATE Development Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NETSPEED_APPLET_H
+#define NETSPEED_APPLET_H
+
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "backend.h"
+#include "netspeed-preferences.h"
+
+#define NETSPEED_TYPE_APPLET netspeed_applet_get_type ()
+G_DECLARE_FINAL_TYPE (NetspeedApplet, netspeed_applet,<--- There is an unknown macro here somewhere. Configuration is required. If G_DECLARE_FINAL_TYPE is a macro then please configure it.
+                      NETSPEED, APPLET, MatePanelApplet)
+
+GSettings * netspeed_applet_get_settings (NetspeedApplet *netspeed);
+const gchar * netspeed_applet_get_current_device_name (NetspeedApplet *netspeed);
+void netspeed_applet_display_help (GtkWidget *dialog, const gchar *section);
+
+#endif
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/128.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/128.html new file mode 100644 index 00000000..4c531f9d --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/128.html @@ -0,0 +1,1131 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.netspeed"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[3835]; const double alignment; void * const ptr;}  netspeed_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0000, 0000, 0050, 0010, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0201, 0321, 0040, 0031, 0002, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 
+  0010, 0001, 0000, 0000, 0014, 0001, 0000, 0000, 0173, 0340, 0034, 0135, 0004, 0000, 0000, 0000, 
+  0014, 0001, 0000, 0000, 0023, 0000, 0166, 0000, 0040, 0001, 0000, 0000, 0327, 0010, 0000, 0000, 
+  0113, 0120, 0220, 0013, 0003, 0000, 0000, 0000, 0327, 0010, 0000, 0000, 0004, 0000, 0114, 0000, 
+  0334, 0010, 0000, 0000, 0340, 0010, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 
+  0340, 0010, 0000, 0000, 0001, 0000, 0114, 0000, 0344, 0010, 0000, 0000, 0350, 0010, 0000, 0000, 
+  0304, 0157, 0223, 0316, 0006, 0000, 0000, 0000, 0350, 0010, 0000, 0000, 0011, 0000, 0114, 0000, 
+  0364, 0010, 0000, 0000, 0000, 0011, 0000, 0000, 0035, 0270, 0145, 0102, 0004, 0000, 0000, 0000, 
+  0000, 0011, 0000, 0000, 0021, 0000, 0166, 0000, 0030, 0011, 0000, 0000, 0223, 0011, 0000, 0000, 
+  0275, 0342, 0315, 0116, 0000, 0000, 0000, 0000, 0223, 0011, 0000, 0000, 0015, 0000, 0114, 0000, 
+  0240, 0011, 0000, 0000, 0244, 0011, 0000, 0000, 0207, 0171, 0122, 0310, 0004, 0000, 0000, 0000, 
+  0244, 0011, 0000, 0000, 0027, 0000, 0166, 0000, 0300, 0011, 0000, 0000, 0372, 0016, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0156, 0145, 0164, 0163, 
+  0160, 0145, 0145, 0144, 0055, 0144, 0145, 0164, 0141, 0151, 0154, 0163, 0056, 0165, 0151, 0000, 
+  0156, 0213, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0135, 0135, 0163, 0342, 0066, 
+  0024, 0175, 0337, 0137, 0341, 0372, 0265, 0343, 0020, 0140, 0047, 0263, 0263, 0003, 0354, 0354, 
+  0107, 0067, 0233, 0231, 0116, 0233, 0151, 0322, 0147, 0106, 0330, 0027, 0254, 0306, 0110, 0256, 
+  0044, 0102, 0350, 0257, 0257, 0214, 0015, 0261, 0361, 0267, 0255, 0045, 0006, 0364, 0226, 0200, 
+  0044, 0164, 0257, 0356, 0271, 0347, 0334, 0153, 0143, 0106, 0237, 0136, 0226, 0236, 0361, 0014, 
+  0214, 0143, 0112, 0306, 0146, 0377, 0352, 0332, 0064, 0200, 0330, 0324, 0301, 0144, 0061, 0066, 
+  0377, 0176, 0374, 0156, 0175, 0060, 0077, 0115, 0336, 0215, 0176, 0261, 0054, 0343, 0026, 0010, 
+  0060, 0044, 0300, 0061, 0326, 0130, 0270, 0306, 0302, 0103, 0016, 0030, 0303, 0253, 0341, 0207, 
+  0253, 0201, 0141, 0131, 0162, 0020, 0046, 0002, 0330, 0034, 0331, 0060, 0171, 0147, 0030, 0043, 
+  0006, 0377, 0256, 0060, 0003, 0156, 0170, 0170, 0066, 0066, 0027, 0342, 0351, 0127, 0363, 0365, 
+  0203, 0206, 0127, 0203, 0201, 0331, 0333, 0216, 0243, 0263, 0177, 0300, 0026, 0206, 0355, 0041, 
+  0316, 0307, 0346, 0255, 0170, 0272, 0133, 0242, 0005, 0230, 0006, 0166, 0306, 0246, 0355, 0121, 
+  0016, 0123, 0274, 0134, 0230, 0301, 0120, 0071, 0330, 0147, 0324, 0007, 0046, 0066, 0006, 0101, 
+  0113, 0030, 0233, 0317, 0230, 0343, 0231, 0007, 0346, 0344, 0221, 0255, 0140, 0324, 0333, 0275, 
+  0233, 0075, 0330, 0106, 0304, 0232, 0123, 0173, 0305, 0315, 0311, 0167, 0344, 0361, 0322, 0361, 
+  0330, 0246, 0304, 0012, 0376, 0064, 0047, 0153, 0114, 0034, 0272, 0266, 0266, 0333, 0111, 0116, 
+  0033, 0365, 0302, 0375, 0227, 0232, 0342, 0202, 0347, 0167, 0300, 0222, 0140, 0033, 0326, 0214, 
+  0321, 0065, 0007, 0126, 0307, 0222, 0157, 0030, 0171, 0164, 0021, 0232, 0342, 0204, 0177, 0253, 
+  0331, 0333, 0214, 0062, 0007, 0230, 0265, 0306, 0216, 0160, 0315, 0111, 0177, 0120, 0066, 0136, 
+  0154, 0174, 0260, 0134, 0031, 0152, 0346, 0044, 0334, 0107, 0152, 0002, 0307, 0013, 0202, 0274, 
+  0150, 0270, 0014, 0100, 0237, 0022, 0056, 0017, 0301, 0105, 0304, 0361, 0200, 0215, 0115, 0112, 
+  0246, 0341, 0314, 0351, 0353, 0233, 0174, 0215, 0174, 0037, 0244, 0155, 0204, 0206, 0141, 0051, 
+  0327, 0261, 0135, 0354, 0071, 0306, 0066, 0250, 0345, 0172, 0326, 0366, 0137, 0171, 0120, 0063, 
+  0372, 0022, 0231, 0236, 0345, 0247, 0057, 0261, 0167, 0353, 0073, 0047, 0153, 0016, 0145, 0030, 
+  0210, 0100, 0102, 0342, 0306, 0234, 0110, 0000, 0011, 0154, 0043, 0257, 0312, 0104, 0356, 0043, 
+  0133, 0302, 0070, 0313, 0251, 0005, 0366, 0041, 0073, 0370, 0244, 0051, 0142, 0200, 0142, 0206, 
+  0144, 0232, 0272, 0022, 0202, 0222, 0244, 0301, 0115, 0215, 0316, 0232, 0347, 0241, 0015, 0135, 
+  0011, 0213, 0213, 0115, 0200, 0013, 0040, 0116, 0356, 0304, 0355, 0326, 0223, 0257, 0345, 0157, 
+  0070, 0214, 0341, 0331, 0366, 0357, 0276, 0171, 0070, 0053, 0153, 0033, 0063, 0360, 0114, 0103, 
+  0060, 0104, 0270, 0207, 0004, 0222, 0050, 0035, 0233, 0033, 0220, 0326, 0114, 0177, 0110, 0060, 
+  0345, 0155, 0252, 0066, 0310, 0053, 0272, 0260, 0356, 0124, 0006, 0066, 0340, 0147, 0340, 0226, 
+  0003, 0163, 0264, 0362, 0104, 0375, 0025, 0360, 0066, 0211, 0115, 0166, 0011, 0254, 0316, 0324, 
+  0025, 0007, 0153, 0105, 0044, 0276, 0075, 0114, 0032, 0230, 0215, 0274, 0065, 0332, 0160, 0213, 
+  0273, 0062, 0367, 0106, 0273, 0050, 0136, 0042, 0236, 0303, 0222, 0013, 0043, 0373, 0111, 0142, 
+  0241, 0374, 0043, 0341, 0305, 0227, 0171, 0242, 0376, 0126, 0347, 0330, 0363, 0352, 0317, 0362, 
+  0051, 0307, 0041, 0260, 0257, 0213, 0214, 0312, 0334, 0375, 0250, 0227, 0021, 0366, 0315, 0241, 
+  0060, 0150, 0007, 0205, 0257, 0151, 0152, 0354, 0036, 0026, 0202, 0251, 0215, 0141, 0340, 0242, 
+  0026, 0030, 0122, 0206, 0302, 0275, 0042, 0322, 0060, 0374, 0031, 0060, 0354, 0253, 0200, 0141, 
+  0226, 0371, 0331, 0246, 0347, 0231, 0135, 0213, 0047, 0103, 0233, 0153, 0115, 0051, 0315, 0073, 
+  0031, 0306, 0246, 0014, 0115, 0347, 0232, 0062, 0071, 0324, 0070, 0017, 0250, 0222, 0024, 0225, 
+  0265, 0124, 0261, 0236, 0272, 0156, 0253, 0104, 0276, 0263, 0100, 0214, 0207, 0142, 0032, 0115, 
+  0347, 0333, 0377, 0216, 0223, 0062, 0013, 0335, 0225, 0233, 0363, 0255, 0027, 0344, 0111, 0125, 
+  0135, 0110, 0123, 0031, 0016, 0163, 0121, 0120, 0065, 0005, 0212, 0335, 0234, 0020, 0112, 0212, 
+  0077, 0067, 0323, 0165, 0331, 0356, 0373, 0034, 0154, 0146, 0011, 0101, 0015, 0220, 0061, 0276, 
+  0205, 0343, 0332, 0072, 0057, 0153, 0176, 0045, 0327, 0145, 0115, 0334, 0124, 0236, 0230, 0353, 
+  0272, 0154, 0367, 0175, 0143, 0110, 0026, 0264, 0213, 0317, 0201, 0304, 0017, 0143, 0060, 0174, 
+  0041, 0245, 0371, 0113, 0010, 0021, 0360, 0302, 0025, 0126, 0120, 0347, 0003, 0227, 0107, 0321, 
+  0377, 0120, 0272, 0323, 0326, 0207, 0243, 0342, 0200, 0322, 0105, 0142, 0140, 0377, 0101, 0201, 
+  0370, 0352, 0221, 0151, 0370, 0156, 0106, 0205, 0230, 0261, 0154, 0016, 0361, 0025, 0050, 0266, 
+  0262, 0211, 0271, 0223, 0242, 0372, 0055, 0100, 0327, 0116, 0231, 0125, 0103, 0317, 0357, 0271, 
+  0143, 0325, 0007, 0177, 0276, 0142, 0174, 0014, 0136, 0232, 0003, 0063, 0376, 0102, 0002, 0214, 
+  0133, 0206, 0174, 0267, 0356, 0342, 0113, 0002, 0113, 0112, 0260, 0035, 0064, 0017, 0026, 0020, 
+  0064, 0004, 0136, 0117, 0255, 0170, 0255, 0332, 0356, 0126, 0247, 0150, 0152, 0047, 0340, 0123, 
+  0253, 0054, 0122, 0214, 0337, 0031, 0052, 0333, 0023, 0370, 0215, 0052, 0042, 0372, 0112, 0075, 
+  0312, 0342, 0265, 0024, 0046, 0166, 0360, 0322, 0224, 0127, 0106, 0230, 0052, 0156, 0152, 0062, 
+  0275, 0176, 0125, 0222, 0316, 0235, 0133, 0173, 0055, 0056, 0341, 0227, 0110, 0240, 0061, 0107, 
+  0114, 0167, 0177, 0211, 0012, 0131, 0264, 0050, 0203, 0346, 0203, 0255, 0025, 0340, 0232, 0203, 
+  0256, 0061, 0360, 0012, 0300, 0127, 0041, 0347, 0253, 0117, 0363, 0157, 0052, 0220, 0012, 0272, 
+  0012, 0167, 0304, 0130, 0004, 0314, 0140, 0154, 0103, 0250, 0356, 0302, 0065, 0313, 0336, 0112, 
+  0024, 0023, 0213, 0353, 0246, 0024, 0163, 0162, 0201, 0334, 0177, 0333, 0100, 0116, 0045, 0131, 
+  0272, 0022, 0072, 0313, 0156, 0263, 0154, 0334, 0023, 0227, 0232, 0146, 0007, 0072, 0315, 0266, 
+  0115, 0263, 0177, 0256, 0104, 0327, 0362, 0154, 0074, 0262, 0057, 0046, 0321, 0016, 0125, 0207, 
+  0362, 0011, 0227, 0055, 0175, 0135, 0266, 0064, 0151, 0132, 0036, 0247, 0356, 0311, 0366, 0126, 
+  0347, 0122, 0236, 0033, 0165, 0320, 0270, 0100, 0114, 0324, 0235, 0134, 0162, 0371, 0274, 0115, 
+  0003, 0056, 0344, 0214, 0260, 0140, 0364, 0247, 0136, 0001, 0203, 0164, 0247, 0141, 0326, 0306, 
+  0265, 0365, 0350, 0350, 0356, 0376, 0371, 0275, 0361, 0331, 0161, 0030, 0160, 0376, 0261, 0311, 
+  0322, 0151, 0321, 0356, 0117, 0005, 0274, 0064, 0332, 0146, 0345, 0356, 0155, 0131, 0363, 0257, 
+  0214, 0214, 0132, 0023, 0122, 0073, 0122, 0152, 0125, 0312, 0226, 0220, 0123, 0111, 0357, 0263, 
+  0055, 0176, 0202, 0243, 0275, 0070, 0370, 0110, 0131, 0044, 0175, 0202, 0132, 0031, 0242, 0143, 
+  0273, 0102, 0165, 0373, 0206, 0261, 0115, 0100, 0054, 0021, 0177, 0322, 0004, 0161, 0100, 0020, 
+  0177, 0204, 0176, 0121, 0303, 0015, 0073, 0047, 0153, 0202, 0150, 0003, 0242, 0101, 0347, 0101, 
+  0244, 0131, 0102, 0263, 0104, 0213, 0000, 0037, 0376, 0314, 0000, 0327, 0027, 0075, 0124, 0165, 
+  0343, 0202, 0302, 0064, 0322, 0205, 0317, 0067, 0323, 0331, 0151, 0224, 0251, 0307, 0252, 0064, 
+  0245, 0107, 0264, 0224, 0110, 0325, 0232, 0067, 0252, 0153, 0115, 0351, 0346, 0043, 0210, 0211, 
+  0026, 0367, 0013, 0351, 0122, 0365, 0215, 0112, 0325, 0050, 0062, 0264, 0014, 0321, 0320, 0070, 
+  0273, 0112, 0127, 0137, 0357, 0126, 0251, 0141, 0264, 0152, 0211, 0222, 0246, 0273, 0106, 0222, 
+  0235, 0265, 0156, 0071, 0320, 0055, 0077, 0020, 0163, 0326, 0210, 0201, 0132, 0355, 0022, 0071, 
+  0133, 0267, 0102, 0316, 0123, 0200, 0304, 0216, 0127, 0113, 0020, 0035, 0337, 0147, 0327, 0057, 
+  0367, 0205, 0257, 0057, 0247, 0246, 0250, 0342, 0336, 0022, 0326, 0275, 0132, 0236, 0010, 0035, 
+  0255, 0151, 0342, 0074, 0073, 0346, 0257, 0247, 0253, 0131, 0102, 0207, 0267, 0356, 0227, 0237, 
+  0363, 0335, 0253, 0272, 0326, 0214, 0067, 0350, 0310, 0154, 0043, 0200, 0153, 0005, 0161, 0240, 
+  0040, 0276, 0004, 0136, 0061, 0060, 0121, 0324, 0040, 0217, 0274, 0254, 0345, 0303, 0231, 0266, 
+  0271, 0143, 0347, 0253, 0101, 0264, 0007, 0321, 0265, 0021, 0270, 0105, 0213, 0022, 0135, 0272, 
+  0146, 0201, 0206, 0256, 0204, 0346, 0236, 0174, 0356, 0221, 0356, 0121, 0103, 0076, 0173, 0077, 
+  0153, 0366, 0071, 0317, 0342, 0065, 0161, 0300, 0032, 0107, 0232, 0176, 0164, 0115, 0254, 0277, 
+  0006, 0327, 0360, 0036, 0262, 0065, 0146, 0062, 0366, 0071, 0077, 0225, 0373, 0310, 0152, 0177, 
+  0121, 0254, 0260, 0324, 0276, 0121, 0135, 0151, 0347, 0367, 0032, 0072, 0233, 0220, 0153, 0364, 
+  0035, 0312, 0075, 0122, 0312, 0135, 0062, 0324, 0260, 0123, 0252, 0000, 0225, 0070, 0113, 0225, 
+  0303, 0224, 0260, 0130, 0075, 0046, 0373, 0355, 0341, 0341, 0356, 0333, 0307, 0246, 0353, 0246, 
+  0024, 0141, 0350, 0364, 0252, 0162, 0260, 0365, 0235, 0111, 0345, 0004, 0127, 0215, 0344, 0224, 
+  0020, 0135, 0173, 0262, 0153, 0335, 0244, 0250, 0100, 0172, 0245, 0162, 0121, 0031, 0364, 0112, 
+  0064, 0343, 0145, 0040, 0257, 0211, 0336, 0323, 0260, 0120, 0334, 0206, 0350, 0010, 0054, 0302, 
+  0147, 0220, 0150, 0112, 0052, 0241, 0244, 0207, 0360, 0121, 0055, 0017, 0202, 0001, 0131, 0010, 
+  0127, 0035, 0071, 0205, 0376, 0237, 0041, 0246, 0101, 0250, 0032, 0204, 0203, 0156, 0203, 0360, 
+  0236, 0321, 0105, 0160, 0303, 0306, 0027, 0304, 0342, 0120, 0224, 0241, 0360, 0306, 0070, 0154, 
+  0263, 0214, 0022, 0030, 0272, 0125, 0237, 0015, 0175, 0221, 0141, 0075, 0074, 0126, 0130, 0353, 
+  0153, 0153, 0307, 0352, 0156, 0356, 0373, 0021, 0004, 0204, 0207, 0311, 0123, 0101, 0073, 0242, 
+  0263, 0205, 0164, 0243, 0326, 0104, 0273, 0366, 0104, 0323, 0314, 0133, 0334, 0246, 0350, 0274, 
+  0324, 0251, 0331, 0262, 0250, 0346, 0245, 0162, 0241, 0030, 0236, 0155, 0045, 0245, 0250, 0314, 
+  0205, 0052, 0335, 0130, 0123, 0360, 0205, 0346, 0176, 0154, 0263, 0172, 0132, 0354, 0105, 0076, 
+  0254, 0323, 0213, 0120, 0240, 0371, 0252, 0022, 0144, 0165, 0222, 0124, 0106, 0224, 0152, 0310, 
+  0122, 0111, 0217, 0242, 0042, 0151, 0126, 0322, 0203, 0212, 0061, 0127, 0241, 0153, 0161, 0062, 
+  0220, 0153, 0332, 0174, 0320, 0070, 0150, 0213, 0203, 0376, 0311, 0342, 0300, 0166, 0021, 0041, 
+  0340, 0135, 0012, 0367, 0174, 0015, 0315, 0125, 0313, 0075, 0011, 0037, 0152, 0320, 0035, 0013, 
+  0164, 0203, 0223, 0007, 0235, 0046, 0037, 0215, 0203, 0366, 0070, 0030, 0276, 0005, 0016, 0364, 
+  0205, 0270, 0256, 0064, 0073, 0165, 0311, 0335, 0044, 0003, 0123, 0231, 0200, 0155, 0001, 0316, 
+  0124, 0340, 0045, 0134, 0214, 0372, 0331, 0131, 0155, 0074, 0112, 0253, 0025, 0213, 0240, 0244, 
+  0107, 0165, 0035, 0256, 0353, 0360, 0006, 0100, 0324, 0212, 0110, 0303, 0341, 0104, 0313, 0161, 
+  0175, 0017, 0206, 0276, 0116, 0246, 0326, 0207, 0372, 0176, 0146, 0351, 0247, 0367, 0372, 0147, 
+  0075, 0252, 0164, 0074, 0072, 0376, 0003, 0313, 0165, 0176, 0237, 0270, 0024, 0043, 0345, 0277, 
+  0257, 0234, 0264, 0061, 0361, 0346, 0010, 0331, 0301, 0342, 0221, 0156, 0345, 0373, 0031, 0211, 
+  0227, 0015, 0006, 0334, 0247, 0204, 0313, 0335, 0130, 0375, 0276, 0071, 0011, 0177, 0345, 0135, 
+  0156, 0047, 0061, 0252, 0174, 0356, 0160, 0067, 0165, 0220, 0071, 0365, 0340, 0305, 0355, 0146, 
+  0342, 0133, 0117, 0053, 0247, 0007, 0374, 0037, 0334, 0062, 0272, 0362, 0043, 0221, 0224, 0372, 
+  0241, 0363, 0005, 0241, 0014, 0054, 0027, 0073, 0016, 0220, 0154, 0267, 0217, 0016, 0055, 0217, 
+  0266, 0035, 0055, 0260, 0173, 0006, 0114, 0057, 0373, 0375, 0304, 0043, 0305, 0162, 0306, 0044, 
+  0277, 0012, 0236, 0067, 0350, 0365, 0211, 0252, 0071, 0043, 0342, 0167, 0164, 0347, 0014, 0111, 
+  0136, 0071, 0315, 0031, 0224, 0131, 0353, 0365, 0166, 0047, 0320, 0051, 0327, 0157, 0345, 0157, 
+  0261, 0347, 0213, 0206, 0044, 0276, 0075, 0134, 0350, 0325, 0242, 0021, 0211, 0113, 0143, 0035, 
+  0364, 0123, 0362, 0311, 0376, 0071, 0106, 0304, 0037, 0147, 0224, 0063, 0344, 0340, 0153, 0243, 
+  0171, 0336, 0210, 0337, 0305, 0231, 0027, 0141, 0211, 0213, 0050, 0035, 0166, 0131, 0321, 0261, 
+  0307, 0236, 0134, 0123, 0346, 0260, 0302, 0350, 0331, 0337, 0152, 0127, 0342, 0254, 0012, 0341, 
+  0065, 0352, 0141, 0042, 0200, 0315, 0221, 0015, 0223, 0167, 0377, 0003, 0315, 0112, 0304, 0153, 
+  0000, 0050, 0165, 0165, 0141, 0171, 0051, 0157, 0162, 0147, 0057, 0000, 0000, 0000, 0000, 0000, 
+  0057, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0156, 0145, 0164, 0163, 0160, 0145, 0145, 0144, 
+  0057, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0156, 0145, 0164, 0163, 0160, 0145, 0145, 0144, 0055, 0155, 0145, 0156, 0165, 0056, 0170, 0155, 
+  0154, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0055, 0001, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0205, 0314, 0073, 0012, 0200, 0060, 0020, 0204, 0341, 0336, 0123, 0004, 0057, 0340, 
+  0005, 0242, 0040, 0130, 0130, 0211, 0127, 0130, 0165, 0212, 0205, 0074, 0226, 0144, 0275, 0277, 
+  0212, 0026, 0066, 0321, 0162, 0370, 0207, 0317, 0172, 0204, 0235, 0025, 0336, 0004, 0362, 0150, 
+  0353, 0011, 0232, 0005, 0330, 0172, 0021, 0007, 0035, 0240, 0304, 0056, 0327, 0206, 0126, 0345, 
+  0030, 0212, 0271, 0351, 0052, 0233, 0041, 0224, 0110, 0143, 0272, 0306, 0247, 0072, 0247, 0050, 
+  0110, 0312, 0050, 0302, 0357, 0307, 0057, 0067, 0302, 0111, 0011, 0272, 0333, 0057, 0321, 0057, 
+  0161, 0327, 0222, 0361, 0304, 0023, 0071, 0000, 0305, 0011, 0154, 0303, 0000, 0050, 0165, 0165, 
+  0141, 0171, 0051, 0155, 0141, 0164, 0145, 0055, 0141, 0160, 0160, 0154, 0145, 0164, 0163, 0057, 
+  0004, 0000, 0000, 0000, 0156, 0145, 0164, 0163, 0160, 0145, 0145, 0144, 0055, 0160, 0162, 0145, 
+  0146, 0145, 0162, 0145, 0156, 0143, 0145, 0163, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 0000, 
+  0101, 0063, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0133, 0113, 0163, 0333, 0066, 
+  0020, 0276, 0373, 0127, 0240, 0070, 0364, 0322, 0201, 0025, 0311, 0115, 0046, 0323, 0112, 0314, 
+  0244, 0156, 0235, 0146, 0246, 0355, 0144, 0046, 0356, 0131, 0003, 0021, 0053, 0021, 0065, 0004, 
+  0060, 0000, 0150, 0111, 0377, 0276, 0040, 0051, 0271, 0222, 0005, 0276, 0104, 0052, 0221, 0073, 
+  0074, 0231, 0026, 0261, 0213, 0335, 0005, 0276, 0335, 0017, 0017, 0216, 0337, 0255, 0227, 0002, 
+  0075, 0202, 0066, 0134, 0311, 0011, 0036, 0136, 0277, 0302, 0010, 0144, 0250, 0030, 0227, 0213, 
+  0011, 0376, 0373, 0376, 0216, 0274, 0305, 0357, 0202, 0253, 0361, 0167, 0204, 0240, 0017, 0040, 
+  0101, 0123, 0013, 0014, 0255, 0270, 0215, 0320, 0102, 0120, 0006, 0350, 0346, 0372, 0346, 0355, 
+  0365, 0010, 0021, 0342, 0032, 0161, 0151, 0101, 0317, 0151, 0010, 0301, 0025, 0102, 0143, 0015, 
+  0137, 0022, 0256, 0301, 0040, 0301, 0147, 0023, 0274, 0260, 0017, 0077, 0340, 0377, 0072, 0272, 
+  0271, 0036, 0215, 0360, 0040, 0153, 0247, 0146, 0377, 0100, 0150, 0121, 0050, 0250, 0061, 0023, 
+  0374, 0301, 0076, 0174, 0134, 0322, 0005, 0140, 0304, 0331, 0004, 0363, 0364, 0161, 0210, 0323, 
+  0166, 0256, 0145, 0254, 0125, 0014, 0332, 0156, 0220, 0244, 0113, 0230, 0340, 0107, 0156, 0370, 
+  0114, 0000, 0016, 0356, 0165, 0002, 0343, 0301, 0356, 0255, 0277, 0161, 0110, 0045, 0231, 0253, 
+  0060, 0061, 0070, 0270, 0243, 0302, 0124, 0266, 0347, 0241, 0222, 0044, 0175, 0304, 0101, 0004, 
+  0042, 0046, 0063, 0255, 0126, 0006, 0364, 0241, 0330, 0170, 0220, 0033, 0137, 0317, 0217, 0321, 
+  0067, 0366, 0143, 0305, 0045, 0123, 0053, 0022, 0012, 0365, 0134, 0354, 0300, 0017, 0013, 0313, 
+  0130, 0270, 0141, 0336, 0171, 0362, 0027, 0130, 0023, 0003, 0260, 0117, 0032, 0346, 0240, 0335, 
+  0344, 0000, 0203, 0121, 0114, 0335, 0223, 0315, 0334, 0374, 0225, 0123, 0241, 0026, 0270, 0033, 
+  0163, 0147, 0112, 0063, 0320, 0144, 0305, 0231, 0215, 0160, 0060, 0034, 0125, 0265, 0267, 0334, 
+  0272, 0310, 0041, 0253, 0251, 0064, 0316, 0150, 0352, 0342, 0070, 0301, 0033, 0147, 0141, 0360, 
+  0347, 0373, 0373, 0337, 0320, 0316, 0166, 0264, 0147, 0174, 0225, 0112, 0006, 0306, 0152, 0265, 
+  0041, 0351, 0044, 0047, 0271, 0237, 0365, 0206, 0146, 0057, 0324, 0113, 0027, 0077, 0042, 0267, 
+  0235, 0023, 0032, 0307, 0002, 0154, 0245, 0053, 0233, 0030, 0110, 0304, 0323, 0336, 0130, 0026, 
+  0322, 0043, 0201, 0060, 0342, 0202, 0241, 0014, 0145, 0222, 0012, 0222, 0375, 0353, 0246, 0317, 
+  0114, 0255, 0267, 0321, 0367, 0315, 0302, 0137, 0366, 0336, 0066, 0037, 0037, 0237, 0214, 0322, 
+  0334, 0305, 0204, 0132, 0007, 0144, 0034, 0070, 0104, 0133, 0036, 0122, 0121, 0107, 0320, 0304, 
+  0064, 0164, 0171, 0005, 0007, 0043, 0157, 0153, 0277, 0173, 0064, 0114, 0073, 0232, 0272, 0161, 
+  0240, 0173, 0176, 0170, 0075, 0115, 0254, 0125, 0362, 0320, 0337, 0123, 0175, 0366, 0311, 0011, 
+  0272, 0121, 0211, 0045, 0306, 0156, 0122, 0260, 0202, 0144, 0205, 0202, 0231, 0351, 0207, 0277, 
+  0025, 0033, 0234, 0147, 0210, 0131, 0366, 0074, 0304, 0317, 0245, 0174, 0146, 0314, 0100, 0170, 
+  0247, 0374, 0364, 0167, 0227, 0251, 0212, 0214, 0152, 0234, 0171, 0152, 0206, 0260, 0251, 0250, 
+  0206, 0020, 0370, 0043, 0030, 0302, 0140, 0116, 0023, 0141, 0233, 0153, 0310, 0222, 0051, 0016, 
+  0362, 0332, 0320, 0104, 0060, 0061, 0100, 0022, 0351, 0362, 0213, 0340, 0362, 0004, 0247, 0251, 
+  0130, 0321, 0215, 0041, 0046, 0162, 0111, 0164, 0153, 0103, 0271, 0212, 0375, 0264, 0172, 0250, 
+  0230, 0206, 0017, 0016, 0010, 0325, 0135, 0302, 0072, 0246, 0222, 0065, 0067, 0165, 0316, 0205, 
+  0150, 0056, 0025, 0053, 0303, 0163, 0124, 0277, 0052, 0163, 0312, 0153, 0375, 0170, 0340, 0231, 
+  0364, 0247, 0003, 0141, 0324, 0016, 0010, 0267, 0307, 0065, 0356, 0362, 0220, 0220, 0212, 0236, 
+  0014, 0202, 0210, 0266, 0100, 0120, 0267, 0030, 0034, 0365, 0030, 0074, 0007, 0006, 0207, 0135, 
+  0140, 0320, 0347, 0276, 0337, 0365, 0042, 0267, 0033, 0225, 0310, 0334, 0347, 0106, 0042, 0225, 
+  0111, 0307, 0343, 0354, 0221, 0243, 0307, 0211, 0346, 0070, 0311, 0334, 0351, 0214, 0232, 0135, 
+  0265, 0116, 0003, 0335, 0361, 0011, 0227, 0277, 0310, 0232, 0012, 0276, 0050, 0113, 0271, 0107, 
+  0054, 0052, 0242, 0051, 0215, 0117, 0351, 0042, 0016, 0244, 0222, 0320, 0226, 0206, 0274, 0117, 
+  0015, 0130, 0146, 0064, 0367, 0253, 0344, 0311, 0322, 0040, 0171, 0003, 0005, 0163, 0353, 0230, 
+  0070, 0143, 0031, 0171, 0034, 0226, 0347, 0033, 0257, 0323, 0165, 0250, 0161, 0047, 0156, 0267, 
+  0165, 0275, 0172, 0115, 0364, 0272, 0251, 0170, 0155, 0272, 0136, 0072, 0351, 0166, 0324, 0375, 
+  0115, 0245, 0144, 0341, 0000, 0064, 0035, 0204, 0326, 0003, 0321, 0305, 0140, 0224, 0006, 0243, 
+  0174, 0052, 0326, 0213, 0210, 0077, 0052, 0177, 0144, 0334, 0246, 0114, 0246, 0203, 0330, 0164, 
+  0025, 0037, 0077, 0077, 0311, 0323, 0232, 0261, 0124, 0333, 0123, 0225, 0024, 0063, 0074, 0267, 
+  0260, 0137, 0051, 0375, 0200, 0246, 0014, 0036, 0171, 0010, 0077, 0235, 0332, 0103, 0103, 0072, 
+  0122, 0246, 0152, 0051, 0141, 0251, 0044, 0017, 0123, 0240, 0056, 0300, 0045, 0123, 0231, 0333, 
+  0270, 0065, 0161, 0032, 0252, 0345, 0114, 0325, 0123, 0136, 0104, 0132, 0352, 0021, 0230, 0326, 
+  0125, 0275, 0033, 0146, 0323, 0172, 0245, 0121, 0203, 0361, 0124, 0256, 0100, 0332, 0342, 0360, 
+  0066, 0035, 0064, 0227, 0242, 0356, 0141, 0155, 0363, 0365, 0211, 0157, 0124, 0137, 0024, 0120, 
+  0215, 0303, 0045, 0025, 0073, 0055, 0021, 0225, 0013, 0140, 0030, 0271, 0277, 0114, 0200, 0166, 
+  0345, 0102, 0116, 0175, 0056, 0116, 0237, 0132, 0232, 0025, 0215, 0143, 0110, 0043, 0241, 0362, 
+  0035, 0334, 0176, 0026, 0007, 0303, 0257, 0065, 0213, 0253, 0142, 0132, 0035, 0317, 0326, 0261, 
+  0154, 0027, 0307, 0126, 0231, 0240, 0042, 0176, 0245, 0261, 0153, 0312, 0113, 0156, 0043, 0010, 
+  0017, 0066, 0046, 0322, 0065, 0347, 0324, 0044, 0113, 0207, 0004, 0367, 0046, 0337, 0246, 0150, 
+  0300, 0134, 0212, 0153, 0331, 0147, 0247, 0030, 0245, 0232, 0021, 0227, 0306, 0002, 0145, 0110, 
+  0315, 0335, 0043, 0372, 0236, 0056, 0343, 0237, 0221, 0112, 0354, 0051, 0161, 0355, 0222, 0050, 
+  0235, 0252, 0342, 0170, 0233, 0341, 0344, 0111, 0326, 0230, 0116, 0164, 0124, 0350, 0217, 0016, 
+  0007, 0064, 0135, 0021, 0056, 0231, 0343, 0320, 0126, 0351, 0272, 0172, 0376, 0307, 0250, 0035, 
+  0276, 0004, 0324, 0316, 0270, 0065, 0147, 0202, 0155, 0252, 0172, 0037, 0267, 0263, 0215, 0075, 
+  0076, 0142, 0352, 0001, 0333, 0003, 0366, 0122, 0000, 0073, 0272, 0160, 0300, 0346, 0074, 0163, 
+  0232, 0036, 0246, 0166, 0016, 0331, 0351, 0155, 0246, 0034, 0245, 0312, 0021, 0015, 0103, 0245, 
+  0323, 0055, 0045, 0144, 0025, 0262, 0021, 0040, 0003, 0302, 0331, 0006, 0014, 0345, 0274, 0267, 
+  0007, 0161, 0017, 0342, 0113, 0005, 0361, 0315, 0113, 0250, 0272, 0147, 0201, 0160, 0136, 0165, 
+  0123, 0325, 0075, 0076, 0173, 0174, 0136, 0052, 0076, 0177, 0174, 0011, 0370, 0374, 0222, 0270, 
+  0351, 0143, 0067, 0147, 0304, 0351, 0166, 0253, 0151, 0327, 0123, 0136, 0167, 0347, 0112, 0243, 
+  0025, 0327, 0256, 0330, 0032, 0263, 0055, 0265, 0075, 0141, 0356, 0261, 0174, 0261, 0130, 0176, 
+  0375, 0022, 0260, 0114, 0205, 0230, 0122, 0306, 0264, 0303, 0024, 0234, 0151, 0251, 0353, 0272, 
+  0100, 0323, 0217, 0237, 0320, 0123, 0067, 0310, 0201, 0331, 0052, 0045, 0054, 0217, 0173, 0374, 
+  0366, 0370, 0275, 0124, 0374, 0276, 0071, 0047, 0176, 0213, 0343, 0126, 0040, 0344, 0027, 0050, 
+  0271, 0075, 0207, 0322, 0213, 0036, 0073, 0160, 0126, 0137, 0346, 0050, 0072, 0070, 0276, 0210, 
+  0213, 0034, 0265, 0061, 0122, 0077, 0065, 0345, 0037, 0045, 0010, 0364, 0031, 0254, 0165, 0003, 
+  0130, 0312, 0044, 0306, 0324, 0132, 0315, 0135, 0136, 0004, 0343, 0035, 0313, 0247, 0327, 0333, 
+  0136, 0127, 0300, 0027, 0221, 0305, 0350, 0221, 0212, 0044, 0273, 0207, 0041, 0230, 0357, 0304, 
+  0153, 0074, 0050, 0326, 0133, 0173, 0270, 0277, 0311, 0105, 0255, 0046, 0267, 0234, 0052, 0267, 
+  0174, 0253, 0357, 0151, 0035, 0372, 0170, 0360, 0162, 0234, 0137, 0363, 0336, 0236, 0235, 0077, 
+  0205, 0361, 0360, 0147, 0344, 0352, 0116, 0254, 0244, 0161, 0326, 0220, 0341, 0020, 0007, 0333, 
+  0073, 0323, 0056, 0376, 0373, 0255, 0252, 0145, 0157, 0166, 0242, 0043, 0257, 0350, 0263, 0037, 
+  0115, 0376, 0205, 0304, 0356, 0263, 0210, 0340, 0152, 0074, 0330, 0373, 0320, 0345, 0137, 0265, 
+  0200, 0073, 0236, 0000, 0050, 0165, 0165, 0141, 0171, 0051
+} };
+
+static GStaticResource static_resource = { netspeed_resource_data.data, sizeof (netspeed_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *netspeed_get_resource (void);
+GResource *netspeed_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * 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.1 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/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CONSTRUCTOR_H__
+#define __G_CONSTRUCTOR_H__
+
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+/*
+ * Only try to include gslist.h if not already included via glib.h,
+ * so that items using gconstructor.h outside of GLib (such as
+ * GResources) continue to build properly.
+ */
+#ifndef __G_LIB_H__
+#include "gslist.h"
+#endif
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+#endif /* __G_CONSTRUCTOR_H__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(netspeedresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(netspeedresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(netspeedresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(netspeedresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void netspeedresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void netspeedresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/129.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/129.html new file mode 100644 index 00000000..e48bf60c --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/129.html @@ -0,0 +1,3777 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+1545
+1546
+1547
+1548
+1549
+1550
+1551
+1552
+1553
+1554
+1555
+1556
+1557
+1558
+1559
+1560
+1561
+1562
+1563
+1564
+1565
+1566
+1567
+1568
+1569
+1570
+1571
+1572
+1573
+1574
+1575
+1576
+1577
+1578
+1579
+1580
+1581
+1582
+1583
+1584
+1585
+1586
+1587
+1588
+1589
+1590
+1591
+1592
+1593
+1594
+1595
+1596
+1597
+1598
+1599
+1600
+1601
+1602
+1603
+1604
+1605
+1606
+1607
+1608
+1609
+1610
+1611
+1612
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+1631
+1632
+1633
+1634
+1635
+1636
+1637
+1638
+1639
+1640
+1641
+1642
+1643
+1644
+1645
+1646
+1647
+1648
+1649
+1650
+1651
+1652
+1653
+1654
+1655
+1656
+1657
+1658
+1659
+1660
+1661
+1662
+1663
+1664
+1665
+1666
+1667
+1668
+1669
+1670
+1671
+1672
+1673
+1674
+1675
+1676
+1677
+1678
+1679
+1680
+1681
+1682
+1683
+1684
+1685
+1686
+1687
+1688
+1689
+1690
+1691
+1692
+1693
+1694
+1695
+1696
+1697
+1698
+1699
+1700
+1701
+1702
+1703
+1704
+1705
+1706
+1707
+1708
+1709
+1710
+1711
+1712
+1713
+1714
+1715
+1716
+1717
+1718
+1719
+1720
+1721
+1722
+1723
+1724
+1725
+1726
+1727
+1728
+1729
+1730
+1731
+1732
+1733
+1734
+1735
+1736
+1737
+1738
+1739
+1740
+1741
+1742
+1743
+1744
+1745
+1746
+1747
+1748
+1749
+1750
+1751
+1752
+1753
+1754
+1755
+1756
+1757
+1758
+1759
+1760
+1761
+1762
+1763
+1764
+1765
+1766
+1767
+1768
+1769
+1770
 /*  netspeed.c
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Netspeed Applet was writen by Jörgen Scheibengruber <mfcn@gmx.de>
+ *
+ *  MATE Netspeed Applet migrated by Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"<--- Include file: "config.h" not found.
+#endif
+
+#include <math.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet-gsettings.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "backend.h"
+#include "netspeed-preferences.h"
+
+#include "netspeed.h"
+
+#define GET_COLOR_CHOOSER(x) (GTK_COLOR_CHOOSER (gtk_builder_get_object (builder, (x))))
+#define GET_DRAWING_AREA(x) (GTK_DRAWING_AREA (gtk_builder_get_object (builder, (x))))
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
+
+ /* Icons for the interfaces */
+static const char* const dev_type_icon [DEV_UNKNOWN + 1] = {
+    /* FIXME: Need an actual loopback icon... */
+    "reload",                    /* DEV_LO */
+    "network-wired",             /* DEV_ETHERNET */
+    "network-wireless",          /* DEV_WIRELESS */
+    "modem",                     /* DEV_PPP */
+    "mate-netspeed-plip",        /* DEV_PLIP */
+    "mate-netspeed-plip",        /* DEV_SLIP */
+    "network-workgroup",         /* DEV_UNKNOWN */
+};
+
+static const char* wireless_quality_icon [] = {
+    "mate-netspeed-wireless-25",
+    "mate-netspeed-wireless-50",
+    "mate-netspeed-wireless-75",
+    "mate-netspeed-wireless-100"
+};
+
+static const char IN_ICON[] = "go-down";
+static const char OUT_ICON[] = "go-up";
+static const char ERROR_ICON[] = "gtk-dialog-error";
+static const char LOGO_ICON[] = "mate-netspeed-applet";
+
+/* How many old in out values do we store?
+ * The value actually shown in the applet is the average
+ * of these values -> prevents the value from
+ * "jumping around like crazy"
+ */
+#define OLD_VALUES          5
+#define OLD_VALUES_DBL      5.0
+#define GRAPH_VALUES      180
+#define GRAPH_LINES         4
+#define REFRESH_TIME     1000
+
+/* A struct containing all the "global" data of the
+ * applet
+ */
+struct _NetspeedApplet
+{
+    MatePanelApplet  parent;
+
+    GtkWidget       *box;
+    GtkWidget       *pix_box;
+    GtkWidget       *speed_box;
+    GtkWidget       *in_box;
+    GtkWidget       *in_label;
+    GtkWidget       *in_pix;
+    GtkWidget       *out_box;
+    GtkWidget       *out_label;
+    GtkWidget       *out_pix;
+    GtkWidget       *sum_box;
+    GtkWidget       *sum_label;
+    GtkWidget       *dev_pix;
+    GtkWidget       *qual_pix;
+    cairo_surface_t *qual_surfaces[4];
+    gboolean         labels_dont_shrink;
+    DevInfo         *devinfo;
+    gboolean         device_has_changed;
+    guint            timeout_id;
+    char            *up_cmd;
+    char            *down_cmd;
+    gboolean         show_all_addresses;
+    gboolean         show_sum;
+    gboolean         show_bits;
+    gboolean         change_icon;
+    gboolean         auto_change_device;
+    gboolean         show_icon;
+    gboolean         show_quality_icon;
+    GdkRGBA          in_color;
+    GdkRGBA          out_color;
+    int              width;
+    /* details dialog */
+    GtkWidget       *details;
+    GtkDrawingArea  *drawingarea;
+    GtkWidget       *ip_text;
+    GtkWidget       *netmask_text;
+    GtkWidget       *ptpip_text;
+    GtkWidget       *ipv6_text;
+    GtkWidget       *hwaddr_text;
+    GtkWidget       *inbytes_text;
+    GtkWidget       *outbytes_text;
+    GtkWidget       *essid_text;
+    GtkWidget       *signalbar;
+#ifdef HAVE_NL
+    GtkWidget       *station_text;
+    GtkWidget       *channel_text;
+    GtkWidget       *connected_time_text;
+#endif
+    GtkWidget       *ipv6_box;
+    GtkWidget       *netlink_box;
+    GtkWidget       *wireless_box;
+    /* settings dialog */
+    GtkWidget       *preferences;
+
+    guint            index_old;
+    guint64          in_old [OLD_VALUES];
+    guint64          out_old [OLD_VALUES];
+    double           max_graph;
+    double           in_graph [GRAPH_VALUES];
+    double           out_graph [GRAPH_VALUES];
+    int              index_graph;
+    GtkWidget       *connect_dialog;
+    gboolean         show_tooltip;
+    GtkIconTheme    *icon_theme;
+    GSettings       *settings;
+};
+
+G_DEFINE_TYPE (NetspeedApplet, netspeed_applet, PANEL_TYPE_APPLET)
+
+static void
+update_tooltip (NetspeedApplet *netspeed);
+
+GSettings *
+netspeed_applet_get_settings (NetspeedApplet *netspeed)
+{
+    return netspeed->settings;
+}
+
+const gchar *
+netspeed_applet_get_current_device_name (NetspeedApplet *netspeed)
+{
+    return netspeed->devinfo->name;
+}
+
+/* Adds a Pango markup "foreground" to a bytestring
+ */
+static void
+add_markup_fgcolor (char       **string,
+                    const char  *color)
+{
+    char *tmp = *string;
+
+    *string = g_strdup_printf ("<span foreground=\"%s\">%s</span>", color, tmp);
+    g_free (tmp);
+}
+
+/* Change the icons according to the selected device
+ */
+static void
+change_icons (NetspeedApplet *netspeed)
+{
+    cairo_surface_t *dev, *down;
+    cairo_surface_t *in_arrow, *out_arrow;
+    gint icon_scale;
+    gint icon_size = mate_panel_applet_get_size (MATE_PANEL_APPLET (netspeed)) - 8;
+
+    /* FIXME: Not all network icons include a high enough resolution, so to make them all
+     * consistent, we cap them at 48px.*/
+    icon_size = CLAMP (icon_size, 16, 48);
+
+    icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (netspeed));
+
+    /* If the user wants a different icon than current, we load it */
+    if (netspeed->show_icon && netspeed->change_icon && netspeed->devinfo) {
+        dev = gtk_icon_theme_load_surface (netspeed->icon_theme,
+                                           dev_type_icon [netspeed->devinfo->type],
+                                           icon_size, icon_scale, NULL, 0, NULL);
+    } else {
+        dev = gtk_icon_theme_load_surface (netspeed->icon_theme,
+                                           dev_type_icon [DEV_UNKNOWN],
+                                           icon_size, icon_scale, NULL, 0, NULL);
+    }
+
+    /* We need a fallback */
+    if (dev == NULL)
+        dev = gtk_icon_theme_load_surface (netspeed->icon_theme,
+                                           dev_type_icon [DEV_UNKNOWN],
+                                           icon_size, icon_scale, NULL, 0, NULL);
+
+    in_arrow = gtk_icon_theme_load_surface (netspeed->icon_theme,
+                                            IN_ICON,
+                                            16, icon_scale, NULL, 0, NULL);
+
+    out_arrow = gtk_icon_theme_load_surface (netspeed->icon_theme,
+                                             OUT_ICON,
+                                             16, icon_scale, NULL, 0, NULL);
+
+    /* Set the windowmanager icon for the applet */
+    gtk_window_set_default_icon_name (LOGO_ICON);
+
+    gtk_image_set_from_surface (GTK_IMAGE (netspeed->out_pix), out_arrow);
+    gtk_image_set_from_surface (GTK_IMAGE (netspeed->in_pix), in_arrow);
+    cairo_surface_destroy (in_arrow);
+    cairo_surface_destroy (out_arrow);
+
+    if (netspeed->devinfo && netspeed->devinfo->running) {
+        gtk_widget_show (netspeed->in_box);
+        gtk_widget_show (netspeed->out_box);
+    } else {
+        cairo_t *cr;
+        cairo_surface_t *copy;
+        gint down_coords;
+
+        gtk_widget_hide (netspeed->in_box);
+        gtk_widget_hide (netspeed->out_box);
+
+        /* We're not allowed to modify "dev" */
+        copy = cairo_surface_create_similar (dev,
+                                             cairo_surface_get_content (dev),
+                                             cairo_image_surface_get_width (dev) / icon_scale,
+                                             cairo_image_surface_get_height (dev) / icon_scale);
+        cr = cairo_create (copy);
+        cairo_set_source_surface (cr, dev, 0, 0);
+        cairo_paint (cr);
+
+        down = gtk_icon_theme_load_surface (netspeed->icon_theme,
+                                            ERROR_ICON,
+                                            icon_size, icon_scale, NULL, 0, NULL);
+
+        down_coords = cairo_image_surface_get_width (copy) / icon_scale;
+        cairo_scale (cr, 0.5, 0.5);
+        cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+        cairo_set_source_surface (cr, down, down_coords, down_coords);
+        cairo_paint (cr);
+
+        cairo_surface_destroy (down);
+        cairo_surface_destroy (dev);
+        dev = copy;
+    }
+
+    if (netspeed->show_icon) {
+        gtk_widget_show (netspeed->dev_pix);
+        gtk_image_set_from_surface (GTK_IMAGE (netspeed->dev_pix), dev);
+    } else {
+        gtk_widget_hide (netspeed->dev_pix);
+    }
+
+    cairo_surface_destroy (dev);
+}
+
+/* Here some rearangement of the icons and the labels occurs
+ * according to the panelsize and wether we show in and out
+ * or just the sum
+ */
+static void
+applet_change_size_or_orient (MatePanelApplet *applet,
+                              int              arg1,
+                              NetspeedApplet  *netspeed)
+{
+    int size;
+    MatePanelAppletOrient orient;
+
+    g_assert (netspeed);
+
+    size = mate_panel_applet_get_size (applet);
+    orient = mate_panel_applet_get_orient (applet);
+
+    g_object_ref (netspeed->pix_box);
+    g_object_ref (netspeed->in_pix);
+    g_object_ref (netspeed->in_label);
+    g_object_ref (netspeed->out_pix);
+    g_object_ref (netspeed->out_label);
+    g_object_ref (netspeed->sum_label);
+
+    if (netspeed->in_box) {
+        gtk_container_remove (GTK_CONTAINER (netspeed->in_box), netspeed->in_label);
+        gtk_container_remove (GTK_CONTAINER (netspeed->in_box), netspeed->in_pix);
+        gtk_widget_destroy (netspeed->in_box);
+    }
+    if (netspeed->out_box) {
+        gtk_container_remove (GTK_CONTAINER (netspeed->out_box), netspeed->out_label);
+        gtk_container_remove (GTK_CONTAINER (netspeed->out_box), netspeed->out_pix);
+        gtk_widget_destroy (netspeed->out_box);
+    }
+    if (netspeed->sum_box) {
+        gtk_container_remove (GTK_CONTAINER (netspeed->sum_box), netspeed->sum_label);
+        gtk_widget_destroy (netspeed->sum_box);
+    }
+    if (netspeed->box) {
+        gtk_container_remove (GTK_CONTAINER (netspeed->box), netspeed->pix_box);
+        gtk_widget_destroy (netspeed->box);
+    }
+
+    if (orient == MATE_PANEL_APPLET_ORIENT_LEFT || orient == MATE_PANEL_APPLET_ORIENT_RIGHT) {
+        netspeed->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+        netspeed->speed_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+        if (size > 64) {
+            netspeed->sum_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
+            netspeed->in_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 1);
+            netspeed->out_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 1);
+        } else {
+            netspeed->sum_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+            netspeed->in_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+            netspeed->out_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+        }
+        netspeed->labels_dont_shrink = FALSE;
+    } else {
+        netspeed->in_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 1);
+        netspeed->out_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 1);
+        netspeed->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 1);
+        netspeed->sum_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
+        if (size < 48) {
+            netspeed->speed_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 1);
+            netspeed->labels_dont_shrink = TRUE;
+        } else {
+            netspeed->speed_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+            netspeed->labels_dont_shrink = !netspeed->show_sum;
+        }
+    }
+
+    gtk_box_pack_start (GTK_BOX (netspeed->in_box), netspeed->in_pix, FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (netspeed->in_box), netspeed->in_label, TRUE, TRUE, 0);
+    gtk_box_pack_start (GTK_BOX (netspeed->out_box), netspeed->out_pix, FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (netspeed->out_box), netspeed->out_label, TRUE, TRUE, 0);
+    gtk_box_pack_start (GTK_BOX (netspeed->sum_box), netspeed->sum_label, TRUE, TRUE, 0);
+    gtk_box_pack_start (GTK_BOX (netspeed->box), netspeed->pix_box, FALSE, FALSE, 0);
+
+    g_object_unref (netspeed->pix_box);
+    g_object_unref (netspeed->in_pix);
+    g_object_unref (netspeed->in_label);
+    g_object_unref (netspeed->out_pix);
+    g_object_unref (netspeed->out_label);
+    g_object_unref (netspeed->sum_label);
+
+    if (netspeed->show_sum) {
+        gtk_box_pack_start (GTK_BOX (netspeed->speed_box), netspeed->sum_box, TRUE, TRUE, 0);
+    } else {
+        gtk_box_pack_start (GTK_BOX (netspeed->speed_box), netspeed->in_box, TRUE, TRUE, 0);
+        gtk_box_pack_start (GTK_BOX (netspeed->speed_box), netspeed->out_box, TRUE, TRUE, 0);
+    }
+    gtk_box_pack_start (GTK_BOX (netspeed->box), netspeed->speed_box, TRUE, TRUE, 0);
+
+    gtk_widget_show_all (netspeed->box);
+    if (!netspeed->show_icon) {
+        gtk_widget_hide (netspeed->dev_pix);
+    }
+    gtk_container_add (GTK_CONTAINER (netspeed), netspeed->box);
+
+    change_icons (netspeed);
+}
+
+/* Change visibility of signal quality icon for wireless devices
+ */
+static void
+change_quality_icon (NetspeedApplet *netspeed)
+{
+    if (netspeed->devinfo->type == DEV_WIRELESS &&
+        netspeed->devinfo->up && netspeed->show_quality_icon) {
+        gtk_widget_show (netspeed->qual_pix);
+    } else {
+        gtk_widget_hide (netspeed->qual_pix);
+    }
+}
+
+static void
+update_quality_icon (NetspeedApplet *netspeed)
+{
+    if (!netspeed->show_quality_icon) {
+        return;
+    }
+
+    unsigned int q;
+
+    q = (netspeed->devinfo->qual);
+    q /= 25;
+    q = MIN (q, 3); /* q out of range would crash when accessing qual_surfaces[q] */
+    gtk_image_set_from_surface (GTK_IMAGE (netspeed->qual_pix), netspeed->qual_surfaces[q]);
+}
+
+static void
+init_quality_surfaces (NetspeedApplet *netspeed)
+{
+    int i;
+    cairo_surface_t *surface;
+    gint icon_scale;
+
+    /* FIXME: Add larger icon files. */
+    gint icon_size = 24;
+
+    icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (netspeed));
+
+    for (i = 0; i < 4; i++) {
+        if (netspeed->qual_surfaces[i])
+            cairo_surface_destroy (netspeed->qual_surfaces[i]);
+
+        surface = gtk_icon_theme_load_surface (netspeed->icon_theme,
+                                               wireless_quality_icon[i],
+                                               icon_size, icon_scale, NULL, 0, NULL);
+
+        if (surface) {
+            cairo_t *cr;
+
+            netspeed->qual_surfaces[i] = cairo_surface_create_similar (surface,
+                                                                     cairo_surface_get_content (surface),
+                                                                     cairo_image_surface_get_width (surface) / icon_scale,
+                                                                     cairo_image_surface_get_height (surface) / icon_scale);
+
+            cr = cairo_create (netspeed->qual_surfaces[i]);
+            cairo_set_source_surface (cr, surface, 0, 0);
+            cairo_paint (cr);
+            cairo_surface_destroy (surface);
+        }
+        else {
+            netspeed->qual_surfaces[i] = NULL;
+        }
+    }
+}
+
+static void
+icon_theme_changed_cb (GtkIconTheme   *icon_theme,
+                       NetspeedApplet *netspeed)
+{
+    init_quality_surfaces (netspeed);
+    if (netspeed->devinfo->type == DEV_WIRELESS && netspeed->devinfo->up)
+        update_quality_icon (netspeed);
+    change_icons (netspeed);
+}
+
+#define IEC_KIBI_DBL  1024.0
+#define IEC_MEBI_DBL  1024.0*1024.0
+#define IEC_GIBI_DBL  1024.0*1024.0*1024.0
+
+static void
+format_transfer_rate (gchar   *out,
+                      double   bytes,
+                      gboolean bits)
+{
+    const char *format;
+    const char *unit;
+
+    if (bits)
+        bytes *= 8.0;
+
+    if (bytes < IEC_KIBI_DBL) {
+        format = "%.0f %s";
+        unit = bits ? /* translators: bits (short) */ N_("bit/s"): /* translators: Bytes (short) */ N_("B/s");
+    } else if (bytes < IEC_MEBI_DBL) {
+        format = (bytes < (100.0 * IEC_KIBI_DBL)) ? "%.1f %s" : "%.0f %s";
+        bytes /= IEC_KIBI_DBL;
+        unit = bits ? /* translators: kibibits (short) */ N_("Kibit/s") : /* translators: Kibibytes (short) */ N_("KiB/s");
+    } else if (bytes < IEC_GIBI_DBL) {
+        format = "%.1f %s";
+        bytes /= IEC_MEBI_DBL;
+        unit = bits ? /* translators: Mebibit (short) */ N_("Mibit/s") : /* translators: Mebibyte (short) */ N_("MiB/s");
+    } else {
+        format = "%.1f %s";
+        bytes /= IEC_GIBI_DBL;
+        unit = bits ? /* translators: Gibibit (short) */ N_("Gibit/s") : /* translators: Gibibyte (short) */ N_("GiB/s");
+    }
+
+    g_snprintf (out, MAX_FORMAT_SIZE, format, bytes, gettext (unit));
+}
+
+/* Converts a number of bytes into a human
+ * readable string - in [M/k]bytes[/s]
+ * The string has to be freed
+ */
+static char*
+bps_to_string (double   bytes,
+               gboolean bits)
+{
+    char res[MAX_FORMAT_SIZE];
+    format_transfer_rate (res, bytes, bits);
+    return g_strdup (res);
+}
+
+/* Redraws the graph drawingarea
+ * Some really black magic is going on in here ;-)
+ */
+static void
+redraw_graph (NetspeedApplet *netspeed,
+              cairo_t        *cr)
+{
+    GtkWidget *da = GTK_WIDGET (netspeed->drawingarea);
+    GtkStyleContext *stylecontext = gtk_widget_get_style_context (da);
+    GdkWindow *real_window = gtk_widget_get_window (da);
+    GdkPoint in_points[GRAPH_VALUES], out_points[GRAPH_VALUES];
+    PangoLayout *layout;
+    PangoRectangle logical_rect;
+    char *text;
+    int i, offset, w, h;
+    double max_val;
+    double dash[2] = { 1.0, 2.0 };
+
+    w = gdk_window_get_width (real_window);
+    h = gdk_window_get_height (real_window);
+
+    /* the graph hight should be: hight/2 <= netspeed->max_graph < hight */
+    for (max_val = 1; max_val < netspeed->max_graph; max_val *= 2) ;
+
+    /* calculate the polygons (GdkPoint[]) for the graphs */
+    offset = 0;
+    for (i = (netspeed->index_graph + 1) % GRAPH_VALUES; netspeed->in_graph[i] < 0; i = (i + 1) % GRAPH_VALUES)
+        offset++;
+    for (i = offset + 1; i < GRAPH_VALUES; i++)
+    {
+        int index = (netspeed->index_graph + i) % GRAPH_VALUES;
+        out_points[i].x = in_points[i].x = ((w - 6) * i) / GRAPH_VALUES + 4;
+        in_points[i].y = h - 6 - (int)((h - 8) * netspeed->in_graph[index] / max_val);
+        out_points[i].y = h - 6 - (int)((h - 8) * netspeed->out_graph[index] / max_val);
+    }
+    in_points[offset].x = out_points[offset].x = ((w - 6) * offset) / GRAPH_VALUES + 4;
+    in_points[offset].y = in_points[(offset + 1) % GRAPH_VALUES].y;
+    out_points[offset].y = out_points[(offset + 1) % GRAPH_VALUES].y;
+
+    /* draw the background */
+    cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+    cairo_rectangle (cr, 02, 2, w - 6, h - 6);
+    cairo_fill (cr);
+
+    cairo_set_line_width (cr, 1.0);
+    cairo_set_dash (cr, dash, 2, 0);
+
+    cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
+    cairo_rectangle (cr, 2, 2, w - 6, h - 6);
+    cairo_stroke (cr);
+
+    for (i = 0; i < GRAPH_LINES; i++) {
+        int y = 2 + ((h - 6) * i) / GRAPH_LINES;
+        cairo_move_to (cr, 2, y);
+        cairo_line_to (cr, w - 4, y);
+    }
+    cairo_stroke (cr);
+
+    /* draw the polygons */
+    cairo_set_dash (cr, dash, 0, 1);
+    cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
+    cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
+
+    gdk_cairo_set_source_rgba (cr, &netspeed->in_color);
+    for (i = offset; i < GRAPH_VALUES; i++) {
+        cairo_line_to (cr, in_points[i].x, in_points[i].y);
+    }
+    cairo_stroke (cr);
+
+    gdk_cairo_set_source_rgba (cr, &netspeed->out_color);
+    for (i = offset; i < GRAPH_VALUES; i++) {
+        cairo_line_to (cr, out_points[i].x, out_points[i].y);
+    }
+    cairo_stroke (cr);
+
+    text = bps_to_string (max_val, netspeed->show_bits);
+    add_markup_fgcolor (&text, "black");
+    layout = gtk_widget_create_pango_layout (da, NULL);
+    pango_layout_set_markup (layout, text, -1);
+    g_free (text);
+    gtk_render_layout (stylecontext, cr, 3, 2, layout);
+    g_object_unref (G_OBJECT (layout));
+
+    text = bps_to_string (0.0, netspeed->show_bits);
+    add_markup_fgcolor (&text, "black");
+    layout = gtk_widget_create_pango_layout (da, NULL);
+    pango_layout_set_markup (layout, text, -1);
+    pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
+    g_free (text);
+    gtk_render_layout (stylecontext, cr, 3, h - 4 - logical_rect.height, layout);
+    g_object_unref (G_OBJECT (layout));
+}
+
+static gboolean
+set_applet_devinfo (NetspeedApplet *netspeed,
+                    const char     *iface)
+{
+    DevInfo *info;
+
+    get_device_info (iface, &info);
+
+    if (info->running) {
+        free_device_info (netspeed->devinfo);
+        netspeed->devinfo = info;
+        netspeed->device_has_changed = TRUE;
+        return TRUE;
+    }
+
+    free_device_info (info);
+    return FALSE;
+}
+
+/* Find the first available device, that is running and != lo */
+static void
+search_for_up_if (NetspeedApplet *netspeed)
+{
+    const gchar *default_route;
+    GList *devices, *tmp;
+
+    default_route = get_default_route ();
+
+    if (default_route != NULL) {
+        if (set_applet_devinfo (netspeed, default_route))
+            return;
+    }
+
+    devices = get_available_devices ();
+    for (tmp = devices; tmp; tmp = g_list_next (tmp)) {
+        if (is_dummy_device (tmp->data))
+            continue;
+        if (set_applet_devinfo (netspeed, tmp->data))
+            break;
+    }
+    g_list_free_full (devices, g_free);
+}
+
+static char *
+format_time (guint32 sec)
+{
+    char *res;
+    char *m, *s;
+    int seconds;
+    int minutes;
+    int hours;
+
+    if (sec < 60)
+        return g_strdup_printf (ngettext ("%'" G_GUINT32_FORMAT " second","%'" G_GUINT32_FORMAT " seconds", sec), sec);
+
+    hours = (sec/3600);
+    minutes = (sec -(3600*hours))/60;
+    seconds = (sec -(3600*hours)-(minutes*60));
+
+    m = g_strdup_printf (ngettext ("%'d minute", "%'d minutes", minutes), minutes);
+    s = g_strdup_printf (ngettext ("%'d secon", "%'d seconds", seconds), seconds);
+    if (sec < 60*60) {
+        res = g_strconcat (m, ", ", s, NULL);
+    } else {
+        char *h;
+        h = g_strdup_printf (ngettext ("%'d hour", "%'d hours", hours), hours);
+        res = g_strconcat (h, ", ", m, ", ", s, NULL);
+        g_free (h);
+    }
+    g_free (m);
+    g_free (s);
+
+    return res;
+}
+
+static char *
+mac_addr_n2a (const unsigned char *hw)
+{
+    if (hw[6] || hw[7]) {
+        return g_strdup_printf ("%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
+                                hw[0], hw[1], hw[2], hw[3],
+                                hw[4], hw[5], hw[6], hw[7]);
+    } else {
+        return g_strdup_printf ("%02x:%02x:%02x:%02x:%02x:%02x",
+                                hw[0], hw[1], hw[2],
+                                hw[3], hw[4], hw[5]);
+    }
+}
+
+static void
+format_ipv4 (guint32  ip,
+             char    *dest)
+{
+    inet_ntop (AF_INET, &ip, dest, INET_ADDRSTRLEN);
+}
+
+static void
+fill_details_dialog (NetspeedApplet *netspeed)
+{
+    char *text;
+    char ipv4_text [INET_ADDRSTRLEN];
+
+    if (netspeed->devinfo->ip) {
+        format_ipv4 (netspeed->devinfo->ip, ipv4_text);
+        text = ipv4_text;
+    } else {
+        text = _("none");
+    }
+    gtk_label_set_text (GTK_LABEL (netspeed->ip_text), text);
+
+    if (netspeed->devinfo->netmask) {
+        format_ipv4 (netspeed->devinfo->netmask, ipv4_text);
+        text = ipv4_text;
+    } else {
+        text = _("none");
+    }
+    gtk_label_set_text (GTK_LABEL (netspeed->netmask_text), text);
+
+    if (netspeed->devinfo->type != DEV_LO) {
+        text = mac_addr_n2a (netspeed->devinfo->hwaddr);
+        gtk_label_set_text (GTK_LABEL (netspeed->hwaddr_text), text);
+        g_free (text);
+    } else {
+        gtk_label_set_text (GTK_LABEL (netspeed->hwaddr_text), _("none"));
+    }
+
+    if (netspeed->devinfo->ptpip) {
+        format_ipv4 (netspeed->devinfo->ptpip, ipv4_text);
+        text = ipv4_text;
+    } else {
+        text = _("none");
+    }
+    gtk_label_set_text (GTK_LABEL (netspeed->ptpip_text), text);
+
+    /* check if we got an ipv6 address */
+    GSList *ipv6_address_list = get_ip_address_list (netspeed->devinfo->name, FALSE);
+    if (ipv6_address_list != NULL) {
+        GSList *iterator;
+        GString *string = NULL;
+
+        for (iterator = ipv6_address_list; iterator; iterator = iterator->next) {
+            if (string == NULL)
+                string = g_string_new ((char*) iterator->data);
+            else
+                g_string_append_printf (string, "\n%s", (char*) iterator->data);
+        }
+        if (string != NULL) {
+            gtk_label_set_text (GTK_LABEL (netspeed->ipv6_text), string->str);
+            gtk_widget_show (netspeed->ipv6_box);
+        }
+        g_string_free (string, TRUE);
+        g_slist_free_full (ipv6_address_list, g_free);
+    } else {
+        gtk_widget_hide (netspeed->ipv6_box);
+    }
+
+    if (netspeed->devinfo->type == DEV_WIRELESS) {
+        float quality;
+
+        /* _maybe_ we can add the encrypted icon between the essid and the signal bar. */
+
+        quality = netspeed->devinfo->qual / 100.0f;
+        if (quality > 1.0)
+            quality = 1.0;
+
+        text = g_strdup_printf ("%d %%", netspeed->devinfo->qual);
+        gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (netspeed->signalbar), quality);
+        gtk_progress_bar_set_text (GTK_PROGRESS_BAR (netspeed->signalbar), text);
+        g_free (text);
+
+        gtk_label_set_text (GTK_LABEL (netspeed->essid_text),
+                            netspeed->devinfo->essid);
+
+#ifdef HAVE_NL
+        if (netspeed->devinfo->running) {
+            text = mac_addr_n2a (netspeed->devinfo->station_mac_addr);
+            gtk_label_set_text (GTK_LABEL (netspeed->station_text), text);
+            g_free (text);
+        } else {
+            gtk_label_set_text (GTK_LABEL (netspeed->station_text), _("unknown"));
+        }
+
+        gtk_label_set_text (GTK_LABEL (netspeed->channel_text),
+                            netspeed->devinfo->channel ? netspeed->devinfo->channel : _("unknown"));
+
+        text = format_time (netspeed->devinfo->connected_time);
+        gtk_label_set_text (GTK_LABEL (netspeed->connected_time_text),
+                            netspeed->devinfo->connected_time > 0 ? text : _("na"));
+        g_free (text);
+
+        gtk_widget_show (netspeed->netlink_box);
+#else
+        gtk_widget_hide (netspeed->netlink_box);
+#endif /* HAVE_NL */
+        gtk_widget_show (netspeed->wireless_box);
+    } else {
+        gtk_widget_hide (netspeed->wireless_box);
+    }
+}
+
+/* Here happens the really interesting stuff */
+static void
+update_applet (NetspeedApplet *netspeed)
+{
+    guint64 indiff, outdiff;
+    double inrate, outrate;
+    char *inbytes, *outbytes;
+    int i;
+    DevInfo *oldinfo;
+
+    if (!netspeed) return;
+
+    /* First we try to figure out if the device has changed */
+    oldinfo = netspeed->devinfo;
+    get_device_info (oldinfo->name, &netspeed->devinfo);
+    if (compare_device_info (netspeed->devinfo, oldinfo))
+        netspeed->device_has_changed = TRUE;
+    free_device_info (oldinfo);
+
+    /* If the device has changed, reintialize stuff */
+    if (netspeed->device_has_changed) {
+        change_icons (netspeed);
+        change_quality_icon (netspeed);
+
+        for (i = 0; i < OLD_VALUES; i++) {
+            netspeed->in_old[i] = netspeed->devinfo->rx;
+            netspeed->out_old[i] = netspeed->devinfo->tx;
+        }
+
+        for (i = 0; i < GRAPH_VALUES; i++) {
+            netspeed->in_graph[i] = -1;
+            netspeed->out_graph[i] = -1;
+        }
+
+        netspeed->max_graph = 0;
+        netspeed->index_graph = 0;
+
+        if (netspeed->details) {
+            fill_details_dialog (netspeed);
+        }
+
+        netspeed->device_has_changed = FALSE;
+    }
+
+    /* create the strings for the labels and tooltips */
+    if (netspeed->devinfo->running) {
+        if (netspeed->devinfo->rx < netspeed->in_old[netspeed->index_old])
+            indiff = 0;
+        else
+            indiff = netspeed->devinfo->rx - netspeed->in_old[netspeed->index_old];
+
+        if (netspeed->devinfo->tx < netspeed->out_old[netspeed->index_old])
+            outdiff = 0;
+        else
+            outdiff = netspeed->devinfo->tx - netspeed->out_old[netspeed->index_old];
+
+        inrate = (double)indiff / OLD_VALUES_DBL;
+        outrate = (double)outdiff / OLD_VALUES_DBL;
+
+        netspeed->in_graph[netspeed->index_graph] = inrate;
+        netspeed->out_graph[netspeed->index_graph] = outrate;
+        netspeed->max_graph = MAX (inrate, netspeed->max_graph);
+        netspeed->max_graph = MAX (outrate, netspeed->max_graph);
+
+        format_transfer_rate (netspeed->devinfo->rx_rate, inrate, netspeed->show_bits);
+        format_transfer_rate (netspeed->devinfo->tx_rate, outrate, netspeed->show_bits);
+        format_transfer_rate (netspeed->devinfo->sum_rate, inrate + outrate, netspeed->show_bits);
+    } else {
+        netspeed->devinfo->rx_rate[0] = '\0';
+        netspeed->devinfo->tx_rate[0] = '\0';
+        netspeed->devinfo->sum_rate[0] = '\0';
+        netspeed->in_graph[netspeed->index_graph] = 0;
+        netspeed->out_graph[netspeed->index_graph] = 0;
+    }
+
+    if (netspeed->devinfo->type == DEV_WIRELESS) {
+        if (netspeed->devinfo->up)
+            update_quality_icon (netspeed);
+
+        if (netspeed->signalbar) {
+            float quality;
+            char *text;
+
+            quality = netspeed->devinfo->qual / 100.0f;
+            if (quality > 1.0)
+                quality = 1.0;
+
+            text = g_strdup_printf ("%d %%", netspeed->devinfo->qual);
+            gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (netspeed->signalbar), quality);
+            gtk_progress_bar_set_text (GTK_PROGRESS_BAR (netspeed->signalbar), text);
+            g_free (text);
+        }
+#ifdef HAVE_NL
+        /* Refresh the value of Connected Time */
+        if (netspeed->connected_time_text) {
+            char *text;
+
+            text = format_time (netspeed->devinfo->connected_time);
+            gtk_label_set_text (GTK_LABEL (netspeed->connected_time_text),
+                                netspeed->devinfo->connected_time > 0 ? text : _("na"));
+            g_free (text);
+        }
+#endif
+    }
+
+    update_tooltip (netspeed);
+
+    /* Refresh the text of the labels */
+    if (netspeed->show_sum) {
+        gtk_label_set_text (GTK_LABEL (netspeed->sum_label),
+                            netspeed->devinfo->sum_rate);
+    } else {
+        gtk_label_set_text (GTK_LABEL (netspeed->in_label),
+                            netspeed->devinfo->rx_rate);
+        gtk_label_set_text (GTK_LABEL (netspeed->out_label),
+                            netspeed->devinfo->tx_rate);
+    }
+
+    /* Refresh the values of the Infodialog */
+    if (netspeed->inbytes_text) {
+        if (netspeed->show_bits)
+            inbytes = g_format_size_full (netspeed->devinfo->rx*8,
+                                          G_FORMAT_SIZE_IEC_UNITS | G_FORMAT_SIZE_BITS);
+        else
+            inbytes = g_format_size_full (netspeed->devinfo->rx,
+                                          G_FORMAT_SIZE_IEC_UNITS);
+
+        gtk_label_set_text (GTK_LABEL (netspeed->inbytes_text), inbytes);
+        g_free (inbytes);
+    }
+    if (netspeed->outbytes_text) {
+        if (netspeed->show_bits)
+            outbytes = g_format_size_full (netspeed->devinfo->tx*8,
+                                           G_FORMAT_SIZE_IEC_UNITS | G_FORMAT_SIZE_BITS);
+        else
+            outbytes = g_format_size_full (netspeed->devinfo->tx,
+                                           G_FORMAT_SIZE_IEC_UNITS);
+
+        gtk_label_set_text (GTK_LABEL (netspeed->outbytes_text), outbytes);
+        g_free (outbytes);
+    }
+
+    /* Redraw the graph of the Infodialog */
+    if (netspeed->drawingarea)
+        gtk_widget_queue_draw (GTK_WIDGET (netspeed->drawingarea));
+
+    /* Save old values... */
+    netspeed->in_old  [netspeed->index_old] = netspeed->devinfo->rx;
+    netspeed->out_old [netspeed->index_old] = netspeed->devinfo->tx;
+    netspeed->index_old = (netspeed->index_old + 1) % OLD_VALUES;
+
+    /* Move the graphindex. Check if we can scale down again */
+    netspeed->index_graph = (netspeed->index_graph + 1) % GRAPH_VALUES;
+    if (netspeed->index_graph % 20 == 0) {
+        double max = 0;
+
+        for (i = 0; i < GRAPH_VALUES; i++) {
+            max = MAX (max, netspeed->in_graph[i]);
+            max = MAX (max, netspeed->out_graph[i]);
+        }
+        netspeed->max_graph = max;
+    }
+
+    /* Always follow the default route */
+    if (netspeed->auto_change_device) {
+        gboolean change_device_now = !netspeed->devinfo->running;
+
+        if (!change_device_now) {
+            const gchar *default_route;
+
+            default_route = get_default_route ();
+            change_device_now = (default_route != NULL &&
+                                 strcmp (default_route, netspeed->devinfo->name));
+        }
+        if (change_device_now) {
+            search_for_up_if (netspeed);
+        }
+    }
+}
+
+static gboolean
+timeout_function (NetspeedApplet *netspeed)
+{
+    if (!netspeed)
+        return FALSE;
+    if (!netspeed->timeout_id)
+        return FALSE;
+
+    update_applet (netspeed);
+    return TRUE;
+}
+
+/* Display a section of netspeed help
+ */
+void
+netspeed_applet_display_help (GtkWidget   *dialog,
+                              const gchar *section)
+{
+    GError *error = NULL;
+    gboolean ret;
+    char *uri;
+
+    if (section)
+        uri = g_strdup_printf ("help:mate-netspeed-applet/%s", section);
+    else
+        uri = g_strdup ("help:mate-netspeed-applet");
+
+    ret = gtk_show_uri_on_window (NULL,
+                                  uri,
+                                  gtk_get_current_event_time (),
+                                  &error);
+    g_free (uri);
+
+    if (ret == FALSE) {
+        GtkWidget *error_dialog = gtk_message_dialog_new (NULL,
+                                                          GTK_DIALOG_MODAL,
+                                                          GTK_MESSAGE_ERROR,
+                                                          GTK_BUTTONS_OK,
+                                                          _("There was an error displaying help:\n%s"),
+                                                          error->message);
+        g_signal_connect (error_dialog, "response",
+                          G_CALLBACK (gtk_widget_destroy), NULL);
+
+        gtk_window_set_resizable (GTK_WINDOW (error_dialog), FALSE);
+        gtk_window_set_screen (GTK_WINDOW (error_dialog), gtk_widget_get_screen (dialog));
+        gtk_widget_show (error_dialog);
+        g_error_free (error);
+    }
+}
+
+/* Opens gnome help application
+ */
+static void
+help_cb (GtkAction      *action,
+         NetspeedApplet *netspeed)
+{
+    netspeed_applet_display_help (GTK_WIDGET (netspeed), NULL);
+}
+
+/* Just the about window... If it's already open, just fokus it
+ */
+static void
+about_cb (GtkAction *action,
+          gpointer   data)
+{
+    const char *authors[] =
+    {
+        "Jörgen Scheibengruber <mfcn@gmx.de>",
+        "Dennis Cranston <dennis_cranston@yahoo.com>",
+        "Pedro Villavicencio Garrido <pvillavi@gnome.org>",
+        "Benoît Dejean <benoit@placenet.org>",
+        "Stefano Karapetsas <stefano@karapetsas.com>",
+        "Perberos <perberos@gmail.com>",
+        NULL
+    };
+
+    gtk_show_about_dialog (NULL,
+                           "title", _("About MATE Netspeed"),
+                           "version", VERSION,
+                           "copyright", _("Copyright \xc2\xa9 2002-2003 Jörgen Scheibengruber\n"
+                                          "Copyright \xc2\xa9 2011-2014 Stefano Karapetsas\n"
+                                          "Copyright \xc2\xa9 2015-2021 MATE developers"),
+                           "comments", _("A little applet that displays some information on the traffic on the specified network device"),
+                           "authors", authors,
+                           "documenters", NULL,
+                           "translator-credits", _("translator-credits"),
+                           "website", PACKAGE_URL,
+                           "logo-icon-name", LOGO_ICON,
+                            NULL);
+}
+
+static void
+netspeed_applet_destroy_preferences (GtkWidget *widget,
+                                     gpointer   user_data)
+{
+	NetspeedApplet *netspeed;
+	(void) widget;
+
+	netspeed = NETSPEED_APPLET (user_data);
+	netspeed->preferences = NULL;
+}
+
+/* Creates the settings dialog
+ * After its been closed, take the new values and store
+ * them in the gsettings database
+ */
+static void
+settings_cb (GtkAction      *action,
+             NetspeedApplet *netspeed)
+{
+    g_assert (netspeed);
+
+    if (netspeed->preferences)
+    {
+        gtk_window_present (GTK_WINDOW (netspeed->preferences));
+        return;
+    }
+
+    netspeed->preferences = netspeed_preferences_new (netspeed);
+    g_signal_connect (netspeed->preferences, "destroy",
+                      G_CALLBACK (netspeed_applet_destroy_preferences), netspeed);
+    gtk_widget_show_all (netspeed->preferences);
+}
+
+static gboolean
+da_draw (GtkWidget      *widget,
+         cairo_t        *cr,
+         NetspeedApplet *netspeed)
+{
+    redraw_graph (netspeed, cr);
+
+    return FALSE;
+}
+
+static void
+incolor_changed_cb (GtkColorChooser *button,
+                    NetspeedApplet  *netspeed)
+{
+    GdkRGBA color;
+    gchar *string;
+
+    gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &color);
+    netspeed->in_color = color;
+
+    string = gdk_rgba_to_string (&color);
+    g_settings_set_string (netspeed->settings, "in-color", string);
+    g_free (string);
+}
+
+static void
+outcolor_changed_cb (GtkColorChooser *button,
+                     NetspeedApplet  *netspeed)
+{
+    GdkRGBA color;
+    gchar *string;
+
+    gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &color);
+    netspeed->out_color = color;
+
+    string = gdk_rgba_to_string (&color);
+    g_settings_set_string (netspeed->settings, "out-color", string);
+    g_free (string);
+}
+
+/* Handle info dialog response event
+ */
+static void
+info_response_cb (GtkDialog      *dialog,
+                  gint            id,
+                  NetspeedApplet *netspeed)
+{
+
+    if (id == GTK_RESPONSE_HELP) {
+        netspeed_applet_display_help (GTK_WIDGET (dialog), "netspeed_applet-details");
+        return;
+    }
+
+    gtk_widget_destroy (netspeed->details);
+
+    netspeed->details       = NULL;
+    netspeed->drawingarea   = NULL;
+    netspeed->ip_text       = NULL;
+    netspeed->netmask_text  = NULL;
+    netspeed->ptpip_text    = NULL;
+    netspeed->ipv6_text     = NULL;
+    netspeed->hwaddr_text   = NULL;
+    netspeed->inbytes_text  = NULL;
+    netspeed->outbytes_text = NULL;
+    netspeed->essid_text    = NULL;
+    netspeed->signalbar     = NULL;
+#ifdef HAVE_NL
+    netspeed->station_text        = NULL;
+    netspeed->channel_text        = NULL;
+    netspeed->connected_time_text = NULL;
+#endif /* HAVE_NL */
+    netspeed->ipv6_box      = NULL;
+    netspeed->netlink_box   = NULL;
+    netspeed->wireless_box  = NULL;
+}
+
+/* Creates the details dialog
+ */
+static void
+showinfo_cb (GtkAction      *action,
+             NetspeedApplet *netspeed)
+{
+    GtkBuilder *builder;
+
+    g_assert (netspeed);
+
+    if (netspeed->details) {
+        gtk_window_present (GTK_WINDOW (netspeed->details));
+        return;
+    }
+
+    builder = gtk_builder_new_from_resource (NETSPEED_RESOURCE_PATH "netspeed-details.ui");
+
+    netspeed->details       = GET_WIDGET ("dialog");
+    netspeed->drawingarea   = GET_DRAWING_AREA ("drawingarea");
+
+    netspeed->ip_text       = GET_WIDGET ("ip_text");
+    netspeed->netmask_text  = GET_WIDGET ("netmask_text");
+    netspeed->ptpip_text    = GET_WIDGET ("ptpip_text");
+    netspeed->ipv6_text     = GET_WIDGET ("ipv6_text");
+    netspeed->hwaddr_text   = GET_WIDGET ("hwaddr_text");
+    netspeed->inbytes_text  = GET_WIDGET ("inbytes_text");
+    netspeed->outbytes_text = GET_WIDGET ("outbytes_text");
+    netspeed->essid_text    = GET_WIDGET ("essid_text");
+    netspeed->signalbar     = GET_WIDGET ("signalbar");
+#ifdef HAVE_NL
+    netspeed->station_text  = GET_WIDGET ("station_text");
+    netspeed->channel_text  = GET_WIDGET ("channel_text");
+
+    netspeed->connected_time_text = GET_WIDGET ("connected_time_text");
+#endif /* HAVE_NL */
+    netspeed->ipv6_box      = GET_WIDGET ("ipv6_box");
+    netspeed->netlink_box   = GET_WIDGET ("netlink_box");
+    netspeed->wireless_box  = GET_WIDGET ("wireless_box");
+
+    gtk_color_chooser_set_rgba (GET_COLOR_CHOOSER ("incolor_sel"),  &netspeed->in_color);
+    gtk_color_chooser_set_rgba (GET_COLOR_CHOOSER ("outcolor_sel"),  &netspeed->out_color);
+
+    fill_details_dialog (netspeed);
+
+    gtk_builder_add_callback_symbols (builder,
+                                      "on_drawingarea_draw", G_CALLBACK (da_draw),
+                                      "on_incolor_sel_color_set", G_CALLBACK (incolor_changed_cb),
+                                      "on_outcolor_sel_color_set", G_CALLBACK (outcolor_changed_cb),
+                                      "on_dialog_response", G_CALLBACK (info_response_cb),
+                                      NULL);
+    gtk_builder_connect_signals (builder, netspeed);
+
+    g_object_unref (builder);
+
+    gtk_window_present (GTK_WINDOW (netspeed->details));
+}
+
+static const GtkActionEntry netspeed_applet_menu_actions [] = {
+        { "NetspeedAppletDetails", "dialog-information", N_("Device _Details"),
+          NULL, NULL, G_CALLBACK (showinfo_cb) },
+        { "NetspeedAppletProperties", "document-properties", N_("Preferences..."),
+          NULL, NULL, G_CALLBACK (settings_cb) },
+        { "NetspeedAppletHelp", "help-browser", N_("Help"),
+          NULL, NULL, G_CALLBACK (help_cb) },
+        { "NetspeedAppletAbout", "help-about", N_("About..."),
+          NULL, NULL, G_CALLBACK (about_cb) }
+};
+
+/* Block the size_request signal emit by the label if the
+ * text changes. Only if the label wants to grow, we give
+ * permission. This will eventually result in the maximal
+ * size of the applet and prevents the icons and labels from
+ * "jumping around" in the mate_panel which looks uggly
+ */
+static void
+label_size_allocate_cb (GtkWidget      *widget,
+                        GtkAllocation  *allocation,
+                        NetspeedApplet *netspeed)
+{
+    if (netspeed->labels_dont_shrink) {
+        if (allocation->width <= netspeed->width)
+            allocation->width = netspeed->width;
+        else
+            netspeed->width = allocation->width;
+    }
+}
+
+static gboolean
+netspeed_applet_button_press_event (GtkWidget      *widget,
+                                    GdkEventButton *event)
+{
+    if (event->button == 1) {
+        NetspeedApplet *netspeed = NETSPEED_APPLET (widget);
+        GError *error = NULL;
+
+        if (netspeed->connect_dialog) {
+            gtk_window_present (GTK_WINDOW (netspeed->connect_dialog));
+            return FALSE;
+        }
+
+        if (netspeed->up_cmd && netspeed->down_cmd) {
+            char *question;
+            int   response;
+
+            if (netspeed->devinfo->up)
+                question = g_strdup_printf (_("Do you want to disconnect %s now?"),
+                                            netspeed->devinfo->name);
+            else
+                question = g_strdup_printf (_("Do you want to connect %s now?"),
+                                            netspeed->devinfo->name);
+
+            netspeed->connect_dialog =
+                gtk_message_dialog_new (NULL,
+                                        GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
+                                        "%s", question);
+
+            response = gtk_dialog_run (GTK_DIALOG (netspeed->connect_dialog));
+            gtk_widget_destroy (netspeed->connect_dialog);
+            netspeed->connect_dialog = NULL;
+            g_free (question);
+
+            if (response == GTK_RESPONSE_YES) {
+                GtkWidget *dialog;
+                char      *command;
+
+                command = g_strdup_printf ("%s %s",
+                                           netspeed->devinfo->up ? netspeed->down_cmd : netspeed->up_cmd,
+                                           netspeed->devinfo->name);
+
+                if (!g_spawn_command_line_async (command, &error)) {
+                    dialog = gtk_message_dialog_new_with_markup (NULL,
+                                                                 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                                 GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+                                                                 _("<b>Running command %s failed</b>\n%s"), command, error->message);
+                    gtk_dialog_run (GTK_DIALOG (dialog));
+                    gtk_widget_destroy (dialog);
+
+                    g_error_free (error);
+                }
+
+                g_free (command);
+            }
+        }
+    }
+
+    return GTK_WIDGET_CLASS (netspeed_applet_parent_class)->button_press_event (widget, event);
+}
+
+/* Frees the applet and all the data it contains
+ * Removes the timeout_cb
+ */
+static void
+netspeed_applet_finalize (GObject *object)
+{
+    NetspeedApplet *netspeed = NETSPEED_APPLET (object);
+
+    if (netspeed->icon_theme != NULL) {
+        g_signal_handlers_disconnect_by_func (netspeed->icon_theme,
+                                              icon_theme_changed_cb,
+                                              netspeed);
+        netspeed->icon_theme = NULL;
+    }
+
+    if (netspeed->timeout_id > 0) {
+        g_source_remove (netspeed->timeout_id);
+        netspeed->timeout_id = 0;
+    }
+
+    g_clear_object (&netspeed->settings);
+
+    g_clear_pointer (&netspeed->details, gtk_widget_destroy);
+    g_clear_pointer (&netspeed->preferences, gtk_widget_destroy);
+
+    g_free (netspeed->up_cmd);
+    g_free (netspeed->down_cmd);
+
+    /* Should never be NULL */
+    free_device_info (netspeed->devinfo);
+}
+
+static void
+update_tooltip (NetspeedApplet *netspeed)
+{
+    GString* tooltip;
+
+    if (!netspeed->show_tooltip)
+        return;
+
+    tooltip = g_string_new ("");
+
+    if (!netspeed->devinfo->running)
+        g_string_printf (tooltip, _("%s is down"), netspeed->devinfo->name);
+    else {
+        GSList *iterator;
+        GString *string = NULL;
+        char ipv4_text [INET_ADDRSTRLEN];
+
+        g_string_printf (tooltip, "%s: ", netspeed->devinfo->name);
+
+        if (netspeed->show_all_addresses || !netspeed->devinfo->ip) {
+            GSList *ip6_address_list = get_ip6_address_list (netspeed->devinfo->name);
+
+            /* check if we got IPv6 addresses */
+            if (ip6_address_list != NULL) {
+                for (iterator = ip6_address_list; iterator; iterator = iterator->next) {
+                    if (string == NULL)
+                        string = g_string_new ((char*) iterator->data);
+                    else
+                        g_string_append_printf (string,
+                                                _("\n%s"),
+                                                (char*) iterator->data);
+                }
+            }
+
+            g_slist_free_full (ip6_address_list, g_free);
+        }
+
+        if (!netspeed->devinfo->ip && !string) {
+            g_string_append (tooltip, "has no ip");
+        }
+
+        if (netspeed->devinfo->ip) {
+            format_ipv4 (netspeed->devinfo->ip, ipv4_text);
+            g_string_append (tooltip, ipv4_text);
+        }
+
+        if (string != NULL) {
+            g_string_append_printf (tooltip,
+                                    _("\n%s"),
+                                    string->str);
+            g_string_free (string, TRUE);
+        }
+
+        if (netspeed->show_sum) {
+            g_string_append_printf (tooltip,
+                                    _("\nin: %s out: %s"),
+                                    netspeed->devinfo->rx_rate,
+                                    netspeed->devinfo->tx_rate);
+        } else {
+            g_string_append_printf (tooltip,
+                                    _("\nsum: %s"),
+                                    netspeed->devinfo->sum_rate);
+        }
+
+#ifdef HAVE_NL
+        if (netspeed->devinfo->type == DEV_WIRELESS)
+            g_string_append_printf (tooltip,
+                                    _("\nESSID: %s\nRSSI: %d dBm\nRX Bitrate: %s\nTX Bitrate: %s"),
+                                    netspeed->devinfo->essid ? netspeed->devinfo->essid : _("unknown"),
+                                    netspeed->devinfo->rssi,
+                                    netspeed->devinfo->rx_bitrate,
+                                    netspeed->devinfo->tx_bitrate);
+#endif /* HAVE_NL */
+#ifdef HAVE_IW
+        if (netspeed->devinfo->type == DEV_WIRELESS)
+            g_string_append_printf (tooltip,
+                                    _("\nESSID: %s\nStrength: %d %%"),
+                                    netspeed->devinfo->essid ? netspeed->devinfo->essid : _("unknown"),
+                                    netspeed->devinfo->qual);
+#endif /* HAVE_IW */
+    }
+
+    gtk_widget_set_tooltip_text (GTK_WIDGET (netspeed), tooltip->str);
+    gtk_widget_trigger_tooltip_query (GTK_WIDGET (netspeed));
+    g_string_free (tooltip, TRUE);
+}
+
+static gboolean
+netspeed_applet_enter_notify_event (GtkWidget        *widget,
+                                    GdkEventCrossing *event)
+{
+    NetspeedApplet *netspeed = NETSPEED_APPLET (widget);
+
+    netspeed->show_tooltip = TRUE;
+    update_tooltip (netspeed);
+    return TRUE;
+}
+
+static gboolean
+netspeed_applet_leave_notify_event (GtkWidget        *widget,
+                                    GdkEventCrossing *event)
+{
+    NetspeedApplet *netspeed = NETSPEED_APPLET (widget);
+
+    netspeed->show_tooltip = FALSE;
+    return TRUE;
+}
+
+static void
+netspeed_applet_class_init (NetspeedAppletClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+    GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+    object_class->finalize = netspeed_applet_finalize;
+
+    widget_class->button_press_event = netspeed_applet_button_press_event;
+    widget_class->leave_notify_event = netspeed_applet_leave_notify_event;
+    widget_class->enter_notify_event = netspeed_applet_enter_notify_event;
+}
+
+static void
+netspeed_applet_init (NetspeedApplet *netspeed)
+{
+}
+
+static void
+changeicon_settings_changed (GSettings      *settings,
+                             const gchar    *key,
+                             NetspeedApplet *netspeed)
+{
+    netspeed->change_icon = g_settings_get_boolean (settings, key);
+    change_icons (netspeed);
+}
+
+static void
+showalladdresses_settings_changed (GSettings      *settings,
+                                   const gchar    *key,
+                                   NetspeedApplet *netspeed)
+{
+    netspeed->show_all_addresses = g_settings_get_boolean (settings, key);
+}
+
+static void
+showsum_settings_changed (GSettings      *settings,
+                          const gchar    *key,
+                          NetspeedApplet *netspeed)
+{
+    netspeed->show_sum = g_settings_get_boolean (settings, key);
+    applet_change_size_or_orient (MATE_PANEL_APPLET (netspeed), -1, netspeed);
+    change_icons (netspeed);
+}
+
+static void
+showbits_settings_changed (GSettings      *settings,
+                           const gchar    *key,
+                           NetspeedApplet *netspeed)
+{
+    netspeed->show_bits = g_settings_get_boolean (settings, key);
+}
+
+static void
+showicon_settings_changed (GSettings      *settings,
+                           const gchar    *key,
+                           NetspeedApplet *netspeed)
+{
+    netspeed->show_icon = g_settings_get_boolean (settings, key);
+    change_icons (netspeed);
+}
+
+static void
+showqualityicon_settings_changed (GSettings      *settings,
+                                  const gchar    *key,
+                                  NetspeedApplet *netspeed)
+{
+    netspeed->show_quality_icon = g_settings_get_boolean (settings, key);
+    change_quality_icon (netspeed);
+}
+
+static void
+auto_change_device_settings_changed (GSettings      *settings,
+                                     const gchar    *key,
+                                     NetspeedApplet *netspeed)
+{
+    netspeed->auto_change_device = g_settings_get_boolean (settings, key);
+    netspeed->device_has_changed = TRUE;
+    update_applet (netspeed);
+}
+
+static void
+device_settings_changed (GSettings      *settings,
+                         const gchar    *key,
+                         NetspeedApplet *netspeed)
+{
+    char *device;
+
+    device = g_settings_get_string (settings, key);
+    if (device && *device != '\0') {
+        free_device_info (netspeed->devinfo);
+        get_device_info (device, &netspeed->devinfo);
+        netspeed->device_has_changed = TRUE;
+    }
+    g_free (device);
+}
+
+/* The "main" function of the applet
+ */
+static gboolean
+netspeed_applet_factory (MatePanelApplet *applet,
+                         const gchar     *iid,
+                         gpointer         data)
+{
+    NetspeedApplet *netspeed;
+    int i;
+    GtkWidget *spacer, *spacer_box;
+    GtkActionGroup *action_group;
+    AtkObject      *atk_obj;
+    char *tmp;
+
+    if (strcmp (iid, "NetspeedApplet"))
+        return FALSE;
+
+    glibtop_init ();
+
+#ifndef ENABLE_IN_PROCESS
+    g_set_application_name (_("MATE Netspeed"));
+#endif
+
+    netspeed = NETSPEED_APPLET (applet);
+    netspeed->icon_theme = gtk_icon_theme_get_default ();
+
+    for (i = 0; i < GRAPH_VALUES; i++)
+    {
+        netspeed->in_graph[i] = -1;
+        netspeed->out_graph[i] = -1;
+    }
+
+    netspeed->settings = mate_panel_applet_settings_new (applet, "org.mate.panel.applet.netspeed");
+
+    /* Get stored settings from gsettings
+     */
+    netspeed->show_all_addresses = g_settings_get_boolean (netspeed->settings, "show-all-addresses");
+    netspeed->show_sum = g_settings_get_boolean (netspeed->settings, "show-sum");
+    netspeed->show_bits = g_settings_get_boolean (netspeed->settings, "show-bits");
+    netspeed->show_icon = g_settings_get_boolean (netspeed->settings, "show-icon");
+    netspeed->show_quality_icon = g_settings_get_boolean (netspeed->settings, "show-quality-icon");
+    netspeed->change_icon = g_settings_get_boolean (netspeed->settings, "change-icon");
+    netspeed->auto_change_device = g_settings_get_boolean (netspeed->settings, "auto-change-device");
+
+    tmp = g_settings_get_string (netspeed->settings, "device");
+    if (tmp && *tmp != '\0')
+        get_device_info (tmp, &netspeed->devinfo);
+    else
+        netspeed->devinfo = NULL;
+    g_free (tmp);
+
+    tmp = g_settings_get_string (netspeed->settings, "up-command");
+    if (tmp && *tmp != '\0')
+        netspeed->up_cmd = g_strdup (tmp);
+    else
+        netspeed->up_cmd = NULL;
+    g_free (tmp);
+
+    tmp = g_settings_get_string (netspeed->settings, "down-command");
+    if (tmp && *tmp != '\0')
+        netspeed->down_cmd = g_strdup (tmp);
+    else
+        netspeed->down_cmd = NULL;
+    g_free (tmp);
+
+    tmp = g_settings_get_string (netspeed->settings, "in-color");
+    if (tmp && *tmp != '\0')
+        gdk_rgba_parse (&netspeed->in_color, tmp);
+    else
+        gdk_rgba_parse (&netspeed->in_color, "#df0028004700");
+    g_free (tmp);
+
+    tmp = g_settings_get_string (netspeed->settings, "out-color");
+    if (tmp && *tmp != '\0')
+        gdk_rgba_parse (&netspeed->out_color, tmp);
+    else
+        gdk_rgba_parse (&netspeed->out_color, "#37002800df00");
+    g_free (tmp);
+
+    if (!netspeed->devinfo) {
+        GList *ptr, *devices = get_available_devices ();
+        ptr = devices;
+        while (ptr) {
+            if (!g_str_equal (ptr->data, "lo")) {
+                get_device_info (ptr->data, &netspeed->devinfo);
+                break;
+            }
+            ptr = g_list_next (ptr);
+        }
+        g_list_free_full (devices, g_free);
+    }
+    if (!netspeed->devinfo)
+        get_device_info ("lo", &netspeed->devinfo);
+
+    netspeed->device_has_changed = TRUE;
+
+    netspeed->in_label = gtk_label_new ("");
+    netspeed->out_label = gtk_label_new ("");
+    netspeed->sum_label = gtk_label_new ("");
+
+    netspeed->in_pix = gtk_image_new ();
+    netspeed->out_pix = gtk_image_new ();
+    netspeed->dev_pix = gtk_image_new ();
+    netspeed->qual_pix = gtk_image_new ();
+
+    netspeed->pix_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+    spacer = gtk_label_new ("");
+    gtk_box_pack_start (GTK_BOX (netspeed->pix_box), spacer, TRUE, TRUE, 0);
+    spacer = gtk_label_new ("");
+    gtk_box_pack_end (GTK_BOX (netspeed->pix_box), spacer, TRUE, TRUE, 0);
+
+    spacer_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
+    gtk_box_pack_start (GTK_BOX (netspeed->pix_box), spacer_box, FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (spacer_box), netspeed->qual_pix, FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (spacer_box), netspeed->dev_pix, FALSE, FALSE, 0);
+
+    init_quality_surfaces (netspeed);
+
+    applet_change_size_or_orient (applet, -1, netspeed);
+    gtk_widget_show_all (GTK_WIDGET (applet));
+    update_applet (netspeed);
+
+    mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR);
+
+    netspeed->timeout_id = g_timeout_add (REFRESH_TIME,
+                                         (GSourceFunc)timeout_function,
+                                         netspeed);
+    g_signal_connect_object (applet, "change-size",
+                             G_CALLBACK (applet_change_size_or_orient),
+                             netspeed, 0);
+
+    g_signal_connect_object (netspeed->icon_theme, "changed",
+                             G_CALLBACK (icon_theme_changed_cb),
+                             netspeed, 0);
+
+    g_signal_connect_object (applet, "change-orient",
+                             G_CALLBACK (applet_change_size_or_orient),
+                             netspeed, 0);
+
+    g_signal_connect_object (netspeed->in_label, "size-allocate",
+                             G_CALLBACK (label_size_allocate_cb),
+                             netspeed, 0);
+
+    g_signal_connect_object (netspeed->out_label, "size-allocate",
+                             G_CALLBACK (label_size_allocate_cb),
+                             netspeed, 0);
+
+    g_signal_connect_object (netspeed->sum_label, "size-allocate",
+                             G_CALLBACK (label_size_allocate_cb),
+                             netspeed, 0);
+
+    g_signal_connect_object (netspeed->settings, "changed::auto-change-device",
+                             G_CALLBACK (auto_change_device_settings_changed),
+                             netspeed, 0);
+
+    g_signal_connect_object (netspeed->settings, "changed::device",
+                             G_CALLBACK (device_settings_changed),
+                             netspeed, 0);
+
+    g_signal_connect_object (netspeed->settings, "changed::show-all-addresses",
+                             G_CALLBACK (showalladdresses_settings_changed),
+                             netspeed, 0);
+
+    g_signal_connect_object (netspeed->settings, "changed::show-sum",
+                             G_CALLBACK (showsum_settings_changed),
+                             netspeed, 0);
+
+    g_signal_connect_object (netspeed->settings, "changed::show-bits",
+                             G_CALLBACK (showbits_settings_changed),
+                             netspeed, 0);
+
+    g_signal_connect_object (netspeed->settings, "changed::change-icon",
+                             G_CALLBACK (changeicon_settings_changed),
+                             netspeed, 0);
+
+    g_signal_connect_object (netspeed->settings, "changed::show-icon",
+                             G_CALLBACK (showicon_settings_changed),
+                             netspeed, 0);
+
+    g_signal_connect_object (netspeed->settings, "changed::show-quality-icon",
+                             G_CALLBACK (showqualityicon_settings_changed),
+                             netspeed, 0);
+
+    action_group = gtk_action_group_new ("Netspeed Applet Actions");
+    gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+    gtk_action_group_add_actions (action_group,
+                                  netspeed_applet_menu_actions,
+                                  G_N_ELEMENTS (netspeed_applet_menu_actions),
+                                  netspeed);
+
+    mate_panel_applet_setup_menu_from_resource (applet,
+                                                NETSPEED_RESOURCE_PATH "netspeed-menu.xml",
+                                                action_group);
+
+    atk_obj = gtk_widget_get_accessible (GTK_WIDGET (applet));
+
+    if (GTK_IS_ACCESSIBLE (atk_obj)) {
+        atk_object_set_name (atk_obj, _("MATE Netspeed"));
+        atk_object_set_description (atk_obj,
+             _("A little applet that displays some information on the traffic on the specified network device"));
+    }
+
+    g_object_unref (action_group);
+
+    return TRUE;
+}
+
+PANEL_APPLET_FACTORY ("NetspeedAppletFactory",
+                      NETSPEED_TYPE_APPLET,
+                      "NetspeedApplet",
+                      netspeed_applet_factory,
+                      NULL)
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/13.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/13.html new file mode 100644 index 00000000..8547eec2 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/13.html @@ -0,0 +1,1317 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
/* battstat        A MATE battery meter for laptops. 
+ * Copyright (C) 2000 by Jörgen Pehrson <jp@spektr.eu.org>
+ * Copyright (C) 2002-2005 Free Software Foundation
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include <sys/file.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/ioctl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/stat.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#ifdef HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#ifdef HAVE_ERR_H
+#include <err.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "battstat.h"
+#include "battstat-upower.h"
+
+#define ERR_ACPID _("Can't access ACPI events in /var/run/acpid.socket! "    \
+                    "Make sure the ACPI subsystem is working and "           \
+                    "the acpid daemon is running.")
+
+#define ERR_OPEN_APMDEV _("Can't open the APM device!\n\n"                  \
+                          "Make sure you have read permission to the\n"     \
+                          "APM device.")
+
+#define ERR_APM_E _("The APM Management subsystem seems to be disabled.\n"  \
+                    "Try executing \"apm -e 1\" (FreeBSD) and see if \n"    \
+                    "that helps.\n")
+
+#define ERR_NO_SUPPORT _("Your platform is not supported!  The battery\n"   \
+                         "monitor applet will not work on your system.\n")
+
+#define ERR_FREEBSD_ACPI _("There was an error reading information from "   \
+                           "the ACPI subsystem.  Check to make sure the "   \
+                           "ACPI subsystem is properly loaded.")
+
+static const char *apm_readinfo (BatteryStatus *status);
+static gboolean pm_initialised = FALSE;
+#ifdef HAVE_UPOWER
+static gboolean using_upower = FALSE;
+#endif
+
+/*
+ * What follows is a series of platform-specific apm_readinfo functions
+ * that take care of the quirks of getting battery information for different
+ * platforms.  Each function takes a BatteryStatus pointer and fills it
+ * then returns a const char *.
+ *
+ * In the case of success, NULL is returned.  In case of failure, a
+ * localised error message is returned to give the user hints about what
+ * the problem might be.  This error message is not to be freed.
+ */
+
+/* Uncomment the following to enable a 'testing' backend.  When you add the
+   applet to the panel a window will appear that allows you to manually
+   change the battery status values for testing purposes.
+
+   NB: Be sure to unset this before committing!!
+ */
+
+/* #define BATTSTAT_TESTING_BACKEND */
+#ifdef BATTSTAT_TESTING_BACKEND
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+BatteryStatus test_status;
+
+static void
+test_update_boolean (GtkToggleButton *button, gboolean *value)
+{
+  *value = gtk_toggle_button_get_active (button);
+}
+
+static void
+test_update_integer (GtkSpinButton *spin, gint *value)
+{
+  *value = gtk_spin_button_get_value_as_int (spin);
+}
+
+static void
+initialise_test (void)
+{
+  GtkWidget *w;
+  GtkBox *box;
+
+  test_status.percent = 50;
+  test_status.minutes = 180;
+  test_status.present = TRUE;
+  test_status.on_ac_power = FALSE;
+  test_status.charging = FALSE;
+
+  box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 5));
+
+  gtk_box_pack_start (box, gtk_label_new ("percent"), TRUE, TRUE, 0);
+  w = gtk_spin_button_new_with_range (-1.0, 100.0, 1);
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (w), 50.0);
+  g_signal_connect (w, "value-changed",
+                    G_CALLBACK (test_update_integer), &test_status.percent);
+  gtk_box_pack_start (box, w, TRUE, TRUE, 0);
+
+  gtk_box_pack_start (box, gtk_label_new ("minutes"), TRUE, TRUE, 0);
+  w = gtk_spin_button_new_with_range (-1.0, 1000.0, 1);
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (w), 180.0);
+  g_signal_connect (w, "value-changed",
+                    G_CALLBACK (test_update_integer), &test_status.minutes);
+  gtk_box_pack_start (box, w, TRUE, TRUE, 0);
+
+  w = gtk_toggle_button_new_with_label ("on_ac_power");
+  g_signal_connect (w, "toggled",
+                    G_CALLBACK (test_update_boolean),
+                    &test_status.on_ac_power);
+  gtk_box_pack_start (box, w, TRUE, TRUE, 0);
+
+  w = gtk_toggle_button_new_with_label ("charging");
+  g_signal_connect (w, "toggled",
+                    G_CALLBACK (test_update_boolean), &test_status.charging);
+  gtk_box_pack_start (box, w, TRUE, TRUE, 0);
+
+  w = gtk_toggle_button_new_with_label ("present");
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), TRUE);
+  g_signal_connect (w, "toggled",
+                    G_CALLBACK (test_update_boolean), &test_status.present);
+  gtk_box_pack_start (box, w, TRUE, TRUE, 0);
+
+  w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_container_add (GTK_CONTAINER (w), GTK_WIDGET (box));
+  gtk_widget_show_all (w);
+}
+
+static const char *
+apm_readinfo (BatteryStatus *status)
+{
+  static int test_initialised;
+
+  if (!test_initialised)
+    initialise_test ();
+
+  test_initialised = 1;
+  *status = test_status;
+
+  return NULL;
+}
+
+#undef __linux__
+
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+
+#include <machine/apm_bios.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "acpi-freebsd.h"
+
+static struct acpi_info acpiinfo;
+static gboolean using_acpi;
+static int acpi_count;
+static struct apm_info apminfo;
+
+#define APMDEVICE "/dev/apm"
+
+static const char *
+apm_readinfo (BatteryStatus *status)
+{
+  int fd;
+
+  if (DEBUG) g_print ("apm_readinfo () (FreeBSD)\n");
+
+  if (using_acpi) {
+    if (acpi_count <= 0) {
+      acpi_count = 30;
+      acpi_process_event (&acpiinfo);
+      if (acpi_freebsd_read (&apminfo, &acpiinfo) == FALSE)
+        return ERR_FREEBSD_ACPI;
+    }
+    acpi_count--;
+  }
+  else
+  {
+    /* This is how I read the information from the APM subsystem under
+       FreeBSD.  Each time this functions is called (once every second)
+       the APM device is opened, read from and then closed.
+    */
+    fd = open (APMDEVICE, O_RDONLY);
+    if (fd == -1) {
+      return ERR_OPEN_APMDEV;
+    }
+
+    if (ioctl (fd, APMIO_GETINFO, &apminfo) == -1)
+      err (1, "ioctl (APMIO_GETINFO)");
+
+    close (fd);
+
+    if (apminfo.ai_status == 0)
+      return ERR_APM_E;
+  }
+
+  status->present = TRUE;
+  status->on_ac_power = apminfo.ai_acline ? 1 : 0;
+  status->percent = apminfo.ai_batt_life;
+  status->charging = (apminfo.ai_batt_stat) ? TRUE : FALSE;
+  if (using_acpi)
+    status->minutes = apminfo.ai_batt_time;
+  else
+    status->minutes = (int) (apminfo.ai_batt_time/60.0);
+
+  return NULL;
+}
+
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
+
+#include <sys/param.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#if defined(__NetBSD__)
+#include <dev/apm/apmio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#else /* __OpenBSD__ */
+#include <machine/apmvar.h>
+#endif
+
+#define APMDEVICE "/dev/apm"
+
+static const char *
+apm_readinfo (BatteryStatus *status)
+{
+  /* Code for OpenBSD by Joe Ammond <jra@twinight.org>. Using the same
+     procedure as for FreeBSD.
+  */
+#if defined(__NetBSD__)
+  struct apm_power_info apminfo;
+#else /* __OpenBSD__ */
+  struct apm_info apminfo;
+#endif
+  int fd;
+
+#if defined(__NetBSD__)
+  if (DEBUG) g_print ("apm_readinfo () (NetBSD)\n");
+#else /* __OpenBSD__ */
+  if (DEBUG) g_print ("apm_readinfo () (OpenBSD)\n");
+#endif
+
+  fd = open(APMDEVICE, O_RDONLY);
+  if (fd == -1)
+  {
+    pm_initialised = FALSE;
+    return ERR_OPEN_APMDEV;
+  }
+  if (ioctl (fd, APM_IOC_GETPOWER, &apminfo) == -1)
+    err(1, "ioctl (APM_IOC_GETPOWER)");
+  close (fd);
+
+  status->present = TRUE;
+  status->on_ac_power = apminfo.ac_state ? 1 : 0;
+  status->percent = apminfo.battery_life;
+  status->charging = (apminfo.battery_state == 3) ? TRUE : FALSE;
+  status->minutes = apminfo.minutes_left;
+
+  return NULL;
+}
+
+#elif __linux__
+
+#include <apm.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "acpi-linux.h"
+
+static struct acpi_info acpiinfo;
+static gboolean using_acpi;
+static int acpi_count;
+static int acpiwatch;
+static struct apm_info apminfo;
+
+static gboolean acpi_callback (GIOChannel * chan, GIOCondition cond, gpointer data)
+{
+  if (cond & (G_IO_ERR | G_IO_HUP)) {
+    acpi_linux_cleanup (&acpiinfo);
+    apminfo.battery_percentage = -1;
+    return FALSE;
+  }
+  
+  if (acpi_process_event (&acpiinfo)) {
+    acpi_linux_read (&apminfo, &acpiinfo);
+  }
+  return TRUE;
+}
+
+static const char *
+apm_readinfo (BatteryStatus *status)
+{
+  /* Code for Linux by Thomas Hood <jdthood@mail.com>. apm_read () will
+     read from /proc/... instead and we do not need to open the device
+     ourselves.
+  */
+  if (DEBUG) g_print ("apm_readinfo () (Linux)\n");
+
+  /* ACPI support added by Lennart Poettering <lennart@poettering.de> 10/27/2001
+   * Updated by David Moore <dcm@acm.org> 5/29/2003 to poll less and
+   *   use ACPI events. */
+  if (using_acpi && acpiinfo.event_fd >= 0) {
+    if (acpi_count <= 0) {
+      /* Only call this one out of 30 calls to apm_readinfo () (every 30 seconds)
+       * since reading the ACPI system takes CPU cycles. */
+      acpi_count=30;
+      acpi_linux_read (&apminfo, &acpiinfo);
+    }
+    acpi_count--;
+  }
+  /* If we lost the file descriptor with ACPI events, try to get it back. */
+  else if (using_acpi) {
+      if (acpi_linux_init (&acpiinfo)) {
+          acpiwatch = g_io_add_watch (acpiinfo.channel,
+              G_IO_IN | G_IO_ERR | G_IO_HUP,
+              acpi_callback, NULL);
+          acpi_linux_read (&apminfo, &acpiinfo);
+      }
+  }
+  else
+    apm_read (&apminfo);
+
+  status->present = TRUE;
+  status->on_ac_power = apminfo.ac_line_status ? 1 : 0;
+  status->percent = (guint) apminfo.battery_percentage;
+  status->charging = (apminfo.battery_flags & 0x8) ? TRUE : FALSE;
+  status->minutes = apminfo.battery_time;
+
+  return NULL;
+}
+
+#else
+
+static const char *
+apm_readinfo (BatteryStatus *status)
+{
+  status->present = FALSE;
+  status->on_ac_power = 1;
+  status->percent = 100;
+  status->charging = FALSE;
+  status->minutes = 0;
+
+  return ERR_NO_SUPPORT;
+}
+
+#endif
+
+/*
+ * End platform-specific code.
+ */
+
+/*
+ * power_management_getinfo
+ *
+ * Main interface to the power management code.  Fills 'status' for you so
+ * you don't have to worry about platform-specific details.
+ *
+ * In the case of success, NULL is returned.  In case of failure, a
+ * localised error message is returned to give the user hints about what
+ * the problem might be.  This error message is not to be freed.
+ */
+const char *
+power_management_getinfo (BatteryStatus *status)
+{
+  const char *retval;
+
+  if (!pm_initialised)
+  {
+    status->on_ac_power = TRUE;
+    status->minutes = -1;
+    status->percent = 0;
+    status->charging = FALSE;
+    status->present = FALSE;
+
+    return NULL;
+  }
+
+#ifdef HAVE_UPOWER
+  if (using_upower)
+  {
+    battstat_upower_get_battery_info (status);
+    return NULL;
+  }
+#endif
+
+  retval = apm_readinfo (status);
+
+  if (status->percent == -1) {
+    status->percent = 0;
+    status->present = FALSE;
+  }
+
+  if (status->percent > 100)
+    status->percent = 100;
+
+  if (status->percent == 100)
+    status->charging = FALSE;
+
+  if (!status->on_ac_power)
+    status->charging = FALSE;
+
+  return retval;
+}
+
+/*
+ * power_management_initialise
+ *
+ * Initialise the power management code.  Call this before you call anything
+ * else.
+ *
+ * In the case of success, NULL is returned.  In case of failure, a
+ * localised error message is returned to give the user hints about what
+ * the problem might be.  This error message is not to be freed.
+ */
+const char *
+power_management_initialise (void (*callback) (void))
+{
+#ifdef __linux__
+  struct stat statbuf;
+#endif /* __linux__ */
+#ifdef HAVE_UPOWER
+  char *err;
+
+  err = battstat_upower_initialise (callback);
+
+  if (err == NULL) /* UPOWER is up */
+  {
+    pm_initialised = TRUE;
+    using_upower = TRUE;
+    return NULL;
+  }
+  else
+    /* fallback to legacy methods */
+    g_free (err);
+#endif /* HAVE_UPOWER */
+
+#ifdef __linux__
+
+  if (acpi_linux_init (&acpiinfo)) {
+    using_acpi = TRUE;
+    acpi_count = 0;
+  }
+  else
+    using_acpi = FALSE;
+
+  /* If neither ACPI nor APM could be read, but ACPI does seem to be
+   * installed, warn the user how to get ACPI working. */
+  if (!using_acpi && (apm_exists () == 1) &&
+          (stat ("/proc/acpi", &statbuf) == 0)) {
+    using_acpi = TRUE;
+    acpi_count = 0;
+    return ERR_ACPID;
+  }
+
+  /* Watch for ACPI events and handle them immediately with acpi_callback (). */
+  if (using_acpi && acpiinfo.event_fd >= 0) {
+    acpiwatch = g_io_add_watch (acpiinfo.channel,
+        G_IO_IN | G_IO_ERR | G_IO_HUP,
+        acpi_callback, NULL);
+  }
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+  if (acpi_freebsd_init (&acpiinfo)) {
+    using_acpi = TRUE;
+    acpi_count = 0;
+  }
+  else
+    using_acpi = FALSE;
+#endif
+  pm_initialised = TRUE;
+
+  return NULL;
+}
+
+/*
+ * power_management_cleanup
+ *
+ * Perform any cleanup that might be required.
+ */
+void
+power_management_cleanup (void)
+{
+#ifdef HAVE_UPOWER
+  if (using_upower)
+  {
+    battstat_upower_cleanup ();
+    pm_initialised = TRUE;
+    return;
+  }
+#endif
+
+#ifdef __linux__
+  if (using_acpi)
+  {
+    if (acpiwatch != 0)
+      g_source_remove (acpiwatch);
+     acpiwatch = 0;
+     acpi_linux_cleanup (&acpiinfo);
+  }
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+  if (using_acpi) {
+    acpi_freebsd_cleanup (&acpiinfo);
+  }
+#endif
+
+  pm_initialised = FALSE;
+}
+
+gboolean
+power_management_using_upower (void)
+{
+#ifdef HAVE_UPOWER
+ return using_upower;
+#else
+ return FALSE;
+#endif
+}
+
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/130.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/130.html new file mode 100644 index 00000000..76c7f562 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/130.html @@ -0,0 +1,1485 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.sticky_notes"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[6670]; const double alignment; void * const ptr;}  sticky_notes_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0124, 0001, 0000, 0000, 0000, 0000, 0000, 0050, 0013, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0005, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0010, 0000, 0000, 0000, 0011, 0000, 0000, 0000, 0013, 0000, 0000, 0000, 0275, 0342, 0315, 0116, 
+  0004, 0000, 0000, 0000, 0124, 0001, 0000, 0000, 0015, 0000, 0114, 0000, 0144, 0001, 0000, 0000, 
+  0150, 0001, 0000, 0000, 0122, 0175, 0330, 0353, 0002, 0000, 0000, 0000, 0150, 0001, 0000, 0000, 
+  0026, 0000, 0166, 0000, 0200, 0001, 0000, 0000, 0026, 0005, 0000, 0000, 0231, 0257, 0032, 0252, 
+  0000, 0000, 0000, 0000, 0026, 0005, 0000, 0000, 0015, 0000, 0114, 0000, 0044, 0005, 0000, 0000, 
+  0074, 0005, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0074, 0005, 0000, 0000, 
+  0001, 0000, 0114, 0000, 0100, 0005, 0000, 0000, 0104, 0005, 0000, 0000, 0201, 0321, 0040, 0031, 
+  0005, 0000, 0000, 0000, 0104, 0005, 0000, 0000, 0005, 0000, 0114, 0000, 0114, 0005, 0000, 0000, 
+  0120, 0005, 0000, 0000, 0113, 0120, 0220, 0013, 0003, 0000, 0000, 0000, 0120, 0005, 0000, 0000, 
+  0004, 0000, 0114, 0000, 0124, 0005, 0000, 0000, 0130, 0005, 0000, 0000, 0015, 0303, 0162, 0323, 
+  0002, 0000, 0000, 0000, 0130, 0005, 0000, 0000, 0010, 0000, 0166, 0000, 0140, 0005, 0000, 0000, 
+  0361, 0005, 0000, 0000, 0314, 0310, 0150, 0001, 0002, 0000, 0000, 0000, 0361, 0005, 0000, 0000, 
+  0032, 0000, 0166, 0000, 0020, 0006, 0000, 0000, 0072, 0013, 0000, 0000, 0121, 0340, 0345, 0262, 
+  0002, 0000, 0000, 0000, 0072, 0013, 0000, 0000, 0033, 0000, 0166, 0000, 0130, 0013, 0000, 0000, 
+  0061, 0022, 0000, 0000, 0065, 0173, 0044, 0273, 0002, 0000, 0000, 0000, 0061, 0022, 0000, 0000, 
+  0024, 0000, 0166, 0000, 0110, 0022, 0000, 0000, 0132, 0026, 0000, 0000, 0230, 0302, 0153, 0170, 
+  0002, 0000, 0000, 0000, 0132, 0026, 0000, 0000, 0032, 0000, 0166, 0000, 0170, 0026, 0000, 0000, 
+  0015, 0032, 0000, 0000, 0155, 0141, 0164, 0145, 0055, 0141, 0160, 0160, 0154, 0145, 0164, 0163, 
+  0057, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0163, 0164, 0151, 0143, 0153, 0171, 0055, 0156, 
+  0157, 0164, 0145, 0163, 0055, 0144, 0145, 0154, 0145, 0164, 0145, 0056, 0165, 0151, 0000, 0000, 
+  0245, 0032, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0131, 0115, 0163, 0332, 0060, 
+  0020, 0275, 0347, 0127, 0250, 0272, 0166, 0214, 0201, 0174, 0064, 0007, 0160, 0146, 0332, 0114, 
+  0062, 0235, 0351, 0061, 0075, 0173, 0204, 0275, 0140, 0065, 0102, 0242, 0222, 0314, 0107, 0177, 
+  0175, 0327, 0066, 0111, 0060, 0010, 0033, 0033, 0332, 0246, 0063, 0334, 0204, 0275, 0157, 0265, 
+  0373, 0274, 0373, 0274, 0062, 0203, 0273, 0345, 0124, 0220, 0071, 0150, 0303, 0225, 0034, 0322, 
+  0136, 0247, 0113, 0011, 0310, 0110, 0305, 0134, 0116, 0206, 0364, 0373, 0323, 0203, 0167, 0113, 
+  0357, 0202, 0213, 0301, 0007, 0317, 0043, 0217, 0040, 0101, 0063, 0013, 0061, 0131, 0160, 0233, 
+  0220, 0211, 0140, 0061, 0220, 0313, 0116, 0277, 0337, 0351, 0021, 0317, 0103, 0043, 0056, 0055, 
+  0350, 0061, 0213, 0040, 0270, 0040, 0144, 0240, 0341, 0147, 0312, 0065, 0030, 0042, 0370, 0150, 
+  0110, 0047, 0366, 0371, 0043, 0175, 0333, 0050, 0203, 0121, 0077, 0267, 0123, 0243, 0037, 0020, 
+  0131, 0022, 0011, 0146, 0314, 0220, 0076, 0332, 0347, 0257, 0123, 0066, 0001, 0112, 0170, 0074, 
+  0244, 0074, 0133, 0206, 0021, 0223, 0021, 0010, 0232, 0131, 0243, 0375, 0114, 0253, 0031, 0150, 
+  0273, 0042, 0222, 0115, 0141, 0110, 0347, 0334, 0360, 0221, 0000, 0032, 0074, 0351, 0024, 0006, 
+  0376, 0313, 0135, 0267, 0061, 0172, 0012, 0307, 0052, 0112, 0015, 0015, 0036, 0230, 0060, 0265, 
+  0366, 0074, 0122, 0062, 0314, 0226, 0064, 0300, 0073, 0021, 0030, 0343, 0031, 0253, 0146, 0145, 
+  0330, 0300, 0057, 0122, 0070, 0060, 0233, 0030, 0004, 0130, 0370, 0307, 0331, 0100, 0314, 0255, 
+  0127, 0104, 0322, 0044, 0231, 0173, 0316, 0204, 0232, 0024, 0331, 0024, 0350, 0060, 0056, 0056, 
+  0235, 0046, 0302, 0221, 0322, 0061, 0350, 0160, 0301, 0143, 0233, 0320, 0340, 0272, 0316, 0034, 
+  0253, 0213, 0377, 0142, 0071, 0137, 0007, 0271, 0237, 0252, 0230, 0211, 0303, 0270, 0265, 0253, 
+  0031, 0204, 0011, 0126, 0064, 0015, 0212, 0014, 0167, 0000, 0121, 0302, 0105, 0134, 0254, 0063, 
+  0270, 0300, 0272, 0117, 0224, 0300, 0360, 0375, 0265, 0201, 0277, 0141, 0121, 0130, 0223, 0274, 
+  0103, 0044, 0023, 0136, 0376, 0023, 0037, 0367, 0110, 0055, 0351, 0253, 0217, 0035, 0272, 0077, 
+  0343, 0335, 0202, 0353, 0074, 0004, 0257, 0144, 0336, 0260, 0170, 0332, 0074, 0036, 0027, 0106, 
+  0151, 0016, 0322, 0062, 0213, 0155, 0114, 0003, 0354, 0147, 0313, 0043, 0046, 0016, 0001, 0232, 
+  0031, 0213, 0120, 0125, 0150, 0320, 0273, 0162, 0232, 0273, 0031, 0142, 0121, 0266, 0123, 0310, 
+  0064, 0260, 0215, 0314, 0235, 0144, 0245, 0326, 0052, 0271, 0115, 0331, 0076, 0174, 0013, 0366, 
+  0332, 0062, 0350, 0302, 0011, 0266, 0122, 0251, 0015, 0215, 0135, 0145, 0073, 0202, 0214, 0367, 
+  0002, 0113, 0145, 0126, 0227, 0175, 0221, 0372, 0050, 0137, 0367, 0350, 0066, 0312, 0025, 0306, 
+  0010, 0205, 0225, 0130, 0315, 0244, 0021, 0314, 0146, 0255, 0064, 0244, 0053, 0300, 0154, 0302, 
+  0057, 0271, 0350, 0356, 0013, 0253, 0065, 0201, 0065, 0044, 0266, 0201, 0306, 0060, 0146, 0251, 
+  0260, 0315, 0301, 0032, 0042, 0340, 0163, 0060, 0157, 0036, 0052, 0237, 0241, 0123, 0122, 0163, 
+  0165, 0017, 0066, 0337, 0123, 0115, 0340, 0251, 0201, 0060, 0225, 0250, 0031, 0202, 0313, 0026, 
+  0304, 0061, 0261, 0140, 0053, 0023, 0232, 0104, 0055, 0302, 0165, 0044, 0325, 0056, 0066, 0325, 
+  0275, 0354, 0230, 0105, 0317, 0330, 0234, 0365, 0133, 0302, 0162, 0306, 0144, 0334, 0202, 0251, 
+  0061, 0027, 0242, 0005, 0154, 0246, 0014, 0057, 0264, 0246, 0133, 0225, 0226, 0063, 0376, 0222, 
+  0002, 0037, 0337, 0120, 0375, 0343, 0032, 0352, 0336, 0361, 0266, 0075, 0067, 0124, 0145, 0103, 
+  0305, 0215, 0051, 0073, 0067, 0324, 0341, 0015, 0325, 0073, 0105, 0103, 0271, 0010, 0160, 0047, 
+  0337, 0052, 0361, 0026, 0111, 0357, 0044, 0214, 0301, 0204, 0331, 0070, 0127, 0375, 0236, 0155, 
+  0252, 0073, 0016, 0212, 0166, 0350, 0331, 0325, 0232, 0212, 0031, 0057, 0301, 0341, 0356, 0323, 
+  0173, 0232, 0121, 0152, 0206, 0361, 0372, 0071, 0257, 0177, 0354, 0120, 0263, 0175, 0166, 0272, 
+  0244, 0177, 0107, 0064, 0033, 0067, 0325, 0234, 0011, 0076, 0301, 0132, 0061, 0226, 0151, 0333, 
+  0250, 0033, 0371, 0022, 0104, 0210, 0247, 0030, 0014, 0370, 0352, 0266, 0221, 0120, 0276, 0035, 
+  0346, 0326, 0243, 0356, 0202, 0151, 0211, 0304, 0067, 0166, 0122, 0354, 0176, 0163, 0236, 0032, 
+  0116, 0061, 0065, 0274, 0164, 0163, 0166, 0124, 0173, 0267, 0345, 0172, 0360, 0031, 0256, 0072, 
+  0175, 0067, 0005, 0337, 0212, 0021, 0050, 0043, 0041, 0237, 0206, 0056, 0273, 0324, 0005, 0074, 
+  0202, 0212, 0143, 0351, 0150, 0066, 0270, 0025, 0163, 0033, 0261, 0011, 0067, 0304, 0040, 0123, 
+  0317, 0010, 0121, 0026, 0356, 0232, 0356, 0260, 0134, 0153, 0104, 0267, 0051, 0160, 0165, 0060, 
+  0220, 0131, 0253, 0071, 0016, 0253, 0140, 0334, 0006, 0233, 0046, 0153, 0347, 0013, 0340, 0223, 
+  0304, 0122, 0202, 0012, 0226, 0346, 0232, 0057, 0142, 0352, 0357, 0161, 0357, 0127, 0373, 0337, 
+  0047, 0023, 0325, 0122, 0161, 0224, 0134, 0034, 0041, 0031, 0255, 0145, 0243, 0102, 0072, 0366, 
+  0312, 0307, 0261, 0075, 0324, 0377, 0277, 0133, 0350, 0051, 0353, 0035, 0164, 0217, 0175, 0103, 
+  0106, 0100, 0160, 0100, 0127, 0022, 0072, 0177, 0250, 0201, 0116, 0137, 0206, 0155, 0310, 0054, 
+  0252, 0260, 0015, 0362, 0240, 0001, 0275, 0135, 0021, 0236, 0117, 0053, 0357, 0377, 0264, 0122, 
+  0227, 0160, 0375, 0271, 0243, 0234, 0144, 0371, 0063, 0164, 0361, 0071, 0324, 0303, 0231, 0176, 
+  0002, 0366, 0125, 0305, 0313, 0227, 0211, 0006, 0063, 0123, 0322, 0140, 0064, 0336, 0015, 0015, 
+  0326, 0137, 0023, 0121, 0375, 0067, 0215, 0352, 0241, 0327, 0057, 0320, 0276, 0023, 0272, 0165, 
+  0321, 0224, 0377, 0174, 0030, 0370, 0033, 0177, 0046, 0375, 0006, 0310, 0171, 0303, 0135, 0000, 
+  0050, 0165, 0165, 0141, 0171, 0051, 0163, 0164, 0151, 0143, 0153, 0171, 0055, 0156, 0157, 0164, 
+  0145, 0163, 0057, 0000, 0006, 0000, 0000, 0000, 0012, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0011, 0000, 0000, 0000, 0010, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 
+  0005, 0000, 0000, 0000, 0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 0155, 0145, 0156, 0165, 0056, 0170, 0155, 0154, 
+  0122, 0001, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0155, 0217, 0321, 0015, 0302, 0060, 
+  0014, 0104, 0377, 0063, 0105, 0325, 0005, 0130, 0240, 0260, 0112, 0145, 0322, 0103, 0104, 0044, 
+  0166, 0224, 0270, 0102, 0154, 0017, 0264, 0110, 0111, 0221, 0077, 0357, 0371, 0235, 0145, 0117, 
+  0011, 0274, 0006, 0105, 0032, 0230, 0022, 0316, 0043, 0343, 0071, 0263, 0050, 0306, 0201, 0274, 
+  0006, 0341, 0236, 0234, 0056, 0156, 0372, 0323, 0357, 0141, 0301, 0066, 0255, 0255, 0320, 0063, 
+  0243, 0022, 0305, 0077, 0232, 0274, 0047, 0103, 0133, 0120, 0265, 0310, 0153, 0246, 0030, 0233, 
+  0175, 0200, 0337, 0122, 0105, 0246, 0102, 0052, 0305, 0330, 0220, 0013, 0156, 0050, 0140, 0337, 
+  0037, 0167, 0200, 0326, 0103, 0210, 0271, 0173, 0145, 0113, 0206, 0106, 0127, 0131, 0265, 0171, 
+  0277, 0370, 0021, 0235, 0173, 0003, 0073, 0200, 0164, 0005, 0000, 0050, 0165, 0165, 0141, 0171, 
+  0051, 0163, 0164, 0151, 0143, 0153, 0171, 0055, 0156, 0157, 0164, 0145, 0163, 0055, 0160, 0162, 
+  0157, 0160, 0145, 0162, 0164, 0151, 0145, 0163, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 0000, 
+  0073, 0070, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0133, 0337, 0163, 0342, 0066, 
+  0020, 0176, 0277, 0277, 0102, 0325, 0353, 0215, 0303, 0001, 0115, 0173, 0323, 0001, 0156, 0346, 
+  0322, 0046, 0355, 0114, 0247, 0163, 0063, 0227, 0173, 0326, 0010, 0131, 0140, 0065, 0102, 0162, 
+  0045, 0021, 0102, 0377, 0372, 0112, 0266, 0233, 0340, 0040, 0377, 0022, 0311, 0305, 0041, 0274, 
+  0001, 0336, 0135, 0357, 0176, 0253, 0157, 0167, 0055, 0344, 0311, 0247, 0273, 0025, 0007, 0267, 
+  0124, 0151, 0046, 0305, 0024, 0016, 0317, 0076, 0100, 0100, 0005, 0221, 0061, 0023, 0313, 0051, 
+  0374, 0166, 0175, 0031, 0175, 0204, 0237, 0146, 0357, 0046, 0077, 0104, 0021, 0270, 0242, 0202, 
+  0052, 0154, 0150, 0014, 0066, 0314, 0044, 0140, 0311, 0161, 0114, 0301, 0370, 0154, 0064, 0072, 
+  0033, 0202, 0050, 0262, 0102, 0114, 0030, 0252, 0026, 0230, 0320, 0331, 0073, 0000, 0046, 0212, 
+  0376, 0263, 0146, 0212, 0152, 0300, 0331, 0174, 0012, 0227, 0346, 0346, 0075, 0174, 0270, 0221, 
+  0123, 0203, 0203, 0114, 0116, 0316, 0377, 0246, 0304, 0000, 0302, 0261, 0326, 0123, 0170, 0145, 
+  0156, 0376, 0130, 0341, 0045, 0205, 0200, 0305, 0123, 0310, 0334, 0107, 0104, 0270, 0324, 0024, 
+  0072, 0141, 0053, 0236, 0052, 0231, 0122, 0145, 0266, 0100, 0340, 0025, 0235, 0302, 0133, 0246, 
+  0331, 0234, 0333, 0253, 0327, 0152, 0115, 0047, 0203, 0377, 0257, 0372, 0205, 0011, 0026, 0150, 
+  0041, 0311, 0132, 0303, 0331, 0045, 0346, 0272, 0121, 0236, 0021, 0051, 0220, 0373, 0010, 0147, 
+  0033, 0046, 0142, 0271, 0211, 0062, 0127, 0312, 0152, 0223, 0101, 0036, 0101, 0313, 0140, 0022, 
+  0312, 0323, 0027, 0216, 0305, 0271, 0020, 0315, 0225, 0334, 0150, 0252, 0272, 0304, 0362, 0053, 
+  0303, 0134, 0056, 0363, 0140, 0264, 0141, 0344, 0146, 0053, 0244, 0241, 0250, 0060, 0300, 0250, 
+  0206, 0117, 0343, 0352, 0134, 0252, 0230, 0052, 0264, 0141, 0261, 0111, 0340, 0354, 0274, 0111, 
+  0334, 0060, 0143, 0101, 0003, 0106, 0141, 0241, 0071, 0066, 0330, 0102, 0070, 0205, 0133, 0347, 
+  0315, 0327, 0314, 0111, 0360, 0227, 0365, 0022, 0174, 0271, 0367, 0262, 0311, 0236, 0135, 0263, 
+  0354, 0137, 0234, 0045, 0242, 0225, 0273, 0146, 0233, 0332, 0264, 0332, 0305, 0017, 0147, 0161, 
+  0206, 0320, 0236, 0002, 0111, 0030, 0217, 0363, 0317, 0116, 0235, 0133, 0212, 0044, 0222, 0333, 
+  0030, 0007, 0205, 0300, 0140, 0107, 0042, 0227, 0006, 0031, 0231, 0004, 0346, 0121, 0366, 0325, 
+  0056, 0216, 0271, 0274, 0203, 0367, 0066, 0366, 0162, 0363, 0331, 0136, 0315, 0022, 0223, 0273, 
+  0020, 0225, 0304, 0073, 0056, 0265, 0220, 0034, 0372, 0164, 0244, 0142, 0124, 0030, 0154, 0054, 
+  0343, 0341, 0354, 0326, 0201, 0117, 0060, 0157, 0243, 0250, 0123, 0114, 0154, 0001, 0202, 0263, 
+  0221, 0127, 0332, 0017, 0020, 0046, 0356, 0106, 0010, 0053, 0212, 0167, 0002, 0367, 0142, 0265, 
+  0066, 0106, 0212, 0307, 0210, 0125, 0351, 0007, 0200, 0027, 0012, 0240, 0117, 0217, 0343, 0255, 
+  0134, 0033, 0244, 0315, 0326, 0335, 0221, 0212, 0270, 0122, 0261, 0264, 0312, 0232, 0242, 0317, 
+  0103, 0167, 0225, 0140, 0236, 0175, 0037, 0301, 0307, 0232, 0076, 0127, 0346, 0224, 0173, 0211, 
+  0206, 0176, 0267, 0206, 0252, 0034, 0013, 0206, 0260, 0001, 0306, 0020, 0325, 0230, 0056, 0360, 
+  0232, 0233, 0356, 0312, 0212, 0022, 0312, 0156, 0251, 0176, 0260, 0120, 0233, 0105, 0157, 0005, 
+  0316, 0132, 0301, 0354, 0241, 0015, 0164, 0121, 0136, 0153, 0212, 0326, 0302, 0226, 0014, 0316, 
+  0104, 0000, 0154, 0230, 0157, 0360, 0126, 0043, 0235, 0310, 0015, 0052, 0374, 0250, 0067, 0261, 
+  0333, 0011, 0312, 0206, 0061, 0271, 0261, 0334, 0154, 0276, 0045, 0275, 0113, 0261, 0210, 0003, 
+  0160, 0132, 0060, 0316, 0003, 0324, 0122, 0251, 0131, 0136, 0152, 0076, 0324, 0205, 0345, 0365, 
+  0277, 0124, 0200, 0017, 0041, 0124, 0066, 0037, 0074, 0011, 0243, 0056, 0366, 0047, 0215, 0023, 
+  0245, 0152, 0051, 0105, 0272, 0042, 0166, 0342, 0124, 0173, 0116, 0015, 0237, 0202, 0123, 0076, 
+  0000, 0374, 0301, 0007, 0005, 0036, 0020, 0364, 0136, 0300, 0326, 0031, 0344, 0006, 0272, 0372, 
+  0126, 0333, 0265, 0364, 0170, 0040, 0332, 0203, 0147, 0277, 0334, 0324, 0114, 0171, 0156, 0274, 
+  0033, 0216, 0372, 0064, 0247, 0064, 0014, 0355, 0007, 0317, 0210, 0265, 0163, 0342, 0360, 0343, 
+  0301, 0123, 0121, 0011, 0331, 0061, 0374, 0076, 0365, 0266, 0063, 0041, 0073, 0301, 0125, 0013, 
+  0331, 0117, 0265, 0132, 0136, 0324, 0374, 0310, 0375, 0231, 0367, 0060, 0207, 0135, 0326, 0316, 
+  0306, 0347, 0320, 0247, 0170, 0000, 0200, 0207, 0202, 0330, 0255, 0363, 0126, 0077, 0050, 0066, 
+  0331, 0274, 0303, 0234, 0055, 0353, 0347, 0217, 0102, 0021, 0033, 0243, 0230, 0035, 0023, 0250, 
+  0366, 0013, 0354, 0212, 0024, 0306, 0067, 0224, 0055, 0023, 0003, 0301, 0055, 0346, 0353, 0214, 
+  0156, 0074, 0206, 0203, 0012, 0363, 0203, 0172, 0373, 0125, 0175, 0250, 0276, 0027, 0035, 0324, 
+  0217, 0016, 0350, 0111, 0301, 0263, 0136, 0115, 0157, 0252, 0234, 0371, 0272, 0056, 0376, 0053, 
+  0305, 0342, 0174, 0355, 0057, 0355, 0247, 0341, 0153, 0130, 0371, 0053, 0254, 0226, 0114, 0040, 
+  0116, 0027, 0166, 0342, 0032, 0216, 0272, 0252, 0053, 0073, 0355, 0264, 0053, 0042, 0136, 0347, 
+  0045, 0137, 0257, 0304, 0203, 0201, 0026, 0367, 0257, 0314, 0106, 0313, 0162, 0064, 0206, 0125, 
+  0312, 0007, 0046, 0346, 0051, 0222, 0323, 0361, 0241, 0340, 0332, 0155, 0165, 0375, 0022, 0142, 
+  0264, 0343, 0254, 0133, 0271, 0170, 0004, 0135, 0111, 0301, 0110, 0144, 0373, 0374, 0222, 0332, 
+  0005, 0224, 0155, 0276, 0041, 0333, 0223, 0324, 0066, 0304, 0136, 0353, 0222, 0131, 0137, 0265, 
+  0232, 0053, 0227, 0027, 0150, 0113, 0001, 0144, 0113, 0045, 0046, 0111, 0053, 0017, 0074, 0133, 
+  0177, 0062, 0355, 0142, 0240, 0246, 0032, 0325, 0126, 0244, 0020, 0036, 0374, 0346, 0122, 0222, 
+  0363, 0140, 0047, 0107, 0057, 0304, 0205, 0120, 0023, 0106, 0112, 0156, 0130, 0212, 0014, 0275, 
+  0063, 0376, 0035, 0336, 0224, 0022, 0266, 0330, 0002, 0014, 0262, 0040, 0301, 0102, 0052, 0140, 
+  0022, 0333, 0063, 0245, 0241, 0057, 0276, 0244, 0206, 0107, 0266, 0244, 0056, 0022, 0112, 0112, 
+  0273, 0035, 0366, 0301, 0035, 0331, 0212, 0056, 0025, 0042, 0356, 0022, 0174, 0212, 0032, 0367, 
+  0115, 0123, 0120, 0154, 0010, 0000, 0042, 0221, 0065, 0036, 0202, 0142, 0037, 0026, 0157, 0300, 
+  0376, 0106, 0225, 0251, 0244, 0050, 0223, 0332, 0140, 0145, 0136, 0260, 0374, 0307, 0012, 0157, 
+  0020, 0023, 0261, 0175, 0352, 0060, 0122, 0265, 0265, 0323, 0367, 0312, 0035, 0304, 0323, 0342, 
+  0101, 0167, 0324, 0057, 0212, 0356, 0114, 0077, 0013, 0051, 0114, 0301, 0316, 0234, 0155, 0257, 
+  0154, 0014, 0352, 0070, 0247, 0166, 0253, 0062, 0227, 0026, 0034, 0160, 0201, 0034, 0072, 0275, 
+  0032, 0247, 0166, 0362, 0365, 0306, 0307, 0251, 0376, 0022, 0353, 0304, 0051, 0077, 0247, 0262, 
+  0277, 0331, 0321, 0305, 0113, 0163, 0352, 0210, 0070, 0060, 0176, 0005, 0363, 0137, 0336, 0146, 
+  0236, 0145, 0374, 0133, 0110, 0044, 0314, 0151, 0372, 0073, 0115, 0177, 0317, 0112, 0262, 0037, 
+  0217, 0147, 0372, 0313, 0152, 0357, 0056, 0101, 0037, 0146, 0100, 0370, 0146, 0331, 0323, 0270, 
+  0207, 0160, 0221, 0110, 0151, 0253, 0016, 0006, 0016, 0055, 0220, 0241, 0325, 0161, 0037, 0241, 
+  0313, 0231, 0264, 0057, 0214, 0334, 0370, 0357, 0225, 0037, 0251, 0073, 0222, 0255, 0213, 0276, 
+  0063, 0043, 0073, 0271, 0170, 0142, 0106, 0113, 0146, 0174, 0047, 0122, 0034, 0061, 0037, 0306, 
+  0375, 0336, 0047, 0070, 0075, 0315, 0354, 0375, 0327, 0342, 0266, 0010, 0172, 0265, 0067, 0220, 
+  0225, 0054, 0227, 0255, 0067, 0376, 0124, 0164, 0336, 0057, 0052, 0271, 0165, 0262, 0327, 0131, 
+  0134, 0232, 0116, 0215, 0245, 0345, 0310, 0165, 0150, 0137, 0311, 0301, 0376, 0152, 0357, 0002, 
+  0302, 0252, 0100, 0273, 0151, 0355, 0050, 0373, 0322, 0263, 0222, 0251, 0127, 0007, 0115, 0102, 
+  0316, 0132, 0264, 0072, 0377, 0030, 0166, 0316, 0344, 0315, 0037, 0260, 0176, 0005, 0207, 0101, 
+  0233, 0262, 0337, 0174, 0254, 0263, 0034, 0144, 0371, 0075, 0237, 0374, 0205, 0223, 0242, 0275, 
+  0337, 0037, 0324, 0052, 0377, 0014, 0024, 0325, 0251, 0024, 0332, 0172, 0023, 0015, 0207, 0371, 
+  0253, 0133, 0305, 0361, 0362, 0311, 0240, 0044, 0331, 0254, 0377, 0063, 0234, 0355, 0036, 0117, 
+  0367, 0352, 0077, 0372, 0121, 0227, 0137, 0012, 0233, 0014, 0166, 0136, 0361, 0373, 0017, 0160, 
+  0272, 0242, 0243, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0163, 0164, 0151, 0143, 0153, 0171, 
+  0055, 0156, 0157, 0164, 0145, 0163, 0055, 0160, 0162, 0145, 0146, 0145, 0162, 0145, 0156, 0143, 
+  0145, 0163, 0056, 0165, 0151, 0000, 0000, 0000, 0326, 0126, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0134, 0135, 0223, 0332, 0066, 0024, 0175, 0317, 0257, 0120, 0375, 0324, 0116, 
+  0207, 0260, 0146, 0223, 0064, 0323, 0001, 0062, 0315, 0146, 0066, 0351, 0114, 0247, 0263, 0063, 
+  0111, 0246, 0217, 0036, 0141, 0137, 0260, 0262, 0102, 0162, 0045, 0261, 0054, 0375, 0365, 0225, 
+  0144, 0357, 0142, 0300, 0330, 0130, 0260, 0213, 0027, 0374, 0146, 0100, 0367, 0112, 0367, 0110, 
+  0347, 0176, 0110, 0302, 0375, 0017, 0367, 0123, 0212, 0356, 0100, 0110, 0302, 0331, 0300, 0363, 
+  0137, 0137, 0170, 0010, 0130, 0310, 0043, 0302, 0046, 0003, 0357, 0373, 0267, 0353, 0316, 0173, 
+  0357, 0303, 0360, 0125, 0377, 0247, 0116, 0007, 0175, 0006, 0006, 0002, 0053, 0210, 0320, 0234, 
+  0250, 0030, 0115, 0050, 0216, 0000, 0135, 0276, 0356, 0365, 0136, 0373, 0250, 0323, 0321, 0215, 
+  0010, 0123, 0040, 0306, 0070, 0204, 0341, 0053, 0204, 0372, 0002, 0376, 0235, 0021, 0001, 0022, 
+  0121, 0062, 0032, 0170, 0023, 0165, 0373, 0253, 0267, 0354, 0310, 0210, 0171, 0135, 0333, 0216, 
+  0217, 0176, 0100, 0250, 0120, 0110, 0261, 0224, 0003, 0357, 0263, 0272, 0375, 0043, 0372, 0061, 
+  0223, 0152, 0012, 0114, 0171, 0210, 0104, 0003, 0017, 0077, 0176, 0366, 0075, 0043, 0241, 0145, 
+  0022, 0301, 0023, 0020, 0152, 0201, 0030, 0236, 0302, 0300, 0243, 0174, 0016, 0302, 0033, 0372, 
+  0375, 0356, 0303, 0017, 0305, 0355, 0146, 0111, 0142, 0332, 0275, 0275, 0270, 0250, 0152, 0171, 
+  0207, 0351, 0014, 0166, 0320, 0050, 0025, 0044, 0001, 0141, 0241, 0000, 0073, 0336, 0241, 0137, 
+  0251, 0071, 0301, 0023, 0130, 0225, 0130, 0023, 0351, 0167, 0123, 0104, 0352, 0202, 0323, 0153, 
+  0301, 0371, 0163, 0252, 0345, 0123, 0134, 0210, 0171, 0014, 0102, 0312, 0045, 0154, 0301, 0345, 
+  0216, 0110, 0062, 0242, 0372, 0327, 0157, 0142, 0006, 0125, 0003, 0013, 0061, 0013, 0306, 0074, 
+  0234, 0111, 0157, 0170, 0215, 0251, 0254, 0154, 0117, 0102, 0316, 0002, 0363, 0350, 0015, 0347, 
+  0204, 0105, 0174, 0336, 0261, 0103, 0331, 0313, 0230, 0030, 0150, 0162, 0144, 0133, 0314, 0020, 
+  0072, 0043, 0301, 0347, 0022, 0104, 0035, 0133, 0076, 0021, 0114, 0371, 0044, 0065, 0046, 0021, 
+  0060, 0006, 0241, 0235, 0014, 0310, 0040, 0112, 0277, 0077, 0314, 0070, 0107, 0134, 0104, 0040, 
+  0202, 0071, 0211, 0124, 0254, 0327, 0161, 0125, 0163, 0105, 0224, 0106, 0014, 0051, 0201, 0231, 
+  0244, 0130, 0141, 0215, 0337, 0300, 0133, 0200, 0356, 0355, 0253, 0042, 0341, 0355, 0002, 0375, 
+  0315, 0225, 0366, 0136, 0067, 0313, 0341, 0126, 0151, 0324, 0316, 0216, 0374, 0207, 0355, 0074, 
+  0354, 0064, 0140, 0265, 0110, 0364, 0254, 0022, 0263, 0320, 0123, 0040, 0066, 0004, 0302, 0230, 
+  0320, 0050, 0175, 0066, 0342, 0124, 0373, 0326, 0230, 0123, 0155, 0145, 0067, 0153, 0320, 0315, 
+  0265, 0110, 0133, 0043, 0353, 0205, 0031, 0246, 0035, 0373, 0121, 0257, 0215, 0021, 0277, 0367, 
+  0036, 0165, 0154, 0114, 0315, 0107, 0375, 0253, 0235, 0227, 0164, 0010, 0235, 0174, 0353, 0232, 
+  0013, 0315, 0145, 0022, 0213, 0144, 0270, 0040, 0232, 0375, 0130, 0351, 0110, 0341, 0015, 0165, 
+  0310, 0320, 0323, 0201, 0351, 0056, 0202, 0062, 0301, 0241, 0016, 0134, 0336, 0260, 0127, 0330, 
+  0272, 0030, 0037, 0034, 0232, 0216, 0002, 0054, 0000, 0347, 0014, 0057, 0204, 0152, 0246, 0024, 
+  0147, 0353, 0200, 0155, 0223, 0167, 0000, 0317, 0025, 0300, 0102, 0267, 0217, 0027, 0174, 0246, 
+  0002, 0251, 0026, 0246, 0107, 0140, 0321, 0126, 0301, 0225, 0105, 0126, 0145, 0175, 0152, 0272, 
+  0361, 0003, 0043, 0373, 0331, 0367, 0326, 0045, 0213, 0206, 0062, 0002, 0132, 0310, 0264, 0340, 
+  0213, 0126, 0264, 0155, 0140, 0316, 0020, 0126, 0300, 0350, 0042, 0032, 0301, 0030, 0317, 0250, 
+  0252, 0057, 0054, 0040, 0004, 0162, 0147, 0134, 0335, 0203, 0206, 0322, 0131, 0054, 0364, 0277, 
+  0066, 0020, 0014, 0227, 0101, 0240, 0216, 0360, 0114, 0102, 0060, 0143, 0332, 0143, 0120, 0302, 
+  0034, 0140, 0303, 0164, 0216, 0027, 0062, 0220, 0061, 0237, 0007, 0331, 0070, 0312, 0125, 0344, 
+  0343, 0300, 0252, 0142, 0034, 0336, 0152, 0156, 0126, 0167, 0011, 0367, 0011, 0146, 0221, 0003, 
+  0116, 0143, 0102, 0251, 0203, 0130, 0302, 0045, 0111, 0135, 0315, 0105, 0231, 0131, 0205, 0343, 
+  0137, 0361, 0277, 0373, 0020, 0312, 0146, 0007, 0007, 0141, 0324, 0325, 0146, 0236, 0321, 0122, 
+  0252, 0224, 0122, 0141, 0135, 0304, 0132, 0116, 0355, 0316, 0051, 0377, 0020, 0234, 0052, 0002, 
+  0240, 0330, 0170, 0047, 0303, 0035, 0214, 0336, 0054, 0134, 0302, 0333, 0300, 0344, 0163, 0345, 
+  0241, 0266, 0256, 0353, 0051, 0200, 0150, 0003, 0236, 0115, 0167, 0123, 0222, 0344, 0231, 0144, 
+  0320, 0157, 0122, 0232, 0122, 0221, 0264, 0357, 0235, 0042, 0226, 0246, 0211, 0376, 0373, 0275, 
+  0223, 0242, 0074, 0260, 0075, 0357, 0171, 0274, 0155, 0155, 0072, 0326, 0102, 0253, 0024, 0261, 
+  0167, 0245, 0122, 0205, 0240, 0025, 0003, 0367, 0127, 0032, 0301, 0014, 0164, 0066, 0230, 0025, 
+  0105, 0275, 0275, 0360, 0333, 0027, 0303, 0172, 0141, 0367, 0123, 0032, 0212, 0154, 0315, 0250, 
+  0113, 0106, 0053, 0105, 0066, 0053, 0306, 0252, 0016, 0356, 0061, 0045, 0223, 0362, 0114, 0044, 
+  0023, 0304, 0112, 0011, 0242, 0023, 0006, 0220, 0305, 0015, 0362, 0115, 0062, 0345, 0163, 0040, 
+  0223, 0130, 0171, 0310, 0156, 0337, 0030, 0346, 0321, 0310, 0353, 0156, 0121, 0337, 0055, 0327, 
+  0277, 0055, 0042, 0225, 0107, 0245, 0275, 0042, 0323, 0036, 0321, 0311, 0071, 0353, 0053, 0211, 
+  0122, 0133, 0263, 0277, 0272, 0104, 0370, 0054, 0110, 0224, 0362, 0140, 0242, 0237, 0136, 0004, 
+  0015, 0246, 0130, 0114, 0010, 0013, 0050, 0214, 0315, 0026, 0135, 0257, 0256, 0270, 0320, 0171, 
+  0317, 0156, 0016, 0245, 0160, 0360, 0234, 0316, 0246, 0154, 0251, 0140, 0207, 0376, 0267, 0316, 
+  0106, 0245, 0153, 0262, 0141, 0051, 0110, 0151, 0277, 0115, 0301, 0236, 0223, 0163, 0210, 0011, 
+  0252, 0131, 0042, 0374, 0143, 0254, 0372, 0335, 0105, 0151, 0315, 0314, 0167, 0353, 0002, 0142, 
+  0060, 0345, 0214, 0204, 0035, 0215, 0357, 0004, 0224, 0331, 0043, 0065, 0070, 0313, 0204, 0060, 
+  0027, 0165, 0073, 0173, 0315, 0162, 0307, 0125, 0355, 0274, 0012, 0161, 0326, 0054, 0010, 0264, 
+  0267, 0304, 0141, 0274, 0323, 0010, 0012, 0266, 0001, 0171, 0122, 0107, 0101, 0211, 0103, 0052, 
+  0165, 0112, 0173, 0122, 0041, 0266, 0321, 0343, 0324, 0270, 0360, 0045, 0260, 0146, 0065, 0212, 
+  0014, 0031, 0322, 0055, 0033, 0312, 0212, 0307, 0143, 0260, 0341, 0253, 0236, 0221, 0374, 0246, 
+  0315, 0322, 0153, 0035, 0211, 0020, 0256, 0052, 0024, 0347, 0124, 0221, 0044, 0120, 0160, 0257, 
+  0212, 0117, 0100, 0022, 0010, 0311, 0170, 0201, 0124, 0014, 0050, 0333, 0145, 0101, 0326, 0132, 
+  0364, 0063, 0141, 0050, 0041, 0367, 0100, 0345, 0057, 0210, 0217, 0021, 0203, 0071, 0142, 0346, 
+  0234, 0304, 0151, 0030, 0333, 0272, 0367, 0135, 0264, 0055, 0117, 0102, 0275, 0141, 0356, 0310, 
+  0330, 0011, 0142, 0112, 0246, 0243, 0300, 0234, 0165, 0073, 0216, 0205, 0315, 0246, 0040, 0110, 
+  0270, 0353, 0014, 0075, 0061, 0017, 0375, 0023, 0213, 0112, 0353, 0074, 0314, 0071, 0314, 0163, 
+  0040, 0142, 0152, 0356, 0363, 0060, 0361, 0342, 0160, 0114, 0354, 0265, 0114, 0334, 0237, 0211, 
+  0015, 0213, 0210, 0127, 0061, 0204, 0053, 0347, 0030, 0162, 0041, 0003, 0135, 0241, 0161, 0021, 
+  0204, 0346, 0047, 0357, 0020, 0071, 0332, 0167, 0011, 0050, 0344, 0201, 0126, 0212, 0306, 0202, 
+  0117, 0055, 0027, 0164, 0077, 0012, 0354, 0343, 0324, 0211, 0170, 0115, 0040, 0277, 0303, 0071, 
+  0306, 0066, 0125, 0161, 0226, 0363, 0111, 0205, 0205, 0072, 0142, 0056, 0033, 0011, 0074, 0017, 
+  0010, 0213, 0110, 0210, 0025, 0027, 0015, 0041, 0335, 0336, 0151, 0250, 0223, 0347, 0312, 0166, 
+  0264, 0173, 0215, 0055, 0350, 0314, 0075, 0034, 0251, 0327, 0060, 0123, 0031, 0143, 0117, 0254, 
+  0264, 0273, 0326, 0226, 0241, 0053, 0353, 0067, 0032, 0125, 0336, 0255, 0343, 0176, 0346, 0065, 
+  0336, 0145, 0303, 0011, 0162, 0222, 0334, 0260, 0307, 0024, 0127, 0001, 0157, 0032, 0067, 0262, 
+  0110, 0330, 0022, 0103, 0053, 0170, 0323, 0260, 0124, 0317, 0114, 0111, 0076, 0325, 0133, 0367, 
+  0143, 0336, 0331, 0146, 0137, 0225, 0125, 0334, 0125, 0314, 0271, 0116, 0142, 0061, 0062, 0150, 
+  0041, 0213, 0026, 0122, 0034, 0151, 0026, 0351, 0157, 0004, 0302, 0224, 0042, 0231, 0336, 0071, 
+  0165, 0257, 0340, 0266, 0336, 0146, 0275, 0321, 0212, 0165, 0327, 0017, 0325, 0343, 0162, 0010, 
+  0057, 0277, 0032, 0272, 0154, 0070, 0105, 0126, 0334, 0131, 0313, 0217, 0152, 0176, 0214, 0260, 
+  0255, 0365, 0216, 0311, 0217, 0134, 0107, 0247, 0102, 0223, 0067, 0057, 0140, 0323, 0040, 0215, 
+  0043, 0007, 0335, 0063, 0030, 0363, 0100, 0273, 0272, 0166, 0313, 0240, 0335, 0062, 0170, 0376, 
+  0344, 0355, 0355, 0251, 0157, 0031, 0234, 0332, 0235, 0010, 0263, 0133, 0320, 0310, 0122, 0310, 
+  0240, 0175, 0346, 0225, 0320, 0273, 0146, 0021, 0302, 0054, 0225, 0242, 0054, 0317, 0314, 0124, 
+  0233, 0344, 0355, 0130, 0004, 0035, 0070, 0275, 0113, 0261, 0377, 0252, 0073, 0105, 0176, 0357, 
+  0331, 0362, 0303, 0335, 0270, 0331, 0364, 0364, 0360, 0111, 0351, 0325, 0250, 0233, 0242, 0056, 
+  0227, 0045, 0167, 0372, 0053, 0203, 0333, 0105, 0321, 0366, 0277, 0122, 0156, 0367, 0354, 0057, 
+  0333, 0173, 0366, 0316, 0367, 0354, 0173, 0057, 0373, 0236, 0375, 0107, 0210, 0361, 0035, 0251, 
+  0056, 0312, 0333, 0213, 0365, 0355, 0305, 0372, 0225, 0213, 0365, 0275, 0366, 0142, 0175, 0325, 
+  0340, 0237, 0374, 0142, 0375, 0346, 0306, 0217, 0315, 0245, 0016, 0270, 0355, 0023, 0334, 0314, 
+  0124, 0232, 0104, 0042, 0316, 0154, 0142, 0071, 0347, 0342, 0326, 0230, 0344, 0226, 0126, 0236, 
+  0151, 0216, 0116, 0306, 0031, 0210, 0130, 0000, 0312, 0060, 0070, 0014, 0240, 0355, 0256, 0323, 
+  0221, 0377, 0075, 0360, 0122, 0166, 0235, 0066, 0174, 0205, 0256, 0024, 0103, 0010, 0036, 0117, 
+  0124, 0016, 0346, 0062, 0256, 0215, 0136, 0364, 0240, 0070, 0073, 0174, 0320, 0221, 0063, 0055, 
+  0123, 0365, 0242, 0167, 0256, 0111, 0317, 0327, 0171, 0344, 0157, 0253, 0332, 0027, 0220, 0040, 
+  0042, 0221, 0235, 0300, 0350, 0301, 0215, 0070, 0243, 0332, 0172, 0220, 0043, 0377, 0343, 0342, 
+  0305, 0172, 0220, 0010, 0344, 0255, 0261, 0065, 0046, 0021, 0034, 0320, 0201, 0174, 0321, 0352, 
+  0262, 0160, 0071, 0217, 0201, 0145, 0213, 0137, 0006, 0246, 0057, 0263, 0356, 0103, 0252, 0223, 
+  0034, 0273, 0360, 0117, 0307, 0211, 0074, 0331, 0175, 0367, 0314, 0207, 0150, 0040, 0065, 0214, 
+  0366, 0020, 0330, 0314, 0326, 0322, 0143, 0244, 0020, 0113, 0240, 0172, 0256, 0365, 0062, 0062, 
+  0336, 0044, 0303, 0333, 0300, 0335, 0372, 0223, 0366, 0352, 0154, 0273, 0057, 0171, 0326, 0373, 
+  0222, 0347, 0362, 0276, 0231, 0052, 0203, 0253, 0337, 0034, 0263, 0152, 0344, 0352, 0233, 0004, 
+  0323, 0167, 0332, 0145, 0147, 0221, 0217, 0033, 0125, 0253, 0137, 0043, 0001, 0062, 0341, 0114, 
+  0352, 0321, 0164, 0174, 0077, 0175, 0067, 0144, 0366, 0006, 0253, 0176, 0167, 0245, 0145, 0265, 
+  0374, 0157, 0336, 0060, 0377, 0006, 0254, 0102, 0371, 0265, 0057, 0345, 0352, 0133, 0047, 0373, 
+  0335, 0334, 0333, 0147, 0377, 0007, 0067, 0204, 0056, 0360, 0000, 0050, 0165, 0165, 0141, 0171, 
+  0051, 0163, 0164, 0151, 0143, 0153, 0171, 0055, 0156, 0157, 0164, 0145, 0163, 0055, 0156, 0157, 
+  0164, 0145, 0056, 0165, 0151, 0000, 0000, 0000, 0230, 0042, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0132, 0115, 0217, 0333, 0066, 0020, 0275, 0347, 0127, 0250, 0274, 0026, 0262, 
+  0327, 0156, 0016, 0075, 0330, 0016, 0220, 0266, 0011, 0002, 0244, 0101, 0321, 0115, 0332, 0243, 
+  0100, 0121, 0043, 0231, 0061, 0105, 0252, 0044, 0045, 0333, 0375, 0365, 0035, 0111, 0373, 0041, 
+  0257, 0151, 0313, 0142, 0234, 0324, 0033, 0370, 0266, 0113, 0361, 0221, 0063, 0217, 0303, 0067, 
+  0063, 0334, 0235, 0275, 0332, 0344, 0042, 0250, 0100, 0033, 0256, 0344, 0234, 0114, 0106, 0067, 
+  0044, 0000, 0311, 0124, 0302, 0145, 0066, 0047, 0237, 0076, 0276, 0011, 0177, 0046, 0257, 0026, 
+  0057, 0146, 0077, 0204, 0141, 0360, 0026, 0044, 0150, 0152, 0041, 0011, 0326, 0334, 0056, 0203, 
+  0114, 0320, 0004, 0202, 0237, 0106, 0323, 0351, 0150, 0022, 0204, 0041, 0116, 0342, 0322, 0202, 
+  0116, 0051, 0203, 0305, 0213, 0040, 0230, 0151, 0370, 0247, 0344, 0032, 0114, 0040, 0170, 0074, 
+  0047, 0231, 0135, 0375, 0110, 0036, 0067, 0252, 0141, 0144, 0354, 0236, 0147, 0124, 0251, 0031, 
+  0124, 0034, 0326, 0035, 0300, 0113, 0264, 0254, 0235, 0257, 0342, 0317, 0300, 0154, 0300, 0004, 
+  0065, 0146, 0116, 0336, 0332, 0325, 0155, 0063, 0377, 0165, 0231, 0246, 0240, 0111, 0300, 0223, 
+  0071, 0211, 0125, 0262, 0215, 0342, 0166, 0240, 0306, 0040, 0252, 0320, 0252, 0000, 0155, 0267, 
+  0201, 0244, 0071, 0314, 0111, 0116, 0067, 0121, 0051, 0023, 0025, 0011, 0250, 0100, 0030, 0262, 
+  0010, 0047, 0263, 0361, 0375, 0234, 0146, 0233, 0161, 0273, 0217, 0173, 0313, 0337, 0101, 0226, 
+  0355, 0126, 0306, 0162, 0266, 0332, 0112, 0145, 0041, 0312, 0353, 0301, 0273, 0355, 0330, 0222, 
+  0213, 0244, 0375, 0371, 0020, 0376, 0235, 0205, 0274, 0135, 0243, 0120, 0105, 0131, 0104, 0114, 
+  0003, 0222, 0113, 0356, 0101, 0373, 0066, 0127, 0334, 0360, 0130, 0340, 0214, 0217, 0272, 0204, 
+  0135, 0153, 0335, 0200, 0322, 0100, 0210, 0116, 0202, 0026, 0134, 0016, 0200, 0011, 0032, 0203, 
+  0040, 0201, 0325, 0124, 0032, 0101, 0055, 0305, 0075, 0347, 0144, 0013, 0110, 0122, 0364, 0001, 
+  0326, 0301, 0007, 0364, 0165, 0177, 0231, 0056, 0137, 0365, 0157, 0035, 0002, 0174, 0310, 0110, 
+  0300, 0130, 0255, 0266, 0227, 0315, 0306, 0257, 0040, 0300, 0102, 0103, 0310, 0150, 0064, 0072, 
+  0053, 0047, 0267, 0120, 0120, 0274, 0153, 0112, 0077, 0220, 0063, 0366, 0130, 0345, 0227, 0045, 
+  0060, 0047, 0275, 0126, 0145, 0231, 0200, 0110, 0050, 0266, 0272, 0154, 0212, 0337, 0243, 0205, 
+  0347, 0217, 0270, 0363, 0260, 0353, 0042, 0366, 0316, 0110, 0136, 0033, 0177, 0311, 0274, 0376, 
+  0361, 0140, 0347, 0000, 0142, 0217, 0153, 0342, 0337, 0034, 0365, 0164, 0275, 0247, 0212, 0353, 
+  0166, 0330, 0055, 0303, 0214, 0312, 0050, 0125, 0254, 0104, 0223, 0336, 0120, 0141, 0366, 0274, 
+  0172, 0072, 0337, 0162, 0213, 0274, 0271, 0074, 0272, 0155, 0166, 0164, 0206, 0312, 0223, 0163, 
+  0054, 0004, 0146, 0250, 0245, 0022, 0110, 0247, 0317, 0251, 0277, 0126, 0233, 0326, 0307, 0052, 
+  0126, 0233, 0311, 0315, 0071, 0217, 0271, 0217, 0015, 0027, 0106, 0151, 0016, 0322, 0122, 0213, 
+  0111, 0222, 0054, 0252, 0372, 0110, 0031, 0025, 0116, 0340, 0216, 0137, 0075, 0276, 0065, 0074, 
+  0107, 0061, 0325, 0244, 0013, 0360, 0160, 0321, 0327, 0115, 0267, 0305, 0007, 0254, 0056, 0255, 
+  0105, 0357, 0033, 0303, 0153, 0105, 0303, 0314, 0337, 0014, 0074, 0105, 0036, 0265, 0344, 0230, 
+  0003, 0056, 0250, 0006, 0006, 0274, 0002, 0203, 0231, 0052, 0245, 0245, 0260, 0075, 0276, 0070, 
+  0203, 0131, 0051, 0141, 0071, 0212, 0061, 0154, 0254, 0063, 0246, 0153, 0361, 0033, 0177, 0222, 
+  0265, 0117, 0201, 0164, 0152, 0340, 0061, 0373, 0004, 0207, 0224, 0054, 0244, 0222, 0307, 0161, 
+  0116, 0222, 0335, 0104, 0277, 0313, 0151, 0006, 0035, 0236, 0171, 0236, 0021, 0027, 0322, 0063, 
+  0116, 0276, 0064, 0136, 0016, 0341, 0215, 0155, 0322, 0034, 0126, 0226, 0141, 0316, 0215, 0301, 
+  0312, 0066, 0344, 0265, 0047, 0307, 0327, 0331, 0125, 0301, 0335, 0057, 0356, 0300, 0074, 0000, 
+  0230, 0025, 0224, 0255, 0160, 0323, 0376, 0063, 0203, 0115, 0101, 0145, 0342, 0021, 0111, 0051, 
+  0027, 0302, 0003, 0126, 0050, 0303, 0133, 0341, 0270, 0071, 0014, 0303, 0057, 0056, 0373, 0235, 
+  0044, 0234, 0172, 0143, 0337, 0267, 0211, 0351, 0121, 0151, 0332, 0114, 0325, 0157, 0361, 0311, 
+  0161, 0364, 0045, 0061, 0264, 0337, 0053, 0350, 0214, 0113, 0354, 0024, 0122, 0274, 0345, 0123, 
+  0017, 0244, 0346, 0331, 0162, 0050, 0024, 0123, 0176, 0204, 0360, 0125, 0131, 0014, 0167, 0366, 
+  0163, 0211, 0371, 0067, 0305, 0342, 0231, 0101, 0335, 0221, 0035, 0205, 0032, 0273, 0025, 0340, 
+  0214, 0377, 0346, 0270, 0166, 0362, 0356, 0330, 0165, 0027, 0234, 0013, 0234, 0357, 0056, 0014, 
+  0365, 0275, 0275, 0012, 0103, 0121, 0217, 0067, 0141, 0362, 0155, 0157, 0102, 0067, 0167, 0061, 
+  0241, 0360, 0320, 0277, 0227, 0344, 0165, 0327, 0034, 0135, 0130, 0336, 0152, 0071, 0276, 0046, 
+  0256, 0357, 0045, 0161, 0115, 0317, 0161, 0135, 0135, 0004, 0270, 0235, 0367, 0162, 0334, 0303, 
+  0351, 0301, 0231, 0332, 0341, 0354, 0236, 0243, 0247, 0164, 0000, 0267, 0114, 0053, 0041, 0040, 
+  0351, 0066, 0163, 0315, 0153, 0232, 0151, 0077, 0174, 0355, 0206, 0140, 0010, 0154, 0331, 0332, 
+  0204, 0135, 0112, 0124, 0050, 0301, 0031, 0046, 0074, 0011, 0325, 0341, 0174, 0267, 0147, 0353, 
+  0120, 0374, 0211, 0232, 0336, 0276, 0107, 0376, 0325, 0274, 0137, 0076, 0360, 0327, 0350, 0344, 
+  0267, 0051, 0160, 0206, 0102, 0327, 0232, 0026, 0121, 0256, 0022, 0334, 0165, 0255, 0164, 0062, 
+  0004, 0132, 0327, 0104, 0121, 0133, 0345, 0220, 0305, 0313, 0101, 0072, 0137, 0327, 0104, 0176, 
+  0320, 0373, 0207, 0335, 0316, 0053, 0357, 0061, 0025, 0160, 0211, 0333, 0127, 0021, 0201, 0041, 
+  0261, 0333, 0137, 0246, 0014, 0056, 0121, 0316, 0045, 0001, 0017, 0217, 0000, 0032, 0014, 0377, 
+  0367, 0224, 0127, 0200, 0163, 0067, 0364, 0277, 0125, 0130, 0267, 0076, 0065, 0303, 0254, 0243, 
+  0030, 0207, 0056, 0264, 0107, 0350, 0055, 0207, 0376, 0154, 0274, 0350, 0057, 0207, 0374, 0312, 
+  0232, 0107, 0216, 0236, 0111, 0151, 0263, 0323, 0123, 0115, 0074, 0321, 0167, 0175, 0225, 0057, 
+  0334, 0252, 0302, 0037, 0034, 0053, 0054, 0323, 0163, 0017, 0374, 0265, 0250, 0273, 0264, 0327, 
+  0010, 0267, 0334, 0300, 0125, 0156, 0172, 0345, 0006, 0256, 0162, 0163, 0225, 0233, 0347, 0052, 
+  0067, 0150, 0130, 0144, 0267, 0005, 0106, 0044, 0310, 0344, 0177, 0174, 0054, 0172, 0116, 0335, 
+  0347, 0324, 0267, 0364, 0074, 0341, 0157, 0212, 0263, 0161, 0347, 0377, 0107, 0376, 0003, 0017, 
+  0157, 0017, 0160, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0163, 0164, 0151, 0143, 0153, 0171, 
+  0055, 0156, 0157, 0164, 0145, 0163, 0055, 0144, 0145, 0154, 0145, 0164, 0145, 0055, 0141, 0154, 
+  0154, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 0202, 0032, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0337, 0157, 0332, 0060, 0020, 0176, 0357, 0137, 0341, 0371, 0165, 0012, 
+  0024, 0112, 0247, 0116, 0202, 0124, 0333, 0252, 0126, 0223, 0366, 0330, 0075, 0107, 0046, 0071, 
+  0210, 0207, 0153, 0063, 0333, 0341, 0307, 0376, 0372, 0135, 0022, 0332, 0022, 0060, 0011, 0111, 
+  0330, 0326, 0111, 0274, 0231, 0344, 0276, 0363, 0335, 0307, 0335, 0227, 0163, 0062, 0274, 0135, 
+  0075, 0011, 0262, 0000, 0155, 0270, 0222, 0043, 0332, 0353, 0134, 0122, 0002, 0062, 0124, 0021, 
+  0227, 0323, 0021, 0375, 0376, 0170, 0357, 0335, 0320, 0133, 0377, 0142, 0370, 0316, 0363, 0310, 
+  0003, 0110, 0320, 0314, 0102, 0104, 0226, 0334, 0306, 0144, 0052, 0130, 0004, 0344, 0252, 0323, 
+  0357, 0167, 0172, 0304, 0363, 0320, 0210, 0113, 0013, 0172, 0302, 0102, 0360, 0057, 0010, 0031, 
+  0152, 0370, 0231, 0160, 0015, 0206, 0010, 0076, 0036, 0321, 0251, 0235, 0275, 0247, 0257, 0033, 
+  0245, 0060, 0332, 0315, 0354, 0324, 0370, 0007, 0204, 0226, 0204, 0202, 0031, 0063, 0242, 0017, 
+  0166, 0366, 0365, 0211, 0115, 0201, 0022, 0036, 0215, 0050, 0117, 0227, 0101, 0310, 0144, 0010, 
+  0202, 0246, 0326, 0150, 0077, 0327, 0152, 0016, 0332, 0256, 0211, 0144, 0117, 0060, 0242, 0013, 
+  0156, 0370, 0130, 0000, 0365, 0037, 0165, 0002, 0303, 0356, 0363, 0135, 0267, 0061, 0172, 0012, 
+  0046, 0052, 0114, 0014, 0365, 0357, 0231, 0060, 0225, 0366, 0074, 0124, 0062, 0110, 0227, 0324, 
+  0307, 0073, 0041, 0030, 0343, 0031, 0253, 0346, 0105, 0330, 0260, 0233, 0247, 0160, 0144, 0066, 
+  0021, 0010, 0260, 0360, 0217, 0263, 0201, 0210, 0133, 0057, 0217, 0244, 0116, 0062, 0167, 0234, 
+  0011, 0065, 0315, 0263, 0311, 0321, 0001, 0023, 0042, 0210, 0362, 0313, 0247, 0211, 0162, 0254, 
+  0164, 0004, 0072, 0130, 0362, 0310, 0306, 0324, 0277, 0256, 0062, 0307, 0012, 0343, 0277, 0130, 
+  0306, 0331, 0121, 0356, 0355, 0172, 0016, 0101, 0214, 0245, 0112, 0375, 0074, 0354, 0075, 0100, 
+  0030, 0163, 0021, 0345, 0353, 0024, 0056, 0260, 0240, 0143, 0045, 0060, 0246, 0356, 0306, 0240, 
+  0273, 0145, 0221, 0133, 0223, 0254, 0364, 0045, 0023, 0136, 0366, 0023, 0377, 0307, 0261, 0132, 
+  0321, 0027, 0037, 0173, 0074, 0176, 0306, 0273, 0071, 0211, 0131, 0010, 0136, 0301, 0274, 0146, 
+  0125, 0064, 0341, 0334, 0205, 0121, 0232, 0203, 0264, 0314, 0142, 0177, 0122, 0037, 0033, 0325, 
+  0362, 0220, 0211, 0143, 0200, 0146, 0316, 0102, 0224, 0013, 0352, 0367, 0006, 0116, 0163, 0067, 
+  0103, 0054, 0114, 0167, 0012, 0230, 0006, 0266, 0225, 0271, 0223, 0254, 0304, 0132, 0045, 0167, 
+  0051, 0073, 0204, 0157, 0300, 0136, 0123, 0006, 0135, 0070, 0301, 0326, 0052, 0261, 0201, 0261, 
+  0353, 0164, 0107, 0220, 0321, 0101, 0140, 0241, 0314, 0252, 0262, 0317, 0123, 0037, 0147, 0353, 
+  0053, 0272, 0213, 0162, 0205, 0061, 0106, 0305, 0044, 0126, 0063, 0151, 0004, 0263, 0151, 0177, 
+  0214, 0350, 0032, 0060, 0233, 0340, 0113, 0246, 0246, 0207, 0302, 0152, 0114, 0140, 0005, 0211, 
+  0115, 0240, 0021, 0114, 0130, 0042, 0154, 0175, 0260, 0206, 0020, 0370, 0002, 0314, 0253, 0207, 
+  0322, 0377, 0320, 0251, 0225, 0231, 0154, 0373, 0333, 0017, 0240, 0072, 0360, 0304, 0100, 0220, 
+  0110, 0324, 0014, 0301, 0145, 0003, 0342, 0230, 0130, 0262, 0265, 0011, 0114, 0254, 0226, 0301, 
+  0046, 0222, 0162, 0027, 0333, 0262, 0135, 0164, 0314, 0302, 0031, 0066, 0147, 0365, 0226, 0260, 
+  0232, 0063, 0031, 0065, 0140, 0152, 0302, 0205, 0150, 0000, 0233, 0053, 0303, 0163, 0255, 0271, 
+  0054, 0113, 0313, 0031, 0177, 0101, 0201, 0333, 0067, 0324, 0240, 0135, 0103, 0335, 0145, 0017, 
+  0102, 0362, 0111, 0234, 0233, 0252, 0116, 0123, 0271, 0246, 0217, 0163, 0123, 0235, 0252, 0251, 
+  0172, 0247, 0150, 0052, 0027, 0001, 0356, 0344, 0033, 0045, 0336, 0040, 0351, 0275, 0204, 0061, 
+  0230, 0040, 0035, 0351, 0312, 0237, 0265, 0165, 0265, 0307, 0101, 0321, 0036, 0075, 0373, 0172, 
+  0123, 0062, 0347, 0305, 0070, 0340, 0335, 0274, 0245, 0071, 0245, 0142, 0312, 0256, 0236, 0365, 
+  0372, 0155, 0007, 0233, 0335, 0203, 0121, 0237, 0376, 0035, 0321, 0254, 0335, 0124, 0013, 0046, 
+  0370, 0024, 0153, 0305, 0130, 0246, 0155, 0255, 0156, 0344, 0053, 0020, 0001, 0036, 0117, 0060, 
+  0340, 0301, 0115, 0055, 0241, 0174, 0075, 0251, 0155, 0306, 0335, 0045, 0323, 0022, 0211, 0257, 
+  0355, 0044, 0337, 0375, 0303, 0171, 0162, 0070, 0305, 0344, 0360, 0334, 0315, 0351, 0161, 0255, 
+  0367, 0126, 0313, 0365, 0350, 0163, 0134, 0171, 0372, 0156, 0012, 0276, 0345, 0143, 0120, 0112, 
+  0102, 0066, 0021, 0365, 0077, 0122, 0027, 0260, 0005, 0025, 0155, 0351, 0250, 0067, 0274, 0155, 
+  0146, 0067, 0046, 0004, 0061, 0110, 0324, 0014, 0021, 0312, 0202, 0271, 0255, 0273, 0303, 0152, 
+  0243, 0021, 0227, 0165, 0201, 0353, 0243, 0201, 0314, 0132, 0315, 0161, 0140, 0005, 0343, 0066, 
+  0330, 0066, 0331, 0070, 0137, 0002, 0237, 0306, 0226, 0022, 0124, 0260, 0044, 0323, 0174, 0021, 
+  0321, 0356, 0001, 0367, 0335, 0162, 0377, 0207, 0144, 0242, 0134, 0052, 0132, 0311, 0105, 0013, 
+  0311, 0150, 0054, 0033, 0045, 0322, 0161, 0120, 0076, 0332, 0366, 0120, 0357, 0377, 0156, 0241, 
+  0307, 0230, 0033, 0202, 0356, 0261, 0161, 0310, 0030, 0010, 0016, 0350, 0112, 0102, 0347, 0017, 
+  0065, 0320, 0351, 0313, 0260, 0011, 0231, 0171, 0025, 0066, 0101, 0036, 0065, 0240, 0067, 0053, 
+  0302, 0363, 0151, 0345, 0355, 0237, 0126, 0252, 0022, 0256, 0076, 0167, 0024, 0223, 0054, 0276, 
+  0212, 0316, 0137, 0211, 0172, 0070, 0323, 0117, 0301, 0276, 0250, 0170, 0361, 0062, 0321, 0140, 
+  0346, 0112, 0032, 0214, 0306, 0373, 0100, 0375, 0315, 0033, 0105, 0124, 0377, 0155, 0243, 0152, 
+  0350, 0365, 0063, 0164, 0340, 0204, 0356, 0134, 0064, 0305, 0057, 0013, 0303, 0356, 0326, 0227, 
+  0242, 0337, 0314, 0353, 0267, 0211, 0000, 0050, 0165, 0165, 0141, 0171, 0051
+} };
+
+static GStaticResource static_resource = { sticky_notes_resource_data.data, sizeof (sticky_notes_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *sticky_notes_get_resource (void);
+GResource *sticky_notes_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * 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.1 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/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CONSTRUCTOR_H__
+#define __G_CONSTRUCTOR_H__
+
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+/*
+ * Only try to include gslist.h if not already included via glib.h,
+ * so that items using gconstructor.h outside of GLib (such as
+ * GResources) continue to build properly.
+ */
+#ifndef __G_LIB_H__
+#include "gslist.h"
+#endif
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+#endif /* __G_CONSTRUCTOR_H__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(sticky_notesresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(sticky_notesresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(sticky_notesresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(sticky_notesresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void sticky_notesresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void sticky_notesresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/131.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/131.html new file mode 100644 index 00000000..679745bf --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/131.html @@ -0,0 +1,2537 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
/* Sticky Notes
+ * Copyright (C) 2002-2003 Loban A Rahman
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <libxml/parser.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <X11/Xatom.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#define WNCK_I_KNOW_THIS_IS_UNSTABLE 1
+#include <libwnck/libwnck.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/stat.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "stickynotes.h"
+#include "stickynotes_callbacks.h"
+#include "util.h"
+#include "stickynotes_applet.h"
+
+/* Stop gcc complaining about xmlChar's signedness */
+#define XML_CHAR(str) ((xmlChar *) (str))
+#define STICKYNOTES_ICON_SIZE 8
+
+static gboolean save_scheduled = FALSE;
+
+static void response_cb (GtkWidget *dialog, gint id, gpointer data);
+
+/* Based on a function found in wnck */
+static void
+set_icon_geometry (GdkWindow *window,
+                   int        x,
+                   int        y,
+                   int        width,
+                   int        height)
+{
+    gulong data[4];
+    Display *dpy;
+
+    dpy = gdk_x11_display_get_xdisplay (gdk_window_get_display (window));
+
+    data[0] = x;
+    data[1] = y;
+    data[2] = width;
+    data[3] = height;
+
+    XChangeProperty (dpy,
+                     GDK_WINDOW_XID (window),
+                     gdk_x11_get_xatom_by_name_for_display (gdk_window_get_display (window),
+                                                            "_NET_WM_ICON_GEOMETRY"),
+                     XA_CARDINAL, 32, PropModeReplace,
+                     (guchar *)&data, 4);
+}
+
+/* Called when a timeout occurs.  */
+static gboolean
+timeout_happened (gpointer data)
+{
+    if (GPOINTER_TO_UINT (data) == stickynotes->last_timeout_data)
+        stickynotes_save ();
+
+    return FALSE;
+}
+
+/* Called when a text buffer is changed.  */
+static void
+buffer_changed (GtkTextBuffer *buffer,
+                StickyNote    *note)
+{
+    if ( (note->h + note->y) > stickynotes->max_height )
+        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (note->w_scroller),
+                                        GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+
+    /* When a buffer is changed, we set a 10 second timer.  When
+       the timer triggers, we will save the buffer if there have
+       been no subsequent changes.  */
+    ++stickynotes->last_timeout_data;
+    g_timeout_add_seconds (10, (GSourceFunc) timeout_happened,
+                           GUINT_TO_POINTER (stickynotes->last_timeout_data));
+}
+
+/* Create a new (empty) Sticky Note at a specific position
+   and with specific size */
+static StickyNote *
+stickynote_new_aux (GdkScreen *screen,
+                    gint       x,
+                    gint       y,
+                    gint       w,
+                    gint       h)
+{
+    StickyNote *note;
+    GtkBuilder *builder;
+
+    note = g_new (StickyNote, 1);
+
+    builder = gtk_builder_new ();
+    gtk_builder_add_from_resource (builder,
+                                   GRESOURCE "sticky-notes-note.ui",
+                                   NULL);
+    gtk_builder_add_from_resource (builder,
+                                   GRESOURCE "sticky-notes-properties.ui",
+                                   NULL);
+
+    note->w_window = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                         "stickynote_window"));
+    gtk_window_set_screen (GTK_WINDOW (note->w_window),screen);
+    gtk_window_set_decorated (GTK_WINDOW (note->w_window), FALSE);
+    gtk_window_set_skip_taskbar_hint (GTK_WINDOW (note->w_window), TRUE);
+    gtk_window_set_skip_pager_hint (GTK_WINDOW (note->w_window), TRUE);
+    gtk_widget_add_events (note->w_window, GDK_BUTTON_PRESS_MASK);
+
+    note->w_title = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                        "title_label"));
+    note->w_body = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                       "body_text"));
+    note->w_scroller = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                           "body_scroller"));
+    note->w_lock = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                       "lock_button"));
+    gtk_widget_add_events (note->w_lock, GDK_BUTTON_PRESS_MASK);
+
+    note->buffer =
+        GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (note->w_body)));
+
+    note->w_close =
+        GTK_WIDGET (gtk_builder_get_object (builder, "close_button"));
+    gtk_widget_add_events (note->w_close, GDK_BUTTON_PRESS_MASK);
+    note->w_resize_se =
+        GTK_WIDGET (gtk_builder_get_object (builder, "resize_se_box"));
+    gtk_widget_add_events (note->w_resize_se, GDK_BUTTON_PRESS_MASK);
+    note->w_resize_sw =
+        GTK_WIDGET (gtk_builder_get_object (builder, "resize_sw_box"));
+    gtk_widget_add_events (note->w_resize_sw, GDK_BUTTON_PRESS_MASK);
+
+    note->img_lock =
+        GTK_IMAGE (gtk_builder_get_object (builder, "lock_img"));
+    note->img_close =
+        GTK_IMAGE (gtk_builder_get_object (builder, "close_img"));
+    note->img_resize_se =
+        GTK_IMAGE (gtk_builder_get_object (builder, "resize_se_img"));
+    note->img_resize_sw =
+        GTK_IMAGE (gtk_builder_get_object (builder, "resize_sw_img"));
+
+    /* deal with RTL environments */
+    gtk_widget_set_direction (GTK_WIDGET (gtk_builder_get_object (builder, "resize_bar")),
+                              GTK_TEXT_DIR_LTR);
+
+    note->w_menu = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                       "stickynote_menu"));
+    note->w_lock_toggle_item =
+        GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder,
+                                                     "popup_toggle_lock"));
+
+    note->w_properties =
+        GTK_WIDGET (gtk_builder_get_object (builder,
+                                            "stickynote_properties"));
+    gtk_window_set_screen (GTK_WINDOW (note->w_properties), screen);
+
+    note->w_entry =
+        GTK_WIDGET (gtk_builder_get_object (builder, "title_entry"));
+    note->w_color =
+        GTK_WIDGET (gtk_builder_get_object (builder, "note_color"));
+    note->w_color_label =
+        GTK_WIDGET (gtk_builder_get_object (builder, "color_label"));
+    note->w_font_color =
+        GTK_WIDGET (gtk_builder_get_object (builder, "font_color"));
+    note->w_font_color_label =
+        GTK_WIDGET (gtk_builder_get_object (builder,
+                                            "font_color_label"));
+    note->w_font =
+        GTK_WIDGET (gtk_builder_get_object (builder, "note_font"));
+    note->w_font_label =
+        GTK_WIDGET (gtk_builder_get_object (builder, "font_label"));
+    note->w_def_color =
+        GTK_WIDGET (&GTK_CHECK_BUTTON (gtk_builder_get_object (builder,
+                                                               "def_color_check"))->toggle_button);
+    note->w_def_font =
+        GTK_WIDGET (&GTK_CHECK_BUTTON (gtk_builder_get_object (builder,
+                                                               "def_font_check"))->toggle_button);
+
+    note->color = NULL;
+    note->font_color = NULL;
+    note->font = NULL;
+    note->locked = FALSE;
+    note->x = x;
+    note->y = y;
+    note->w = w;
+    note->h = h;
+
+    /* Customize the window */
+    if (g_settings_get_boolean (stickynotes->settings, "sticky"))
+        gtk_window_stick (GTK_WINDOW (note->w_window));
+
+    if (w == 0 || h == 0)
+        gtk_window_resize (GTK_WINDOW (note->w_window),
+                                       g_settings_get_int (stickynotes->settings,
+                                       "default-width"),
+                                       g_settings_get_int (stickynotes->settings,
+                                       "default-height"));
+    else
+        gtk_window_resize (GTK_WINDOW (note->w_window),
+                                       note->w,
+                                       note->h);
+
+    if (x != -1 && y != -1)
+        gtk_window_move (GTK_WINDOW (note->w_window),
+                                     note->x,
+                                     note->y);
+
+    /* Set the button images */
+    gtk_image_set_from_icon_name (note->img_close,
+                                  STICKYNOTES_STOCK_CLOSE,
+                                  GTK_ICON_SIZE_MENU);
+    gtk_image_set_pixel_size (note->img_close,
+                              STICKYNOTES_ICON_SIZE);
+
+    gtk_image_set_from_icon_name (note->img_resize_se,
+                                  STICKYNOTES_STOCK_RESIZE_SE,
+                                  GTK_ICON_SIZE_MENU);
+    gtk_image_set_pixel_size (note->img_resize_se,
+                              STICKYNOTES_ICON_SIZE);
+
+    gtk_image_set_from_icon_name (note->img_resize_sw,
+                                  STICKYNOTES_STOCK_RESIZE_SW,
+                                  GTK_ICON_SIZE_MENU);
+    gtk_image_set_pixel_size (note->img_resize_sw,
+                              STICKYNOTES_ICON_SIZE);
+
+    gtk_widget_show (note->w_lock);
+    gtk_widget_show (note->w_close);
+    gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (builder,
+                                                         "resize_bar")));
+
+    /* Customize the title and colors, hide and unlock */
+    stickynote_set_title (note, NULL);
+    stickynote_set_color (note, NULL, NULL, TRUE);
+    stickynote_set_font (note, NULL, TRUE);
+    stickynote_set_locked (note, FALSE);
+
+    gtk_widget_realize (note->w_window);
+
+    /* Connect a popup menu to all buttons and title */
+    /* GtkBuilder holds and drops the references to all the widgets it
+     * creates for as long as it exist (GtkBuilder). Hence in our callback
+     * we would have an invalid GtkMenu. We need to ref it.
+     */
+    g_object_ref (note->w_menu);
+
+    g_signal_connect (note->w_window, "button-press-event",
+                      G_CALLBACK (stickynote_show_popup_menu),
+                      note->w_menu);
+
+    g_signal_connect (note->w_lock, "button-press-event",
+                      G_CALLBACK (stickynote_show_popup_menu),
+                      note->w_menu);
+
+    g_signal_connect (note->w_close, "button-press-event",
+                      G_CALLBACK (stickynote_show_popup_menu),
+                      note->w_menu);
+
+    g_signal_connect (note->w_resize_se, "button-press-event",
+                      G_CALLBACK (stickynote_show_popup_menu),
+                      note->w_menu);
+
+    g_signal_connect (note->w_resize_sw, "button-press-event",
+                      G_CALLBACK (stickynote_show_popup_menu),
+                      note->w_menu);
+
+    /* Connect a properties dialog to the note */
+    gtk_window_set_transient_for (GTK_WINDOW (note->w_properties),
+                                  GTK_WINDOW (note->w_window));
+    gtk_dialog_set_default_response (GTK_DIALOG (note->w_properties),
+                                     GTK_RESPONSE_CLOSE);
+    g_signal_connect (note->w_properties, "response",
+                      G_CALLBACK (response_cb),
+                      note);
+
+    /* Connect signals to the sticky note */
+    g_signal_connect (note->w_lock, "clicked",
+                      G_CALLBACK (stickynote_toggle_lock_cb),
+                      note);
+
+    g_signal_connect (note->w_close, "clicked",
+                      G_CALLBACK (stickynote_close_cb),
+                      note);
+
+    g_signal_connect (note->w_resize_se, "button-press-event",
+                      G_CALLBACK (stickynote_resize_cb),
+                      note);
+
+    g_signal_connect (note->w_resize_sw, "button-press-event",
+                      G_CALLBACK (stickynote_resize_cb),
+                      note);
+
+    g_signal_connect (note->w_window, "button-press-event",
+                      G_CALLBACK (stickynote_move_cb),
+                      note);
+
+    g_signal_connect (note->w_window, "configure-event",
+                      G_CALLBACK (stickynote_configure_cb),
+                      note);
+
+    g_signal_connect (note->w_window, "delete-event",
+                      G_CALLBACK (stickynote_delete_cb),
+                      note);
+
+    g_signal_connect (gtk_builder_get_object (builder, "popup_create"), "activate",
+                      G_CALLBACK (popup_create_cb),
+                      note);
+
+    g_signal_connect (gtk_builder_get_object (builder, "popup_destroy"), "activate",
+                      G_CALLBACK (popup_destroy_cb),
+                      note);
+
+    g_signal_connect (gtk_builder_get_object (builder, "popup_toggle_lock"), "toggled",
+                      G_CALLBACK (popup_toggle_lock_cb),
+                      note);
+
+    g_signal_connect (gtk_builder_get_object (builder, "popup_properties"), "activate",
+                      G_CALLBACK (popup_properties_cb),
+                      note);
+
+    g_signal_connect_swapped (note->w_entry, "changed",
+                              G_CALLBACK (properties_apply_title_cb),
+                              note);
+
+    g_signal_connect (note->w_color, "color-set",
+                      G_CALLBACK (properties_color_cb),
+                      note);
+
+    g_signal_connect (note->w_font_color, "color-set",
+                      G_CALLBACK (properties_color_cb),
+                      note);
+
+    g_signal_connect_swapped (note->w_def_color, "toggled",
+                              G_CALLBACK (properties_apply_color_cb),
+                              note);
+
+    g_signal_connect (note->w_font, "font-set",
+                      G_CALLBACK (properties_font_cb),
+                      note);
+
+    g_signal_connect_swapped (note->w_def_font, "toggled",
+                              G_CALLBACK (properties_apply_font_cb),
+                              note);
+
+    g_signal_connect (note->w_entry, "activate",
+                      G_CALLBACK (properties_activate_cb),
+                      note);
+
+    g_signal_connect (note->w_properties, "delete-event",
+                      G_CALLBACK (gtk_widget_hide),
+                      note);
+
+    g_signal_connect_after (note->w_window, "key-press-event",
+                            G_CALLBACK (stickynote_keypress_cb),
+                            note->w_menu);
+
+    g_object_unref (builder);
+
+    g_signal_connect_after (note->w_body, "button-press-event",
+                            G_CALLBACK (gtk_true),
+                            note);
+
+    g_signal_connect (gtk_text_view_get_buffer (GTK_TEXT_VIEW (note->w_body)), "changed",
+                      G_CALLBACK (buffer_changed),
+                      note);
+
+    return note;
+}
+
+/* Create a new (empty) Sticky Note */
+StickyNote *
+stickynote_new (GdkScreen *screen)
+{
+    return stickynote_new_aux (screen, -1, -1, 0, 0);
+}
+
+/* Destroy a Sticky Note */
+void stickynote_free (StickyNote *note)
+{
+    gtk_widget_destroy (note->w_properties);
+    gtk_widget_destroy (note->w_menu);
+    gtk_widget_destroy (note->w_window);
+
+    g_free (note->color);
+    g_free (note->font_color);
+    g_free (note->font);
+
+    g_free (note);
+}
+
+/* Change the sticky note title and color */
+void stickynote_change_properties (StickyNote *note)
+{
+    char *color_str = NULL;
+
+    gtk_entry_set_text (GTK_ENTRY (note->w_entry),
+                        gtk_label_get_text (GTK_LABEL (note->w_title)));
+
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (note->w_def_color),
+                                  note->color == NULL);
+
+    if (note->color)
+        color_str = g_strdup (note->color);
+    else {
+        color_str = g_settings_get_string (stickynotes->settings,
+                                           "default-color");
+    }
+
+    if (color_str) {
+        GdkRGBA color;
+        gdk_rgba_parse (&color, color_str);
+        gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (note->w_color),
+                                    &color);
+        g_free (color_str);
+    }
+
+    if (note->font_color)
+        color_str = g_strdup (note->font_color);
+    else {
+        color_str = g_settings_get_string (stickynotes->settings,
+                                           "default-font-color");
+    }
+
+    if (color_str) {
+        GdkRGBA font_color;
+        gdk_rgba_parse (&font_color, color_str);
+        gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (note->w_font_color),
+                                    &font_color);
+        g_free (color_str);
+    }
+
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (note->w_def_font),
+                                  note->font == NULL);
+    if (note->font)
+        gtk_font_button_set_font_name (GTK_FONT_BUTTON (note->w_font),
+                                       note->font);
+
+    gtk_widget_show (note->w_properties);
+
+    stickynotes_save ();
+}
+
+static void
+response_cb (GtkWidget *dialog,
+             gint id,   gpointer data)
+{
+    if (id == GTK_RESPONSE_HELP)
+        gtk_show_uri_on_window (GTK_WINDOW (dialog),
+                                "help:mate-stickynotes-applet/stickynotes-settings-individual",
+                                gtk_get_current_event_time (),
+                                NULL);
+    else if (id == GTK_RESPONSE_CLOSE)
+        gtk_widget_hide (dialog);
+}
+
+/* Check if a sticky note is empty */
+gboolean
+stickynote_get_empty (const StickyNote *note)
+{
+    return gtk_text_buffer_get_char_count (gtk_text_view_get_buffer (GTK_TEXT_VIEW (note->w_body))) == 0;
+}
+
+/* Set the sticky note title */
+void
+stickynote_set_title (StickyNote  *note,
+                      const gchar *title)
+{
+    /* If title is NULL, use the current date as the title. */
+    if (!title) {
+        GDateTime *now;
+        gchar *date_title;
+        gchar *date_format;
+
+        date_format = g_settings_get_string (stickynotes->settings, "date-format");
+        if (!date_format)
+            date_format = g_strdup ("%x");
+
+        now = g_date_time_new_now_local ();
+        date_title = g_date_time_format (now, date_format);
+
+        gtk_window_set_title (GTK_WINDOW (note->w_window), date_title);
+        gtk_label_set_text (GTK_LABEL (note->w_title), date_title);
+
+        g_date_time_unref (now);
+        g_free (date_title);
+        g_free (date_format);
+    }
+    else {
+        gtk_window_set_title (GTK_WINDOW (note->w_window), title);
+        gtk_label_set_text (GTK_LABEL (note->w_title), title);
+    }
+}
+
+/* Set the sticky note color */
+void
+stickynote_set_color (StickyNote  *note,
+                      const gchar *color_str,
+                      const gchar *font_color_str,
+                      gboolean     save)
+{
+    char *color_str_actual, *font_color_str_actual;
+    gboolean force_default, use_system_color;
+
+    if (save) {
+        if (note->color)
+            g_free (note->color);
+        if (note->font_color)
+            g_free (note->font_color);
+
+        note->color = color_str ? g_strdup (color_str) : NULL;
+        note->font_color = font_color_str ? g_strdup (font_color_str) : NULL;
+
+        gtk_widget_set_sensitive (note->w_color_label,
+                                  note->color != NULL);
+        gtk_widget_set_sensitive (note->w_font_color_label,
+                                  note->font_color != NULL);
+        gtk_widget_set_sensitive (note->w_color,
+                                  note->color != NULL);
+        gtk_widget_set_sensitive (note->w_font_color,
+                                  note->color != NULL);
+    }
+
+    force_default = g_settings_get_boolean (stickynotes->settings,
+                                            "force-default");
+    use_system_color = g_settings_get_boolean (stickynotes->settings,
+                                               "use-system-color");
+
+    /* If "force_default" is enabled or color_str is NULL,
+     * then we use the default color instead of color_str. */
+    if (!color_str || force_default) {
+        if (use_system_color)
+            color_str_actual = NULL;
+        else
+            color_str_actual = g_settings_get_string (stickynotes->settings,
+                                                      "default-color");
+    } else
+        color_str_actual = g_strdup (color_str);
+
+    if (!font_color_str || force_default) {
+        if (use_system_color)
+            font_color_str_actual = NULL;
+        else
+            font_color_str_actual = g_settings_get_string (stickynotes->settings,
+                                                           "default-font-color");
+    } else
+        font_color_str_actual = g_strdup (font_color_str);
+
+    /* Do not use custom colors if "use_system_color" is enabled */
+    if (color_str_actual) {
+        GdkRGBA colors[4];
+        gint i;
+
+        for (i = 0; i <= 3; i++) {
+            gdk_rgba_parse (&colors[i], color_str_actual);
+            colors[i].red = (colors[i].red * (10 - i)) / 10;
+            colors[i].green = (colors[i].green * (10 - i)) / 10;
+            colors[i].blue = (colors[i].blue * (10 - i)) / 10;
+        }
+
+        gtk_widget_override_background_color (note->w_window,
+                                              GTK_STATE_FLAG_NORMAL,
+                                              &colors[0]);
+        gtk_widget_override_background_color (note->w_body,
+                                              GTK_STATE_FLAG_NORMAL,
+                                              &colors[0]);
+        gtk_widget_override_background_color (note->w_lock,
+                                              GTK_STATE_FLAG_NORMAL,
+                                              &colors[0]);
+        gtk_widget_override_background_color (note->w_close,
+                                              GTK_STATE_FLAG_NORMAL,
+                                              &colors[0]);
+        gtk_widget_override_background_color (note->w_resize_se,
+                                              GTK_STATE_FLAG_NORMAL,
+                                              &colors[0]);
+        gtk_widget_override_background_color (note->w_resize_sw,
+                                              GTK_STATE_FLAG_NORMAL,
+                                              &colors[0]);
+    } else {
+        gtk_widget_override_background_color (note->w_window,
+                                              GTK_STATE_FLAG_NORMAL,
+                                              NULL);
+        gtk_widget_override_background_color (note->w_body,
+                                              GTK_STATE_FLAG_NORMAL,
+                                              NULL);
+        gtk_widget_override_background_color (note->w_lock,
+                                              GTK_STATE_FLAG_NORMAL,
+                                              NULL);
+        gtk_widget_override_background_color (note->w_close,
+                                              GTK_STATE_FLAG_NORMAL,
+                                              NULL);
+        gtk_widget_override_background_color (note->w_resize_se,
+                                              GTK_STATE_FLAG_NORMAL,
+                                              NULL);
+        gtk_widget_override_background_color (note->w_resize_sw,
+                                              GTK_STATE_FLAG_NORMAL,
+                                              NULL);
+    }
+
+    if (font_color_str_actual) {
+        GdkRGBA color;
+
+        gdk_rgba_parse (&color, font_color_str_actual);
+
+        gtk_widget_override_color (note->w_window,
+                                   GTK_STATE_FLAG_NORMAL,
+                                   &color);
+        gtk_widget_override_color (note->w_body,
+                                   GTK_STATE_FLAG_NORMAL,
+                                   &color);
+    } else {
+        gtk_widget_override_color (note->w_window,
+                                   GTK_STATE_FLAG_NORMAL,
+                                   NULL);
+        gtk_widget_override_color (note->w_body,
+                                   GTK_STATE_FLAG_NORMAL,
+                                   NULL);
+    }
+
+    if (color_str_actual)
+        g_free (color_str_actual);
+    if (font_color_str_actual)
+        g_free (font_color_str_actual);
+}
+
+/* Set the sticky note font */
+void
+stickynote_set_font (StickyNote  *note,
+                     const gchar *font_str,
+                     gboolean     save)
+{
+    PangoFontDescription *font_desc;
+    gchar *font_str_actual;
+
+    if (save) {
+        g_free (note->font);
+        note->font = font_str ? g_strdup (font_str) : NULL;
+
+        gtk_widget_set_sensitive (note->w_font_label,
+                                  note->font != NULL);
+        gtk_widget_set_sensitive (note->w_font,
+                                  note->font != NULL);
+    }
+
+    /* If "force_default" is enabled or font_str is NULL,
+     * then we use the default font instead of font_str. */
+    if (!font_str || g_settings_get_boolean (stickynotes->settings,
+                                             "force-default")) {
+        if (g_settings_get_boolean (stickynotes->settings,
+                                    "use-system-font"))
+            font_str_actual = NULL;
+        else
+            font_str_actual = g_settings_get_string (stickynotes->settings,
+                                                     "default-font");
+    } else
+        font_str_actual = g_strdup (font_str);
+
+    /* Do not use custom fonts if "use_system_font" is enabled */
+    font_desc = font_str_actual ?
+        pango_font_description_from_string (font_str_actual): NULL;
+
+    /* Apply the style to the widgets */
+    gtk_widget_override_font (note->w_window, font_desc);
+    gtk_widget_override_font (note->w_body, font_desc);
+
+    g_free (font_str_actual);
+    pango_font_description_free (font_desc);
+}
+
+/* Lock/Unlock a sticky note from editing */
+void
+stickynote_set_locked (StickyNote *note,
+                       gboolean    locked)
+{
+    note->locked = locked;
+
+    /* Set cursor visibility and editability */
+    gtk_text_view_set_editable (GTK_TEXT_VIEW (note->w_body),
+                                !locked);
+    gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (note->w_body),
+                                      !locked);
+
+    /* Show appropriate icon and tooltip */
+    if (locked) {
+        gtk_image_set_from_icon_name (note->img_lock,
+                                      STICKYNOTES_STOCK_LOCKED,
+                                      GTK_ICON_SIZE_MENU);
+        gtk_widget_set_tooltip_text (note->w_lock,
+                                     _("This note is locked."));
+    } else {
+        gtk_image_set_from_icon_name (note->img_lock,
+                                      STICKYNOTES_STOCK_UNLOCKED,
+                                      GTK_ICON_SIZE_MENU);
+        gtk_widget_set_tooltip_text (note->w_lock,
+                                     _("This note is unlocked."));
+    }
+
+    gtk_image_set_pixel_size (note->img_lock,
+                              STICKYNOTES_ICON_SIZE);
+
+    gtk_check_menu_item_set_active (note->w_lock_toggle_item,
+                                    locked);
+
+    stickynotes_applet_update_menus ();
+}
+
+/* Show/Hide a sticky note */
+void
+stickynote_set_visible (StickyNote *note,
+                        gboolean    visible)
+{
+    if (visible) {
+        gtk_window_present (GTK_WINDOW (note->w_window));
+
+        if (note->x != -1 || note->y != -1)
+            gtk_window_move (GTK_WINDOW (note->w_window),
+                             note->x, note->y);
+
+        /* Put the note on all workspaces if necessary. */
+        if (g_settings_get_boolean (stickynotes->settings, "sticky"))
+            gtk_window_stick (GTK_WINDOW (note->w_window));
+
+        else if (note->workspace > 0)
+            xstuff_change_workspace (GTK_WINDOW (note->w_window),
+                                     note->workspace - 1);
+    } else {
+        /* Hide sticky note */
+        int x, y, width, height;
+
+        stickynotes_applet_panel_icon_get_geometry (&x, &y,
+                                                    &width, &height);
+        set_icon_geometry (gtk_widget_get_window (GTK_WIDGET (note->w_window)),
+                           x, y, width, height);
+        gtk_window_iconify (GTK_WINDOW (note->w_window));
+    }
+}
+
+/* Add a sticky note */
+void
+stickynotes_add (GdkScreen *screen)
+{
+    StickyNote *note;
+
+    note = stickynote_new (screen);
+
+    stickynotes->notes = g_list_append (stickynotes->notes, note);
+    stickynotes_applet_update_tooltips ();
+    stickynotes_save ();
+    stickynote_set_visible (note, TRUE);
+}
+
+/* Remove a sticky note with confirmation, if needed */
+void
+stickynotes_remove (StickyNote *note)
+{
+    GtkBuilder *builder;
+    GtkWidget  *dialog;
+
+    builder = gtk_builder_new ();
+    gtk_builder_add_from_resource (builder,
+                                   GRESOURCE "sticky-notes-delete.ui",
+                                   NULL);
+
+    dialog = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                 "delete_dialog"));
+
+    gtk_window_set_transient_for (GTK_WINDOW (dialog),
+                                  GTK_WINDOW (note->w_window));
+
+    if (stickynote_get_empty (note)
+        || !g_settings_get_boolean (stickynotes->settings,
+                                    "confirm-deletion")
+        || gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
+
+        /* Remove the note from the linked-list of all notes */
+        stickynotes->notes = g_list_remove_all (stickynotes->notes,
+                                                note);
+
+        /* Destroy the note */
+        stickynote_free (note);
+
+        /* Update tooltips */
+        stickynotes_applet_update_tooltips ();
+
+        /* Save notes */
+        stickynotes_save ();
+    }
+
+    gtk_widget_destroy (dialog);
+    g_object_unref (builder);
+}
+
+/* Save all sticky notes in an XML configuration file */
+gboolean
+stickynotes_save_now (void)
+{
+    const gchar *title;
+    GtkTextBuffer *buffer;
+    GtkTextIter start, end;
+    gchar *body;
+    gint i;
+
+    /* Create a new XML document */
+    xmlDocPtr doc = xmlNewDoc (XML_CHAR ("1.0"));
+    xmlNodePtr root = xmlNewDocNode (doc, NULL, XML_CHAR ("stickynotes"), NULL);
+
+    xmlDocSetRootElement (doc, root);
+    xmlNewProp (root, XML_CHAR ("version"), XML_CHAR (VERSION));
+#ifdef GDK_WINDOWING_X11
+    GdkDisplay *display = gdk_screen_get_display (gdk_screen_get_default());
+    if (GDK_IS_X11_DISPLAY (display))
+    {
+        WnckScreen *wnck_screen = wnck_screen_get_default ();
+        wnck_screen_force_update (wnck_screen);
+    }
+#endif
+    /* For all sticky notes */
+    for (i = 0; i < g_list_length (stickynotes->notes); i++) {
+
+        /* Access the current note in the list */
+        StickyNote *note = g_list_nth_data (stickynotes->notes, i);
+
+        /* Retrieve the window size of the note */
+        gchar *w_str = g_strdup_printf ("%d", note->w);
+        gchar *h_str = g_strdup_printf ("%d", note->h);
+
+        /* Retrieve the window position of the note */
+        gchar *x_str = g_strdup_printf ("%d", note->x);
+        gchar *y_str = g_strdup_printf ("%d", note->y);
+#ifdef GDK_WINDOWING_X11
+        if (GDK_IS_X11_DISPLAY(display))
+        {
+            gulong xid = GDK_WINDOW_XID (gtk_widget_get_window (note->w_window));
+            WnckWindow *wnck_win = wnck_window_get (xid);
+
+            if (!g_settings_get_boolean (stickynotes->settings, "sticky") && wnck_win)
+                note->workspace = 1 +
+                    wnck_workspace_get_number (wnck_window_get_workspace (wnck_win));
+            else
+                note->workspace = 0;
+        }
+#endif
+        /* Retrieve the title of the note */
+        title = gtk_label_get_text (GTK_LABEL (note->w_title));
+
+        /* Retrieve body contents of the note */
+        buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (note->w_body));
+
+        gtk_text_buffer_get_bounds (buffer, &start, &end);
+        body = gtk_text_iter_get_text (&start, &end);
+
+        /* Save the note as a node in the XML document */
+        {
+            xmlNodePtr node = xmlNewTextChild (root, NULL,
+                                               XML_CHAR ("note"),
+                                               XML_CHAR (body));
+
+            xmlNewProp (node, XML_CHAR ("title"),
+                        XML_CHAR (title));
+
+            if (note->color)
+                xmlNewProp (node, XML_CHAR ("color"),
+                            XML_CHAR (note->color));
+
+            if (note->font_color)
+                xmlNewProp (node, XML_CHAR ("font_color"),
+                            XML_CHAR (note->font_color));
+
+            if (note->font)
+                xmlNewProp (node, XML_CHAR ("font"),
+                            XML_CHAR (note->font));
+
+            if (note->locked)
+                xmlNewProp (node, XML_CHAR ("locked"),
+                            XML_CHAR ("true"));
+
+            xmlNewProp (node, XML_CHAR ("x"), XML_CHAR (x_str));
+            xmlNewProp (node, XML_CHAR ("y"), XML_CHAR (y_str));
+            xmlNewProp (node, XML_CHAR ("w"), XML_CHAR (w_str));
+            xmlNewProp (node, XML_CHAR ("h"), XML_CHAR (h_str));
+            if (note->workspace > 0) {
+                char *workspace_str;
+
+                workspace_str = g_strdup_printf ("%i", note->workspace);
+                xmlNewProp (node, XML_CHAR ("workspace"), XML_CHAR (workspace_str));
+                g_free (workspace_str);
+            }
+        }
+
+        /* Now that it has been saved, reset the modified flag */
+        gtk_text_buffer_set_modified (buffer, FALSE);
+
+        g_free (x_str);
+        g_free (y_str);
+        g_free (w_str);
+        g_free (h_str);
+        g_free (body);
+    }
+
+    /* The XML file is $HOME/.config/mate/stickynotes-applet,
+       most probably */
+    {
+        gchar* path = g_build_filename (g_get_user_config_dir (),
+                                        "mate", NULL);
+        gchar* file = g_build_filename (path, "stickynotes-applet.xml",
+                                        NULL);
+        g_mkdir_with_parents (path, S_IRWXU);
+        g_free (path);
+
+        xmlSaveFormatFile (file, doc, 1);
+
+        g_free (file);
+    }
+
+    xmlFreeDoc (doc);
+
+    save_scheduled = FALSE;
+
+    return FALSE;
+}
+
+void
+stickynotes_save (void)
+{
+    /* If a save isn't already scheduled, save everything a minute from now. */
+    if (!save_scheduled) {
+        g_timeout_add_seconds (60, (GSourceFunc) stickynotes_save_now, NULL);
+        save_scheduled = TRUE;
+    }
+}
+
+/* Load all sticky notes from an XML configuration file */
+void
+stickynotes_load (GdkScreen *screen)
+{
+    xmlDocPtr doc = NULL;
+    xmlNodePtr root;
+    xmlNodePtr node;
+    GList *new_notes, *tmp1;  /* Lists of StickyNote*'s */
+    GList *new_nodes; /* Lists of xmlNodePtr's */
+    int x, y, w, h;
+#ifdef GDK_WINDOWING_X11
+    GdkDisplay *display = gdk_screen_get_display (gdk_screen_get_default());
+#endif
+
+    /* The XML file is $HOME/.config/mate/stickynotes-applet, most probably */
+    gchar* file = g_build_filename (g_get_user_config_dir (),
+                                    "mate", "stickynotes-applet.xml", NULL);
+
+    if (g_file_test (file, G_FILE_TEST_EXISTS)) {
+        /* load file */
+        doc = xmlParseFile (file);
+    } else {
+        /* old one */
+        g_free (file);
+
+        file = g_build_filename (g_get_home_dir (),
+                                 ".mate2", "stickynotes_applet", NULL);
+
+        if (g_file_test (file, G_FILE_TEST_EXISTS)) {
+            /* load file */
+            doc = xmlParseFile (file);
+        }
+    }
+    g_free (file);
+
+    /* If the XML file does not exist, create a blank one */
+    if (!doc) {
+        stickynotes_save ();
+        return;
+    }
+
+    /* If the XML file is corrupted/incorrect, create a blank one */
+    root = xmlDocGetRootElement (doc);
+    if (!root || xmlStrcmp (root->name, XML_CHAR ("stickynotes"))) {
+        xmlFreeDoc (doc);
+        stickynotes_save ();
+        return;
+    }
+
+    node = root->xmlChildrenNode;
+
+    /* For all children of the root node (ie all sticky notes) */
+    new_notes = NULL;
+    new_nodes = NULL;
+    while (node) {
+        if (!xmlStrcmp (node->name, (const xmlChar *) "note")) {
+            StickyNote *note;
+
+            /* Retrieve and set the window size of the note */
+            {
+                gchar *w_str = (gchar *)xmlGetProp (node, XML_CHAR ("w"));
+                gchar *h_str = (gchar *)xmlGetProp (node, XML_CHAR ("h"));
+                if (w_str && h_str) {
+                    w = atoi (w_str);
+                    h = atoi (h_str);
+                } else {
+                    w = 0;
+                    h = 0;
+                }
+
+                g_free (w_str);
+                g_free (h_str);
+            }
+
+            /* Retrieve and set the window position of the note */
+            {
+                gchar *x_str = (gchar *)xmlGetProp (node, XML_CHAR ("x"));
+                gchar *y_str = (gchar *)xmlGetProp (node, XML_CHAR ("y"));
+
+                if (x_str && y_str) {
+                    x = atoi (x_str);
+                    y = atoi (y_str);
+                } else {
+                    x = -1;
+                    y = -1;
+                }
+
+                g_free (x_str);
+                g_free (y_str);
+            }
+
+            /* Create a new note */
+            note = stickynote_new_aux (screen, x, y, w, h);
+            stickynotes->notes = g_list_append (stickynotes->notes,
+                                                note);
+            new_notes = g_list_append (new_notes, note);
+            new_nodes = g_list_append (new_nodes, node);
+
+            /* Retrieve and set title of the note */
+            {
+                gchar *title = (gchar *)xmlGetProp (node,
+                                                    XML_CHAR ("title"));
+                if (title)
+                    stickynote_set_title (note, title);
+
+                g_free (title);
+            }
+
+            /* Retrieve and set the color of the note */
+            {
+                gchar *color_str;
+                gchar *font_color_str;
+
+                color_str = (gchar *)xmlGetProp (node, XML_CHAR ("color"));
+                font_color_str = (gchar *)xmlGetProp (node, XML_CHAR ("font_color"));
+
+                if (color_str || font_color_str)
+                    stickynote_set_color (note,
+                                          color_str,
+                                          font_color_str,
+                                          TRUE);
+
+                g_free (color_str);
+                g_free (font_color_str);
+            }
+
+            /* Retrieve and set the font of the note */
+            {
+                gchar *font_str = (gchar *)xmlGetProp (node,
+                                                       XML_CHAR ("font"));
+                if (font_str)
+                    stickynote_set_font (note, font_str, TRUE);
+
+                g_free (font_str);
+            }
+
+            /* Retrieve the workspace */
+            {
+                char *workspace_str;
+
+                workspace_str = (gchar *)xmlGetProp (node,
+                                                     XML_CHAR ("workspace"));
+                if (workspace_str) {
+                    note->workspace = atoi (workspace_str);
+                    g_free (workspace_str);
+                }
+            }
+
+            /* Retrieve and set (if any) the body contents of the
+             * note */
+            {
+                gchar *body = (gchar *)xmlNodeListGetString (doc,
+                                                             node->xmlChildrenNode,
+                                                              1);
+                if (body) {
+                    GtkTextBuffer *buffer;
+                    GtkTextIter start, end;
+
+                    buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (note->w_body));
+                    gtk_text_buffer_get_bounds (buffer,
+                                                &start, &end);
+                    gtk_text_buffer_insert (buffer,
+                                            &start, body, -1);
+                }
+                g_free (body);
+            }
+
+            /* Retrieve and set the locked state of the note,
+             * by default unlocked */
+            {
+                gchar *locked = (gchar *)xmlGetProp (node,
+                                                     XML_CHAR ("locked"));
+                if (locked)
+                    stickynote_set_locked (note,
+                                           !strcmp (locked,
+                                           "true"));
+                g_free (locked);
+            }
+        }
+
+        node = node->next;
+    }
+
+    tmp1 = new_notes;
+
+#ifdef GDK_WINDOWING_X11
+    if (GDK_IS_X11_DISPLAY(display))
+    {
+        WnckScreen *wnck_screen = wnck_screen_get_default ();
+        wnck_screen_force_update (wnck_screen);
+    }
+#endif
+    while (tmp1) {
+        StickyNote *note = tmp1->data;
+
+        stickynote_set_visible (note, stickynotes->visible);
+        tmp1 = tmp1->next;
+    }
+
+    g_list_free (new_notes);
+    g_list_free (new_nodes);
+
+    xmlFreeDoc (doc);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/132.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/132.html new file mode 100644 index 00000000..44524a43 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/132.html @@ -0,0 +1,443 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
/* Sticky Notes
+ * Copyright (C) 2002-2003 Loban A Rahman
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef __STICKYNOTES_H__
+#define __STICKYNOTES_H__
+
+#define WNCK_I_KNOW_THIS_IS_UNSTABLE 1
+#include <libwnck/libwnck.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stickynotes_applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gtksourceview/gtksource.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+typedef struct
+{
+    GtkWidget *w_window;                  /* Sticky Note window */
+    GtkWidget *w_menu;                    /* Sticky Note menu */
+    GtkWidget *w_properties;              /* Sticky Note properties dialog */
+
+    GtkWidget *w_entry;                   /* Sticky Note title entry */
+    GtkWidget *w_color;                   /* Sticky Note color picker */
+    GtkWidget *w_color_label;             /* Sticky Note color label */
+    GtkWidget *w_font_color;              /* Sticky Note font color picker */
+    GtkWidget *w_font_color_label;        /* Sticky Note font color label */
+    GtkWidget *w_font;                    /* Sticky Note font picker */
+    GtkWidget *w_font_label;              /* Sticky Note font label */
+    GtkWidget *w_def_color;               /* Sticky Note default color setting */
+    GtkWidget *w_def_font;                /* Sticky Note default font setting */
+
+    GtkWidget *w_title;                   /* Sticky Note title */
+    GtkWidget *w_body;                    /* Sticky Note text body */
+    GtkWidget *w_scroller;                /* Sticky Note scroller */
+    GtkWidget *w_lock;                    /* Sticky Note lock button */
+    GtkWidget *w_close;                   /* Sticky Note close button */
+    GtkWidget *w_resize_se;               /* Sticky Note resize button (south east) */
+    GtkWidget *w_resize_sw;               /* Sticky Note resize button (south west) */
+
+    GtkSourceBuffer *buffer;              /* Sticky Note text buffer for undo/redo */
+
+    GtkCheckMenuItem *w_lock_toggle_item; /* Lock item in the popup menu */
+
+    GtkImage *img_lock;                   /* Lock image */
+    GtkImage *img_close;                  /* Close image */
+    GtkImage *img_resize_se;              /* SE resize image */
+    GtkImage *img_resize_sw;              /* SW resize image */
+
+    gchar *color;                         /* Note color */
+    gchar *font_color;                    /* Font color */
+    gchar *font;                          /* Note font */
+    gboolean locked;                      /* Note locked state */
+
+    gint x;                               /* Note x-coordinate */
+    gint y;                               /* Note y-coordinate */
+    gint w;                               /* Note width */
+    gint h;                               /* Note height */
+
+    int workspace;                        /* Workspace the note is on */
+
+} StickyNote;
+
+StickyNote * stickynote_new (GdkScreen *screen);
+void stickynote_free (StickyNote *note);
+
+gboolean stickynote_get_empty (const StickyNote *note);
+
+void stickynote_set_title (StickyNote  *note,
+                           const gchar *title);
+void stickynote_set_color (StickyNote  *note,
+                           const gchar *color_str,
+                           const gchar *font_color_str,
+                           gboolean     save);
+void stickynote_set_font (StickyNote  *note,
+                          const gchar *font_str,
+                          gboolean     save);
+void stickynote_set_locked (StickyNote *note,
+                            gboolean    locked);
+void stickynote_set_visible (StickyNote *note,
+                             gboolean    visible);
+
+void stickynote_change_properties (StickyNote *note);
+
+void stickynotes_add (GdkScreen *screen);
+void stickynotes_remove (StickyNote *note);
+void stickynotes_save (void);
+gboolean stickynotes_save_now (void);
+void stickynotes_load (GdkScreen *screen);
+
+#endif /* __STICKYNOTES_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/133.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/133.html new file mode 100644 index 00000000..24d0b951 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/133.html @@ -0,0 +1,413 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
/* Sticky Notes
+ * Copyright (C) 2002-2003 Loban A Rahman
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef __STICKYNOTES_CALLBACKS_H__
+#define __STICKYNOTES_CALLBACKS_H__
+
+#include <stickynotes.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+/* Callbacks for the sticky notes windows */
+gboolean
+stickynote_toggle_lock_cb (GtkWidget  *widget,
+                           StickyNote *note);
+gboolean
+stickynote_close_cb (GtkWidget  *widget,
+                     StickyNote *note);
+gboolean
+stickynote_resize_cb (GtkWidget      *widget,
+                      GdkEventButton *event,
+                      StickyNote     *note);
+gboolean
+stickynote_move_cb (GtkWidget      *widget,
+                    GdkEventButton *event,
+                    StickyNote     *note);
+gboolean
+stickynote_configure_cb (GtkWidget         *widget,
+                         GdkEventConfigure *event,
+                         StickyNote        *note);
+gboolean
+stickynote_delete_cb (GtkWidget  *widget,
+                      GdkEvent   *event,
+                      StickyNote *note);
+gboolean
+stickynote_show_popup_menu (GtkWidget      *widget,
+                            GdkEventButton *event,
+                            GtkWidget      *popup_menu);
+gboolean
+stickynote_keypress_cb (GtkWidget      *widget,
+                        GdkEventKey    *event,
+                        GtkMenu        *popup_menu);
+
+/* Callbacks for the sticky notes popup menu */
+void
+popup_create_cb (GtkWidget  *widget,
+                 StickyNote *note);
+void
+popup_destroy_cb (GtkWidget  *widget,
+                  StickyNote *note);
+void
+popup_toggle_lock_cb (GtkCheckMenuItem *item,
+                      StickyNote       *note);
+void
+popup_properties_cb (GtkWidget  *widget,
+                     StickyNote *note);
+
+/* Callbacks for sticky notes properties dialog */
+void
+properties_apply_title_cb (StickyNote *note);
+void
+properties_apply_color_cb (StickyNote *note);
+void
+properties_apply_font_cb (StickyNote *note);
+void
+properties_color_cb (GtkWidget  *button,
+                     StickyNote *note);
+void
+properties_font_cb (GtkWidget  *button,
+                    StickyNote *note);
+void
+properties_activate_cb (GtkWidget  *widget,
+                        StickyNote *note);
+
+#endif /* __STICKYNOTES_CALLBACKS_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/134.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/134.html new file mode 100644 index 00000000..7a00f7f5 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/134.html @@ -0,0 +1,297 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
/* Sticky Notes
+ * Copyright (C) 2002-2003 Loban A Rahman
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef __UTIL_H__
+#define __UTIL_H__
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+void    xstuff_change_workspace (GtkWindow *window,
+                                 int        new_space);
+int     xstuff_get_current_workspace (GtkWindow *window);
+
+#endif /* #ifndef __UTIL_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/135.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/135.html new file mode 100644 index 00000000..612a9a0b --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/135.html @@ -0,0 +1,461 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
/* Sticky Notes
+ * Copyright (C) 2002-2003 Loban A Rahman
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef __STICKYNOTES_APPLET_H__
+#define __STICKYNOTES_APPLET_H__
+
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define STICKYNOTES_SCHEMA            "org.mate.stickynotes"
+
+#define STICKYNOTES_STOCK_LOCKED      "stickynotes-stock-locked"
+#define STICKYNOTES_STOCK_UNLOCKED    "stickynotes-stock-unlocked"
+#define STICKYNOTES_STOCK_CLOSE       "stickynotes-stock-close"
+#define STICKYNOTES_STOCK_RESIZE_SE   "stickynotes-stock-resize-se"
+#define STICKYNOTES_STOCK_RESIZE_SW   "stickynotes-stock-resize-sw"
+
+/* Global Sticky Notes instance */
+typedef struct
+{
+    GtkBuilder *builder;
+
+    GtkWidget *w_prefs;    /* The prefs dialog */
+    GtkAdjustment *w_prefs_width;
+    GtkAdjustment *w_prefs_height;
+    GtkWidget *w_prefs_color;
+    GtkWidget *w_prefs_font_color;
+    GtkWidget *w_prefs_sys_color;
+    GtkWidget *w_prefs_font;
+    GtkWidget *w_prefs_sys_font;
+    GtkWidget *w_prefs_sticky;
+    GtkWidget *w_prefs_force;
+    GtkWidget *w_prefs_desktop;
+
+    GList *notes;     /* Linked-List of all the sticky notes */
+    GList *applets;   /* Linked-List of all the applets */
+
+    cairo_surface_t *icon_normal;      /* Normal applet icon */
+    cairo_surface_t *icon_prelight;    /* Prelighted applet icon */
+
+    GSettings *settings;    /* Shared GSettings */
+
+    gint max_height;
+    guint last_timeout_data;
+
+    gboolean visible;    /* Toggle show/hide notes */
+} StickyNotes;
+
+/* Sticky Notes Applet */
+typedef struct
+{
+    GtkWidget *w_applet;    /* The applet */
+    GtkWidget *w_image;     /* The applet icon */
+
+    GtkWidget *destroy_all_dialog;    /* The applet it's destroy all dialog */
+
+    gboolean prelighted;    /* Whether applet is prelighted */
+
+    gint panel_size;
+    MatePanelAppletOrient panel_orient;
+
+    GtkActionGroup *action_group;
+    GtkWidget *menu_tip;
+} StickyNotesApplet;
+
+typedef enum
+{
+    STICKYNOTES_NEW = 0,
+    STICKYNOTES_SET_VISIBLE,
+    STICKYNOTES_SET_LOCKED
+
+} StickyNotesDefaultAction;
+
+extern StickyNotes *stickynotes;
+
+void stickynotes_applet_init (MatePanelApplet *mate_panel_applet);
+void stickynotes_applet_init_prefs (void);
+
+StickyNotesApplet * stickynotes_applet_new (MatePanelApplet *mate_panel_applet);
+
+void stickynotes_applet_update_icon (StickyNotesApplet *applet);
+void stickynotes_applet_update_prefs (void);
+void stickynotes_applet_update_menus (void);
+void stickynotes_applet_update_tooltips (void);
+
+void stickynotes_applet_do_default_action (GdkScreen *screen);
+
+void stickynotes_applet_panel_icon_get_geometry (int *x,
+                                                 int *y,
+                                                 int *width,
+                                                 int *height);
+
+#endif /* __STICKYNOTES_APPLET_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/136.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/136.html new file mode 100644 index 00000000..f0e115fe --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/136.html @@ -0,0 +1,1569 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
/* Sticky Notes
+ * Copyright (C) 2002-2003 Loban A Rahman
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "stickynotes_applet.h"
+#include "stickynotes_applet_callbacks.h"
+#include "stickynotes.h"
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+StickyNotes *stickynotes = NULL;
+
+/* Popup menu on the applet */
+static const GtkActionEntry stickynotes_applet_menu_actions[] =
+{
+    { "new_note", "document-new", N_("_New Note"),
+      NULL, NULL,
+      G_CALLBACK (menu_new_note_cb) },
+    { "hide_notes", NULL, N_("Hi_de Notes"),
+      NULL, NULL,
+      G_CALLBACK (menu_hide_notes_cb) },
+    { "destroy_all", "edit-delete", N_("_Delete Notes"),
+      NULL, NULL,
+      G_CALLBACK (menu_destroy_all_cb) },
+    { "preferences", "document-properties", N_("_Preferences"),
+      NULL, NULL,
+      G_CALLBACK (menu_preferences_cb) },
+    { "help", "help-browser", N_("_Help"),
+      NULL, NULL,
+      G_CALLBACK (menu_help_cb) },
+    { "about", "help-about", N_("_About"),
+      NULL, NULL,
+      G_CALLBACK (menu_about_cb) }
+};
+
+static const GtkToggleActionEntry stickynotes_applet_menu_toggle_actions[] =
+{
+    { "lock", NULL, N_("_Lock Notes"),
+      NULL, NULL,
+      G_CALLBACK (menu_toggle_lock_cb), FALSE }
+};
+
+/* Sticky Notes applet factory */
+static gboolean
+stickynotes_applet_factory (MatePanelApplet *mate_panel_applet,
+                            const gchar     *iid,
+                            gpointer         data)
+{
+    if (!strcmp (iid, "StickyNotesApplet")) {
+        if (!stickynotes)
+            stickynotes_applet_init (mate_panel_applet);
+
+        mate_panel_applet_set_flags (mate_panel_applet, MATE_PANEL_APPLET_EXPAND_MINOR);
+
+        /* Add applet to linked list of all applets */
+        stickynotes->applets = g_list_append (stickynotes->applets,
+                                              stickynotes_applet_new (mate_panel_applet));
+
+        stickynotes_applet_update_menus ();
+        stickynotes_applet_update_tooltips ();
+
+        return TRUE;
+    }
+
+    return FALSE;
+}
+
+/* Sticky Notes applet factory */
+PANEL_APPLET_FACTORY ("StickyNotesAppletFactory",<--- There is an unknown macro here somewhere. Configuration is required. If PANEL_APPLET_FACTORY is a macro then please configure it.
+                      PANEL_TYPE_APPLET,
+                      "stickynotes_applet",
+                      stickynotes_applet_factory,
+                      NULL)
+
+/* colorshift a surface */
+static void
+stickynotes_make_prelight_icon (cairo_surface_t *dest,
+                                cairo_surface_t *src,
+                                int              shift)
+{
+    gint i, j;
+    gint width, height, has_alpha, srcrowstride, destrowstride;
+    guchar *target_pixels;
+    guchar *original_pixels;
+    guchar *pixsrc;
+    guchar *pixdest;
+    int val;
+    guchar r,g,b;
+
+    has_alpha = cairo_surface_get_content (src) != CAIRO_CONTENT_COLOR;
+    width = cairo_image_surface_get_width (src);
+    height = cairo_image_surface_get_height (src);
+    srcrowstride = cairo_image_surface_get_stride (src);
+    destrowstride = cairo_image_surface_get_stride (dest);
+    original_pixels = cairo_image_surface_get_data (src);
+    target_pixels = cairo_image_surface_get_data (dest);
+
+    for (i = 0; i < height; i++) {
+        pixdest = target_pixels + i*destrowstride;
+        pixsrc = original_pixels + i*srcrowstride;
+        for (j = 0; j < width; j++) {
+            r = *(pixsrc++);
+            g = *(pixsrc++);
+            b = *(pixsrc++);
+            val = r + shift;
+            *(pixdest++) = CLAMP (val, 0, 255);
+            val = g + shift;
+            *(pixdest++) = CLAMP (val, 0, 255);
+            val = b + shift;
+            *(pixdest++) = CLAMP (val, 0, 255);
+            if (has_alpha)
+                *(pixdest++) = *(pixsrc++);
+        }
+    }
+}
+
+static void
+icon_theme_changed (GtkIconTheme *icon_theme,
+                    gpointer      user_data)
+{
+    gtk_icon_theme_append_search_path (icon_theme,
+                                       PKG_DATA_DIR G_DIR_SEPARATOR_S "icons");
+}
+
+static void
+stickynotes_applet_init_icons (void)
+{
+    GtkIconTheme *icon_theme;
+
+    icon_theme = gtk_icon_theme_get_default ();
+    icon_theme_changed (icon_theme, NULL);
+
+    g_signal_connect (gtk_icon_theme_get_default (), "changed",
+                      G_CALLBACK (icon_theme_changed), NULL);
+}
+
+static void
+stickynotes_destroy (GtkWidget *widget,
+                     gpointer   user_dta)
+{
+    g_signal_handlers_disconnect_by_func (gtk_icon_theme_get_default (),
+                                          icon_theme_changed, NULL);
+}
+
+/* Create and initalize global sticky notes instance */
+void
+stickynotes_applet_init (MatePanelApplet *mate_panel_applet)
+{
+    cairo_t *cr;
+    gint size, scale;
+    int screen_height;
+    GdkScreen *screen;
+
+    stickynotes = g_new (StickyNotes, 1);
+
+    stickynotes->notes = NULL;
+    stickynotes->applets = NULL;
+    stickynotes->last_timeout_data = 0;
+
+    size = mate_panel_applet_get_size (mate_panel_applet);
+    scale = gtk_widget_get_scale_factor (GTK_WIDGET (mate_panel_applet));
+
+#ifndef ENABLE_IN_PROCESS
+    g_set_application_name (_("Sticky Notes"));
+#endif
+    gtk_window_set_default_icon_name ("mate-sticky-notes-applet");
+
+    stickynotes->icon_normal =
+        gtk_icon_theme_load_surface (gtk_icon_theme_get_default (),
+                                     "mate-sticky-notes-applet",
+                                     size, scale, NULL, 0, NULL);
+
+    stickynotes->icon_prelight =
+        cairo_surface_create_similar (stickynotes->icon_normal,
+                                      cairo_surface_get_content (stickynotes->icon_normal),
+                                      cairo_image_surface_get_width (stickynotes->icon_normal),
+                                      cairo_image_surface_get_height (stickynotes->icon_normal));
+
+    stickynotes_make_prelight_icon (stickynotes->icon_prelight,
+                                    stickynotes->icon_normal, 30);
+
+    cr = cairo_create (stickynotes->icon_prelight);
+    cairo_set_operator (cr, CAIRO_OPERATOR_DEST_IN);
+    cairo_mask_surface (cr, stickynotes->icon_normal, 0, 0);
+
+    stickynotes->settings = g_settings_new (STICKYNOTES_SCHEMA);
+    stickynotes->visible = TRUE;
+
+    stickynotes_applet_init_icons ();
+    stickynotes_applet_init_prefs ();
+
+    /* Watch GSettings values */
+    g_signal_connect (stickynotes->settings, "changed",
+                      G_CALLBACK (preferences_apply_cb), NULL);
+
+    /* Max height for large notes in x11 only
+     * In wayland we do not have access to global screen dimensions
+     */
+
+    screen = gtk_widget_get_screen (GTK_WIDGET (mate_panel_applet));
+#ifdef GDK_WINDOWING_X11
+    if (GDK_IS_X11_DISPLAY (gdk_screen_get_display (screen)))
+        screen_height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale;
+#endif
+
+    stickynotes->max_height = (int) (0.8 * (double) screen_height);
+
+    /* Load sticky notes */
+    stickynotes_load (screen);
+
+    install_check_click_on_desktop (screen);
+}
+
+void
+stickynotes_applet_init_prefs (void)
+{
+
+    stickynotes->builder = gtk_builder_new ();
+
+    gtk_builder_add_from_resource (stickynotes->builder,
+                                   GRESOURCE "sticky-notes-preferences.ui",
+                                   NULL);
+
+    stickynotes->w_prefs =
+        GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                            "preferences_dialog"));
+
+    stickynotes->w_prefs_width =
+        gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (gtk_builder_get_object (stickynotes->builder,
+                                                                                 "width_spin")));
+    stickynotes->w_prefs_height =
+        gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (gtk_builder_get_object (stickynotes->builder,
+                                                                                 "height_spin")));
+    stickynotes->w_prefs_color =
+        GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                            "default_color"));
+    stickynotes->w_prefs_font_color =
+        GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                            "prefs_font_color"));
+    stickynotes->w_prefs_sys_color =
+        GTK_WIDGET (&GTK_CHECK_BUTTON (gtk_builder_get_object (stickynotes->builder,
+                                                               "sys_color_check"))->toggle_button);
+    stickynotes->w_prefs_font =
+        GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                            "default_font"));
+    stickynotes->w_prefs_sys_font =
+        GTK_WIDGET (&GTK_CHECK_BUTTON (gtk_builder_get_object (stickynotes->builder,
+                                                               "sys_font_check"))->toggle_button);
+    stickynotes->w_prefs_sticky =
+        GTK_WIDGET (&GTK_CHECK_BUTTON (gtk_builder_get_object (stickynotes->builder,
+                                                               "sticky_check"))->toggle_button);
+    stickynotes->w_prefs_force =
+        GTK_WIDGET (&GTK_CHECK_BUTTON (gtk_builder_get_object (stickynotes->builder,
+                                                               "force_default_check"))->toggle_button);
+    stickynotes->w_prefs_desktop =
+        GTK_WIDGET (&GTK_CHECK_BUTTON (gtk_builder_get_object (stickynotes->builder,
+                                                               "desktop_hide_check"))->toggle_button);
+
+    g_signal_connect (stickynotes->w_prefs, "response",
+                      G_CALLBACK (preferences_response_cb), NULL);
+    g_signal_connect (stickynotes->w_prefs, "delete-event",
+                      G_CALLBACK (preferences_delete_cb), NULL);
+    g_signal_connect_swapped (stickynotes->w_prefs_width, "value-changed",
+                              G_CALLBACK (preferences_save_cb), NULL);
+    g_signal_connect_swapped (stickynotes->w_prefs_height, "value-changed",
+                              G_CALLBACK (preferences_save_cb), NULL);
+    g_signal_connect_swapped (stickynotes->w_prefs_sys_color, "toggled",
+                              G_CALLBACK (preferences_save_cb), NULL);
+    g_signal_connect_swapped (stickynotes->w_prefs_sys_font, "toggled",
+                              G_CALLBACK (preferences_save_cb), NULL);
+    g_signal_connect (stickynotes->w_prefs_color, "color-set",
+                      G_CALLBACK (preferences_color_cb), NULL);
+    g_signal_connect (stickynotes->w_prefs_font_color, "color-set",
+                      G_CALLBACK (preferences_color_cb), NULL);
+    g_signal_connect (stickynotes->w_prefs_font, "font-set",
+                      G_CALLBACK (preferences_font_cb), NULL);
+    g_signal_connect_swapped (stickynotes->w_prefs_sticky, "toggled",
+                              G_CALLBACK (preferences_save_cb), NULL);
+    g_signal_connect_swapped (stickynotes->w_prefs_force, "toggled",
+                              G_CALLBACK (preferences_save_cb), NULL);
+    g_signal_connect_swapped (stickynotes->w_prefs_desktop, "toggled",
+                              G_CALLBACK (preferences_save_cb), NULL);
+
+    {
+        GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+
+        gtk_size_group_add_widget (group,
+                                   GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                                                       "width_label")));
+        gtk_size_group_add_widget (group,
+                                   GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                                                       "height_label")));
+        gtk_size_group_add_widget (group,
+                                   GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                                                       "prefs_color_label")));
+
+        g_object_unref (group);
+    }
+
+    if (!g_settings_is_writable (stickynotes->settings, "default-width")) {
+        gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                                                      "width_label")),
+                                                                      FALSE);
+        gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                                                      "width_spin")),
+                                                                      FALSE);
+    }
+    if (!g_settings_is_writable (stickynotes->settings, "default-height")) {
+        gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                                                      "height_label")),
+                                                                       FALSE);
+        gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                                                      "height_spin")),
+                                                                      FALSE);
+    }
+    if (!g_settings_is_writable (stickynotes->settings, "default-color")) {
+        gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                                                      "prefs_color_label")),
+                                                                      FALSE);
+        gtk_widget_set_sensitive (stickynotes->w_prefs_color, FALSE);
+    }
+    if (!g_settings_is_writable (stickynotes->settings, "default-font-color")) {
+        gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                                                      "prefs_font_color_label")),
+                                                                      FALSE);
+        gtk_widget_set_sensitive (stickynotes->w_prefs_font_color, FALSE);
+    }
+    if (!g_settings_is_writable (stickynotes->settings, "use-system-color"))
+        gtk_widget_set_sensitive (stickynotes->w_prefs_sys_color, FALSE);
+    if (!g_settings_is_writable (stickynotes->settings, "default-font")) {
+        gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                                                      "prefs_font_label")),
+                                                                      FALSE);
+        gtk_widget_set_sensitive (stickynotes->w_prefs_font, FALSE);
+    }
+    if (!g_settings_is_writable (stickynotes->settings, "use-system-font"))
+        gtk_widget_set_sensitive (stickynotes->w_prefs_sys_font, FALSE);
+    if (!g_settings_is_writable (stickynotes->settings, "sticky"))
+        gtk_widget_set_sensitive (stickynotes->w_prefs_sticky, FALSE);
+    if (!g_settings_is_writable (stickynotes->settings, "force-default"))
+        gtk_widget_set_sensitive (stickynotes->w_prefs_force, FALSE);
+
+    stickynotes_applet_update_prefs ();
+}
+
+/* Create a Sticky Notes applet */
+StickyNotesApplet *
+stickynotes_applet_new (MatePanelApplet *mate_panel_applet)
+{
+    AtkObject *atk_obj;
+
+    /* Create Sticky Notes Applet */
+    StickyNotesApplet *applet = g_new (StickyNotesApplet, 1);
+
+    /* Initialize Sticky Notes Applet */
+    applet->w_applet = GTK_WIDGET (mate_panel_applet);
+    applet->w_image = gtk_image_new ();
+    applet->destroy_all_dialog = NULL;
+    applet->prelighted = FALSE;
+
+    applet->menu_tip = NULL;
+
+    /* Expand the applet for Fitts' law complience. */
+    mate_panel_applet_set_flags (mate_panel_applet,
+                                 MATE_PANEL_APPLET_EXPAND_MINOR);
+
+    /* Add the applet icon */
+    gtk_container_add (GTK_CONTAINER (mate_panel_applet),
+                                      applet->w_image);
+    applet->panel_size = mate_panel_applet_get_size (mate_panel_applet);
+    applet->panel_orient = mate_panel_applet_get_orient (mate_panel_applet);
+    stickynotes_applet_update_icon (applet);
+
+    /* Add the popup menu */
+    applet->action_group = gtk_action_group_new ("StickyNotes Applet Actions");
+    gtk_action_group_set_translation_domain (applet->action_group,
+                                             GETTEXT_PACKAGE);
+    gtk_action_group_add_actions (applet->action_group,
+                                  stickynotes_applet_menu_actions,
+                                  G_N_ELEMENTS (stickynotes_applet_menu_actions),
+                                  applet);
+    gtk_action_group_add_toggle_actions (applet->action_group,
+                                         stickynotes_applet_menu_toggle_actions,
+                                         G_N_ELEMENTS (stickynotes_applet_menu_toggle_actions),
+                                         applet);
+    mate_panel_applet_setup_menu_from_resource (mate_panel_applet,
+                                                GRESOURCE "menu.xml",
+                                                applet->action_group);
+
+    if (mate_panel_applet_get_locked_down (mate_panel_applet)) {
+        GtkAction *action;
+
+        action = gtk_action_group_get_action (applet->action_group,
+                                              "preferences");
+        gtk_action_set_visible (action, FALSE);
+    }
+
+    /* Connect all signals for applet management */
+    g_signal_connect (applet->w_applet, "button-press-event",
+                      G_CALLBACK (applet_button_cb), applet);
+    g_signal_connect (applet->w_applet, "key-press-event",
+                      G_CALLBACK (applet_key_cb), applet);
+    g_signal_connect (applet->w_applet, "focus-in-event",
+                      G_CALLBACK (applet_focus_cb), applet);
+    g_signal_connect (applet->w_applet, "focus-out-event",
+                      G_CALLBACK (applet_focus_cb), applet);
+    g_signal_connect (applet->w_applet, "enter-notify-event",
+                      G_CALLBACK (applet_cross_cb), applet);
+    g_signal_connect (applet->w_applet, "leave-notify-event",
+                      G_CALLBACK (applet_cross_cb), applet);
+    g_signal_connect (applet->w_applet, "size-allocate",
+                      G_CALLBACK (applet_size_allocate_cb), applet);
+    g_signal_connect (applet->w_applet, "change-orient",
+                      G_CALLBACK (applet_change_orient_cb), applet);
+    g_signal_connect (applet->w_applet, "destroy",
+                      G_CALLBACK (applet_destroy_cb), applet);
+    g_signal_connect (applet->w_applet, "destroy",
+                      G_CALLBACK (stickynotes_destroy), NULL);
+
+    atk_obj = gtk_widget_get_accessible (applet->w_applet);
+    atk_object_set_name (atk_obj, _("Sticky Notes"));
+
+    /* Show the applet */
+    gtk_widget_show_all (applet->w_applet);
+
+    return applet;
+}
+
+void
+stickynotes_applet_update_icon (StickyNotesApplet *applet)
+{
+    cairo_t *cr;
+    cairo_surface_t *surface;
+
+    gint size = applet->panel_size;
+
+    if (size > 3)
+        size = size - 3;
+
+    /* Choose appropriate icon and size it */
+    if (applet->prelighted)
+        surface = cairo_surface_create_similar (stickynotes->icon_prelight,
+                                                cairo_surface_get_content (stickynotes->icon_prelight),
+                                                size, size);
+    else
+        surface = cairo_surface_create_similar (stickynotes->icon_normal,
+                                                cairo_surface_get_content (stickynotes->icon_normal),
+                                                size, size);
+
+    cr = cairo_create (surface);
+    cairo_set_source_surface (cr, applet->prelighted ? stickynotes->icon_prelight : stickynotes->icon_normal, 0, 0);
+    cairo_paint (cr);
+
+    /* Apply the finished surface to the applet image */
+    gtk_image_set_from_surface (GTK_IMAGE (applet->w_image), surface);
+
+    cairo_surface_destroy (surface);
+}
+
+void
+stickynotes_applet_update_prefs (void)
+{
+    gint width, height;
+    gboolean sys_color, sys_font, sticky, force_default, desktop_hide;
+    char *font_str;
+    char *color_str, *font_color_str;
+    GdkRGBA color, font_color;
+
+    width = g_settings_get_int (stickynotes->settings,
+                                "default-width");
+    width = MAX (width, 1);
+    height = g_settings_get_int (stickynotes->settings,
+                                 "default-height");
+    height = MAX (height, 1);
+
+    sys_color = g_settings_get_boolean (stickynotes->settings,
+                                        "use-system-color");
+    sys_font = g_settings_get_boolean (stickynotes->settings,
+                                       "use-system-font");
+    sticky = g_settings_get_boolean (stickynotes->settings,
+                                     "sticky");
+    force_default = g_settings_get_boolean (stickynotes->settings,
+                                            "force-default");
+    desktop_hide = g_settings_get_boolean (stickynotes->settings,
+                                           "desktop-hide");
+
+    font_str = g_settings_get_string (stickynotes->settings,
+                                      "default-font");
+    if (!font_str)
+        font_str = g_strdup ("Sans 10");
+
+    color_str = g_settings_get_string (stickynotes->settings,
+                                       "default-color");
+    if (!color_str)
+        color_str = g_strdup ("#ECF833");
+
+    font_color_str = g_settings_get_string (stickynotes->settings,
+                                            "default-font-color");
+    if (!font_color_str)
+        font_color_str = g_strdup ("#000000");
+
+    gdk_rgba_parse (&color, color_str);
+    gdk_rgba_parse (&font_color, font_color_str);
+
+    g_free (color_str);
+    g_free (font_color_str);
+
+    gtk_adjustment_set_value (stickynotes->w_prefs_width, width);
+    gtk_adjustment_set_value (stickynotes->w_prefs_height, height);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (stickynotes->w_prefs_sys_color),
+                                  sys_color);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (stickynotes->w_prefs_sys_font),
+                                  sys_font);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (stickynotes->w_prefs_sticky),
+                                  sticky);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (stickynotes->w_prefs_force),
+                                  force_default);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (stickynotes->w_prefs_desktop),
+                                  desktop_hide);
+
+    gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (stickynotes->w_prefs_color),
+                                &color);
+    gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (stickynotes->w_prefs_font_color),
+                                &font_color);
+
+    gtk_font_button_set_font_name (GTK_FONT_BUTTON (stickynotes->w_prefs_font),
+                                   font_str);
+    g_free (font_str);
+
+    if (g_settings_is_writable (stickynotes->settings, "default-color")) {
+        gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                                                      "prefs_color_label")),
+                                  !sys_color);
+        gtk_widget_set_sensitive (stickynotes->w_prefs_color, !sys_color);
+    }
+    if (g_settings_is_writable (stickynotes->settings, "default-font-color")) {
+        gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                                                      "prefs_font_color_label")),
+                                  !sys_color);
+        gtk_widget_set_sensitive (stickynotes->w_prefs_font_color, !sys_color);
+    }
+    if (g_settings_is_writable (stickynotes->settings, "default-font")) {
+        gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
+                                                                      "prefs_font_label")),
+                                  !sys_font);
+        gtk_widget_set_sensitive (stickynotes->w_prefs_font, !sys_font);
+    }
+}
+
+void
+stickynotes_applet_update_menus (void)
+{
+    GList *l;
+    gboolean inconsistent = FALSE;
+
+    gboolean locked = g_settings_get_boolean (stickynotes->settings,
+                                              "locked");
+    gboolean locked_writable = g_settings_is_writable (stickynotes->settings,
+                                                       "locked");
+
+    for (l = stickynotes->notes; l != NULL; l = l->next) {
+        StickyNote *note = l->data;
+
+        if (note->locked != locked) {
+            inconsistent = TRUE;
+            break;
+        }
+    }
+
+    for (l = stickynotes->applets; l != NULL; l = l->next) {
+        StickyNotesApplet *applet = l->data;
+        GSList *proxies, *p;
+
+        GtkAction *action = gtk_action_group_get_action (applet->action_group,
+                                                         "lock");
+
+        g_object_set (action,
+                      "active", locked,
+                      "sensitive", locked_writable,
+                      NULL);
+
+        proxies = gtk_action_get_proxies (action);
+        for (p = proxies; p; p = g_slist_next (p)) {
+            if (GTK_IS_CHECK_MENU_ITEM (p->data))
+                gtk_check_menu_item_set_inconsistent (GTK_CHECK_MENU_ITEM (p->data),
+                                                      inconsistent);
+        }
+    }
+}
+
+void
+stickynotes_applet_update_tooltips (void)
+{
+    int num;
+    char *tooltip, *no_notes;
+    StickyNotesApplet *applet;
+    GList *l;
+
+    num = g_list_length (stickynotes->notes);
+
+    no_notes = g_strdup_printf (ngettext ("%d note",
+                                          "%d notes",
+                                          num),
+                                num);
+
+    tooltip = g_strdup_printf ("%s\n%s",
+                               _("Show sticky notes"),
+                               no_notes);
+
+    for (l = stickynotes->applets; l; l = l->next)
+    {
+        applet = l->data;
+        gtk_widget_set_tooltip_text (applet->w_applet,
+                                     tooltip);
+
+        if (applet->menu_tip)
+            gtk_label_set_text (GTK_LABEL (gtk_bin_get_child (GTK_BIN (applet->menu_tip))),
+                                no_notes);
+    }
+
+    g_free (tooltip);
+    g_free (no_notes);
+}
+
+void
+stickynotes_applet_panel_icon_get_geometry (int *x,
+                                            int *y,
+                                            int *width,
+                                            int *height)
+{
+    GtkWidget         *widget;
+    GtkAllocation      allocation;
+    GtkRequisition     requisition;
+    StickyNotesApplet *applet;
+
+    applet = stickynotes->applets->data;
+
+    widget = GTK_WIDGET (applet->w_image);
+
+    gtk_widget_get_preferred_size (widget,
+                                   NULL, &requisition);
+
+    gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
+
+    gtk_widget_get_allocation (widget, &allocation);
+    *width = allocation.x;
+    *height = allocation.y;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/137.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/137.html new file mode 100644 index 00000000..018eae92 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/137.html @@ -0,0 +1,447 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
/* Sticky Notes
+ * Copyright (C) 2002-2003 Loban A Rahman
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef __STICKYNOTES_APPLET_CALLBACKS_H__
+#define __STICKYNOTES_APPLET_CALLBACKS_H__
+
+#include <stickynotes_applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+/* Callbacks for the sticky notes applet */
+gboolean
+applet_button_cb (GtkWidget         *widget,
+                  GdkEventButton    *event,
+                  StickyNotesApplet *applet);
+gboolean
+applet_key_cb (GtkWidget         *widget,
+               GdkEventKey       *event,
+               StickyNotesApplet *applet);
+gboolean
+applet_cross_cb (GtkWidget         *widget,
+                 GdkEventCrossing  *event,
+                 StickyNotesApplet *applet);
+gboolean
+applet_focus_cb (GtkWidget         *widget,
+                 GdkEventFocus     *event,
+                 StickyNotesApplet *applet);
+
+void
+install_check_click_on_desktop (GdkScreen *screen);
+void
+applet_change_orient_cb (MatePanelApplet       *mate_panel_applet,
+                         MatePanelAppletOrient  orient,
+                         StickyNotesApplet     *applet);
+void
+applet_size_allocate_cb (GtkWidget         *widget,
+                         GtkAllocation     *allocation,
+                         StickyNotesApplet *applet);
+void
+applet_destroy_cb (MatePanelApplet   *mate_panel_applet,
+                   StickyNotesApplet *applet);
+
+/* Callbacks for sticky notes applet menu */
+void
+menu_create_cb (GtkAction         *action,
+                StickyNotesApplet *applet);
+void
+menu_new_note_cb (GtkAction         *action,
+                  StickyNotesApplet *applet);
+void
+menu_hide_notes_cb (GtkAction         *action,
+                    StickyNotesApplet *applet);
+void
+menu_destroy_all_cb (GtkAction         *action,
+                     StickyNotesApplet *applet);
+void
+menu_toggle_lock_cb (GtkAction         *action,
+                     StickyNotesApplet *applet);
+void
+menu_preferences_cb (GtkAction         *action,
+                     StickyNotesApplet *applet);
+void
+menu_help_cb (GtkAction         *action,
+              StickyNotesApplet *applet);
+void
+menu_about_cb (GtkAction         *action,
+               StickyNotesApplet *applet);
+
+/* Callbacks for sticky notes preferences dialog */
+void
+preferences_save_cb (gpointer data);
+void
+preferences_color_cb (GtkWidget *button,
+                      gpointer   data);
+void
+preferences_font_cb (GtkWidget *button,
+                     gpointer   data);
+void
+preferences_apply_cb (GSettings *settings,
+                      gchar     *key,
+                      gpointer   data);
+void
+preferences_response_cb (GtkWidget *dialog,
+                         gint       response,
+                         gpointer   data);
+gboolean
+preferences_delete_cb (GtkWidget *widget,
+                       GdkEvent  *event,
+                       gpointer   data);
+
+#endif /* __STICKYNOTES_APPLET_CALLBACKS_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/138.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/138.html new file mode 100644 index 00000000..3bd5e24b --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/138.html @@ -0,0 +1,1583 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
/* Sticky Notes
+ * Copyright (C) 2002-2003 Loban A Rahman
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "stickynotes_applet_callbacks.h"
+#include "stickynotes.h"
+#include <gdk/gdkkeysyms.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <X11/Xatom.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+static void
+popup_add_note (StickyNotesApplet *applet,
+                GtkWidget         *item)
+{
+    stickynotes_add (gtk_widget_get_screen (applet->w_applet));
+}
+
+static void
+stickynote_show_notes (gboolean visible)
+{
+    StickyNote *note;
+    GList *l;
+
+    if (stickynotes->visible == visible) return;
+
+    if (g_settings_get_boolean (stickynotes->settings, "click-hide") && !visible)
+        return;
+
+    stickynotes->visible = visible;
+
+    for (l = stickynotes->notes; l; l = l->next) {
+        note = l->data;
+        stickynote_set_visible (note, visible);
+    }
+}
+
+static void
+stickynote_toggle_notes_visible (void)
+{
+    stickynote_show_notes (!stickynotes->visible);
+}
+
+/* Applet Callback : Mouse button press on the applet. */
+gboolean
+applet_button_cb (GtkWidget         *widget,
+                  GdkEventButton    *event,<--- Parameter 'event' can be declared as pointer to const
+                  StickyNotesApplet *applet)
+{
+    if (event->type == GDK_2BUTTON_PRESS) {
+        popup_add_note (applet, NULL);
+        return TRUE;
+    }
+    else if (event->button == 1) {
+        stickynote_toggle_notes_visible ();
+        return TRUE;
+    }
+
+    return FALSE;
+}
+
+/* Applet Callback : Keypress on the applet. */
+gboolean
+applet_key_cb (GtkWidget         *widget,
+               GdkEventKey       *event,<--- Parameter 'event' can be declared as pointer to const
+               StickyNotesApplet *applet)
+{
+    switch (event->keyval) {
+        case GDK_KEY_KP_Space:
+        case GDK_KEY_space:
+        case GDK_KEY_KP_Enter:
+        case GDK_KEY_Return:
+            stickynote_show_notes (TRUE);
+            return TRUE;
+    }
+     return FALSE;
+}
+
+/* Applet Callback : Cross (enter or leave) the applet. */
+gboolean
+applet_cross_cb (GtkWidget         *widget,
+                 GdkEventCrossing  *event,<--- Parameter 'event' can be declared as pointer to const
+                 StickyNotesApplet *applet)
+{
+    applet->prelighted =
+        event->type == GDK_ENTER_NOTIFY || gtk_widget_has_focus (widget);
+
+    stickynotes_applet_update_icon (applet);
+
+    return FALSE;
+}
+
+/* Applet Callback : On focus (in or out) of the applet. */
+gboolean
+applet_focus_cb (GtkWidget         *widget,
+                 GdkEventFocus     *event,
+                 StickyNotesApplet *applet)
+{
+    stickynotes_applet_update_icon (applet);
+
+    return FALSE;
+}
+
+#ifdef GDK_WINDOWING_X11
+static gboolean get_desktop_window (GdkScreen *screen, Window *window)
+{
+    Window *desktop_window;
+    GdkWindow *root_window;
+    GdkAtom type_returned;
+    int format_returned;
+    int length_returned;
+
+    root_window = gdk_screen_get_root_window (screen);
+
+    if (gdk_property_get (root_window,
+                          gdk_atom_intern ("CAJA_DESKTOP_WINDOW_ID", FALSE),
+                          gdk_x11_xatom_to_atom (XA_WINDOW),
+                          0, 4, FALSE,
+                          &type_returned,
+                          &format_returned,
+                          &length_returned,
+                          (guchar**) &desktop_window)) {
+        *window = *desktop_window;
+        g_free (desktop_window);
+        return TRUE;
+    }
+    else {
+        *window = 0;
+        return FALSE;
+    }
+}
+
+static GdkFilterReturn
+desktop_window_event_filter (GdkXEvent *xevent,
+                             GdkEvent  *event,
+                             gpointer   data)
+{
+    gboolean desktop_hide = g_settings_get_boolean (stickynotes->settings,
+                                                    "desktop-hide");
+    if (desktop_hide &&
+        (((XEvent*)xevent)->xany.type == PropertyNotify) &&
+        (((XEvent*)xevent)->xproperty.atom == gdk_x11_get_xatom_by_name ("_NET_WM_USER_TIME"))) {
+        stickynote_show_notes (FALSE);
+    }
+    return GDK_FILTER_CONTINUE;
+}
+#endif /* GDK_WINDOWING_X11 */
+
+void install_check_click_on_desktop (GdkScreen *screen)
+{
+#ifdef GDK_WINDOWING_X11
+    Window desktop_window;
+    GdkWindow *window;
+    Atom user_time_window;
+    Atom user_time;
+    GdkDisplay *display;
+
+    display = gdk_screen_get_display (screen);
+    /* All this uses X11-only APIs and features */
+    if (!GDK_IS_X11_DISPLAY (display))
+        return;
+
+    if (!get_desktop_window (screen, &desktop_window)) {
+        return;
+    }
+
+    /* Access the desktop window. desktop_window is the root window for the
+     * default screen, so we know using gdk_display_get_default () is correct.
+     * This code should not be reached if running in wayland
+     */
+    window = gdk_x11_window_foreign_new_for_display (display, desktop_window);
+
+    /* Avoid crash if the desktop window ID is set but invalid, e.g. if
+     * Caja has set it but quit since then */
+    if (!window) {
+        return;
+    }
+
+    /* It may contain an atom to tell us which other window to monitor */
+    user_time_window = gdk_x11_get_xatom_by_name ("_NET_WM_USER_TIME_WINDOW");
+    user_time = gdk_x11_get_xatom_by_name ("_NET_WM_USER_TIME");
+    if (user_time != None  &&  user_time_window != None) {
+        /* Looks like the atoms are there */
+        Atom actual_type;
+        Window *data;
+        int actual_format;
+        gulong nitems;
+        gulong bytes;
+
+        /* We only use this extra property if the actual user-time property's missing */
+        XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_window_get_display (window)),
+                            desktop_window, user_time,
+                            0, 4, False, AnyPropertyType,
+                            &actual_type, &actual_format,
+                            &nitems, &bytes, (unsigned char **)&data);
+        if (actual_type == None) {
+            /* No user-time property, so look for the user-time-window */
+            XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_window_get_display (window)),
+                                desktop_window, user_time_window,
+                                0, 4, False, AnyPropertyType,
+                                &actual_type, &actual_format,
+                                &nitems, &bytes, (unsigned char **)&data);
+            if (actual_type != None) {
+                /* We have another window to monitor */
+                desktop_window = *data;
+                window = gdk_x11_window_foreign_new_for_display (gdk_window_get_display (window),
+                                                                 desktop_window);
+            }
+        }
+    }
+
+    gdk_window_set_events (window, GDK_PROPERTY_CHANGE_MASK);
+    gdk_window_add_filter (window, desktop_window_event_filter, NULL);
+#endif
+}
+
+/* Applet Callback : Change the panel orientation. */
+void
+applet_change_orient_cb (MatePanelApplet       *mate_panel_applet,
+                         MatePanelAppletOrient  orient,
+                         StickyNotesApplet     *applet)
+{
+    applet->panel_orient = orient;
+}
+
+/* Applet Callback : Resize the applet. */
+void
+applet_size_allocate_cb (GtkWidget         *widget,
+                         GtkAllocation     *allocation,<--- Parameter 'allocation' can be declared as pointer to const
+                         StickyNotesApplet *applet)
+{
+    if ((applet->panel_orient == MATE_PANEL_APPLET_ORIENT_UP)
+        || (applet->panel_orient == MATE_PANEL_APPLET_ORIENT_DOWN)) {
+        if (applet->panel_size == allocation->height)
+            return;
+        applet->panel_size = allocation->height;
+    } else {
+        if (applet->panel_size == allocation->width)
+            return;
+        applet->panel_size = allocation->width;
+    }
+
+    stickynotes_applet_update_icon (applet);
+
+    return;
+}
+
+/* Applet Callback : Deletes the applet. */
+void
+applet_destroy_cb (MatePanelApplet   *mate_panel_applet,
+                   StickyNotesApplet *applet)
+{
+    GList *notes;
+
+    stickynotes_save_now ();
+
+    if (applet->destroy_all_dialog != NULL)
+        gtk_widget_destroy (applet->destroy_all_dialog);
+
+    if (applet->action_group)
+        g_object_unref (applet->action_group);
+
+    if (stickynotes->applets != NULL)
+        stickynotes->applets = g_list_remove (stickynotes->applets,
+                                              applet);
+
+    if (stickynotes->applets == NULL) {
+        notes = stickynotes->notes;
+        while (notes) {
+            StickyNote *note = notes->data;
+            stickynote_free (note);
+            notes = g_list_next (notes);
+        }
+    }
+}
+
+/* Destroy all response Callback: Callback for the destroy all dialog */
+static void
+destroy_all_response_cb (GtkDialog         *dialog,
+                         gint               id,
+                         StickyNotesApplet *applet)
+{
+    if (id == GTK_RESPONSE_OK) {
+        while (g_list_length (stickynotes->notes) > 0) {
+            StickyNote *note = g_list_nth_data (stickynotes->notes, 0);
+            stickynote_free (note);
+            stickynotes->notes = g_list_remove (stickynotes->notes, note);
+        }
+    }
+
+    stickynotes_applet_update_tooltips ();
+    stickynotes_save ();
+
+    gtk_widget_destroy (GTK_WIDGET (dialog));
+    applet->destroy_all_dialog = NULL;
+}
+
+/* Menu Callback : New Note */
+void
+menu_new_note_cb (GtkAction         *action,
+                  StickyNotesApplet *applet)
+{
+    popup_add_note (applet, NULL);
+}
+
+/* Menu Callback : Hide Notes */
+void
+menu_hide_notes_cb (GtkAction         *action,
+                    StickyNotesApplet *applet)
+{
+    stickynote_show_notes (FALSE);
+}
+
+/* Menu Callback : Destroy all sticky notes */
+void
+menu_destroy_all_cb (GtkAction         *action,
+                     StickyNotesApplet *applet)
+{
+    GtkBuilder *builder;
+
+    builder = gtk_builder_new ();
+    gtk_builder_add_from_resource (builder,
+                                   GRESOURCE "sticky-notes-delete-all.ui",
+                                   NULL);
+
+    if (applet->destroy_all_dialog != NULL) {
+        gtk_window_set_screen (GTK_WINDOW (applet->destroy_all_dialog),
+                               gtk_widget_get_screen (GTK_WIDGET (applet->w_applet)));
+
+        gtk_window_present (GTK_WINDOW (applet->destroy_all_dialog));
+        return;
+    }
+
+    applet->destroy_all_dialog = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                     "delete_all_dialog"));
+
+    g_object_unref (builder);
+
+    g_signal_connect (applet->destroy_all_dialog, "response",
+                      G_CALLBACK (destroy_all_response_cb),
+                      applet);
+
+    gtk_window_set_screen (GTK_WINDOW (applet->destroy_all_dialog),
+                           gtk_widget_get_screen (applet->w_applet));
+
+    gtk_widget_show_all (applet->destroy_all_dialog);
+}
+
+/* Menu Callback: Lock/Unlock sticky notes */
+void
+menu_toggle_lock_cb (GtkAction         *action,
+                     StickyNotesApplet *applet)
+{
+    gboolean locked = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+
+    if (g_settings_is_writable (stickynotes->settings, "locked"))
+        g_settings_set_boolean (stickynotes->settings, "locked", locked);
+}
+
+/* Menu Callback : Configure preferences */
+void
+menu_preferences_cb (GtkAction         *action,
+                     StickyNotesApplet *applet)
+{
+    stickynotes_applet_update_prefs ();
+    gtk_window_set_screen (GTK_WINDOW (stickynotes->w_prefs),
+                           gtk_widget_get_screen (applet->w_applet));
+    gtk_window_present (GTK_WINDOW (stickynotes->w_prefs));
+}
+
+/* Menu Callback : Show help */
+void
+menu_help_cb (GtkAction         *action,
+              StickyNotesApplet *applet)
+{
+    GError *error = NULL;
+
+    gtk_show_uri_on_window (NULL,
+                            "help:mate-stickynotes-applet",
+                            gtk_get_current_event_time (),
+                            &error);
+
+    if (error) {
+        GtkWidget *dialog = gtk_message_dialog_new (NULL,
+                                                    GTK_DIALOG_MODAL,
+                                                    GTK_MESSAGE_ERROR,
+                                                    GTK_BUTTONS_CLOSE,
+                                                    _("There was an error displaying help: %s"),
+                                                    error->message);
+
+        g_signal_connect (dialog, "response",
+                          G_CALLBACK (gtk_widget_destroy),
+                          NULL);
+
+        gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+        gtk_window_set_screen (GTK_WINDOW (dialog),
+                               gtk_widget_get_screen (applet->w_applet));
+        gtk_widget_show (dialog);
+        g_error_free (error);
+    }
+}
+
+/* Menu Callback : Display About window */
+void
+menu_about_cb (GtkAction         *action,
+               StickyNotesApplet *applet)
+{
+    static const gchar *authors[] = {
+        "Loban A Rahman <loban@earthling.net>",
+        "Davyd Madeley <davyd@madeley.id.au>",
+        NULL
+    };
+
+    static const gchar *documenters[] = {
+        "Loban A Rahman <loban@earthling.net>",
+        N_("Sun GNOME Documentation Team <gdocteam@sun.com>"),
+        N_("MATE Documentation Team"),
+        NULL
+    };
+
+#ifdef ENABLE_NLS
+    const char **p;
+    for (p = documenters; *p; ++p)
+        *p = _(*p);
+#endif
+
+    gtk_show_about_dialog (NULL,
+                           "title",              _("About Sticky Notes"),
+                           "version",            VERSION,
+                           "copyright",          _("Copyright \xc2\xa9 2002-2003 Loban A Rahman\n"
+                                                   "Copyright \xc2\xa9 2005 Davyd Madeley\n"
+                                                   "Copyright \xc2\xa9 2012-2021 MATE developers"),
+                           "comments",           _("Sticky Notes for the "
+                                                   "MATE Desktop Environment"),
+                           "authors",            authors,
+                           "documenters",        documenters,
+                           "translator-credits", _("translator-credits"),
+                           "logo-icon-name",     "mate-sticky-notes-applet",
+                           NULL);
+}
+
+/* Preferences Callback : Save. */
+void
+preferences_save_cb (gpointer data)
+{
+    gint     width;
+    gint     height;
+    gboolean sys_color;
+    gboolean sys_font;
+    gboolean sticky;
+    gboolean force_default;
+    gboolean desktop_hide;
+    gdouble  adjustment_value;
+
+    adjustment_value = gtk_adjustment_get_value (stickynotes->w_prefs_width);
+    width = (gint) adjustment_value;
+
+    adjustment_value = gtk_adjustment_get_value (stickynotes->w_prefs_height);
+    height = (gint) adjustment_value;
+
+    sys_color     = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (stickynotes->w_prefs_sys_color));
+    sys_font      = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (stickynotes->w_prefs_sys_font));
+    sticky        = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (stickynotes->w_prefs_sticky));
+    force_default = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (stickynotes->w_prefs_force));
+    desktop_hide  = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (stickynotes->w_prefs_desktop));
+
+    if (g_settings_is_writable (stickynotes->settings,
+                                "default-width"))
+        g_settings_set_int (stickynotes->settings,
+                            "default-width", width);
+    if (g_settings_is_writable (stickynotes->settings,
+                                "default-height"))
+        g_settings_set_int (stickynotes->settings,
+                            "default-height", height);
+    if (g_settings_is_writable (stickynotes->settings,
+                                "use-system-color"))
+        g_settings_set_boolean (stickynotes->settings,
+                                "use-system-color", sys_color);
+    if (g_settings_is_writable (stickynotes->settings,
+                                "use-system-font"))
+        g_settings_set_boolean (stickynotes->settings,
+                                "use-system-font", sys_font);
+    if (g_settings_is_writable (stickynotes->settings,
+                                "sticky"))
+        g_settings_set_boolean (stickynotes->settings,
+                                "sticky", sticky);
+    if (g_settings_is_writable (stickynotes->settings,
+                                "force-default"))
+        g_settings_set_boolean (stickynotes->settings,
+                                "force-default", force_default);
+    if (g_settings_is_writable (stickynotes->settings,
+                                "desktop-hide"))
+        g_settings_set_boolean (stickynotes->settings,
+                                "desktop-hide", desktop_hide);
+}
+
+/* Preferences Callback : Change color. */
+void
+preferences_color_cb (GtkWidget *button,
+                      gpointer   data)
+{
+    char *color_str, *font_color_str;
+
+    GdkRGBA color, font_color;
+
+    gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (stickynotes->w_prefs_color),
+                                &color);
+    gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (stickynotes->w_prefs_font_color),
+                                &font_color);
+
+    color_str = gdk_rgba_to_string (&color);
+    font_color_str = gdk_rgba_to_string (&font_color);
+
+    g_settings_set_string (stickynotes->settings,
+                           "default-color",
+                           color_str);
+    g_settings_set_string (stickynotes->settings,
+                           "default-font-color",
+                           font_color_str);
+
+    g_free (color_str);
+    g_free (font_color_str);
+}
+
+/* Preferences Callback : Change font. */
+void
+preferences_font_cb (GtkWidget *button,
+                     gpointer   data)
+{
+    const char *font_str;
+
+    font_str = gtk_font_button_get_font_name (GTK_FONT_BUTTON (button));
+    g_settings_set_string (stickynotes->settings,
+                           "default-font",
+                           font_str);
+}
+
+/* Preferences Callback : Apply to existing notes. */
+void
+preferences_apply_cb (GSettings *settings,
+                      gchar     *key,
+                      gpointer   data)
+{
+    GList *l;
+    StickyNote *note;
+
+    if (!strcmp (key, "sticky")) {
+        if (g_settings_get_boolean (settings, key))
+            for (l = stickynotes->notes; l; l = l->next) {
+                note = l->data;
+                gtk_window_stick (GTK_WINDOW (note->w_window));
+            }
+        else
+            for (l = stickynotes->notes; l; l = l->next) {
+                note = l->data;
+                gtk_window_unstick (GTK_WINDOW (note->w_window));
+            }
+    }
+
+    else if (!strcmp (key, "locked")) {
+        for (l = stickynotes->notes; l; l = l->next) {
+            note = l->data;
+            stickynote_set_locked (note,
+                                   g_settings_get_boolean (settings, key));
+        }
+        stickynotes_save ();
+    }
+
+    else if (!strcmp (key, "use-system-color") ||
+        !strcmp (key, "default-color")) {
+            for (l = stickynotes->notes; l; l = l->next) {
+                note = l->data;
+                stickynote_set_color (note,
+                                      note->color,
+                                      note->font_color,
+                                      FALSE);
+            }
+    }
+
+    else if (!strcmp (key, "use-system-font") ||
+        !strcmp (key, "default-font")) {
+            for (l = stickynotes->notes; l; l = l->next) {
+                note = l->data;
+                stickynote_set_font (note, note->font, FALSE);
+            }
+    }
+
+    else if (!strcmp (key, "force-default")) {
+        for (l = stickynotes->notes; l; l = l->next) {
+            note = l->data;
+            stickynote_set_color (note,
+                                  note->color,
+                                  note->font_color,
+                                  FALSE);
+            stickynote_set_font (note,
+                                 note->font,
+                                 FALSE);
+        }
+    }
+
+    stickynotes_applet_update_prefs ();
+    stickynotes_applet_update_menus ();
+}
+
+/* Preferences Callback : Response. */
+void
+preferences_response_cb (GtkWidget *dialog,
+                         gint       response,
+                         gpointer   data)
+{
+    if (response == GTK_RESPONSE_HELP) {
+        GError *error = NULL;
+
+        gtk_show_uri_on_window (GTK_WINDOW (dialog),
+                                "help:mate-stickynotes-applet/stickynotes-advanced-settings",
+                                gtk_get_current_event_time (),
+                                &error);
+
+        if (error) {
+            dialog = gtk_message_dialog_new (NULL,
+                                             GTK_DIALOG_MODAL,
+                                             GTK_MESSAGE_ERROR,
+                                             GTK_BUTTONS_CLOSE,
+                                             _("There was an error displaying help: %s"),
+                                             error->message);
+
+            g_signal_connect (dialog, "response",
+                              G_CALLBACK (gtk_widget_destroy),
+                              NULL);
+            gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+            gtk_window_set_screen (GTK_WINDOW (dialog),
+                                   gtk_widget_get_screen (GTK_WIDGET (dialog)));
+            gtk_widget_show (dialog);
+            g_error_free (error);
+        }
+    }
+
+    else if (response == GTK_RESPONSE_CLOSE)
+            gtk_widget_hide (GTK_WIDGET (dialog));
+}
+
+/* Preferences Callback : Delete */
+gboolean
+preferences_delete_cb (GtkWidget *widget,
+                       GdkEvent  *event,
+                       gpointer   data)
+{
+    gtk_widget_hide (widget);
+
+    return TRUE;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/139.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/139.html new file mode 100644 index 00000000..41400a30 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/139.html @@ -0,0 +1,779 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
/* Sticky Notes
+ * Copyright (C) 2002-2003 Loban A Rahman
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stickynotes_callbacks.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+/* Sticky Window Callback : Lock/Unlock the window */
+gboolean
+stickynote_toggle_lock_cb (GtkWidget  *widget,
+                           StickyNote *note)
+{
+    stickynote_set_locked (note, !note->locked);
+
+    return TRUE;
+}
+
+/* Sticky Window Callback : Close the window. */
+gboolean
+stickynote_close_cb (GtkWidget  *widget,
+                     StickyNote *note)
+{
+    stickynotes_remove (note);
+
+    return TRUE;
+}
+
+/* Sticky Window Callback : Resize the window. */
+gboolean stickynote_resize_cb (GtkWidget      *widget,<--- Parameter 'widget' can be declared as pointer to const
+                               GdkEventButton *event,
+                               StickyNote     *note)
+{
+    if (event->type == GDK_BUTTON_PRESS && event->button == 1) {
+        if (widget == note->w_resize_se)
+            gtk_window_begin_resize_drag (GTK_WINDOW (note->w_window),
+                                          GDK_WINDOW_EDGE_SOUTH_EAST,
+                                          event->button,
+                                          (gint) event->x_root,
+                                          (gint) event->y_root,
+                                          event->time);
+        else /* if (widget == note->w_resize_sw) */
+            gtk_window_begin_resize_drag (GTK_WINDOW (note->w_window),
+                                          GDK_WINDOW_EDGE_SOUTH_WEST,
+                                          event->button,
+                                          (gint) event->x_root,
+                                          (gint) event->y_root,
+                                          event->time);
+    }
+    else
+        return FALSE;
+
+    return TRUE;
+}
+
+/* Sticky Window Callback : Move the window or edit the title. */
+gboolean
+stickynote_move_cb (GtkWidget      *widget,
+                    GdkEventButton *event,
+                    StickyNote     *note)
+{
+    if (event->type == GDK_BUTTON_PRESS && event->button == 1)
+        gtk_window_begin_move_drag (GTK_WINDOW (note->w_window),
+                                    event->button, event->x_root,
+                                    event->y_root, event->time);
+    else if (event->type == GDK_2BUTTON_PRESS && event->button == 1)
+        stickynote_change_properties (note);
+    else
+        return FALSE;
+
+    return TRUE;
+}
+
+/* Sticky Window Callback : Store settings when resizing/moving the window */
+gboolean
+stickynote_configure_cb (GtkWidget         *widget,
+                         GdkEventConfigure *event,<--- Parameter 'event' can be declared as pointer to const
+                         StickyNote        *note)
+{
+    note->x = event->x;
+    note->y = event->y;
+    note->w = event->width;
+    note->h = event->height;
+
+    stickynotes_save ();
+
+    return FALSE;
+}
+
+/* Sticky Window Callback : Get confirmation when deleting the window. */
+gboolean
+stickynote_delete_cb (GtkWidget  *widget,
+                      GdkEvent   *event,
+                      StickyNote *note)
+{
+    stickynotes_remove (note);
+
+    return TRUE;
+}
+
+/* Sticky Window Callback : Popup the right click menu. */
+gboolean
+stickynote_show_popup_menu (GtkWidget      *widget,
+                            GdkEventButton *event,
+                            GtkWidget      *popup_menu)
+{
+    if (event->type == GDK_BUTTON_PRESS && event->button == 3) {
+        gtk_menu_popup_at_pointer (GTK_MENU (popup_menu),
+                                   (const GdkEvent*) event);
+    }
+
+    return FALSE;
+}
+
+/* Sticky Window Callback : Exit entry field on key press or popup
+ * the right click menu. */
+gboolean
+stickynote_keypress_cb (GtkWidget    *widget,
+                        GdkEventKey  *event,
+                        GtkMenu      *popup_menu)
+{
+    GdkModifierType state = event->state & gtk_accelerator_get_default_mod_mask ();
+
+    switch (event->keyval) {
+        case GDK_KEY_F6:
+            if (state == 0)
+                gtk_widget_child_focus(widget, GTK_DIR_TAB_FORWARD);
+            else if (state == GDK_SHIFT_MASK)
+                gtk_widget_child_focus(widget, GTK_DIR_TAB_BACKWARD);
+            else
+                break;
+            return TRUE;
+        default:
+            break;
+    }
+
+    if ((event->keyval == GDK_KEY_F10 && (state == 0 || state == GDK_SHIFT_MASK)) ||
+        (event->keyval == GDK_KEY_Menu && state == 0)) {
+        GtkWidget *focus_widget = NULL;
+
+        if (GTK_IS_WINDOW (widget))
+            focus_widget = gtk_window_get_focus (GTK_WINDOW (widget));
+        if (! focus_widget)
+            focus_widget = widget;
+
+        gtk_menu_popup_at_widget (popup_menu, focus_widget,
+                                  GDK_GRAVITY_SOUTH_WEST,
+                                  GDK_GRAVITY_NORTH_WEST,
+                                  (const GdkEvent*) event);
+        return TRUE;
+    }
+
+    return FALSE;
+}
+
+/* Popup Menu Callback : Create a new sticky note */
+void popup_create_cb (GtkWidget  *widget,
+                      StickyNote *note)
+{
+    stickynotes_add (gtk_widget_get_screen (note->w_window));
+}
+
+/* Popup Menu Callback : Destroy selected sticky note */
+void
+popup_destroy_cb (GtkWidget  *widget,
+                  StickyNote *note)
+{
+    stickynotes_remove (note);
+}
+
+/* Popup Menu Callback : Lock/Unlock selected sticky note */
+void
+popup_toggle_lock_cb (GtkCheckMenuItem *item,
+                      StickyNote       *note)
+{
+    stickynote_set_locked (note,
+                           gtk_check_menu_item_get_active (item));
+}
+
+/* Popup Menu Callback : Change sticky note properties */
+void
+popup_properties_cb (GtkWidget  *widget,
+                     StickyNote *note)
+{
+    stickynote_change_properties (note);
+}
+
+/* Properties Dialog Callback : Apply title */
+void
+properties_apply_title_cb (StickyNote *note)
+{
+    stickynote_set_title (note,
+                          gtk_entry_get_text (GTK_ENTRY (note->w_entry)));
+}
+
+/* Properties Dialog Callback : Apply color */
+void
+properties_apply_color_cb (StickyNote *note)
+{
+    char *color_str = NULL;
+    char *font_color_str = NULL;
+
+    if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (note->w_def_color))) {
+        GdkRGBA color, font_color;
+
+        gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (note->w_color),
+                                    &color);
+        gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (note->w_font_color),
+                                    &font_color);
+
+        color_str = gdk_rgba_to_string (&color);
+        font_color_str = gdk_rgba_to_string (&font_color);
+    }
+
+    stickynote_set_color (note, color_str,
+                          font_color_str, TRUE);
+
+    g_free (color_str);
+    g_free (font_color_str);
+}
+
+/* Properties Dialog Callback : Apply font */
+void properties_apply_font_cb (StickyNote *note)
+{
+    const gchar *font_str = NULL;
+
+    if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (note->w_def_font)))
+        font_str = gtk_font_button_get_font_name (GTK_FONT_BUTTON (note->w_font));
+
+    stickynote_set_font (note, font_str, TRUE);
+}
+
+/* Properties Dialog Callback : Color */
+void
+properties_color_cb (GtkWidget  *button,
+                     StickyNote *note)
+{
+    properties_apply_color_cb (note);
+}
+
+/* Properties Dialog Callback : Font */
+void
+properties_font_cb (GtkWidget  *button,
+                    StickyNote *note)
+{
+    const char *font_str = gtk_font_button_get_font_name (GTK_FONT_BUTTON (button));
+    stickynote_set_font (note, font_str, TRUE);
+}
+
+/* Properties Dialog Callback : Activate */
+void
+properties_activate_cb (GtkWidget  *widget,
+                        StickyNote *note)
+{
+    gtk_dialog_response (GTK_DIALOG (note->w_properties),
+                         GTK_RESPONSE_CLOSE);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/14.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/14.html new file mode 100644 index 00000000..70e59292 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/14.html @@ -0,0 +1,699 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.charpick"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[381]; const double alignment; void * const ptr;}  charpick_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0310, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0006, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 
+  0002, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 0001, 0000, 0000, 0000, 
+  0310, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0314, 0000, 0000, 0000, 0320, 0000, 0000, 0000, 
+  0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0320, 0000, 0000, 0000, 0001, 0000, 0114, 0000, 
+  0324, 0000, 0000, 0000, 0330, 0000, 0000, 0000, 0052, 0265, 0124, 0011, 0004, 0000, 0000, 0000, 
+  0330, 0000, 0000, 0000, 0030, 0000, 0166, 0000, 0360, 0000, 0000, 0000, 0114, 0001, 0000, 0000, 
+  0275, 0342, 0315, 0116, 0005, 0000, 0000, 0000, 0114, 0001, 0000, 0000, 0015, 0000, 0114, 0000, 
+  0134, 0001, 0000, 0000, 0140, 0001, 0000, 0000, 0121, 0222, 0032, 0331, 0003, 0000, 0000, 0000, 
+  0140, 0001, 0000, 0000, 0011, 0000, 0114, 0000, 0154, 0001, 0000, 0000, 0160, 0001, 0000, 0000, 
+  0201, 0321, 0040, 0031, 0000, 0000, 0000, 0000, 0160, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 
+  0170, 0001, 0000, 0000, 0174, 0001, 0000, 0000, 0157, 0162, 0147, 0057, 0005, 0000, 0000, 0000, 
+  0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0143, 0150, 0141, 0162, 0160, 0151, 0143, 0153, 
+  0055, 0141, 0160, 0160, 0154, 0145, 0164, 0055, 0155, 0145, 0156, 0165, 0056, 0170, 0155, 0154, 
+  0204, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0263, 0311, 0115, 0315, 0053, 0315, 
+  0054, 0111, 0315, 0125, 0310, 0113, 0314, 0115, 0265, 0125, 0362, 0004, 0061, 0015, 0225, 0024, 
+  0022, 0223, 0113, 0062, 0363, 0363, 0154, 0225, 0002, 0212, 0122, 0323, 0122, 0213, 0122, 0363, 
+  0222, 0123, 0213, 0225, 0024, 0364, 0355, 0270, 0154, 0260, 0251, 0067, 0102, 0250, 0367, 0110, 
+  0315, 0051, 0300, 0255, 0320, 0030, 0241, 0320, 0061, 0051, 0277, 0264, 0004, 0254, 0222, 0013, 
+  0000, 0157, 0157, 0052, 0154, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 
+  0055, 0141, 0160, 0160, 0154, 0145, 0164, 0163, 0057, 0000, 0000, 0000, 0004, 0000, 0000, 0000, 
+  0143, 0150, 0141, 0162, 0160, 0151, 0143, 0153, 0057, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0003, 0000, 0000, 0000
+} };
+
+static GStaticResource static_resource = { charpick_resource_data.data, sizeof (charpick_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *charpick_get_resource (void);
+GResource *charpick_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * 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.1 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/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CONSTRUCTOR_H__
+#define __G_CONSTRUCTOR_H__
+
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+/*
+ * Only try to include gslist.h if not already included via glib.h,
+ * so that items using gconstructor.h outside of GLib (such as
+ * GResources) continue to build properly.
+ */
+#ifndef __G_LIB_H__
+#include "gslist.h"
+#endif
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+#endif /* __G_CONSTRUCTOR_H__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(charpickresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(charpickresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(charpickresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(charpickresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void charpickresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void charpickresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/140.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/140.html new file mode 100644 index 00000000..c20791e2 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/140.html @@ -0,0 +1,503 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
/* Sticky Notes
+ * Copyright (C) 2002-2003 Loban A Rahman
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "util.h"
+
+#include <X11/Xlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <X11/Xatom.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+static Atom
+xstuff_atom_get (const char *atom_name)
+{
+    static GHashTable *atom_hash;
+    Display           *xdisplay;
+    Atom               retval;
+
+    g_return_val_if_fail (atom_name != NULL, None);
+
+    xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
+
+    if (!atom_hash)
+        atom_hash = g_hash_table_new_full (g_str_hash,
+                                           g_str_equal,
+                                           g_free, NULL);
+
+    retval = GPOINTER_TO_UINT (g_hash_table_lookup (atom_hash, atom_name));
+    if (!retval) {
+        retval = XInternAtom (xdisplay, atom_name, FALSE);
+
+        if (retval != None)
+            g_hash_table_insert (atom_hash, g_strdup (atom_name),
+                                 GUINT_TO_POINTER (retval));
+    }
+
+    return retval;
+}
+
+int
+xstuff_get_current_workspace (GtkWindow *window)
+{
+#ifdef GDK_WINDOWING_X11
+    Window      root_window;
+    Atom        type = None;
+    gulong      nitems;
+    gulong      bytes_after;
+    gulong     *num;
+    int         format;
+    int         result;
+    int         retval;
+    GdkDisplay *gdk_display;
+    Display    *xdisplay;
+
+    gdk_display = gdk_display_get_default ();
+    if  (!GDK_IS_X11_DISPLAY (gdk_display))
+        return -1;
+
+    root_window = GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (window)));
+    xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display);
+
+    gdk_x11_display_error_trap_push (gdk_display);
+    result = XGetWindowProperty (xdisplay,
+                                 root_window,
+                                 xstuff_atom_get ("_NET_CURRENT_DESKTOP"),
+                                 0, G_MAXLONG,
+                                 False, XA_CARDINAL,
+                                 &type, &format, &nitems,
+                                 &bytes_after, (gpointer) &num);<--- Uninitialized variable: num
+    if (gdk_x11_display_error_trap_pop (gdk_display) || result != Success)
+        return -1;
+
+    if (type != XA_CARDINAL) {
+        XFree (num);
+        return -1;
+    }
+
+    retval = *num;
+
+    XFree (num);
+
+    return retval;
+#else
+    return -1;
+#endif
+}
+void
+xstuff_change_workspace (GtkWindow *window,
+                         int        new_space)
+{
+    XEvent xev;
+    Window xwindow;
+    Display *gdk_display;
+    Screen *screen;
+
+    gdk_display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
+    xwindow = GDK_WINDOW_XID (GDK_WINDOW (gtk_widget_get_window (GTK_WIDGET (window))));
+    screen = GDK_SCREEN_XSCREEN (gtk_widget_get_screen (GTK_WIDGET (window)));
+
+    xev.xclient.type = ClientMessage;
+    xev.xclient.serial = 0;
+    xev.xclient.send_event = True;
+    xev.xclient.display = gdk_display;
+    xev.xclient.window = xwindow;
+    xev.xclient.message_type = xstuff_atom_get ("_NET_WM_DESKTOP");
+    xev.xclient.format = 32;
+    xev.xclient.data.l[0] = new_space;
+    xev.xclient.data.l[1] = 0;
+    xev.xclient.data.l[2] = 0;
+
+    XSendEvent (gdk_display,
+                RootWindowOfScreen (screen),
+                False,
+                SubstructureRedirectMask | SubstructureNotifyMask,
+                &xev);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/141.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/141.html new file mode 100644 index 00000000..c9882e24 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/141.html @@ -0,0 +1,831 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.timerapplet"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[1437]; const double alignment; void * const ptr;}  timerapplet_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0310, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0006, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0063, 0064, 0113, 0146, 0005, 0000, 0000, 0000, 
+  0310, 0000, 0000, 0000, 0014, 0000, 0114, 0000, 0324, 0000, 0000, 0000, 0330, 0000, 0000, 0000, 
+  0113, 0120, 0220, 0013, 0002, 0000, 0000, 0000, 0330, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 
+  0334, 0000, 0000, 0000, 0340, 0000, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 
+  0340, 0000, 0000, 0000, 0001, 0000, 0114, 0000, 0344, 0000, 0000, 0000, 0350, 0000, 0000, 0000, 
+  0005, 0360, 0061, 0263, 0000, 0000, 0000, 0000, 0350, 0000, 0000, 0000, 0032, 0000, 0166, 0000, 
+  0010, 0001, 0000, 0000, 0177, 0005, 0000, 0000, 0201, 0321, 0040, 0031, 0001, 0000, 0000, 0000, 
+  0177, 0005, 0000, 0000, 0005, 0000, 0114, 0000, 0204, 0005, 0000, 0000, 0210, 0005, 0000, 0000, 
+  0275, 0342, 0315, 0116, 0004, 0000, 0000, 0000, 0210, 0005, 0000, 0000, 0015, 0000, 0114, 0000, 
+  0230, 0005, 0000, 0000, 0234, 0005, 0000, 0000, 0164, 0151, 0155, 0145, 0162, 0141, 0160, 0160, 
+  0154, 0145, 0164, 0057, 0003, 0000, 0000, 0000, 0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 
+  0057, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0164, 0151, 0155, 0145, 0162, 0141, 0160, 0160, 
+  0154, 0145, 0164, 0055, 0160, 0162, 0145, 0146, 0145, 0162, 0145, 0156, 0143, 0145, 0163, 0056, 
+  0165, 0151, 0000, 0000, 0000, 0000, 0000, 0000, 0023, 0053, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0132, 0121, 0163, 0342, 0066, 0020, 0176, 0277, 0137, 0241, 0352, 0265, 0103, 
+  0010, 0144, 0232, 0151, 0073, 0300, 0315, 0365, 0332, 0113, 0073, 0323, 0166, 0072, 0223, 0364, 
+  0131, 0043, 0344, 0005, 0353, 0042, 0044, 0125, 0222, 0103, 0370, 0367, 0047, 0133, 0160, 0140, 
+  0054, 0154, 0234, 0320, 0004, 0162, 0074, 0141, 0154, 0175, 0353, 0335, 0325, 0267, 0053, 0171, 
+  0127, 0203, 0367, 0217, 0063, 0201, 0036, 0300, 0130, 0256, 0344, 0020, 0367, 0056, 0056, 0061, 
+  0002, 0311, 0124, 0302, 0345, 0164, 0210, 0377, 0275, 0373, 0324, 0371, 0021, 0277, 0037, 0275, 
+  0033, 0174, 0327, 0351, 0240, 0033, 0220, 0140, 0250, 0203, 0004, 0315, 0271, 0113, 0321, 0124, 
+  0320, 0004, 0320, 0325, 0305, 0325, 0365, 0305, 0045, 0352, 0164, 0374, 0040, 0056, 0035, 0230, 
+  0011, 0145, 0060, 0172, 0207, 0320, 0300, 0300, 0177, 0031, 0067, 0140, 0221, 0340, 0343, 0041, 
+  0236, 0272, 0373, 0357, 0361, 0372, 0105, 0127, 0027, 0375, 0076, 0356, 0026, 0343, 0324, 0370, 
+  0063, 0060, 0207, 0230, 0240, 0326, 0016, 0361, 0215, 0273, 0377, 0220, 0174, 0316, 0254, 0233, 
+  0201, 0164, 0030, 0361, 0144, 0210, 0123, 0225, 0031, 0113, 0350, 0372, 0156, 0016, 0363, 0100, 
+  0155, 0224, 0006, 0343, 0026, 0110, 0322, 0031, 0014, 0161, 0246, 0375, 0077, 0074, 0352, 0137, 
+  0015, 0272, 0253, 0047, 0361, 0201, 0326, 0201, 0046, 0134, 0062, 0003, 0101, 0132, 0257, 0011, 
+  0240, 0351, 0024, 0112, 0200, 0313, 0062, 0142, 0320, 0015, 0066, 0304, 0315, 0371, 0143, 0346, 
+  0341, 0301, 0022, 0236, 0137, 0366, 0166, 0350, 0377, 0300, 0055, 0037, 0013, 0300, 0243, 0073, 
+  0223, 0101, 0223, 0112, 0214, 0112, 0062, 0121, 0054, 0263, 0170, 0364, 0211, 0012, 0333, 0070, 
+  0236, 0063, 0045, 0111, 0176, 0211, 0107, 0163, 0056, 0023, 0065, 0357, 0060, 0241, 0266, 0141, 
+  0365, 0166, 0154, 0117, 0313, 0214, 0313, 0314, 0301, 0376, 0023, 0363, 0303, 0117, 0107, 0066, 
+  0061, 0333, 0006, 0131, 0360, 0116, 0112, 0116, 0330, 0240, 0137, 0071, 0025, 0152, 0032, 0214, 
+  0321, 0006, 0046, 0140, 0174, 0050, 0373, 0031, 0112, 0302, 0375, 0303, 0060, 0151, 0254, 0114, 
+  0002, 0206, 0314, 0171, 0342, 0122, 0257, 0140, 0277, 0151, 0274, 0343, 0316, 0223, 0032, 0071, 
+  0103, 0245, 0025, 0324, 0121, 0117, 0361, 0041, 0136, 0200, 0177, 0335, 0035, 0237, 0201, 0101, 
+  0037, 0264, 0026, 0340, 0320, 0077, 0153, 0175, 0033, 0045, 0056, 0064, 0220, 0224, 0347, 0376, 
+  0011, 0226, 0125, 0000, 0054, 0345, 0042, 0101, 0105, 0072, 0222, 0124, 0164, 0212, 0277, 0076, 
+  0300, 0306, 0352, 0161, 0351, 0204, 0230, 0367, 0176, 0331, 0170, 0332, 0336, 0115, 0061, 0214, 
+  0062, 0334, 0317, 0042, 0165, 0076, 0343, 0341, 0221, 0117, 0175, 0216, 0063, 0052, 0366, 0001, 
+  0132, 0115, 0231, 0117, 0300, 0076, 0231, 0105, 0107, 0307, 0315, 0243, 0054, 0177, 0021, 0241, 
+  0006, 0350, 0206, 0035, 0121, 0113, 0063, 0347, 0224, 0054, 0333, 0373, 0124, 0233, 0143, 0070, 
+  0101, 0027, 0052, 0163, 0304, 0272, 0105, 0236, 0316, 0100, 0046, 0073, 0201, 0205, 0352, 0345, 
+  0173, 0273, 0025, 0016, 0304, 0036, 0027, 0327, 0075, 0274, 0215, 0212, 0251, 0061, 0006, 0021, 
+  0145, 0036, 0371, 0130, 0115, 0176, 0365, 0262, 0152, 0223, 0363, 0236, 0076, 0154, 0013, 0065, 
+  0300, 0200, 0077, 0344, 0361, 0013, 0023, 0232, 0011, 0327, 0136, 0102, 0261, 0336, 0340, 0121, 
+  0130, 0166, 0332, 0000, 0063, 0013, 0044, 0223, 0076, 0316, 0005, 0227, 0117, 0060, 0232, 0212, 
+  0071, 0135, 0130, 0142, 0123, 0065, 0047, 0113, 0035, 0352, 0105, 0154, 0346, 0265, 0262, 0140, 
+  0312, 0356, 0175, 0044, 0064, 0277, 0022, 0036, 0065, 0225, 0111, 0173, 0125, 0047, 0134, 0210, 
+  0366, 0050, 0255, 0054, 0017, 0141, 0175, 0131, 0147, 0124, 0124, 0373, 0101, 0267, 0302, 0372, 
+  0230, 0371, 0161, 0323, 0167, 0231, 0335, 0052, 0076, 0203, 0315, 0255, 0040, 0215, 0006, 0107, 
+  0214, 0255, 0030, 0132, 0015, 0367, 0246, 0054, 0374, 0344, 0120, 0074, 0124, 0052, 0333, 0073, 
+  0205, 0327, 0246, 0361, 0353, 0347, 0046, 0300, 0033, 0303, 0023, 0374, 0062, 0131, 0252, 0326, 
+  0075, 0321, 0064, 0345, 0203, 0274, 0331, 0322, 0350, 0133, 0225, 0310, 0146, 0162, 0015, 0356, 
+  0365, 0153, 0321, 0121, 0137, 0305, 0375, 0365, 0147, 0221, 0372, 0143, 0143, 0237, 0341, 0264, 
+  0347, 0072, 0056, 0206, 0117, 0251, 0340, 0123, 0117, 0055, 0353, 0250, 0161, 0155, 0301, 0065, 
+  0013, 0334, 0337, 0176, 0300, 0317, 0155, 0345, 0265, 0314, 0372, 0061, 0021, 0063, 0011, 0063, 
+  0045, 0071, 0313, 0367, 0207, 0123, 0360, 0113, 0126, 0176, 0233, 0370, 0020, 0062, 0213, 0172, 
+  0121, 0273, 0126, 0200, 0372, 0125, 0040, 0352, 0025, 0230, 0070, 0102, 0235, 0243, 0054, 0255, 
+  0115, 0317, 0161, 0264, 0123, 0172, 0137, 0360, 0216, 0374, 0276, 0043, 0307, 0237, 0111, 0334, 
+  0232, 0304, 0277, 0347, 0037, 0376, 0107, 0301, 0342, 0120, 0202, 0260, 0232, 0313, 0260, 0375, 
+  0074, 0075, 0056, 0367, 0316, 0134, 0176, 0125, 0056, 0377, 0025, 0252, 0045, 0107, 0301, 0346, 
+  0125, 0345, 0346, 0224, 0371, 0334, 0077, 0363, 0371, 0125, 0371, 0174, 0033, 0212, 0145, 0107, 
+  0301, 0347, 0125, 0341, 0356, 0224, 0371, 0174, 0365, 0272, 0174, 0376, 0055, 0337, 0241, 0205, 
+  0002, 0313, 0172, 0307, 0366, 0302, 0374, 0176, 0012, 0074, 0335, 0367, 0273, 0377, 0177, 0233, 
+  0365, 0336, 0011, 0357, 0060, 0157, 0175, 0300, 0154, 0326, 0326, 0266, 0267, 0071, 0157, 0213, 
+  0000, 0221, 0072, 0325, 0106, 0245, 0177, 0273, 0313, 0324, 0050, 0313, 0372, 0274, 0112, 0305, 
+  0312, 0005, 0124, 0144, 0320, 0141, 0051, 0225, 0123, 0110, 0060, 0362, 0277, 0211, 0000, 0063, 
+  0304, 0112, 0222, 0155, 0247, 0222, 0142, 0054, 0371, 0072, 0326, 0316, 0251, 0326, 0220, 0007, 
+  0236, 0012, 0035, 0261, 0123, 0040, 0156, 0357, 0270, 0210, 0133, 0335, 0321, 0174, 0113, 0324, 
+  0255, 0166, 0342, 0016, 0106, 0336, 0252, 0143, 0337, 0004, 0175, 0373, 0307, 0105, 0337, 0352, 
+  0006, 0346, 0133, 0242, 0157, 0265, 0357, 0172, 0060, 0372, 0126, 0035, 0373, 0046, 0350, 0173, 
+  0360, 0315, 0342, 0341, 0372, 0057, 0255, 0313, 0307, 0107, 0321, 0200, 0331, 0277, 0022, 0377, 
+  0061, 0005, 0126, 0352, 0107, 0026, 0115, 0056, 0251, 0034, 0237, 0160, 0126, 0364, 0011, 0210, 
+  0126, 0072, 0323, 0236, 0141, 0176, 0340, 0263, 0272, 0224, 0267, 0136, 0062, 0332, 0224, 0214, 
+  0202, 0350, 0323, 0353, 0133, 0266, 0046, 0305, 0336, 0137, 0255, 0007, 0156, 0134, 0046, 0206, 
+  0316, 0011, 0227, 0111, 0356, 0160, 0145, 0136, 0256, 0153, 0371, 0342, 0121, 0323, 0073, 0206, 
+  0250, 0011, 0247, 0067, 0016, 0025, 0051, 0044, 0176, 0030, 0344, 0034, 0035, 0347, 0350, 0150, 
+  0033, 0035, 0375, 0223, 0155, 0352, 0267, 0351, 0211, 0067, 0146, 0203, 0346, 0236, 0176, 0331, 
+  0306, 0322, 0303, 0101, 0070, 0217, 0324, 0011, 0105, 0072, 0373, 0025, 0121, 0272, 0215, 0014, 
+  0130, 0255, 0244, 0365, 0332, 0164, 0256, 0361, 0150, 0171, 0266, 0147, 0320, 0055, 0015, 0132, 
+  0011, 0217, 0011, 0134, 0236, 0205, 0312, 0217, 0204, 0055, 0217, 0232, 0215, 0251, 0131, 0037, 
+  0362, 0322, 0202, 0062, 0110, 0225, 0360, 0224, 0357, 0126, 0164, 0134, 0053, 0077, 0350, 0156, 
+  0034, 0135, 0375, 0002, 0303, 0105, 0161, 0163, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 
+  0141, 0164, 0145, 0057, 0005, 0000, 0000, 0000, 0155, 0141, 0164, 0145, 0055, 0141, 0160, 0160, 
+  0154, 0145, 0164, 0163, 0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000
+} };
+
+static GStaticResource static_resource = { timerapplet_resource_data.data, sizeof (timerapplet_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *timerapplet_get_resource (void);
+GResource *timerapplet_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * 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.1 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/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CONSTRUCTOR_H__
+#define __G_CONSTRUCTOR_H__
+
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+/*
+ * Only try to include gslist.h if not already included via glib.h,
+ * so that items using gconstructor.h outside of GLib (such as
+ * GResources) continue to build properly.
+ */
+#ifndef __G_LIB_H__
+#include "gslist.h"
+#endif
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+#endif /* __G_CONSTRUCTOR_H__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(timerappletresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(timerappletresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(timerappletresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(timerappletresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void timerappletresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void timerappletresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/142.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/142.html new file mode 100644 index 00000000..7764d200 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/142.html @@ -0,0 +1,1181 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
/* timerapplet.c:
+ *
+ * Copyright (C) 2014 Stefano Karapetsas
+ *
+ * This file is part of MATE Applets.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authors:
+ *      Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <libnotify/notify.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet-gsettings.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+/* Applet constants */
+#define APPLET_ICON  "mate-panel-clock"
+#define STEP         100
+
+/* GSettings constants */
+#define TIMER_SCHEMA            "org.mate.panel.applet.timer"
+#define NAME_KEY                "name"
+#define DURATION_KEY            "duration"
+#define SHOW_NOTIFICATION_KEY   "show-notification"
+#define SHOW_DIALOG_KEY         "show-dialog"
+
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
+#define GET_DIALOG(x) (GTK_DIALOG (gtk_builder_get_object (builder, (x))))
+#define GET_SPIN_BUTTON(x) (GTK_SPIN_BUTTON (gtk_builder_get_object (builder, (x))))
+
+typedef struct
+{
+    MatePanelApplet   *applet;
+
+    GSettings         *settings;
+
+    GtkActionGroup    *action_group;
+    GtkLabel          *label;
+    GtkImage          *image;
+    GtkImage          *pause_image;
+    GtkBox            *box;
+
+    GtkSpinButton     *hours;
+    GtkSpinButton     *minutes;
+    GtkSpinButton     *seconds;
+
+    gboolean           active;
+    gboolean           pause;
+    gint               elapsed;
+
+    guint              timeout_id;
+} TimerApplet;
+
+static void timer_start_callback (GtkAction *action, TimerApplet *applet);
+static void timer_pause_callback (GtkAction *action, TimerApplet *applet);
+static void timer_stop_callback (GtkAction *action, TimerApplet *applet);
+static void timer_about_callback (GtkAction *action, TimerApplet *applet);
+static void timer_reset_callback (GtkAction *action, TimerApplet *applet);
+static void timer_preferences_callback (GtkAction *action, TimerApplet *applet);
+
+static const GtkActionEntry applet_menu_actions [] = {
+    { "Start", "media-playback-start", N_("_Start timer"), NULL, NULL, G_CALLBACK (timer_start_callback) },
+    { "Pause", "media-playback-pause", N_("P_ause timer"), NULL, NULL, G_CALLBACK (timer_pause_callback) },
+    { "Stop", "media-playback-stop", N_("S_top timer"), NULL, NULL, G_CALLBACK (timer_stop_callback) },
+    { "Reset", "edit-undo", N_("R_eset"), NULL, NULL, G_CALLBACK (timer_reset_callback) },
+    { "Preferences", "document-properties", N_("_Preferences"), NULL, NULL, G_CALLBACK (timer_preferences_callback) },
+    { "About", "help-about", N_("_About"), NULL, NULL, G_CALLBACK (timer_about_callback) }
+};
+
+static char *ui = "<menuitem name='Item 1' action='Start' />"
+                  "<menuitem name='Item 2' action='Pause' />"
+                  "<menuitem name='Item 3' action='Stop' />"
+                  "<menuitem name='Item 4' action='Reset' />"
+                  "<menuitem name='Item 5' action='Preferences' />"
+                  "<menuitem name='Item 6' action='About' />";
+
+static void
+timer_applet_destroy (MatePanelApplet *applet_widget, TimerApplet *applet)
+{
+    g_assert (applet);
+
+    if (applet->timeout_id != 0)
+    {
+        g_source_remove(applet->timeout_id);
+        applet->timeout_id = 0;
+    }
+
+    g_object_unref (applet->settings);
+
+    notify_uninit ();
+}
+
+/* timer management */
+static gboolean
+timer_callback (TimerApplet *applet)
+{
+    AtkObject *atk_obj;
+    gboolean retval = TRUE;
+    gchar *label;
+    gchar *name;
+    gchar *tooltip;
+    gint hours, minutes, seconds, duration, remaining;
+
+    label = NULL;
+    tooltip = NULL;
+
+    if (!GTK_IS_WIDGET (applet->label))
+        return FALSE;
+
+    name = g_settings_get_string (applet->settings, NAME_KEY);
+    atk_obj = gtk_widget_get_accessible (GTK_WIDGET (applet->applet));
+
+    if (!applet->active)
+    {
+        applet->pause = FALSE;
+        applet->elapsed = 0;
+
+        gtk_label_set_text (applet->label, name);
+        gtk_widget_set_tooltip_text (GTK_WIDGET (applet->label), "");
+        gtk_widget_hide (GTK_WIDGET (applet->pause_image));
+        atk_object_set_name (atk_obj, name);
+    }
+    else
+    {
+        if (!applet->pause)
+            applet->elapsed += STEP;
+
+        duration = g_settings_get_int (applet->settings, DURATION_KEY);
+
+        remaining = duration - (applet->elapsed / 1000);
+
+        if (remaining <= 0)
+        {
+            applet->active = FALSE;
+            applet->timeout_id = 0;
+
+            /* Translators: %s is a placeholder for the timer name, 'Timer' by default */
+            label = g_strdup_printf (_("Finished %s"), name);
+            gtk_label_set_text (applet->label, label);
+            gtk_widget_set_tooltip_text (GTK_WIDGET (applet->label), name);
+            gtk_widget_hide (GTK_WIDGET (applet->pause_image));
+            atk_object_set_name (atk_obj, label);
+            atk_object_set_description (atk_obj, "");
+
+            if (g_settings_get_boolean (applet->settings, SHOW_NOTIFICATION_KEY))
+            {
+                NotifyNotification *n;
+                n = notify_notification_new (name, _("Timer finished!"), APPLET_ICON);
+                notify_notification_set_timeout (n, 30000);
+                notify_notification_show (n, NULL);
+                g_object_unref (G_OBJECT (n));
+            }
+
+            if (g_settings_get_boolean (applet->settings, SHOW_DIALOG_KEY))
+            {
+                GtkWidget *dialog = gtk_message_dialog_new_with_markup (NULL,
+                                                                        GTK_DIALOG_MODAL,
+                                                                        GTK_MESSAGE_INFO,
+                                                                        GTK_BUTTONS_OK,
+                                                                        "<b>%s</b>\n\n%s", name, _("Timer finished!"));
+                gtk_dialog_run (GTK_DIALOG (dialog));
+                gtk_widget_destroy (dialog);
+            }
+
+            /* stop further calls */
+            retval = FALSE;
+        }
+        else
+        {
+            hours = remaining / 60 / 60;
+            minutes = remaining / 60 % 60;
+            seconds = remaining % 60;
+
+            if (hours > 0)
+                label = g_strdup_printf ("%02d:%02d:%02d", hours, minutes, seconds);
+            else
+                label = g_strdup_printf ("%02d:%02d", minutes, seconds);
+
+            hours = duration / 60 / 60;
+            minutes = duration / 60 % 60;
+            seconds = duration % 60;
+
+            if (hours > 0)
+                tooltip = g_strdup_printf ("%s (%02d:%02d:%02d)", name, hours, minutes, seconds);
+            else
+                tooltip = g_strdup_printf ("%s (%02d:%02d)", name, minutes, seconds);
+
+            gtk_label_set_text (applet->label, label);
+            gtk_widget_set_tooltip_text (GTK_WIDGET (applet->label), tooltip);
+            gtk_widget_set_visible (GTK_WIDGET (applet->pause_image), applet->pause);
+            atk_object_set_name (atk_obj, label);
+        }
+
+        g_free (label);
+        g_free (tooltip);
+    }
+
+    /* update actions sensitiveness */
+    gtk_action_set_sensitive (gtk_action_group_get_action (applet->action_group, "Start"), !applet->active || applet->pause);
+    gtk_action_set_sensitive (gtk_action_group_get_action (applet->action_group, "Pause"), applet->active && !applet->pause);
+    gtk_action_set_sensitive (gtk_action_group_get_action (applet->action_group, "Stop"), applet->active);
+    gtk_action_set_sensitive (gtk_action_group_get_action (applet->action_group, "Reset"), !applet->active && !applet->pause && applet->elapsed);
+    gtk_action_set_sensitive (gtk_action_group_get_action (applet->action_group, "Preferences"), !applet->active && !applet->pause);
+
+    g_free (name);
+
+    return retval;
+}
+
+/* start action */
+static void
+timer_start_callback (GtkAction *action, TimerApplet *applet)
+{
+    applet->active = TRUE;
+    if (applet->pause)
+        applet->pause = FALSE;
+    else
+        applet->elapsed = 0;
+    applet->timeout_id = g_timeout_add (STEP, (GSourceFunc) timer_callback, applet);
+}
+
+/* pause action */
+static void
+timer_pause_callback (GtkAction *action, TimerApplet *applet)
+{
+    applet->pause = TRUE;
+    if (applet->timeout_id != 0)
+    {
+        g_source_remove(applet->timeout_id);
+        applet->timeout_id = 0;
+    }
+    timer_callback (applet);
+}
+
+/* stop action */
+static void
+timer_stop_callback (GtkAction *action, TimerApplet *applet)
+{
+    applet->active = FALSE;
+    if (applet->timeout_id != 0)
+    {
+        g_source_remove(applet->timeout_id);
+        applet->timeout_id = 0;
+    }
+    timer_callback (applet);
+}
+
+/* reset action */
+static void
+timer_reset_callback (GtkAction *action, TimerApplet *applet)
+{
+    applet->active = FALSE;
+    applet->pause = FALSE;
+    applet->elapsed = 0;
+    timer_callback (applet);
+}
+
+/* Show the about dialog */
+static void
+timer_about_callback (GtkAction *action, TimerApplet *applet)
+{
+    const char* authors[] = { "Stefano Karapetsas <stefano@karapetsas.com>", NULL };
+
+    gtk_show_about_dialog(NULL,
+                          "title", _("About Timer Applet"),
+                          "version", VERSION,
+                          "copyright", _("Copyright \xc2\xa9 2014 Stefano Karapetsas\n"
+                                         "Copyright \xc2\xa9 2015-2021 MATE developers"),
+                          "authors", authors,
+                          "comments", _("Start a timer and receive a notification when it is finished"),
+                          "translator-credits", _("translator-credits"),
+                          "logo-icon-name", APPLET_ICON,
+                          NULL);
+}
+
+/* calculate duration and save in GSettings */
+static void
+timer_spin_button_value_changed (GtkSpinButton *spinbutton, TimerApplet *applet)
+{
+    gint duration;
+
+    duration =  gtk_spin_button_get_value_as_int (applet->seconds);
+    duration += gtk_spin_button_get_value_as_int (applet->minutes) * 60;
+    duration += gtk_spin_button_get_value_as_int (applet->hours)   * 3600;
+
+    g_settings_set_int (applet->settings, DURATION_KEY, duration);
+}
+
+/* Show the preferences dialog */
+static void
+timer_preferences_callback (GtkAction *action, TimerApplet *applet)
+{
+    GtkBuilder *builder;
+    GtkDialog *dialog;
+    gint duration, hours, minutes, seconds;
+
+    builder = gtk_builder_new_from_resource ("/org/mate/mate-applets/timerapplet/timerapplet-preferences.ui");
+
+    dialog = GET_DIALOG ("preferences_dialog");
+    applet->hours = GET_SPIN_BUTTON ("hours_spinbutton");
+    applet->minutes = GET_SPIN_BUTTON ("minutes_spinbutton");
+    applet->seconds = GET_SPIN_BUTTON ("seconds_spinbutton");
+
+    duration = g_settings_get_int (applet->settings, DURATION_KEY);
+    hours = duration / 60 / 60;
+    minutes = duration / 60 % 60;
+    seconds = duration % 60;
+
+    gtk_spin_button_set_value (applet->hours,   hours);
+    gtk_spin_button_set_value (applet->minutes, minutes);
+    gtk_spin_button_set_value (applet->seconds, seconds);
+
+    g_settings_bind (applet->settings, NAME_KEY, GET_WIDGET ("name_entry"), "text", G_SETTINGS_BIND_DEFAULT);
+    g_settings_bind (applet->settings, SHOW_NOTIFICATION_KEY, GET_WIDGET ("show_notification_popup_check"), "active", G_SETTINGS_BIND_DEFAULT);
+    g_settings_bind (applet->settings, SHOW_DIALOG_KEY, GET_WIDGET ("show_dialog_check"), "active", G_SETTINGS_BIND_DEFAULT);
+
+    /* signals */
+    gtk_builder_add_callback_symbols (builder,
+                                      "on_hours_spinbutton_value_changed", G_CALLBACK (timer_spin_button_value_changed),
+                                      "on_minutes_spinbutton_value_changed", G_CALLBACK (timer_spin_button_value_changed),
+                                      "on_seconds_spinbutton_value_changed", G_CALLBACK (timer_spin_button_value_changed),
+                                      NULL);
+    gtk_builder_connect_signals (builder, applet);
+
+    g_signal_connect (dialog, "response",
+                      G_CALLBACK (gtk_widget_destroy),
+                      dialog);
+
+    g_object_unref (builder);
+
+    gtk_widget_show_all (GTK_WIDGET (dialog));
+}
+
+static gboolean
+timer_applet_click (TimerApplet *applet,  GdkEventButton *event)<--- Parameter 'event' can be declared as pointer to const
+{
+    if (  event->button == 1)
+    {
+        if (!applet->active && !applet->pause && applet->elapsed)
+            timer_reset_callback (NULL, applet);
+        else if (applet->active && !applet->pause)
+            timer_pause_callback (NULL, applet);
+        else if (!applet->active || applet->pause)
+            timer_start_callback (NULL, applet);
+    return TRUE;
+    }
+    else
+        return FALSE;
+}
+
+static void
+timer_settings_changed (GSettings *settings, gchar *key, TimerApplet *applet)
+{
+    timer_callback (applet);
+}
+
+static gboolean
+timer_applet_fill (MatePanelApplet* applet_widget)
+{
+    TimerApplet *applet;
+    AtkObject   *atk_obj;
+
+#ifndef ENABLE_IN_PROCESS
+    g_set_application_name (_("Timer Applet"));
+#endif
+    gtk_window_set_default_icon_name (APPLET_ICON);
+
+    if (!notify_is_initted ())
+        notify_init ("timer-applet");
+
+    mate_panel_applet_set_flags (applet_widget, MATE_PANEL_APPLET_EXPAND_MINOR);
+
+    applet = g_malloc0(sizeof(TimerApplet));
+    applet->applet = applet_widget;
+    applet->settings = mate_panel_applet_settings_new (applet_widget,TIMER_SCHEMA);
+    applet->timeout_id = 0;
+    applet->active = FALSE;
+    applet->pause = FALSE;
+
+    applet->box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
+    applet->image = GTK_IMAGE (gtk_image_new_from_icon_name (APPLET_ICON, GTK_ICON_SIZE_BUTTON));
+    applet->pause_image = GTK_IMAGE (gtk_image_new_from_icon_name ("media-playback-pause", GTK_ICON_SIZE_BUTTON));
+    applet->label = GTK_LABEL (gtk_label_new (""));
+
+    atk_obj = gtk_widget_get_accessible (GTK_WIDGET (applet->applet));
+    if (GTK_IS_ACCESSIBLE (atk_obj)) {
+        atk_object_set_name (atk_obj, _("Timer Applet"));
+        atk_object_set_description (atk_obj, _("Start a timer and receive a notification when it is finished"));
+    }
+    /* we add the Gtk label into the applet */
+    gtk_box_pack_start (applet->box,
+                        GTK_WIDGET (applet->image),
+                        TRUE, TRUE, 0);
+    gtk_box_pack_start (applet->box,
+                        GTK_WIDGET (applet->pause_image),
+                        TRUE, TRUE, 0);
+    gtk_box_pack_start (applet->box,
+                        GTK_WIDGET (applet->label),
+                        TRUE, TRUE, 3);
+
+    gtk_container_add (GTK_CONTAINER (applet_widget),
+                       GTK_WIDGET (applet->box));
+
+    gtk_widget_show_all (GTK_WIDGET (applet->applet));
+    gtk_widget_hide (GTK_WIDGET (applet->pause_image));
+
+    g_signal_connect (applet->applet, "destroy",
+                      G_CALLBACK (timer_applet_destroy),
+                      applet);
+
+    g_signal_connect_swapped (applet->applet, "button-press-event",
+                              G_CALLBACK (timer_applet_click),<--- You might need to cast the function pointer here
+                              applet);
+
+    /* set up context menu */
+    applet->action_group = gtk_action_group_new ("Timer Applet Actions");
+    gtk_action_group_set_translation_domain (applet->action_group, GETTEXT_PACKAGE);
+    gtk_action_group_add_actions (applet->action_group, applet_menu_actions,
+                                  G_N_ELEMENTS (applet_menu_actions), applet);
+    mate_panel_applet_setup_menu (applet->applet, ui, applet->action_group);
+
+    /* execute callback to set actions sensitiveness */
+    timer_callback (applet);
+
+    /* GSettings callback */
+    g_signal_connect (applet->settings, "changed",
+                      G_CALLBACK (timer_settings_changed),
+                      applet);
+
+    return TRUE;
+}
+
+/* this function, called by mate-panel, will create the applet */
+static gboolean
+timer_factory (MatePanelApplet* applet, const char* iid, gpointer data)
+{
+    gboolean retval = FALSE;
+
+    if (!g_strcmp0 (iid, "TimerApplet"))
+        retval = timer_applet_fill (applet);
+
+    return retval;
+}
+
+/* needed by mate-panel applet library */
+PANEL_APPLET_FACTORY ("TimerAppletFactory",
+                      PANEL_TYPE_APPLET,
+                      "Timer applet",
+                      timer_factory,
+                      NULL)
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/143.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/143.html new file mode 100644 index 00000000..bbb2c9f6 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/143.html @@ -0,0 +1,991 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
/*
+ * trash-empty.c: a routine to empty the trash
+ *
+ * Copyright © 2008 Ryan Lortie
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "trash-empty.h"
+#include "config.h"<--- Include file: "config.h" not found.
+
+/* only one concurrent trash empty operation can occur */
+static GtkDialog          *trash_empty_confirm_dialog;
+static GtkDialog          *trash_empty_dialog;
+static GtkProgressBar     *trash_empty_progress_bar;
+static GtkLabel           *trash_empty_location;
+static GtkLabel           *trash_empty_file;
+
+/* the rules:
+ * 1) nothing here may be modified while trash_empty_update_pending.
+ * 2) an idle may only be scheduled if trash_empty_update_pending.
+ * 3) only the worker may set trash_empty_update_pending = TRUE.
+ * 4) only the UI updater may set trash_empty_update_pending = FALSE.
+ *
+ * i -think- this is threadsafe...  ((famous last words...))
+ */
+static GFile *     volatile trash_empty_current_file;
+static gsize       volatile trash_empty_deleted_files;
+static gsize       volatile trash_empty_total_files;
+static gboolean    volatile trash_empty_update_pending;
+
+static gboolean
+trash_empty_update_dialog (gpointer user_data)
+{
+  gsize deleted, total;
+  GFile *file;
+
+  g_assert (trash_empty_update_pending);
+
+  deleted = trash_empty_deleted_files;
+  total = trash_empty_total_files;
+  file = trash_empty_current_file;
+
+  /* maybe the done() got processed first. */
+  if (trash_empty_dialog)
+    {
+      char *index_str, *total_str;
+      char *text_tmp, *text;
+      char *tmp;
+
+      /* The i18n tools can't handle a direct embedding of the
+       * size format using a macro. This is a work-around. */
+      index_str = g_strdup_printf ("%"G_GSIZE_FORMAT, deleted + 1);
+      total_str = g_strdup_printf ("%"G_GSIZE_FORMAT, total);
+      /* Translators: the %s in this string should be read as %d. */
+      text = g_strdup_printf (_("Removing item %s of %s"),
+                              index_str, total_str);
+      gtk_progress_bar_set_text (trash_empty_progress_bar, text);
+      g_free (total_str);
+      g_free (index_str);
+      g_free (text);
+
+      if (deleted > total)
+        gtk_progress_bar_set_fraction (trash_empty_progress_bar, 1.0);
+      else
+        gtk_progress_bar_set_fraction (trash_empty_progress_bar,
+                                       (gdouble) deleted / (gdouble) total);
+
+      /* no g_file_get_basename? */
+      {
+        GFile *parent;
+
+        parent = g_file_get_parent (file);
+        text = g_file_get_uri (parent);
+        g_object_unref (parent);
+      }
+      gtk_label_set_text (trash_empty_location, text);
+      g_free (text);
+
+      tmp = g_file_get_basename (file);
+      /* Translators: %s is a file name */
+      text_tmp = g_strdup_printf (_("Removing: %s"), tmp);
+      text = g_markup_printf_escaped ("<i>%s</i>", text_tmp);
+      gtk_label_set_markup (trash_empty_file, text);
+      g_free (text);
+      g_free (text_tmp);
+      g_free (tmp);
+
+      /* unhide the labels */
+      gtk_widget_show_all (GTK_WIDGET (trash_empty_dialog));
+    }
+
+  trash_empty_current_file = NULL;
+  g_object_unref (file);
+
+  trash_empty_update_pending = FALSE;
+
+  return FALSE;
+}
+
+static void
+trash_empty_done (GObject      *source_object,
+                  GAsyncResult *res,
+                  gpointer      user_data)
+{
+  gtk_widget_destroy (GTK_WIDGET (trash_empty_dialog));
+
+  g_assert (trash_empty_dialog == NULL);
+}
+
+/* =============== worker thread code begins here =============== */
+static void
+trash_empty_maybe_schedule_update (GFile           *file,
+                                   gsize            deleted)
+{
+  if (!trash_empty_update_pending)
+    {
+      g_assert (trash_empty_current_file == NULL);
+
+      trash_empty_current_file = g_object_ref (file);
+      trash_empty_deleted_files = deleted;
+
+      trash_empty_update_pending = TRUE;
+      g_main_context_invoke (NULL, trash_empty_update_dialog, NULL);
+    }
+}
+
+static void
+trash_empty_delete_contents (GCancellable    *cancellable,
+                             GFile           *file,
+                             gboolean         actually_delete,
+                             gsize           *deleted)
+{
+  GFileEnumerator *enumerator;
+  GFileInfo *info;
+  GFile *child;
+
+  if (g_cancellable_is_cancelled (cancellable))
+    return;
+
+  enumerator = g_file_enumerate_children (file,
+                                          G_FILE_ATTRIBUTE_STANDARD_NAME ","
+                                          G_FILE_ATTRIBUTE_STANDARD_TYPE,
+                                          G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                          cancellable, NULL);
+  if (enumerator)
+    {
+      while ((info = g_file_enumerator_next_file (enumerator,
+                                                  cancellable, NULL)) != NULL)
+        {
+          child = g_file_get_child (file, g_file_info_get_name (info));
+
+          if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
+            trash_empty_delete_contents (cancellable, child,
+                                         actually_delete, deleted);
+
+          if (actually_delete)
+            {
+              trash_empty_maybe_schedule_update (child, *deleted);
+              g_file_delete (child, cancellable, NULL);
+            }
+
+          (*deleted)++;
+
+          g_object_unref (child);
+          g_object_unref (info);
+
+          if (g_cancellable_is_cancelled (cancellable))
+            break;
+        }
+
+      g_object_unref (enumerator);
+    }
+}
+
+static void
+trash_empty_job (GTask        *task,
+                 gpointer      source_object,
+                 gpointer      user_data,
+                 GCancellable *cancellable)
+{
+  gsize deleted;
+  GFile *trash;
+
+  trash = g_file_new_for_uri ("trash:///");
+
+  /* first do a dry run to count the number of files */
+  deleted = 0;
+  trash_empty_delete_contents (cancellable, trash, FALSE, &deleted);
+  trash_empty_total_files = deleted;
+
+  /* now do the real thing */
+  deleted = 0;
+  trash_empty_delete_contents (cancellable, trash, TRUE, &deleted);
+
+  /* done */
+  g_object_unref (trash);
+  g_task_return_boolean (task, TRUE);
+}
+/* ================ worker thread code ends here ================ */
+
+static void
+trash_empty_start (GtkWidget *parent)
+{
+  struct { const char *name; gpointer *pointer; } widgets[] =
+    {
+      { "empty_trash",       (gpointer *) &trash_empty_dialog        },
+      { "progressbar",       (gpointer *) &trash_empty_progress_bar  },
+      { "location_label",    (gpointer *) &trash_empty_location      },
+      { "file_label",        (gpointer *) &trash_empty_file          }
+    };
+  GCancellable *cancellable;
+  GtkBuilder *builder;
+  GTask      *task;
+  gint i;
+
+  builder = gtk_builder_new_from_resource (GRESOURCE "trashapplet-empty-progress.ui");
+
+  for (i = 0; i < G_N_ELEMENTS (widgets); i++)
+    {
+      GObject *object;
+
+      object = gtk_builder_get_object (builder, widgets[i].name);
+
+      if (object == NULL)
+        {
+          g_critical ("failed to parse trash-empty dialog markup");
+
+          if (trash_empty_dialog)
+            gtk_widget_destroy (GTK_WIDGET (trash_empty_dialog));
+
+          g_object_unref (builder);
+          return;
+        }
+
+      *widgets[i].pointer = object;
+      g_object_add_weak_pointer (object, widgets[i].pointer);
+    }
+  g_object_unref (builder);
+
+  cancellable = g_cancellable_new ();
+  g_signal_connect_object (trash_empty_dialog, "response",
+                           G_CALLBACK (g_cancellable_cancel),
+                           cancellable, G_CONNECT_SWAPPED);
+
+  task = g_task_new (parent, cancellable, trash_empty_done, NULL);
+  g_task_run_in_thread (task, trash_empty_job);
+  g_object_unref (task);
+  g_object_unref (cancellable);
+
+  gtk_window_set_screen (GTK_WINDOW (trash_empty_dialog),
+                         gtk_widget_get_screen (parent));
+  gtk_widget_show (GTK_WIDGET (trash_empty_dialog));
+}
+
+static gboolean
+trash_empty_require_confirmation (void)
+{
+  gboolean confirm_trash;
+  GSettings *settings;
+  settings = g_settings_new ("org.mate.caja.preferences");
+  confirm_trash = g_settings_get_boolean (settings, "confirm-trash");
+  g_object_unref (settings);
+  return confirm_trash;
+}
+
+static void
+trash_empty_confirmation_response (GtkDialog *dialog,
+                                   gint       response_id,
+                                   gpointer   user_data)
+{
+  if (response_id == GTK_RESPONSE_YES)
+    trash_empty_start (GTK_WIDGET (dialog));
+
+  gtk_widget_destroy (GTK_WIDGET (dialog));
+  g_assert (trash_empty_confirm_dialog == NULL);
+}
+
+/*
+ * The code in trash_empty_show_confirmation_dialog() was taken from
+ * libcaja-private/caja-file-operations.c (confirm_empty_trash)
+ * by Michiel Sikkes <michiel@eyesopened.nl> and adapted for the applet.
+ */
+static void
+trash_empty_show_confirmation_dialog (GtkWidget *parent)
+{
+  GtkWidget *dialog;
+  GtkWidget *button;
+  GdkScreen *screen;
+
+  if (!trash_empty_require_confirmation ())
+    {
+      trash_empty_start (parent);
+      return;
+    }
+
+  screen = gtk_widget_get_screen (parent);
+
+  dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+                                   GTK_MESSAGE_WARNING,
+                                   GTK_BUTTONS_NONE,
+                                   _("Empty all of the items from "
+                                     "the trash?"));
+  trash_empty_confirm_dialog = GTK_DIALOG (dialog);
+  g_object_add_weak_pointer (G_OBJECT (dialog),
+                             (gpointer *) &trash_empty_confirm_dialog);
+
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                                            _("If you choose to empty "
+                                              "the trash, all items in "
+                                              "it will be permanently "
+                                              "lost. Please note that "
+                                              "you can also delete them "
+                                              "separately."));
+
+  gtk_window_set_screen (GTK_WINDOW (dialog), screen);
+  atk_object_set_role (gtk_widget_get_accessible (dialog), ATK_ROLE_ALERT);
+
+  gtk_dialog_add_button (GTK_DIALOG (dialog), "gtk-cancel",
+                         GTK_RESPONSE_CANCEL);
+
+  button = gtk_button_new_with_mnemonic (_("_Empty Trash"));
+  gtk_widget_show (button);
+  gtk_widget_set_can_default (button, TRUE);
+
+  gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button,
+                                GTK_RESPONSE_YES);
+
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog),
+                                   GTK_RESPONSE_YES);
+
+  gtk_widget_show (dialog);
+
+  g_signal_connect (dialog, "response",
+                    G_CALLBACK (trash_empty_confirmation_response), NULL);
+}
+
+void
+trash_empty (GtkWidget *parent)
+{
+  if (trash_empty_confirm_dialog)
+    gtk_window_present (GTK_WINDOW (trash_empty_confirm_dialog));
+  else if (trash_empty_dialog)
+    gtk_window_present (GTK_WINDOW (trash_empty_dialog));
+
+  /* theoretically possible that an update is pending, but very unlikely. */
+  else if (!trash_empty_update_pending)
+    trash_empty_show_confirmation_dialog (parent);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/144.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/144.html new file mode 100644 index 00000000..2944a07f --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/144.html @@ -0,0 +1,295 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
/*
+ * trash-empty.h: empty the trash
+ *
+ * Copyright © 2008 Ryan Lortie
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef _trash_empty_h_
+#define _trash_empty_h_
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+void trash_empty (GtkWidget *parent);
+
+#endif /* _trash_empty_h_ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/145.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/145.html new file mode 100644 index 00000000..4aca261c --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/145.html @@ -0,0 +1,821 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.trashapplet"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[1361]; const double alignment; void * const ptr;}  trashapplet_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0004, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 
+  0002, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 
+  0354, 0000, 0000, 0000, 0327, 0305, 0262, 0375, 0006, 0000, 0000, 0000, 0354, 0000, 0000, 0000, 
+  0024, 0000, 0166, 0000, 0000, 0001, 0000, 0000, 0170, 0001, 0000, 0000, 0324, 0265, 0002, 0000, 
+  0377, 0377, 0377, 0377, 0170, 0001, 0000, 0000, 0001, 0000, 0114, 0000, 0174, 0001, 0000, 0000, 
+  0200, 0001, 0000, 0000, 0201, 0321, 0040, 0031, 0000, 0000, 0000, 0000, 0200, 0001, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0210, 0001, 0000, 0000, 0214, 0001, 0000, 0000, 0240, 0234, 0144, 0100, 
+  0006, 0000, 0000, 0000, 0214, 0001, 0000, 0000, 0035, 0000, 0166, 0000, 0260, 0001, 0000, 0000, 
+  0057, 0005, 0000, 0000, 0275, 0342, 0315, 0116, 0003, 0000, 0000, 0000, 0057, 0005, 0000, 0000, 
+  0015, 0000, 0114, 0000, 0074, 0005, 0000, 0000, 0100, 0005, 0000, 0000, 0156, 0266, 0312, 0111, 
+  0005, 0000, 0000, 0000, 0100, 0005, 0000, 0000, 0006, 0000, 0114, 0000, 0110, 0005, 0000, 0000, 
+  0120, 0005, 0000, 0000, 0157, 0162, 0147, 0057, 0003, 0000, 0000, 0000, 0164, 0162, 0141, 0163, 
+  0150, 0141, 0160, 0160, 0154, 0145, 0164, 0055, 0155, 0145, 0156, 0165, 0056, 0170, 0155, 0154, 
+  0347, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0263, 0311, 0115, 0315, 0053, 0315, 
+  0054, 0111, 0315, 0125, 0310, 0113, 0314, 0115, 0265, 0125, 0362, 0057, 0110, 0315, 0123, 0010, 
+  0051, 0112, 0054, 0316, 0120, 0360, 0004, 0212, 0052, 0051, 0044, 0046, 0227, 0144, 0346, 0347, 
+  0101, 0044, 0300, 0342, 0112, 0012, 0372, 0166, 0134, 0066, 0150, 0332, 0134, 0163, 0013, 0112, 
+  0052, 0261, 0352, 0003, 0313, 0040, 0151, 0054, 0116, 0055, 0110, 0054, 0112, 0054, 0311, 0057, 
+  0302, 0142, 0012, 0330, 0162, 0217, 0324, 0234, 0002, 0064, 0063, 0100, 0102, 0270, 0355, 0166, 
+  0114, 0312, 0057, 0055, 0101, 0323, 0001, 0026, 0103, 0150, 0341, 0002, 0000, 0351, 0166, 0115, 
+  0363, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0164, 0162, 0141, 0163, 
+  0150, 0141, 0160, 0160, 0154, 0145, 0164, 0055, 0145, 0155, 0160, 0164, 0171, 0055, 0160, 0162, 
+  0157, 0147, 0162, 0145, 0163, 0163, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0156, 0031, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0325, 0131, 0135, 0157, 0233, 0060, 
+  0024, 0175, 0357, 0257, 0360, 0374, 0072, 0221, 0317, 0251, 0232, 0046, 0102, 0245, 0156, 0153, 
+  0065, 0151, 0017, 0173, 0350, 0236, 0043, 0143, 0156, 0300, 0253, 0143, 0063, 0333, 0064, 0315, 
+  0176, 0375, 0014, 0044, 0155, 0150, 0014, 0204, 0020, 0125, 0311, 0133, 0213, 0175, 0077, 0316, 
+  0365, 0075, 0347, 0032, 0342, 0337, 0074, 0057, 0071, 0172, 0002, 0245, 0231, 0024, 0063, 0074, 
+  0036, 0214, 0060, 0002, 0101, 0145, 0304, 0104, 0074, 0303, 0277, 0037, 0356, 0274, 0317, 0370, 
+  0046, 0270, 0362, 0077, 0170, 0036, 0272, 0007, 0001, 0212, 0030, 0210, 0320, 0212, 0231, 0004, 
+  0305, 0234, 0104, 0200, 0246, 0203, 0351, 0347, 0301, 0004, 0171, 0236, 0335, 0304, 0204, 0001, 
+  0265, 0040, 0024, 0202, 0053, 0204, 0174, 0005, 0177, 0063, 0246, 0100, 0043, 0316, 0302, 0031, 
+  0216, 0315, 0343, 0107, 0374, 0032, 0150, 0072, 0230, 0114, 0360, 0260, 0330, 0047, 0303, 0077, 
+  0100, 0015, 0242, 0234, 0150, 0075, 0303, 0367, 0346, 0361, 0307, 0222, 0304, 0200, 0021, 0213, 
+  0146, 0230, 0022, 0101, 0201, 0317, 0303, 0314, 0030, 0051, 0346, 0154, 0031, 0343, 0334, 0304, 
+  0032, 0245, 0112, 0246, 0240, 0314, 0032, 0011, 0262, 0204, 0031, 0176, 0142, 0232, 0205, 0034, 
+  0160, 0360, 0240, 0062, 0360, 0207, 0333, 0125, 0367, 0146, 0353, 0324, 0133, 0110, 0232, 0151, 
+  0034, 0334, 0021, 0256, 0133, 0367, 0063, 0052, 0205, 0227, 0377, 0211, 0003, 0273, 0102, 0101, 
+  0153, 0117, 0033, 0231, 0126, 0315, 0374, 0141, 0211, 0303, 0015, 0351, 0033, 0043, 0134, 0306, 
+  0045, 0046, 0130, 0246, 0146, 0075, 0067, 0212, 0350, 0004, 0237, 0046, 0301, 0120, 0252, 0010, 
+  0224, 0267, 0142, 0221, 0261, 0056, 0257, 0333, 0266, 0033, 0146, 0154, 0251, 0220, 0315, 0100, 
+  0150, 0116, 0014, 0261, 0205, 0233, 0341, 0065, 0330, 0150, 0337, 0363, 0324, 0354, 0311, 0043, 
+  0223, 0000, 0172, 0310, 0063, 0154, 0363, 0025, 0301, 0202, 0144, 0334, 0154, 0143, 0177, 0032, 
+  0215, 0132, 0243, 0257, 0123, 0360, 0022, 0333, 0052, 0070, 0210, 0212, 0252, 0354, 0031, 0320, 
+  0204, 0361, 0010, 0025, 0315, 0044, 0010, 0367, 0212, 0177, 0355, 0021, 0207, 0362, 0171, 0123, 
+  0057, 0127, 0205, 0157, 0167, 0126, 0273, 0127, 0324, 0145, 0043, 0025, 0003, 0141, 0210, 0261, 
+  0375, 0212, 0003, 0333, 0270, 0206, 0121, 0302, 0017, 0061, 0324, 0051, 0241, 0266, 0210, 0070, 
+  0230, 0070, 0167, 0273, 0341, 0021, 0232, 0007, 0232, 0023, 0005, 0144, 0007, 0207, 0023, 0151, 
+  0101, 0206, 0052, 0336, 0143, 0061, 0273, 0354, 0070, 0131, 0313, 0314, 0330, 0026, 0137, 0347, 
+  0204, 0002, 0021, 0325, 0032, 0026, 0251, 0127, 0237, 0325, 0047, 0354, 0040, 0064, 0176, 0153, 
+  0353, 0112, 0046, 0004, 0356, 0354, 0325, 0371, 0327, 0302, 0125, 0135, 0162, 0235, 0125, 0342, 
+  0300, 0122, 0036, 0143, 0272, 0041, 0111, 0167, 0343, 0204, 0350, 0343, 0215, 0025, 0120, 0140, 
+  0117, 0320, 0303, 0003, 0053, 0204, 0070, 0330, 0023, 0341, 0056, 0076, 0062, 0015, 0136, 0046, 
+  0254, 0074, 0161, 0046, 0216, 0250, 0074, 0341, 0053, 0262, 0266, 0172, 0233, 0310, 0225, 0267, 
+  0111, 0247, 0331, 0305, 0256, 0016, 0127, 0035, 0023, 0372, 0150, 0131, 0331, 0036, 0022, 0236, 
+  0123, 0042, 0242, 0356, 0251, 0056, 0030, 0347, 0335, 0255, 0122, 0251, 0131, 0051, 0061, 0243, 
+  0046, 0120, 0316, 0354, 0375, 0341, 0036, 0003, 0135, 0360, 0335, 0320, 0353, 0140, 0167, 0322, 
+  0212, 0022, 0163, 0047, 0223, 0126, 0300, 0016, 0260, 0173, 0100, 0367, 0245, 0307, 0075, 0021, 
+  0012, 0315, 0311, 0047, 0307, 0270, 0105, 0054, 0017, 0222, 0206, 0123, 0051, 0154, 0313, 0274, 
+  0356, 0075, 0220, 0032, 0207, 0322, 0170, 0322, 0127, 0317, 0177, 0226, 0232, 0234, 0227, 0266, 
+  0220, 0347, 0061, 0176, 0037, 0351, 0155, 0254, 0261, 0133, 0076, 0071, 0213, 0155, 0255, 0264, 
+  0041, 0312, 0164, 0061, 0254, 0237, 0072, 0355, 0067, 0244, 0212, 0137, 0142, 0214, 0142, 0126, 
+  0070, 0101, 0357, 0057, 0356, 0056, 0157, 0342, 0256, 0200, 0305, 0211, 0261, 0327, 0144, 0302, 
+  0263, 0242, 0117, 0170, 0124, 0136, 0222, 0133, 0055, 0265, 0155, 0005, 0170, 0061, 0034, 0017, 
+  0246, 0056, 0073, 0177, 0130, 0237, 0317, 0351, 0164, 0263, 0363, 0061, 0235, 0205, 0160, 0166, 
+  0270, 0316, 0154, 0165, 0045, 0161, 0350, 0312, 0331, 0364, 0376, 0001, 0174, 0257, 0007, 0175, 
+  0030, 0357, 0247, 0330, 0145, 0327, 0003, 0177, 0337, 0032, 0164, 0243, 0362, 0235, 0222, 0313, 
+  0057, 0255, 0356, 0232, 0031, 0334, 0217, 0305, 0315, 0214, 0154, 0142, 0145, 0063, 0063, 0173, 
+  0261, 0363, 0170, 0206, 0036, 0315, 0322, 0006, 0246, 0326, 0262, 0265, 0117, 0363, 0112, 0132, 
+  0014, 0321, 0171, 0331, 0033, 0027, 0320, 0304, 0300, 0071, 0113, 0065, 0373, 0147, 0303, 0057, 
+  0131, 0024, 0361, 0316, 0016, 0236, 0067, 0223, 0260, 0365, 0020, 0116, 0335, 0156, 0307, 0124, 
+  0353, 0024, 0335, 0066, 0076, 0165, 0267, 0135, 0360, 0174, 0034, 0277, 0357, 0174, 0374, 0245, 
+  0144, 0254, 0100, 0353, 0133, 0242, 0112, 0276, 0245, 0233, 0007, 0241, 0175, 0160, 0026, 0323, 
+  0362, 0162, 0337, 0021, 0047, 0357, 0173, 0224, 0073, 0242, 0151, 0063, 0207, 0132, 0301, 0074, 
+  0213, 0033, 0317, 0001, 0032, 0167, 0301, 0044, 0236, 0136, 0354, 0327, 0201, 0056, 0157, 0324, 
+  0255, 0242, 0325, 0376, 0161, 0240, 0212, 0261, 0262, 0350, 0227, 0037, 0131, 0363, 0027, 0357, 
+  0030, 0314, 0313, 0205, 0253, 0372, 0030, 0131, 0251, 0112, 0245, 0320, 0066, 0033, 0357, 0372, 
+  0315, 0307, 0057, 0173, 0135, 0333, 0335, 0272, 0015, 0261, 0357, 0366, 0065, 0011, 0177, 0270, 
+  0363, 0253, 0310, 0177, 0265, 0122, 0104, 0015, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 
+  0141, 0164, 0145, 0055, 0141, 0160, 0160, 0154, 0145, 0164, 0163, 0057, 0006, 0000, 0000, 0000, 
+  0164, 0162, 0141, 0163, 0150, 0057, 0000, 0000, 0004, 0000, 0000, 0000, 0001, 0000, 0000, 0000
+} };
+
+static GStaticResource static_resource = { trashapplet_resource_data.data, sizeof (trashapplet_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *trashapplet_get_resource (void);
+GResource *trashapplet_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * 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.1 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/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CONSTRUCTOR_H__
+#define __G_CONSTRUCTOR_H__
+
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+/*
+ * Only try to include gslist.h if not already included via glib.h,
+ * so that items using gconstructor.h outside of GLib (such as
+ * GResources) continue to build properly.
+ */
+#ifndef __G_LIB_H__
+#include "gslist.h"
+#endif
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+#endif /* __G_CONSTRUCTOR_H__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(trashappletresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(trashappletresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(trashappletresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(trashappletresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void trashappletresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void trashappletresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/146.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/146.html new file mode 100644 index 00000000..b1e12e26 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/146.html @@ -0,0 +1,1561 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
/* -*- mode: c; c-basic-offset: 8 -*-
+ * trashapplet.c
+ *
+ * Copyright (c) 2004  Michiel Sikkes <michiel@eyesopened.nl>,
+ *               2004  Emmanuele Bassi <ebassi@gmail.com>
+ *               2008  Ryan Lortie <desrt@desrt.ca>
+ *                     Matthias Clasen <mclasen@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"<--- Include file: "config.h" not found.
+#endif
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkkeysyms.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "trash-empty.h"
+
+#define TRASH_TYPE_APPLET (trash_applet_get_type ())
+
+G_DECLARE_FINAL_TYPE (TrashApplet, trash_applet,
+                      TRASH, APPLET, MatePanelApplet)
+
+struct _TrashApplet
+{
+  MatePanelApplet applet;
+
+  GFileMonitor *trash_monitor;
+  GFile *trash;
+
+  GtkImage *image;
+  GIcon *icon;
+  gint items;
+};
+
+G_DEFINE_TYPE (TrashApplet, trash_applet, PANEL_TYPE_APPLET);
+
+static void trash_applet_do_empty    (GtkAction   *action,
+                                      TrashApplet *applet);
+static void trash_applet_show_about  (GtkAction   *action,
+                                      TrashApplet *applet);
+static void trash_applet_open_folder (GtkAction   *action,
+                                      TrashApplet *applet);
+static void trash_applet_show_help   (GtkAction   *action,
+                                      TrashApplet *applet);
+
+static const GtkActionEntry trash_applet_menu_actions [] = {
+	{ "EmptyTrash", "edit-clear", N_("_Empty Trash"),
+	  NULL, NULL,
+	  G_CALLBACK (trash_applet_do_empty) },
+	{ "OpenTrash", "document-open", N_("_Open Trash"),
+	  NULL, NULL,
+	  G_CALLBACK (trash_applet_open_folder) },
+	{ "HelpTrash", "help-browser", N_("_Help"),
+	  NULL, NULL,
+	  G_CALLBACK (trash_applet_show_help) },
+	{ "AboutTrash", "help-about", N_("_About"),
+	  NULL, NULL,
+	  G_CALLBACK (trash_applet_show_about) }
+};
+
+static void
+trash_applet_monitor_changed (TrashApplet *applet)
+{
+  GError *error = NULL;
+  GFileInfo *info;
+  GIcon *icon;
+  AtkObject *atk_obj;
+  gint items;
+
+  info = g_file_query_info (applet->trash,
+                            G_FILE_ATTRIBUTE_STANDARD_ICON","
+                            G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT,
+                            0, NULL, &error);
+
+  atk_obj = gtk_widget_get_accessible (GTK_WIDGET (applet));
+
+  if (!info)
+    {
+      g_critical ("could not query trash:/: '%s'", error->message);
+      g_error_free (error);
+
+      return;
+    }
+
+  icon = g_file_info_get_icon (info);
+  items = g_file_info_get_attribute_uint32 (info,
+                                            G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT);
+
+  if (!g_icon_equal (icon, applet->icon))
+    {
+      /* note: the size is meaningless here,
+       * since we do set_pixel_size() later
+       */
+      gtk_image_set_from_gicon (GTK_IMAGE (applet->image),
+                                icon, GTK_ICON_SIZE_MENU);
+
+      if (applet->icon)
+        g_object_unref (applet->icon);
+
+      applet->icon = g_object_ref (icon);
+    }
+
+  if (items != applet->items)
+    {
+      char *text;
+
+      if (items)
+        {
+          text = g_strdup_printf (ngettext ("%d Item in Trash",
+                                            "%d Items in Trash",
+                                            items), items);
+        }
+      else
+        text = g_strdup (_("No Items in Trash"));
+
+      gtk_widget_set_tooltip_text (GTK_WIDGET (applet), text);
+      atk_object_set_description (atk_obj, text);
+      g_free (text);
+
+      applet->items = items;
+    }
+
+  g_object_unref (info);
+}
+
+static void
+trash_applet_set_icon_size (TrashApplet *applet,
+                            gint         size)
+{
+  /* copied from button-widget.c in the panel */
+  if (size < 22)
+    size = 16;
+  else if (size < 24)
+    size = 22;
+  else if (size < 32)
+    size = 24;
+  else if (size < 48)
+    size = 32;
+  else
+    size = 48;
+
+  /* GtkImage already contains a check to do nothing if it's the same */
+  gtk_image_set_pixel_size (applet->image, size);
+}
+
+static void
+trash_applet_size_allocate (GtkWidget    *widget,
+                            GdkRectangle *allocation)
+{
+  TrashApplet *applet = TRASH_APPLET (widget);
+
+  GTK_WIDGET_CLASS (trash_applet_parent_class)
+    ->size_allocate (widget, allocation);
+
+  switch (mate_panel_applet_get_orient (MATE_PANEL_APPLET (applet)))
+  {
+    case MATE_PANEL_APPLET_ORIENT_LEFT:
+    case MATE_PANEL_APPLET_ORIENT_RIGHT:
+      trash_applet_set_icon_size (applet, allocation->width);
+      break;
+
+    case MATE_PANEL_APPLET_ORIENT_UP:
+    case MATE_PANEL_APPLET_ORIENT_DOWN:
+      trash_applet_set_icon_size (applet, allocation->height);
+      break;
+  }
+
+}
+
+static void
+trash_applet_dispose (GObject *object)
+{
+  TrashApplet *applet = TRASH_APPLET (object);
+
+  if (applet->trash_monitor)
+    g_object_unref (applet->trash_monitor);
+  applet->trash_monitor = NULL;
+
+  if (applet->trash)
+    g_object_unref (applet->trash);
+  applet->trash = NULL;
+
+  if (applet->image)
+    g_object_unref (applet->image);
+  applet->image = NULL;
+
+  if (applet->icon)
+    g_object_unref (applet->icon);
+  applet->icon = NULL;
+
+  G_OBJECT_CLASS (trash_applet_parent_class)->dispose (object);
+}
+
+static void
+trash_applet_init (TrashApplet *applet)
+{
+  const GtkTargetEntry drop_types[] = { { "text/uri-list", 0, 0 } };
+
+  /* needed to clamp ourselves to the panel size */
+  mate_panel_applet_set_flags (MATE_PANEL_APPLET (applet), MATE_PANEL_APPLET_EXPAND_MINOR);
+
+  /* setup the image */
+  applet->image = g_object_ref_sink (GTK_IMAGE (gtk_image_new ()));
+  gtk_container_add (GTK_CONTAINER (applet),
+                     GTK_WIDGET (applet->image));
+  gtk_widget_show (GTK_WIDGET (applet->image));
+
+  /* setup the trash backend */
+  applet->trash = g_file_new_for_uri ("trash:/");
+  applet->trash_monitor = g_file_monitor_file (applet->trash, 0, NULL, NULL);
+  g_signal_connect_swapped (applet->trash_monitor, "changed",
+                            G_CALLBACK (trash_applet_monitor_changed),
+                            applet);
+
+  /* setup drag and drop */
+  gtk_drag_dest_set (GTK_WIDGET (applet), GTK_DEST_DEFAULT_ALL,
+                     drop_types, G_N_ELEMENTS (drop_types),
+                     GDK_ACTION_MOVE);
+
+  /* synthesise the first update */
+  applet->items = -1;
+  trash_applet_monitor_changed (applet);
+}
+
+#define PANEL_SCHEMA "org.mate.panel"
+#define PANEL_ENABLE_ANIMATIONS "enable-animations"
+static gboolean
+trash_applet_button_release (GtkWidget      *widget,
+                             GdkEventButton *event)
+{
+  TrashApplet *applet = TRASH_APPLET (widget);
+  static GSettings *settings;
+
+  if (settings == NULL)
+    settings = g_settings_new (PANEL_SCHEMA);
+
+  if (event->button == 2)
+    return FALSE;
+
+  if ((event->button == 1) &&
+      (event->type != GDK_2BUTTON_PRESS) &&
+      (event->type != GDK_3BUTTON_PRESS))
+    {
+      trash_applet_open_folder (NULL, applet);
+      return TRUE;
+    }
+
+  return GTK_WIDGET_CLASS (trash_applet_parent_class)->button_press_event (widget, event);
+}
+static gboolean
+trash_applet_key_press (GtkWidget   *widget,
+                        GdkEventKey *event)
+{
+  TrashApplet *applet = TRASH_APPLET (widget);
+
+  switch (event->keyval)
+    {
+     case GDK_KEY_KP_Enter:
+     case GDK_KEY_ISO_Enter:
+     case GDK_KEY_3270_Enter:
+     case GDK_KEY_Return:
+     case GDK_KEY_space:
+     case GDK_KEY_KP_Space:
+      trash_applet_open_folder (NULL, applet);
+      return TRUE;
+
+     default:
+      break;
+    }
+
+  if (GTK_WIDGET_CLASS (trash_applet_parent_class)->key_press_event)
+    return GTK_WIDGET_CLASS (trash_applet_parent_class)
+      ->key_press_event (widget, event);
+  else
+    return FALSE;
+}
+
+static gboolean
+trash_applet_drag_motion (GtkWidget      *widget,
+                          GdkDragContext *context,
+                          gint            x,
+                          gint            y,
+                          guint           time)
+{
+  GList *target;
+
+  /* refuse drops of panel applets */
+  for (target = gdk_drag_context_list_targets (context); target; target = target->next)
+    {
+      const char *name = gdk_atom_name (target->data);
+
+      if (!strcmp (name, "application/x-panel-icon-internal"))
+        break;
+    }
+
+  if (target)
+    gdk_drag_status (context, 0, time);
+  else
+    gdk_drag_status (context, GDK_ACTION_MOVE, time);
+
+  return TRUE;
+}
+
+/* TODO - Must HIGgify this dialog */
+static void
+error_dialog (TrashApplet *applet, const gchar *error, ...)
+{
+  va_list args;
+  gchar *error_string;
+  GtkWidget *dialog;
+
+  g_return_if_fail (error != NULL);
+
+  va_start (args, error);
+  error_string = g_strdup_vprintf (error, args);
+  va_end (args);
+
+  dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+                                   GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+                                   "%s", error_string);
+
+  g_signal_connect (dialog, "response",
+                    G_CALLBACK (gtk_widget_destroy),
+                    NULL);
+
+  gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+  gtk_window_set_screen (GTK_WINDOW(dialog),
+                         gtk_widget_get_screen (GTK_WIDGET (applet)));
+  gtk_widget_show (dialog);
+
+  g_free (error_string);
+}
+
+static void
+trash_applet_do_empty (GtkAction   *action,
+                       TrashApplet *applet)
+{
+  trash_empty (GTK_WIDGET (applet));
+}
+
+static void
+trash_applet_open_folder (GtkAction   *action,
+                          TrashApplet *applet)
+{
+  GError *err = NULL;
+
+  gtk_show_uri_on_window (NULL,
+                          "trash:",
+                          gtk_get_current_event_time (),
+                          &err);
+
+  if (err)
+    {
+      error_dialog (applet, _("Error while spawning caja:\n%s"),
+      err->message);
+      g_error_free (err);
+    }
+}
+
+static void
+trash_applet_show_help (GtkAction   *action,
+                        TrashApplet *applet)
+{
+  GError *err = NULL;
+
+  /* FIXME - Actually, we need a user guide */
+  gtk_show_uri_on_window (NULL,
+                          "help:mate-trashapplet",
+                          gtk_get_current_event_time (),
+                          &err);
+
+  if (err)
+    {
+      error_dialog (applet,
+                    _("There was an error displaying help: %s"),
+                    err->message);
+      g_error_free (err);
+    }
+}
+
+static void
+trash_applet_show_about (GtkAction   *action,
+                         TrashApplet *applet)
+{
+  static const char *authors[] = {
+    "Michiel Sikkes <michiel@eyesopened.nl>",
+    "Emmanuele Bassi <ebassi@gmail.com>",
+    "Sebastian Bacher <seb128@canonical.com>",
+    "James Henstridge <james.henstridge@canonical.com>",
+    "Ryan Lortie <desrt@desrt.ca>",
+    NULL
+  };
+
+  static const char *documenters[] = {
+    "Michiel Sikkes <michiel@eyesopened.nl>",
+    N_("MATE Documentation Team"),
+    NULL
+  };
+
+#ifdef ENABLE_NLS
+  const char **p;
+  for (p = documenters; *p; ++p)
+    *p = _(*p);
+#endif
+
+  gtk_show_about_dialog (NULL,
+                         "title", _("About Trash Applet"),
+                         "version", VERSION,
+                         "copyright", _("Copyright \xc2\xa9 2004 Michiel Sikkes\n"
+                                        "Copyright \xc2\xa9 2008 Ryan Lortie\n"
+                                        "Copyright \xc2\xa9 2012-2021 MATE developers"),
+                         "comments", _("A MATE trash bin that lives in your panel. "
+                                       "You can use it to view the trash or drag "
+                                       "and drop items into the trash."),
+                         "authors", authors,
+                         "documenters", documenters,
+                         "translator-credits", _("translator-credits"),
+                         "logo_icon_name", "user-trash-full",
+                         NULL);
+}
+
+static gboolean
+confirm_delete_immediately (GtkWidget *parent_view,
+                            gint num_files,
+                            gboolean all)
+{
+  GdkScreen *screen;
+  GtkWidget *dialog, *hbox, *vbox, *image, *label;
+  gchar *str, *prompt, *detail;
+  int response;
+
+  screen = gtk_widget_get_screen (parent_view);
+
+  dialog = gtk_dialog_new ();
+  gtk_window_set_screen (GTK_WINDOW (dialog), screen);
+  atk_object_set_role (gtk_widget_get_accessible (dialog), ATK_ROLE_ALERT);
+  gtk_window_set_title (GTK_WINDOW (dialog), _("Delete Immediately?"));
+  gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+  gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+
+  gtk_widget_realize (dialog);
+  gdk_window_set_transient_for (gtk_widget_get_window (GTK_WIDGET (dialog)),
+                                gdk_screen_get_root_window (screen));
+  gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+
+  gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 14);
+
+  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+  gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
+  gtk_widget_show (hbox);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox,
+                      FALSE, FALSE, 0);
+
+  image = gtk_image_new_from_icon_name ("dialog-question",
+                                        GTK_ICON_SIZE_DIALOG);
+  gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
+  gtk_widget_show (image);
+  gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+  gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+  gtk_widget_show (vbox);
+
+  if (all)
+    {
+      prompt = _("Cannot move items to trash, do you want to delete them immediately?");
+      detail = g_strdup_printf ("None of the %d selected items can be moved to the Trash", num_files);
+    }
+  else
+    {
+      prompt = _("Cannot move some items to trash, do you want to delete these immediately?");
+      detail = g_strdup_printf ("%d of the selected items cannot be moved to the Trash", num_files);
+    }
+
+  str = g_strconcat ("<span weight=\"bold\" size=\"larger\">",
+                     prompt, "</span>", NULL);
+  label = gtk_label_new (str);
+  gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+  gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+  gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+  gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+  gtk_widget_show (label);
+  g_free (str);
+
+  label = gtk_label_new (detail);
+  gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+  gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+  gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+  gtk_widget_show (label);
+  g_free (detail);
+
+  gtk_dialog_add_button (GTK_DIALOG (dialog), "gtk-cancel",
+                         GTK_RESPONSE_CANCEL);
+  gtk_dialog_add_button (GTK_DIALOG (dialog), "gtk-delete",
+                         GTK_RESPONSE_YES);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog),
+                                   GTK_RESPONSE_YES);
+
+  response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+  gtk_widget_destroy (GTK_WIDGET (dialog));
+
+  return response == GTK_RESPONSE_YES;
+}
+
+static void
+trash_applet_drag_data_received (GtkWidget        *widget,
+                                 GdkDragContext   *context,
+                                 gint              x,
+                                 gint              y,
+                                 GtkSelectionData *selectiondata,
+                                 guint             info,
+                                 guint             time_)
+{
+  gchar **list;
+  gint i;
+  GList *trashed = NULL;
+  GList *untrashable = NULL;
+  GList *l;
+  GError *error = NULL;
+
+  list = g_uri_list_extract_uris ((gchar *)gtk_selection_data_get_data (selectiondata));
+
+  for (i = 0; list[i]; i++)
+    {
+      GFile *file;
+
+      file = g_file_new_for_uri (list[i]);
+
+      if (!g_file_trash (file, NULL, NULL))
+        {
+          untrashable = g_list_prepend (untrashable, file);
+        }
+      else
+        {
+          trashed = g_list_prepend (trashed, file);
+        }
+    }
+
+  if (untrashable)
+    {
+      if (confirm_delete_immediately (widget,
+                                      g_list_length (untrashable),
+                                      trashed == NULL))
+        {
+          for (l = untrashable; l; l = l->next)
+            {
+              if (!g_file_delete (l->data, NULL, &error))
+                {
+/*
+* FIXME: uncomment me after branched (we're string frozen)
+                  error_dialog (applet,
+                                _("Unable to delete '%s': %s"),
+                                g_file_get_uri (l->data),
+                                error->message);
+*/
+                                g_clear_error (&error);
+                }
+            }
+        }
+    }
+
+  g_list_free_full (untrashable, g_object_unref);
+  g_list_free_full (trashed, g_object_unref);
+
+  g_strfreev (list);
+
+  gtk_drag_finish (context, TRUE, FALSE, time_);
+}
+
+static void
+trash_applet_class_init (TrashAppletClass *class)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+
+  gobject_class->dispose = trash_applet_dispose;
+  widget_class->size_allocate = trash_applet_size_allocate;
+#ifdef GDK_WINDOWING_X11
+  if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
+    widget_class->button_release_event = trash_applet_button_release;
+  else /* for Wayland we need to watch button press rather than release */
+#endif
+  widget_class->button_press_event = trash_applet_button_release;
+  widget_class->key_press_event = trash_applet_key_press;
+  widget_class->drag_motion = trash_applet_drag_motion;
+  widget_class->drag_data_received = trash_applet_drag_data_received;
+}
+
+static gboolean
+trash_applet_factory (MatePanelApplet *applet,
+                      const gchar *iid,
+                      gpointer     data)
+{
+  gboolean retval = FALSE;
+
+  if (!strcmp (iid, "TrashApplet"))
+    {
+      AtkObject *atk_obj;
+      GtkActionGroup *action_group;
+
+#ifndef ENABLE_IN_PROCESS
+      g_set_application_name (_("Trash Applet"));
+#endif
+
+      gtk_window_set_default_icon_name ("user-trash");
+
+      /* Set up the menu */
+      action_group = gtk_action_group_new ("Trash Applet Actions");
+      gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+      gtk_action_group_add_actions (action_group,
+				    trash_applet_menu_actions,
+				    G_N_ELEMENTS (trash_applet_menu_actions),
+				    applet);
+      mate_panel_applet_setup_menu_from_resource (applet,
+                                                  GRESOURCE "trashapplet-menu.xml",
+                                                  action_group);
+      g_object_unref (action_group);
+
+      atk_obj = gtk_widget_get_accessible (GTK_WIDGET (applet));
+
+      if (GTK_IS_ACCESSIBLE (atk_obj)) {
+          atk_object_set_name (atk_obj, _("Trash Applet"));
+      }
+
+      gtk_widget_show (GTK_WIDGET (applet));
+
+      retval = TRUE;
+  }
+
+  return retval;
+}
+
+PANEL_APPLET_FACTORY ("TrashAppletFactory",
+		      TRASH_TYPE_APPLET,
+		      "TrashApplet",
+		      trash_applet_factory,
+		      NULL)
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/15.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/15.html new file mode 100644 index 00000000..656ca337 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/15.html @@ -0,0 +1,2025 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
+875
+876
+877
+878
+879
+880
+881
+882
/* charpick.c  This is a mate panel applet that allow users to select
+ * accented (and other) characters to be pasted into other apps.
+ */
+
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet-gsettings.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#ifdef HAVE_GUCHARMAP
+#include <gucharmap/gucharmap.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+#include "charpick.h"
+
+/* The comment for each char list has the html entity names of the chars */
+/* All gunicar codes should end in 0 */
+
+/* This is the default list used when starting charpick the first time */
+/* aacute, agrave, eacute, iacute, oacute, frac12, copy*/
+/* static const gchar *def_list = "áàéíñóœ©"; */
+static const gunichar def_code[] = {225, 224, 233, 237, 241, 243, 189, 169, 1579, 8364, 0};
+
+/* aacute, agrave, acirc, atilde, auml. aring, aelig, ordf */
+/* static const gchar *a_list = "áàâãäåæª"; */
+static const gunichar a_code[] = {225, 224, 226, 227, 228, 229, 230, 170, 0};
+/* static const gchar *cap_a_list = "ÁÀÂÃÄÅÆª"; */
+static const gunichar cap_a_code[] = {192, 193, 194, 195, 196, 197, 198, 170, 0};
+/* ccedil, cent, copy */
+/* static const gchar *c_list = "çÇ¢©"; */
+static const gunichar c_code[] = {231, 199, 162, 169, 0};
+/* eacute, egrave, ecirc, euml, aelig */
+/* static const gchar *e_list = "éèêëæ"; */
+static const gunichar e_code[] = {232, 233, 234, 235, 230, 0};
+/* static const gchar *cap_e_list = "ÉÈÊËÆ"; */
+static const gunichar cap_e_code[] = {200, 201, 202, 203, 198, 0};
+/* iacute, igrave, icirc, iuml */
+/* static const gchar *i_list = "íìîï"; */
+static const gunichar i_code[] = {236, 237, 238, 239, 0};
+/* static const gchar *cap_i_list = "ÍÌÎÏ"; */
+static const gunichar cap_i_code[] = {204, 205, 206, 207, 0};
+/* ntilde (this is the most important line in this program.) */
+/* static const gchar *n_list = "ñ, Ñ"; */
+static const gunichar n_code[] = {241, 209, 0};
+/* oacute, ograve, ocirc, otilde, ouml, oslash, ordm */
+/* static const gchar *o_list = "óòôõöøº"; */
+static const gunichar o_code[] = {242, 243, 244, 245, 246, 248, 176, 0};
+/* static const gchar *cap_o_list = "ÓÒÔÕÖØº"; */
+static const gunichar cap_o_code[] = {210, 211, 212, 213, 214, 216, 176, 0};
+/* szlig, sect, dollar */
+/* static const gchar *s_list = "ß§$"; */
+static const gunichar s_code[] = {223, 167, 36, 0};
+/* eth, thorn */
+/* static const gchar *t_list = "ðÐþÞ"; */
+static const gunichar t_code[] = {240, 208, 254, 222, 0};
+/* uacute, ugrave, ucirc, uuml */
+/* static const gchar *u_list = "úùûü"; */
+static const gunichar u_code[] = {249, 250, 251, 252, 0};
+/* static const gchar *cap_u_list = "ÚÙÛÜ"; */
+static const gunichar cap_u_code[] = {217, 218, 219, 220, 0};
+/* yacute, yuml, yen Yes, there is no capital yuml in iso 8859-1.*/
+/* static const gchar *y_list = "ýÝÿ¥"; */
+static const gunichar y_code[] = {253, 221, 255, 165, 0};
+
+/* extra characters unrelated to the latin alphabet. All characters in
+   ISO-8859-1 should now be accounted for.*/
+/* not shy macr plusmn */
+/* static const gchar *dash_list = "¬­¯±"; */
+static const gunichar dash_code[] = {172, 173, 175, 177, 0};
+/* laquo raquo uml */
+/* static const gchar *quote_list = "«»š·×"; */
+static const gunichar quote_code[] = {171, 187, 168, 183, 215, 0};
+/* curren, pound, yen, cent, dollar */
+/* static const gchar *currency_list = "€£¥¢$"; */
+static const gunichar currency_code[] = {164, 163, 165, 162, 36, 8364, 0};
+/* sup1 frac12 */
+/* static const gchar *one_list = "¹œŒ"; */
+static const gunichar one_code[] = {185, 178, 179, 188, 189, 190, 0};
+/* µ ¶ ® ¿ ¡ |  */
+static const gunichar misc_code[] = {181, 182, 174, 191, 161, 124, 0};
+
+/* language/region specific character groups */
+/* South Africa: Venda, Tswana and Northern Sotho */
+/* static const gchar *ZA_list = "ḓḽṋṱḒḼṊṰṅṄšŠ"; */
+static const gunichar ZA_code[] = {7699, 7741, 7755, 7793, 7698, 7740, 7754, 7792, 7749, 7748, 353, 352, 0};
+/* South Africa: Afrikaans */
+/* static const gchar *af_ZA_list = "áéíóúýêîôûèäëïöüÁÉÍÓÚÝÊÎÔÛÈÄËÏÖÜ"; */
+static const gunichar af_ZA_code[] = {225, 233, 237, 243, 250, 253, 234, 238, 244, 251, 232, 228, 235, 239, 246, 252, 193, 201, 205, 211, 218, 221, 202, 206, 212, 219, 200, 196, 203, 207, 214, 220, 0};
+
+static const gunichar * const chartable[] = {
+    def_code,
+    a_code,
+    cap_a_code,
+    c_code,
+    e_code,
+    cap_e_code,
+    i_code,
+    cap_i_code,
+    n_code,
+    o_code,
+    cap_o_code,
+    s_code,
+    t_code,
+    u_code,
+    cap_u_code,
+    y_code,
+    dash_code,
+    quote_code,
+    currency_code,
+    one_code,
+    misc_code,
+    ZA_code,
+    af_ZA_code
+};
+
+/* sets the picked character as the selection when it gets a request */
+static void
+charpick_selection_handler (GtkWidget        *widget,
+                            GtkSelectionData *selection_data,
+                            guint             info,
+                            guint             time,
+                            gpointer          data)
+{
+    charpick_data *p_curr_data = data;
+    gint num;
+    gchar tmp[7];
+    num = g_unichar_to_utf8 (p_curr_data->selected_unichar, tmp);
+    tmp[num] = '\0';
+
+    gtk_selection_data_set_text (selection_data, tmp, -1);
+
+    return;
+}
+
+/* untoggles the active toggle_button when we lose the selection */
+static gint
+selection_clear_cb (GtkWidget         *widget,
+                    GdkEventSelection *event,
+                    gpointer           data)
+{
+    charpick_data *curr_data = data;
+
+    if (curr_data->last_toggle_button)
+        gtk_toggle_button_set_active (curr_data->last_toggle_button, FALSE);
+
+    curr_data->last_toggle_button = NULL;
+    return TRUE;
+}
+
+static gint
+toggle_button_toggled_cb (GtkToggleButton *button,
+                          gpointer         data)
+{
+    charpick_data *curr_data = data;
+    gint button_index;
+    gboolean toggled;
+
+    button_index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "index"));
+    toggled = gtk_toggle_button_get_active (button);
+
+    if (toggled)
+    {
+        gunichar unichar;
+        if (curr_data->last_toggle_button && (button != curr_data->last_toggle_button))
+            gtk_toggle_button_set_active (curr_data->last_toggle_button, FALSE);
+
+        curr_data->last_toggle_button = button;
+        gtk_widget_grab_focus (curr_data->applet);
+        unichar = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "unichar"));
+        curr_data->selected_unichar = unichar;
+        /* set this? widget as the selection owner */
+        gtk_selection_owner_set (curr_data->invisible,
+                                 GDK_SELECTION_PRIMARY,
+                                 GDK_CURRENT_TIME);
+        gtk_selection_owner_set (curr_data->invisible,
+                                 GDK_SELECTION_CLIPBOARD,
+                                 GDK_CURRENT_TIME);
+        curr_data->last_index = button_index;
+    }
+    return TRUE;
+}
+
+/* This is a hack around the fact that gtk+ doesn't
+ * propogate button presses on button2/3.
+ */
+static gboolean
+button_press_hack (GtkWidget      *widget,
+                   GdkEventButton *event,
+                   GtkWidget      *applet)
+{
+    if (event->button == 3 || event->button == 2) {
+        gtk_propagate_event (applet, (GdkEvent *) event);
+
+        return TRUE;
+    }
+
+    return FALSE;
+}
+
+static gint
+key_press_event (GtkWidget   *widget,
+                 GdkEventKey *event,
+                 gpointer     data)
+{
+#if 0
+    charpick_data *p_curr_data = data;
+    const gunichar *code = NULL;
+    gchar inputchar = event->keyval;
+
+    switch (inputchar)
+      {
+      case 'a' : code = a_code;
+                 break;
+      case 'A' : code = cap_a_code;
+                 break;
+      case 'c' :
+      case 'C' : code = c_code;
+                 break;
+      case 'e' : code = e_code;
+                 break;
+      case 'E' : code = cap_e_code;
+                 break;
+      case 'i' : code = i_code;
+                 break;
+      case 'I' : code =  cap_i_code;
+                 break;
+      case 'n' :
+      case 'N' : code = n_code;
+                 break;
+      case 'o' : code = o_code;
+                 break;
+      case 'O' : code = cap_o_code;
+                 break;
+      case 's' : code = s_code;
+                 break;
+      case 't' :
+      case 'T' : code = t_code;
+                 break;
+      case 'u' : code = u_code;
+                 break;
+      case 'U' : code = cap_u_code;
+                 break;
+      case 'y' :
+      case 'Y' : code = y_code;
+                 break;
+      case '-' : code = dash_code;
+                 break;
+      case '\"' : code = quote_code;
+                 break;
+      case '$' : code = currency_code;
+                 break;
+      case '1' :
+      case '2' :
+      case '3' : code = one_code;
+                 break;
+      case 'd' : code = NULL;
+                 break;
+      default :
+                 return FALSE;
+    }
+    /* FIXME: what's wrong here ? */
+    if (code)
+      p_curr_data->charlist = g_ucs4_to_utf8 (code, -1, NULL, NULL, NULL);
+    else
+      p_curr_data->charlist = "hello";
+    p_curr_data->last_index = NO_LAST_INDEX;
+    p_curr_data->last_toggle_button = NULL;
+    build_table (p_curr_data);
+#endif
+  return FALSE;
+}
+
+static void
+menuitem_activated (GtkMenuItem   *menuitem,
+                    charpick_data *curr_data)
+{
+    gchar *string;
+
+    string = g_object_get_data (G_OBJECT (menuitem), "string");
+    if (g_ascii_strcasecmp (curr_data->charlist, string) == 0)
+        return;
+
+    g_free (curr_data->charlist);
+    curr_data->charlist = g_strdup (string);
+
+    build_table (curr_data);
+    if (g_settings_is_writable (curr_data->settings, "current-list"))
+        g_settings_set_string (curr_data->settings,
+                               "current-list",
+                               curr_data->charlist);
+}
+
+void
+populate_menu (charpick_data *curr_data)
+{
+    GList *list = curr_data->chartable;
+    GSList *group = NULL;
+    GtkMenu *menu;
+    GtkWidget *menuitem;
+
+    if (curr_data->menu)
+        gtk_widget_destroy (curr_data->menu);
+
+    curr_data->menu = gtk_menu_new ();
+    menu  = GTK_MENU (curr_data->menu);
+
+    while (list) {
+        gchar *string = list->data;
+        menuitem = gtk_radio_menu_item_new_with_label (group, string);
+        group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem));
+        gtk_widget_show (menuitem);
+        g_object_set_data (G_OBJECT (menuitem), "string", string);
+        g_signal_connect (menuitem, "activate",
+                          G_CALLBACK (menuitem_activated),
+                          curr_data);
+        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+        if (g_ascii_strcasecmp (curr_data->charlist, string) == 0)
+            gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), TRUE);
+        list = g_list_next (list);
+    }
+    build_table (curr_data);
+
+    /*Set up custom theme and transparency support*/
+    GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menu));
+    /* Fix any failures of compiz/other wm's to communicate with gtk for transparency */
+    GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (toplevel));
+    GdkVisual *visual = gdk_screen_get_rgba_visual (screen);
+    gtk_widget_set_visual (GTK_WIDGET (toplevel), visual);
+    /* Set menu and it's toplevel window to follow panel theme */
+    GtkStyleContext *context;
+    context = gtk_widget_get_style_context (GTK_WIDGET (toplevel));
+    gtk_style_context_add_class (context, "gnome-panel-menu-bar");
+    gtk_style_context_add_class (context, "mate-panel-menu-bar");
+}
+
+static void
+chooser_button_clicked (GtkButton     *button,
+                        charpick_data *curr_data)
+{
+    if (gtk_widget_get_visible (curr_data->menu))
+        gtk_menu_popdown (GTK_MENU (curr_data->menu));
+    else {
+        gtk_menu_set_screen (GTK_MENU (curr_data->menu),
+                             gtk_widget_get_screen (GTK_WIDGET (curr_data->applet)));
+
+        gtk_menu_popup_at_widget (GTK_MENU (curr_data->menu),
+                                  GTK_WIDGET (button),
+                                  GDK_GRAVITY_SOUTH_WEST,
+                                  GDK_GRAVITY_NORTH_WEST,
+                                  NULL);
+    }
+}
+
+/* Force the button not to have any focus padding and let the focus
+   indication be drawn on the label itself when space is tight. Taken from the clock applet.
+   FIXME : This is an Evil Hack and should be fixed when the focus padding can be overridden at the gtk+ level */
+
+static inline void force_no_button_padding (GtkWidget *widget)
+{
+    GtkCssProvider *provider;
+
+    provider = gtk_css_provider_new ();
+
+    gtk_css_provider_load_from_data (provider,
+                                     "#charpick-applet-button {\n"
+                                     "border-width: 0px;\n"
+                                     "padding: 0px;\n"
+                                     "margin: 0px;\n"
+                                     "}",
+                                     -1,
+                                     NULL);
+
+    gtk_style_context_add_provider (gtk_widget_get_style_context (widget),
+                                    GTK_STYLE_PROVIDER (provider),
+                                    GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
+    g_object_unref (provider);
+
+    gtk_widget_set_name (widget, "charpick-applet-button");
+}
+
+/* creates table of buttons, sets up their callbacks, and packs the table in
+   the event box */
+
+void
+build_table (charpick_data *p_curr_data)
+{
+    GtkWidget *box, *button_box, **row_box;
+    GtkWidget *button, *arrow;
+    gint i = 0, len = g_utf8_strlen (p_curr_data->charlist, -1);
+    GtkWidget **toggle_button;
+    gchar *charlist;
+    gint max_width=1, max_height=1;
+    gint size_ratio;
+
+    toggle_button = g_new (GtkWidget *, len);
+
+    if (p_curr_data->box)
+        gtk_widget_destroy (p_curr_data->box);
+
+    if (p_curr_data->panel_vertical)
+        box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+    else
+        box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+
+    gtk_widget_show (box);
+    p_curr_data->box = box;
+
+    button = gtk_button_new ();
+    if (g_list_length (p_curr_data->chartable) != 1)
+    {
+        gtk_widget_set_tooltip_text (button, _("Available palettes"));
+
+        switch (mate_panel_applet_get_orient (MATE_PANEL_APPLET (p_curr_data->applet))) {
+            case MATE_PANEL_APPLET_ORIENT_DOWN:
+                arrow = gtk_image_new_from_icon_name ("pan-down-symbolic",
+                                                      GTK_ICON_SIZE_MENU);
+                break;
+            case MATE_PANEL_APPLET_ORIENT_UP:
+                arrow = gtk_image_new_from_icon_name ("pan-up-symbolic",
+                                                      GTK_ICON_SIZE_MENU);
+                break;
+            case MATE_PANEL_APPLET_ORIENT_LEFT:
+                arrow = gtk_image_new_from_icon_name ("pan-start-symbolic",
+                                                      GTK_ICON_SIZE_MENU);
+                break;
+            case MATE_PANEL_APPLET_ORIENT_RIGHT:
+                arrow = gtk_image_new_from_icon_name ("pan-end-symbolic",
+                                                      GTK_ICON_SIZE_MENU);
+                break;
+            default:
+                g_assert_not_reached ();
+        }
+        gtk_container_add (GTK_CONTAINER (button), arrow);
+
+        gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+
+        /* FIXME : evil hack (see force_no_button_padding) */
+        force_no_button_padding (button);
+
+        gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE, 0);
+        g_signal_connect (button, "clicked",
+                          G_CALLBACK (chooser_button_clicked),
+                          p_curr_data);
+
+        g_signal_connect (button, "button-press-event",
+                          G_CALLBACK (button_press_hack),
+                          p_curr_data->applet);
+    }
+
+    charlist = p_curr_data->charlist;
+    for (i = 0; i < len; i++) {
+        gchar label[7];
+        GtkRequisition req;
+        gchar *atk_desc;
+        gchar *name;
+        g_utf8_strncpy (label, charlist, 1);
+        charlist = g_utf8_next_char (charlist);
+
+#ifdef HAVE_GUCHARMAP
+        /* TRANSLATOR: This sentance reads something like 'Insert "PILCROW SIGN"'
+         *             hopefully, the name of the unicode character has already
+         *             been translated.
+         */
+        name = g_strdup_printf (_("Insert \"%s\""),
+                                gucharmap_get_unicode_name (g_utf8_get_char (label)));
+#else
+        name = g_strdup (_("Insert special character"));
+#endif
+
+        toggle_button[i] = gtk_toggle_button_new_with_label (label);
+        atk_desc =  g_strdup_printf (_("insert special character %s"), label);
+
+        set_atk_name_description (toggle_button[i], NULL, atk_desc);
+        g_free (atk_desc);
+        gtk_widget_show (toggle_button[i]);
+        gtk_button_set_relief (GTK_BUTTON (toggle_button[i]), GTK_RELIEF_NONE);
+
+        /* FIXME : evil hack (see force_no_button_padding) */
+        force_no_button_padding (toggle_button[i]);
+
+        gtk_widget_set_tooltip_text (toggle_button[i], name);
+        g_free (name);
+
+        gtk_widget_get_preferred_size (toggle_button[i], NULL, &req);
+
+        max_width = MAX (max_width, req.width);
+        max_height = MAX (max_height, req.height-2);
+
+        g_object_set_data (G_OBJECT (toggle_button[i]), "unichar",
+                           GINT_TO_POINTER (g_utf8_get_char (label)));
+
+        g_signal_connect (toggle_button[i], "toggled",
+                          G_CALLBACK (toggle_button_toggled_cb),
+                          p_curr_data);
+
+        g_signal_connect (toggle_button[i], "button-press-event",
+                          G_CALLBACK (button_press_hack),
+                          p_curr_data->applet);
+    }
+
+    if (p_curr_data->panel_vertical) {
+        size_ratio = p_curr_data->panel_size / max_width;
+        button_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+    } else {
+        size_ratio = p_curr_data->panel_size / max_height;
+        button_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+    }
+
+    gtk_box_set_homogeneous (GTK_BOX (button_box), TRUE);
+    gtk_box_pack_start (GTK_BOX (box), button_box, TRUE, TRUE, 0);
+
+    size_ratio = MAX (size_ratio, 1);
+    row_box = g_new0 (GtkWidget *, size_ratio);
+    for (i=0; i < size_ratio; i++) {
+        if (!p_curr_data->panel_vertical)
+            row_box[i] = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+        else
+            row_box[i] = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+
+        gtk_box_set_homogeneous (GTK_BOX (row_box[i]), TRUE);
+        gtk_box_pack_start (GTK_BOX (button_box), row_box[i], TRUE, TRUE, 0);
+    }
+
+    for (i = 0; i <len; i++) {
+        int delta = len/size_ratio;
+        int index;
+
+        if (delta > 0)
+            index = i / delta;
+        else
+            index = i;
+
+        index = CLAMP (index, 0, size_ratio-1);
+        gtk_box_pack_start (GTK_BOX (row_box[index]),
+                            toggle_button[i],
+                            TRUE, TRUE, 0);
+    }
+
+    g_free (toggle_button);
+    g_free (row_box);
+
+    gtk_container_add (GTK_CONTAINER (p_curr_data->applet), box);
+    gtk_widget_show_all (p_curr_data->box);
+
+    p_curr_data->last_index = NO_LAST_INDEX;
+    p_curr_data->last_toggle_button = NULL;
+}
+
+static gboolean
+rebuild_cb (gpointer user_data)
+{
+    charpick_data *curr_data;
+
+    curr_data = user_data;
+    curr_data->rebuild_id = 0;
+
+    build_table (curr_data);
+
+    return G_SOURCE_REMOVE;
+}
+
+static void
+queue_rebuild (charpick_data *curr_data)
+{
+    if (curr_data->rebuild_id != 0)
+        return;
+
+    curr_data->rebuild_id = g_idle_add (rebuild_cb, curr_data);
+    g_source_set_name_by_id (curr_data->rebuild_id, "[charpick] rebuild_cb");
+}
+
+static void
+applet_size_allocate (MatePanelApplet *applet,
+                      GtkAllocation   *allocation,<--- Parameter 'allocation' can be declared as pointer to const
+                      gpointer         data)
+{
+    charpick_data *curr_data = data;
+    if (curr_data->panel_vertical) {
+        if (curr_data->panel_size == allocation->width)
+            return;
+        curr_data->panel_size = allocation->width;
+    } else {
+        if (curr_data->panel_size == allocation->height)
+            return;
+        curr_data->panel_size = allocation->height;
+    }
+
+    queue_rebuild (curr_data);
+    return;
+}
+
+static void
+applet_change_orient (MatePanelApplet      *applet,
+                      MatePanelAppletOrient o,
+                      gpointer              data)
+{
+    charpick_data *curr_data = data;
+    if (o == MATE_PANEL_APPLET_ORIENT_UP ||
+        o == MATE_PANEL_APPLET_ORIENT_DOWN)
+        curr_data->panel_vertical = FALSE;
+    else
+        curr_data->panel_vertical = TRUE;
+
+    build_table (curr_data);
+    return;
+}
+
+static void
+about (GtkAction     *action,
+       charpick_data *curr_data)
+{
+    static const char * const authors[] = {
+            "Alexandre Muñiz <munizao@xprt.net>",
+            "Kevin Vandersloot",
+            NULL
+    };
+
+    static const gchar* documenters[] = {
+            "Dan Mueth <d-mueth@uchicago.edu>",
+            N_("Sun GNOME Documentation Team <gdocteam@sun.com>"),
+            N_("MATE Documentation Team"),
+            NULL
+    };
+
+#ifdef ENABLE_NLS
+    const char **p;
+    for (p = documenters; *p; ++p)
+        *p = _(*p);
+#endif
+
+    gtk_show_about_dialog (NULL,
+                           "title",              _("About Character Palette"),
+                           "version",            VERSION,
+                           "copyright",          _("Copyright \xc2\xa9 1998, 2004-2005 GNOME Applets Maintainers and others\n"
+                                                   "Copyright \xc2\xa9 2012-2021 MATE developers"),
+                           "comments",           _("MATE Panel applet for selecting strange "
+                                                   "characters that are not on the keyboard. "
+                                                   "Released under GNU General Public Licence."),
+                           "authors",            authors,
+                           "documenters",        documenters,
+                           "translator-credits", _("translator-credits"),
+                           "logo-icon-name",     "accessories-character-map",
+                           NULL);
+}
+
+static void
+help_cb (GtkAction     *action,
+         charpick_data *curr_data)
+{
+    GError *error = NULL;
+
+    gtk_show_uri_on_window (NULL,
+                            "help:mate-char-palette",
+                            gtk_get_current_event_time (),
+                            &error);
+
+    if (error) { /* FIXME: the user needs to see this */
+        g_warning ("help error: %s\n", error->message);
+        g_error_free (error);
+        error = NULL;
+    }
+}
+
+static void
+applet_destroy (GtkWidget *widget,
+                gpointer   data)
+{
+    charpick_data *curr_data = data;
+
+    g_return_if_fail (curr_data);
+
+    if (curr_data->rebuild_id != 0)
+    {
+        g_source_remove (curr_data->rebuild_id);
+        curr_data->rebuild_id = 0;
+    }
+
+    if (curr_data->about_dialog)
+        gtk_widget_destroy (curr_data->about_dialog);
+    if (curr_data->propwindow)
+        gtk_widget_destroy (curr_data->propwindow);
+    if (curr_data->box)
+        gtk_widget_destroy (curr_data->box);
+    if (curr_data->menu)
+        gtk_widget_destroy (curr_data->menu);
+    if (curr_data->invisible)
+        gtk_widget_destroy (curr_data->invisible);
+    g_free (curr_data->charlist);
+    g_free (curr_data);
+}
+
+void
+save_chartable (charpick_data *curr_data)
+{
+    mate_panel_applet_settings_set_glist (curr_data->settings,
+                                          "chartable",
+                                          curr_data->chartable);
+}
+
+static void
+get_chartable (charpick_data *curr_data)
+{
+    gint i, n;
+    GList *value = NULL;
+
+    value = mate_panel_applet_settings_get_glist (curr_data->settings, "chartable");
+    if (value) {
+        curr_data->chartable = value;
+    }
+    else {
+        n = G_N_ELEMENTS (chartable);
+        for (i=0; i<n; i++) {
+            gchar *string;
+
+            string = g_ucs4_to_utf8 (chartable[i], -1, NULL, NULL, NULL);
+            curr_data->chartable = g_list_append (curr_data->chartable, string);
+        }
+        if (! g_settings_is_writable (curr_data->settings, "chartable"))
+            save_chartable (curr_data);
+    }
+}
+
+static const GtkActionEntry charpick_applet_menu_actions [] = {
+    { "Preferences", "document-properties", N_("_Preferences"),
+      NULL, NULL,
+      G_CALLBACK (show_preferences_dialog) },
+    { "Help", "help-browser", N_("_Help"),
+      NULL, NULL,
+      G_CALLBACK (help_cb) },
+    { "About", "help-about", N_("_About"),
+      NULL, NULL,
+      G_CALLBACK (about) }
+};
+
+void
+set_atk_name_description (GtkWidget   *widget,
+                          const gchar *name,
+                          const gchar *description)
+{
+    AtkObject *aobj;
+    aobj = gtk_widget_get_accessible (widget);
+    /* return if gail is not loaded */
+    if (GTK_IS_ACCESSIBLE (aobj) == FALSE)
+        return;
+    if (name)
+        atk_object_set_name (aobj, name);
+    if (description)
+        atk_object_set_description (aobj, description);
+}
+
+static void
+make_applet_accessible (GtkWidget *applet)
+{
+    set_atk_name_description (applet, _("Character Palette"), _("Insert characters"));
+}
+
+static gboolean
+charpicker_applet_fill (MatePanelApplet *applet)
+{
+    MatePanelAppletOrient orientation;
+    charpick_data *curr_data;
+    GdkScreen *screen;
+    GdkAtom utf8_atom;
+    gchar *string;
+    GtkActionGroup *action_group;
+
+#ifndef ENABLE_IN_PROCESS
+    g_set_application_name (_("Character Palette"));
+#endif
+
+    gtk_window_set_default_icon_name ("accessories-character-map");
+
+    mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR);
+
+    curr_data = g_new0 (charpick_data, 1);
+    curr_data->last_index = NO_LAST_INDEX;
+    curr_data->applet = GTK_WIDGET (applet);
+    curr_data->about_dialog = NULL;
+    curr_data->add_edit_dialog = NULL;
+    curr_data->settings = mate_panel_applet_settings_new (applet,
+                                                          "org.mate.panel.applet.charpick");
+    curr_data->rebuild_id = 0;
+
+    get_chartable (curr_data);
+
+    string  = g_settings_get_string (curr_data->settings, "current-list");
+    if (string && *string != '\0') {
+        curr_data->charlist = g_strdup (string);
+    } else {
+        curr_data->charlist = g_strdup (curr_data->chartable->data);
+    }
+    g_free (string);
+
+    curr_data->panel_size = mate_panel_applet_get_size (applet);
+
+    orientation = mate_panel_applet_get_orient (applet);
+    curr_data->panel_vertical = (orientation == MATE_PANEL_APPLET_ORIENT_LEFT)
+                             || (orientation == MATE_PANEL_APPLET_ORIENT_RIGHT);
+    build_table (curr_data);
+
+    g_signal_connect (curr_data->applet, "key-press-event",
+                      G_CALLBACK (key_press_event), curr_data);
+
+    utf8_atom = gdk_atom_intern ("UTF8_STRING", FALSE);
+
+    screen = gtk_widget_get_screen (GTK_WIDGET (applet));
+    curr_data->invisible = gtk_invisible_new_for_screen (screen);
+
+    gtk_selection_add_target (curr_data->invisible,
+                              GDK_SELECTION_PRIMARY,
+                              utf8_atom, 0);
+
+    gtk_selection_add_target (curr_data->invisible,
+                              GDK_SELECTION_CLIPBOARD,
+                              utf8_atom, 0);
+
+    g_signal_connect (curr_data->invisible, "selection-get",
+                      G_CALLBACK (charpick_selection_handler),
+                      curr_data);
+
+    g_signal_connect (curr_data->invisible, "selection-clear-event",
+                      G_CALLBACK (selection_clear_cb),
+                      curr_data);
+
+    make_applet_accessible (GTK_WIDGET (applet));
+
+    /* session save signal */
+    g_signal_connect (applet, "change-orient",
+                      G_CALLBACK (applet_change_orient), curr_data);
+
+    g_signal_connect (applet, "size-allocate",
+                      G_CALLBACK (applet_size_allocate), curr_data);<--- You might need to cast the function pointer here
+
+    g_signal_connect (applet, "destroy",
+                      G_CALLBACK (applet_destroy), curr_data);
+
+    gtk_widget_show_all (GTK_WIDGET (applet));
+
+    action_group = gtk_action_group_new ("Charpicker Applet Actions");
+    gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+    gtk_action_group_add_actions (action_group,
+                                  charpick_applet_menu_actions,
+                                  G_N_ELEMENTS (charpick_applet_menu_actions),
+                                  curr_data);
+
+    mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (applet),
+                                                CHARPICK_RESOURCE_PATH "charpick-applet-menu.xml",
+                                                action_group);
+
+    if (mate_panel_applet_get_locked_down (MATE_PANEL_APPLET (applet))) {
+        GtkAction *action;
+
+        action = gtk_action_group_get_action (action_group, "Preferences");
+        gtk_action_set_visible (action, FALSE);
+    }
+    g_object_unref (action_group);
+
+    register_stock_for_edit ();
+    populate_menu (curr_data);
+
+    return TRUE;
+}
+
+static gboolean
+charpicker_applet_factory (MatePanelApplet *applet,
+                           const gchar     *iid,
+                           gpointer         data)
+{
+    gboolean retval = FALSE;
+
+    if (!strcmp (iid, "CharpickerApplet"))
+        retval = charpicker_applet_fill (applet);
+
+    return retval;
+}
+
+PANEL_APPLET_FACTORY ("CharpickerAppletFactory",
+                      PANEL_TYPE_APPLET,
+                      "char-palette",
+                      charpicker_applet_factory,
+                      NULL)
+
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/16.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/16.html new file mode 100644 index 00000000..0d0f3af9 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/16.html @@ -0,0 +1,369 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
/* charpick.h -- header file for character picker applet */
+
+#ifndef __CHARPICK_H__
+#define __CHARPICK_H__
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet-gsettings.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define NO_LAST_INDEX -1
+
+typedef struct _charpick_data charpick_data;
+/* this type has basically all data for this program */
+struct _charpick_data {
+    GList           *chartable;
+    gchar           *charlist;  
+    gunichar         selected_unichar;
+    gint             last_index;
+    GtkWidget       *box;
+    GtkWidget       *frame;
+    GtkWidget       *applet;
+    GtkWidget       *invisible;
+    GtkToggleButton *last_toggle_button;
+    gint             panel_size;
+    gboolean         panel_vertical;
+    GtkWidget       *propwindow;
+    GtkWidget       *about_dialog;
+    GtkWidget       *pref_tree;
+    GtkWidget       *menu;
+    GtkWidget       *add_edit_dialog;
+    GtkWidget       *add_edit_entry;
+    GSettings       *settings;
+    guint           rebuild_id;
+};
+
+typedef struct _charpick_button_cb_data charpick_button_cb_data;
+/* This is the data type for the button callback function. */
+
+struct _charpick_button_cb_data {
+  gint button_index;
+  charpick_data * p_curr_data;
+};
+
+void start_callback_update (void);
+void register_stock_for_edit (void);
+
+void build_table (charpick_data *curr_data);
+void add_to_popup_menu (charpick_data *curr_data);
+void populate_menu (charpick_data *curr_data);
+void save_chartable (charpick_data *curr_data);
+void show_preferences_dialog (GtkAction     *action,
+                              charpick_data *curr_data);
+
+void add_edit_dialog_create (charpick_data *curr_data,
+                             gchar         *string,
+                             gchar         *title);
+void set_atk_name_description (GtkWidget         *widget,
+                               const char        *name,
+                               const char        *description);
+gboolean key_writable (MatePanelApplet *applet,
+                       const char *key);
+
+#endif	/* __CHARPICK_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/17.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/17.html new file mode 100644 index 00000000..5a7a5702 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/17.html @@ -0,0 +1,1415 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
/* properties.c -- properties dialog box and session management for character
+ * picker applet. Much of this is adapted from modemlights/properties.c
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include "charpick.h"
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <atk/atkrelation.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define CHARPICK_STOCK_EDIT "charpick-stock-edit"
+
+void
+register_stock_for_edit (void)
+{
+    static gboolean registered = FALSE;
+    if (!registered)
+    {
+        GtkIconFactory *factory;
+        GtkIconSet     *icons;
+
+        static const GtkStockItem edit_item [] = {
+            { CHARPICK_STOCK_EDIT, N_("_Edit"), 0, 0, GETTEXT_PACKAGE },
+        };
+        icons = gtk_icon_factory_lookup_default ("gtk-preferences");
+        factory = gtk_icon_factory_new ();
+        gtk_icon_factory_add (factory,
+                              CHARPICK_STOCK_EDIT,
+                              icons);
+        gtk_icon_factory_add_default (factory);
+        gtk_stock_add_static (edit_item, 1);
+        registered = TRUE;
+    }
+}
+
+/* sets accessible name and description */
+
+static void
+set_access_namedesc (GtkWidget   *widget,
+                     const gchar *name,
+                     const gchar *desc)
+{
+    AtkObject *obj;
+
+    obj = gtk_widget_get_accessible (widget);
+    if (! GTK_IS_ACCESSIBLE (obj))
+        return;
+
+    if (desc)
+        atk_object_set_description (obj, desc);
+    if (name)
+        atk_object_set_name (obj, name);
+}
+
+void
+add_edit_dialog_create (charpick_data *curr_data, gchar *string, gchar *title)
+{
+    GtkWidget *dialog;
+    GtkWidget *entry;
+    GtkWidget *dbox;
+    GtkWidget *vbox;
+    GtkWidget *hbox;
+    GtkWidget *label;
+
+    dialog = gtk_dialog_new_with_buttons (_(title),
+                                          GTK_WINDOW (curr_data->propwindow),
+                                          GTK_DIALOG_DESTROY_WITH_PARENT,
+                                          "gtk-cancel", GTK_RESPONSE_CANCEL,
+                                          "gtk-ok", GTK_RESPONSE_OK,
+                                          NULL);
+
+    gtk_window_set_transient_for (GTK_WINDOW (dialog),
+                                  GTK_WINDOW (curr_data->propwindow));
+    gtk_widget_set_sensitive (curr_data->propwindow, FALSE);
+
+    gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+    gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+    gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2);
+
+    dbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+    gtk_box_pack_start (GTK_BOX (dbox), vbox, TRUE, TRUE, 0);
+    gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+
+    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+    gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
+
+    label = gtk_label_new_with_mnemonic (_("_Palette:"));
+    gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+    entry = gtk_entry_new ();
+    gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
+    gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
+    gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
+
+    set_access_namedesc (entry, _("Palette entry"),
+                         _("Modify a palette by adding or removing characters"));
+    if (string)
+        gtk_entry_set_text (GTK_ENTRY (entry), string);
+
+    curr_data->add_edit_dialog = dialog;
+    curr_data->add_edit_entry = entry;
+}
+
+static void
+add_palette_cb (GtkDialog     *dialog,
+                int            response_id,
+                charpick_data *curr_data)
+{
+    GList            *list = curr_data->chartable;
+    GtkTreeModel     *model;
+    GtkTreeIter       iter;
+    GtkTreeSelection *selection;
+    GtkTreePath      *path;
+    char             *new;
+
+    gtk_widget_set_sensitive (curr_data->propwindow, TRUE);
+
+    if (response_id != GTK_RESPONSE_OK) {
+        gtk_widget_destroy (curr_data->add_edit_dialog);
+        return;
+    }
+
+    new = gtk_editable_get_chars (GTK_EDITABLE (curr_data->add_edit_entry), 0, -1);
+
+    gtk_widget_destroy (curr_data->add_edit_dialog);
+
+    if (!new || strlen (new) == 0)
+        return;
+
+    list = g_list_append (list, new);
+
+    if (curr_data->chartable == NULL) {
+        curr_data->chartable = list;
+        g_free (curr_data->charlist);
+        curr_data->charlist = g_strdup (curr_data->chartable->data);
+        build_table (curr_data);
+
+        if (g_settings_is_writable (curr_data->settings, "current-list"))
+            g_settings_set_string (curr_data->settings,
+                                   "current-list",
+                                   curr_data->charlist);
+    }
+
+    save_chartable (curr_data);
+    populate_menu (curr_data);
+
+    model = gtk_tree_view_get_model (GTK_TREE_VIEW (curr_data->pref_tree));
+
+    gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+    gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, new, 1, new, -1);
+
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (curr_data->pref_tree));
+    gtk_tree_selection_select_iter (selection, &iter);
+
+    path = gtk_tree_model_get_path (model, &iter);
+    gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (curr_data->pref_tree),
+                                  path, NULL, FALSE, 0.0, 0.0);
+
+    gtk_tree_path_free (path);
+}
+
+static void
+edit_palette_cb (GtkDialog     *dialog,
+                 int            response_id,
+                 charpick_data *curr_data)
+{
+    GtkTreeSelection *selection;
+    GtkTreeIter       iter;
+    GtkTreeModel     *model;
+    GList            *list;
+    char             *new;
+    char             *charlist;
+
+    gtk_widget_set_sensitive (curr_data->propwindow, TRUE);
+
+    if (response_id != GTK_RESPONSE_OK) {
+        gtk_widget_destroy (curr_data->add_edit_dialog);
+        return;
+    }
+
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (curr_data->pref_tree));
+
+    if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+        return;
+
+    gtk_tree_model_get (model, &iter, 1, &charlist, -1);
+
+    new = gtk_editable_get_chars (GTK_EDITABLE (curr_data->add_edit_entry), 0, -1);
+
+    gtk_widget_destroy (curr_data->add_edit_dialog);
+
+    if (!new || (g_ascii_strcasecmp (new, charlist) == 0))
+        return;
+
+    list = g_list_find (curr_data->chartable, charlist);
+    list->data = new;
+    save_chartable (curr_data);
+    populate_menu (curr_data);
+    gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, new, 1, new, -1);
+
+    if (g_ascii_strcasecmp (curr_data->charlist, charlist) == 0) {
+        g_free (curr_data->charlist);
+        curr_data->charlist = g_strdup (new);
+        build_table (curr_data);
+
+        if (g_settings_is_writable (curr_data->settings, "current-list"))
+            g_settings_set_string (curr_data->settings,
+                                   "current-list",
+                                   curr_data->charlist);
+    }
+
+    g_free (charlist);
+}
+
+static void
+add_palette (GtkButton     *buttonk,
+             charpick_data *curr_data)
+{
+    if (curr_data->add_edit_dialog == NULL) {
+        add_edit_dialog_create (curr_data, NULL, _("Add Palette"));
+
+        g_signal_connect (curr_data->add_edit_dialog, "response",
+                          G_CALLBACK (add_palette_cb),
+                          curr_data);
+
+        g_signal_connect (curr_data->add_edit_dialog, "destroy",
+                          G_CALLBACK (gtk_widget_destroyed),
+                          &curr_data->add_edit_dialog);
+
+        gtk_widget_show_all (curr_data->add_edit_dialog);
+    } else {
+        gtk_window_set_screen (GTK_WINDOW (curr_data->add_edit_dialog),
+                               gtk_widget_get_screen (GTK_WIDGET (curr_data->applet)));
+
+        gtk_window_present (GTK_WINDOW (curr_data->add_edit_dialog));
+    }
+}
+
+static void
+edit_palette (GtkButton     *button,
+              charpick_data *curr_data)
+{
+    GtkTreeSelection *selection;
+    GtkTreeIter iter;
+    GtkTreeModel *model;
+    char *charlist;
+
+    if (curr_data->add_edit_dialog == NULL) {
+        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (curr_data->pref_tree));
+
+        if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+            return;
+
+        gtk_tree_model_get (model, &iter, 1, &charlist, -1);
+
+        add_edit_dialog_create (curr_data, charlist, _("Edit Palette"));
+
+        g_signal_connect (curr_data->add_edit_dialog, "response",
+                          G_CALLBACK (edit_palette_cb),
+                          curr_data);
+
+        g_signal_connect (curr_data->add_edit_dialog, "destroy",
+                          G_CALLBACK (gtk_widget_destroyed),
+                          &curr_data->add_edit_dialog);
+
+        gtk_widget_show_all (curr_data->add_edit_dialog);
+    } else {
+        gtk_window_set_screen (GTK_WINDOW (curr_data->add_edit_dialog),
+                               gtk_widget_get_screen (GTK_WIDGET (curr_data->applet)));
+
+        gtk_window_present (GTK_WINDOW (curr_data->add_edit_dialog));
+    }
+}
+
+static void
+delete_palette (GtkButton     *button,
+                charpick_data *curr_data)
+{
+    GtkTreeSelection *selection;
+    GtkTreeIter       iter;
+    GtkTreeIter       next;
+    GtkTreeModel     *model;
+    gchar            *charlist;
+
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (curr_data->pref_tree));
+
+    if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+        return;
+
+    gtk_tree_model_get (model, &iter, 1, &charlist, -1);
+
+    curr_data->chartable = g_list_remove (curr_data->chartable, charlist);
+
+    if (g_ascii_strcasecmp (curr_data->charlist, charlist) == 0) {
+        g_free (curr_data->charlist);
+        curr_data->charlist = curr_data->chartable != NULL ?
+            g_strdup (curr_data->chartable->data) : g_strdup ("");
+        if (g_settings_is_writable (curr_data->settings, "current-list"))
+            g_settings_set_string (curr_data->settings,
+                                   "current-list",
+                                   curr_data->charlist);
+    }
+    g_free (charlist);
+
+    save_chartable (curr_data);
+    populate_menu (curr_data);
+
+    gtk_widget_grab_focus (curr_data->pref_tree);
+    next = iter;
+    if (gtk_tree_model_iter_next (model, &next) )
+        gtk_tree_selection_select_iter (selection, &next);
+    else {
+        GtkTreePath *path;
+        path = gtk_tree_model_get_path (model, &iter);
+        if (gtk_tree_path_prev (path))
+            gtk_tree_selection_select_path (selection, path);
+        gtk_tree_path_free (path);
+    }
+    gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
+}
+
+static void
+selection_changed (GtkTreeSelection *selection,
+                   gpointer          data)
+{
+    GtkWidget *scrolled = data;
+    GtkWidget *edit_button, *delete_button;
+    gboolean selected;
+
+    selected = gtk_tree_selection_get_selected (selection, NULL, NULL);
+    edit_button = g_object_get_data (G_OBJECT (scrolled), "edit_button");
+    gtk_widget_set_sensitive (edit_button, selected);
+    delete_button = g_object_get_data (G_OBJECT (scrolled), "delete_button");
+    gtk_widget_set_sensitive (delete_button, selected);
+}
+
+static GtkWidget *
+create_palettes_tree (charpick_data *curr_data,
+                      GtkWidget     *label)
+{
+    GtkWidget *scrolled;
+    GtkWidget *tree;
+    GtkListStore *model;
+    GtkCellRenderer *cell;
+    GtkTreeViewColumn *column;
+    GList *list = curr_data->chartable;
+    GtkTreeSelection *selection;
+
+    scrolled = gtk_scrolled_window_new (NULL, NULL);
+    gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
+                                         GTK_SHADOW_IN);
+    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
+                                    GTK_POLICY_AUTOMATIC,
+                                    GTK_POLICY_AUTOMATIC);
+
+    model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
+    tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
+    curr_data->pref_tree = tree;
+    gtk_label_set_mnemonic_widget (GTK_LABEL (label), tree);
+    gtk_container_add (GTK_CONTAINER (scrolled), tree);
+    set_access_namedesc (tree,
+                         _("Palettes list"),
+                         _("List of available palettes"));
+    g_object_unref (G_OBJECT (model));
+    cell = gtk_cell_renderer_text_new ();
+    column = gtk_tree_view_column_new_with_attributes ("hello",
+                                                       cell,
+                                                       "text",
+                                                       0, NULL);
+    gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
+    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree), FALSE);
+
+    while (list) {
+        GtkTreeIter iter;
+        gchar *charlist = list->data;
+
+        gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+        gtk_list_store_set (GTK_LIST_STORE (model),
+                            &iter, 0,
+                            charlist, 1,
+                            charlist, -1);
+
+        list = g_list_next (list);
+    }
+
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
+    g_signal_connect (selection, "changed",
+                      G_CALLBACK (selection_changed),
+                      scrolled);
+
+    return scrolled;
+
+}
+
+static GtkWidget *
+create_hig_catagory (GtkWidget *main_box,
+                     gchar *title)
+{
+    GtkWidget *vbox, *vbox2, *hbox;
+    GtkWidget *label;
+    gchar *tmp;
+
+    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+    gtk_box_pack_start (GTK_BOX (main_box), vbox, TRUE, TRUE, 0);
+
+    tmp = g_strdup_printf ("<b>%s</b>", title);
+    label = gtk_label_new (NULL);
+    gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+    gtk_label_set_markup (GTK_LABEL (label), tmp);
+    g_free (tmp);
+    gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+
+    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+    gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
+    
+    label = gtk_label_new ("    ");
+    gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+    
+    vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+    gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
+
+    return vbox2;
+}
+
+static void
+default_chars_frame_create (charpick_data *curr_data)
+{
+    GtkWidget *dialog = curr_data->propwindow;
+    GtkWidget *dbox;
+    GtkWidget *vbox;
+    GtkWidget *vbox1;
+    GtkWidget *vbox2;
+    GtkWidget *vbox3;
+    GtkWidget *hbox;
+    GtkWidget *label;
+    GtkWidget *scrolled;
+    GtkWidget *button;
+
+    dbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
+    gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+    gtk_box_pack_start (GTK_BOX (dbox), vbox, TRUE, TRUE, 0);
+
+    vbox1 = create_hig_catagory (vbox, _("Character Palette")); 
+
+    vbox3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+    gtk_box_pack_start (GTK_BOX (vbox1), vbox3, TRUE, TRUE, 0);
+
+    label = gtk_label_new_with_mnemonic (_("_Palettes:"));
+    gtk_box_pack_start (GTK_BOX (vbox3), label, FALSE, FALSE, 0);
+    gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+    gtk_widget_show (label);
+
+    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+    gtk_box_pack_start (GTK_BOX (vbox3), hbox, TRUE, TRUE, 0); 
+    scrolled = create_palettes_tree (curr_data, label);
+    gtk_box_pack_start (GTK_BOX (hbox), scrolled, TRUE, TRUE, 0);
+
+    vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+    gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0);
+
+    button = GTK_WIDGET (g_object_new (GTK_TYPE_BUTTON,
+                         "label", "gtk-add",
+                         "use-stock", TRUE,
+                         "use-underline", TRUE,
+                         NULL));
+
+    gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
+    g_signal_connect (button, "clicked",
+                      G_CALLBACK (add_palette),
+                      curr_data);
+    set_access_namedesc (button, _("Add button"),
+                         _("Click to add a new palette"));
+
+    button = GTK_WIDGET (g_object_new (GTK_TYPE_BUTTON,
+                         "label", CHARPICK_STOCK_EDIT,
+                         "use-stock", TRUE,
+                         "use-underline", TRUE,
+                         NULL));
+
+    gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
+    g_signal_connect (button, "clicked",
+                      G_CALLBACK (edit_palette),
+                      curr_data);
+    g_object_set_data (G_OBJECT (scrolled),
+                       "edit_button", button);
+    set_access_namedesc (button, _("Edit button"),
+                         _("Click to edit the selected palette"));
+
+    button = GTK_WIDGET (g_object_new (GTK_TYPE_BUTTON,
+                         "label", "gtk-delete",
+                         "use-stock", TRUE,
+                         "use-underline", TRUE,
+                         NULL));
+
+    gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
+    g_signal_connect (button, "clicked",
+                      G_CALLBACK (delete_palette),
+                      curr_data);
+    g_object_set_data (G_OBJECT (scrolled),
+                       "delete_button", button);
+    set_access_namedesc (button, _("Delete button"),
+                         _("Click to delete the selected palette"));
+
+    if (! g_settings_is_writable (curr_data->settings, "chartable"))
+        gtk_widget_set_sensitive (vbox3, FALSE);
+
+    return;
+}
+
+static void
+phelp_cb (GtkDialog *dialog,
+          gint       tab,
+          gpointer   data)
+{
+    GError *error = NULL;
+
+    gtk_show_uri_on_window (GTK_WINDOW (dialog),
+                            "help:mate-char-palette/charpick-prefs",
+                            gtk_get_current_event_time (),
+                            &error);
+
+    if (error) { /* FIXME: the user needs to see this */
+        g_warning ("help error: %s\n", error->message);
+        g_error_free (error);
+        error = NULL;
+    }
+}
+
+static void
+response_cb (GtkDialog *dialog,
+             gint       id,
+             gpointer   data)
+{
+    charpick_data *curr_data = data;
+
+    if (id == GTK_RESPONSE_HELP) {
+        phelp_cb (dialog, id, data);
+        return;
+    }
+
+    gtk_widget_destroy (curr_data->propwindow);
+    curr_data->propwindow = NULL;
+}
+
+void
+show_preferences_dialog (GtkAction     *action,
+                         charpick_data *curr_data)
+{
+    if (curr_data->propwindow) {
+        gtk_window_set_screen (GTK_WINDOW (curr_data->propwindow),
+        gtk_widget_get_screen (curr_data->applet));
+        gtk_window_present (GTK_WINDOW (curr_data->propwindow));
+        return;
+    }
+
+    curr_data->propwindow = gtk_dialog_new_with_buttons (_("Character Palette Preferences"), 
+                                                         NULL,
+                                                         GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                         "gtk-close", GTK_RESPONSE_CLOSE,
+                                                         "gtk-help", GTK_RESPONSE_HELP,
+                                                         NULL);
+    gtk_window_set_screen (GTK_WINDOW (curr_data->propwindow),
+                           gtk_widget_get_screen (curr_data->applet));
+    gtk_window_set_default_size (GTK_WINDOW (curr_data->propwindow), 350, 350);
+    gtk_container_set_border_width (GTK_CONTAINER (curr_data->propwindow), 5);
+    gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (curr_data->propwindow))), 2);
+    gtk_dialog_set_default_response (GTK_DIALOG (curr_data->propwindow), GTK_RESPONSE_CLOSE);
+
+    default_chars_frame_create (curr_data);
+    g_signal_connect (curr_data->propwindow, "response",
+                      G_CALLBACK (response_cb), curr_data);
+
+    gtk_widget_show_all (curr_data->propwindow);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/18.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/18.html new file mode 100644 index 00000000..c9802bc1 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/18.html @@ -0,0 +1,829 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.command"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[1414]; const double alignment; void * const ptr;}  command_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0310, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0006, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 
+  0002, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 0001, 0000, 0000, 0000, 
+  0310, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0314, 0000, 0000, 0000, 0320, 0000, 0000, 0000, 
+  0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0320, 0000, 0000, 0000, 0001, 0000, 0114, 0000, 
+  0324, 0000, 0000, 0000, 0330, 0000, 0000, 0000, 0201, 0321, 0040, 0031, 0000, 0000, 0000, 0000, 
+  0330, 0000, 0000, 0000, 0005, 0000, 0114, 0000, 0340, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 
+  0275, 0342, 0315, 0116, 0002, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0015, 0000, 0114, 0000, 
+  0364, 0000, 0000, 0000, 0370, 0000, 0000, 0000, 0253, 0307, 0222, 0153, 0003, 0000, 0000, 0000, 
+  0370, 0000, 0000, 0000, 0010, 0000, 0114, 0000, 0000, 0001, 0000, 0000, 0004, 0001, 0000, 0000, 
+  0365, 0147, 0122, 0205, 0004, 0000, 0000, 0000, 0004, 0001, 0000, 0000, 0026, 0000, 0166, 0000, 
+  0040, 0001, 0000, 0000, 0205, 0005, 0000, 0000, 0157, 0162, 0147, 0057, 0002, 0000, 0000, 0000, 
+  0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0155, 0141, 0164, 0145, 0055, 0141, 0160, 0160, 0154, 0145, 0164, 0163, 
+  0057, 0000, 0000, 0000, 0004, 0000, 0000, 0000, 0143, 0157, 0155, 0155, 0141, 0156, 0144, 0057, 
+  0005, 0000, 0000, 0000, 0143, 0157, 0155, 0155, 0141, 0156, 0144, 0055, 0160, 0162, 0145, 0146, 
+  0145, 0162, 0145, 0156, 0143, 0145, 0163, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0242, 0042, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0132, 0337, 0157, 0333, 0066, 
+  0020, 0176, 0357, 0137, 0301, 0361, 0251, 0303, 0240, 0370, 0107, 0206, 0254, 0030, 0154, 0025, 
+  0135, 0266, 0006, 0005, 0066, 0140, 0100, 0273, 0147, 0202, 0246, 0316, 0026, 0033, 0212, 0324, 
+  0110, 0312, 0216, 0377, 0373, 0121, 0242, 0033, 0133, 0066, 0055, 0131, 0261, 0341, 0332, 0135, 
+  0337, 0024, 0351, 0356, 0170, 0337, 0371, 0273, 0073, 0362, 0230, 0321, 0333, 0247, 0114, 0240, 
+  0071, 0150, 0303, 0225, 0034, 0343, 0301, 0115, 0037, 0043, 0220, 0114, 0045, 0134, 0316, 0306, 
+  0370, 0237, 0117, 0357, 0243, 0067, 0370, 0155, 0374, 0152, 0364, 0103, 0024, 0241, 0007, 0220, 
+  0240, 0251, 0205, 0004, 0055, 0270, 0115, 0321, 0114, 0320, 0004, 0320, 0355, 0315, 0355, 0335, 
+  0115, 0037, 0105, 0221, 0023, 0342, 0322, 0202, 0236, 0122, 0006, 0361, 0053, 0204, 0106, 0032, 
+  0376, 0055, 0270, 0006, 0203, 0004, 0237, 0214, 0361, 0314, 0076, 0376, 0204, 0327, 0013, 0335, 
+  0336, 0014, 0207, 0270, 0127, 0311, 0251, 0311, 0147, 0140, 0026, 0061, 0101, 0215, 0031, 0343, 
+  0007, 0373, 0370, 0041, 0243, 0063, 0300, 0210, 0047, 0143, 0314, 0313, 0307, 0001, 0056, 0345, 
+  0234, 0144, 0256, 0125, 0016, 0332, 0056, 0221, 0244, 0031, 0214, 0361, 0234, 0033, 0076, 0021, 
+  0200, 0343, 0117, 0272, 0200, 0121, 0357, 0313, 0327, 0260, 0060, 0243, 0222, 0114, 0025, 0053, 
+  0014, 0216, 0337, 0123, 0141, 0132, 0345, 0071, 0123, 0222, 0224, 0217, 0070, 0136, 0160, 0231, 
+  0250, 0105, 0304, 0204, 0332, 0126, 0033, 0365, 0274, 0363, 0141, 0034, 0357, 0222, 0317, 0205, 
+  0261, 0031, 0110, 0273, 0002, 0123, 0206, 0147, 0116, 0005, 0241, 0353, 0017, 0341, 0305, 0205, 
+  0132, 0200, 0306, 0361, 0240, 0315, 0311, 0042, 0317, 0113, 0271, 0067, 0167, 0077, 0367, 0373, 
+  0155, 0262, 0306, 0102, 0116, 0270, 0144, 0032, 0374, 0302, 0255, 0306, 0163, 0027, 0372, 0232, 
+  0102, 0377, 0030, 0360, 0013, 0236, 0330, 0364, 0344, 0310, 0007, 0027, 0207, 0373, 0167, 0116, 
+  0205, 0232, 0171, 0314, 0271, 0206, 0051, 0150, 0227, 0116, 0140, 0110, 0342, 0337, 0237, 0206, 
+  0234, 0023, 0245, 0023, 0320, 0244, 0212, 0251, 0163, 0160, 0330, 0046, 0157, 0271, 0165, 0171, 
+  0202, 0254, 0246, 0322, 0010, 0152, 0251, 0313, 0232, 0061, 0136, 0202, 0133, 0356, 0136, 0145, 
+  0031, 0225, 0011, 0172, 0227, 0347, 0002, 0054, 0372, 0173, 0355, 0161, 0207, 0004, 0051, 0054, 
+  0027, 0334, 0162, 0060, 0221, 0043, 0170, 0306, 0045, 0025, 0255, 0016, 0055, 0163, 0040, 0051, 
+  0057, 0303, 0353, 0003, 0263, 0243, 0300, 0122, 0056, 0022, 0124, 0245, 0214, 0263, 0027, 0125, 
+  0177, 0272, 0224, 0237, 0250, 0247, 0125, 0014, 0103, 0301, 0377, 0155, 0343, 0153, 0367, 0050, 
+  0207, 0164, 0224, 0346, 0216, 0004, 0324, 0272, 0242, 0205, 0143, 0127, 0275, 0054, 0147, 0273, 
+  0350, 0202, 0264, 0313, 0051, 0163, 0065, 0024, 0307, 0303, 0240, 0164, 0030, 0036, 0145, 0345, 
+  0102, 0204, 0152, 0240, 0033, 0070, 0202, 0110, 0013, 0153, 0225, 0254, 0343, 0175, 0051, 0346, 
+  0140, 0036, 0322, 0245, 0052, 0054, 0061, 0166, 0131, 0026, 0130, 0220, 0311, 0136, 0305, 0312, 
+  0365, 0372, 0273, 0375, 0016, 0373, 0274, 0230, 0124, 0317, 0003, 0274, 0255, 0025, 0162, 0143, 
+  0002, 0042, 0110, 0134, 0162, 0277, 0133, 0216, 0233, 0155, 0065, 0266, 0213, 0003, 0143, 0330, 
+  0125, 0125, 0003, 0003, 0076, 0057, 0323, 0037, 0246, 0264, 0020, 0266, 0273, 0205, 0252, 0003, 
+  0342, 0330, 0067, 0302, 0056, 0212, 0205, 0001, 0122, 0110, 0127, 0046, 0004, 0227, 0057, 0000, 
+  0115, 0305, 0202, 0056, 0015, 0061, 0251, 0132, 0220, 0225, 0017, 0315, 0046, 0066, 0313, 0142, 
+  0335, 0060, 0145, 0217, 0056, 0023, 0332, 0227, 0204, 0247, 0334, 0225, 0242, 0356, 0256, 0116, 
+  0271, 0020, 0335, 0265, 0162, 0145, 0270, 0117, 0353, 0176, 0023, 0250, 0240, 0367, 0243, 0336, 
+  0016, 0353, 0103, 0360, 0303, 0320, 0367, 0301, 0356, 0224, 0237, 0036, 0163, 0047, 0225, 0126, 
+  0300, 0001, 0260, 0073, 0100, 0167, 0323, 0275, 0255, 0012, 0277, 0070, 0025, 0117, 0125, 0312, 
+  0016, 0056, 0341, 0215, 0145, 0374, 0356, 0330, 0002, 0370, 0240, 0171, 0202, 0317, 0123, 0245, 
+  0032, 0303, 0023, 0054, 0123, 0056, 0311, 0333, 0221, 0006, 0127, 0125, 0242, 0310, 0344, 0132, 
+  0171, 0060, 0154, 0324, 0016, 0306, 0052, 0034, 0257, 0077, 0253, 0322, 0037, 0222, 0075, 0042, 
+  0150, 0307, 0006, 0056, 0244, 0237, 0122, 0301, 0147, 0216, 0132, 0306, 0122, 0155, 0273, 0052, 
+  0357, 0157, 0160, 0367, 0304, 0157, 0315, 0176, 0355, 0152, 0262, 0143, 0341, 0017, 0231, 0310, 
+  0044, 0144, 0112, 0162, 0126, 0356, 0060, 0147, 0340, 0272, 0026, 0363, 0276, 0020, 0227, 0110, 
+  0172, 0331, 0154, 0155, 0137, 0037, 0150, 0356, 0005, 0301, 0330, 0300, 0324, 0022, 0152, 0055, 
+  0145, 0151, 0143, 0221, 0016, 0153, 0133, 0225, 0037, 0252, 0274, 0247, 0312, 0357, 0251, 0364, 
+  0337, 0251, 0334, 0171, 0257, 0366, 0141, 0165, 0362, 0105, 0257, 0015, 0270, 0143, 0103, 0142, 
+  0176, 0274, 0010, 0126, 0077, 0037, 0310, 0115, 0316, 0245, 0337, 0224, 0136, 0037, 0267, 0007, 
+  0337, 0271, 0375, 0065, 0271, 0375, 0027, 0175, 0342, 0131, 0221, 0041, 0177, 0030, 0107, 0257, 
+  0131, 0112, 0365, 0205, 0320, 0333, 0217, 0134, 0256, 0231, 0333, 0303, 0257, 0313, 0355, 0077, 
+  0312, 0156, 0347, 0217, 0254, 0265, 0006, 0170, 0146, 0272, 0277, 0104, 0075, 0075, 0364, 0060, 
+  0125, 0051, 0033, 0227, 0031, 0256, 0072, 0257, 0216, 0026, 0345, 0252, 0221, 0073, 0375, 0107, 
+  0060, 0257, 0306, 0167, 0251, 0063, 0044, 0100, 0273, 0235, 0264, 0044, 0265, 0070, 0170, 0007, 
+  0111, 0071, 0050, 0130, 0211, 0232, 0005, 0315, 0163, 0160, 0361, 0222, 0312, 0117, 0167, 0317, 
+  0304, 0262, 0301, 0025, 0357, 0016, 0076, 0272, 0004, 0335, 0234, 0216, 0004, 0272, 0322, 0067, 
+  0107, 0270, 0355, 0141, 0303, 0306, 0130, 0070, 0060, 0045, 0357, 0306, 0137, 0247, 0133, 0100, 
+  0344, 0352, 0260, 0234, 0101, 0122, 0147, 0157, 0040, 0264, 0244, 0022, 0047, 0317, 0342, 0127, 
+  0311, 0340, 0301, 0145, 0061, 0170, 0273, 0361, 0374, 0237, 0350, 0273, 0175, 0317, 0161, 0062, 
+  0356, 0156, 0007, 0365, 0233, 0040, 0356, 0311, 0033, 0374, 0351, 0246, 0220, 0235, 0207, 0050, 
+  0027, 0061, 0206, 0074, 0174, 0036, 0165, 0237, 0002, 0253, 0115, 0345, 0375, 0250, 0267, 0274, 
+  0325, 0141, 0345, 0247, 0343, 0246, 0363, 0037, 0235, 0061, 0124, 0032, 0273, 0276, 0011, 0175, 
+  0347, 0037, 0376, 0340, 0223, 0305, 0211, 0107, 0364, 0211, 0246, 0356, 0007, 0223, 0011, 0147, 
+  0324, 0052, 0175, 0276, 0371, 0374, 0331, 0063, 0143, 0160, 0265, 0003, 0372, 0056, 0363, 0355, 
+  0126, 0274, 0355, 0363, 0371, 0072, 0306, 0332, 0307, 0221, 0277, 0133, 0214, 0374, 0341, 0320, 
+  0074, 0153, 0324, 0136, 0043, 0015, 0046, 0127, 0322, 0070, 0157, 0242, 0137, 0160, 0274, 0272, 
+  0247, 0033, 0365, 0152, 0102, 0137, 0214, 0207, 0014, 0256, 0356, 0065, 0313, 0353, 0335, 0325, 
+  0255, 0363, 0204, 0352, 0365, 0205, 0155, 0056, 0050, 0203, 0124, 0011, 0107, 0371, 0336, 0216, 
+  0217, 0153, 0347, 0107, 0275, 0215, 0377, 0044, 0371, 0017, 0135, 0113, 0017, 0201, 0000, 0050, 
+  0165, 0165, 0141, 0171, 0051
+} };
+
+static GStaticResource static_resource = { command_resource_data.data, sizeof (command_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *command_get_resource (void);
+GResource *command_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * 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.1 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/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CONSTRUCTOR_H__
+#define __G_CONSTRUCTOR_H__
+
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+/*
+ * Only try to include gslist.h if not already included via glib.h,
+ * so that items using gconstructor.h outside of GLib (such as
+ * GResources) continue to build properly.
+ */
+#ifndef __G_LIB_H__
+#include "gslist.h"
+#endif
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+#endif /* __G_CONSTRUCTOR_H__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(commandresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(commandresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(commandresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(commandresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void commandresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void commandresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/19.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/19.html new file mode 100644 index 00000000..96296194 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/19.html @@ -0,0 +1,1271 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
/* command.c:
+ *
+ * Copyright (C) 2013-2014 Stefano Karapetsas
+ *
+ * This file is part of MATE Applets.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authors:
+ *      Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gmodule.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet-gsettings.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "ma-command.h"
+
+/* Applet constants */
+#define APPLET_ICON    "utilities-terminal"
+#define ERROR_OUTPUT   "#"
+
+/* GSettings constants */
+#define COMMAND_SCHEMA "org.mate.panel.applet.command"
+#define COMMAND_KEY    "command"
+#define INTERVAL_KEY   "interval"
+#define SHOW_ICON_KEY  "show-icon"
+#define WIDTH_KEY      "width"
+
+/* GKeyFile constants */
+#define GK_COMMAND_GROUP   "Command"
+#define GK_COMMAND_OUTPUT  "Output"
+#define GK_COMMAND_ICON    "Icon"
+
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
+#define GET_DIALOG(x) (GTK_DIALOG (gtk_builder_get_object (builder, (x))))
+
+typedef struct
+{
+    MatePanelApplet   *applet;
+
+    GSettings         *settings;
+
+    GtkLabel          *label;
+    GtkImage          *image;
+    GtkBox            *box;
+    MaCommand         *command;
+    GCancellable      *cancellable;
+    gboolean           running;
+
+    gchar             *cmdline;
+    gint               interval;
+    gint               width;
+
+    guint              timeout_id;
+} CommandApplet;
+
+static void command_about_callback (GtkAction *action, CommandApplet *command_applet);
+static void command_settings_callback (GtkAction *action, CommandApplet *command_applet);
+static gboolean command_execute (CommandApplet *command_applet);
+static gboolean command_text_changed (GtkWidget *widget, GdkEvent  *event, gpointer user_data);
+static void interval_value_changed (GtkSpinButton *spin_button, gpointer user_data);
+static void width_value_changed (GtkSpinButton *spin_button, gpointer user_data);
+static void command_async_ready_callback (GObject *source_object, GAsyncResult *res, gpointer user_data);
+static gboolean timeout_callback (CommandApplet *command_applet);
+
+static const GtkActionEntry applet_menu_actions [] = {
+    { "Preferences", "document-properties", N_("_Preferences"), NULL, NULL, G_CALLBACK (command_settings_callback) },
+    { "About", "help-about", N_("_About"), NULL, NULL, G_CALLBACK (command_about_callback) }
+};
+
+static char *ui = "<menuitem name='Item 1' action='Preferences' />"
+                  "<menuitem name='Item 2' action='About' />";
+
+/* GSettings signal callbacks */
+static void
+settings_command_changed (GSettings *settings, gchar *key, CommandApplet *command_applet)
+{
+    GError *error = NULL;
+    gchar *cmdline;
+    gchar **argv;
+
+    cmdline = g_settings_get_string (command_applet->settings, COMMAND_KEY);
+    if (strlen (cmdline) == 0 || g_strcmp0(command_applet->cmdline, cmdline) == 0)
+    {
+        g_free (cmdline);
+        return;
+    }
+
+    if (!g_shell_parse_argv (cmdline, NULL, &argv, &error))
+    {
+        gtk_label_set_text (command_applet->label, ERROR_OUTPUT);
+        g_clear_error (&error);
+        g_free (cmdline);
+        return;
+    }
+    g_strfreev(argv);
+
+    if (command_applet->cmdline)
+        g_free (command_applet->cmdline);
+    command_applet->cmdline = cmdline;
+
+    command_execute (command_applet);
+}
+
+static void
+command_applet_destroy (MatePanelApplet *applet_widget, CommandApplet *command_applet)
+{
+    g_assert (command_applet);
+
+    g_signal_handlers_disconnect_by_func (command_applet->settings,
+                      G_CALLBACK (settings_command_changed),
+                      command_applet);
+
+
+    if (command_applet->timeout_id != 0)
+    {
+        g_source_remove (command_applet->timeout_id);
+        command_applet->timeout_id = 0;
+    }
+
+    if (command_applet->cmdline != NULL)
+    {
+        g_free (command_applet->cmdline);
+        command_applet->cmdline = NULL;
+    }
+
+    if (command_applet->command != NULL)
+    {
+        g_object_unref (command_applet->command);
+    }
+
+    g_object_unref (command_applet->settings);
+}
+
+/* Show the about dialog */
+static void
+command_about_callback (GtkAction *action, CommandApplet *command_applet)
+{
+    const char* authors[] = { "Stefano Karapetsas <stefano@karapetsas.com>", NULL };
+
+    gtk_show_about_dialog(NULL,
+                          "title", _("About Command Applet"),
+                          "version", VERSION,
+                          "copyright", _("Copyright \xc2\xa9 2013-2014 Stefano Karapetsas\n"
+                                         "Copyright \xc2\xa9 2015-2021 MATE developers"),
+                          "authors", authors,
+                          "comments", _("Shows the output of a command"),
+                          "translator-credits", _("translator-credits"),
+                          "logo-icon-name", APPLET_ICON,
+                          NULL );
+}
+
+static gboolean
+command_text_changed (GtkWidget *widget, GdkEvent  *event, gpointer user_data)
+{
+    const gchar *text;
+    CommandApplet *command_applet;
+
+    command_applet = (CommandApplet*) user_data;
+    text = gtk_entry_get_text (GTK_ENTRY(widget));
+    if (g_strcmp0(command_applet->cmdline, text) == 0) {
+        return TRUE;
+    }
+
+    if (strlen (text) == 0) {
+        gtk_label_set_text (command_applet->label, ERROR_OUTPUT);
+        return TRUE;
+    }
+
+    g_settings_set_string (command_applet->settings, COMMAND_KEY, text);
+    return TRUE;
+}
+
+static void interval_value_changed (GtkSpinButton *spin_button, gpointer user_data)
+{
+    gint value;
+    CommandApplet *command_applet;
+
+    command_applet = (CommandApplet*) user_data;
+    value = gtk_spin_button_get_value_as_int (spin_button);
+    if (command_applet->interval == value) {
+        return;
+    }
+
+    g_settings_set_int (command_applet->settings, INTERVAL_KEY, value);
+}
+
+static void width_value_changed (GtkSpinButton *spin_button, gpointer user_data)
+{
+    gint value;
+    CommandApplet *command_applet;
+
+    command_applet = (CommandApplet*) user_data;
+    value = gtk_spin_button_get_value_as_int (spin_button);
+    if (command_applet->width == value) {
+        return;
+    }
+
+    g_settings_set_int (command_applet->settings, WIDTH_KEY, value);
+}
+
+/* Show the preferences dialog */
+static void
+command_settings_callback (GtkAction *action, CommandApplet *command_applet)
+{
+    GtkDialog *dialog;
+    GtkBuilder *builder;
+
+    builder = gtk_builder_new_from_resource ("/org/mate/mate-applets/command/command-preferences.ui");
+
+    dialog = GET_DIALOG ("preferences_dialog");
+
+    g_settings_bind (command_applet->settings, COMMAND_KEY, GET_WIDGET ("command_entry"), "text", G_SETTINGS_BIND_GET_NO_CHANGES);
+    g_settings_bind (command_applet->settings, INTERVAL_KEY, GET_WIDGET ("interval_spinbutton"), "value", G_SETTINGS_BIND_GET_NO_CHANGES);
+    g_settings_bind (command_applet->settings, WIDTH_KEY, GET_WIDGET ("width_spinbutton"), "value", G_SETTINGS_BIND_GET_NO_CHANGES);
+    g_settings_bind (command_applet->settings, SHOW_ICON_KEY, GET_WIDGET ("show_icon_check"), "active", G_SETTINGS_BIND_DEFAULT);
+
+    /* signals */
+    gtk_builder_add_callback_symbols (builder,
+                                      "on_command_entry_focus_out_event", G_CALLBACK (command_text_changed),
+                                      "on_interval_spinbutton_value_changed", G_CALLBACK (interval_value_changed),
+                                      "on_width_spinbutton_value_changed", G_CALLBACK (width_value_changed),
+                                      NULL);
+    gtk_builder_connect_signals (builder, command_applet);
+
+    g_signal_connect (dialog, "response",
+                      G_CALLBACK (gtk_widget_destroy),
+                      dialog);
+
+    g_object_unref (builder);
+
+    gtk_widget_show_all (GTK_WIDGET (dialog));
+}
+
+static void
+settings_width_changed (GSettings *settings, gchar *key, CommandApplet *command_applet)
+{
+    gint width;
+
+    width = g_settings_get_int (command_applet->settings, WIDTH_KEY);
+
+    if (command_applet->width != width) {<--- Condition 'command_applet->width!=width' is redundant
+        command_applet->width = width;<--- Assignment 'command_applet->width=width'
+    }
+}
+
+static void
+settings_interval_changed (GSettings *settings, gchar *key, CommandApplet *command_applet)
+{
+    gint interval;
+
+    interval = g_settings_get_int (command_applet->settings, INTERVAL_KEY);
+
+    /* minimum interval */
+    if (interval < 1)
+        interval = 1;
+
+    if (command_applet->interval == interval) {
+        return;
+    }
+    command_applet->interval = interval;
+
+    command_execute (command_applet);
+}
+
+static void
+process_command_output (CommandApplet *command_applet, gchar *output)
+{
+    gtk_widget_set_tooltip_text (GTK_WIDGET (command_applet->label), command_applet->cmdline);
+
+    if ((output == NULL) || (output[0] == '\0'))
+    {
+        gtk_label_set_text (command_applet->label, ERROR_OUTPUT);
+        return;
+    }
+
+    /* check if output is a custom GKeyFile */
+    if (g_str_has_prefix (output, "[Command]"))
+    {
+        GKeyFile *file = g_key_file_new ();
+        if (g_key_file_load_from_data (file, output, -1, G_KEY_FILE_NONE, NULL))
+        {
+            gchar *goutput = g_key_file_get_string (file, GK_COMMAND_GROUP, GK_COMMAND_OUTPUT, NULL);
+            gchar *icon = g_key_file_get_string (file, GK_COMMAND_GROUP, GK_COMMAND_ICON, NULL);
+
+            if (goutput)
+            {
+                gtk_label_set_use_markup (command_applet->label, TRUE);
+                gtk_label_set_markup (command_applet->label, goutput);
+            }
+
+            if (icon)
+                gtk_image_set_from_icon_name (command_applet->image, icon, GTK_ICON_SIZE_LARGE_TOOLBAR);
+
+            g_free (goutput);
+            g_free (icon);
+        }
+        else
+            gtk_label_set_text (command_applet->label, ERROR_OUTPUT);
+
+        g_key_file_free (file);
+    }
+    else
+    {
+        /* Remove leading and trailing whitespace */
+        g_strstrip (output);
+
+        /* check output length */
+        if (g_utf8_strlen (output, strlen(output)) > command_applet->width)
+        {
+            *g_utf8_offset_to_pointer(output, command_applet->width) = '\0';
+        }
+
+        gtk_label_set_text (command_applet->label, output);
+    }
+}
+
+static void command_async_ready_callback (GObject *source_object, GAsyncResult *res, gpointer user_data)
+{
+    gchar *output;
+    GError *error = NULL;
+    CommandApplet *command_applet;
+
+    command_applet = (CommandApplet*) user_data;
+
+    output = ma_command_run_finish (command_applet->command, res, &error);
+    if (error == NULL) {
+        process_command_output (command_applet, output);
+    } else {
+        if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_FAILED)) {
+            gtk_label_set_text (command_applet->label, ERROR_OUTPUT);
+        }
+        g_error_free (error);
+    }
+    g_free (output);
+    command_applet->running = FALSE;
+}
+
+static gboolean timeout_callback (CommandApplet *command_applet)
+{
+    /* command is empty, wait for next timer execution */
+    if (strlen (command_applet->cmdline) == 0) {
+        return G_SOURCE_CONTINUE;
+    }
+
+    /* command running, wait for next timer execution */
+    if (command_applet->running) {
+        return G_SOURCE_CONTINUE;
+    } else {
+        gchar **argv;
+        GError *error = NULL;
+        if (!g_shell_parse_argv (command_applet->cmdline, NULL, &argv, &error)) {
+            gtk_label_set_text (command_applet->label, ERROR_OUTPUT);
+            g_clear_error (&error);
+            return G_SOURCE_CONTINUE;
+        }
+        g_strfreev(argv);
+        command_execute (command_applet);
+        return G_SOURCE_REMOVE;
+    }
+}
+
+static gboolean
+command_execute (CommandApplet *command_applet)
+{
+    /* stop current timer */
+    if (command_applet->timeout_id != 0)
+    {
+        g_source_remove (command_applet->timeout_id);
+        command_applet->timeout_id = 0;
+    }
+
+    if (command_applet->running) {
+        g_cancellable_cancel (command_applet->cancellable);
+    }
+
+    g_object_set (G_OBJECT(command_applet->command), "command", command_applet->cmdline, NULL);
+    ma_command_run_async (command_applet->command,
+                          command_applet->cancellable,
+                          command_async_ready_callback,
+                          command_applet);
+    if (!command_applet->running) {
+        command_applet->running = TRUE;
+    }
+
+    if (g_cancellable_is_cancelled (command_applet->cancellable)) {
+        g_cancellable_reset (command_applet->cancellable);
+    }
+
+    command_applet->timeout_id = g_timeout_add_seconds (command_applet->interval,
+                                                        (GSourceFunc) timeout_callback,
+                                                        command_applet);
+    return G_SOURCE_CONTINUE;
+}
+
+static gboolean
+command_applet_fill (MatePanelApplet* applet)
+{
+    CommandApplet *command_applet;
+    AtkObject *atk_widget;
+
+#ifndef ENABLE_IN_PROCESS
+    g_set_application_name (_("Command Applet"));
+#endif
+
+    gtk_window_set_default_icon_name (APPLET_ICON);
+
+    mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR);
+
+    command_applet = g_malloc0(sizeof(CommandApplet));
+    command_applet->applet = applet;
+    command_applet->settings = mate_panel_applet_settings_new (applet, COMMAND_SCHEMA);
+
+    command_applet->interval = g_settings_get_int (command_applet->settings, INTERVAL_KEY);
+    command_applet->cmdline = g_settings_get_string (command_applet->settings, COMMAND_KEY);
+    command_applet->width = g_settings_get_int (command_applet->settings, WIDTH_KEY);
+    command_applet->command = ma_command_new(command_applet->cmdline, NULL);
+    command_applet->cancellable = g_cancellable_new ();
+
+    command_applet->box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
+    command_applet->image = GTK_IMAGE (gtk_image_new_from_icon_name (APPLET_ICON, GTK_ICON_SIZE_LARGE_TOOLBAR));
+    command_applet->label = GTK_LABEL (gtk_label_new (ERROR_OUTPUT));
+    command_applet->timeout_id = 0;
+
+    /* we add the Gtk label into the applet */
+    gtk_box_pack_start (command_applet->box,
+                        GTK_WIDGET (command_applet->image),
+                        TRUE, TRUE, 0);
+    gtk_box_pack_start (command_applet->box,
+                        GTK_WIDGET (command_applet->label),
+                        TRUE, TRUE, 0);
+
+    gtk_container_add (GTK_CONTAINER (applet),
+                       GTK_WIDGET (command_applet->box));
+
+    gtk_widget_show_all (GTK_WIDGET (command_applet->applet));
+
+    g_signal_connect (command_applet->applet, "destroy",
+                      G_CALLBACK (command_applet_destroy),
+                      command_applet);
+
+    /* GSettings signals */
+    g_signal_connect (command_applet->settings, "changed::" COMMAND_KEY,
+                      G_CALLBACK (settings_command_changed),
+                      command_applet);
+
+    g_signal_connect (command_applet->settings, "changed::" INTERVAL_KEY,
+                      G_CALLBACK (settings_interval_changed),
+                      command_applet);
+
+    g_signal_connect (command_applet->settings, "changed::" WIDTH_KEY,
+                      G_CALLBACK (settings_width_changed),
+                      command_applet);
+
+    g_settings_bind (command_applet->settings,
+                     SHOW_ICON_KEY,
+                     command_applet->image,
+                     "visible",
+                     G_SETTINGS_BIND_DEFAULT);
+
+    atk_widget = gtk_widget_get_accessible (GTK_WIDGET (command_applet->applet));
+    if (GTK_IS_ACCESSIBLE (atk_widget)) {
+        atk_object_set_name (atk_widget,
+                             _("Command applet"));
+        atk_object_set_description (atk_widget,
+                                    _("Shows the output of a command"));
+    }
+
+    /* set up context menu */
+    GtkActionGroup *action_group = gtk_action_group_new ("Command Applet Actions");
+    gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+    gtk_action_group_add_actions (action_group, applet_menu_actions,
+                                  G_N_ELEMENTS (applet_menu_actions), command_applet);
+    mate_panel_applet_setup_menu (command_applet->applet, ui, action_group);
+
+    /* first command execution */
+    command_execute (command_applet);
+    return TRUE;
+}
+
+/* this function, called by mate-panel, will create the applet */
+static gboolean
+command_factory (MatePanelApplet* applet, const char* iid, gpointer data)
+{
+    gboolean retval = FALSE;
+
+    if (!g_strcmp0 (iid, "CommandApplet"))
+        retval = command_applet_fill (applet);
+
+    return retval;
+}
+
+/* needed by mate-panel applet library */
+PANEL_APPLET_FACTORY ("CommandAppletFactory",
+                      PANEL_TYPE_APPLET,
+                      "Command applet",
+                      command_factory,
+                      NULL)
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/2.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/2.html new file mode 100644 index 00000000..7a5ec009 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/2.html @@ -0,0 +1,469 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
/* Keyboard Accessibility Status Applet
+ * Copyright 2003 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __ACCESSX_APPLET_H__
+#define __ACCESSX_APPLET_H__
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define ACCESSX_APPLET            "preferences-desktop-accessibility"
+
+#define ACCESSX_BASE_ICON         "mate-ax-key-none"
+#define ACCESSX_BASE_ICON_BASE    "mate-ax-key-base"
+#define ACCESSX_BASE_ICON_INVERSE "mate-ax-key-inverse"
+#define ACCESSX_ACCEPT_BASE       "mate-ax-key-yes"
+#define ACCESSX_REJECT_BASE       "mate-ax-key-no"
+
+#define MOUSEKEYS_BASE_ICON       "mate-mousekeys-base"
+#define MOUSEKEYS_BUTTON_LEFT     "mate-mousekeys-pressed-left"
+#define MOUSEKEYS_BUTTON_MIDDLE   "mate-mousekeys-pressed-middle"
+#define MOUSEKEYS_BUTTON_RIGHT    "mate-mousekeys-pressed-right"
+#define MOUSEKEYS_DOT_LEFT        "mate-mousekeys-default-left"
+#define MOUSEKEYS_DOT_MIDDLE      "mate-mousekeys-default-middle"
+#define MOUSEKEYS_DOT_RIGHT       "mate-mousekeys-default-right"
+
+#define SHIFT_KEY_ICON            "mate-sticky-shift-none"
+#define SHIFT_KEY_ICON_LATCHED    "mate-sticky-shift-latched"
+#define SHIFT_KEY_ICON_LOCKED     "mate-sticky-shift-locked"
+
+#define CONTROL_KEY_ICON          "mate-sticky-ctrl-none"
+#define CONTROL_KEY_ICON_LATCHED  "mate-sticky-ctrl-latched"
+#define CONTROL_KEY_ICON_LOCKED   "mate-sticky-ctrl-locked"
+
+#define ALT_KEY_ICON              "mate-sticky-alt-none"
+#define ALT_KEY_ICON_LATCHED      "mate-sticky-alt-latched"
+#define ALT_KEY_ICON_LOCKED       "mate-sticky-alt-locked"
+
+#define META_KEY_ICON             "mate-sticky-meta-none"
+#define META_KEY_ICON_LATCHED     "mate-sticky-meta-latched"
+#define META_KEY_ICON_LOCKED      "mate-sticky-meta-locked"
+
+#define HYPER_KEY_ICON            "mate-sticky-hyper-none"
+#define HYPER_KEY_ICON_LATCHED    "mate-sticky-hyper-latched"
+#define HYPER_KEY_ICON_LOCKED     "mate-sticky-hyper-locked"
+
+#define SUPER_KEY_ICON            "mate-sticky-super-none"
+#define SUPER_KEY_ICON_LATCHED    "mate-sticky-super-latched"
+#define SUPER_KEY_ICON_LOCKED     "mate-sticky-super-locked"
+
+#define ALTGRAPH_KEY_ICON         "mate-sticky-alt-none"
+#define ALTGRAPH_KEY_ICON_LATCHED "mate-sticky-alt-latched"
+#define ALTGRAPH_KEY_ICON_LOCKED  "mate-sticky-alt-locked"
+
+#define SLOWKEYS_IDLE_ICON        "mate-ax-slowkeys"
+#define SLOWKEYS_PENDING_ICON     "mate-ax-slowkeys-pending"
+#define SLOWKEYS_ACCEPT_ICON      "mate-ax-slowkeys-yes"
+#define SLOWKEYS_REJECT_ICON      "mate-ax-slowkeys-no"
+
+#define BOUNCEKEYS_ICON           "mate-ax-bouncekeys"
+
+typedef enum {
+    ACCESSX_STATUS_ERROR_NONE = 0,
+    ACCESSX_STATUS_ERROR_XKB_DISABLED,
+    ACCESSX_STATUS_ERROR_UNKNOWN
+}AccessxStatusErrorType;
+
+typedef struct {
+    MatePanelApplet* applet;
+    GtkWidget* box;
+    GtkWidget* idlefoo;
+    GtkWidget* mousefoo;
+    GtkWidget* stickyfoo;
+    GtkWidget* slowfoo;
+    GtkWidget* bouncefoo;
+    GtkWidget* shift_indicator;
+    GtkWidget* ctrl_indicator;
+    GtkWidget* alt_indicator;
+    GtkWidget* meta_indicator;
+    GtkWidget* hyper_indicator;
+    GtkWidget* super_indicator;
+    GtkWidget* alt_graph_indicator;
+    MatePanelAppletOrient orient;
+    GtkIconFactory* icon_factory;
+    gboolean initialized;
+    XkbDescRec* xkb;
+    Display* xkb_display;
+    AccessxStatusErrorType error_type;
+} AccessxStatusApplet;
+
+typedef enum {
+    ACCESSX_STATUS_MODIFIERS = 1 << 0,
+    ACCESSX_STATUS_SLOWKEYS = 1 << 1,
+    ACCESSX_STATUS_BOUNCEKEYS = 1 << 2,
+    ACCESSX_STATUS_MOUSEKEYS = 1 << 3,
+    ACCESSX_STATUS_ENABLED = 1 << 4,
+    ACCESSX_STATUS_ALL = 0xFFFF
+} AccessxStatusNotifyType;
+
+#endif
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/20.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/20.html new file mode 100644 index 00000000..90d21b49 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/20.html @@ -0,0 +1,323 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
/*
+ * Copyright (C) 2018 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MA_COMMAND_H
+#define MA_COMMAND_H
+
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define MA_TYPE_COMMAND (ma_command_get_type ())
+G_DECLARE_FINAL_TYPE (MaCommand, ma_command, MA, COMMAND, GObject)
+
+MaCommand *ma_command_new        (const gchar          *command,
+                                  GError              **error);
+
+void       ma_command_run_async  (MaCommand            *command,
+                                  GCancellable         *cancellable,
+                                  GAsyncReadyCallback   callback,
+                                  gpointer              user_data);
+
+gchar     *ma_command_run_finish (MaCommand            *command,
+                                  GAsyncResult         *result,
+                                  GError              **error);
+
+G_END_DECLS
+
+#endif
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/21.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/21.html new file mode 100644 index 00000000..4b504038 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/21.html @@ -0,0 +1,1071 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
/*
+ * Copyright (C) 2018 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "ma-command.h"
+
+#define BUFFER_SIZE 64
+
+struct _MaCommand
+{
+  GObject   parent;
+
+  gchar    *command;
+  gchar   **argv;
+};
+
+typedef struct
+{
+  GPid        pid;
+
+  GIOChannel *channel;
+
+  GString    *input;
+
+  guint       io_watch_id;
+  guint       child_watch_id;
+} CommandData;
+
+enum
+{
+  PROP_0,
+
+  PROP_COMMAND,
+
+  LAST_PROP
+};
+
+static GParamSpec *command_properties[LAST_PROP] = { NULL };
+
+static void initable_iface_init (GInitableIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (MaCommand, ma_command, G_TYPE_OBJECT,<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_CODE is a macro then please configure it.
+                         G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
+                                                initable_iface_init))
+
+static gboolean
+read_cb (GIOChannel   *source,
+         GIOCondition  condition,
+         gpointer      user_data)
+{
+  GTask *task;
+  CommandData *data;
+  gchar buffer[BUFFER_SIZE];
+  gsize bytes_read;
+  GError *error;
+  GIOStatus status;
+
+  task = (GTask *) user_data;
+  data = g_task_get_task_data (task);
+
+  if (g_task_return_error_if_cancelled (task))
+    {
+      g_object_unref (task);
+
+      data->io_watch_id = 0;
+
+      return G_SOURCE_REMOVE;
+    }
+
+  error = NULL;
+  status = g_io_channel_read_chars (source, buffer, BUFFER_SIZE,
+                                    &bytes_read, &error);
+
+  if (status == G_IO_STATUS_AGAIN)
+    {
+      g_clear_error (&error);
+
+      return G_SOURCE_CONTINUE;
+    }
+  else if (status != G_IO_STATUS_NORMAL)
+    {
+      if (error != NULL)
+        {
+          g_task_return_error (task, error);
+          g_object_unref (task);
+        }
+
+      data->io_watch_id = 0;
+
+      return G_SOURCE_REMOVE;
+    }
+
+  g_string_append_len (data->input, buffer, bytes_read);
+
+  return G_SOURCE_CONTINUE;
+}
+
+static void
+child_watch_cb (GPid     pid,
+                gint     status,
+                gpointer user_data)
+{
+  GTask *task;
+  CommandData *data;
+
+  task = (GTask *) user_data;
+  data = g_task_get_task_data (task);
+
+  g_task_return_pointer (task, g_strdup (data->input->str), g_free);
+  g_object_unref (task);
+}
+
+static void
+cancelled_cb (GCancellable *cancellable,
+              gpointer      user_data)
+{
+  GTask *task;
+
+  task = G_TASK (user_data);
+
+  g_object_unref (task);
+}
+
+static void
+command_data_free (gpointer user_data)
+{
+  CommandData *data;
+
+  data = (CommandData *) user_data;
+
+  if (data->pid != 0)
+    {
+      g_spawn_close_pid (data->pid);
+      data->pid = 0;
+    }
+
+  if (data->channel != NULL)
+    {
+      g_io_channel_unref (data->channel);
+      data->channel = NULL;
+    }
+
+  if (data->input != NULL)
+    {
+      g_string_free (data->input, TRUE);
+      data->input = NULL;
+    }
+
+  if (data->io_watch_id != 0)
+    {
+      g_source_remove (data->io_watch_id);
+      data->io_watch_id = 0;
+    }
+
+  if (data->child_watch_id != 0)
+    {
+      g_source_remove (data->child_watch_id);
+      data->child_watch_id = 0;
+    }
+
+  g_free (data);
+}
+
+static gboolean
+ma_command_initable_init (GInitable     *initable,
+                          GCancellable  *cancellable,
+                          GError       **error)
+{
+  MaCommand *command;
+
+  command = MA_COMMAND (initable);
+
+  if (command->command == NULL || *command->command == '\0')
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
+                   "Empty command");
+
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+static void
+initable_iface_init (GInitableIface *iface)
+{
+  iface->init = ma_command_initable_init;
+}
+
+static void
+ma_command_finalize (GObject *object)
+{
+  MaCommand *command;
+
+  command = MA_COMMAND (object);
+
+  g_clear_pointer (&command->command, g_free);
+  g_clear_pointer (&command->argv, g_strfreev);
+
+  G_OBJECT_CLASS (ma_command_parent_class)->finalize (object);
+}
+
+static void
+ma_command_set_property (GObject      *object,
+                         guint         property_id,
+                         const GValue *value,
+                         GParamSpec   *pspec)
+{
+  MaCommand *command;
+
+  command = MA_COMMAND (object);
+
+  switch (property_id)
+    {
+      case PROP_COMMAND:
+          //g_assert (command->command == NULL);
+          command->command = g_value_dup_string (value);
+          if (command->argv && *command->argv != NULL) {
+              g_strfreev(command->argv);
+          }
+          g_shell_parse_argv (command->command, NULL, &command->argv, NULL);
+        break;
+
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+        break;
+    }
+}
+
+static void
+ma_command_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+    MaCommand *command;
+
+    command = MA_COMMAND (object);
+
+    switch (prop_id)
+    {
+        case PROP_COMMAND:
+            g_value_set_string (value, command->command);
+        default:
+            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+            break;
+    }
+}
+
+static void
+install_properties (GObjectClass *object_class)
+{
+  command_properties[PROP_COMMAND] =
+    g_param_spec_string ("command", "command", "command",
+                         NULL,
+                         G_PARAM_READWRITE);
+
+  g_object_class_install_properties (object_class, LAST_PROP,
+                                     command_properties);
+}
+
+static void
+ma_command_class_init (MaCommandClass *command_class)
+{
+  GObjectClass *object_class;
+
+  object_class = G_OBJECT_CLASS (command_class);
+
+  object_class->finalize = ma_command_finalize;
+  object_class->set_property = ma_command_set_property;
+  object_class->get_property = ma_command_get_property;
+
+  install_properties (object_class);
+}
+
+static void
+ma_command_init (MaCommand *command)
+{
+}
+
+/**
+ * ma_command_new:
+ * @command: a command
+ * @error: (nullable): return location for an error, or %NULL
+ *
+ * Creates a new #MaCommand.
+ *
+ * Returns: (nullable): a newly allocated #MaCommand
+ */
+MaCommand *
+ma_command_new (const gchar  *command,
+                GError      **error)
+{
+  return g_initable_new (MA_TYPE_COMMAND, NULL, error,
+                         "command", command,
+                         NULL);
+}
+
+/**
+ * ma_command_run_async:
+ * @command: a #MaCommand
+ * @cancellable: (nullable): a #GCancellable or %NULL
+ * @callback: a #GAsyncReadyCallback to call when the request is satisfied
+ * @user_data: the data to pass to @callback
+ *
+ * Request an asynchronous read of output from command that was passed
+ * to ma_command_new().
+ */
+void
+ma_command_run_async (MaCommand           *command,
+                      GCancellable        *cancellable,
+                      GAsyncReadyCallback  callback,
+                      gpointer             user_data)
+{
+  GTask *task;
+  CommandData *data;
+  GSpawnFlags spawn_flags;
+  gint command_stdout;
+  GError *error;
+  GIOChannel *channel;
+  GIOStatus status;
+  GIOCondition condition;
+
+  g_return_if_fail (MA_IS_COMMAND (command));
+  g_return_if_fail (callback != NULL);
+
+  task = g_task_new (command, cancellable, callback, user_data);
+  g_task_set_source_tag (task, ma_command_run_async);
+
+  if (cancellable)
+    {
+      g_signal_connect_object (cancellable, "cancelled",
+                               G_CALLBACK (cancelled_cb), task,
+                               G_CONNECT_AFTER);
+    }
+
+  data = g_new0 (CommandData, 1);
+  g_task_set_task_data (task, data, command_data_free);
+
+  spawn_flags = G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD;
+  error = NULL;
+
+  if (!g_spawn_async_with_pipes (NULL, command->argv, NULL, spawn_flags,
+                                 NULL, NULL, &data->pid, NULL, &command_stdout,
+                                 NULL, &error))
+    {
+      g_task_return_error (task, error);
+      g_object_unref (task);
+
+      return;
+    }
+
+  channel = data->channel = g_io_channel_unix_new (command_stdout);
+  g_io_channel_set_close_on_unref (channel, TRUE);
+
+  g_assert (error == NULL);
+  status = g_io_channel_set_encoding (channel, NULL, &error);
+
+  if (status != G_IO_STATUS_NORMAL)
+    {
+      g_task_return_error (task, error);
+      g_object_unref (task);
+
+      return;
+    }
+
+  g_assert (error == NULL);
+  status = g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, &error);
+
+  if (status != G_IO_STATUS_NORMAL)
+    {
+      g_task_return_error (task, error);
+      g_object_unref (task);
+
+      return;
+    }
+
+  data->input = g_string_new (NULL);
+
+  condition = G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP;
+  data->io_watch_id = g_io_add_watch (channel, condition, read_cb, task);
+
+  data->child_watch_id = g_child_watch_add (data->pid, child_watch_cb, task);
+}
+
+/**
+ * ma_command_run_finish:
+ * @command: a #MaCommand
+ * @result: a #GAsyncResult
+ * @error: (nullable): return location for an error, or %NULL
+ *
+ * Finishes an operation started with ma_command_run_async().
+ *
+ * Returns: %NULL if @error is set, otherwise output from command
+ */
+gchar *
+ma_command_run_finish (MaCommand     *command,
+                       GAsyncResult  *result,
+                       GError       **error)
+{
+  g_return_val_if_fail (MA_IS_COMMAND (command), NULL);
+  g_return_val_if_fail (g_task_is_valid (result, command), NULL);
+  g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+  return g_task_propagate_pointer (G_TASK (result), error);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/22.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/22.html new file mode 100644 index 00000000..ff738a50 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/22.html @@ -0,0 +1,1989 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
+875
+876
/*
+ * MATE CPUFreq Applet
+ * Copyright (C) 2004 Carlos Garcia Campos <carlosgc@gnome.org>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This 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
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Authors : Carlos García Campos <carlosgc@gnome.org>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"<--- Include file: "config.h" not found.
+#endif
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkkeysyms.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet-gsettings.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "cpufreq-applet.h"
+#include "cpufreq-prefs.h"
+#include "cpufreq-popup.h"
+#include "cpufreq-monitor.h"
+#include "cpufreq-monitor-factory.h"
+#include "cpufreq-utils.h"
+
+struct _CPUFreqApplet {
+    MatePanelApplet        base;
+
+    /* Visibility */
+    CPUFreqShowMode        show_mode;
+    CPUFreqShowTextMode    show_text_mode;
+    gboolean               show_freq;
+    gboolean               show_perc;
+    gboolean               show_unit;
+    gboolean               show_icon;
+
+    CPUFreqMonitor        *monitor;
+
+    MatePanelAppletOrient  orient;
+    gint                   size;
+
+    GtkWidget             *box;
+    GtkWidget             *icon;
+    GtkWidget             *labels_box;
+    GtkWidget             *label;
+    GtkWidget             *unit_label;
+
+    cairo_surface_t       *surfaces[5];
+
+    gboolean               need_refresh;
+
+    CPUFreqPrefs          *prefs;
+    CPUFreqPopup          *popup;
+};
+
+struct _CPUFreqAppletClass {
+        MatePanelAppletClass parent_class;
+};
+
+static void     cpufreq_applet_preferences_cb    (GtkAction             *action,
+                                                  CPUFreqApplet         *applet);
+static void     cpufreq_applet_help_cb           (GtkAction             *action,
+                                                  CPUFreqApplet         *applet);
+static void     cpufreq_applet_about_cb          (GtkAction             *action,
+                                                  CPUFreqApplet         *applet);
+
+static void     cpufreq_applet_pixmap_set_image  (CPUFreqApplet         *applet,
+                                                  gint                   perc);
+
+static void     cpufreq_applet_setup             (CPUFreqApplet         *applet);
+static void     cpufreq_applet_update            (CPUFreqApplet         *applet,
+                                                  CPUFreqMonitor        *monitor);
+static void     cpufreq_applet_refresh           (CPUFreqApplet         *applet);
+
+static void     cpufreq_applet_dispose           (GObject               *widget);
+static gboolean cpufreq_applet_button_press      (GtkWidget             *widget,
+                                                  GdkEventButton        *event);
+static gboolean cpufreq_applet_key_press         (GtkWidget             *widget,
+                                                  GdkEventKey           *event);
+static void     cpufreq_applet_size_allocate     (GtkWidget             *widget,
+                                                  GtkAllocation         *allocation);
+static void     cpufreq_applet_change_orient     (MatePanelApplet       *pa,
+                                                  MatePanelAppletOrient  orient);
+static void     cpufreq_applet_style_updated     (GtkWidget *widget);
+static gboolean cpufreq_applet_factory           (CPUFreqApplet         *applet,
+                                                  const gchar           *iid,
+                                                  gpointer               gdata);
+
+static const gchar* const cpufreq_icons[] = {
+    MATE_PIXMAPSDIR "/mate-cpufreq-applet/cpufreq-25.png",
+    MATE_PIXMAPSDIR "/mate-cpufreq-applet/cpufreq-50.png",
+    MATE_PIXMAPSDIR "/mate-cpufreq-applet/cpufreq-75.png",
+    MATE_PIXMAPSDIR "/mate-cpufreq-applet/cpufreq-100.png",
+    MATE_PIXMAPSDIR "/mate-cpufreq-applet/cpufreq-na.png",
+    NULL
+};
+
+static const GtkActionEntry cpufreq_applet_menu_actions[] = {
+    { "CPUFreqAppletPreferences", "document-properties", N_("_Preferences"),
+      NULL, NULL,
+      G_CALLBACK (cpufreq_applet_preferences_cb) },
+    { "CPUFreqAppletHelp", "help-browser", N_("_Help"),
+      NULL, NULL,
+      G_CALLBACK (cpufreq_applet_help_cb) },
+    { "CPUFreqAppletAbout", "help-about", N_("_About"),
+      NULL, NULL,
+      G_CALLBACK (cpufreq_applet_about_cb) }
+};
+
+G_DEFINE_TYPE (CPUFreqApplet, cpufreq_applet, PANEL_TYPE_APPLET)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
+
+/* Enum Types */
+GType
+cpufreq_applet_show_mode_get_type (void)
+{
+    static GType etype = 0;
+
+    if (etype == 0) {
+        static const GEnumValue values[] = {
+            { CPUFREQ_MODE_GRAPHIC, "CPUFREQ_MODE_GRAPHIC", "mode-graphic" },
+            { CPUFREQ_MODE_TEXT,    "CPUFREQ_MODE_TEXT",    "mode-text" },
+            { CPUFREQ_MODE_BOTH,    "CPUFREQ_MODE_BOTH",    "mode-both" },
+            { 0, NULL, NULL }
+        };
+
+        etype = g_enum_register_static ("CPUFreqShowMode", values);
+    }
+
+    return etype;
+}
+
+GType
+cpufreq_applet_show_text_mode_get_type (void)
+{
+    static GType etype = 0;
+
+    if (etype == 0) {
+        static const GEnumValue values[] = {
+            { CPUFREQ_MODE_TEXT_FREQUENCY,      "CPUFREQ_MODE_TEXT_FREQUENCY",      "mode-text-frequency" },
+            { CPUFREQ_MODE_TEXT_FREQUENCY_UNIT, "CPUFREQ_MODE_TEXT_FREQUENCY_UNIT", "mode-text-frequency-unit" },
+            { CPUFREQ_MODE_TEXT_PERCENTAGE,     "CPUFREQ_MODE_TEXT_PERCENTAGE",     "mode-text-percentage" },
+            { 0, NULL, NULL }
+        };
+
+        etype = g_enum_register_static ("CPUFreqShowTextMode", values);
+    }
+
+    return etype;
+}
+
+static void
+cpufreq_applet_init (CPUFreqApplet *applet)
+{
+    applet->prefs = NULL;
+    applet->popup = NULL;
+    applet->monitor = NULL;
+
+    applet->show_mode = CPUFREQ_MODE_BOTH;
+    applet->show_text_mode = CPUFREQ_MODE_TEXT_FREQUENCY_UNIT;
+
+    applet->need_refresh = TRUE;
+
+    mate_panel_applet_set_flags (MATE_PANEL_APPLET (applet), MATE_PANEL_APPLET_EXPAND_MINOR);
+
+    applet->size = mate_panel_applet_get_size (MATE_PANEL_APPLET (applet));
+    applet->orient = mate_panel_applet_get_orient (MATE_PANEL_APPLET (applet));
+
+    applet->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
+    gtk_container_add (GTK_CONTAINER (applet), applet->box);
+    gtk_widget_set_valign (applet->box, GTK_ALIGN_CENTER);
+    gtk_widget_show (applet->box);
+
+    switch (applet->orient) {
+        case MATE_PANEL_APPLET_ORIENT_LEFT:
+        case MATE_PANEL_APPLET_ORIENT_RIGHT:
+            gtk_widget_set_halign (applet->box, GTK_ALIGN_CENTER);
+            break;
+        case MATE_PANEL_APPLET_ORIENT_UP:
+        case MATE_PANEL_APPLET_ORIENT_DOWN:
+            gtk_widget_set_halign (applet->box, GTK_ALIGN_START);
+            break;
+    }
+
+    applet->icon = gtk_image_new ();
+    gtk_box_pack_start (GTK_BOX (applet->box), applet->icon, FALSE, FALSE, 0);
+
+    applet->labels_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
+    gtk_box_pack_start (GTK_BOX (applet->box), applet->labels_box, FALSE, FALSE, 0);
+    gtk_widget_show (applet->labels_box);
+
+    applet->label = gtk_label_new (NULL);
+    gtk_box_pack_start (GTK_BOX (applet->labels_box), applet->label,
+                        FALSE, FALSE, 0);
+
+    applet->unit_label = gtk_label_new (NULL);
+    gtk_box_pack_start (GTK_BOX (applet->labels_box), applet->unit_label,
+                        FALSE, FALSE, 0);
+}
+
+static void
+cpufreq_applet_class_init (CPUFreqAppletClass *klass)
+{
+    MatePanelAppletClass *applet_class = MATE_PANEL_APPLET_CLASS (klass);
+    GObjectClass         *gobject_class = G_OBJECT_CLASS (klass);
+    GtkWidgetClass       *widget_class = GTK_WIDGET_CLASS (klass);
+
+    gobject_class->dispose = cpufreq_applet_dispose;
+
+    widget_class->size_allocate = cpufreq_applet_size_allocate;
+    widget_class->style_updated = cpufreq_applet_style_updated;
+    widget_class->button_press_event = cpufreq_applet_button_press;
+    widget_class->key_press_event = cpufreq_applet_key_press;
+
+    applet_class->change_orient = cpufreq_applet_change_orient;
+}
+
+static void
+cpufreq_applet_dispose (GObject *widget)
+{
+    CPUFreqApplet *applet;
+    gint           i;
+
+    applet = CPUFREQ_APPLET (widget);
+
+    if (applet->monitor) {
+        g_object_unref (G_OBJECT (applet->monitor));
+        applet->monitor = NULL;
+    }
+
+    for (i = 0; i <= 3; i++) {
+         if (applet->surfaces[i]) {
+             cairo_surface_destroy (applet->surfaces[i]);
+             applet->surfaces[i] = NULL;
+         }
+    }
+
+    if (applet->prefs) {
+        g_object_unref (applet->prefs);
+        applet->prefs = NULL;
+    }
+
+    if (applet->popup) {
+        g_object_unref (applet->popup);
+        applet->popup = NULL;
+    }
+
+    G_OBJECT_CLASS (cpufreq_applet_parent_class)->dispose (widget);
+}
+
+static void
+cpufreq_applet_size_allocate (GtkWidget     *widget,
+                              GtkAllocation *allocation)
+{
+    CPUFreqApplet *applet;
+    gint           size = 0;
+
+    applet = CPUFREQ_APPLET (widget);
+
+    switch (applet->orient) {
+        case MATE_PANEL_APPLET_ORIENT_LEFT:
+        case MATE_PANEL_APPLET_ORIENT_RIGHT:
+            size = allocation->width;
+            break;
+        case MATE_PANEL_APPLET_ORIENT_UP:
+        case MATE_PANEL_APPLET_ORIENT_DOWN:
+            size = allocation->height;
+            break;
+    }
+
+    if (size != applet->size) {
+        applet->size = size;
+        cpufreq_applet_refresh (applet);
+    }
+
+    GTK_WIDGET_CLASS (cpufreq_applet_parent_class)->size_allocate (widget, allocation);
+}
+
+static void
+cpufreq_applet_menu_popup (CPUFreqApplet *applet,
+                           guint32        time)
+{
+    GtkWidget *menu;
+
+    if (!cpufreq_utils_selector_is_available ())
+        return;
+
+    if (!applet->popup) {
+        applet->popup = cpufreq_popup_new ();
+        cpufreq_popup_set_monitor (applet->popup, applet->monitor);
+        cpufreq_popup_set_parent (applet->popup, GTK_WIDGET (applet));
+    }
+
+    menu = cpufreq_popup_get_menu (applet->popup);
+
+    if (!menu)
+        return;
+
+    /* Set up theme and transparency support */
+    GtkWidget *toplevel = gtk_widget_get_toplevel (menu);
+    /* Fix any failures of compiz/other wm's to communicate with gtk for transparency */
+    GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (toplevel));
+    GdkVisual *visual = gdk_screen_get_rgba_visual (screen);
+    gtk_widget_set_visual (GTK_WIDGET (toplevel), visual);
+    /* Set menu and it's toplevel window to follow panel theme */
+    GtkStyleContext *context;
+    context = gtk_widget_get_style_context (GTK_WIDGET (toplevel));
+    gtk_style_context_add_class (context, "gnome-panel-menu-bar");
+    gtk_style_context_add_class (context, "mate-panel-menu-bar");
+
+    gtk_menu_popup_at_widget (GTK_MENU (menu),
+                              GTK_WIDGET (applet),
+                              GDK_GRAVITY_SOUTH_WEST,
+                              GDK_GRAVITY_NORTH_WEST,
+                              NULL);
+}
+
+static gboolean
+cpufreq_applet_button_press (GtkWidget      *widget,
+                             GdkEventButton *event)
+{
+    CPUFreqApplet *applet;
+
+    applet = CPUFREQ_APPLET (widget);
+
+    if (event->button == 2)
+        return FALSE;
+
+    if ((event->button == 1) &&
+        (event->type != GDK_2BUTTON_PRESS) &&
+        (event->type != GDK_3BUTTON_PRESS))
+    {
+        cpufreq_applet_menu_popup (applet, event->time);
+
+        return TRUE;
+    }
+
+    return GTK_WIDGET_CLASS (cpufreq_applet_parent_class)->button_press_event (widget, event);
+}
+
+static gboolean
+cpufreq_applet_key_press (GtkWidget   *widget,
+                          GdkEventKey *event)
+{
+    CPUFreqApplet *applet;
+
+    applet = CPUFREQ_APPLET (widget);
+
+    switch (event->keyval) {
+        case GDK_KEY_KP_Enter:
+        case GDK_KEY_ISO_Enter:
+        case GDK_KEY_3270_Enter:
+        case GDK_KEY_Return:
+        case GDK_KEY_space:
+        case GDK_KEY_KP_Space:
+            cpufreq_applet_menu_popup (applet, event->time);
+
+            return TRUE;
+        default:
+            break;
+        }
+
+    return GTK_WIDGET_CLASS (cpufreq_applet_parent_class)->key_press_event (widget, event);
+}
+
+static void
+cpufreq_applet_change_orient (MatePanelApplet       *pa,
+                              MatePanelAppletOrient  orient)
+{
+    CPUFreqApplet *applet;
+    GtkAllocation  allocation;
+    gint           size;
+
+    applet = CPUFREQ_APPLET (pa);
+
+    applet->orient = orient;
+
+    gtk_widget_get_allocation (GTK_WIDGET (applet), &allocation);
+
+    if ((orient == MATE_PANEL_APPLET_ORIENT_LEFT) ||
+        (orient == MATE_PANEL_APPLET_ORIENT_RIGHT))
+    {
+        size = allocation.width;
+        gtk_widget_set_halign (applet->box, GTK_ALIGN_CENTER);
+    } else {
+        size = allocation.height;
+        gtk_widget_set_halign (applet->box, GTK_ALIGN_START);
+    }
+
+    if (size != applet->size) {
+        applet->size = size;
+        cpufreq_applet_refresh (applet);
+    }
+}
+
+static void
+cpufreq_applet_style_updated (GtkWidget *widget)
+{
+    CPUFreqApplet *applet;
+
+    applet = CPUFREQ_APPLET (widget);
+
+    cpufreq_applet_refresh (applet);
+
+    /* Reset label sizes to zero that have been held to maximum reached width */
+    gtk_widget_set_size_request (GTK_WIDGET (applet->label), 0, 0);
+    gtk_widget_set_size_request (GTK_WIDGET (applet->unit_label), 0, 0);
+}
+
+static void
+cpufreq_applet_preferences_cb (GtkAction     *action,
+                               CPUFreqApplet *applet)
+{
+    cpufreq_preferences_dialog_run (applet->prefs,
+                                    gtk_widget_get_screen (GTK_WIDGET (applet)));
+}
+
+static void
+cpufreq_applet_help_cb (GtkAction     *action,
+                        CPUFreqApplet *applet)
+{
+    GError *error = NULL;
+
+    gtk_show_uri_on_window (NULL,
+                            "help:mate-cpufreq-applet",
+                            gtk_get_current_event_time (),
+                            &error);
+
+    if (error) {
+        cpufreq_utils_display_error (_("Could not open help document"),
+                                     error->message);
+        g_error_free (error);
+    }
+}
+
+static void
+cpufreq_applet_about_cb (GtkAction     *action,
+                         CPUFreqApplet *applet)
+{
+    static const gchar *const authors[] = {
+        "Carlos Garcia Campos <carlosgc@gnome.org>",
+        NULL
+    };
+    static const gchar* documenters[] = {
+        "Carlos Garcia Campos <carlosgc@gnome.org>",
+        "Davyd Madeley <davyd@madeley.id.au>",
+        N_("MATE Documentation Team"),
+        NULL
+    };
+    static const gchar *const artists[] = {
+        "Pablo Arroyo Loma <zzioma@yahoo.es>",
+        NULL
+    };
+
+#ifdef ENABLE_NLS
+    const char **p;
+    for (p = documenters; *p; ++p)
+         *p = _(*p);
+#endif
+
+    gtk_show_about_dialog (NULL,
+                           "title",              _("About CPU Frequency Scaling Monitor"),
+                           "version",            VERSION,
+                           "copyright",          _("Copyright \xC2\xA9 2004 Carlos Garcia Campos\n"
+                                                 "Copyright \xc2\xa9 2012-2021 MATE developers"),
+                           "comments",           _("This utility shows the current CPU "
+                                                 "Frequency Scaling."),
+                           "authors",            authors,
+                           "documenters",        documenters,
+                           "artists",            artists,
+                           "translator-credits", _("translator-credits"),
+                           "logo-icon-name",     "mate-cpu-frequency-applet",
+                            NULL);
+}
+
+static void
+cpufreq_applet_pixmap_set_image (CPUFreqApplet *applet,
+                                 gint           perc)
+{
+    gint image;
+    gint scale;
+    gint size = 24; /* FIXME */
+
+    /* 0-29   -> 25%
+     * 30-69  -> 50%
+     * 70-89  -> 75%
+     * 90-100 -> 100%
+     */
+    if (perc < 30)
+        image = 0;
+    else if ((perc >= 30) && (perc < 70))
+        image = 1;
+    else if ((perc >= 70) && (perc < 90))
+        image = 2;
+    else if ((perc >= 90) && (perc <= 100))
+        image = 3;
+    else
+        image = 4;
+
+    scale = gtk_widget_get_scale_factor (GTK_WIDGET (applet->icon));
+
+    if (applet->surfaces[image] == NULL) {
+        GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_scale (cpufreq_icons[image],
+                                                               size * scale,
+                                                               size * scale,
+                                                               TRUE,
+                                                               NULL);
+        applet->surfaces[image] = gdk_cairo_surface_create_from_pixbuf (pixbuf, scale, NULL);
+    }
+
+    gtk_image_set_from_surface (GTK_IMAGE (applet->icon), applet->surfaces[image]);
+}
+
+static gboolean
+refresh_cb (CPUFreqApplet *applet)
+{
+    cpufreq_applet_refresh (applet);
+
+    return FALSE;
+}
+
+static void
+cpufreq_applet_update_visibility (CPUFreqApplet *applet)
+{
+    CPUFreqShowMode     show_mode;
+    CPUFreqShowTextMode show_text_mode;
+    gboolean            show_freq = FALSE;
+    gboolean            show_perc = FALSE;
+    gboolean            show_unit = FALSE;
+    gboolean            show_icon = FALSE;
+    gboolean            changed = FALSE;
+    gboolean            need_update = FALSE;
+
+    show_mode = cpufreq_prefs_get_show_mode (applet->prefs);
+    show_text_mode = cpufreq_prefs_get_show_text_mode (applet->prefs);
+
+    if (show_mode != CPUFREQ_MODE_GRAPHIC) {
+        show_icon = (show_mode == CPUFREQ_MODE_BOTH);
+
+        switch (show_text_mode) {
+            case CPUFREQ_MODE_TEXT_FREQUENCY:
+                show_freq = TRUE;
+                break;
+            case CPUFREQ_MODE_TEXT_PERCENTAGE:
+                show_perc = TRUE;
+                break;
+            case CPUFREQ_MODE_TEXT_FREQUENCY_UNIT:
+                show_freq = TRUE;
+                show_unit = TRUE;
+                break;
+        }
+    } else {
+        show_icon = TRUE;
+    }
+
+    if (applet->show_mode != show_mode) {
+        applet->show_mode = show_mode;
+        need_update = TRUE;
+    }
+
+    if (applet->show_text_mode != show_text_mode) {
+        applet->show_text_mode = show_text_mode;
+        need_update = TRUE;
+    }
+
+    if (show_freq != applet->show_freq) {
+        applet->show_freq = show_freq;
+        changed = TRUE;
+    }
+
+    if (show_perc != applet->show_perc) {
+        applet->show_perc = show_perc;
+        changed = TRUE;
+    }
+
+    if (changed) {
+        g_object_set (G_OBJECT (applet->label),
+                      "visible",
+                      applet->show_freq || applet->show_perc,
+                      NULL);
+    }
+
+    if (show_unit != applet->show_unit) {
+        applet->show_unit = show_unit;
+        changed = TRUE;
+
+        g_object_set (G_OBJECT (applet->unit_label),
+                      "visible", applet->show_unit,
+                      NULL);
+    }
+
+    if (show_icon != applet->show_icon) {
+        applet->show_icon = show_icon;
+        changed = TRUE;
+
+        g_object_set (G_OBJECT (applet->icon),
+                      "visible", applet->show_icon,
+                      NULL);
+    }
+
+    if (changed)
+        g_idle_add ((GSourceFunc)refresh_cb, applet);
+
+    if (need_update)
+        cpufreq_applet_update (applet, applet->monitor);
+}
+
+static void
+cpufreq_applet_update (CPUFreqApplet  *applet,
+                       CPUFreqMonitor *monitor)
+{
+   gchar          *text_mode = NULL;
+   gchar          *freq_label, *unit_label;
+   gint            freq;
+   gint            perc;
+   guint           cpu;
+   GtkRequisition  req;
+   const gchar    *governor;
+
+   cpu = cpufreq_monitor_get_cpu (monitor);
+   freq = cpufreq_monitor_get_frequency (monitor);
+   perc = cpufreq_monitor_get_percentage (monitor);
+   governor = cpufreq_monitor_get_governor (monitor);
+
+   freq_label = cpufreq_utils_get_frequency_label (freq);
+   unit_label = cpufreq_utils_get_frequency_unit (freq);
+
+   if (applet->show_freq) {
+       /* Force the label to render if frequencies are not found right away */
+       if (freq_label == NULL) {
+           gtk_label_set_text (GTK_LABEL (applet->label),"---");
+       }
+        else {
+           gtk_label_set_text (GTK_LABEL (applet->label), freq_label);
+        }
+        /*Hold the largest size set by any jumping text */
+        gtk_widget_get_preferred_size (GTK_WIDGET (applet->label),&req, NULL);
+        gtk_widget_set_size_request (GTK_WIDGET (applet->label),req.width, req.height);
+    }
+
+    if (applet->show_perc) {
+        gchar *text_perc;
+
+        text_perc = g_strdup_printf ("%d%%", perc);
+        gtk_label_set_text (GTK_LABEL (applet->label), text_perc);
+        g_free (text_perc);
+    }
+
+    if (applet->show_unit) {
+        gtk_label_set_text (GTK_LABEL (applet->unit_label), unit_label);
+        /* Hold the largest size set by MHZ or GHZ to prevent jumping */
+        gtk_widget_get_preferred_size (GTK_WIDGET (applet->unit_label),&req, NULL);
+        gtk_widget_set_size_request (GTK_WIDGET (applet->unit_label),req.width, req.height);
+    }
+
+    if (applet->show_icon) {
+        cpufreq_applet_pixmap_set_image (applet, perc);
+    }
+
+    if (governor) {
+        gchar *gov_text;
+
+        gov_text = g_strdup (governor);
+        gov_text[0] = g_ascii_toupper (gov_text[0]);
+        text_mode = g_strdup_printf ("%s\n%s %s (%d%%)",
+                                     gov_text, freq_label,
+                                     unit_label, perc);
+        g_free (gov_text);
+    }
+
+    g_free (freq_label);
+    g_free (unit_label);
+
+    if (text_mode) {
+        gchar *text_tip;
+
+        text_tip = cpufreq_utils_get_n_cpus () == 1 ?
+            g_strdup_printf ("%s", text_mode) :
+            g_strdup_printf ("CPU %u - %s", cpu, text_mode);
+        g_free (text_mode);
+
+        gtk_widget_set_tooltip_text (GTK_WIDGET (applet), text_tip);
+        g_free (text_tip);
+    }
+
+    /* Call refresh only the first time */
+    if (applet->need_refresh) {
+        cpufreq_applet_refresh (applet);
+        applet->need_refresh = FALSE;
+    }
+}
+
+static void
+cpufreq_applet_refresh (CPUFreqApplet *applet)
+{
+    gint      total_size = 0;
+    gint      panel_size, label_size;
+    gint      unit_label_size, pixmap_size;
+    gint      size_step = 12;
+    gboolean  horizontal;
+
+    panel_size = applet->size - 1; /* 1 pixel margin */
+
+    horizontal = ((applet->orient == MATE_PANEL_APPLET_ORIENT_UP) ||
+                  (applet->orient == MATE_PANEL_APPLET_ORIENT_DOWN));
+
+    /* We want a fixed label size, the biggest */
+
+    gtk_widget_get_preferred_width (GTK_WIDGET (applet->label), &label_size, NULL);
+    total_size += label_size;
+
+    gtk_widget_get_preferred_width (GTK_WIDGET (applet->unit_label), &unit_label_size, NULL);
+    total_size += unit_label_size;
+
+    gtk_widget_get_preferred_width (GTK_WIDGET (applet->icon), &pixmap_size, NULL);
+    total_size += pixmap_size;
+
+    if (horizontal) {
+        if ((label_size + pixmap_size) <= panel_size) {
+            gtk_orientable_set_orientation (GTK_ORIENTABLE (applet->box),
+                                            GTK_ORIENTATION_VERTICAL);
+        } else {
+            gtk_orientable_set_orientation (GTK_ORIENTABLE (applet->box),
+                                            GTK_ORIENTATION_HORIZONTAL);
+        }
+
+        gtk_orientable_set_orientation (GTK_ORIENTABLE (applet->labels_box),
+                                        GTK_ORIENTATION_HORIZONTAL);
+    } else {
+        if (total_size <= panel_size) {
+            gtk_orientable_set_orientation (GTK_ORIENTABLE (applet->box),
+                                            GTK_ORIENTATION_HORIZONTAL);
+            gtk_orientable_set_orientation (GTK_ORIENTABLE (applet->labels_box),
+                                            GTK_ORIENTATION_HORIZONTAL);
+        } else if ((label_size + unit_label_size) <= (panel_size - size_step)) {
+            gtk_orientable_set_orientation (GTK_ORIENTABLE (applet->box),
+                                            GTK_ORIENTATION_VERTICAL);
+            gtk_orientable_set_orientation (GTK_ORIENTABLE (applet->labels_box),
+                                            GTK_ORIENTATION_HORIZONTAL);
+        } else {
+            gtk_orientable_set_orientation (GTK_ORIENTABLE (applet->box),
+                                            GTK_ORIENTATION_VERTICAL);
+            gtk_orientable_set_orientation (GTK_ORIENTABLE (applet->labels_box),
+                                            GTK_ORIENTATION_VERTICAL);
+        }
+    }
+}
+
+/* Preferences callbacks */
+static void
+cpufreq_applet_prefs_cpu_changed (CPUFreqPrefs  *prefs,
+                                  GParamSpec    *arg1,
+                                  CPUFreqApplet *applet)
+{
+    cpufreq_monitor_set_cpu (applet->monitor,
+                             cpufreq_prefs_get_cpu (applet->prefs));
+}
+
+static void
+cpufreq_applet_prefs_show_mode_changed (CPUFreqPrefs  *prefs,
+                                        GParamSpec    *arg1,
+                                        CPUFreqApplet *applet)
+{
+    cpufreq_applet_update_visibility (applet);
+}
+
+static void
+cpufreq_applet_setup (CPUFreqApplet *applet)
+{
+    GtkActionGroup *action_group;
+    AtkObject      *atk_obj;
+    GSettings      *settings;
+
+#ifndef ENABLE_IN_PROCESS
+    g_set_application_name  (_("CPU Frequency Scaling Monitor"));
+#endif
+
+    gtk_window_set_default_icon_name ("mate-cpu-frequency-applet");
+
+    /* Preferences */
+    if (applet->prefs)
+        g_object_unref (applet->prefs);
+
+    settings = mate_panel_applet_settings_new (MATE_PANEL_APPLET (applet), "org.mate.panel.applet.cpufreq");
+    applet->prefs = cpufreq_prefs_new (settings);
+
+    g_signal_connect (applet->prefs, "notify::cpu",
+                      G_CALLBACK (cpufreq_applet_prefs_cpu_changed),
+                      applet);
+
+    g_signal_connect (applet->prefs, "notify::show-mode",
+                      G_CALLBACK (cpufreq_applet_prefs_show_mode_changed),
+                      applet);
+
+    g_signal_connect (applet->prefs, "notify::show-text-mode",
+                      G_CALLBACK (cpufreq_applet_prefs_show_mode_changed),
+                      applet);
+
+    /* Monitor */
+    applet->monitor =
+        cpufreq_monitor_factory_create_monitor (cpufreq_prefs_get_cpu (applet->prefs));
+
+    cpufreq_monitor_run (applet->monitor);
+
+    g_signal_connect_swapped (applet->monitor, "changed",
+                              G_CALLBACK (cpufreq_applet_update),
+                              applet);
+
+    /* Setup the menus */
+    action_group = gtk_action_group_new ("CPUFreq Applet Actions");
+    gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+    gtk_action_group_add_actions (action_group,
+                                  cpufreq_applet_menu_actions,
+                                  G_N_ELEMENTS (cpufreq_applet_menu_actions),
+                                  applet);
+    mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (applet),
+                                                CPUFREQ_RESOURCE_PATH "cpufreq-applet-menu.xml",
+                                                action_group);
+
+    if (mate_panel_applet_get_locked_down (MATE_PANEL_APPLET (applet))) {
+        GtkAction *action;
+
+        action = gtk_action_group_get_action (action_group, "CPUFreqPreferences");
+        gtk_action_set_visible (action, FALSE);
+    }
+    g_object_unref (action_group);
+
+    atk_obj = gtk_widget_get_accessible (GTK_WIDGET (applet));
+
+    if (GTK_IS_ACCESSIBLE (atk_obj)) {
+        atk_object_set_name (atk_obj, _("CPU Frequency Scaling Monitor"));
+        atk_object_set_description (atk_obj, _("This utility shows the current CPU Frequency"));
+    }
+
+    cpufreq_applet_update_visibility (applet);
+
+    gtk_widget_show (GTK_WIDGET (applet));
+}
+
+static gboolean
+cpufreq_applet_factory (CPUFreqApplet *applet,
+                        const gchar *iid,
+                        gpointer gdata)
+{
+    gboolean retval = FALSE;
+
+    if (!strcmp (iid, "CPUFreqApplet")) {
+        cpufreq_applet_setup (applet);
+
+        retval = TRUE;
+    }
+
+    return retval;
+}
+
+PANEL_APPLET_FACTORY ("CPUFreqAppletFactory",
+                      CPUFREQ_TYPE_APPLET,
+                      "cpufreq-applet",
+                      (MatePanelAppletFactoryCallback) cpufreq_applet_factory,
+                      NULL)
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/3.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/3.html new file mode 100644 index 00000000..54b5e378 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/3.html @@ -0,0 +1,707 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
/* battstat        A MATE battery meter for laptops.
+ * Copyright (C) 2000 by Jörgen Pehrson <jp@spektr.eu.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ $Id$
+ */
+
+/*
+ * ACPI battery functions for FreeBSD >= 5.2.
+ * September 2004 by Joe Marcus Clarke <marcus@FreeBSD.org>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/sysctl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/ioctl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <machine/apm_bios.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <errno.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <fcntl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "acpi-freebsd.h"
+
+#ifdef HAVE_ACPIIO
+
+#include <dev/acpica/acpiio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+static gboolean
+update_ac_info(struct acpi_info * acpiinfo)
+{
+  int acline;
+  size_t len = sizeof(acline);
+
+  acpiinfo->ac_online = FALSE;
+
+  if (sysctlbyname(ACPI_ACLINE, &acline, &len, NULL, 0) == -1) {
+    return FALSE;
+  }
+
+  acpiinfo->ac_online = acline ? TRUE : FALSE;
+
+  return TRUE;
+}
+
+static gboolean
+update_battery_info(struct acpi_info * acpiinfo)
+{
+  union acpi_battery_ioctl_arg battio;
+  int i;
+
+  /* We really don't have to do this here.  All of the relevant battery
+   * info can be obtained through sysctl.  However, one day, the rate
+   * may be useful to get time left to full charge.
+   */
+
+  for(i = BATT_MIN; i < BATT_MAX; i++) {
+    battio.unit = i;
+    if (ioctl(acpiinfo->acpifd, ACPIIO_CMBAT_GET_BIF, &battio) == -1) {
+      continue;
+    }
+
+    acpiinfo->max_capacity += battio.bif.lfcap;
+    acpiinfo->low_capacity += battio.bif.wcap;
+    acpiinfo->critical_capacity += battio.bif.lcap;
+  }
+
+  return TRUE;
+}
+
+gboolean
+acpi_freebsd_init(struct acpi_info * acpiinfo)
+{
+  int acpi_fd;
+
+  g_assert(acpiinfo);
+
+  acpi_fd = open(ACPIDEV, O_RDONLY);
+  if (acpi_fd >= 0) {
+    acpiinfo->acpifd = acpi_fd;
+  }
+  else {
+    acpiinfo->acpifd = -1;
+    return FALSE;
+  }
+
+  update_battery_info(acpiinfo);
+  update_ac_info(acpiinfo);
+
+  return TRUE;
+}
+
+void
+acpi_freebsd_cleanup(struct acpi_info * acpiinfo)
+{
+  g_assert(acpiinfo);
+
+  if (acpiinfo->acpifd >= 0) {
+    close(acpiinfo->acpifd);
+    acpiinfo->acpifd = -1;
+  }
+}
+
+/* XXX This is a hack since user-land applications can't get ACPI events yet.
+ * Devd provides this (or supposedly provides this), but you need to be
+ * root to access devd.
+ */
+gboolean
+acpi_process_event(struct acpi_info * acpiinfo)
+{
+  g_assert(acpiinfo);
+
+  update_ac_info(acpiinfo);
+  update_battery_info(acpiinfo);
+
+  return TRUE;
+}
+
+gboolean
+acpi_freebsd_read(struct apm_info *apminfo, struct acpi_info * acpiinfo)
+{
+  int time;
+  int life;
+  int state;
+  size_t len;
+  int rate;
+  int remain;
+  union acpi_battery_ioctl_arg battio;
+  gboolean charging;
+  int i;
+
+  g_assert(acpiinfo);
+
+  charging = FALSE;
+
+  for(i = BATT_MIN; i < BATT_MAX; i++) {
+    battio.unit = i;
+    if (ioctl(acpiinfo->acpifd, ACPIIO_CMBAT_GET_BST, &battio) == -1) {
+      continue;
+    }
+
+    remain += battio.bst.cap;<--- Uninitialized variable: remain
+    rate += battio.bst.rate;<--- Uninitialized variable: rate
+  }
+
+  len = sizeof(time);
+  if (sysctlbyname(ACPI_TIME, &time, &len, NULL, 0) == -1) {
+    return FALSE;
+  }
+
+  len = sizeof(life);
+  if (sysctlbyname(ACPI_LIFE, &life, &len, NULL, 0) == -1) {
+    return FALSE;
+  }
+
+  len = sizeof(state);
+  if (sysctlbyname(ACPI_STATE, &state, &len, NULL, 0) == -1) {
+    return FALSE;
+  }
+
+  apminfo->ai_acline = acpiinfo->ac_online ? 1 : 0;
+  if (state & ACPI_BATT_STAT_CHARGING) {
+    apminfo->ai_batt_stat = 3;
+    charging = TRUE;
+  }
+  else if (state & ACPI_BATT_STAT_CRITICAL) {
+    /* Add a special check here since FreeBSD's ACPI interface will tell us
+     * when the battery is critical.
+     */
+    apminfo->ai_batt_stat = 2;
+  }
+  else {
+    apminfo->ai_batt_stat = remain < acpiinfo->low_capacity ? 1 : remain < acpiinfo->critical_capacity ? 2 : 0;
+  }
+  apminfo->ai_batt_life = life;
+  if (!charging) {
+    apminfo->ai_batt_time = time;
+  }
+  else if (rate > 0) {
+    apminfo->ai_batt_time = (int) ((acpiinfo->max_capacity-remain)/(float)rate);
+  }
+  else
+    apminfo->ai_batt_time = -1;
+
+  return TRUE;
+}
+
+#else /* !defined(HAVE_ACPIIO) */
+
+gboolean
+acpi_freebsd_init(struct acpi_info * acpiinfo)
+{
+  return FALSE;
+}
+
+gboolean
+acpi_process_event(struct acpi_info * acpiinfo)
+{
+  return FALSE;
+}
+
+gboolean
+acpi_freebsd_read(struct apm_info *apminfo, struct acpi_info * acpiinfo)
+{
+  return FALSE;
+}
+
+void
+acpi_freebsd_cleanup(struct acpi_info * acpiinfo)
+{
+}
+
+#endif /* defined(HAVE_ACPIIO) */
+
+#endif /* defined(__FreeBSD__) || defined(__FreeBSD_kernel__) */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/35.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/35.html new file mode 100644 index 00000000..7bd74254 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/35.html @@ -0,0 +1,1027 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
/*
+ * MATE CPUFreq Applet
+ * Copyright (C) 2004 Carlos Garcia Campos <carlosgc@gnome.org>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This 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
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Authors : Carlos García Campos <carlosgc@gnome.org>
+ */
+
+#include "cpufreq-monitor.h"
+
+#define CPUFREQ_MONITOR_INTERVAL 1
+
+/* Properties */
+enum {
+    PROP_0,
+    PROP_CPU,
+    PROP_ONLINE,
+    PROP_FREQUENCY,
+    PROP_MAX_FREQUENCY,
+    PROP_GOVERNOR
+};
+
+/* Signals */
+enum {
+    SIGNAL_CHANGED,
+    N_SIGNALS
+};
+
+struct _CPUFreqMonitorPrivate {
+    guint    cpu;
+    gboolean online;
+    gint     cur_freq;
+    gint     max_freq;
+    gchar   *governor;
+    GList   *available_freqs;
+    GList   *available_govs;
+    guint    timeout_handler;
+
+    gboolean changed;
+};
+
+static void   cpufreq_monitor_finalize     (GObject             *object);
+
+static void   cpufreq_monitor_set_property (GObject             *object,
+                                            guint                prop_id,
+                                            const GValue        *value,
+                                            GParamSpec          *spec);
+static void   cpufreq_monitor_get_property (GObject             *object,
+                                            guint                prop_id,
+                                            GValue              *value,
+                                            GParamSpec          *spec);
+
+static guint signals[N_SIGNALS] = { 0 };
+
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (CPUFreqMonitor, cpufreq_monitor, G_TYPE_OBJECT)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE is a macro then please configure it.
+
+static void
+cpufreq_monitor_init (CPUFreqMonitor *monitor)
+{
+    monitor->priv = cpufreq_monitor_get_instance_private (monitor);
+
+    monitor->priv->governor = NULL;
+    monitor->priv->available_freqs = NULL;
+    monitor->priv->available_govs = NULL;
+    monitor->priv->timeout_handler = 0;
+
+    monitor->priv->changed = FALSE;
+}
+
+static void
+cpufreq_monitor_class_init (CPUFreqMonitorClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+    object_class->set_property = cpufreq_monitor_set_property;
+    object_class->get_property = cpufreq_monitor_get_property;
+
+    /* Public virtual methods */
+    klass->run = NULL;
+    klass->get_available_frequencies = NULL;
+    klass->get_available_governors = NULL;
+
+    /* Porperties */
+    g_object_class_install_property (object_class,
+                                     PROP_CPU,
+                                     g_param_spec_uint ("cpu",
+                                                        "CPU",
+                                                        "The cpu to monitor",
+                                                        0,
+                                                        G_MAXUINT,
+                                                        0,
+                                                        G_PARAM_CONSTRUCT |
+                                                        G_PARAM_READWRITE));
+    g_object_class_install_property (object_class,
+                                     PROP_ONLINE,
+                                     g_param_spec_boolean ("online",
+                                                           "Online",
+                                                           "Whether cpu is online",
+                                                           TRUE,
+                                                           G_PARAM_READWRITE));
+    g_object_class_install_property (object_class,
+                                     PROP_FREQUENCY,
+                                     g_param_spec_int ("frequency",
+                                                       "Frequency",
+                                                       "The current cpu frequency",
+                                                       0,
+                                                       G_MAXINT,
+                                                       0,
+                                                       G_PARAM_READWRITE));
+    g_object_class_install_property (object_class,
+                                     PROP_MAX_FREQUENCY,
+                                     g_param_spec_int ("max-frequency",
+                                                       "MaxFrequency",
+                                                       "The max cpu frequency",
+                                                       -1,
+                                                       G_MAXINT,
+                                                       0,
+                                                       G_PARAM_READWRITE));
+    g_object_class_install_property (object_class,
+                                     PROP_GOVERNOR,
+                                     g_param_spec_string ("governor",
+                                                          "Governor",
+                                                          "The current cpufreq governor",
+                                                          NULL,
+                                                          G_PARAM_READWRITE));
+
+    /* Signals */
+    signals[SIGNAL_CHANGED] =
+            g_signal_new ("changed",
+                          G_TYPE_FROM_CLASS (klass),
+                          G_SIGNAL_RUN_LAST,
+                          G_STRUCT_OFFSET (CPUFreqMonitorClass, changed),
+                          NULL, NULL,
+                          g_cclosure_marshal_VOID__VOID,
+                          G_TYPE_NONE, 0);
+
+    object_class->finalize = cpufreq_monitor_finalize;
+}
+
+static void
+cpufreq_monitor_finalize (GObject *object)
+{
+    CPUFreqMonitor *monitor = CPUFREQ_MONITOR (object);
+
+    monitor->priv->online = FALSE;
+
+    if (monitor->priv->timeout_handler > 0) {
+        g_source_remove (monitor->priv->timeout_handler);
+        monitor->priv->timeout_handler = 0;
+    }
+
+    if (monitor->priv->governor) {
+        g_free (monitor->priv->governor);
+        monitor->priv->governor = NULL;
+    }
+
+    if (monitor->priv->available_freqs) {
+        g_list_free_full (monitor->priv->available_freqs, g_free);
+        monitor->priv->available_freqs = NULL;
+    }
+
+    if (monitor->priv->available_govs) {
+        g_list_free_full (monitor->priv->available_govs, g_free);
+        monitor->priv->available_govs = NULL;
+    }
+
+    G_OBJECT_CLASS (cpufreq_monitor_parent_class)->finalize (object);
+}
+
+static void
+cpufreq_monitor_set_property (GObject      *object,
+                              guint         prop_id,
+                              const GValue *value,
+                              GParamSpec   *spec)
+{
+    CPUFreqMonitor *monitor;
+
+    monitor = CPUFREQ_MONITOR (object);
+
+    switch (prop_id) {
+    case PROP_CPU: {
+        guint cpu = g_value_get_uint (value);
+
+        if (cpu != monitor->priv->cpu) {
+            monitor->priv->cpu = cpu;
+            monitor->priv->changed = TRUE;
+        }
+        break;
+    }
+    case PROP_ONLINE:
+        monitor->priv->online = g_value_get_boolean (value);
+
+        break;
+    case PROP_FREQUENCY: {
+        gint freq = g_value_get_int (value);
+
+        if (freq != monitor->priv->cur_freq) {
+            monitor->priv->cur_freq = freq;
+            monitor->priv->changed = TRUE;
+        }
+        break;
+    }
+    case PROP_MAX_FREQUENCY: {
+        gint freq = g_value_get_int (value);
+
+        if (freq != monitor->priv->max_freq) {
+            monitor->priv->max_freq = freq;
+            monitor->priv->changed = TRUE;
+        }
+        break;
+    }
+    case PROP_GOVERNOR: {
+        const gchar *gov = g_value_get_string (value);
+
+        if (monitor->priv->governor) {
+            if (g_ascii_strcasecmp (gov, monitor->priv->governor) != 0) {
+                g_free (monitor->priv->governor);
+                monitor->priv->governor = gov ? g_strdup (gov) : NULL;
+                monitor->priv->changed = TRUE;
+            }
+        } else {
+            monitor->priv->governor = gov ? g_strdup (gov) : NULL;
+            monitor->priv->changed = TRUE;
+        }
+        break;
+    }
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
+    }
+}
+
+static void
+cpufreq_monitor_get_property (GObject    *object,
+                              guint       prop_id,
+                              GValue     *value,
+                              GParamSpec *spec)
+{
+    CPUFreqMonitor *monitor;
+
+    monitor = CPUFREQ_MONITOR (object);
+
+    switch (prop_id) {
+    case PROP_CPU:
+        g_value_set_uint (value, monitor->priv->cpu);
+        break;
+    case PROP_ONLINE:
+        g_value_set_boolean (value, monitor->priv->online);
+        break;
+    case PROP_FREQUENCY:
+        g_value_set_int (value, monitor->priv->cur_freq);
+        break;
+    case PROP_MAX_FREQUENCY:
+        g_value_set_int (value, monitor->priv->max_freq);
+        break;
+    case PROP_GOVERNOR:
+        g_value_set_string (value, monitor->priv->governor);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
+    }
+}
+
+static gboolean
+cpufreq_monitor_run_cb (CPUFreqMonitor *monitor)
+{
+    CPUFreqMonitorClass *class;
+    gboolean             retval = FALSE;
+
+    class = CPUFREQ_MONITOR_GET_CLASS (monitor);
+
+    if (class->run)
+        retval = class->run (monitor);
+
+    if (monitor->priv->changed) {
+        g_signal_emit (monitor, signals[SIGNAL_CHANGED], 0);
+        monitor->priv->changed = FALSE;
+    }
+
+    return retval;
+}
+
+void
+cpufreq_monitor_run (CPUFreqMonitor *monitor)
+{
+    g_return_if_fail (CPUFREQ_IS_MONITOR (monitor));
+
+    if (monitor->priv->timeout_handler > 0)
+        return;
+
+    monitor->priv->timeout_handler =
+        g_timeout_add_seconds (CPUFREQ_MONITOR_INTERVAL,
+                               (GSourceFunc) cpufreq_monitor_run_cb,
+                               (gpointer) monitor);
+}
+
+GList *
+cpufreq_monitor_get_available_frequencies (CPUFreqMonitor *monitor)
+{
+    CPUFreqMonitorClass *class;
+
+    g_return_val_if_fail (CPUFREQ_IS_MONITOR (monitor), NULL);
+
+    if (!monitor->priv->online)
+        return NULL;
+
+    if (monitor->priv->available_freqs)
+        return monitor->priv->available_freqs;
+
+    class = CPUFREQ_MONITOR_GET_CLASS (monitor);
+
+    if (class->get_available_frequencies)
+        monitor->priv->available_freqs = class->get_available_frequencies (monitor);
+
+    return monitor->priv->available_freqs;
+}
+
+GList *
+cpufreq_monitor_get_available_governors (CPUFreqMonitor *monitor)
+{
+    CPUFreqMonitorClass *class;
+
+    g_return_val_if_fail (CPUFREQ_IS_MONITOR (monitor), NULL);
+
+    if (!monitor->priv->online)
+        return NULL;
+
+    if (monitor->priv->available_govs)
+        return monitor->priv->available_govs;
+
+    class = CPUFREQ_MONITOR_GET_CLASS (monitor);
+
+    if (class->get_available_governors) {
+        monitor->priv->available_govs = class->get_available_governors (monitor);
+    }
+
+    return monitor->priv->available_govs;
+}
+
+guint
+cpufreq_monitor_get_cpu (CPUFreqMonitor *monitor)
+{
+    g_return_val_if_fail (CPUFREQ_IS_MONITOR (monitor), 0);
+
+    return monitor->priv->cpu;
+}
+
+void
+cpufreq_monitor_set_cpu (CPUFreqMonitor *monitor, guint cpu)
+{
+    g_return_if_fail (CPUFREQ_IS_MONITOR (monitor));
+
+    g_object_set (G_OBJECT (monitor),
+                  "cpu", cpu, NULL);
+}
+
+gint
+cpufreq_monitor_get_frequency (CPUFreqMonitor *monitor)
+{
+    g_return_val_if_fail (CPUFREQ_IS_MONITOR (monitor), -1);
+
+    return monitor->priv->cur_freq;
+}
+
+const gchar *
+cpufreq_monitor_get_governor (CPUFreqMonitor *monitor)
+{
+    g_return_val_if_fail (CPUFREQ_IS_MONITOR (monitor), NULL);
+
+    return monitor->priv->governor;
+}
+
+gint
+cpufreq_monitor_get_percentage (CPUFreqMonitor *monitor)
+{
+    g_return_val_if_fail (CPUFREQ_IS_MONITOR (monitor), -1);
+
+    if (monitor->priv->max_freq > 0) {
+        return ((monitor->priv->cur_freq * 100) / monitor->priv->max_freq);
+    }
+
+    return -1;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/36.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/36.html new file mode 100644 index 00000000..fdb5cd03 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/36.html @@ -0,0 +1,1249 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
/*
+ * MATE CPUFreq Applet
+ * Copyright (C) 2004 Carlos Garcia Campos <carlosgc@gnome.org>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This 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
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Authors : Carlos García Campos <carlosgc@gnome.org>
+ */
+
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "cpufreq-popup.h"
+#include "cpufreq-selector.h"
+#include "cpufreq-utils.h"
+
+struct _CPUFreqPopupPrivate {
+    GtkUIManager        *ui_manager;
+    GSList              *radio_group;
+
+    GtkActionGroup      *freqs_group;
+    GSList              *freqs_actions;
+
+    GtkActionGroup      *govs_group;
+    GSList              *govs_actions;
+
+    guint                merge_id;
+    gboolean             need_build;
+    gboolean             show_freqs;
+
+    CPUFreqMonitor      *monitor;
+    GtkWidget           *parent;
+};
+
+static void cpufreq_popup_finalize   (GObject           *object);
+
+G_DEFINE_TYPE_WITH_PRIVATE (CPUFreqPopup, cpufreq_popup, G_TYPE_OBJECT)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
+
+static const gchar *ui_popup =
+    "<ui>"
+    "    <popup name=\"CPUFreqSelectorPopup\" action=\"PopupAction\">"
+    "        <placeholder name=\"FreqsItemsGroup\">"
+    "        </placeholder>"
+    "        <separator />"
+    "        <placeholder name=\"GovsItemsGroup\">"
+    "        </placeholder>"
+    "    </popup>"
+    "</ui>";
+
+#define FREQS_PLACEHOLDER_PATH "/CPUFreqSelectorPopup/FreqsItemsGroup"
+#define GOVS_PLACEHOLDER_PATH "/CPUFreqSelectorPopup/GovsItemsGroup"
+
+static void
+cpufreq_popup_init (CPUFreqPopup *popup)
+{
+    popup->priv = cpufreq_popup_get_instance_private (popup);
+
+    popup->priv->ui_manager = gtk_ui_manager_new ();
+    popup->priv->radio_group = NULL;
+
+    popup->priv->freqs_group = NULL;
+    popup->priv->freqs_actions = NULL;
+
+    popup->priv->govs_group = NULL;
+    popup->priv->govs_actions = NULL;
+
+    popup->priv->merge_id = 0;
+    popup->priv->need_build = TRUE;
+    popup->priv->show_freqs = FALSE;
+
+    gtk_ui_manager_add_ui_from_string (popup->priv->ui_manager,
+                                       ui_popup, -1, NULL);
+
+    popup->priv->monitor = NULL;
+}
+
+static void
+cpufreq_popup_class_init (CPUFreqPopupClass *klass)
+{
+    GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
+
+    g_object_class->finalize = cpufreq_popup_finalize;
+}
+
+static void
+cpufreq_popup_finalize (GObject *object)
+{
+    CPUFreqPopup *popup = CPUFREQ_POPUP (object);
+
+    if (popup->priv->ui_manager) {
+        g_object_unref (popup->priv->ui_manager);
+        popup->priv->ui_manager = NULL;
+    }
+
+    if (popup->priv->freqs_group) {
+        g_object_unref (popup->priv->freqs_group);
+        popup->priv->freqs_group = NULL;
+    }
+
+    if (popup->priv->freqs_actions) {
+        g_slist_free (popup->priv->freqs_actions);
+        popup->priv->freqs_actions = NULL;
+    }
+
+    if (popup->priv->govs_group) {
+        g_object_unref (popup->priv->govs_group);
+        popup->priv->govs_group = NULL;
+    }
+
+    if (popup->priv->govs_actions) {
+        g_slist_free (popup->priv->govs_actions);
+        popup->priv->govs_actions = NULL;
+    }
+
+    if (popup->priv->monitor) {
+        g_object_unref (popup->priv->monitor);
+        popup->priv->monitor = NULL;
+    }
+
+    G_OBJECT_CLASS (cpufreq_popup_parent_class)->finalize (object);
+}
+
+CPUFreqPopup *
+cpufreq_popup_new (void)
+{
+    CPUFreqPopup *popup;
+
+    popup = CPUFREQ_POPUP (g_object_new (CPUFREQ_TYPE_POPUP,
+                                         NULL));
+
+    return popup;
+}
+
+/* Public methods */
+void
+cpufreq_popup_set_monitor (CPUFreqPopup   *popup,
+                           CPUFreqMonitor *monitor)
+{
+    g_return_if_fail (CPUFREQ_IS_POPUP (popup));
+    g_return_if_fail (CPUFREQ_IS_MONITOR (monitor));
+
+    if (popup->priv->monitor == monitor)
+        return;
+
+    if (popup->priv->monitor)
+        g_object_unref (popup->priv->monitor);
+    popup->priv->monitor = g_object_ref (monitor);
+}
+
+void
+cpufreq_popup_set_parent (CPUFreqPopup *popup,
+                          GtkWidget    *parent)
+{
+    g_return_if_fail (CPUFREQ_IS_POPUP (popup));
+    g_return_if_fail (GTK_IS_WIDGET (parent));
+
+    popup->priv->parent = parent;
+}
+
+static void
+cpufreq_popup_frequencies_menu_activate (GtkAction    *action,
+                                         CPUFreqPopup *popup)
+{
+    CPUFreqSelector *selector;
+    const gchar     *name;
+    guint            cpu;
+    guint            freq;
+
+    if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+        return;
+
+    selector = cpufreq_selector_get_default ();
+
+    cpu = cpufreq_monitor_get_cpu (popup->priv->monitor);
+    name = gtk_action_get_name (action);
+    freq = (guint) atoi (name + strlen ("Frequency"));
+
+    cpufreq_selector_set_frequency_async (selector, cpu, freq);
+}
+
+static void
+cpufreq_popup_governors_menu_activate (GtkAction    *action,
+                                       CPUFreqPopup *popup)
+{
+    CPUFreqSelector *selector;
+    const gchar     *name;
+    guint            cpu;
+    const gchar     *governor;
+
+    if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+        return;
+
+    selector = cpufreq_selector_get_default ();
+
+    cpu = cpufreq_monitor_get_cpu (popup->priv->monitor);
+    name = gtk_action_get_name (action);
+    governor = name + strlen ("Governor");
+
+    cpufreq_selector_set_governor_async (selector, cpu, governor);
+}
+
+static void
+cpufreq_popup_menu_add_action (CPUFreqPopup   *popup,
+                               const gchar    *menu,
+                               GtkActionGroup *action_group,
+                               const gchar    *action_name,
+                               const gchar    *label,
+                               gboolean        sensitive)
+{
+    GtkToggleAction *action;
+    gchar           *name;
+
+    name = g_strdup_printf ("%s%s", menu, action_name);
+
+    action = g_object_new (GTK_TYPE_RADIO_ACTION,
+                           "name", name,
+                           "label", label,
+                           NULL);
+
+    gtk_action_set_sensitive (GTK_ACTION (action), sensitive);
+
+    gtk_radio_action_set_group (GTK_RADIO_ACTION (action), popup->priv->radio_group);
+    popup->priv->radio_group = gtk_radio_action_get_group (GTK_RADIO_ACTION (action));
+
+    if (g_ascii_strcasecmp (menu, "Frequency") == 0) {
+        popup->priv->freqs_actions = g_slist_prepend (popup->priv->freqs_actions,
+                                                      (gpointer) action);
+
+        g_signal_connect (action, "activate",
+                          G_CALLBACK (cpufreq_popup_frequencies_menu_activate),
+                          popup);
+    } else if (g_ascii_strcasecmp (menu, "Governor") == 0) {
+        popup->priv->govs_actions = g_slist_prepend (popup->priv->govs_actions,
+                                                     (gpointer) action);
+
+        g_signal_connect (action, "activate",
+                          G_CALLBACK (cpufreq_popup_governors_menu_activate),
+                          popup);
+    }
+
+    gtk_action_group_add_action (action_group, GTK_ACTION (action));
+    g_object_unref (action);
+
+    g_free (name);
+}
+
+static void
+frequencies_menu_create_actions (CPUFreqPopup *popup)
+{
+    GList *available_freqs;
+
+    available_freqs = cpufreq_monitor_get_available_frequencies (popup->priv->monitor);
+
+    while (available_freqs) {
+        const gchar *text;
+        gchar       *freq_text;
+        gchar       *label;
+        gchar       *unit;
+        gint         freq;
+
+        text = (const gchar *) available_freqs->data;
+        freq = atoi (text);
+
+        freq_text = cpufreq_utils_get_frequency_label (freq);
+        unit = cpufreq_utils_get_frequency_unit (freq);
+
+        label = g_strdup_printf ("%s %s", freq_text, unit);
+        g_free (freq_text);
+        g_free (unit);
+
+        cpufreq_popup_menu_add_action (popup,
+                                       "Frequency",
+                                       popup->priv->freqs_group,
+                                       text, label, TRUE);
+        g_free (label);
+
+        available_freqs = g_list_next (available_freqs);
+    }
+}
+
+static void
+governors_menu_create_actions (CPUFreqPopup *popup)
+{
+    GList *available_govs;
+
+    available_govs = cpufreq_monitor_get_available_governors (popup->priv->monitor);
+    available_govs = g_list_sort (available_govs, (GCompareFunc)g_ascii_strcasecmp);
+
+    while (available_govs) {
+        const gchar *governor;
+        gchar       *label;
+
+        governor = (const gchar *) available_govs->data;
+        if (g_ascii_strcasecmp (governor, "userspace") == 0) {
+            popup->priv->show_freqs = TRUE;
+            available_govs = g_list_next (available_govs);
+            continue;
+        }
+
+        label = g_strdup (governor);
+        label[0] = g_ascii_toupper (label[0]);
+
+        cpufreq_popup_menu_add_action (popup,
+                                       "Governor",
+                                       popup->priv->govs_group,
+                                       governor, label, TRUE);
+        g_free (label);
+
+        available_govs = g_list_next (available_govs);
+    }
+}
+
+static void
+cpufreq_popup_build_ui (CPUFreqPopup *popup,
+                        GSList       *actions,
+                        const gchar  *menu_path)
+{
+    GSList *l = NULL;
+
+    for (l = actions; l && l->data; l = g_slist_next (l)) {
+        GtkAction *action;
+        gchar     *name = NULL;
+        gchar     *label = NULL;
+
+        action = (GtkAction *) l->data;
+
+        g_object_get (G_OBJECT (action),
+                      "name", &name,
+                      "label", &label,
+                      NULL);
+
+        gtk_ui_manager_add_ui (popup->priv->ui_manager,
+                               popup->priv->merge_id,
+                               menu_path,
+                               label, name,
+                               GTK_UI_MANAGER_MENUITEM,
+                               FALSE);
+
+        g_free (name);
+        g_free (label);
+    }
+}
+
+static void
+cpufreq_popup_build_frequencies_menu (CPUFreqPopup *popup,
+                                      const gchar  *path)
+{
+    if (!popup->priv->freqs_group) {
+        GtkActionGroup *action_group;
+
+        action_group = gtk_action_group_new ("FreqsActions");
+        popup->priv->freqs_group = action_group;
+        gtk_action_group_set_translation_domain (action_group, NULL);
+
+        frequencies_menu_create_actions (popup);
+        popup->priv->freqs_actions = g_slist_reverse (popup->priv->freqs_actions);
+        gtk_ui_manager_insert_action_group (popup->priv->ui_manager,
+                                            action_group, 0);
+    }
+
+    cpufreq_popup_build_ui (popup,
+                            popup->priv->freqs_actions,
+                            path);
+}
+
+static void
+cpufreq_popup_build_governors_menu (CPUFreqPopup *popup,
+                                    const gchar  *path)
+{
+    if (!popup->priv->govs_group) {
+        GtkActionGroup *action_group;
+
+        action_group = gtk_action_group_new ("GovsActions");
+        popup->priv->govs_group = action_group;
+        gtk_action_group_set_translation_domain (action_group, NULL);
+
+        governors_menu_create_actions (popup);
+        popup->priv->govs_actions = g_slist_reverse (popup->priv->govs_actions);
+        gtk_ui_manager_insert_action_group (popup->priv->ui_manager,
+                                            action_group, 1);
+    }
+
+    cpufreq_popup_build_ui (popup,
+                            popup->priv->govs_actions,
+                            path);
+}
+
+static void
+cpufreq_popup_build_menu (CPUFreqPopup *popup)
+{
+    if (popup->priv->merge_id > 0) {
+        gtk_ui_manager_remove_ui (popup->priv->ui_manager,
+                                  popup->priv->merge_id);
+        gtk_ui_manager_ensure_update (popup->priv->ui_manager);
+    }
+
+    popup->priv->merge_id = gtk_ui_manager_new_merge_id (popup->priv->ui_manager);
+
+    cpufreq_popup_build_frequencies_menu (popup, FREQS_PLACEHOLDER_PATH);
+    cpufreq_popup_build_governors_menu (popup, GOVS_PLACEHOLDER_PATH);
+
+    gtk_action_group_set_visible (popup->priv->freqs_group,
+                                  popup->priv->show_freqs);
+}
+
+static void
+cpufreq_popup_menu_set_active_action (CPUFreqPopup   *popup,
+                                      GtkActionGroup *action_group,
+                                      const gchar    *prefix,
+                                      const gchar    *item)
+{
+    gchar      name[128];
+    GtkAction *action;
+
+    g_snprintf (name, sizeof (name), "%s%s", prefix, item);
+    action = gtk_action_group_get_action (action_group, name);
+
+    /* gtk_action_group_get_action can return NULL with frequencies (userspace governor)
+     * when the CPU does not actually stay locked to that exact frequency but rather to a
+     * frequency range. Since cpufreq_monitor_get_frequency gets the realtime frequency, this
+     * may not match any named frequency and then returns NULL. Return when this happens to
+     * avoid segfaults
+     */
+    if (action == NULL)
+        return;
+
+    g_signal_handlers_block_by_func (action,
+                                     cpufreq_popup_frequencies_menu_activate,
+                                     popup);
+    g_signal_handlers_block_by_func (action,
+                                     cpufreq_popup_governors_menu_activate,
+                                     popup);
+
+    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+
+    g_signal_handlers_unblock_by_func (action,
+                                       cpufreq_popup_frequencies_menu_activate,
+                                       popup);
+    g_signal_handlers_unblock_by_func (action,
+                                       cpufreq_popup_governors_menu_activate,
+                                       popup);
+}
+
+static void
+cpufreq_popup_menu_set_active (CPUFreqPopup *popup)
+{
+    const gchar *governor;
+
+    governor = cpufreq_monitor_get_governor (popup->priv->monitor);
+
+    if (g_ascii_strcasecmp (governor, "userspace") == 0) {
+        gchar *active;
+        guint  freq;
+
+        freq = cpufreq_monitor_get_frequency (popup->priv->monitor);
+        active = g_strdup_printf ("%d", freq);
+        cpufreq_popup_menu_set_active_action (popup,
+                                              popup->priv->freqs_group,
+                                              "Frequency", active);
+        g_free (active);
+    } else {
+        cpufreq_popup_menu_set_active_action (popup,
+                                              popup->priv->govs_group,
+                                              "Governor", governor);
+    }
+}
+
+GtkWidget *
+cpufreq_popup_get_menu (CPUFreqPopup *popup)
+{
+    GtkWidget *menu;
+
+    g_return_val_if_fail (CPUFREQ_IS_POPUP (popup), NULL);
+    g_return_val_if_fail (CPUFREQ_IS_MONITOR (popup->priv->monitor), NULL);
+
+    if (!cpufreq_utils_selector_is_available ())
+        return NULL;
+
+    if (popup->priv->need_build) {
+        cpufreq_popup_build_menu (popup);
+        popup->priv->need_build = FALSE;
+    }
+
+    cpufreq_popup_menu_set_active (popup);
+
+    menu = gtk_ui_manager_get_widget (popup->priv->ui_manager,
+                                      "/CPUFreqSelectorPopup");
+
+    return menu;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/37.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/37.html new file mode 100644 index 00000000..2215bfab --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/37.html @@ -0,0 +1,335 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
/*
+ * MATE CPUFreq Applet
+ * Copyright (C) 2008 Carlos Garcia Campos <carlosgc@gnome.org>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This 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
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __CPUFREQ_SELECTOR_H__
+#define __CPUFREQ_SELECTOR_H__
+
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define CPUFREQ_TYPE_SELECTOR            (cpufreq_selector_get_type ())
+#define CPUFREQ_SELECTOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CPUFREQ_TYPE_SELECTOR, CPUFreqSelector))
+#define CPUFREQ_SELECTOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), CPUFREQ_TYPE_SELECTOR, CPUFreqSelectorClass))
+#define CPUFREQ_IS_SELECTOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CPUFREQ_TYPE_SELECTOR))
+#define CPUFREQ_IS_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CPUFREQ_TYPE_SELECTOR))
+#define CPUFREQ_SELECTOR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CPUFREQ_TYPE_SELECTOR, CPUFreqSelectorClass))
+
+typedef struct _CPUFreqSelector        CPUFreqSelector;
+typedef struct _CPUFreqSelectorClass   CPUFreqSelectorClass;
+
+GType            cpufreq_selector_get_type            (void) G_GNUC_CONST;
+
+CPUFreqSelector *cpufreq_selector_get_default         (void);
+void             cpufreq_selector_set_frequency_async (CPUFreqSelector *selector,
+                                                       guint            cpu,
+                                                       guint            frequency);
+void             cpufreq_selector_set_governor_async  (CPUFreqSelector *selector,
+                                                       guint            cpu,
+                                                       const gchar     *governor);
+
+G_END_DECLS
+
+#endif /* __CPUFREQ_SELECTOR_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/39.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/39.html new file mode 100644 index 00000000..fb9071e4 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/39.html @@ -0,0 +1,881 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.cpufreq"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[1833]; const double alignment; void * const ptr;}  cpufreq_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0004, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 
+  0001, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 
+  0354, 0000, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0354, 0000, 0000, 0000, 
+  0001, 0000, 0114, 0000, 0360, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0302, 0313, 0300, 0312, 
+  0006, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0010, 0000, 0114, 0000, 0374, 0000, 0000, 0000, 
+  0004, 0001, 0000, 0000, 0201, 0321, 0040, 0031, 0000, 0000, 0000, 0000, 0004, 0001, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0014, 0001, 0000, 0000, 0020, 0001, 0000, 0000, 0243, 0217, 0034, 0237, 
+  0002, 0000, 0000, 0000, 0020, 0001, 0000, 0000, 0026, 0000, 0166, 0000, 0050, 0001, 0000, 0000, 
+  0217, 0006, 0000, 0000, 0114, 0366, 0171, 0131, 0002, 0000, 0000, 0000, 0217, 0006, 0000, 0000, 
+  0027, 0000, 0166, 0000, 0250, 0006, 0000, 0000, 0027, 0007, 0000, 0000, 0275, 0342, 0315, 0116, 
+  0003, 0000, 0000, 0000, 0027, 0007, 0000, 0000, 0015, 0000, 0114, 0000, 0044, 0007, 0000, 0000, 
+  0050, 0007, 0000, 0000, 0157, 0162, 0147, 0057, 0003, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0143, 0160, 0165, 0146, 0162, 0145, 0161, 0057, 0005, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 
+  0143, 0160, 0165, 0146, 0162, 0145, 0161, 0055, 0160, 0162, 0145, 0146, 0145, 0162, 0145, 0156, 
+  0143, 0145, 0163, 0056, 0165, 0151, 0000, 0000, 0154, 0071, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0133, 0155, 0163, 0233, 0070, 0020, 0376, 0336, 0137, 0241, 0323, 0327, 0033, 
+  0307, 0301, 0151, 0172, 0235, 0216, 0115, 0247, 0227, 0116, 0162, 0067, 0323, 0233, 0351, 0134, 
+  0332, 0317, 0214, 0200, 0065, 0350, 0042, 0113, 0124, 0022, 0161, 0334, 0137, 0177, 0002, 0034, 
+  0277, 0304, 0342, 0315, 0220, 0324, 0156, 0375, 0315, 0006, 0355, 0152, 0167, 0331, 0147, 0331, 
+  0147, 0201, 0361, 0373, 0207, 0031, 0103, 0367, 0040, 0025, 0025, 0174, 0202, 0235, 0263, 0163, 
+  0214, 0200, 0007, 0042, 0244, 0074, 0232, 0340, 0257, 0137, 0256, 0007, 0157, 0361, 0173, 0367, 
+  0325, 0370, 0267, 0301, 0000, 0335, 0000, 0007, 0111, 0064, 0204, 0150, 0116, 0165, 0214, 0042, 
+  0106, 0102, 0100, 0027, 0147, 0027, 0157, 0316, 0316, 0321, 0140, 0140, 0026, 0121, 0256, 0101, 
+  0116, 0111, 0000, 0356, 0053, 0204, 0306, 0022, 0276, 0245, 0124, 0202, 0102, 0214, 0372, 0023, 
+  0034, 0351, 0273, 0337, 0361, 0172, 0243, 0213, 0263, 0321, 0010, 0017, 0363, 0165, 0302, 0377, 
+  0017, 0002, 0215, 0002, 0106, 0224, 0232, 0340, 0033, 0175, 0367, 0367, 0214, 0104, 0200, 0021, 
+  0015, 0047, 0070, 0140, 0102, 0201, 0107, 0147, 0021, 0316, 0226, 0232, 0305, 0211, 0024, 0011, 
+  0110, 0275, 0100, 0234, 0314, 0140, 0202, 0357, 0251, 0242, 0076, 0003, 0354, 0176, 0221, 0051, 
+  0214, 0207, 0217, 0147, 0355, 0213, 0003, 0302, 0275, 0251, 0010, 0122, 0205, 0335, 0153, 0302, 
+  0124, 0355, 0172, 0032, 0010, 0356, 0145, 0077, 0261, 0073, 0247, 0074, 0024, 0363, 0101, 0156, 
+  0316, 0266, 0330, 0170, 0130, 0330, 0137, 0353, 0112, 0014, 0054, 0071, 0000, 0117, 0062, 0063, 
+  0006, 0276, 0024, 0163, 0005, 0262, 0215, 0047, 0037, 0051, 0141, 0042, 0052, 0134, 0111, 0044, 
+  0114, 0225, 0027, 0026, 0107, 0372, 0261, 0320, 0027, 0062, 0004, 0351, 0315, 0151, 0250, 0143, 
+  0354, 0136, 0326, 0055, 0327, 0124, 0233, 0130, 0041, 0055, 0011, 0127, 0214, 0150, 0142, 0042, 
+  0067, 0301, 0013, 0060, 0273, 0135, 0175, 0376, 0212, 0256, 0263, 0324, 0063, 0131, 0274, 0100, 
+  0377, 0010, 0116, 0265, 0220, 0350, 0263, 0261, 0030, 0244, 0071, 0004, 0252, 0126, 0365, 0042, 
+  0001, 0057, 0066, 0251, 0214, 0335, 0302, 0303, 0035, 0201, 0040, 0246, 0054, 0104, 0171, 0262, 
+  0163, 0302, 0006, 0371, 0137, 0163, 0001, 0175, 0361, 0260, 0014, 0206, 0055, 0176, 0177, 0156, 
+  0234, 0155, 0037, 0056, 0233, 0214, 0220, 0024, 0270, 0046, 0332, 0340, 0011, 0273, 0006, 0130, 
+  0232, 0006, 0204, 0065, 0021, 0124, 0011, 0011, 0014, 0274, 0261, 0073, 0262, 0256, 0266, 0273, 
+  0107, 0202, 0154, 0043, 0217, 0110, 0040, 0033, 0176, 0130, 0075, 0115, 0265, 0026, 0174, 0333, 
+  0337, 0175, 0175, 0266, 0311, 0061, 0262, 0020, 0251, 0366, 0224, 0136, 0144, 0160, 0001, 0036, 
+  0226, 0012, 0346, 0246, 0157, 0037, 0053, 0067, 0270, 0110, 0155, 0077, 0377, 0075, 0302, 0117, 
+  0245, 0154, 0146, 0370, 0300, 0254, 0051, 0350, 0375, 0145, 0060, 0126, 0146, 0124, 0153, 0354, 
+  0067, 0014, 0141, 0133, 0121, 0011, 0001, 0320, 0173, 0060, 0060, 0206, 0051, 0111, 0231, 0156, 
+  0257, 0201, 0346, 0265, 0315, 0175, 0254, 0153, 0155, 0104, 0123, 0123, 0324, 0123, 0156, 0000, 
+  0317, 0050, 0337, 0303, 0155, 0302, 0346, 0144, 0241, 0074, 0025, 0213, 0271, 0267, 0264, 0242, 
+  0132, 0305, 0146, 0151, 0333, 0126, 0114, 0202, 0073, 0003, 0205, 0372, 0055, 0341, 0041, 0041, 
+  0074, 0154, 0157, 0352, 0224, 0062, 0326, 0136, 0052, 0021, 0212, 0026, 0270, 0076, 0257, 0162, 
+  0312, 0152, 0375, 0170, 0150, 0111, 0373, 0375, 0241, 0340, 0164, 0203, 0302, 0325, 0356, 0035, 
+  0363, 0047, 0306, 0302, 0252, 0135, 0071, 0201, 0341, 0071, 0300, 0340, 0364, 0001, 0006, 0233, 
+  0373, 0166, 0327, 0313, 0334, 0156, 0165, 0267, 0052, 0174, 0156, 0045, 0122, 0213, 0176, 0213, 
+  0263, 0073, 0216, 0356, 0042, 0276, 0256, 0047, 0331, 0033, 0215, 0175, 0335, 0330, 0153, 0172, 
+  0300, 0316, 0175, 0120, 0145, 0057, 0344, 0274, 0355, 0332, 0106, 0134, 0313, 0254, 0301, 0316, 
+  0113, 0347, 0254, 0150, 0073, 0075, 0005, 0132, 0033, 0355, 0312, 0233, 0346, 0347, 0136, 0246, 
+  0372, 0125, 0306, 0274, 0264, 0174, 0173, 0017, 0204, 0321, 0250, 0372, 0216, 0143, 0011, 0137, 
+  0114, 0014, 0057, 0362, 0262, 0236, 0031, 0273, 0134, 0360, 0352, 0175, 0255, 0201, 0264, 0007, 
+  0363, 0103, 0146, 0314, 0014, 0262, 0056, 0334, 0262, 0276, 0103, 0340, 0272, 0006, 0317, 0032, 
+  0100, 0230, 0152, 0057, 0041, 0141, 0130, 0144, 0322, 0250, 0126, 0276, 0064, 0020, 0115, 0161, 
+  0332, 0133, 0050, 0372, 0010, 0207, 0115, 0307, 0214, 0310, 0210, 0162, 0117, 0213, 0004, 0273, 
+  0157, 0366, 0121, 0260, 0006, 0346, 0250, 0221, 0170, 0145, 0110, 0355, 0141, 0375, 0124, 0264, 
+  0055, 0031, 0140, 0163, 0010, 0070, 0257, 0161, 0225, 0202, 0036, 0042, 0335, 0127, 0264, 0155, 
+  0172, 0342, 0045, 0176, 0225, 0046, 0122, 0357, 0253, 0244, 0242, 0223, 0133, 0122, 0151, 0010, 
+  0221, 0241, 0330, 0357, 0366, 0335, 0240, 0145, 0263, 0123, 0231, 0142, 0034, 0262, 0072, 0033, 
+  0144, 0067, 0214, 0010, 0114, 0241, 0050, 0306, 0022, 0101, 0222, 0172, 0074, 0235, 0371, 0117, 
+  0307, 0033, 0315, 0025, 0067, 0252, 0204, 0365, 0375, 0124, 0263, 0336, 0252, 0163, 0303, 0321, 
+  0254, 0351, 0352, 0244, 0242, 0021, 0035, 0151, 0320, 0215, 0325, 0322, 0224, 0256, 0210, 0276, 
+  0022, 0063, 0137, 0144, 0325, 0162, 0143, 0114, 0265, 0316, 0207, 0343, 0101, 0367, 0363, 0247, 
+  0124, 0027, 0237, 0232, 0265, 0361, 0235, 0133, 0372, 0176, 0023, 0252, 0072, 0244, 0025, 0302, 
+  0345, 0202, 0245, 0102, 0313, 0021, 0132, 0326, 0025, 0075, 0226, 0324, 0146, 0135, 0317, 0247, 
+  0322, 0265, 0207, 0326, 0361, 0224, 0336, 0047, 0036, 0047, 0256, 0267, 0313, 0326, 0267, 0126, 
+  0063, 0321, 0132, 0122, 0077, 0325, 0240, 0112, 0057, 0335, 0152, 0311, 0162, 0367, 0071, 0320, 
+  0050, 0326, 0030, 0335, 0023, 0226, 0346, 0274, 0201, 0205, 0305, 0263, 0004, 0333, 0325, 0253, 
+  0326, 0337, 0372, 0352, 0366, 0307, 0236, 0133, 0367, 0351, 0107, 0066, 0113, 0272, 0076, 0161, 
+  0236, 0023, 0347, 0371, 0225, 0070, 0117, 0253, 0101, 0104, 0043, 0356, 0363, 0346, 0271, 0250, 
+  0117, 0165, 0164, 0017, 0236, 0353, 0264, 0146, 0227, 0075, 0060, 0314, 0146, 0241, 0156, 0310, 
+  0064, 0057, 0161, 0235, 0222, 0236, 0256, 0100, 0237, 0127, 0241, 0067, 0326, 0331, 0222, 0171, 
+  0176, 0110, 0022, 0040, 0346, 0170, 0000, 0357, 0272, 0354, 0320, 0201, 0172, 0266, 0240, 0237, 
+  0371, 0034, 0176, 0046, 0302, 0116, 0272, 0133, 0062, 0320, 0246, 0224, 0241, 0071, 0155, 0350, 
+  0215, 0215, 0366, 0303, 0037, 0172, 0041, 0245, 0015, 0171, 0104, 0043, 0162, 0332, 0245, 0030, 
+  0330, 0110, 0352, 0052, 0153, 0216, 0263, 0056, 0274, 0134, 0362, 0165, 0365, 0261, 0357, 0334, 
+  0163, 0176, 0104, 0356, 0035, 0305, 0304, 0251, 0237, 0371, 0300, 0201, 0017, 0234, 0376, 0045, 
+  0041, 0025, 0233, 0017, 0315, 0067, 0340, 0074, 0225, 0360, 0015, 0367, 0065, 0176, 0275, 0065, 
+  0032, 0263, 0301, 0053, 0232, 0256, 0336, 0155, 0042, 0012, 0171, 0253, 0177, 0373, 0106, 0272, 
+  0357, 0266, 0256, 0213, 0232, 0335, 0307, 0360, 0077, 0176, 0040, 0336, 0343, 0274, 0072, 0173, 
+  0203, 0352, 0276, 0243, 0216, 0120, 0222, 0271, 0107, 0171, 0150, 0230, 0205, 0026, 0262, 0215, 
+  0256, 0137, 0250, 0146, 0070, 0007, 0076, 0244, 0216, 0041, 0270, 0053, 0251, 0031, 0051, 0247, 
+  0272, 0337, 0232, 0261, 0256, 0027, 0271, 0162, 0165, 0052, 0024, 0317, 0123, 0050, 0226, 0224, 
+  0064, 0327, 0121, 0365, 0066, 0301, 0013, 0026, 0234, 0123, 0261, 0150, 0120, 0054, 0106, 0307, 
+  0333, 0140, 0030, 0243, 0203, 0347, 0156, 0060, 0262, 0075, 0262, 0241, 0126, 0004, 0247, 0302, 
+  0161, 0360, 0035, 0306, 0376, 0200, 0337, 0325, 0025, 0111, 0221, 0046, 0133, 0103, 0215, 0054, 
+  0061, 0116, 0345, 0343, 0111, 0371, 0270, 0070, 0075, 0277, 0374, 0271, 0236, 0137, 0176, 0244, 
+  0052, 0141, 0144, 0161, 0172, 0176, 0171, 0170, 0317, 0057, 0217, 0367, 0365, 0337, 0066, 0157, 
+  0317, 0326, 0372, 0133, 0377, 0366, 0357, 0266, 0217, 0133, 0047, 0307, 0305, 0167, 0074, 0203, 
+  0142, 0150, 0275, 0112, 0251, 0355, 0303, 0110, 0202, 0112, 0004, 0127, 0306, 0232, 0201, 0343, 
+  0140, 0167, 0371, 0121, 0214, 0311, 0305, 0315, 0125, 0365, 0262, 0177, 0074, 0212, 0072, 0126, 
+  0321, 0047, 0007, 0325, 0326, 0347, 0125, 0105, 0361, 0311, 0277, 0363, 0362, 0311, 0372, 0325, 
+  0235, 0261, 0001, 0147, 0000, 0261, 0101, 0014, 0310, 0341, 0216, 0177, 0325, 0237, 0260, 0335, 
+  0322, 0357, 0160, 0123, 0334, 0326, 0012, 0301, 0247, 0101, 0130, 0172, 0260, 0121, 0042, 0234, 
+  0327, 0153, 0140, 0332, 0116, 0137, 0342, 0225, 0021, 0033, 0312, 0326, 0146, 0214, 0207, 0033, 
+  0337, 0104, 0376, 0017, 0306, 0271, 0170, 0002, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 
+  0160, 0165, 0146, 0162, 0145, 0161, 0055, 0141, 0160, 0160, 0154, 0145, 0164, 0055, 0155, 0145, 
+  0156, 0165, 0056, 0170, 0155, 0154, 0000, 0000, 0324, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0263, 0311, 0115, 0315, 0053, 0315, 0054, 0111, 0315, 0125, 0310, 0113, 0314, 0115, 
+  0265, 0125, 0162, 0016, 0010, 0165, 0053, 0112, 0055, 0124, 0010, 0050, 0112, 0115, 0113, 0055, 
+  0112, 0315, 0113, 0116, 0055, 0126, 0360, 0004, 0112, 0053, 0051, 0044, 0046, 0227, 0144, 0346, 
+  0347, 0301, 0125, 0070, 0026, 0024, 0344, 0244, 0226, 0040, 0051, 0123, 0122, 0320, 0267, 0343, 
+  0262, 0301, 0141, 0234, 0107, 0152, 0116, 0001, 0076, 0163, 0100, 0362, 0170, 0015, 0160, 0114, 
+  0312, 0057, 0055, 0301, 0147, 0002, 0130, 0001, 0330, 0010, 0056, 0000, 0244, 0336, 0110, 0042, 
+  0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 0055, 0141, 0160, 0160, 0154, 
+  0145, 0164, 0163, 0057, 0002, 0000, 0000, 0000
+} };
+
+static GStaticResource static_resource = { cpufreq_resource_data.data, sizeof (cpufreq_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *cpufreq_get_resource (void);
+GResource *cpufreq_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * 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.1 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/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CONSTRUCTOR_H__
+#define __G_CONSTRUCTOR_H__
+
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+/*
+ * Only try to include gslist.h if not already included via glib.h,
+ * so that items using gconstructor.h outside of GLib (such as
+ * GResources) continue to build properly.
+ */
+#ifndef __G_LIB_H__
+#include "gslist.h"
+#endif
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+#endif /* __G_CONSTRUCTOR_H__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(cpufreqresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(cpufreqresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(cpufreqresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(cpufreqresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void cpufreqresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void cpufreqresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/4.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/4.html new file mode 100644 index 00000000..637c6e08 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/4.html @@ -0,0 +1,1183 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
/* battstat        A MATE battery meter for laptops.
+ * Copyright (C) 2000 by Jörgen Pehrson <jp@spektr.eu.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ $Id$
+ */
+
+/*
+ * ACPI battery read-out functions for Linux >= 2.4.12
+ * October 2001 by Lennart Poettering <lennart@poettering.de>
+ */
+
+#ifdef HAVE_CONFIG_H
+    #include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#ifdef __linux__
+
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <apm.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/stat.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/socket.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/un.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <fcntl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <errno.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <dirent.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "acpi-linux.h"
+
+static GHashTable*
+read_file (const char* file, char* buf, size_t bufsize)
+{
+    GHashTable* hash = NULL;
+
+    int fd, len, i;
+    char* key;
+    char* value;
+    gboolean reading_key;
+
+    fd = open (file, O_RDONLY);
+
+    if (fd == -1)
+    {
+        return hash;
+    }
+
+    len = read (fd, buf, bufsize);
+
+    close (fd);
+
+    if (len < 0)
+    {
+        if (getenv ("BATTSTAT_DEBUG"))
+        {
+            g_message ("Error reading %s: %s", file, g_strerror (errno));
+        }
+
+        return hash;
+    }
+
+    hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+    for (i = 0, value = key = buf, reading_key = TRUE; i < len; i++)
+    {
+        if (buf[i] == ':' && reading_key)
+        {
+            reading_key = FALSE;
+            buf[i] = '\0';
+            value = buf + i + 1;
+        }
+        else if (buf[i] == '\n')
+        {
+            reading_key = TRUE;
+            buf[i] = '\0';
+            /* g_message ("Read: %s => %s\n", key, value); */
+            g_hash_table_insert (hash, key, g_strstrip (value));
+            key = buf + i + 1;
+        }
+        else if (reading_key)
+        {
+            /* in acpi 20020214 it switched to lower-case proc
+             * entries.  fixing this up here simplifies the
+             * code.
+             */
+            buf[i] = g_ascii_tolower (buf[i]);
+        }
+    }
+
+    return hash;
+}
+
+#if 0
+static gboolean
+read_bool (GHashTable *hash, const char *key)
+{
+    char *s;
+
+    g_return_val_if_fail (hash, FALSE);
+    g_return_val_if_fail (key, FALSE);
+
+    s = g_hash_table_lookup (hash, key);
+    return s && (*s == 'y');
+}
+#endif
+
+static long
+read_long (GHashTable *hash, const char *key)
+{
+    char* s;<--- Variable 's' can be declared as pointer to const
+
+    g_return_val_if_fail (hash, 0);
+    g_return_val_if_fail (key, 0);
+
+    s = g_hash_table_lookup (hash, key);
+    return s ? strtol (s, NULL, 10) : 0;
+}
+
+static gulong
+read_ulong (GHashTable *hash, const char *key)
+{
+  char *s;<--- Variable 's' can be declared as pointer to const
+
+    g_return_val_if_fail (hash, 0);
+    g_return_val_if_fail (key, 0);
+
+    s = g_hash_table_lookup (hash, key);
+    return s ? strtoul (s, NULL, 10) : 0;
+}
+
+static const char *
+read_string (GHashTable *hash, const char *key)
+{
+    return g_hash_table_lookup (hash, key);
+}
+
+/* Reads the current status of the AC adapter and stores the
+ * result in acpiinfo->ac_online. */
+static gboolean
+update_ac_info (struct acpi_info * acpiinfo)
+{
+    gchar *ac_state = NULL;
+    DIR * procdir;
+    struct dirent * procdirentry;
+    char buf[BUFSIZ];
+    GHashTable *hash;
+    gboolean have_adaptor = FALSE;
+
+    acpiinfo->ac_online = FALSE;
+
+    procdir=opendir ("/proc/acpi/ac_adapter/");
+    if (!procdir)
+        return FALSE;
+
+    while ((procdirentry=readdir (procdir)))
+    {
+        if (procdirentry->d_name[0]!='.')
+        {
+            have_adaptor = TRUE;
+            ac_state = g_strconcat ("/proc/acpi/ac_adapter/",
+                                    procdirentry->d_name,
+                                    "/",
+                                    acpiinfo->ac_state_state,
+                                    NULL);
+            hash = read_file (ac_state, buf, sizeof (buf));
+            if (hash && !acpiinfo->ac_online)
+            {
+                const char *s;
+                s = read_string (hash, acpiinfo->ac_state_state);
+                acpiinfo->ac_online = s ? (strcmp (s, "on-line") == 0) : 0;
+                g_hash_table_destroy (hash);
+           }
+           g_free (ac_state);
+        }
+    }
+
+  /* If there are no AC adaptors registered in the system, then we're
+     probably on a desktop (and therefore, on AC power).
+   */
+    if (have_adaptor == FALSE)
+        acpiinfo->ac_online = 1;
+
+    closedir (procdir);
+
+    return TRUE;
+}
+
+/* Reads the ACPI info for the system batteries, and finds
+ * the total capacity, which is stored in acpiinfo. */
+static gboolean
+update_battery_info (struct acpi_info* acpiinfo)
+{
+    gchar* batt_info = NULL;
+    GHashTable* hash;
+    DIR* procdir;
+    struct dirent* procdirentry;
+    char buf[BUFSIZ];
+
+    acpiinfo->max_capacity = 0;
+    acpiinfo->low_capacity = 0;
+    acpiinfo->critical_capacity = 0;
+
+    procdir = opendir ("/proc/acpi/battery/");
+
+    if (!procdir)
+    {
+        return FALSE;
+    }
+
+    while ((procdirentry = readdir (procdir)))
+    {
+        if (procdirentry->d_name[0] != '.')
+        {
+            batt_info = g_strconcat ("/proc/acpi/battery/", procdirentry->d_name, "/info", NULL);
+            hash = read_file (batt_info, buf, sizeof (buf));
+
+            if (hash)
+            {
+                acpiinfo->max_capacity += read_long (hash, "last full capacity");
+                acpiinfo->low_capacity += read_long (hash, "design capacity warning");
+                acpiinfo->critical_capacity += read_long (hash, "design capacity low");
+
+                g_hash_table_destroy (hash);
+            }
+            g_free (batt_info);
+        }
+    }
+
+    closedir (procdir);
+
+    return TRUE;
+}
+
+/* Initializes the ACPI-reading subsystem by opening a file
+ * descriptor to the ACPI event file.  This can either be the
+ * /proc/acpi/event exported by the kernel, or if it's already
+ * in use, the /var/run/acpid.socket maintained by acpid.  Also
+ * initializes the stored battery and AC adapter information. */
+gboolean
+acpi_linux_init (struct acpi_info * acpiinfo)
+{
+    GHashTable *hash;
+    char buf[BUFSIZ];
+    gchar *pbuf;
+    gulong acpi_ver;
+    int fd;
+
+    g_assert (acpiinfo);
+
+    if (g_file_get_contents ("/sys/module/acpi/parameters/acpica_version", &pbuf, NULL, NULL)) {
+        acpi_ver = strtoul (pbuf, NULL, 10);
+        g_free (pbuf);
+    } else if ((hash = read_file ("/proc/acpi/info", buf, sizeof (buf)))) {
+        acpi_ver = read_ulong (hash, "version");
+        g_hash_table_destroy (hash);
+    } else
+        return FALSE;
+
+    if (acpi_ver < (gulong)20020208) {
+        acpiinfo->ac_state_state = "status";
+        acpiinfo->batt_state_state = "status";
+        acpiinfo->charging_state = "state";
+    } else {
+        acpiinfo->ac_state_state = "state";
+        acpiinfo->batt_state_state = "state";
+        acpiinfo->charging_state = "charging state";
+    }
+
+    if (!update_battery_info (acpiinfo) || !update_ac_info (acpiinfo))
+        return FALSE;
+
+    fd = open ("/proc/acpi/event", 0);
+    if (fd >= 0) {
+        acpiinfo->event_fd = fd;
+        acpiinfo->channel = g_io_channel_unix_new (fd);
+        return TRUE;
+    }
+
+    fd = socket (PF_UNIX, SOCK_STREAM, 0);
+    if (fd >= 0) {
+        struct sockaddr_un addr;
+        addr.sun_family = AF_UNIX;
+        strcpy (addr.sun_path, "/var/run/acpid.socket");
+        if (connect (fd, (struct sockaddr *) &addr, sizeof (addr)) == 0) {
+            acpiinfo->event_fd = fd;
+            acpiinfo->channel = g_io_channel_unix_new (fd);
+            return TRUE;
+        }
+    }
+
+    close (fd);
+    acpiinfo->event_fd = -1;
+    return FALSE;
+}
+
+/* Cleans up ACPI */
+void
+acpi_linux_cleanup (struct acpi_info * acpiinfo)
+{
+    g_assert (acpiinfo);
+
+    if (acpiinfo->event_fd >= 0) {
+        g_io_channel_unref (acpiinfo->channel);
+        close (acpiinfo->event_fd);
+        acpiinfo->event_fd = -1;
+    }
+}
+
+#define ACPI_EVENT_IGNORE       0
+#define ACPI_EVENT_DONE         1
+#define ACPI_EVENT_AC           2
+#define ACPI_EVENT_BATTERY_INFO 3
+
+/* Given a string event from the ACPI system, returns the type
+ * of event if we're interested in it.  str is updated to point
+ * to the next event. */
+static int
+parse_acpi_event (GString *buffer)
+{
+
+    if (strstr (buffer->str, "ac_adapter"))
+        return ACPI_EVENT_AC;
+    if (strstr (buffer->str, "battery"))
+        return ACPI_EVENT_BATTERY_INFO;
+
+    return ACPI_EVENT_IGNORE;
+}
+
+/* Handles a new ACPI event by reading it from the event file
+ * and calling any handlers.  Since this does a blocking read,
+ * it should only be called when there is a new event as indicated
+ * by select (). */
+gboolean acpi_process_event (struct acpi_info * acpiinfo)
+{
+    gsize i;
+    int evt;
+    GString *buffer;
+    GError *gerror=NULL;
+    buffer=g_string_new (NULL);
+    g_io_channel_read_line_string (acpiinfo->channel,
+                                   buffer,
+                                   &i,
+                                   &gerror);
+
+    if (gerror != NULL) {
+        g_warning ("%s", gerror->message);
+        g_error_free (gerror);
+    }
+
+    gboolean result;
+
+    evt = parse_acpi_event (buffer);
+    switch (evt) {
+        case ACPI_EVENT_AC:
+            result = update_ac_info (acpiinfo);
+            break;
+        case ACPI_EVENT_BATTERY_INFO:
+            if (update_battery_info (acpiinfo)) {
+                /* Update AC info on battery info updates.  This works around
+                 * a bug in ACPI (as per bug #163013).
+                 */
+                result = update_ac_info (acpiinfo);
+                break;
+            }
+        /* fall-through */
+        default:
+            result = FALSE;
+    }
+
+    g_string_free (buffer, FALSE);
+    return result;
+}
+
+/*
+ * Fills out a classic apm_info structure with the data gathered from
+ * the ACPI kernel interface in /proc
+ */
+gboolean
+acpi_linux_read (struct apm_info *apminfo, struct acpi_info * acpiinfo)
+{
+    guint32 remain;
+    guint32 rate;
+    gboolean charging;
+    GHashTable *hash;
+    gchar* batt_state = NULL;
+    DIR * procdir;
+    struct dirent * procdirentry;
+    char buf[BUFSIZ];
+
+    g_assert (acpiinfo);
+
+    /*
+     * apminfo.ac_line_status must be one when on ac power
+     * apminfo.battery_status must be 0 for high, 1 for low, 2 for critical, 3 for charging
+     * apminfo.battery_percentage must contain batter charge percentage
+     * apminfo.battery_flags & 0x8 must be nonzero when charging
+     */
+
+    g_assert (apminfo);
+
+    charging = FALSE;
+    remain = 0;
+    rate = 0;
+
+    procdir=opendir ("/proc/acpi/battery/");
+    if (!procdir)
+        return FALSE;
+
+    /* Get the remaining capacity for the batteries.  Other information
+     * such as AC state and battery max capacity are read only when they
+     * change using acpi_process_event (). */
+    while ((procdirentry=readdir (procdir)))
+    {
+        if (procdirentry->d_name[0]!='.')
+        {
+            batt_state = g_strconcat ("/proc/acpi/battery/",
+                                      procdirentry->d_name,
+                                      "/",
+                                      acpiinfo->batt_state_state,
+                                      NULL);
+            hash = read_file (batt_state, buf, sizeof (buf));
+            if (hash)
+            {
+                const char *s;
+                if (!charging)
+                {
+                    s = read_string (hash, acpiinfo->charging_state);
+                    charging = s ? (strcmp (s, "charging") == 0) : 0;
+                }
+                remain += read_long (hash, "remaining capacity");
+                rate += read_long (hash, "present rate");
+                g_hash_table_destroy (hash);
+            }
+            g_free (batt_state);
+        }
+    }
+    closedir (procdir);
+
+    apminfo->ac_line_status = acpiinfo->ac_online ? 1 : 0;
+    apminfo->battery_status =
+        remain < acpiinfo->low_capacity ? 1 : remain < acpiinfo->critical_capacity ? 2 : 0;
+    if (!acpiinfo->max_capacity)
+        apminfo->battery_percentage = -1;
+    else
+        apminfo->battery_percentage = (int) (remain/(float)acpiinfo->max_capacity*100);
+    apminfo->battery_flags = charging ? 0x8 : 0;
+    if (rate && !charging)
+        apminfo->battery_time = (int) (remain/(float)rate * 60);
+    else if (rate && charging)
+        apminfo->battery_time = (int) ((acpiinfo->max_capacity-remain)/(float)rate * 60);
+    else
+        apminfo->battery_time = -1;
+
+    return TRUE;
+}
+
+#endif /* __linux__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/40.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/40.html new file mode 100644 index 00000000..99b9540f --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/40.html @@ -0,0 +1,887 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
/*
+ * MATE CPUFreq Applet
+ * Copyright (C) 2008 Carlos Garcia Campos <carlosgc@gnome.org>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This 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
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/sysinfo.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#ifdef HAVE_POLKIT
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif /* HAVE_POLKIT */
+
+#include "cpufreq-selector.h"
+
+struct _CPUFreqSelector {
+    GObject parent;
+
+#ifdef HAVE_POLKIT
+    GDBusConnection *system_bus;
+    GDBusProxy      *proxy;
+#endif /* HAVE_POLKIT */
+};
+
+struct _CPUFreqSelectorClass {
+    GObjectClass parent_class;
+};
+
+G_DEFINE_TYPE (CPUFreqSelector, cpufreq_selector, G_TYPE_OBJECT)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
+
+static void
+cpufreq_selector_finalize (GObject *object)
+{
+#ifdef HAVE_POLKIT
+    CPUFreqSelector *selector = CPUFREQ_SELECTOR (object);
+
+    g_clear_object (&selector->proxy);
+    g_clear_object (&selector->system_bus);
+#endif /* HAVE_POLKIT */
+
+    G_OBJECT_CLASS (cpufreq_selector_parent_class)->finalize (object);
+}
+
+static void
+cpufreq_selector_class_init (CPUFreqSelectorClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+    object_class->finalize = cpufreq_selector_finalize;
+}
+
+static void
+cpufreq_selector_init (CPUFreqSelector *selector)
+{
+}
+
+CPUFreqSelector *
+cpufreq_selector_get_default (void)
+{
+    static CPUFreqSelector *selector = NULL;
+
+    if (!selector)
+        selector = CPUFREQ_SELECTOR (g_object_new (CPUFREQ_TYPE_SELECTOR, NULL));
+
+    return selector;
+}
+
+#ifdef HAVE_POLKIT
+typedef enum {
+    FREQUENCY,
+    GOVERNOR
+} CPUFreqSelectorCall;
+
+typedef struct {
+    CPUFreqSelector *selector;
+
+    CPUFreqSelectorCall call;
+
+    guint  cpu;
+    guint  frequency;
+    gchar *governor;
+
+    guint32 parent_xid;
+} SelectorAsyncData;
+
+static void
+selector_async_data_free (SelectorAsyncData *data)
+{
+    if (!data)
+        return;
+
+    g_free (data->governor);
+    g_free (data);
+}
+
+static gboolean
+cpufreq_selector_connect_to_system_bus (CPUFreqSelector *selector,
+                                        GError         **error)
+{
+    if (selector->system_bus)
+        return TRUE;
+
+    selector->system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, error);
+
+    return (selector->system_bus != NULL);
+}
+
+static gboolean
+cpufreq_selector_create_proxy (CPUFreqSelector  *selector,
+                               GError          **error)
+{
+    if (selector->proxy)
+        return TRUE;
+
+    selector->proxy = g_dbus_proxy_new_sync (selector->system_bus,
+                                             G_DBUS_PROXY_FLAGS_NONE,
+                                             NULL,
+                                             "org.mate.CPUFreqSelector",
+                                             "/org/mate/cpufreq_selector/selector",
+                                             "org.mate.CPUFreqSelector",
+                                             NULL,
+                                             error);
+
+    return (selector->proxy != NULL);
+}
+
+static void
+selector_setter_cb (GObject      *source,
+                    GAsyncResult *result,
+                    gpointer      user_data)
+{
+    GDBusProxy *proxy = G_DBUS_PROXY (source);
+    SelectorAsyncData *data = (SelectorAsyncData *)user_data;
+    GError *error = NULL;
+
+    g_dbus_proxy_call_finish (proxy, result, &error);
+    if (error != NULL) {
+        g_warning ("%s", error->message);
+        g_clear_error (&error);
+    }
+    selector_async_data_free (data);
+}
+
+static void
+selector_set_frequency_async (SelectorAsyncData *data)
+{
+    GError *error = NULL;
+
+    if (!cpufreq_selector_connect_to_system_bus (data->selector, &error)) {
+        g_warning ("%s", error->message);
+        g_error_free (error);
+
+        selector_async_data_free (data);
+
+        return;
+    }
+
+    if (!cpufreq_selector_create_proxy (data->selector, &error)) {
+        g_warning ("%s", error->message);
+        g_error_free (error);
+
+        selector_async_data_free (data);
+        return;
+    }
+
+    g_dbus_proxy_call (data->selector->proxy,
+                       "SetFrequency",
+                       g_variant_new ("(uu)",
+                                      data->cpu,
+                                      data->frequency),
+                       G_DBUS_CALL_FLAGS_NONE,
+                       -1,
+                       NULL,
+                       selector_setter_cb,
+                       data);
+}
+
+void
+cpufreq_selector_set_frequency_async (CPUFreqSelector *selector,
+                                      guint            cpu,
+                                      guint            frequency)
+{
+    guint            cores;
+    cores = get_nprocs() ;
+    for (cpu = 0; cpu < cores; cpu = cpu+1) {
+        SelectorAsyncData *data;
+
+        data = g_new0 (SelectorAsyncData, 1);
+
+        data->selector = selector;
+        data->call = FREQUENCY;
+        data->cpu = cpu;
+        data->frequency = frequency;
+
+        selector_set_frequency_async (data);
+    }
+}
+
+static void
+selector_set_governor_async (SelectorAsyncData *data)
+{
+    GError *error = NULL;
+
+    if (!cpufreq_selector_connect_to_system_bus (data->selector, &error)) {
+        g_warning ("%s", error->message);
+        g_error_free (error);
+
+        selector_async_data_free (data);
+
+        return;
+    }
+
+    if (!cpufreq_selector_create_proxy (data->selector, &error)) {
+        g_warning ("%s", error->message);
+        g_error_free (error);
+
+        selector_async_data_free (data);
+
+        return;
+    }
+
+    g_dbus_proxy_call (data->selector->proxy,
+                       "SetGovernor",
+                       g_variant_new ("(us)",
+                                      data->cpu,
+                                      data->governor),
+                       G_DBUS_CALL_FLAGS_NONE,
+                       -1,
+                       NULL,
+                       selector_setter_cb,
+                       data);
+}
+
+void
+cpufreq_selector_set_governor_async (CPUFreqSelector *selector,
+                                     guint            cpu,
+                                     const gchar     *governor)
+{
+    guint            cores;
+    cores = get_nprocs() ;
+    for (cpu = 0; cpu < cores; cpu = cpu+1){
+        SelectorAsyncData *data;
+
+        data = g_new0 (SelectorAsyncData, 1);
+
+        data->selector = selector;
+        data->call = GOVERNOR;
+        data->cpu = cpu;
+        data->governor = g_strdup (governor);
+
+        selector_set_governor_async (data);
+   }
+}
+#else /* !HAVE_POLKIT */
+static void
+cpufreq_selector_run_command (CPUFreqSelector *selector,
+                              const gchar     *args)
+{
+    gchar  *command;
+    gchar  *path;
+    GError *error = NULL;
+
+    path = g_find_program_in_path ("cpufreq-selector");
+
+    if (!path)
+        return;
+
+    command = g_strdup_printf ("%s %s", path, args);
+    g_free (path);
+
+    g_spawn_command_line_async (command, &error);
+    g_free (command);
+
+    if (error) {
+        g_warning ("%s", error->message);
+        g_error_free (error);
+    }
+}
+
+void
+cpufreq_selector_set_frequency_async (CPUFreqSelector *selector,
+                                      guint            cpu,
+                                      guint            frequency)
+{
+    guint           cores;
+    cores = get_nprocs ();
+
+    for (cpu = 0; cpu < cores; cpu = cpu+1) {
+        gchar *args;
+
+        args = g_strdup_printf ("-c %u -f %u", cpu, frequency);
+        cpufreq_selector_run_command (selector, args);
+        g_free (args);
+    }
+}
+
+void
+cpufreq_selector_set_governor_async (CPUFreqSelector *selector,
+                                     guint            cpu,
+                                     const gchar     *governor)
+{
+    guint            cores;
+    cores = get_nprocs() ;
+    for (cpu = 0; cpu < cores; cpu = cpu+1){
+        gchar *args;
+
+        args = g_strdup_printf ("-c %u -g %s", cpu, governor);
+        cpufreq_selector_run_command (selector, args);
+        g_free (args);
+    }
+}
+#endif /* HAVE_POLKIT */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/43.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/43.html new file mode 100644 index 00000000..7acfcf93 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/43.html @@ -0,0 +1,327 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
/*
+ * MATE CPUFreq Applet
+ * Copyright (C) 2008 Carlos Garcia Campos <carlosgc@gnome.org>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This 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
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"<--- Include file: "config.h" not found.
+#endif
+
+#include "cpufreq-selector-factory.h"
+#ifdef HAVE_LIBCPUFREQ
+#include "cpufreq-selector-libcpufreq.h"
+#else
+#include "cpufreq-selector-sysfs.h"
+#endif
+
+CPUFreqSelector *
+cpufreq_selector_factory_create_selector (guint cpu)
+{
+#ifdef HAVE_LIBCPUFREQ
+    return cpufreq_selector_libcpufreq_new (cpu);
+#else
+    CPUFreqSelector *selector = NULL;
+
+    if (g_file_test ("/sys/devices/system/cpu/cpu0/cpufreq", G_FILE_TEST_EXISTS)) {
+        selector = cpufreq_selector_sysfs_new (cpu);
+    }
+
+    return selector;
+#endif /* HAVE_LIBCPUFREQ */
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/46.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/46.html new file mode 100644 index 00000000..24371f62 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/46.html @@ -0,0 +1,1209 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
/*
+ * MATE CPUFreq Applet
+ * Copyright (C) 2008 Carlos Garcia Campos <carlosgc@gnome.org>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This 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
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <polkit/polkit.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <dbus/dbus-glib-lowlevel.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "cpufreq-selector.h"
+#include "cpufreq-selector-factory.h"
+#include "cpufreq-selector-service.h"
+
+#include "cpufreq-selector-service-glue.h"
+
+#define MAX_CPUS 255
+
+struct _CPUFreqSelectorService {
+    GObject parent;
+
+    CPUFreqSelector *selectors[MAX_CPUS];
+    gint             selectors_max;
+
+    DBusGConnection *system_bus;
+
+    /* PolicyKit */
+    PolkitAuthority   *authority;
+};
+
+struct _CPUFreqSelectorServiceClass {
+    GObjectClass parent_class;
+};
+
+G_DEFINE_TYPE (CPUFreqSelectorService, cpufreq_selector_service, G_TYPE_OBJECT)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
+
+#define BUS_NAME "org.mate.CPUFreqSelector"
+
+GType
+cpufreq_selector_service_error_get_type (void)
+{
+    static GType etype = 0;
+
+    if (G_UNLIKELY (etype == 0)) {
+        static const GEnumValue values[] = {
+            { SERVICE_ERROR_GENERAL,            "SERVICE_ERROR_GENERAL",            "GeneralError" },
+            { SERVICE_ERROR_DBUS,               "SERVICE_ERROR_DBUS",               "DBUSError" },
+            { SERVICE_ERROR_ALREADY_REGISTERED, "SERVICE_ERROR_ALREADY_REGISTERED", "AlreadyRegistered" },
+            { SERVICE_ERROR_NOT_AUTHORIZED,     "SERVICE_ERROR_NOT_AUTHORIZED",     "NotAuthorized"},
+            { 0, NULL, NULL}
+        };
+
+        etype = g_enum_register_static ("CPUFreqSelectorServiceError", values);
+    }
+
+    return etype;
+}
+
+GQuark
+cpufreq_selector_service_error_quark (void)
+{
+    static GQuark error_quark = 0;
+
+    if (G_UNLIKELY (error_quark == 0))
+        error_quark =
+            g_quark_from_static_string ("cpufreq-selector-service-error-quark");
+
+    return error_quark;
+}
+
+static void
+cpufreq_selector_service_finalize (GObject *object)
+{
+    CPUFreqSelectorService *service = CPUFREQ_SELECTOR_SERVICE (object);
+    gint i;
+
+    service->system_bus = NULL;
+
+    if (service->selectors_max >= 0) {
+        for (i = 0; i < service->selectors_max; i++) {
+            if (service->selectors[i]) {
+                g_object_unref (service->selectors[i]);
+                service->selectors[i] = NULL;
+            }
+        }
+
+        service->selectors_max = -1;
+    }
+
+    if (service->authority) {
+        g_object_unref (service->authority);
+        service->authority = NULL;
+    }
+
+    G_OBJECT_CLASS (cpufreq_selector_service_parent_class)->finalize (object);
+}
+
+static void
+cpufreq_selector_service_class_init (CPUFreqSelectorServiceClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+    object_class->finalize = cpufreq_selector_service_finalize;
+}
+
+static void
+cpufreq_selector_service_init (CPUFreqSelectorService *service)
+{
+    service->selectors_max = -1;
+}
+
+CPUFreqSelectorService *
+cpufreq_selector_service_get_instance (void)
+{
+    static CPUFreqSelectorService *service = NULL;
+
+    if (!service)
+        service = CPUFREQ_SELECTOR_SERVICE (g_object_new (CPUFREQ_TYPE_SELECTOR_SERVICE, NULL));
+
+    return service;
+}
+
+static gboolean
+service_shutdown (gpointer user_data)
+{
+    g_object_unref (SELECTOR_SERVICE);
+
+    return FALSE;
+}
+
+static void
+reset_killtimer (void)
+{
+    static guint timer_id = 0;
+
+    if (timer_id > 0)
+        g_source_remove (timer_id);
+
+    timer_id = g_timeout_add_seconds (30,
+                                      (GSourceFunc) service_shutdown,
+                                      NULL);
+}
+
+gboolean
+cpufreq_selector_service_register (CPUFreqSelectorService *service,
+                                   GError                **error)
+{
+    DBusGConnection *connection;
+    DBusGProxy      *bus_proxy;
+    gboolean         res;
+    guint            result;
+    GError          *err = NULL;
+
+    if (service->system_bus) {
+        g_set_error (error,
+                     CPUFREQ_SELECTOR_SERVICE_ERROR,
+                     SERVICE_ERROR_ALREADY_REGISTERED,
+                     "Service %s already registered", BUS_NAME);
+        return FALSE;
+    }
+
+    connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &err);
+    if (!connection) {
+        g_set_error (error,
+                     CPUFREQ_SELECTOR_SERVICE_ERROR,
+                     SERVICE_ERROR_DBUS,
+                     "Couldn't connect to system bus: %s",
+                     err->message);
+        g_error_free (err);
+
+        return FALSE;
+    }
+
+    bus_proxy = dbus_g_proxy_new_for_name (connection,
+                                           DBUS_SERVICE_DBUS,
+                                           DBUS_PATH_DBUS,
+                                           DBUS_INTERFACE_DBUS);
+    if (!bus_proxy) {
+        g_set_error (error,
+                     CPUFREQ_SELECTOR_SERVICE_ERROR,
+                     SERVICE_ERROR_DBUS,
+                     "Could not construct bus_proxy object");
+        return FALSE;
+    }
+
+    res = dbus_g_proxy_call (bus_proxy,
+                             "RequestName",
+                             &err,
+                             G_TYPE_STRING, BUS_NAME,
+                             G_TYPE_UINT, DBUS_NAME_FLAG_DO_NOT_QUEUE,
+                             G_TYPE_INVALID,
+                             G_TYPE_UINT, &result,
+                             G_TYPE_INVALID);
+    g_object_unref (bus_proxy);
+
+    if (!res) {
+        if (err) {
+            g_set_error (error,
+                         CPUFREQ_SELECTOR_SERVICE_ERROR,
+                         SERVICE_ERROR_DBUS,
+                         "Failed to acquire %s: %s",
+                         BUS_NAME, err->message);
+            g_error_free (err);
+        } else {
+            g_set_error (error,
+                         CPUFREQ_SELECTOR_SERVICE_ERROR,
+                         SERVICE_ERROR_DBUS,
+                         "Failed to acquire %s", BUS_NAME);
+        }
+
+        return FALSE;
+    }
+
+    if (result == DBUS_REQUEST_NAME_REPLY_EXISTS) {
+        g_set_error (error,
+                     CPUFREQ_SELECTOR_SERVICE_ERROR,
+                     SERVICE_ERROR_ALREADY_REGISTERED,
+                     "Service %s already registered", BUS_NAME);
+        return FALSE;
+    }
+
+    service->authority = polkit_authority_get_sync (NULL, NULL);
+
+    service->system_bus = connection;
+
+    dbus_g_object_type_install_info (CPUFREQ_TYPE_SELECTOR_SERVICE,
+                                     &dbus_glib_cpufreq_selector_service_object_info);
+    dbus_g_connection_register_g_object (connection,
+                                         "/org/mate/cpufreq_selector/selector",
+                                         G_OBJECT (service));
+    dbus_g_error_domain_register (CPUFREQ_SELECTOR_SERVICE_ERROR, NULL,
+                                  CPUFREQ_TYPE_SELECTOR_SERVICE_ERROR);
+
+    reset_killtimer ();
+
+    return TRUE;
+}
+
+static CPUFreqSelector *
+get_selector_for_cpu (CPUFreqSelectorService *service,
+                      guint                   cpu)
+{
+    if (!service->selectors[cpu]) {
+        service->selectors[cpu] = cpufreq_selector_factory_create_selector (cpu);
+        if (!service->selectors[cpu])
+            return NULL;
+
+        if (service->selectors_max < cpu)
+            service->selectors_max = cpu;
+    }
+
+    return service->selectors[cpu];
+}
+
+/* PolicyKit */
+static gboolean
+cpufreq_selector_service_check_policy (CPUFreqSelectorService *service,
+                                       DBusGMethodInvocation  *context,
+                                       GError                **error)
+{
+    PolkitSubject             *subject;
+    PolkitAuthorizationResult *result;
+    gchar                     *sender;
+    gboolean                   ret;
+
+    sender = dbus_g_method_get_sender (context);
+    subject = polkit_system_bus_name_new (sender);
+    g_free (sender);
+
+    result = polkit_authority_check_authorization_sync (service->authority,
+                                                        subject,
+                                                        "org.mate.cpufreqselector",
+                                                        NULL,
+                                                        POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
+                                                        NULL, error);
+    g_object_unref (subject);
+
+    if (*error) {
+        g_warning ("Check policy: %s", (*error)->message);
+        g_object_unref (result);
+
+        return FALSE;
+    }
+
+    ret = polkit_authorization_result_get_is_authorized (result);
+    if (!ret) {
+        g_set_error (error,
+                     CPUFREQ_SELECTOR_SERVICE_ERROR,
+                     SERVICE_ERROR_NOT_AUTHORIZED,
+                     "Caller is not authorized");
+    }
+
+    g_object_unref (result);
+
+    return ret;
+}
+
+/* D-BUS interface */
+gboolean
+cpufreq_selector_service_set_frequency (CPUFreqSelectorService *service,
+                                        guint                   cpu,
+                                        guint                   frequency,
+                                        DBusGMethodInvocation  *context)
+{
+    CPUFreqSelector *selector;
+    GError          *error = NULL;
+
+    reset_killtimer ();
+
+    if (!cpufreq_selector_service_check_policy (service, context, &error)) {
+        dbus_g_method_return_error (context, error);
+        g_error_free (error);
+
+        return FALSE;
+    }
+
+    if (cpu > MAX_CPUS) {
+        GError *err;
+
+        err = g_error_new (CPUFREQ_SELECTOR_SERVICE_ERROR,
+                           SERVICE_ERROR_DBUS,
+                           "Error setting frequency on cpu %d: Invalid cpu",
+                           cpu);
+        dbus_g_method_return_error (context, err);
+        g_error_free (err);
+
+        return FALSE;
+    }
+
+    selector = get_selector_for_cpu (service, cpu);
+    if (!selector) {
+        GError *err;
+
+        err = g_error_new (CPUFREQ_SELECTOR_SERVICE_ERROR,
+                           SERVICE_ERROR_DBUS,
+                           "Error setting frequency on cpu %d: No cpufreq support",
+                           cpu);
+        dbus_g_method_return_error (context, err);
+        g_error_free (err);
+
+        return FALSE;
+    }
+
+    cpufreq_selector_set_frequency (selector, frequency, &error);
+    if (error) {
+        GError *err;
+
+        err = g_error_new (CPUFREQ_SELECTOR_SERVICE_ERROR,
+                           SERVICE_ERROR_DBUS,
+                           "Error setting frequency %d on cpu %d: %s",
+                           frequency, cpu, error->message);
+        dbus_g_method_return_error (context, err);
+        g_error_free (err);
+        g_error_free (error);
+
+        return FALSE;
+    }
+
+    dbus_g_method_return (context);
+
+    return TRUE;
+}
+
+gboolean
+cpufreq_selector_service_set_governor (CPUFreqSelectorService *service,
+                                       guint                   cpu,
+                                       const gchar            *governor,
+                                       DBusGMethodInvocation  *context)
+{
+    CPUFreqSelector *selector;
+    GError          *error = NULL;
+
+    reset_killtimer ();
+
+    if (!cpufreq_selector_service_check_policy (service, context, &error)) {
+        dbus_g_method_return_error (context, error);
+        g_error_free (error);
+
+        return FALSE;
+    }
+
+    if (cpu > MAX_CPUS) {
+        GError *err;
+
+        err = g_error_new (CPUFREQ_SELECTOR_SERVICE_ERROR,
+                           SERVICE_ERROR_DBUS,
+                           "Error setting governor on cpu %d: Invalid cpu",
+                           cpu);
+        dbus_g_method_return_error (context, err);
+        g_error_free (err);
+
+        return FALSE;
+    }
+
+    selector = get_selector_for_cpu (service, cpu);
+    if (!selector) {
+        GError *err;
+
+        err = g_error_new (CPUFREQ_SELECTOR_SERVICE_ERROR,
+                           SERVICE_ERROR_DBUS,
+                           "Error setting governor on cpu %d: No cpufreq support",
+                           cpu);
+        dbus_g_method_return_error (context, err);
+        g_error_free (err);
+
+        return FALSE;
+    }
+
+    cpufreq_selector_set_governor (selector, governor, &error);
+    if (error) {
+        GError *err;
+
+        err = g_error_new (CPUFREQ_SELECTOR_SERVICE_ERROR,
+                           SERVICE_ERROR_DBUS,
+                           "Error setting governor %s on cpu %d: %s",
+                           governor, cpu, error->message);
+        dbus_g_method_return_error (context, err);
+        g_error_free (err);
+        g_error_free (error);
+
+        return FALSE;
+    }
+
+    dbus_g_method_return (context);
+
+    return TRUE;
+}
+
+gboolean
+cpufreq_selector_service_can_set (CPUFreqSelectorService *service,
+                                  DBusGMethodInvocation  *context)
+{
+    PolkitSubject             *subject;
+    PolkitAuthorizationResult *result;
+    gchar                     *sender;
+    gboolean                   ret;
+    GError                    *error = NULL;
+
+    reset_killtimer ();
+
+    sender = dbus_g_method_get_sender (context);
+    subject = polkit_system_bus_name_new (sender);
+    g_free (sender);
+
+    result = polkit_authority_check_authorization_sync (service->authority,
+                                                        subject,
+                                                        "org.mate.cpufreqselector",
+                                                        NULL,
+                                                        0,
+                                                        NULL,
+                                                        &error);
+    g_object_unref (subject);
+
+    if (error) {
+        dbus_g_method_return_error (context, error);
+        g_error_free (error);
+
+        return FALSE;
+    }
+
+    if (polkit_authorization_result_get_is_authorized (result)) {
+        ret = TRUE;
+    } else if (polkit_authorization_result_get_is_challenge (result)) {
+        ret = TRUE;
+    } else {
+        ret = FALSE;
+    }
+
+    g_object_unref (result);
+
+    dbus_g_method_return (context, ret);
+
+    return TRUE;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/47.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/47.html new file mode 100644 index 00000000..39b63356 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/47.html @@ -0,0 +1,379 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
/*
+ * MATE CPUFreq Applet
+ * Copyright (C) 2008 Carlos Garcia Campos <carlosgc@gnome.org>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This 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
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __CPUFREQ_SELECTOR_SERVICE_H__
+#define __CPUFREQ_SELECTOR_SERVICE_H__
+
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <dbus/dbus-glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define CPUFREQ_TYPE_SELECTOR_SERVICE            (cpufreq_selector_service_get_type ())
+#define CPUFREQ_SELECTOR_SERVICE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CPUFREQ_TYPE_SELECTOR_SERVICE, CPUFreqSelectorService))
+#define CPUFREQ_SELECTOR_SERVICE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), CPUFREQ_TYPE_SELECTOR_SERVICE, CPUFreqSelectorServiceClass))
+#define CPUFREQ_IS_SELECTOR_SERVICE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CPUFREQ_TYPE_SELECTOR_SERVICE))
+#define CPUFREQ_IS_SELECTOR_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CPUFREQ_TYPE_SELECTOR_SERVICE))
+#define CPUFREQ_SELECTOR_SERVICE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CPUFREQ_TYPE_SELECTOR_SERVICE, CPUFreqSelectorServiceClass))
+
+#define SELECTOR_SERVICE                         (cpufreq_selector_service_get_instance ())
+
+#define CPUFREQ_SELECTOR_SERVICE_ERROR           (cpufreq_selector_service_error_quark ())
+#define CPUFREQ_TYPE_SELECTOR_SERVICE_ERROR      (cpufreq_selector_service_error_get_type ())
+
+enum {
+    SERVICE_ERROR_GENERAL,
+    SERVICE_ERROR_DBUS,
+    SERVICE_ERROR_ALREADY_REGISTERED,
+    SERVICE_ERROR_NOT_AUTHORIZED
+};
+
+typedef struct _CPUFreqSelectorService        CPUFreqSelectorService;
+typedef struct _CPUFreqSelectorServiceClass   CPUFreqSelectorServiceClass;
+
+GType                   cpufreq_selector_service_get_type       (void) G_GNUC_CONST;
+GType                   cpufreq_selector_service_error_get_type (void) G_GNUC_CONST;
+GQuark                  cpufreq_selector_service_error_quark    (void) G_GNUC_CONST;
+CPUFreqSelectorService *cpufreq_selector_service_get_instance   (void);
+gboolean                cpufreq_selector_service_register       (CPUFreqSelectorService *service,
+                                                                 GError                **error);
+
+gboolean                cpufreq_selector_service_set_frequency  (CPUFreqSelectorService *service,
+                                                                 guint                   cpu,
+                                                                 guint                   frequency,
+                                                                 DBusGMethodInvocation  *context);
+gboolean                cpufreq_selector_service_set_governor   (CPUFreqSelectorService *service,
+                                                                 guint                   cpu,
+                                                                 const gchar            *governor,
+                                                                 DBusGMethodInvocation  *context);
+gboolean               cpufreq_selector_service_can_set         (CPUFreqSelectorService *service,
+                                                                 DBusGMethodInvocation  *context);
+
+G_END_DECLS
+
+#endif /* __CPUFREQ_SELECTOR_SERVICE_H__ */
+
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/48.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/48.html new file mode 100644 index 00000000..6a15c076 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/48.html @@ -0,0 +1,577 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
/* Generated by dbus-binding-tool; do not edit! */
+
+/* This file is generated by glib-genmarshal, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#ifdef G_ENABLE_DEBUG
+#define g_marshal_value_peek_boolean(v)  g_value_get_boolean (v)
+#define g_marshal_value_peek_char(v)     g_value_get_schar (v)
+#define g_marshal_value_peek_uchar(v)    g_value_get_uchar (v)
+#define g_marshal_value_peek_int(v)      g_value_get_int (v)
+#define g_marshal_value_peek_uint(v)     g_value_get_uint (v)
+#define g_marshal_value_peek_long(v)     g_value_get_long (v)
+#define g_marshal_value_peek_ulong(v)    g_value_get_ulong (v)
+#define g_marshal_value_peek_int64(v)    g_value_get_int64 (v)
+#define g_marshal_value_peek_uint64(v)   g_value_get_uint64 (v)
+#define g_marshal_value_peek_enum(v)     g_value_get_enum (v)
+#define g_marshal_value_peek_flags(v)    g_value_get_flags (v)
+#define g_marshal_value_peek_float(v)    g_value_get_float (v)
+#define g_marshal_value_peek_double(v)   g_value_get_double (v)
+#define g_marshal_value_peek_string(v)   (char*) g_value_get_string (v)
+#define g_marshal_value_peek_param(v)    g_value_get_param (v)
+#define g_marshal_value_peek_boxed(v)    g_value_get_boxed (v)
+#define g_marshal_value_peek_pointer(v)  g_value_get_pointer (v)
+#define g_marshal_value_peek_object(v)   g_value_get_object (v)
+#define g_marshal_value_peek_variant(v)  g_value_get_variant (v)
+#else /* !G_ENABLE_DEBUG */
+/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
+ *          Do not access GValues directly in your code. Instead, use the
+ *          g_value_get_*() functions
+ */
+#define g_marshal_value_peek_boolean(v)  (v)->data[0].v_int
+#define g_marshal_value_peek_char(v)     (v)->data[0].v_int
+#define g_marshal_value_peek_uchar(v)    (v)->data[0].v_uint
+#define g_marshal_value_peek_int(v)      (v)->data[0].v_int
+#define g_marshal_value_peek_uint(v)     (v)->data[0].v_uint
+#define g_marshal_value_peek_long(v)     (v)->data[0].v_long
+#define g_marshal_value_peek_ulong(v)    (v)->data[0].v_ulong
+#define g_marshal_value_peek_int64(v)    (v)->data[0].v_int64
+#define g_marshal_value_peek_uint64(v)   (v)->data[0].v_uint64
+#define g_marshal_value_peek_enum(v)     (v)->data[0].v_long
+#define g_marshal_value_peek_flags(v)    (v)->data[0].v_ulong
+#define g_marshal_value_peek_float(v)    (v)->data[0].v_float
+#define g_marshal_value_peek_double(v)   (v)->data[0].v_double
+#define g_marshal_value_peek_string(v)   (v)->data[0].v_pointer
+#define g_marshal_value_peek_param(v)    (v)->data[0].v_pointer
+#define g_marshal_value_peek_boxed(v)    (v)->data[0].v_pointer
+#define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer
+#define g_marshal_value_peek_object(v)   (v)->data[0].v_pointer
+#define g_marshal_value_peek_variant(v)  (v)->data[0].v_pointer
+#endif /* !G_ENABLE_DEBUG */
+
+#define dbus_glib_marshal_cpufreq_selector_service_VOID__POINTER	g_cclosure_marshal_VOID__POINTER
+
+#define dbus_glib_marshal_cpufreq_selector_service_NONE__POINTER	dbus_glib_marshal_cpufreq_selector_service_VOID__POINTER
+
+/* Prototype for -Wmissing-prototypes */
+G_BEGIN_DECLS
+extern
+void dbus_glib_marshal_cpufreq_selector_service_VOID__UINT_UINT_POINTER (GClosure     *closure,
+                                                                         GValue       *return_value,
+                                                                         guint         n_param_values,
+                                                                         const GValue *param_values,
+                                                                         gpointer      invocation_hint,
+                                                                         gpointer      marshal_data);
+G_END_DECLS
+void
+dbus_glib_marshal_cpufreq_selector_service_VOID__UINT_UINT_POINTER (GClosure     *closure,
+                                                                    GValue       *return_value G_GNUC_UNUSED,
+                                                                    guint         n_param_values,
+                                                                    const GValue *param_values,
+                                                                    gpointer      invocation_hint G_GNUC_UNUSED,
+                                                                    gpointer      marshal_data)
+{
+  typedef void (*GMarshalFunc_VOID__UINT_UINT_POINTER) (gpointer data1,
+                                                        guint arg1,
+                                                        guint arg2,
+                                                        gpointer arg3,
+                                                        gpointer data2);
+  GCClosure *cc = (GCClosure *) closure;
+  gpointer data1, data2;
+  GMarshalFunc_VOID__UINT_UINT_POINTER callback;
+
+  g_return_if_fail (n_param_values == 4);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_VOID__UINT_UINT_POINTER) (marshal_data ? marshal_data : cc->callback);
+
+  callback (data1,
+            g_marshal_value_peek_uint (param_values + 1),
+            g_marshal_value_peek_uint (param_values + 2),
+            g_marshal_value_peek_pointer (param_values + 3),
+            data2);
+}
+
+#define dbus_glib_marshal_cpufreq_selector_service_NONE__UINT_UINT_POINTER	dbus_glib_marshal_cpufreq_selector_service_VOID__UINT_UINT_POINTER
+
+/* Prototype for -Wmissing-prototypes */
+G_BEGIN_DECLS
+extern
+void dbus_glib_marshal_cpufreq_selector_service_VOID__UINT_STRING_POINTER (GClosure     *closure,
+                                                                           GValue       *return_value,
+                                                                           guint         n_param_values,
+                                                                           const GValue *param_values,
+                                                                           gpointer      invocation_hint,
+                                                                           gpointer      marshal_data);
+G_END_DECLS
+void
+dbus_glib_marshal_cpufreq_selector_service_VOID__UINT_STRING_POINTER (GClosure     *closure,
+                                                                      GValue       *return_value G_GNUC_UNUSED,
+                                                                      guint         n_param_values,
+                                                                      const GValue *param_values,
+                                                                      gpointer      invocation_hint G_GNUC_UNUSED,
+                                                                      gpointer      marshal_data)
+{
+  typedef void (*GMarshalFunc_VOID__UINT_STRING_POINTER) (gpointer data1,
+                                                          guint arg1,
+                                                          gpointer arg2,
+                                                          gpointer arg3,
+                                                          gpointer data2);
+  GCClosure *cc = (GCClosure *) closure;
+  gpointer data1, data2;
+  GMarshalFunc_VOID__UINT_STRING_POINTER callback;
+
+  g_return_if_fail (n_param_values == 4);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_VOID__UINT_STRING_POINTER) (marshal_data ? marshal_data : cc->callback);
+
+  callback (data1,
+            g_marshal_value_peek_uint (param_values + 1),
+            g_marshal_value_peek_string (param_values + 2),
+            g_marshal_value_peek_pointer (param_values + 3),
+            data2);
+}
+
+#define dbus_glib_marshal_cpufreq_selector_service_NONE__UINT_STRING_POINTER	dbus_glib_marshal_cpufreq_selector_service_VOID__UINT_STRING_POINTER
+
+#include <dbus/dbus-glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+static const DBusGMethodInfo dbus_glib_cpufreq_selector_service_methods[] = {
+  { (GCallback) cpufreq_selector_service_set_frequency, dbus_glib_marshal_cpufreq_selector_service_NONE__UINT_UINT_POINTER, 0 },
+  { (GCallback) cpufreq_selector_service_set_governor, dbus_glib_marshal_cpufreq_selector_service_NONE__UINT_STRING_POINTER, 63 },
+  { (GCallback) cpufreq_selector_service_can_set, dbus_glib_marshal_cpufreq_selector_service_NONE__POINTER, 124 },
+};
+
+const DBusGObjectInfo dbus_glib_cpufreq_selector_service_object_info = {  1,
+  dbus_glib_cpufreq_selector_service_methods,
+  3,
+"org.mate.CPUFreqSelector\0SetFrequency\0A\0cpu\0I\0u\0frequency\0I\0u\0\0org.mate.CPUFreqSelector\0SetGovernor\0A\0cpu\0I\0u\0governor\0I\0s\0\0org.mate.CPUFreqSelector\0CanSet\0A\0result\0O\0F\0N\0b\0\0\0",
+"\0",
+"\0"
+};
+
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/5.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/5.html new file mode 100644 index 00000000..8908d787 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/5.html @@ -0,0 +1,1241 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
/* apmlib.c -- Sample APM interface routines
+ * Created: Mon Jan  8 10:28:16 1996 by faith@acm.org
+ * Revised: Fri Dec 26 21:38:29 1997 by faith@acm.org
+ * Copyright 1996, 1997 Rickard E. Faith (faith@acm.org)
+ * 
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <fcntl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <ctype.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/stat.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/ioctl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/sysmacros.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "apm.h"
+
+#define BACKWARD_COMPAT 1
+
+/* If APM support of the right version exists in kernel, return zero.
+ * Otherwise, return 1 if no support exists, or 2 if it is the wrong
+ * version.  *NOTE* The sense of the return value is not intuitive.
+ */
+int
+apm_exists (void)
+{
+    apm_info i;
+
+    if (access (APM_PROC, R_OK))
+        return 1;
+    return apm_read (&i);
+}
+
+/* Read information from /proc/apm.  Return 0 on success, 1 if APM not
+ * installed, 2 if APM installed, but old version. 
+ */
+int
+apm_read (apm_info * i)
+{
+    FILE *str;
+    char units[10];
+    char buffer[100];
+    int retcode = 0;
+
+    if (!(str = fopen (APM_PROC, "r")))
+        return 1;
+
+    if (fgets (buffer, sizeof (buffer) - 1, str) == NULL)
+        printf ("fgets error\n");
+
+    buffer[sizeof (buffer) - 1] = '\0';
+
+    /* Should check for other driver versions; driver 1.9 (and some
+     * others) uses this format, which doesn't expose # batteries.
+     */
+    sscanf (buffer, "%s %d.%d %hx %hx %hx %hx %d%% %d %s\n",
+            (char *) i->driver_version,
+            &i->apm_version_major,
+            &i->apm_version_minor,
+            &i->apm_flags,
+            &i->ac_line_status,
+            &i->battery_status,
+            &i->battery_flags,
+            &i->battery_percentage,
+            &i->battery_time,
+            units);
+    i->using_minutes = !strncmp (units, "min", 3) ? 1 : 0;
+    if (i->driver_version[0] == 'B')
+    {                /* old style.  argh. */
+#if !BACKWARD_COMPAT
+    retcode = 2;
+#else
+    strcpy ((char *) i->driver_version, "pre-0.7");
+    i->apm_version_major = 0;
+    i->apm_version_minor = 0;
+    i->apm_flags = 0;
+    i->ac_line_status = 0xff;
+    i->battery_status = 0xff;
+    i->battery_flags = 0xff;
+    i->battery_percentage = -1;
+    i->battery_time = -1;
+    i->using_minutes = 1;
+
+    sscanf (buffer, "BIOS version: %d.%d",
+            &i->apm_version_major, &i->apm_version_minor);
+
+    if (fgets (buffer, sizeof (buffer) - 1, str) == NULL)
+        printf ("fgets error\n");
+
+    sscanf (buffer, "Flags: 0x%02hx", &i->apm_flags);
+    if (i->apm_flags & APM_32_BIT_SUPPORT)
+    {
+        if (fgets (buffer, sizeof (buffer) - 1, str) == NULL)
+            printf ("fgets error\n");
+
+        if (fgets (buffer, sizeof (buffer) - 1, str) == NULL)
+            printf ("fgets error\n");
+
+        if (buffer[0] != 'P')
+        {
+            if (!strncmp (buffer + 4, "off line", 8))
+                i->ac_line_status = 0;
+            else if (!strncmp (buffer + 4, "on line", 7))
+                i->ac_line_status = 1;
+            else if (!strncmp (buffer + 4, "on back", 7))
+                i->ac_line_status = 2;
+
+            if (fgets (buffer, sizeof (buffer) - 1, str) == NULL)
+                printf ("fgets error\n");
+
+            if (!strncmp (buffer + 16, "high", 4))
+                i->battery_status = 0;
+            else if (!strncmp (buffer + 16, "low", 3))
+                i->battery_status = 1;
+            else if (!strncmp (buffer + 16, "crit", 4))
+                i->battery_status = 2;
+            else if (!strncmp (buffer + 16, "charg", 5))
+                i->battery_status = 3;
+
+            if (fgets (buffer, sizeof (buffer) - 1, str) == NULL)
+                printf ("fgets error\n");
+
+            if (strncmp (buffer + 14, "unknown", 7))
+                i->battery_percentage = atoi (buffer + 14);
+            if (i->apm_version_major >= 1 && i->apm_version_minor >= 1)
+            {
+                if (fgets (buffer, sizeof (buffer) - 1, str) == NULL)
+                    printf ("fgets error\n");
+
+                sscanf (buffer, "Battery flag: 0x%02hx", &i->battery_flags);
+
+                if (fgets (buffer, sizeof (buffer) - 1, str) == NULL)
+                    printf ("fgets error\n");
+
+                if (strncmp (buffer + 14, "unknown", 7))
+                    i->battery_time = atoi (buffer + 14);
+            }
+        }
+    }
+#endif
+    }
+
+    /* Fix possible kernel bug -- percentage
+     * set to 0xff (==255) instead of -1. 
+     */
+    if (i->battery_percentage > 100)
+        i->battery_percentage = -1;
+
+    fclose (str);
+    return retcode;
+}
+
+/* Lookup the device number for the apm_bios device. */
+dev_t apm_dev (void)
+{
+    FILE *str;
+    static int cached = -1;
+    char buf[80];
+    char *pt;
+    apm_info i;
+
+    if (cached >= 0)
+        return cached;
+
+    if (access (APM_PROC, R_OK) || apm_read (&i) == 1)
+        return cached = -1;
+    if (i.driver_version[0] == '1')
+        return cached = makedev (10, 134);
+
+    if (!(str = fopen (APM_DEV, "r")))
+        return -1;
+    while (fgets (buf, sizeof (buf) - 1, str))
+    {
+        buf[sizeof (buf) - 1] = '\0';
+        for (pt = buf; *pt && isspace (*pt); ++pt);    /* skip leading spaces */
+        for (; *pt && !isspace (*pt); ++pt);    /* find next space */
+        if (isspace (*pt))
+        {
+            *pt++ = '\0';
+            pt[strlen (pt) - 1] = '\0';    /* get rid of newline */
+            if (!strcmp (pt, APM_NAME))
+            {
+                fclose (str);
+                return cached = makedev (atoi (buf), 0);
+            }
+        }
+    }
+    fclose (str);
+    return cached = -1;
+}
+
+/* Return a file descriptor for the apm_bios device, or -1 if there is an
+ * error.  Is this method secure?  Should we make the device in /dev
+ * instead of /tmp? 
+ *
+ * apenwarr 2001/05/11: just throw out the weird temporary device file stuff.
+ * It was only for ancient kernel versions anyway.
+ */
+int
+apm_open (void)
+{
+    int fd;
+    apm_info i;
+
+    if (access (APM_PROC, R_OK) || apm_read (&i) == 1)
+        return -1;
+    if (i.driver_version[0] >= '1')
+    {
+        if ((fd = open (APM_DEVICE, O_RDWR)) < 0)
+        {
+            /* Try to create it.  This is reasonable
+             * for backward compatibility.
+             */
+            if (mknod (APM_DEVICE, S_IFCHR | S_IRUSR | S_IWUSR, apm_dev ()))
+            {
+                unlink (APM_DEVICE);
+                return -1;
+            }
+            fd = open (APM_DEVICE, O_RDWR);
+        }
+        return fd;
+    }
+    return -1;
+}
+
+/* Given a file descriptor for the apm_bios device, close it. */
+int
+apm_close (int fd)
+{
+    return close (fd);
+}
+
+/* Given a file descriptor for the apm_bios device, this routine will wait
+ * timeout seconds for APM events.  Up to n events will be placed in the
+ * events queue.  The return code will indicate the number of events
+ * stored.  Since this routine uses select (2), it will return if an
+ * unblocked signal is caught.  A timeout < 0 means to block indefinately.
+ *
+ * Note that if you read a request to standby or to suspend, the kernel
+ * will be waiting for you to respond to it with a call to apm_suspend ()
+ * or to apm_standby () !
+ */
+int
+apm_get_events (int fd, int timeout, apm_event_t * events, int n)
+{
+    int retcode;
+    fd_set fds;
+    struct timeval t;
+
+    t.tv_sec = timeout;
+    t.tv_usec = 0;
+
+    FD_ZERO (&fds);
+    FD_SET (fd, &fds);
+    retcode = select (fd + 1, &fds, NULL, NULL, timeout < 0 ? NULL : &t);
+    if (retcode <= 0)
+        return 0;
+    return read (fd, events, n * sizeof (apm_event_t)) / sizeof (apm_event_t);
+}
+
+/* Try to set the Power State to Suspend. */
+int
+apm_suspend (int fd)
+{
+    sync ();
+    return ioctl (fd, APM_IOC_SUSPEND, NULL);
+}
+
+/* Try to set the Power State to Standby. */
+int
+apm_standby (int fd)
+{
+    sync ();
+    return ioctl (fd, APM_IOC_STANDBY, NULL);
+}
+
+/* Return the last error code generated by the kernel APM driver */
+unsigned int
+apm_last_error ( int fd )
+{
+    int err = 0;
+
+#ifdef APM_IOC_LAST_ERROR
+    int ierr = 0;
+    if ((ierr = ioctl (fd, APM_IOC_LAST_ERROR, &err)))
+        return ierr;
+#endif
+    return err;
+}
+
+/* Define lookup table for error messages */
+typedef struct lookup_t {
+    int    key;
+    char*  msg;
+} lookup_t;
+
+/* APM error messages, arranged by error code */
+static const lookup_t error_table[] = {
+/* N/A { APM_SUCCESS, "Operation succeeded" }, */
+    { APM_DISABLED,        "Power management disabled" },
+    { APM_CONNECTED,       "Real mode interface already connected" },
+    { APM_NOT_CONNECTED,   "Interface not connected" },
+    { APM_16_CONNECTED,    "16 bit interface already connected" },
+/* N/A { APM_16_UNSUPPORTED, "16 bit interface not supported" }, */
+    { APM_32_CONNECTED,    "32 bit interface already connected" },
+    { APM_32_UNSUPPORTED,  "32 bit interface not supported" },
+    { APM_BAD_DEVICE,      "Unrecognized device ID" },
+    { APM_BAD_PARAM,       "Parameter out of range" },
+    { APM_NOT_ENGAGED,     "Interface not engaged" },
+#ifdef APM_BAD_FUNCTION
+    { APM_BAD_FUNCTION,    "Function not supported" },
+#endif
+#ifdef APM_RESUME_DISABLED
+    { APM_RESUME_DISABLED, "Resume timer disabled" },
+#endif
+    { APM_BAD_STATE,       "Unable to enter requested state" },
+/* N/A { APM_NO_EVENTS, "No events pending" }, */
+    { APM_NOT_PRESENT,     "No APM present" }
+};
+#define ERROR_COUNT (sizeof(error_table)/sizeof(lookup_t))
+
+/* Return character string describing error messages from APM kernel */
+const char *
+apm_error_name (unsigned int err)
+{
+  int i;
+  
+  for (i=0; i<ERROR_COUNT; i++)
+    if (err == error_table[i].key) return (error_table[i].msg);
+
+  return "Unknown error";
+}
+
+int
+apm_reject (int fd)
+{
+#ifdef APM_IOC_REJECT
+    if (ioctl fd, APM_IOC_REJECT, NULL )) <--- Unmatched ')'. Configuration: 'APM_IOC_REJECT'.
+        return apm_last_error (fd);
+    else
+#endif
+        return 0;
+}
+
+#ifdef APM_IOC_IGNORE   /* detect kernel support of IGNORE/NOIGNORE functions */
+int
+apm_set_ignore (int fd, int mode)
+/* Ignore Standby. */
+{
+    if (mode == IGNORE)
+    {
+        printf ("Telling kernel to ignore system standby/suspend mode\n");
+        return ioctl (fd, APM_IOC_IGNORE, NULL);
+    }
+    else
+    {
+        printf ("Telling kernel not to ignore system standby/suspend mode\n");
+        return ioctl (fd, APM_IOC_NOIGNORE, NULL);
+    }
+    printf ("NOTE: User-generated suspend/standby requests are not ignored\n");
+}
+#endif
+
+/* Return a string describing the event. From p. 16 of the Intel/Microsoft
+ * Advanded Power Management (APM) BIOS Interface Specification, Revision
+ * 1.1 (September 1993). Intel Order Number: 241704-001.  Microsoft Part
+ * Number: 781-110-X01.
+ *
+ * Updated to APM BIOS 1.2 spec (February 1996).  Available on-line.
+ */
+const char *
+apm_event_name (apm_event_t event)
+{
+    switch (event)
+    {
+    case APM_SYS_STANDBY:
+        return "System Standby Request";
+    case APM_SYS_SUSPEND:
+        return "System Suspend Request";
+    case APM_NORMAL_RESUME:
+        return "Normal Resume System";
+    case APM_CRITICAL_RESUME:
+        return "Critical Resume System";
+    case APM_LOW_BATTERY:
+        return "Battery Low";
+    case APM_POWER_STATUS_CHANGE:
+        return "Power Status Change";
+    case APM_UPDATE_TIME:
+        return "Update Time";
+    case APM_CRITICAL_SUSPEND:
+        return "Critical Suspend";
+    case APM_USER_STANDBY:
+        return "User System Standby Request";
+    case APM_USER_SUSPEND:
+        return "User System Suspend Request";
+    case APM_STANDBY_RESUME:
+        return "System Standby Resume";
+#ifdef APM_CAPABILITY_CHANGE
+    case APM_CAPABILITY_CHANGE:
+        return "Capability Change";
+#endif
+    }
+    return "Unknown";
+}
+
+/* This is a convenience function that has nothing to do with APM.  It just
+ * formats a time nicely.  If you don't like this format, then write your
+ * own.
+ */
+#define SEC_PER_DAY  (60*60*24)
+#define SEC_PER_HOUR (60*60)
+#define SEC_PER_MIN  (60)
+
+const char *
+apm_delta_time (time_t then, time_t now)
+{
+    return apm_time (now - then);
+}
+
+const char *
+apm_time (time_t t)
+{
+    static char buffer[128];
+    unsigned long s, m, h, d;
+
+    d = t / SEC_PER_DAY;
+    t -= d * SEC_PER_DAY;
+    h = t / SEC_PER_HOUR;
+    t -= h * SEC_PER_HOUR;
+    m = t / SEC_PER_MIN;
+    t -= m * SEC_PER_MIN;
+    s = t;
+
+    if (d)
+        sprintf (buffer, "%lu day%s, %02lu:%02lu:%02lu",
+                 d, d > 1 ? "s" : "", h, m, s);
+    else
+        sprintf (buffer, "%02lu:%02lu:%02lu", h, m, s);
+
+    if (t == -1)
+        sprintf (buffer, "unknown");
+
+    return buffer;
+}
+
+const char *
+apm_time_nosec (time_t t)
+{
+    static char buffer[128];
+    unsigned long s, m, h, d;
+
+    d = t / SEC_PER_DAY;
+    t -= d * SEC_PER_DAY;
+    h = t / SEC_PER_HOUR;
+    t -= h * SEC_PER_HOUR;
+    m = t / SEC_PER_MIN;
+    t -= m * SEC_PER_MIN;
+    s = t;
+
+    if (s > 30)
+        ++m;
+
+    if (d)
+        sprintf (buffer, "%lu day%s, %lu:%02lu",
+                 d, d > 1 ? "s" : "", h, m);
+    else
+        sprintf (buffer, "%lu:%02lu", h, m);
+
+    if (t == -1)
+        sprintf (buffer, "unknown");
+
+    return buffer;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/53.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/53.html new file mode 100644 index 00000000..6be761e0 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/53.html @@ -0,0 +1,2213 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
+875
+876
+877
+878
+879
+880
+881
+882
+883
+884
+885
+886
+887
+888
+889
+890
+891
+892
+893
+894
+895
+896
+897
+898
+899
+900
+901
+902
+903
+904
+905
+906
+907
+908
+909
+910
+911
+912
+913
+914
+915
+916
+917
+918
+919
+920
+921
+922
+923
+924
+925
+926
+927
+928
+929
+930
+931
+932
+933
+934
+935
+936
+937
+938
+939
+940
+941
+942
+943
+944
+945
+946
+947
+948
+949
+950
+951
+952
+953
+954
+955
+956
+957
+958
+959
+960
+961
+962
+963
+964
+965
+966
+967
+968
+969
+970
+971
+972
+973
+974
+975
+976
+977
+978
+979
+980
+981
+982
+983
+984
+985
+986
+987
+988
/* -*- mode: C; c-basic-offset: 4 -*-
+ * Drive Mount Applet
+ * Copyright (c) 2004 Canonical Ltd
+ * Copyright 2008 Pierre Ossman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author:
+ *   James Henstridge <jamesh@canonical.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "drive-button.h"
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkkeysyms.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gdesktopappinfo.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <libmate-desktop/mate-image-menu-item.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+enum {
+    CMD_NONE,
+    CMD_MOUNT_OR_PLAY,
+    CMD_UNMOUNT,
+    CMD_EJECT
+};
+
+/* type registration boilerplate code */
+G_DEFINE_TYPE (DriveButton, drive_button, GTK_TYPE_BUTTON)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
+
+static void     drive_button_set_volume   (DriveButton    *self,
+                                           GVolume        *volume);
+static void     drive_button_set_mount    (DriveButton    *self,
+                                           GMount         *mount);
+static void     drive_button_reset_popup  (DriveButton    *self);
+static void     drive_button_ensure_popup (DriveButton    *self);
+
+static void     drive_button_dispose      (GObject        *object);
+#if 0
+static void     drive_button_unrealize    (GtkWidget      *widget);
+#endif /* 0 */
+static gboolean drive_button_button_press (GtkWidget      *widget,
+                                           GdkEventButton *event);
+static gboolean drive_button_key_press    (GtkWidget      *widget,
+                                           GdkEventKey    *event);
+static void drive_button_theme_change     (GtkIconTheme   *icon_theme,
+                                           gpointer        data);
+
+static void
+drive_button_class_init (DriveButtonClass *class)
+{
+    G_OBJECT_CLASS (class)->dispose = drive_button_dispose;
+    GTK_WIDGET_CLASS (class)->button_press_event = drive_button_button_press;
+    GTK_WIDGET_CLASS (class)->key_press_event = drive_button_key_press;
+
+    GtkCssProvider *provider;
+
+    provider = gtk_css_provider_new ();
+
+    gtk_css_provider_load_from_data (provider,
+                                     "#drive-button {\n"
+                                     " border-width: 0px;\n"
+                                     " padding: 0px;\n"
+                                     " margin: 0px;\n"
+                                     "}",
+                                     -1, NULL);
+
+    gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
+                                    GTK_STYLE_PROVIDER (provider),
+                                    GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+    g_object_unref (provider);
+}
+
+static void
+drive_button_init (DriveButton *self)
+{
+    GtkWidget *image;
+
+    image = gtk_image_new ();
+    gtk_container_add (GTK_CONTAINER (self), image);
+    gtk_widget_show (image);
+
+    self->volume = NULL;
+    self->mount = NULL;
+    self->icon_size = 24;
+    self->update_tag = 0;
+
+    self->popup_menu = NULL;
+
+    gtk_widget_set_name (GTK_WIDGET (self), "drive-button");
+}
+
+GtkWidget *
+drive_button_new (GVolume *volume)
+{
+    DriveButton *self;
+
+    self = g_object_new (DRIVE_TYPE_BUTTON, NULL);
+    if (volume != NULL) {
+      drive_button_set_volume (self, volume);
+
+      g_signal_connect (gtk_icon_theme_get_default (), "changed",
+                        G_CALLBACK (drive_button_theme_change),
+                        self);
+    }
+
+    return (GtkWidget *)self;
+}
+
+GtkWidget *
+drive_button_new_from_mount (GMount *mount)
+{
+    DriveButton *self;
+
+    self = g_object_new (DRIVE_TYPE_BUTTON, NULL);
+    drive_button_set_mount (self, mount);
+
+    g_signal_connect (gtk_icon_theme_get_default (), "changed",
+                      G_CALLBACK (drive_button_theme_change),
+                      self);
+
+    return (GtkWidget *)self;
+}
+
+static void
+drive_button_dispose (GObject *object)
+{
+    DriveButton *self = DRIVE_BUTTON (object);
+
+    drive_button_set_volume (self, NULL);
+
+    if (self->update_tag)
+        g_source_remove (self->update_tag);
+    self->update_tag = 0;
+
+    drive_button_reset_popup (self);
+
+    if (G_OBJECT_CLASS (drive_button_parent_class)->dispose)
+        (* G_OBJECT_CLASS (drive_button_parent_class)->dispose) (object);
+}
+
+static gboolean
+drive_button_button_press (GtkWidget      *widget,
+                           GdkEventButton *event)
+{
+    DriveButton *self = DRIVE_BUTTON (widget);
+
+    /* don't consume non-button1 presses */
+    if (event->button == 1) {
+        drive_button_ensure_popup (self);
+        if (self->popup_menu) {
+            gtk_menu_popup_at_widget (GTK_MENU (self->popup_menu),
+                                      widget,
+                                      GDK_GRAVITY_SOUTH_WEST,
+                                      GDK_GRAVITY_NORTH_WEST,
+                                      (const GdkEvent*) event);
+        }
+        return TRUE;
+    }
+    return FALSE;
+}
+
+static gboolean
+drive_button_key_press (GtkWidget      *widget,
+                        GdkEventKey    *event)
+{
+    DriveButton *self = DRIVE_BUTTON (widget);
+
+    switch (event->keyval) {
+    case GDK_KEY_KP_Space:
+    case GDK_KEY_space:
+    case GDK_KEY_KP_Enter:
+    case GDK_KEY_Return:
+        drive_button_ensure_popup (self);
+        if (self->popup_menu) {
+            gtk_menu_popup_at_widget (GTK_MENU (self->popup_menu),
+                                      widget,
+                                      GDK_GRAVITY_SOUTH_WEST,
+                                      GDK_GRAVITY_NORTH_WEST,
+                                      (const GdkEvent*) event);
+        }
+        return TRUE;
+    }
+    return FALSE;
+}
+
+static void
+drive_button_theme_change (GtkIconTheme *icon_theme,
+                           gpointer      data)
+{
+    drive_button_queue_update (data);
+}
+
+static void
+drive_button_set_volume (DriveButton *self,
+                         GVolume     *volume)
+{
+    g_return_if_fail (DRIVE_IS_BUTTON (self));
+
+    if (self->volume) {
+        g_object_unref (self->volume);
+    }
+    self->volume = NULL;
+    if (self->mount) {
+        g_object_unref (self->mount);
+    }
+    self->mount = NULL;
+
+    if (volume) {
+        self->volume = g_object_ref (volume);
+    }
+    drive_button_queue_update (self);
+}
+
+static void
+drive_button_set_mount (DriveButton *self,
+                        GMount       *mount)
+{
+    g_return_if_fail (DRIVE_IS_BUTTON (self));
+
+    if (self->volume) {
+        g_object_unref (self->volume);
+    }
+    self->volume = NULL;
+    if (self->mount) {
+        g_object_unref (self->mount);
+    }
+    self->mount = NULL;
+
+    if (mount) {
+        self->mount = g_object_ref (mount);
+    }
+    drive_button_queue_update (self);
+}
+
+static gboolean
+drive_button_update (gpointer user_data)
+{
+    DriveButton *self;
+    GdkScreen *screen;
+    GtkIconTheme *icon_theme;
+    GtkIconInfo *icon_info;
+    GIcon *icon;
+    int width, height, scale;
+    cairo_t *cr;
+    cairo_surface_t *surface = NULL;
+    cairo_surface_t *tmp_surface = NULL;
+    GtkRequisition button_req, image_req;
+    char *display_name, *tip;
+
+    g_return_val_if_fail (DRIVE_IS_BUTTON (user_data), FALSE);
+    self = DRIVE_BUTTON (user_data);
+    self->update_tag = 0;
+
+    /* base the icon size on the desired button size */
+    drive_button_reset_popup (self);
+    scale = gtk_widget_get_scale_factor (GTK_WIDGET (self));
+    gtk_widget_get_preferred_size (GTK_WIDGET (self), NULL, &button_req);
+    gtk_widget_get_preferred_size (gtk_bin_get_child (GTK_BIN (self)), NULL, &image_req);
+    width = (self->icon_size - (button_req.width - image_req.width)) / scale;
+    height = (self->icon_size - (button_req.height - image_req.height)) / scale;
+
+    /* if no volume or mount, display general image */
+    if (!self->volume && !self->mount)
+    {
+        gtk_widget_set_tooltip_text (GTK_WIDGET (self), _("nothing to mount"));
+        screen = gtk_widget_get_screen (GTK_WIDGET (self));
+        icon_theme = gtk_icon_theme_get_for_screen (screen); //m
+        // note - other good icon would be emblem-unreadable
+        icon_info = gtk_icon_theme_lookup_icon_for_scale (icon_theme, "media-floppy",
+                                                          MIN (width, height), scale,
+                                                          GTK_ICON_LOOKUP_USE_BUILTIN);
+        if (icon_info) {
+            surface = gtk_icon_info_load_surface (icon_info, NULL, NULL);
+            g_object_unref (icon_info);
+        }
+
+        if (!surface)
+            return FALSE;
+
+        if (gtk_bin_get_child (GTK_BIN (self)) != NULL)
+            gtk_image_set_from_surface (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (self))), surface);
+
+        return FALSE;
+    }
+
+    gboolean is_mounted = FALSE;
+
+    if (self->volume)
+    {
+        GMount *mount;
+
+        display_name = g_volume_get_name (self->volume);
+        mount = g_volume_get_mount (self->volume);
+
+        if (mount)
+        {
+            is_mounted = TRUE;
+            tip = g_strdup_printf ("%s\n%s", display_name, _("(mounted)"));
+            icon = g_mount_get_icon (mount);
+            g_object_unref (mount);
+        }
+        else
+        {
+            is_mounted = FALSE;
+            tip = g_strdup_printf ("%s\n%s", display_name, _("(not mounted)"));
+            icon = g_volume_get_icon (self->volume);
+        }
+    } else
+    {
+        is_mounted = TRUE;
+        display_name = g_mount_get_name (self->mount);
+        tip = g_strdup_printf ("%s\n%s", display_name, _("(mounted)"));
+        icon = g_mount_get_icon (self->mount);
+    }
+
+    gtk_widget_set_tooltip_text (GTK_WIDGET (self), tip);
+    g_free (tip);
+    g_free (display_name);
+
+    screen = gtk_widget_get_screen (GTK_WIDGET (self));
+    icon_theme = gtk_icon_theme_get_for_screen (screen);
+    icon_info = gtk_icon_theme_lookup_by_gicon_for_scale (icon_theme, icon,
+                                                          MIN (width, height), scale,
+                                                          GTK_ICON_LOOKUP_USE_BUILTIN);
+    if (icon_info)
+    {
+        surface = gtk_icon_info_load_surface (icon_info, NULL, NULL);
+        g_object_unref (icon_info);
+    }
+
+    g_object_unref (icon);
+
+    if (!surface)
+        return FALSE;
+
+    // create a new surface because icon image can be shared by system
+    tmp_surface = cairo_surface_create_similar (surface,
+                                                cairo_surface_get_content (surface),
+                                                cairo_image_surface_get_width (surface) / scale,
+                                                cairo_image_surface_get_height (surface) / scale);
+
+    // if mounted, change icon
+    if (is_mounted)
+    {
+        int icon_width, icon_height, rowstride, n_channels, x, y;
+        guchar *pixels, *p;
+        gboolean has_alpha;
+
+        has_alpha = cairo_surface_get_content (tmp_surface) != CAIRO_CONTENT_COLOR;
+        n_channels = 3;
+        if (has_alpha)
+            n_channels++;
+
+        icon_width = cairo_image_surface_get_width (tmp_surface);
+        icon_height = cairo_image_surface_get_height (tmp_surface);
+
+        rowstride = cairo_image_surface_get_stride (tmp_surface);
+        pixels = cairo_image_surface_get_data (tmp_surface);
+
+        GdkRGBA color;
+        GSettings *settings;
+        settings = g_settings_new ("org.mate.drivemount");
+        gchar *color_string = g_settings_get_string (settings, "drivemount-checkmark-color");
+        if (!color_string)
+                color_string = g_strdup ("#00ff00");
+        gdk_rgba_parse (&color, color_string);
+        g_free (color_string);
+        g_object_unref (settings);
+
+        guchar red   = (guchar) (color.red   * 255.0);
+        guchar green = (guchar) (color.green * 255.0);
+        guchar blue  = (guchar) (color.blue  * 255.0);
+
+        int y_start = (int) (0.65 * (gdouble) icon_height);
+        int x_start = (int) (1.65 * (gdouble) icon_height);
+
+        for (y = y_start; y < icon_height; y++)
+            for (x = x_start - y; x < icon_width; x++)
+            {
+                p = pixels + y * rowstride + x * n_channels;
+                p[0] = red;
+                p[1] = green;
+                p[2] = blue;
+                if (has_alpha)
+                    p[3] = 255;
+            }
+    }
+
+    cr = cairo_create (tmp_surface);
+    cairo_set_operator (cr, CAIRO_OPERATOR_OVERLAY);
+    cairo_set_source_surface (cr, surface, 0, 0);
+    cairo_paint (cr);
+
+    gtk_image_set_from_surface (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (self))), tmp_surface);
+
+    cairo_surface_destroy (surface);
+    cairo_surface_destroy (tmp_surface);
+
+    gtk_widget_get_preferred_size (GTK_WIDGET (self), NULL, &button_req);
+
+    return FALSE;
+}
+
+void
+drive_button_queue_update (DriveButton *self)
+{
+    if (!self->update_tag) {
+        self->update_tag = g_idle_add (drive_button_update, self);
+    }
+}
+
+void
+drive_button_set_size (DriveButton *self,
+                       int icon_size)
+{
+    g_return_if_fail (DRIVE_IS_BUTTON (self));
+
+    if (self->icon_size != icon_size) {
+        self->icon_size = icon_size;
+        drive_button_queue_update (self);
+    }
+}
+
+void
+drive_button_redraw (gpointer key,
+                     gpointer value,
+                     gpointer user_data)
+{
+    DriveButton *button = value;
+    drive_button_queue_update (button);
+}
+
+int
+drive_button_compare (DriveButton *button,
+                      DriveButton *other_button)
+{
+    /* sort drives before driveless volumes volumes */
+    if (button->volume) {
+        if (other_button->volume) {
+            int cmp;
+            gchar *str1, *str2;
+
+            str1 = g_volume_get_name (button->volume);
+            str2 = g_volume_get_name (other_button->volume);
+            cmp = g_utf8_collate (str1, str2);
+            g_free (str2);
+            g_free (str1);
+
+            return cmp;
+        } else {
+            return -1;
+        }
+    } else {
+        if (other_button->volume) {
+            return 1;
+        } else {
+            int cmp;
+            gchar *str1, *str2;
+
+            str1 = g_mount_get_name (button->mount);
+            str2 = g_mount_get_name (other_button->mount);
+            cmp = g_utf8_collate (str1, str2);
+            g_free (str2);
+            g_free (str1);
+
+            return cmp;
+        }
+    }
+}
+
+static void
+drive_button_reset_popup (DriveButton *self)
+{
+    if (self->popup_menu)
+        gtk_widget_destroy (GTK_WIDGET (self->popup_menu));
+    self->popup_menu = NULL;
+}
+
+#if 0
+static void
+popup_menu_detach (GtkWidget *attach_widget, GtkMenu *menu)
+{
+    DRIVE_BUTTON (attach_widget)->popup_menu = NULL;
+}
+#endif /* 0 */
+
+static char *
+escape_underscores (const char *str)
+{
+    char *new_str;
+    int i, j, count;
+
+    /* count up how many underscores are in the string */
+    count = 0;
+    for (i = 0; str[i] != '\0'; i++) {
+        if (str[i] == '_')
+            count++;
+    }
+    /* copy to new string, doubling up underscores */
+    new_str = g_new (char, i + count + 1);
+    for (i = j = 0; str[i] != '\0'; i++, j++) {
+        new_str[j] = str[i];
+        if (str[i] == '_')
+            new_str[++j] = '_';
+    }
+    new_str[j] = '\0';
+    return new_str;
+}
+static GtkWidget *
+create_menu_item (DriveButton *self,
+                  const gchar *icon_name,
+                  const gchar *label,
+                  GCallback    callback,
+                  gboolean     sensitive)
+{
+    GtkWidget *item, *image;
+
+    item = mate_image_menu_item_new_with_mnemonic (label);
+    if (icon_name) {
+        image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
+        mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item), image);
+        gtk_widget_show (image);
+    }
+    if (callback)
+        g_signal_connect_object (item, "activate",
+                                 callback, self,
+                                 G_CONNECT_SWAPPED);
+    gtk_widget_set_sensitive (item, sensitive);
+    gtk_widget_show (item);
+    return item;
+}
+
+static void
+open_drive (DriveButton *self,
+            GtkWidget   *item)
+{
+    GdkScreen *screen;
+    GtkWidget *dialog;
+    GError *error = NULL;
+    GFile *file = NULL;
+    GList *files = NULL;
+    GdkAppLaunchContext *launch_context;
+    GAppInfo *app_info;
+
+    if (self->volume) {
+        GMount *mount;
+
+        mount = g_volume_get_mount (self->volume);
+        if (mount) {
+            file = g_mount_get_root (mount);
+            g_object_unref (mount);
+        }
+    } else if (self->mount) {
+        file = g_mount_get_root (self->mount);
+    } else
+        g_return_if_reached ();
+
+    app_info = g_app_info_get_default_for_type ("inode/directory", FALSE);
+    if (!app_info)
+      app_info = G_APP_INFO (g_desktop_app_info_new ("caja.desktop"));
+
+    if (app_info) {
+        GdkDisplay *display = gtk_widget_get_display (item);
+        launch_context = gdk_display_get_app_launch_context (display);
+        screen = gtk_widget_get_screen (GTK_WIDGET (self));
+        gdk_app_launch_context_set_screen (launch_context, screen);
+        files = g_list_prepend (files, file);
+        g_app_info_launch (app_info,
+        files,
+        G_APP_LAUNCH_CONTEXT (launch_context),
+        &error);
+
+        g_object_unref (launch_context);
+        g_list_free (files);
+    }
+
+    if (!app_info || error) {
+        dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
+                                                     GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                     GTK_MESSAGE_ERROR,
+                                                     GTK_BUTTONS_OK,
+                                                     _("Cannot execute Caja"));
+        if (error)
+            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message);
+        else
+            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "Could not find Caja");
+
+        g_signal_connect (dialog, "response",
+                          G_CALLBACK (gtk_widget_destroy),
+                          NULL);
+
+        gtk_widget_show (dialog);
+        g_error_free (error);
+    }
+
+    g_object_unref (file);
+}
+
+/* copied from mate-volume-manager/src/manager.c maybe there is a better way than
+ * duplicating this code? */
+
+/*
+ * gvm_run_command - run the given command, replacing %d with the device node
+ * and %m with the given path
+ */
+static void
+gvm_run_command (const char *device,
+                 const char *command,
+                 const char *path)
+{
+    char *argv[4];
+    gchar *new_command;
+    GError *error = NULL;
+    GString *exec = g_string_new (NULL);
+    char *p, *q;
+
+    /* perform s/%d/device/ and s/%m/path/ */
+    new_command = g_strdup (command);
+    q = new_command;
+    p = new_command;
+    while ((p = strchr (p, '%')) != NULL) {
+        if (*(p + 1) == 'd') {
+            *p = '\0';
+            g_string_append (exec, q);
+            g_string_append (exec, device);
+            q = p + 2;
+            p = p + 2;
+        } else if (*(p + 1) == 'm') {
+            *p = '\0';
+            g_string_append (exec, q);
+            g_string_append (exec, path);
+            q = p + 2;
+            p = p + 2;
+        } else {
+            /* Ignore anything else. */
+            p++;
+        }
+    }
+    g_string_append (exec, q);
+
+    argv[0] = "/bin/sh";
+    argv[1] = "-c";
+    argv[2] = exec->str;
+    argv[3] = NULL;
+
+    g_spawn_async (g_get_home_dir (), argv, NULL, 0, NULL, NULL,
+                   NULL, &error);
+    if (error) {
+        g_warning ("failed to exec %s: %s\n", exec->str, error->message);
+        g_error_free (error);
+    }
+
+    g_string_free (exec, TRUE);
+    g_free (new_command);
+}
+
+/*
+ * gvm_check_dvd_only - is this a Video DVD?
+ *
+ * Returns TRUE if this was a Video DVD and FALSE otherwise.
+ * (the original in gvm was also running the autoplay action,
+ * I removed that code, so I renamed from gvm_check_dvd to
+ * gvm_check_dvd_only)
+ */
+static gboolean
+gvm_check_dvd_only (const char *udi,
+                    const char *device,
+                    const char *mount_point)
+{
+    char *path;
+    gboolean retval;
+
+    path = g_build_path (G_DIR_SEPARATOR_S, mount_point, "video_ts", NULL);
+    retval = g_file_test (path, G_FILE_TEST_IS_DIR);
+    g_free (path);
+
+    /* try the other name, if needed */
+    if (retval == FALSE) {
+        path = g_build_path (G_DIR_SEPARATOR_S, mount_point,
+                             "VIDEO_TS", NULL);
+        retval = g_file_test (path, G_FILE_TEST_IS_DIR);
+        g_free (path);
+    }
+
+    return retval;
+}
+/* END copied from mate-volume-manager/src/manager.c */
+
+static gboolean
+check_dvd_video (DriveButton *self)
+{
+    GFile *file;
+    char *udi, *device_path, *mount_path;
+    gboolean result;
+    GMount *mount;
+
+    if (!self->volume)
+        return FALSE;
+
+    mount = g_volume_get_mount (self->volume);
+    if (!mount)
+        return FALSE;
+
+    file = g_mount_get_root (mount);
+    g_object_unref (mount);
+
+    if (!file)
+        return FALSE;
+
+    mount_path = g_file_get_path (file);
+
+    g_object_unref (file);
+
+    device_path = g_volume_get_identifier (self->volume,
+                                           G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
+    udi = g_volume_get_identifier (self->volume,
+                                   G_VOLUME_IDENTIFIER_KIND_HAL_UDI);
+
+    result = gvm_check_dvd_only (udi, device_path, mount_path);
+
+    g_free (device_path);
+    g_free (udi);
+    g_free (mount_path);
+
+    return result;
+}
+
+static gboolean
+check_audio_cd (DriveButton *self)
+{
+    GFile *file;
+    char *activation_uri;
+    GMount *mount;
+
+    if (!self->volume)
+        return FALSE;
+
+    mount = g_volume_get_mount (self->volume);
+    if (!mount)
+        return FALSE;
+
+    file = g_mount_get_root (mount);
+    g_object_unref (mount);
+
+    if (!file)
+        return FALSE;
+
+    activation_uri = g_file_get_uri (file);
+
+    g_object_unref (file);
+
+    /* we have an audioCD if the activation URI starts by 'cdda://' */
+    gboolean result = (strncmp ("cdda://", activation_uri, 7) == 0);
+    g_free (activation_uri);
+    return result;
+}
+
+static void
+run_command (DriveButton *self,
+             const char  *command)
+{
+    GFile *file;
+    char *mount_path, *device_path;
+    GMount *mount;
+
+    if (!self->volume)
+        return;
+
+    mount = g_volume_get_mount (self->volume);
+    if (!mount)
+        return;
+
+    file = g_mount_get_root (mount);
+    g_object_unref (mount);
+
+    g_assert (file);
+
+    mount_path = g_file_get_path (file);
+
+    g_object_unref (file);
+
+    device_path = g_volume_get_identifier (self->volume,
+                                           G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
+
+    gvm_run_command (device_path, command, mount_path);
+
+    g_free (mount_path);
+    g_free (device_path);
+}
+
+static void dummy_async_ready_callback (GObject      *source_object,
+                                        GAsyncResult *res,
+                                        gpointer      user_data)
+{
+    /* do nothing */
+}
+
+static void
+mount_drive (DriveButton *self,
+             GtkWidget   *item)
+{
+    if (self->volume) {
+        GMountOperation *mount_op = gtk_mount_operation_new (NULL);
+        g_volume_mount (self->volume, G_MOUNT_MOUNT_NONE,
+                        mount_op, NULL, dummy_async_ready_callback, NULL);
+        g_object_unref (mount_op);
+    } else {
+        g_return_if_reached ();
+    }
+}
+
+static void
+unmount_drive (DriveButton *self,
+               GtkWidget   *item)
+{
+    if (self->volume) {
+        GMount *mount;
+
+        mount = g_volume_get_mount (self->volume);
+        if (mount) {
+            g_mount_unmount_with_operation (mount, G_MOUNT_UNMOUNT_NONE,
+                                            NULL, NULL, dummy_async_ready_callback, NULL);
+            g_object_unref (mount);
+        }
+    } else if (self->mount) {
+        g_mount_unmount_with_operation (self->mount, G_MOUNT_UNMOUNT_NONE,
+                                        NULL, NULL, dummy_async_ready_callback, NULL);
+    } else {
+        g_return_if_reached ();
+    }
+}
+
+static void eject_finish (DriveButton  *self,
+                          GAsyncResult *res,
+                          gpointer      user_data)
+{
+    /* Do nothing. We shouldn't need this according to the GIO
+     * docs, but the applet crashes without it using glib 2.18.0 */
+}
+
+static void
+eject_drive (DriveButton *self,
+             GtkWidget   *item)
+{
+    if (self->volume) {
+        g_volume_eject_with_operation (self->volume, G_MOUNT_UNMOUNT_NONE,
+                                       NULL, NULL,
+                                       (GAsyncReadyCallback) eject_finish,
+                                       NULL);
+    } else if (self->mount) {
+        g_mount_eject_with_operation (self->mount, G_MOUNT_UNMOUNT_NONE,
+                                      NULL, NULL,
+                                      (GAsyncReadyCallback) eject_finish,
+                                      NULL);
+    } else {
+        g_return_if_reached ();
+    }
+}
+static void
+play_autoplay_media (DriveButton *self,
+                     const char  *dflt)
+{
+    run_command (self, dflt);
+}
+
+static void
+play_dvd (DriveButton *self,
+          GtkWidget   *item)
+{
+    /* FIXME add an option to set this */
+    play_autoplay_media (self, "totem %d");
+}
+
+static void
+play_cda (DriveButton *self,
+          GtkWidget   *item)
+{
+    /* FIXME add an option to set this */
+    play_autoplay_media (self, "sound-juicer -d %d");
+}
+
+static void
+drive_button_ensure_popup (DriveButton *self)
+{
+    char *display_name, *tmp, *label;
+    GtkWidget *item;
+    gboolean mounted, ejectable;
+
+    if (self->popup_menu) return;
+
+    mounted = FALSE;
+
+    if (self->volume) {
+        GMount *mount = NULL;
+
+        display_name = g_volume_get_name (self->volume);
+        ejectable = g_volume_can_eject (self->volume);
+
+        mount = g_volume_get_mount (self->volume);
+        if (mount) {
+            mounted = TRUE;
+            g_object_unref (mount);
+        }
+    } else {
+        if (!G_IS_MOUNT (self->volume))
+            return;
+        else {
+            display_name = g_mount_get_name (self->mount);
+            ejectable = g_mount_can_eject (self->mount);
+            mounted = TRUE;
+        }
+    }
+
+    self->popup_menu = gtk_menu_new ();
+
+    /* make sure the display name doesn't look like a mnemonic */
+    tmp = escape_underscores (display_name ? display_name : "(none)");
+    g_free (display_name);
+    display_name = tmp;
+
+    if (check_dvd_video (self)) {
+        item = create_menu_item (self, "media-playback-start",
+                                 _("_Play DVD"), G_CALLBACK (play_dvd),
+                                 TRUE);
+    } else if (check_audio_cd (self)) {
+        item = create_menu_item (self, "media-playback-start",
+                                 _("_Play CD"), G_CALLBACK (play_cda),
+                                 TRUE);
+    } else {
+        label = g_strdup_printf (_("_Open %s"), display_name);
+        item = create_menu_item (self, "document-open", label,
+                                 G_CALLBACK (open_drive), mounted);
+        g_free (label);
+    }
+    gtk_container_add (GTK_CONTAINER (self->popup_menu), item);
+
+    if (mounted) {
+        label = g_strdup_printf (_("Un_mount %s"), display_name);
+        item = create_menu_item (self, NULL, label,
+                                 G_CALLBACK (unmount_drive), TRUE);
+        g_free (label);
+        gtk_container_add (GTK_CONTAINER (self->popup_menu), item);
+    } else {
+        label = g_strdup_printf (_("_Mount %s"), display_name);
+        item = create_menu_item (self, NULL, label,
+                                 G_CALLBACK (mount_drive), TRUE);
+        g_free (label);
+        gtk_container_add (GTK_CONTAINER (self->popup_menu), item);
+    }
+
+    if (ejectable) {
+        label = g_strdup_printf (_("_Eject %s"), display_name);
+        item = create_menu_item (self, "media-eject", label,
+                                 G_CALLBACK (eject_drive), TRUE);
+        g_free (label);
+        gtk_container_add (GTK_CONTAINER (self->popup_menu), item);
+    }
+
+    /*Set up custom theme and transparency support */
+    GtkWidget *toplevel = gtk_widget_get_toplevel (self->popup_menu);
+    /* Fix any failures of compiz/other wm's to communicate with gtk for transparency */
+    GdkScreen *screen2 = gtk_widget_get_screen (GTK_WIDGET (toplevel));
+    GdkVisual *visual = gdk_screen_get_rgba_visual (screen2);
+    gtk_widget_set_visual (GTK_WIDGET (toplevel), visual);
+    /*set menu and it's toplevel window to follow panel theme */
+    GtkStyleContext *context;
+    context = gtk_widget_get_style_context (GTK_WIDGET (toplevel));
+    gtk_style_context_add_class (context,"gnome-panel-menu-bar");
+    gtk_style_context_add_class (context,"mate-panel-menu-bar");
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/54.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/54.html new file mode 100644 index 00000000..70f21105 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/54.html @@ -0,0 +1,379 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
/* -*- mode: C; c-basic-offset: 4 -*-
+ * Drive Mount Applet
+ * Copyright (c) 2004 Canonical Ltd
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author:
+ *   James Henstridge <jamesh@canonical.com>
+ */
+
+#ifndef DRIVE_BUTTON_H
+#define DRIVE_BUTTON_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define DRIVE_TYPE_BUTTON         (drive_button_get_type ())
+#define DRIVE_BUTTON(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), DRIVE_TYPE_BUTTON, DriveButton))
+#define DRIVE_BUTTON_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), DRIVE_TYPE_BUTTON, DriveButtonClass))
+#define DRIVE_IS_BUTTON(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), DRIVE_TYPE_BUTTON))
+#define DRIVE_IS_BUTTON_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), DRIVE_TYPE_BUTTON))
+#define DRIVE_BUTTON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DRIVE_TYPE_BUTTON, DriveButtonClass))
+
+typedef struct _DriveButton      DriveButton;
+typedef struct _DriveButtonClass DriveButtonClass;
+
+struct _DriveButton
+{
+    GtkButton parent;
+
+    GVolume *volume;
+    GMount *mount;
+    int icon_size;
+    guint update_tag;
+
+    GtkWidget *popup_menu;
+};
+
+struct _DriveButtonClass
+{
+    GtkButtonClass parent;
+};
+
+GType      drive_button_get_type        (void);
+GtkWidget *drive_button_new             (GVolume *volume);
+GtkWidget *drive_button_new_from_mount  (GMount *mount);
+void       drive_button_queue_update    (DriveButton *button);
+void       drive_button_set_size        (DriveButton *button,
+                                         int          icon_size);
+
+int        drive_button_compare         (DriveButton *button,
+                                         DriveButton *other_button);
+
+void       drive_button_redraw (gpointer key, gpointer value, gpointer user_data);
+
+G_END_DECLS
+
+#endif /* DRIVE_BUTTON_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/55.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/55.html new file mode 100644 index 00000000..6aa49baa --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/55.html @@ -0,0 +1,1279 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
/* -*- mode: C; c-basic-offset: 4 -*-
+ * Drive Mount Applet
+ * Copyright (c) 2004 Canonical Ltd
+ * Copyright 2008 Pierre Ossman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author:
+ *   James Henstridge <jamesh@canonical.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "drive-list.h"
+#include "drive-button.h"
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_DEFINE_TYPE (DriveList, drive_list, GTK_TYPE_GRID);
+
+static GVolumeMonitor *volume_monitor = NULL;
+
+static void drive_list_finalize (GObject *object);
+static void drive_list_dispose  (GObject *object);
+static void drive_list_add      (GtkContainer *container, GtkWidget *child);
+static void drive_list_remove   (GtkContainer *container, GtkWidget *child);
+
+static void mount_added         (GVolumeMonitor *monitor, GMount *mount, DriveList *self);
+static void mount_changed       (GVolumeMonitor *monitor, GMount *mount, DriveList *self);
+static void mount_removed       (GVolumeMonitor *monitor, GMount *mount, DriveList *self);
+static void volume_added        (GVolumeMonitor *monitor, GVolume *volume, DriveList *self);
+static void volume_changed      (GVolumeMonitor *monitor, GVolume *volume, DriveList *self);
+static void volume_removed      (GVolumeMonitor *monitor, GVolume *volume, DriveList *self);
+static void add_volume          (DriveList *self, GVolume *volume);
+static void remove_volume       (DriveList *self, GVolume *volume);
+static void add_mount           (DriveList *self, GMount *mount);
+static void remove_mount        (DriveList *self, GMount *mount);
+static void queue_relayout      (DriveList *self);
+
+static void
+drive_list_class_init (DriveListClass *class)
+{
+    G_OBJECT_CLASS (class)->finalize = drive_list_finalize;
+    G_OBJECT_CLASS (class)->dispose = drive_list_dispose;
+    GTK_CONTAINER_CLASS (class)->add = drive_list_add;
+    GTK_CONTAINER_CLASS (class)->remove = drive_list_remove;
+}
+
+static void
+drive_list_init (DriveList *self)
+{
+    GList *volumes, *mounts, *tmp;
+
+    gtk_grid_set_column_homogeneous (GTK_GRID (self), TRUE);
+    gtk_grid_set_row_homogeneous (GTK_GRID (self), TRUE);
+
+    self->volumes = g_hash_table_new (NULL, NULL);
+    self->mounts = g_hash_table_new (NULL, NULL);
+    self->orientation = GTK_ORIENTATION_HORIZONTAL;
+    self->layout_tag = 0;
+    self->settings = g_settings_new ("org.mate.drivemount");
+    self->icon_size = 24;
+    self->relief = GTK_RELIEF_NORMAL;
+
+    g_signal_connect (self->settings,
+                      "changed::drivemount-checkmark-color",
+                      G_CALLBACK (settings_color_changed),
+                      self);
+
+    /* listen for drive connects/disconnects, and add
+     * currently connected drives. */
+    self->count = 0;
+    if (!volume_monitor)
+        volume_monitor = g_volume_monitor_get ();
+
+    g_signal_connect_object (volume_monitor, "mount-added",
+                             G_CALLBACK (mount_added), self, 0);
+    g_signal_connect_object (volume_monitor, "mount-changed",
+                             G_CALLBACK (mount_changed), self, 0);
+    g_signal_connect_object (volume_monitor, "mount-removed",
+                             G_CALLBACK (mount_removed), self, 0);
+    g_signal_connect_object (volume_monitor, "volume-added",
+                             G_CALLBACK (volume_added), self, 0);
+    g_signal_connect_object (volume_monitor, "volume-changed",
+                             G_CALLBACK (volume_changed), self, 0);
+    g_signal_connect_object (volume_monitor, "volume-removed",
+                             G_CALLBACK (volume_removed), self, 0);
+    volumes = g_volume_monitor_get_volumes (volume_monitor);
+    for (tmp = volumes; tmp != NULL; tmp = tmp->next) {
+        GVolume *volume = tmp->data;
+        add_volume (self, volume);
+        g_object_unref (volume);
+        self->count++;
+    }
+    g_list_free (volumes);
+
+    mounts = g_volume_monitor_get_mounts (volume_monitor);
+    for (tmp = mounts; tmp != NULL; tmp = tmp->next) {
+        GMount *mount = tmp->data;
+        add_mount (self, mount);
+        g_object_unref (mount);
+        self->count++;
+    }
+    self->dummy = drive_button_new (NULL);
+    gtk_button_set_relief (GTK_BUTTON (self->dummy), self->relief);
+    drive_button_set_size (DRIVE_BUTTON (self->dummy), self->icon_size);
+
+    if (self->count == 0) {
+        gtk_container_add (GTK_CONTAINER (self), self->dummy);
+        queue_relayout (self);
+        drive_button_queue_update (DRIVE_BUTTON (self->dummy));
+    }
+    g_list_free (mounts);
+}
+
+GtkWidget *
+drive_list_new (void)
+{
+    return g_object_new (DRIVE_TYPE_LIST, NULL);
+}
+
+static void
+drive_list_finalize (GObject *object)
+{
+    DriveList *self = DRIVE_LIST (object);
+
+    g_hash_table_destroy (self->volumes);
+    g_hash_table_destroy (self->mounts);
+    g_object_unref (self->settings);
+
+    if (G_OBJECT_CLASS (drive_list_parent_class)->finalize)
+        (* G_OBJECT_CLASS (drive_list_parent_class)->finalize) (object);
+}
+
+static void
+drive_list_dispose (GObject *object)
+{
+    DriveList *self = DRIVE_LIST (object);
+
+    g_signal_handlers_disconnect_by_func (volume_monitor,
+                                          G_CALLBACK (mount_added), self);
+    g_signal_handlers_disconnect_by_func (volume_monitor,
+                                          G_CALLBACK (mount_changed), self);
+    g_signal_handlers_disconnect_by_func (volume_monitor,
+                                          G_CALLBACK (mount_removed), self);
+    g_signal_handlers_disconnect_by_func (volume_monitor,
+                                          G_CALLBACK (volume_added), self);
+    g_signal_handlers_disconnect_by_func (volume_monitor,
+                                          G_CALLBACK (volume_changed), self);
+    g_signal_handlers_disconnect_by_func (volume_monitor,
+                                          G_CALLBACK (volume_removed), self);
+
+    if (self->layout_tag)
+        g_source_remove (self->layout_tag);
+    self->layout_tag = 0;
+
+    if (G_OBJECT_CLASS (drive_list_parent_class)->dispose)
+        (* G_OBJECT_CLASS (drive_list_parent_class)->dispose) (object);
+}
+
+static void
+drive_list_add (GtkContainer *container,
+                GtkWidget    *child)
+{
+    DriveList *self;
+    DriveButton *button;
+
+    g_return_if_fail (DRIVE_IS_LIST (container));
+    g_return_if_fail (DRIVE_IS_BUTTON (child));
+
+    if (GTK_CONTAINER_CLASS (drive_list_parent_class)->add)
+        (* GTK_CONTAINER_CLASS (drive_list_parent_class)->add) (container, child);
+
+    self = DRIVE_LIST (container);
+    button = DRIVE_BUTTON (child);
+    if (button->volume)
+        g_hash_table_insert (self->volumes, button->volume, button);
+    else
+        g_hash_table_insert (self->mounts, button->mount, button);
+}
+
+static void
+drive_list_remove (GtkContainer *container,
+                   GtkWidget    *child)
+{
+    DriveList *self;
+    DriveButton *button;
+
+    g_return_if_fail (DRIVE_IS_LIST (container));
+    g_return_if_fail (DRIVE_IS_BUTTON (child));
+
+    self = DRIVE_LIST (container);
+    button = DRIVE_BUTTON (child);
+    if (button->volume)
+        g_hash_table_remove (self->volumes, button->volume);
+    else
+        g_hash_table_remove (self->mounts, button->mount);
+
+    if (GTK_CONTAINER_CLASS (drive_list_parent_class)->remove)
+        (* GTK_CONTAINER_CLASS (drive_list_parent_class)->remove) (container, child);
+}
+
+static void
+list_buttons (gpointer key,
+              gpointer value,
+              gpointer user_data)
+{
+    GtkWidget *button = value;
+    GList **sorted_buttons = user_data;
+
+    *sorted_buttons = g_list_insert_sorted (*sorted_buttons, button,
+                                            (GCompareFunc)drive_button_compare);
+}
+
+static gboolean
+relayout_buttons (gpointer data)
+{
+    DriveList *self = DRIVE_LIST (data);
+    GList *sorted_buttons = NULL, *tmp;
+    int i = 0;
+
+    self->layout_tag = 0;
+    if ( self->count > 0 ) {
+        g_hash_table_foreach (self->volumes, list_buttons, &sorted_buttons);
+        g_hash_table_foreach (self->mounts, list_buttons, &sorted_buttons);
+
+        /* position buttons in the table according to their sorted order */
+        for (tmp = sorted_buttons, i = 0; tmp != NULL; tmp = tmp->next, i++) {
+            GtkWidget *button = tmp->data;
+
+            if (self->orientation == GTK_ORIENTATION_HORIZONTAL) {
+                gtk_container_child_set (GTK_CONTAINER (self), button,
+                                         "left-attach", i + 1, "top-attach", 0,
+                                         "width", 1, "height", 1,
+                                         NULL);
+            }
+            else {
+                gtk_container_child_set (GTK_CONTAINER (self), button,
+                                         "left-attach", 0, "top-attach", i + 1,
+                                         "width", 1, "height", 1,
+                                         NULL);
+            }
+        }
+    }
+    else {
+        gtk_widget_show (self->dummy);
+        if (self->orientation == GTK_ORIENTATION_HORIZONTAL) {
+            gtk_container_child_set (GTK_CONTAINER (self), self->dummy,
+                                     "left-attach", i + 1, "top-attach", 0,
+                                     "width", 1, "height", 1,
+                                     NULL);
+        }
+        else {
+            gtk_container_child_set (GTK_CONTAINER (self), self->dummy,
+                                     "left-attach", 0, "top-attach", i + 1,
+                                     "width", 1, "height", 1,
+                                     NULL);
+        }
+    }
+    return FALSE;
+}
+
+static void
+queue_relayout (DriveList *self)
+{
+    if (!self->layout_tag) {
+        self->layout_tag = g_idle_add (relayout_buttons, self);
+    }
+}
+
+static void
+mount_added (GVolumeMonitor *monitor,
+             GMount         *mount,
+             DriveList      *self)
+{
+    add_mount (self, mount);
+    self->count++;
+    if (self->count == 1)
+        gtk_container_remove (GTK_CONTAINER (self), g_object_ref (self->dummy));
+
+    mount_changed (monitor, mount, self);
+}
+
+static void
+mount_changed (GVolumeMonitor *monitor,
+               GMount         *mount,
+               DriveList      *self)
+{
+    GVolume *volume;
+    DriveButton *button = NULL;;
+
+    volume = g_mount_get_volume (mount);
+    if (volume) {
+        button = g_hash_table_lookup (self->volumes, volume);
+        g_object_unref (volume);
+    } else {
+        button = g_hash_table_lookup (self->mounts, mount);
+    }
+    if (button)
+        drive_button_queue_update (button);
+}
+
+static void
+mount_removed (GVolumeMonitor *monitor,
+               GMount         *mount,
+               DriveList      *self)
+{
+    remove_mount (self, mount);
+    mount_changed (monitor, mount, self);
+    self->count--;
+    if (self->count == 0) {
+        gtk_container_add (GTK_CONTAINER (self), self->dummy);
+        queue_relayout (self);
+    }
+}
+
+static void
+volume_added (GVolumeMonitor *monitor,
+              GVolume        *volume,
+              DriveList      *self)
+{
+    add_volume (self, volume);
+    self->count++;
+    if (self->count == 1)
+        gtk_container_remove (GTK_CONTAINER (self), g_object_ref (self->dummy));
+}
+
+static void
+volume_changed (GVolumeMonitor *monitor,
+                GVolume        *volume,
+                DriveList      *self)
+{
+    DriveButton *button = NULL;;
+
+    button = g_hash_table_lookup (self->volumes, volume);
+    if (button)
+        drive_button_queue_update (button);
+}
+
+static void
+volume_removed (GVolumeMonitor *monitor,
+                GVolume        *volume,
+                DriveList      *self)
+{
+    remove_volume (self, volume);
+    self->count--;
+    if (self->count == 0) {
+        gtk_container_add (GTK_CONTAINER (self), self->dummy);
+        queue_relayout (self);
+    }
+}
+
+static void
+add_volume (DriveList *self,
+            GVolume   *volume)
+{
+    GtkWidget *button;
+
+    /* if the volume has already been added, return */
+    if (g_hash_table_lookup (self->volumes, volume) != NULL)
+        return;
+
+    button = drive_button_new (volume);
+    gtk_button_set_relief (GTK_BUTTON (button), self->relief);
+    drive_button_set_size (DRIVE_BUTTON (button), self->icon_size);
+    gtk_container_add (GTK_CONTAINER (self), button);
+    gtk_widget_show (button);
+    queue_relayout (self);
+}
+
+static void
+remove_volume (DriveList *self,
+               GVolume   *volume)
+{
+    GtkWidget *button;
+
+    /* if the volume has already been added, return */
+    button = g_hash_table_lookup (self->volumes, volume);
+    if (button) {
+        gtk_container_remove (GTK_CONTAINER (self), button);
+        queue_relayout (self);
+    }
+}
+
+static void
+add_mount (DriveList *self,
+           GMount    *mount)
+{
+    GtkWidget *button;
+    GVolume *volume;
+
+    /* ignore mounts reported as shadowed */
+    if (g_mount_is_shadowed (mount)) {
+        return;
+    }
+
+    /* ignore mounts attached to a volume */
+    volume = g_mount_get_volume (mount);
+    if (volume) {
+        g_object_unref (volume);
+        return;
+    }
+
+    /* if the mount has already been added, return */
+    if (g_hash_table_lookup (self->mounts, mount) != NULL)
+        return;
+
+    button = drive_button_new_from_mount (mount);
+    gtk_button_set_relief (GTK_BUTTON (button), self->relief);
+    drive_button_set_size (DRIVE_BUTTON (button), self->icon_size);
+    gtk_container_add (GTK_CONTAINER (self), button);
+    gtk_widget_show (button);
+    queue_relayout (self);
+}
+
+static void
+remove_mount (DriveList *self,
+              GMount    *mount)
+{
+    GtkWidget *button;
+
+    /* if the mount has already been added, return */
+    button = g_hash_table_lookup (self->mounts, mount);
+    if (button) {
+        gtk_container_remove (GTK_CONTAINER (self), button);
+        queue_relayout (self);
+    }
+}
+
+void
+drive_list_set_orientation (DriveList      *self,
+                            GtkOrientation  orientation)
+{
+    g_return_if_fail (DRIVE_IS_LIST (self));
+
+    if (orientation != self->orientation) {
+        self->orientation = orientation;
+        queue_relayout (self);
+    }
+}
+
+static void
+set_icon_size (gpointer key,
+               gpointer value,
+               gpointer user_data)
+{
+    DriveButton *button = value;
+    DriveList *self = user_data;
+
+    drive_button_set_size (button, self->icon_size);
+}
+
+void
+drive_list_set_panel_size (DriveList *self,
+                           int        panel_size)
+{
+    g_return_if_fail (DRIVE_IS_LIST (self));
+
+    if (self->icon_size != panel_size) {
+        self->icon_size = panel_size;
+        g_hash_table_foreach (self->volumes, set_icon_size, self);
+        g_hash_table_foreach (self->mounts, set_icon_size, self);
+    }
+}
+
+void
+drive_list_redraw (DriveList *self)
+{
+    g_hash_table_foreach (self->volumes, drive_button_redraw, self);
+    g_hash_table_foreach (self->mounts, drive_button_redraw, self);
+}
+
+void
+settings_color_changed (GSettings *settings,
+                        gchar     *key,
+                        DriveList *drive_list)
+{
+    g_return_if_fail (DRIVE_IS_LIST (drive_list));
+    drive_list_redraw (drive_list);
+}
+
+static void
+set_button_relief (gpointer key,
+                   gpointer value,
+                   gpointer user_data)
+{
+    GtkButton *button = value;
+    DriveList *self = user_data;
+
+    gtk_button_set_relief (button, self->relief);
+}
+
+void
+drive_list_set_transparent (DriveList *self,
+                            gboolean   transparent)
+{
+    GtkReliefStyle relief;
+
+    relief  = transparent ? GTK_RELIEF_NONE : GTK_RELIEF_NORMAL;
+
+    if (relief == self->relief)
+        return;
+
+    self->relief = relief;
+    g_hash_table_foreach (self->volumes, set_button_relief, self);
+    g_hash_table_foreach (self->mounts, set_button_relief, self);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/56.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/56.html new file mode 100644 index 00000000..eeb32a76 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/56.html @@ -0,0 +1,383 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
/* -*- mode: C; c-basic-offset: 4 -*-
+ * Drive Mount Applet
+ * Copyright (c) 2004 Canonical Ltd
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author:
+ *   James Henstridge <jamesh@canonical.com>
+ */
+
+#ifndef DRIVE_LIST_H
+#define DRIVE_LIST_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define DRIVE_TYPE_LIST         (drive_list_get_type ())
+#define DRIVE_LIST(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), DRIVE_TYPE_LIST, DriveList))
+#define DRIVE_LIST_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), DRIVE_TYPE_LIST, DriveListClass))
+#define DRIVE_IS_LIST(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), DRIVE_TYPE_LIST))
+#define DRIVE_IS_LIST_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), DRIVE_TYPE_LIST))
+#define DRIVE_LIST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DRIVE_TYPE_LIST, DriveListClass))
+
+typedef struct _DriveList      DriveList;
+typedef struct _DriveListClass DriveListClass;
+
+struct _DriveList
+{
+    GtkGrid parent;
+
+    GHashTable *volumes;
+    GHashTable *mounts;
+    GtkOrientation orientation;
+    guint layout_tag;
+    GtkReliefStyle relief;
+    GtkWidget *dummy;
+    gint count;
+
+    GSettings *settings;
+
+    int icon_size;
+};
+
+struct _DriveListClass
+{
+    GtkGridClass parent_class;
+};
+
+GType      drive_list_get_type (void);
+GtkWidget *drive_list_new (void);
+void       drive_list_set_orientation (DriveList *list,
+                                       GtkOrientation orientation);
+void       drive_list_set_panel_size  (DriveList *list,
+                                       int panel_size);
+void       drive_list_set_transparent (DriveList *self,
+                                       gboolean transparent);
+void       drive_list_redraw (DriveList *self);
+void       settings_color_changed (GSettings *settings, gchar *key, DriveList *drive_list);
+
+#endif /* DRIVE_LIST_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/57.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/57.html new file mode 100644 index 00000000..52af528d --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/57.html @@ -0,0 +1,697 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.drivemount"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[365]; const double alignment; void * const ptr;}  drivemount_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0310, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0006, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0004, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0004, 0000, 0000, 0000, 0331, 0151, 0055, 0110, 0005, 0000, 0000, 0000, 
+  0310, 0000, 0000, 0000, 0013, 0000, 0114, 0000, 0324, 0000, 0000, 0000, 0330, 0000, 0000, 0000, 
+  0113, 0120, 0220, 0013, 0003, 0000, 0000, 0000, 0330, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 
+  0334, 0000, 0000, 0000, 0340, 0000, 0000, 0000, 0072, 0362, 0271, 0352, 0000, 0000, 0000, 0000, 
+  0340, 0000, 0000, 0000, 0032, 0000, 0166, 0000, 0000, 0001, 0000, 0000, 0106, 0001, 0000, 0000, 
+  0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0106, 0001, 0000, 0000, 0001, 0000, 0114, 0000, 
+  0110, 0001, 0000, 0000, 0114, 0001, 0000, 0000, 0201, 0321, 0040, 0031, 0001, 0000, 0000, 0000, 
+  0114, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 0124, 0001, 0000, 0000, 0130, 0001, 0000, 0000, 
+  0275, 0342, 0315, 0116, 0004, 0000, 0000, 0000, 0130, 0001, 0000, 0000, 0015, 0000, 0114, 0000, 
+  0150, 0001, 0000, 0000, 0154, 0001, 0000, 0000, 0144, 0162, 0151, 0166, 0145, 0155, 0157, 0165, 
+  0156, 0164, 0057, 0000, 0002, 0000, 0000, 0000, 0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 
+  0144, 0162, 0151, 0166, 0145, 0155, 0157, 0165, 0156, 0164, 0055, 0141, 0160, 0160, 0154, 0145, 
+  0164, 0055, 0155, 0145, 0156, 0165, 0056, 0170, 0155, 0154, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0121, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0263, 0311, 0115, 0315, 0053, 0315, 
+  0054, 0111, 0315, 0125, 0310, 0113, 0314, 0115, 0265, 0125, 0362, 0110, 0315, 0051, 0120, 0122, 
+  0110, 0114, 0056, 0311, 0314, 0317, 0203, 0361, 0364, 0355, 0270, 0154, 0320, 0224, 0071, 0046, 
+  0345, 0227, 0226, 0040, 0324, 0101, 0271, 0100, 0205, 0134, 0000, 0146, 0237, 0032, 0103, 0000, 
+  0050, 0165, 0165, 0141, 0171, 0051, 0057, 0000, 0001, 0000, 0000, 0000, 0155, 0141, 0164, 0145, 
+  0057, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0155, 0141, 0164, 0145, 0055, 0141, 0160, 0160, 
+  0154, 0145, 0164, 0163, 0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000
+} };
+
+static GStaticResource static_resource = { drivemount_resource_data.data, sizeof (drivemount_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *drivemount_get_resource (void);
+GResource *drivemount_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * 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.1 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/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CONSTRUCTOR_H__
+#define __G_CONSTRUCTOR_H__
+
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+/*
+ * Only try to include gslist.h if not already included via glib.h,
+ * so that items using gconstructor.h outside of GLib (such as
+ * GResources) continue to build properly.
+ */
+#ifndef __G_LIB_H__
+#include "gslist.h"
+#endif
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+#endif /* __G_CONSTRUCTOR_H__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(drivemountresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(drivemountresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(drivemountresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(drivemountresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void drivemountresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void drivemountresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/58.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/58.html new file mode 100644 index 00000000..f5ae42b5 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/58.html @@ -0,0 +1,699 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
/* -*- mode: C; c-basic-offset: 4 -*-
+ * Drive Mount Applet
+ * Copyright (c) 2004 Canonical Ltd
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author:
+ *   James Henstridge <jamesh@canonical.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "drive-list.h"
+
+static const char drivemount_iid[] = "DriveMountApplet";
+static const char factory_iid[] = "DriveMountAppletFactory";
+
+static void
+change_orient (MatePanelApplet *applet,
+               MatePanelAppletOrient o,
+               DriveList *drive_list)
+{
+    GtkOrientation orientation;
+
+    switch (o) {
+        case MATE_PANEL_APPLET_ORIENT_LEFT:
+        case MATE_PANEL_APPLET_ORIENT_RIGHT:
+            orientation = GTK_ORIENTATION_VERTICAL;
+            break;
+        case MATE_PANEL_APPLET_ORIENT_UP:
+        case MATE_PANEL_APPLET_ORIENT_DOWN:
+        default:
+            orientation = GTK_ORIENTATION_HORIZONTAL;
+    }
+    drive_list_set_orientation (drive_list, orientation);
+}
+
+static void
+size_allocate (MatePanelApplet *applet,
+               GdkRectangle    *allocation,<--- Parameter 'allocation' can be declared as pointer to const
+               DriveList       *drive_list)
+{
+    int size;
+
+    switch (mate_panel_applet_get_orient (applet)) {
+        case MATE_PANEL_APPLET_ORIENT_LEFT:
+        case MATE_PANEL_APPLET_ORIENT_RIGHT:
+            size = allocation->width;
+            break;
+        case MATE_PANEL_APPLET_ORIENT_UP:
+        case MATE_PANEL_APPLET_ORIENT_DOWN:
+        default:
+            size = allocation->height;
+    }
+    drive_list_set_panel_size (drive_list, size);
+}
+
+static void
+change_background (MatePanelApplet               *applet,
+                   MatePanelAppletBackgroundType  type,
+                   GdkColor                      *colour,
+                   cairo_pattern_t               *pattern,
+                   DriveList                     *drivelist)
+{
+    switch (type) {
+        case PANEL_NO_BACKGROUND:
+            drive_list_set_transparent (drivelist, FALSE);
+            break;
+        case PANEL_COLOR_BACKGROUND:
+        case PANEL_PIXMAP_BACKGROUND:
+            drive_list_set_transparent (drivelist, TRUE);
+    }
+}
+
+static void
+display_about_dialog (GtkAction *action,
+                      DriveList *drive_list)
+{
+    const gchar *authors[] = {
+        "James Henstridge <jamesh@canonical.com>",
+        NULL
+    };
+
+    const gchar *documenters[] = {
+        "Dan Mueth <muet@alumni.uchicago.edu>",
+        "John Fleck <jfleck@inkstain.net>",
+        N_("MATE Documentation Team"),
+        NULL
+    };
+
+#ifdef ENABLE_NLS
+    const char **p;
+    for (p = documenters; *p; ++p)
+        *p = _(*p);
+#endif
+
+    gtk_show_about_dialog (NULL,
+                           "title",              _("About Disk Mounter"),
+                           "version",            VERSION,
+                           "copyright",          _("Copyright \xC2\xA9 2004 Canonical Ltd\n"
+                                                   "Copyright \xc2\xa9 2012-2021 MATE developers"),
+                           "comments",           _("Applet for mounting and unmounting block volumes."),
+                           "authors",            authors,
+                           "documenters",        documenters,
+                           "translator-credits", _("translator-credits"),
+                           "logo_icon_name",     "media-floppy",
+                           NULL);
+}
+
+static void
+display_help (GtkAction *action,
+              DriveList *drive_list)
+{
+    GdkScreen *screen;
+    GError *error = NULL;
+
+    screen = gtk_widget_get_screen (GTK_WIDGET (drive_list));
+
+    gtk_show_uri_on_window (NULL,
+                            "help:mate-drivemount",
+                            gtk_get_current_event_time (),
+                            &error);
+
+    if (error) {
+        GtkWidget *dialog;
+
+        dialog = gtk_message_dialog_new (NULL,
+                                         GTK_DIALOG_MODAL,
+                                         GTK_MESSAGE_ERROR,
+                                         GTK_BUTTONS_OK,
+                                         _("There was an error displaying help: %s"),
+                                         error->message);
+        g_signal_connect (dialog, "response",
+                          G_CALLBACK (gtk_widget_destroy), NULL);
+        gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+        gtk_window_set_screen (GTK_WINDOW (dialog), screen);
+        gtk_widget_show (dialog);
+        g_error_free (error);
+    }
+}
+
+static const GtkActionEntry applet_menu_actions[] = {
+    { "Help", "help-browser", N_("_Help"),
+      NULL, NULL,
+      G_CALLBACK (display_help) },
+    { "About", "help-about", N_("_About"),
+      NULL, NULL,
+      G_CALLBACK (display_about_dialog) }
+};
+
+static gboolean
+applet_factory (MatePanelApplet *applet,
+                const char      *iid,
+                gpointer         user_data)
+{
+    gboolean ret = FALSE;
+    GtkWidget *drive_list;
+    AtkObject *ao;
+    GtkActionGroup *action_group;
+
+    if (!strcmp (iid, drivemount_iid)) {
+#ifndef ENABLE_IN_PROCESS
+        g_set_application_name (_("Disk Mounter"));
+#endif
+
+        gtk_window_set_default_icon_name ("media-floppy");
+
+        mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR);
+
+        drive_list = drive_list_new ();
+
+        gtk_container_add (GTK_CONTAINER (applet), drive_list);
+
+        g_signal_connect_object (applet, "change-orient",
+                                 G_CALLBACK (change_orient), drive_list, 0);
+        g_signal_connect_object (applet, "size-allocate",
+                                 G_CALLBACK (size_allocate), drive_list, 0);<--- You might need to cast the function pointer here
+        g_signal_connect (applet, "change-background",
+                          G_CALLBACK (change_background), drive_list);
+
+        /* set initial state */
+        change_orient (applet,
+                       mate_panel_applet_get_orient (applet),
+                       DRIVE_LIST (drive_list));
+
+        action_group = gtk_action_group_new ("DriveMount Applet Actions");
+        gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+        gtk_action_group_add_actions (action_group,
+                                      applet_menu_actions,
+                                      G_N_ELEMENTS (applet_menu_actions),
+                                      drive_list);
+        mate_panel_applet_setup_menu_from_resource (applet,
+                                                    DRIVEMOUNT_RESOURCE_PATH "drivemount-applet-menu.xml",
+                                                    action_group);
+        g_object_unref (action_group);
+
+        ao = gtk_widget_get_accessible (GTK_WIDGET (applet));
+        atk_object_set_name (ao, _("Disk Mounter"));
+
+        gtk_widget_show_all (GTK_WIDGET (applet));
+
+        ret = TRUE;
+    }
+
+    return ret;
+}
+
+PANEL_APPLET_FACTORY (factory_iid,
+                      PANEL_TYPE_APPLET,
+                      "Drive-Mount-Applet",
+                      applet_factory, NULL)
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/59.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/59.html new file mode 100644 index 00000000..664a951b --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/59.html @@ -0,0 +1,853 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.eyes"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[1616]; const double alignment; void * const ptr;}  eyes_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 
+  0001, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 
+  0354, 0000, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0354, 0000, 0000, 0000, 
+  0001, 0000, 0114, 0000, 0360, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0102, 0342, 0021, 0205, 
+  0005, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0005, 0000, 0114, 0000, 0374, 0000, 0000, 0000, 
+  0004, 0001, 0000, 0000, 0264, 0016, 0213, 0116, 0002, 0000, 0000, 0000, 0004, 0001, 0000, 0000, 
+  0011, 0000, 0166, 0000, 0020, 0001, 0000, 0000, 0275, 0005, 0000, 0000, 0201, 0321, 0040, 0031, 
+  0000, 0000, 0000, 0000, 0275, 0005, 0000, 0000, 0005, 0000, 0114, 0000, 0304, 0005, 0000, 0000, 
+  0310, 0005, 0000, 0000, 0275, 0342, 0315, 0116, 0004, 0000, 0000, 0000, 0310, 0005, 0000, 0000, 
+  0015, 0000, 0114, 0000, 0330, 0005, 0000, 0000, 0334, 0005, 0000, 0000, 0223, 0167, 0072, 0045, 
+  0002, 0000, 0000, 0000, 0334, 0005, 0000, 0000, 0025, 0000, 0166, 0000, 0370, 0005, 0000, 0000, 
+  0117, 0006, 0000, 0000, 0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0145, 0171, 0145, 0163, 0057, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0164, 0150, 0145, 0155, 0145, 0163, 0056, 0165, 0151, 0000, 0000, 0000, 
+  0246, 0037, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0131, 0333, 0156, 0343, 0066, 
+  0020, 0175, 0317, 0127, 0260, 0174, 0055, 0024, 0137, 0002, 0154, 0213, 0302, 0326, 0142, 0173, 
+  0311, 0266, 0300, 0076, 0024, 0110, 0332, 0076, 0022, 0224, 0064, 0226, 0330, 0320, 0244, 0112, 
+  0322, 0166, 0374, 0367, 0245, 0044, 0337, 0144, 0123, 0167, 0355, 0146, 0121, 0364, 0045, 0160, 
+  0044, 0316, 0160, 0146, 0070, 0347, 0360, 0210, 0134, 0274, 0177, 0135, 0163, 0264, 0005, 0245, 
+  0231, 0024, 0113, 0074, 0273, 0237, 0142, 0004, 0042, 0224, 0021, 0023, 0361, 0022, 0377, 0361, 
+  0374, 0350, 0175, 0217, 0337, 0373, 0167, 0213, 0157, 0074, 0017, 0175, 0004, 0001, 0212, 0032, 
+  0210, 0320, 0216, 0231, 0004, 0305, 0234, 0106, 0200, 0036, 0356, 0037, 0336, 0335, 0117, 0221, 
+  0347, 0331, 0101, 0114, 0030, 0120, 0053, 0032, 0202, 0177, 0207, 0320, 0102, 0301, 0077, 0033, 
+  0246, 0100, 0043, 0316, 0202, 0045, 0216, 0315, 0313, 0267, 0370, 0074, 0321, 0303, 0375, 0174, 
+  0216, 0047, 0371, 0070, 0031, 0374, 0015, 0241, 0101, 0041, 0247, 0132, 0057, 0361, 0107, 0363, 
+  0362, 0333, 0232, 0306, 0200, 0021, 0213, 0226, 0230, 0145, 0077, 0147, 0070, 0033, 0147, 0107, 
+  0246, 0112, 0246, 0240, 0314, 0036, 0011, 0272, 0206, 0045, 0336, 0062, 0315, 0002, 0016, 0330, 
+  0177, 0126, 0033, 0130, 0114, 0216, 0157, 0335, 0203, 0103, 0052, 0310, 0112, 0206, 0033, 0215, 
+  0375, 0107, 0312, 0165, 0343, 0170, 0026, 0112, 0101, 0262, 0237, 0330, 0117, 0200, 0247, 0136, 
+  0240, 0344, 0116, 0203, 0052, 0233, 0055, 0046, 0105, 0360, 0355, 0362, 0230, 0277, 0161, 0036, 
+  0073, 0046, 0042, 0271, 0363, 0102, 0056, 0257, 0315, 0352, 0363, 0370, 0231, 0121, 0056, 0343, 
+  0042, 0221, 0124, 0301, 0012, 0224, 0355, 0020, 0320, 0044, 0052, 0236, 0217, 0023, 0147, 0040, 
+  0125, 0004, 0212, 0354, 0130, 0144, 0022, 0354, 0317, 0346, 0115, 0343, 0015, 0063, 0266, 0144, 
+  0310, 0050, 0052, 0064, 0247, 0206, 0332, 0002, 0056, 0361, 0036, 0354, 0164, 0277, 0330, 0277, 
+  0350, 0367, 0163, 0234, 0115, 0236, 0042, 0130, 0321, 0015, 0067, 0307, 0251, 0037, 0246, 0323, 
+  0266, 0026, 0011, 0260, 0070, 0061, 0330, 0237, 0067, 0233, 0134, 0054, 0303, 0332, 0102, 0310, 
+  0003, 0033, 0244, 0107, 0323, 0224, 0203, 0151, 0314, 0164, 0237, 0002, 0111, 0054, 0266, 0260, 
+  0137, 0124, 0374, 0306, 0100, 0263, 0130, 0120, 0176, 0030, 0156, 0021, 0227, 0112, 0241, 0155, 
+  0155, 0022, 0052, 0042, 0016, 0152, 0211, 0355, 0324, 0267, 0353, 0106, 0316, 0003, 0365, 0316, 
+  0106, 0002, 0166, 0165, 0205, 0054, 0060, 0151, 0175, 0206, 0011, 0343, 0021, 0312, 0021, 0155, 
+  0175, 0173, 0371, 0277, 0266, 0125, 0003, 0371, 0172, 0130, 0160, 0127, 0247, 0374, 0170, 0361, 
+  0266, 0173, 0113, 0270, 0154, 0244, 0142, 0040, 0014, 0065, 0226, 0064, 0260, 0157, 0331, 0303, 
+  0260, 0220, 0362, 0066, 0206, 0072, 0245, 0241, 0345, 0060, 0273, 0070, 0316, 0321, 0356, 0364, 
+  0150, 0230, 0115, 0104, 0250, 0002, 0172, 0221, 0207, 0063, 0323, 0215, 0061, 0122, 0224, 0363, 
+  0355, 0233, 0263, 0313, 0216, 0323, 0275, 0334, 0030, 0242, 0315, 0076, 0043, 0006, 0020, 0121, 
+  0245, 0141, 0036, 0172, 0371, 0131, 0165, 0300, 0005, 0210, 0203, 0374, 0367, 0014, 0137, 0133, 
+  0271, 0302, 0010, 0200, 0073, 0121, 0106, 0176, 0265, 0254, 0130, 0025, 0124, 0147, 0226, 0153, 
+  0131, 0302, 0256, 0246, 0012, 0102, 0140, 0333, 0254, 0345, 0013, 0304, 0166, 0367, 0220, 0023, 
+  0067, 0366, 0213, 0175, 0250, 0213, 0341, 0106, 0003, 0331, 0010, 0113, 0151, 0234, 0211, 0036, 
+  0111, 0123, 0276, 0243, 0173, 0115, 0164, 0042, 0167, 0344, 0020, 0103, 0275, 0213, 0113, 0012, 
+  0057, 0073, 0246, 0341, 0213, 0005, 0102, 0363, 0224, 0360, 0232, 0132, 0302, 0350, 0036, 0352, 
+  0212, 0161, 0336, 0335, 0052, 0225, 0232, 0025, 0250, 0236, 0326, 0045, 0345, 0214, 0176, 0061, 
+  0161, 0064, 0175, 0177, 0040, 0314, 0207, 0001, 0341, 0247, 0333, 0375, 0364, 0353, 0103, 0102, 
+  0146, 0332, 0033, 0004, 0011, 0035, 0200, 0240, 0161, 0061, 0070, 0377, 0037, 0203, 0237, 0003, 
+  0203, 0263, 0061, 0060, 0350, 0112, 0337, 0235, 0172, 0125, 0332, 0235, 0266, 0310, 0042, 0347, 
+  0116, 0046, 0215, 0244, 0343, 0110, 0366, 0046, 0321, 0133, 0242, 0271, 0045, 0231, 0107, 0225, 
+  0113, 0275, 0273, 0301, 0064, 0060, 0226, 0236, 0330, 0266, 0351, 0054, 0047, 0351, 0221, 0127, 
+  0312, 0255, 0276, 0254, 0341, 0351, 0033, 0351, 0225, 0120, 0373, 0235, 0101, 0062, 0335, 0212, 
+  0175, 0041, 0005, 0014, 0325, 0056, 0037, 0262, 0000, 0326, 0220, 0051, 0340, 0057, 0102, 0256, 
+  0265, 0225, 0165, 0026, 0012, 0126, 0206, 0244, 0064, 0212, 0162, 0305, 0071, 0253, 0047, 0051, 
+  0147, 0322, 0155, 0364, 0364, 0050, 0151, 0017, 0115, 0335, 0145, 0277, 0246, 0052, 0146, 0202, 
+  0030, 0231, 0142, 0377, 0135, 0117, 0343, 0100, 0332, 0255, 0170, 0335, 0303, 0176, 0333, 0226, 
+  0063, 0007, 0175, 0136, 0324, 0366, 0373, 0361, 0123, 0243, 0071, 0366, 0312, 0265, 0167, 0257, 
+  0377, 0247, 0102, 0165, 0144, 0122, 0105, 0003, 0267, 0357, 0210, 0111, 0140, 0015, 0244, 0120, 
+  0043, 0125, 0176, 0006, 0166, 0307, 0030, 0035, 0342, 0126, 0021, 0005, 0217, 0150, 0103, 0225, 
+  0351, 0343, 0240, 0106, 0203, 0075, 0345, 0325, 0101, 0024, 0345, 0365, 0371, 0241, 0217, 0367, 
+  0216, 0142, 0241, 0262, 0235, 0005, 0254, 0245, 0140, 0141, 0166, 0234, 0020, 0203, 0145, 0254, 
+  0074, 0042, 0115, 0214, 0002, 0330, 0062, 0330, 0065, 0373, 0254, 0122, 0021, 0315, 0152, 0142, 
+  0320, 0366, 0072, 0134, 0136, 0014, 0222, 0372, 0015, 0162, 0243, 0126, 0372, 0367, 0205, 0327, 
+  0123, 0250, 0044, 0347, 0020, 0375, 0225, 0037, 0214, 0275, 0021, 0236, 0372, 0272, 0110, 0272, 
+  0360, 0336, 0140, 0342, 0164, 0106, 0240, 0363, 0372, 0005, 0124, 0221, 0124, 0162, 0026, 0356, 
+  0355, 0156, 0017, 0333, 0353, 0063, 0322, 0166, 0276, 0112, 0232, 0201, 0211, 0126, 0056, 0152, 
+  0127, 0333, 0275, 0342, 0317, 0026, 0205, 0177, 0132, 0024, 0026, 0234, 0172, 0005, 0115, 0134, 
+  0347, 0153, 0204, 0046, 0030, 0251, 0021, 0106, 0151, 0206, 0121, 0032, 0302, 0035, 0011, 0265, 
+  0034, 0252, 0311, 0251, 0072, 0255, 0111, 0247, 0316, 0133, 0150, 0333, 0353, 0205, 0366, 0360, 
+  0347, 0076, 0347, 0053, 0066, 0323, 0234, 0222, 0152, 0315, 0253, 0132, 0350, 0351, 0144, 0177, 
+  0335, 0107, 0355, 0075, 0137, 0237, 0333, 0206, 0011, 0025, 0061, 0104, 0345, 0143, 0133, 0227, 
+  0147, 0162, 0032, 0351, 0070, 0267, 0255, 0231, 0255, 0141, 0133, 0151, 0301, 0257, 0155, 0035, 
+  0065, 0070, 0371, 0017, 0157, 0160, 0263, 0317, 0271, 0301, 0125, 0327, 0255, 0302, 0310, 0155, 
+  0120, 0163, 0172, 0206, 0062, 0376, 0075, 0012, 0255, 0346, 0357, 0262, 0117, 0025, 0062, 0364, 
+  0353, 0370, 0046, 0253, 0124, 0213, 0317, 0071, 0250, 0152, 0175, 0121, 0143, 0024, 0013, 0066, 
+  0006, 0264, 0163, 0041, 0116, 0257, 0017, 0163, 0355, 0212, 0213, 0040, 0264, 0245, 0174, 0223, 
+  0337, 0145, 0361, 0310, 0005, 0310, 0305, 0244, 0332, 0157, 0353, 0265, 0172, 0223, 0123, 0226, 
+  0056, 0247, 0006, 0215, 0150, 0150, 0076, 0144, 0051, 0347, 0130, 0172, 0271, 0050, 0356, 0150, 
+  0274, 0102, 0136, 0237, 0312, 0130, 0176, 0214, 0216, 0167, 0133, 0113, 0354, 0315, 0146, 0330, 
+  0077, 0134, 0170, 0330, 0372, 0137, 0216, 0152, 0266, 0375, 0356, 0150, 0072, 0167, 0232, 0136, 
+  0075, 0324, 0245, 0253, 0263, 0002, 0112, 0371, 0065, 0245, 0125, 0110, 0347, 0113, 0263, 0224, 
+  0323, 0020, 0022, 0333, 0041, 0240, 0046, 0067, 0371, 0235, 0023, 0137, 0114, 0056, 0156, 0323, 
+  0377, 0005, 0207, 0320, 0017, 0150, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 
+  0145, 0057, 0000, 0000, 0005, 0000, 0000, 0000, 0155, 0141, 0164, 0145, 0055, 0141, 0160, 0160, 
+  0154, 0145, 0164, 0163, 0057, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0147, 0145, 0171, 0145, 
+  0163, 0055, 0141, 0160, 0160, 0154, 0145, 0164, 0055, 0155, 0145, 0156, 0165, 0056, 0170, 0155, 
+  0154, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0177, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0263, 0311, 0115, 0315, 0053, 0315, 0054, 0111, 0315, 0125, 0310, 0113, 0314, 0115, 
+  0265, 0125, 0362, 0004, 0061, 0015, 0225, 0024, 0022, 0223, 0113, 0062, 0363, 0363, 0154, 0225, 
+  0002, 0212, 0362, 0013, 0212, 0225, 0024, 0364, 0355, 0270, 0154, 0260, 0251, 0064, 0102, 0250, 
+  0364, 0110, 0315, 0051, 0300, 0255, 0320, 0030, 0241, 0320, 0061, 0051, 0277, 0264, 0004, 0254, 
+  0222, 0213, 0013, 0000, 0160, 0033, 0050, 0030, 0000, 0050, 0165, 0165, 0141, 0171, 0051
+} };
+
+static GStaticResource static_resource = { eyes_resource_data.data, sizeof (eyes_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *eyes_get_resource (void);
+GResource *eyes_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * 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.1 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/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CONSTRUCTOR_H__
+#define __G_CONSTRUCTOR_H__
+
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+/*
+ * Only try to include gslist.h if not already included via glib.h,
+ * so that items using gconstructor.h outside of GLib (such as
+ * GResources) continue to build properly.
+ */
+#ifndef __G_LIB_H__
+#include "gslist.h"
+#endif
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+#endif /* __G_CONSTRUCTOR_H__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(eyesresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(eyesresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(eyesresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(eyesresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void eyesresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void eyesresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/6.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/6.html new file mode 100644 index 00000000..ea0fb5c2 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/6.html @@ -0,0 +1,401 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
/* apm.h -- Header file for sample APM interface routines
+ * Created: Mon Jan  8 11:40:50 1996 by r.faith@ieee.org
+ * Revised: Thu Apr  4 21:57:31 1996 by r.faith@ieee.org
+ * Copyright 1996 Rickard E. Faith (r.faith@ieee.org)
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ * 
+ * $Id$
+ * 
+ */
+#ifndef __APM_H__
+#define __APM_H__
+
+#include <linux/apm_bios.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define APM_PROC   "/proc/apm"
+#define APM_DEVICE "/dev/apm_bios"
+
+#define APM_DEV  "/proc/devices"
+#define APM_NAME "apm_bios"
+
+#ifndef APM_32_BIT_SUPPORT
+#define APM_32_BIT_SUPPORT      0x0002
+#endif
+
+typedef struct apm_info
+{
+    const char driver_version[10];
+    int apm_version_major;
+    int apm_version_minor;
+    unsigned short apm_flags;
+    unsigned short ac_line_status;
+    unsigned short battery_status;
+    unsigned short battery_flags;
+    int battery_percentage;
+    int battery_time;
+    int using_minutes;
+}
+apm_info;
+
+extern int apm_exists (void);
+extern int apm_read (apm_info * i);
+extern dev_t apm_dev (void);
+extern int apm_open (void);
+extern int apm_close (int fd);
+extern int apm_get_events (int fd, int timeout, apm_event_t * events, int n);
+extern int apm_suspend (int fd);
+extern int apm_standby (int fd);
+extern int apm_set_ignore (int fd, int mode);
+extern unsigned int apm_last_error (int fd);
+extern const char *apm_error_name (unsigned int err);
+extern int apm_reject (int fd);
+extern const char *apm_event_name (apm_event_t event);
+extern const char *apm_time (time_t t);
+extern const char *apm_delta_time (time_t then, time_t now);
+extern const char *apm_time_nosec (time_t t);
+
+#define SUSPEND 0
+#define STANDBY 1
+#define IGNORE 2
+#define NOIGNORE 3
+
+/* Linux Kernel APM drivers version 1.10 and higher permit suspend
+   rejections. */
+#ifdef APM_IOC_REJECT
+#define APM_REJECT_ENABLED
+#endif
+
+#endif /* __APM_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/60.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/60.html new file mode 100644 index 00000000..c293c6dc --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/60.html @@ -0,0 +1,1205 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
/* -*- Mode: C; c-basic-offset: 4 -*-
+ * geyes.c - A cheap xeyes ripoff.
+ * Copyright (C) 1999 Dave Camp
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <math.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet-gsettings.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "geyes.h"
+
+#define UPDATE_TIMEOUT 100
+
+static gfloat
+gtk_align_to_gfloat (GtkAlign align)
+{
+    switch (align) {
+        case GTK_ALIGN_START:
+            return 0.0f;
+        case GTK_ALIGN_END:
+            return 1.0f;
+        case GTK_ALIGN_CENTER:
+        case GTK_ALIGN_FILL:
+            return 0.5f;
+        default:
+            return 0.0f;
+    }
+}
+
+/* TODO - Optimize this a bit */
+static void
+calculate_pupil_xy (EyesApplet *eyes_applet,
+                    gint        x,
+                    gint        y,
+                    gint       *pupil_x,
+                    gint       *pupil_y,
+                    GtkWidget  *widget)
+{
+    GtkAllocation allocation;
+    float sina;
+    float cosa;
+    float h;
+    float temp;
+    float nx, ny;
+    float xalign, yalign;
+    float eye_width_half, eye_height_half;
+
+    gtk_widget_get_allocation (GTK_WIDGET (widget), &allocation);
+    xalign = gtk_align_to_gfloat (gtk_widget_get_halign (widget));
+    yalign = gtk_align_to_gfloat (gtk_widget_get_valign (widget));
+    eye_width_half = (float) eyes_applet->eye_width * 0.5f;
+    eye_height_half = (float) eyes_applet->eye_height * 0.5f;
+
+    nx = (float) x - (float) MAX (allocation.width - eyes_applet->eye_width, 0) * xalign
+         - eye_width_half;
+    ny = (float) y - (float) MAX (allocation.height - eyes_applet->eye_height, 0) * yalign
+         - eye_height_half;
+
+    h = hypotf (nx, ny);
+    if ((h < 0.5f) ||
+        (fabs (h) < (fabs (hypotf (eye_height_half, eye_width_half)
+                           - (float) eyes_applet->wall_thickness
+                           - (float) eyes_applet->pupil_height)))) {
+        *pupil_x = (gint)(nx + eye_width_half);
+        *pupil_y = (gint)(ny + eye_height_half);
+        return;
+    }
+
+    sina = nx / h;
+    cosa = ny / h;
+
+    temp  = hypotf ((float) eyes_applet->eye_width * sina,
+                    (float) eyes_applet->eye_height * cosa);
+    temp -= hypotf ((float) eyes_applet->pupil_width * sina,
+                    (float) eyes_applet->pupil_height * cosa);
+    temp -= (float) eyes_applet->wall_thickness * hypotf (sina, cosa);
+    temp *= 0.5f;
+
+    *pupil_x = (gint)(temp * sina + eye_width_half);
+    *pupil_y = (gint)(temp * cosa + eye_height_half);
+}
+
+static void
+draw_eye (EyesApplet *eyes_applet,
+          gsize       eye_num,
+          gint        pupil_x,
+          gint        pupil_y)
+{
+    GdkPixbuf *pixbuf;
+    GdkRectangle rect, r1, r2;
+
+    pixbuf = gdk_pixbuf_copy (eyes_applet->eye_image);
+    r1.x = pupil_x - eyes_applet->pupil_width / 2;
+    r1.y = pupil_y - eyes_applet->pupil_height / 2;
+    r1.width = eyes_applet->pupil_width;
+    r1.height = eyes_applet->pupil_height;
+    r2.x = 0;
+    r2.y = 0;
+    r2.width = eyes_applet->eye_width;
+    r2.height = eyes_applet->eye_height;
+    gdk_rectangle_intersect (&r1, &r2, &rect);
+    gdk_pixbuf_composite (eyes_applet->pupil_image, pixbuf,
+                          rect.x, rect.y,
+                          rect.width, rect.height,
+                          pupil_x - eyes_applet->pupil_width / 2,
+                          pupil_y - eyes_applet->pupil_height / 2,
+                          1.0, 1.0,
+                          GDK_INTERP_BILINEAR,
+                          255);
+    gtk_image_set_from_pixbuf (GTK_IMAGE (eyes_applet->eyes[eye_num]), pixbuf);
+    g_object_unref (pixbuf);
+
+}
+
+static gint
+timer_cb (EyesApplet *eyes_applet)
+{
+    GdkDisplay *display;
+    GdkSeat *seat;
+    gint x, y, dx, dy;
+    gint pupil_x, pupil_y;
+    gsize i;
+    int applet_x,applet_y;
+
+    display = gtk_widget_get_display (GTK_WIDGET (eyes_applet->applet));
+    seat = gdk_display_get_default_seat (display);
+
+    for (i = 0; i < eyes_applet->num_eyes; i++)
+    {
+        if (gtk_widget_get_realized (eyes_applet->eyes[i]))
+        {
+            gdk_window_get_device_position (gtk_widget_get_window (eyes_applet->eyes[i]),
+                                            gdk_seat_get_pointer (seat),
+                                            &x, &y, NULL);
+
+#ifdef ENABLE_IN_PROCESS
+            gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET(eyes_applet->applet)),
+                                       &applet_x, &applet_y);
+#else
+            applet_x = 0;
+            applet_y = 0;
+#endif
+            gtk_widget_translate_coordinates (eyes_applet->eyes[i],
+                                              gtk_widget_get_toplevel(eyes_applet->eyes[i]),
+                                              -applet_x, -applet_y, &dx, &dy);
+            x -= dx;
+            y -= dy;
+
+            if ((x != eyes_applet->pointer_last_x[i]) ||
+                (y != eyes_applet->pointer_last_y[i])) {
+
+                calculate_pupil_xy (eyes_applet, x, y, &pupil_x, &pupil_y,
+                                    eyes_applet->eyes[i]);
+                draw_eye (eyes_applet, i, pupil_x, pupil_y);
+
+                eyes_applet->pointer_last_x[i] = x;
+                eyes_applet->pointer_last_y[i] = y;
+            }
+        }
+    }
+    return TRUE;
+}
+
+static void
+about_cb (GtkAction  *action,
+          EyesApplet *eyes_applet)
+{
+    static const gchar *authors[] = {
+        "Dave Camp <campd@oit.edu>",
+        NULL
+    };
+
+    const gchar *documenters[] = {
+        "Arjan Scherpenisse <acscherp@wins.uva.nl>",
+        "Telsa Gwynne <hobbit@aloss.ukuu.org.uk>",
+        N_("Sun GNOME Documentation Team <gdocteam@sun.com>"),
+        N_("MATE Documentation Team"),
+        NULL
+    };
+
+#ifdef ENABLE_NLS
+    const char **p;
+    for (p = documenters; *p; ++p)
+        *p = _(*p);
+#endif
+
+    gtk_show_about_dialog (NULL,
+                           "title",              _("About Eyes"),
+                           "version",            VERSION,
+                           "comments",           _("A goofy set of eyes for the MATE "
+                                                   "panel. They follow your mouse."),
+                           "copyright",          _("Copyright \xC2\xA9 1999 Dave Camp\n"
+                                                   "Copyright \xc2\xa9 2012-2021 MATE developers"),
+                           "authors",            authors,
+                           "documenters",        documenters,
+                           "translator-credits", _("translator-credits"),
+                           "logo-icon-name",     "mate-eyes-applet",
+                           NULL);
+}
+
+static gboolean
+properties_load (EyesApplet *eyes_applet)
+{
+    gchar *theme_path = NULL;
+    gboolean result;
+
+    theme_path = g_settings_get_string (eyes_applet->settings,
+                                        GEYES_SETTINGS_THEME_PATH_KEY);
+
+    if (theme_path == NULL)
+        theme_path = g_strdup (GEYES_THEMES_DIR "Default-tiny");
+
+    result = load_theme (eyes_applet, theme_path);
+    g_free (theme_path);
+
+    return result;
+}
+
+void
+setup_eyes (EyesApplet *eyes_applet)
+{
+    gsize i;
+
+    eyes_applet->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+    gtk_box_pack_start (GTK_BOX (eyes_applet->vbox), eyes_applet->hbox, TRUE,
+                        TRUE, 0);
+
+    eyes_applet->eyes = g_new0 (GtkWidget *, eyes_applet->num_eyes);
+    eyes_applet->pointer_last_x = g_new0 (gint, eyes_applet->num_eyes);
+    eyes_applet->pointer_last_y = g_new0 (gint, eyes_applet->num_eyes);
+
+    for (i = 0; i < eyes_applet->num_eyes; i++) {
+        if ((eyes_applet->eyes[i] = gtk_image_new ()) == NULL)
+            g_error ("Error creating geyes\n");
+
+        gtk_widget_set_size_request (GTK_WIDGET (eyes_applet->eyes[i]),
+                                     eyes_applet->eye_width,
+                                     eyes_applet->eye_height);
+
+        gtk_widget_show (eyes_applet->eyes[i]);
+
+        gtk_box_pack_start (GTK_BOX (eyes_applet->hbox), eyes_applet->eyes[i],
+                            TRUE, TRUE, 0);
+
+        if ((eyes_applet->num_eyes != 1) && (i == 0)) {
+            gtk_widget_set_halign (eyes_applet->eyes[i], GTK_ALIGN_END);
+            gtk_widget_set_valign (eyes_applet->eyes[i], GTK_ALIGN_CENTER);
+        } else if ((eyes_applet->num_eyes != 1) &&
+                   (i == eyes_applet->num_eyes - 1)) {
+            gtk_widget_set_halign (eyes_applet->eyes[i], GTK_ALIGN_START);
+            gtk_widget_set_valign (eyes_applet->eyes[i], GTK_ALIGN_CENTER);
+        } else {
+            gtk_widget_set_halign (eyes_applet->eyes[i], GTK_ALIGN_CENTER);
+            gtk_widget_set_valign (eyes_applet->eyes[i], GTK_ALIGN_CENTER);
+        }
+
+        eyes_applet->pointer_last_x[i] = G_MAXINT;
+        eyes_applet->pointer_last_y[i] = G_MAXINT;
+
+        draw_eye (eyes_applet, i, eyes_applet->eye_width / 2,
+                  eyes_applet->eye_height / 2);
+
+    }
+    gtk_widget_show (eyes_applet->hbox);
+}
+
+void
+destroy_eyes (EyesApplet *eyes_applet)
+{
+    gtk_widget_destroy (eyes_applet->hbox);
+    eyes_applet->hbox = NULL;
+
+    g_free (eyes_applet->eyes);
+    g_free (eyes_applet->pointer_last_x);
+    g_free (eyes_applet->pointer_last_y);
+}
+
+static EyesApplet*
+create_eyes (MatePanelApplet *applet)
+{
+    EyesApplet *eyes_applet = g_new0 (EyesApplet, 1);
+
+    eyes_applet->applet = applet;
+    eyes_applet->vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+    eyes_applet->settings =
+        mate_panel_applet_settings_new (applet,
+                                        GEYES_SETTINGS_SCHEMA);
+    gtk_container_add (GTK_CONTAINER (applet), eyes_applet->vbox);
+    return eyes_applet;
+}
+
+static void
+destroy_cb (GObject    *object,
+            EyesApplet *eyes_applet)
+{
+    g_return_if_fail (eyes_applet);
+
+    g_source_remove (eyes_applet->timeout_id);
+
+    if (eyes_applet->hbox)
+        destroy_eyes (eyes_applet);
+    eyes_applet->timeout_id = 0;
+
+    if (eyes_applet->eye_image)
+        g_object_unref (eyes_applet->eye_image);
+    eyes_applet->eye_image = NULL;
+
+    if (eyes_applet->pupil_image)
+        g_object_unref (eyes_applet->pupil_image);
+    eyes_applet->pupil_image = NULL;
+
+    g_free (eyes_applet->theme_dir);
+    eyes_applet->theme_dir = NULL;
+
+    g_free (eyes_applet->theme_name);
+    eyes_applet->theme_name = NULL;
+
+    g_free (eyes_applet->eye_filename);
+    eyes_applet->eye_filename = NULL;
+
+    g_free (eyes_applet->pupil_filename);
+    eyes_applet->pupil_filename = NULL;
+
+    if (eyes_applet->prop_box.pbox)
+        gtk_widget_destroy (eyes_applet->prop_box.pbox);
+
+    if (eyes_applet->settings)
+        g_object_unref (eyes_applet->settings);
+    eyes_applet->settings = NULL;
+
+    g_free (eyes_applet);
+}
+
+static void
+help_cb (GtkAction  *action,
+         EyesApplet *eyes_applet)
+{
+    GError *error = NULL;
+
+    gtk_show_uri_on_window (NULL, "help:mate-geyes",
+                            gtk_get_current_event_time (),
+                            &error);
+
+    if (error) {
+        GtkWidget *dialog
+            = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+                                      GTK_MESSAGE_ERROR,
+                                      GTK_BUTTONS_CLOSE,
+                                      _("There was an error displaying help: %s"),
+                                      error->message);
+        g_signal_connect (dialog, "response",
+                          G_CALLBACK (gtk_widget_destroy),
+                          NULL);
+        gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+        gtk_window_set_screen (GTK_WINDOW (dialog),
+                               gtk_widget_get_screen (GTK_WIDGET (eyes_applet->applet)));
+        gtk_widget_show (dialog);
+        g_clear_error (&error);
+    }
+}
+
+static const GtkActionEntry geyes_applet_menu_actions[] = {
+        { "Props", "document-properties", N_("_Preferences"),
+          NULL, NULL, G_CALLBACK (properties_cb) },
+        { "Help", "help-browser", N_("_Help"),
+          NULL, NULL, G_CALLBACK (help_cb) },
+        { "About", "help-about", N_("_About"),
+          NULL, NULL, G_CALLBACK (about_cb) }
+};
+
+static void
+set_atk_name_description (GtkWidget   *widget,
+                          const gchar *name,
+                          const gchar *description)
+{
+    AtkObject *aobj;
+
+    aobj = gtk_widget_get_accessible (widget);
+
+    /* Check if gail is loaded */
+    if (GTK_IS_ACCESSIBLE (aobj) == FALSE)
+        return;
+
+    atk_object_set_name (aobj, name);
+    atk_object_set_description (aobj, description);
+}
+
+static gboolean
+geyes_applet_fill (MatePanelApplet *applet)
+{
+    EyesApplet *eyes_applet;
+    GtkActionGroup *action_group;
+    gboolean result;
+
+#ifndef ENABLE_IN_PROCESS
+    g_set_application_name (_("Eyes"));
+#endif
+    gtk_window_set_default_icon_name ("mate-eyes-applet");
+    mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR);
+
+    eyes_applet = create_eyes (applet);
+
+    eyes_applet->timeout_id = g_timeout_add (UPDATE_TIMEOUT,
+                                             (GSourceFunc) timer_cb,
+                                             eyes_applet);
+
+    action_group = gtk_action_group_new ("Geyes Applet Actions");
+    gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+
+    gtk_action_group_add_actions (action_group, geyes_applet_menu_actions,
+                                  G_N_ELEMENTS (geyes_applet_menu_actions),
+                                  eyes_applet);
+
+    mate_panel_applet_setup_menu_from_resource (eyes_applet->applet,
+                                                GEYES_RESOURCE_PATH "geyes-applet-menu.xml",
+                                                action_group);
+
+    if (mate_panel_applet_get_locked_down (eyes_applet->applet)) {
+        GtkAction *action;
+
+        action = gtk_action_group_get_action (action_group, "Props");
+        gtk_action_set_visible (action, FALSE);
+    }
+    g_object_unref (action_group);
+
+    gtk_widget_set_tooltip_text (GTK_WIDGET (eyes_applet->applet), _("Eyes"));
+
+    set_atk_name_description (GTK_WIDGET (eyes_applet->applet), _("Eyes"),
+                              _("The eyes look in the direction of the mouse pointer"));
+
+    g_signal_connect (eyes_applet->vbox, "destroy",
+                      G_CALLBACK (destroy_cb),
+                      eyes_applet);
+
+    gtk_widget_show_all (GTK_WIDGET (eyes_applet->applet));
+
+    /* setup here and not in create eyes so the destroy signal is set so
+     * that when there is an error within loading the theme
+     * we can emit this signal */
+    if ((result = properties_load (eyes_applet)) == TRUE)
+        setup_eyes (eyes_applet);
+
+    return result;
+}
+
+static gboolean
+geyes_applet_factory (MatePanelApplet *applet,
+                      const gchar     *iid,
+                      gpointer         data)
+{
+    gboolean retval = FALSE;
+
+    theme_dirs_create ();
+
+    if (!strcmp (iid, "GeyesApplet"))
+        retval = geyes_applet_fill (applet);
+
+    if (retval == FALSE) {
+        exit (-1);
+    }
+
+    return retval;
+}
+
+PANEL_APPLET_FACTORY ("GeyesAppletFactory",
+                      PANEL_TYPE_APPLET,
+                      "geyes",
+                      geyes_applet_factory,
+                      NULL)
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/61.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/61.html new file mode 100644 index 00000000..6221abef --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/61.html @@ -0,0 +1,401 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
/* Copyright (C) 1999 Dave Camp <dave@davec.dhs.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GEYES_H__
+#define __GEYES_H__
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk-pixbuf/gdk-pixbuf.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define MAX_EYES 1000
+#define GEYES_SETTINGS_SCHEMA "org.mate.panel.applet.geyes"
+#define GEYES_SETTINGS_THEME_PATH_KEY "theme-path"
+
+typedef struct
+{
+    GtkWidget *pbox;
+
+    gint selected_row;
+} EyesPropertyBox;
+
+typedef struct
+{
+    /* Applet */
+    MatePanelApplet *applet;
+    GtkWidget       *vbox;
+    GtkWidget       *hbox;
+    GtkWidget      **eyes;
+    guint            timeout_id;
+    gint            *pointer_last_x;
+    gint            *pointer_last_y;
+
+    /* Theme */
+    GdkPixbuf       *eye_image;
+    GdkPixbuf       *pupil_image;
+    gchar           *theme_dir;
+    gchar           *theme_name;
+    gchar           *eye_filename;
+    gchar           *pupil_filename;
+    gsize            num_eyes;
+    gint             eye_height;
+    gint             eye_width;
+    gint             pupil_height;
+    gint             pupil_width;
+    gint             wall_thickness;
+
+    /* Properties */
+    EyesPropertyBox  prop_box;
+
+    /* Settings */
+    GSettings       *settings;
+} EyesApplet;
+
+/* eyes.c */
+void   setup_eyes         (EyesApplet  *eyes_applet);
+void   destroy_eyes       (EyesApplet  *eyes_applet);
+
+/* theme.c */
+void    theme_dirs_create (void);
+int     load_theme        (EyesApplet  *eyes_applet,
+                           const gchar *theme_dir);
+void    properties_cb     (GtkAction   *action,
+                           EyesApplet  *eyes_applet);
+
+#endif
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/62.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/62.html new file mode 100644 index 00000000..f4272c1d --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/62.html @@ -0,0 +1,963 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
/*
+ * Copyright (C) 1999 Dave Camp <dave@davec.dhs.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <ctype.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "geyes.h"
+
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
+#define NUM_THEME_DIRECTORIES 2
+
+static char *theme_directories[NUM_THEME_DIRECTORIES];
+
+enum {
+    COL_THEME_DIR = 0,
+    COL_THEME_NAME,
+    TOTAL_COLS
+};
+
+void
+theme_dirs_create (void)
+{
+    static gboolean themes_created = FALSE;
+
+    if (themes_created == TRUE)
+        return;
+
+    theme_directories[0] = g_build_filename (GEYES_THEMES_DIR, NULL);
+
+    theme_directories[1] = g_build_filename (g_get_user_config_dir (), "mate",
+                                             "geyes-themes", NULL);
+
+    themes_created = TRUE;
+}
+
+static void
+parse_theme_file (EyesApplet *eyes_applet,
+                  FILE       *theme_file)
+{
+    gchar line_buf[512]; /* prolly overkill */
+    gchar *token;
+
+    if (fgets (line_buf, 512, theme_file) == NULL)
+        g_debug ("fgets error");
+
+    while (!feof (theme_file)) {
+        token = strtok (line_buf, "=");
+        if (strncmp (token, "wall-thickness", strlen ("wall-thickness")) == 0) {
+            token += strlen ("wall-thickness");
+            while (!isdigit (*token)) {
+                token++;
+            }
+            sscanf (token, "%d", &eyes_applet->wall_thickness);
+        } else if (strncmp (token, "num-eyes", strlen ("num-eyes")) == 0) {
+            token += strlen ("num-eyes");
+            while (!isdigit (*token)) {
+                token++;
+            }
+            sscanf (token, "%" G_GSIZE_FORMAT, &eyes_applet->num_eyes);
+            if (eyes_applet->num_eyes > MAX_EYES)
+                eyes_applet->num_eyes = MAX_EYES;
+        } else if (strncmp (token, "eye-pixmap", strlen ("eye-pixmap")) == 0) {
+            token = strtok (NULL, "\"");<--- token is assigned
+            token = strtok (NULL, "\"");<--- token is overwritten
+            if (eyes_applet->eye_filename != NULL)
+                g_free (eyes_applet->eye_filename);
+            eyes_applet->eye_filename
+                = g_build_filename (eyes_applet->theme_dir, token, NULL);
+        } else if (strncmp (token, "pupil-pixmap", strlen ("pupil-pixmap")) == 0) {
+            token = strtok (NULL, "\"");<--- token is assigned
+            token = strtok (NULL, "\"");<--- token is overwritten
+            if (eyes_applet->pupil_filename != NULL)
+                g_free (eyes_applet->pupil_filename);
+            eyes_applet->pupil_filename
+                = g_build_filename (eyes_applet->theme_dir, token, NULL);
+        }
+        if (fgets (line_buf, 512, theme_file) == NULL)
+            g_debug ("fgets error");
+    }
+}
+
+int
+load_theme (EyesApplet  *eyes_applet,
+            const gchar *theme_dir)
+{
+    GtkWidget *dialog;
+    FILE      *theme_file;
+    gchar     *file_name;
+
+    eyes_applet->theme_dir = g_strdup (theme_dir);
+
+    file_name = g_build_filename (theme_dir, "config", NULL);
+    if ((theme_file = fopen (file_name, "r")) == NULL) {
+        g_free (eyes_applet->theme_dir);
+        eyes_applet->theme_dir = g_build_filename (GEYES_THEMES_DIR, "Default-tiny", NULL);
+        theme_file = fopen (GEYES_THEMES_DIR "Default-tiny/config", "r");
+    }
+    g_free (file_name);
+
+    /* if it's still NULL we've got a major problem */
+    if (theme_file == NULL) {
+        dialog = gtk_message_dialog_new_with_markup (NULL,
+                                                     GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                     GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+                                                     "<b>%s</b>\n\n%s",
+                                                     _("Can not launch the eyes applet."),
+                                                     _("There was a fatal error while trying to load the theme."));
+
+        gtk_dialog_run (GTK_DIALOG (dialog));
+        gtk_widget_destroy (dialog);
+
+        gtk_widget_destroy (GTK_WIDGET (eyes_applet->applet));
+
+        return FALSE;
+    }
+
+    parse_theme_file (eyes_applet, theme_file);
+    fclose (theme_file);
+
+    eyes_applet->theme_name = g_strdup (theme_dir);
+
+    if (eyes_applet->eye_image)
+        g_object_unref (eyes_applet->eye_image);
+
+    eyes_applet->eye_image
+        = gdk_pixbuf_new_from_file (eyes_applet->eye_filename,
+                                    NULL);
+
+    if (eyes_applet->pupil_image)
+        g_object_unref (eyes_applet->pupil_image);
+
+    eyes_applet->pupil_image
+        = gdk_pixbuf_new_from_file (eyes_applet->pupil_filename,
+                                    NULL);
+
+    eyes_applet->eye_height = gdk_pixbuf_get_height (eyes_applet->eye_image);
+    eyes_applet->eye_width = gdk_pixbuf_get_width (eyes_applet->eye_image);
+    eyes_applet->pupil_height = gdk_pixbuf_get_height (eyes_applet->pupil_image);
+    eyes_applet->pupil_width = gdk_pixbuf_get_width (eyes_applet->pupil_image);
+
+    return TRUE;
+}
+
+static void
+destroy_theme (EyesApplet *eyes_applet)
+{
+    /* Dunno about this - to unref or not to unref? */
+    if (eyes_applet->eye_image != NULL) {
+        g_object_unref (eyes_applet->eye_image);
+        eyes_applet->eye_image = NULL;
+    }
+    if (eyes_applet->pupil_image != NULL) {
+        g_object_unref (eyes_applet->pupil_image);
+        eyes_applet->pupil_image = NULL;
+    }
+
+    g_free (eyes_applet->theme_dir);
+    g_free (eyes_applet->theme_name);
+}
+
+static void
+theme_selected_cb (GtkTreeSelection *selection,
+                   gpointer          data)
+{
+    EyesApplet *eyes_applet = data;
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+    gchar *theme;
+
+    if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+        return;
+
+    gtk_tree_model_get (model, &iter, COL_THEME_DIR, &theme, -1);
+
+    g_return_if_fail (theme);
+
+    if (!g_ascii_strncasecmp (theme, eyes_applet->theme_dir,
+                              strlen (theme))) {
+        g_free (theme);
+        return;
+    }
+
+    destroy_eyes (eyes_applet);
+    destroy_theme (eyes_applet);
+    load_theme (eyes_applet, theme);
+    setup_eyes (eyes_applet);
+
+    g_settings_set_string (eyes_applet->settings,
+                           GEYES_SETTINGS_THEME_PATH_KEY,
+                           theme);
+
+    g_free (theme);
+}
+
+static void
+phelp_cb (GtkDialog *dialog)
+{
+    GError *error = NULL;
+
+    gtk_show_uri_on_window (GTK_WINDOW (dialog), "help:mate-geyes/geyes-settings",
+                            gtk_get_current_event_time (),
+                            &error);
+
+    if (error) {
+        GtkWidget *error_dialog
+            = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+                                      GTK_MESSAGE_ERROR,
+                                      GTK_BUTTONS_CLOSE,
+                                      _("There was an error displaying help: %s"),
+                                      error->message);
+        g_signal_connect (error_dialog, "response",
+                          G_CALLBACK (gtk_widget_destroy),
+                          NULL);
+        gtk_window_set_resizable (GTK_WINDOW (error_dialog), FALSE);
+        gtk_window_set_screen (GTK_WINDOW (error_dialog),
+                               gtk_widget_get_screen (GTK_WIDGET (dialog)));
+        gtk_widget_show (error_dialog);
+        g_clear_error (&error);
+    }
+}
+
+static void
+presponse_cb (GtkDialog *dialog,
+              gint       id,
+              gpointer   data)
+{
+    EyesApplet *eyes_applet = data;
+    if (id == GTK_RESPONSE_HELP) {
+        phelp_cb (dialog);
+        return;
+    }
+
+    gtk_widget_destroy (GTK_WIDGET (dialog));
+
+    eyes_applet->prop_box.pbox = NULL;
+}
+
+void
+properties_cb (GtkAction  *action,
+               EyesApplet *eyes_applet)
+{
+    GtkBuilder *builder;
+    GtkWidget *tree;
+    GtkWidget *label;
+    GtkListStore *model;
+    GtkTreeViewColumn *column;
+    GtkCellRenderer *cell;
+    GtkTreeIter iter;
+    GDir *dfd;
+    const char *dp;
+    GError *error = NULL;
+    int i;
+
+    if (eyes_applet->prop_box.pbox) {
+        gtk_window_set_screen (GTK_WINDOW (eyes_applet->prop_box.pbox),
+                               gtk_widget_get_screen (GTK_WIDGET (eyes_applet->applet)));
+
+        gtk_window_present (GTK_WINDOW (eyes_applet->prop_box.pbox));
+        return;
+    }
+
+    builder = gtk_builder_new_from_resource (GEYES_RESOURCE_PATH "themes.ui");
+
+    eyes_applet->prop_box.pbox = GET_WIDGET("preferences_dialog");
+    tree = GET_WIDGET("themes_treeview");
+    label = GET_WIDGET("select_theme_label");
+
+    model = gtk_list_store_new (TOTAL_COLS, G_TYPE_STRING, G_TYPE_STRING);
+    gtk_tree_view_set_model (GTK_TREE_VIEW (tree), GTK_TREE_MODEL (model));
+    cell = gtk_cell_renderer_text_new ();
+    column = gtk_tree_view_column_new_with_attributes ("not used", cell, "text",
+                                                       COL_THEME_NAME,
+                                                       NULL);
+    gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
+
+    if (!g_settings_is_writable (eyes_applet->settings, GEYES_SETTINGS_THEME_PATH_KEY)) {
+        gtk_widget_set_sensitive (tree, FALSE);
+        gtk_widget_set_sensitive (label, FALSE);
+    }
+
+    for (i = 0; i < NUM_THEME_DIRECTORIES; i++) {
+        dfd = g_dir_open (theme_directories[i], 0, &error);
+        if (error) {
+            g_debug ("Could not open the folder: %s", error->message);
+            g_clear_error (&error);
+            continue;
+        }
+        while ((dp = g_dir_read_name (dfd)) != NULL) {
+            if (dp[0] != '.') {
+                gchar *theme_dir;
+
+                theme_dir = g_build_filename (theme_directories[i], dp, NULL);
+                gtk_list_store_append (model, &iter);
+                gtk_list_store_set (model, &iter,
+                                    COL_THEME_DIR, theme_dir,
+                                    COL_THEME_NAME, dp,
+                                    -1);
+
+                if (!g_ascii_strncasecmp (eyes_applet->theme_dir, theme_dir,
+                                          strlen (theme_dir))) {
+                    GtkTreePath *path;
+
+                    path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
+                    gtk_tree_view_set_cursor (GTK_TREE_VIEW (tree),
+                                              path, NULL, FALSE);
+                    gtk_tree_path_free (path);
+                }
+                g_free (theme_dir);
+            }
+        }
+        g_dir_close (dfd);
+    }
+    g_object_unref (model);
+
+    /* signals */
+    gtk_builder_add_callback_symbols (builder, "on_preferences_dialog_response",
+                                      G_CALLBACK (presponse_cb),
+                                      "on_themes_treeselection_changed",
+                                      G_CALLBACK (theme_selected_cb),
+                                      NULL);
+    gtk_builder_connect_signals (builder, eyes_applet);
+
+    g_object_unref (builder);
+
+    gtk_widget_show_all (eyes_applet->prop_box.pbox);
+
+    return;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/63.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/63.html new file mode 100644 index 00000000..2d15623d --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/63.html @@ -0,0 +1,863 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
/*
+ * Copyright 2007 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/* Author: Soren Sandmann <sandmann@redhat.com> */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n-lib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <math.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "edid.h"
+
+typedef struct Vendor Vendor;
+
+struct Vendor {
+	const char vendor_id[4];
+	const char vendor_name[28];
+};
+
+/* This list of vendor codes derived from lshw
+ *
+ * http://ezix.org/project/wiki/HardwareLiSter
+ *
+ * Note: we now prefer to use data coming from hwdata (and shipped with
+ * mate-desktop). See
+ * http://git.fedorahosted.org/git/?p=hwdata.git;a=blob_plain;f=pnp.ids;hb=HEAD
+ * All contributions to the list of vendors should go there.
+ */
+static const struct Vendor vendors[] = {
+	{"AIC", "AG Neovo"},
+	{"ACR", "Acer"},
+	{"DEL", "DELL"},
+	{"SAM", "SAMSUNG"},
+	{"SNY", "SONY"},
+	{"SEC", "Epson"},
+	{"WAC", "Wacom"},
+	{"NEC", "NEC"},
+	{"CMO", "CMO"},	/* Chi Mei */
+	{"BNQ", "BenQ"},
+
+	{"ABP", "Advansys"},
+	{"ACC", "Accton"},
+	{"ACE", "Accton"},
+	{"ADP", "Adaptec"},
+	{"ADV", "AMD"},
+	{"AIR", "AIR"},
+	{"AMI", "AMI"},
+	{"ASU", "ASUS"},
+	{"ATI", "ATI"},
+	{"ATK", "Allied Telesyn"},
+	{"AZT", "Aztech"},
+	{"BAN", "Banya"},
+	{"BRI", "Boca Research"},
+	{"BUS", "Buslogic"},
+	{"CCI", "Cache Computers Inc."},
+	{"CHA", "Chase"},
+	{"CMD", "CMD Technology, Inc."},
+	{"COG", "Cogent"},
+	{"CPQ", "Compaq"},
+	{"CRS", "Crescendo"},
+	{"CSC", "Crystal"},
+	{"CSI", "CSI"},
+	{"CTL", "Creative Labs"},
+	{"DBI", "Digi"},
+	{"DEC", "Digital Equipment"},
+	{"DBK", "Databook"},
+	{"EGL", "Eagle Technology"},
+	{"ELS", "ELSA"},
+	{"ESS", "ESS"},
+	{"FAR", "Farallon"},
+	{"FDC", "Future Domain"},
+	{"HWP", "Hewlett-Packard"},
+	{"IBM", "IBM"},
+	{"INT", "Intel"},
+	{"ISA", "Iomega"},
+	{"LEN", "Lenovo"},
+	{"MDG", "Madge"},
+	{"MDY", "Microdyne"},
+	{"MET", "Metheus"},
+	{"MIC", "Micronics"},
+	{"MLX", "Mylex"},
+	{"NVL", "Novell"},
+	{"OLC", "Olicom"},
+	{"PRO", "Proteon"},
+	{"RII", "Racal"},
+	{"RTL", "Realtek"},
+	{"SCM", "SCM"},
+	{"SKD", "SysKonnect"},
+	{"SGI", "SGI"},
+	{"SMC", "SMC"},
+	{"SNI", "Siemens Nixdorf"},
+	{"STL", "Stallion Technologies"},
+	{"SUN", "Sun"},
+	{"SUP", "SupraExpress"},
+	{"SVE", "SVEC"},
+	{"TCC", "Thomas-Conrad"},
+	{"TCI", "Tulip"},
+	{"TCM", "3Com"},
+	{"TCO", "Thomas-Conrad"},
+	{"TEC", "Tecmar"},
+	{"TRU", "Truevision"},
+	{"TOS", "Toshiba"},
+	{"TYN", "Tyan"},
+	{"UBI", "Ungermann-Bass"},
+	{"USC", "UltraStor"},
+	{"VDM", "Vadem"},
+	{"VMI", "Vermont"},
+	{"WDC", "Western Digital"},
+	{"ZDS", "Zeos"},
+
+	/* From http://faydoc.tripod.com/structures/01/0136.htm */
+	{"ACT", "Targa"},
+	{"ADI", "ADI"},
+	{"AOC", "AOC Intl"},
+	{"API", "Acer America"},
+	{"APP", "Apple Computer"},
+	{"ART", "ArtMedia"},
+	{"AST", "AST Research"},
+	{"CPL", "Compal"},
+	{"CTX", "Chuntex Electronic Co."},
+	{"DPC", "Delta Electronics"},
+	{"DWE", "Daewoo"},
+	{"ECS", "ELITEGROUP"},
+	{"EIZ", "EIZO"},
+	{"FCM", "Funai"},
+	{"GSM", "LG Electronics"},
+	{"GWY", "Gateway 2000"},
+	{"HEI", "Hyundai"},
+	{"HIT", "Hitachi"},
+	{"HSL", "Hansol"},
+	{"HTC", "Hitachi"},
+	{"ICL", "Fujitsu ICL"},
+	{"IVM", "Idek Iiyama"},
+	{"KFC", "KFC Computek"},
+	{"LKM", "ADLAS"},
+	{"LNK", "LINK Tech"},
+	{"LTN", "Lite-On"},
+	{"MAG", "MAG InnoVision"},
+	{"MAX", "Maxdata"},
+	{"MEI", "Panasonic"},
+	{"MEL", "Mitsubishi"},
+	{"MIR", "miro"},
+	{"MTC", "MITAC"},
+	{"NAN", "NANAO"},
+	{"NEC", "NEC Tech"},
+	{"NOK", "Nokia"},
+	{"OQI", "OPTIQUEST"},
+	{"PBN", "Packard Bell"},
+	{"PGS", "Princeton"},
+	{"PHL", "Philips"},
+	{"REL", "Relisys"},
+	{"SDI", "Samtron"},
+	{"SMI", "Smile"},
+	{"SPT", "Sceptre"},
+	{"SRC", "Shamrock Technology"},
+	{"STP", "Sceptre"},
+	{"TAT", "Tatung"},
+	{"TRL", "Royal Information Company"},
+	{"TSB", "Toshiba, Inc."},
+	{"UNM", "Unisys"},
+	{"VSC", "ViewSonic"},
+	{"WTC", "Wen Tech"},
+	{"ZCM", "Zenith Data Systems"},
+
+	{"???", "Unknown"},
+};
+
+static GHashTable* pnp_ids = NULL;
+
+static void read_pnp_ids(void)
+{
+	gchar* contents;
+	gchar** lines;
+	gchar* line;
+	gchar* code, *name;
+	gint i;
+
+	if (pnp_ids)
+		return;
+
+	pnp_ids = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
+
+	if (g_file_get_contents(PNP_IDS, &contents, NULL, NULL))
+	{
+		lines = g_strsplit(contents, "\n", -1);
+
+		for (i = 0; lines[i]; i++)
+		{
+			 line = lines[i];
+
+			 if (line[0] && line[1] && line[2] && line[3] == '\t' && line[4])
+			 {
+				 code = line;
+				 line[3] = '\0';
+				 name = line + 4;
+				 g_hash_table_insert(pnp_ids, code, name);
+			 }
+		}
+
+		g_free(lines);
+		g_free(contents);
+	}
+}
+
+static const char* find_vendor(const char* code)
+{
+	const char* vendor_name;
+	gsize i;
+
+	read_pnp_ids();
+
+	vendor_name = g_hash_table_lookup(pnp_ids, code);
+
+	if (vendor_name)
+		return vendor_name;
+
+	for (i = 0; i < G_N_ELEMENTS (vendors); ++i)
+	{
+		const Vendor* v = &(vendors[i]);
+
+		if (strcmp(v->vendor_id, code) == 0)
+			return v->vendor_name;
+	}
+
+	return code;
+}
+
+char* make_display_name(const MonitorInfo* info)
+{
+	const char* vendor;
+	int width_mm, height_mm, inches;
+
+	if (info)
+	{
+		vendor = find_vendor(info->manufacturer_code);
+	}
+	else
+	{
+		/* Translators: "Unknown" here is used to identify a monitor for which
+		 * we don't know the vendor. When a vendor is known, the name of the
+		 * vendor is used. */
+		vendor = C_("Monitor vendor", "Unknown");
+	}
+
+	if (info && info->width_mm != -1 && info->height_mm)
+	{
+		width_mm = info->width_mm;
+		height_mm = info->height_mm;
+	}
+	else if (info && info->n_detailed_timings)
+	{
+		width_mm = info->detailed_timings[0].width_mm;
+		height_mm = info->detailed_timings[0].height_mm;
+	}
+	else
+	{
+		width_mm = -1;
+		height_mm = -1;
+	}
+
+	if (width_mm != -1 && height_mm != -1)
+	{
+		double d = sqrt (width_mm * width_mm + height_mm * height_mm);
+
+		inches = (int) (d / 25.4 + 0.5);
+	}
+	else
+	{
+		inches = -1;
+	}
+
+	if (inches > 0)
+	{
+		return g_strdup_printf("%s %d\"", vendor, inches);
+	}
+	else
+	{
+		return g_strdup(vendor);
+	}
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/64.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/64.html new file mode 100644 index 00000000..22994104 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/64.html @@ -0,0 +1,1309 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
/*
+ * Copyright 2007 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/* Author: Soren Sandmann <sandmann@redhat.com> */
+
+#include "edid.h"
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <math.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+static int get_bit(int in, int bit)
+{
+	return (in & (1 << bit)) >> bit;
+}
+
+static int get_bits(int in, int begin, int end)
+{
+	int mask = (1 << (end - begin + 1)) - 1;
+
+	return (in >> begin) & mask;
+}
+
+static int decode_header(const uchar* edid)
+{
+	if (memcmp(edid, "\x00\xff\xff\xff\xff\xff\xff\x00", 8) == 0)
+	{
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+static int decode_vendor_and_product_identification(const uchar* edid, MonitorInfo* info)
+{
+	int is_model_year;
+
+	/* Manufacturer Code */
+	info->manufacturer_code[0] = get_bits(edid[0x08], 2, 6);
+	info->manufacturer_code[1] = get_bits(edid[0x08], 0, 1) << 3;
+	info->manufacturer_code[1] |= get_bits(edid[0x09], 5, 7);
+	info->manufacturer_code[2] = get_bits(edid[0x09], 0, 4);
+	info->manufacturer_code[3] = '\0';
+
+	info->manufacturer_code[0] += 'A' - 1;
+	info->manufacturer_code[1] += 'A' - 1;
+	info->manufacturer_code[2] += 'A' - 1;
+
+	/* Product Code */
+	info->product_code = edid[0x0b] << 8 | edid[0x0a];
+
+	/* Serial Number */
+	info->serial_number = edid[0x0c] | edid[0x0d] << 8 | edid[0x0e] << 16 | edid[0x0f] << 24;
+
+	/* Week and Year */
+	is_model_year = FALSE;
+
+	switch (edid[0x10])
+	{
+		case 0x00:
+			info->production_week = -1;
+			break;
+
+		case 0xff:
+			info->production_week = -1;
+			is_model_year = TRUE;
+			break;
+
+		default:
+			info->production_week = edid[0x10];
+			break;
+	}
+
+	if (is_model_year)
+	{
+		info->production_year = -1;
+		info->model_year = 1990 + edid[0x11];
+	}
+	else
+	{
+		info->production_year = 1990 + edid[0x11];
+		info->model_year = -1;
+	}
+
+	return TRUE;
+}
+
+static int decode_edid_version(const uchar* edid, MonitorInfo* info)
+{
+	info->major_version = edid[0x12];
+	info->minor_version = edid[0x13];
+
+	return TRUE;
+}
+
+static int decode_display_parameters(const uchar* edid, MonitorInfo* info)
+{
+	/* Digital vs Analog */
+	info->is_digital = get_bit(edid[0x14], 7);
+
+	if (info->is_digital)
+	{
+		int bits;
+
+		static const int bit_depth[8] = {
+			-1, 6, 8, 10, 12, 14, 16, -1
+		};
+
+		static const Interface interfaces[6] = {
+			UNDEFINED, DVI, HDMI_A, HDMI_B, MDDI, DISPLAY_PORT
+		};
+
+		bits = get_bits(edid[0x14], 4, 6);
+		info->connector.digital.bits_per_primary = bit_depth[bits];
+
+		bits = get_bits(edid[0x14], 0, 3);
+
+		if (bits <= 5)
+		{
+			info->connector.digital.interface = interfaces[bits];
+		}
+		else
+		{
+			info->connector.digital.interface = UNDEFINED;
+		}
+	}
+	else
+	{
+		int bits = get_bits (edid[0x14], 5, 6);
+
+		static const double levels[][3] = {
+			{ 0.7,   0.3,	1.0 },
+			{ 0.714, 0.286,  1.0 },
+			{ 1.0,   0.4,	1.4 },
+			{ 0.7,   0.0,	0.7 },
+		};
+
+		info->connector.analog.video_signal_level = levels[bits][0];
+		info->connector.analog.sync_signal_level = levels[bits][1];
+		info->connector.analog.total_signal_level = levels[bits][2];
+
+		info->connector.analog.blank_to_black = get_bit (edid[0x14], 4);
+
+		info->connector.analog.separate_hv_sync = get_bit (edid[0x14], 3);
+		info->connector.analog.composite_sync_on_h = get_bit (edid[0x14], 2);
+		info->connector.analog.composite_sync_on_green = get_bit (edid[0x14], 1);
+
+		info->connector.analog.serration_on_vsync = get_bit (edid[0x14], 0);
+	}
+
+	/* Screen Size / Aspect Ratio */
+	if (edid[0x15] == 0 && edid[0x16] == 0)
+	{
+		info->width_mm = -1;
+		info->height_mm = -1;
+		info->aspect_ratio = -1.0;
+	}
+	else if (edid[0x16] == 0)
+	{
+		info->width_mm = -1;
+		info->height_mm = -1;
+		info->aspect_ratio = 100.0 / (edid[0x15] + 99);
+	}
+	else if (edid[0x15] == 0)
+	{
+		info->width_mm = -1;
+		info->height_mm = -1;
+		info->aspect_ratio = 100.0 / (edid[0x16] + 99);
+		info->aspect_ratio = 1/info->aspect_ratio; /* portrait */
+	}
+	else
+	{
+		info->width_mm = 10 * edid[0x15];
+		info->height_mm = 10 * edid[0x16];
+	}
+
+	/* Gamma */
+	if (edid[0x17] == 0xFF)
+		info->gamma = -1.0;
+	else
+		info->gamma = (edid[0x17] + 100.0) / 100.0;
+
+	/* Features */
+	info->standby = get_bit(edid[0x18], 7);
+	info->suspend = get_bit(edid[0x18], 6);
+	info->active_off = get_bit(edid[0x18], 5);
+
+	if (info->is_digital)
+	{
+		info->connector.digital.rgb444 = TRUE;
+
+		if (get_bit(edid[0x18], 3))
+			info->connector.digital.ycrcb444 = 1;
+		if (get_bit(edid[0x18], 4))
+			info->connector.digital.ycrcb422 = 1;
+	}
+	else
+	{
+		int bits = get_bits(edid[0x18], 3, 4);
+
+		ColorType color_type[4] = {
+			MONOCHROME, RGB, OTHER_COLOR, UNDEFINED_COLOR
+		};
+
+		info->connector.analog.color_type = color_type[bits];
+	}
+
+	info->srgb_is_standard = get_bit(edid[0x18], 2);
+
+	/* In 1.3 this is called "has preferred timing" */
+	info->preferred_timing_includes_native = get_bit(edid[0x18], 1);
+
+	/* FIXME: In 1.3 this indicates whether the monitor accepts GTF */
+	info->continuous_frequency = get_bit(edid[0x18], 0);
+
+	return TRUE;
+}
+
+static double decode_fraction(int high, int low)
+{
+	double result = 0.0;
+	int i;
+
+	high = (high << 2) | low;
+
+	for (i = 0; i < 10; ++i)
+	{
+		result += get_bit (high, i) * pow (2, i - 10);
+	}
+
+	return result;
+}
+
+static int decode_color_characteristics(const uchar* edid, MonitorInfo* info)
+{
+	info->red_x = decode_fraction(edid[0x1b], get_bits(edid[0x19], 6, 7));
+	info->red_y = decode_fraction(edid[0x1c], get_bits(edid[0x19], 5, 4));
+	info->green_x = decode_fraction(edid[0x1d], get_bits(edid[0x19], 2, 3));
+	info->green_y = decode_fraction(edid[0x1e], get_bits(edid[0x19], 0, 1));
+	info->blue_x = decode_fraction(edid[0x1f], get_bits(edid[0x1a], 6, 7));
+	info->blue_y = decode_fraction(edid[0x20], get_bits(edid[0x1a], 4, 5));
+	info->white_x = decode_fraction(edid[0x21], get_bits(edid[0x1a], 2, 3));
+	info->white_y = decode_fraction(edid[0x22], get_bits(edid[0x1a], 0, 1));
+
+	return TRUE;
+}
+
+static int decode_established_timings(const uchar* edid, MonitorInfo* info)
+{
+	static const Timing established[][8] = {
+		{
+			{800, 600, 60},
+			{800, 600, 56},
+			{640, 480, 75},
+			{640, 480, 72},
+			{640, 480, 67},
+			{640, 480, 60},
+			{720, 400, 88},
+			{720, 400, 70}
+		},
+		{
+			{1280, 1024, 75},
+			{1024, 768, 75},
+			{1024, 768, 70},
+			{1024, 768, 60},
+			{1024, 768, 87},
+			{832, 624, 75},
+			{800, 600, 75},
+			{800, 600, 72}
+		},
+		{
+			{0, 0, 0},
+			{0, 0, 0},
+			{0, 0, 0},
+			{0, 0, 0},
+			{0, 0, 0},
+			{0, 0, 0},
+			{0, 0, 0},
+			{1152, 870, 75}
+		},
+	};
+
+	int i, j, idx;
+
+	idx = 0;
+
+	for (i = 0; i < 3; ++i)
+	{
+		for (j = 0; j < 8; ++j)
+		{
+			int byte = edid[0x23 + i];
+
+			if (get_bit (byte, j) && established[i][j].frequency != 0)
+			{
+				info->established[idx++] = established[i][j];
+			}
+		}
+	}
+
+	return TRUE;
+}
+
+static int decode_standard_timings(const uchar* edid, MonitorInfo* info)
+{
+	int i;
+
+	for (i = 0; i < 8; i++)
+	{
+		int first = edid[0x26 + 2 * i];
+		int second = edid[0x27 + 2 * i];
+
+		if (first != 0x01 && second != 0x01)
+		{
+			int w = 8 * (first + 31);
+			int h = 0;
+
+			switch (get_bits(second, 6, 7))
+			{
+				case 0x00:
+					h = (w / 16) * 10;
+					break;
+				case 0x01:
+					h = (w / 4) * 3;
+					break;
+				case 0x02:
+					h = (w / 5) * 4;
+					break;
+				case 0x03:
+					h = (w / 16) * 9;
+					break;
+			}
+
+			info->standard[i].width = w;
+			info->standard[i].height = h;
+			info->standard[i].frequency = get_bits(second, 0, 5) + 60;
+		}
+	}
+
+	return TRUE;
+}
+
+static void decode_lf_string(const uchar* s, int n_chars, char* result)
+{
+	int i;
+
+	for (i = 0; i < n_chars; ++i)
+	{
+		if (s[i] == 0x0a)
+		{
+			*result++ = '\0';
+			break;
+		}
+		else if (s[i] == 0x00)
+		{
+			/* Convert embedded 0's to spaces */
+			*result++ = ' ';
+		}
+		else
+		{
+			*result++ = s[i];
+		}
+	}
+}
+
+static void decode_display_descriptor(const uchar* desc, MonitorInfo* info)
+{
+	switch (desc[0x03])
+	{
+		case 0xFC:
+			decode_lf_string (desc + 5, 13, info->dsc_product_name);
+			break;
+		case 0xFF:
+			decode_lf_string (desc + 5, 13, info->dsc_serial_number);
+			break;
+		case 0xFE:
+			decode_lf_string (desc + 5, 13, info->dsc_string);
+			break;
+		case 0xFD:
+			/* Range Limits */
+			break;
+		case 0xFB:
+			/* Color Point */
+			break;
+		case 0xFA:
+			/* Timing Identifications */
+			break;
+		case 0xF9:
+			/* Color Management */
+			break;
+		case 0xF8:
+			/* Timing Codes */
+			break;
+		case 0xF7:
+			/* Established Timings */
+			break;
+		case 0x10:
+			break;
+	}
+}
+
+static void decode_detailed_timing(const uchar* timing, DetailedTiming* detailed)
+{
+	int bits;
+
+	StereoType stereo[] = {
+		NO_STEREO, NO_STEREO, FIELD_RIGHT, FIELD_LEFT,
+		TWO_WAY_RIGHT_ON_EVEN, TWO_WAY_LEFT_ON_EVEN,
+		FOUR_WAY_INTERLEAVED, SIDE_BY_SIDE
+	};
+
+	detailed->pixel_clock = (timing[0x00] | timing[0x01] << 8) * 10000;
+	detailed->h_addr = timing[0x02] | ((timing[0x04] & 0xf0) << 4);
+	detailed->h_blank = timing[0x03] | ((timing[0x04] & 0x0f) << 8);
+	detailed->v_addr = timing[0x05] | ((timing[0x07] & 0xf0) << 4);
+	detailed->v_blank = timing[0x06] | ((timing[0x07] & 0x0f) << 8);
+	detailed->h_front_porch = timing[0x08] | get_bits(timing[0x0b], 6, 7) << 8;
+	detailed->h_sync = timing[0x09] | get_bits(timing[0x0b], 4, 5) << 8;
+	detailed->v_front_porch =
+	get_bits (timing[0x0a], 4, 7) | get_bits(timing[0x0b], 2, 3) << 4;
+	detailed->v_sync =
+	get_bits (timing[0x0a], 0, 3) | get_bits(timing[0x0b], 0, 1) << 4;
+	detailed->width_mm =  timing[0x0c] | get_bits(timing[0x0e], 4, 7) << 8;
+	detailed->height_mm = timing[0x0d] | get_bits(timing[0x0e], 0, 3) << 8;
+	detailed->right_border = timing[0x0f];
+	detailed->top_border = timing[0x10];
+
+	detailed->interlaced = get_bit(timing[0x11], 7);
+
+	/* Stereo */
+	bits = get_bits (timing[0x11], 5, 6) << 1 | get_bit(timing[0x11], 0);
+	detailed->stereo = stereo[bits];
+
+	/* Sync */
+	bits = timing[0x11];
+
+	detailed->digital_sync = get_bit(bits, 4);
+
+	if (detailed->digital_sync)
+	{
+		detailed->connector.digital.composite = !get_bit(bits, 3);
+
+		if (detailed->connector.digital.composite)
+		{
+			detailed->connector.digital.serrations = get_bit(bits, 2);
+			detailed->connector.digital.negative_vsync = FALSE;
+		}
+		else
+		{
+			detailed->connector.digital.serrations = FALSE;
+			detailed->connector.digital.negative_vsync = !get_bit(bits, 2);
+		}
+
+		detailed->connector.digital.negative_hsync = !get_bit(bits, 0);
+	}
+	else
+	{
+		detailed->connector.analog.bipolar = get_bit(bits, 3);
+		detailed->connector.analog.serrations = get_bit(bits, 2);
+		detailed->connector.analog.sync_on_green = !get_bit(bits, 1);
+	}
+}
+
+static int decode_descriptors(const uchar* edid, MonitorInfo* info)
+{
+	int i;
+	int timing_idx;
+
+	timing_idx = 0;
+
+	for (i = 0; i < 4; ++i)
+	{
+		int index = 0x36 + i * 18;
+
+		if (edid[index + 0] == 0x00 && edid[index + 1] == 0x00)
+		{
+			decode_display_descriptor(edid + index, info);
+		}
+		else
+		{
+			decode_detailed_timing(edid + index, &(info->detailed_timings[timing_idx++]));
+		}
+	}
+
+	info->n_detailed_timings = timing_idx;
+
+	return TRUE;
+}
+
+static void decode_check_sum(const uchar* edid, MonitorInfo* info)
+{
+	int i;
+	uchar check = 0;
+
+	for (i = 0; i < 128; ++i)
+	{
+		check += edid[i];
+	}
+
+	info->checksum = check;
+}
+
+MonitorInfo* decode_edid(const uchar* edid)
+{
+	MonitorInfo* info = g_new0(MonitorInfo, 1);
+
+	decode_check_sum(edid, info);
+
+	if (decode_header(edid) && decode_vendor_and_product_identification(edid, info) && decode_edid_version(edid, info) && decode_display_parameters(edid, info) && decode_color_characteristics(edid, info) && decode_established_timings(edid, info) && decode_standard_timings(edid, info) && decode_descriptors(edid, info))
+	{
+		return info;
+	}
+	else
+	{
+		g_free(info);
+		return NULL;
+	}
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/65.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/65.html new file mode 100644 index 00000000..b2235e9d --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/65.html @@ -0,0 +1,1769 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
/* mate-bg-crossfade.h - fade window background between two surfaces
+ *
+ * Copyright (C) 2008 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * Author: Ray Strode <rstrode@redhat.com>
+*/
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <math.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdarg.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gdk/gdk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <X11/Xlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <X11/Xatom.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <cairo.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <cairo-xlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define MATE_DESKTOP_USE_UNSTABLE_API
+#include <mate-bg.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "mate-bg-crossfade.h"
+
+struct _MateBGCrossfadePrivate
+{
+    GdkWindow       *window;
+    GtkWidget       *widget;
+    int              width;
+    int              height;
+    cairo_surface_t *fading_surface;
+    cairo_surface_t *start_surface;
+    cairo_surface_t *end_surface;
+    gdouble          start_time;
+    gdouble          total_duration;
+    guint            timeout_id;
+    guint            is_first_frame : 1;
+};
+
+enum {
+    PROP_0,
+    PROP_WIDTH,
+    PROP_HEIGHT,
+};
+
+enum {
+    FINISHED,
+    NUMBER_OF_SIGNALS
+};
+
+static guint signals[NUMBER_OF_SIGNALS] = { 0 };
+
+G_DEFINE_TYPE_WITH_PRIVATE (MateBGCrossfade, mate_bg_crossfade, G_TYPE_OBJECT)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
+
+static void
+mate_bg_crossfade_set_property (GObject      *object,
+                                guint         property_id,
+                                const GValue *value,
+                                GParamSpec   *pspec)
+{
+    MateBGCrossfade *fade;
+
+    g_assert (MATE_IS_BG_CROSSFADE (object));
+
+    fade = MATE_BG_CROSSFADE (object);
+
+    switch (property_id)
+    {
+    case PROP_WIDTH:
+        fade->priv->width = g_value_get_int (value);
+        break;
+    case PROP_HEIGHT:
+        fade->priv->height = g_value_get_int (value);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+        break;
+    }
+}
+
+static void
+mate_bg_crossfade_get_property (GObject    *object,
+                                guint       property_id,
+                                GValue     *value,
+                                GParamSpec *pspec)
+{
+    MateBGCrossfade *fade;
+
+    g_assert (MATE_IS_BG_CROSSFADE (object));
+
+    fade = MATE_BG_CROSSFADE (object);
+
+    switch (property_id)
+    {
+    case PROP_WIDTH:
+        g_value_set_int (value, fade->priv->width);
+        break;
+    case PROP_HEIGHT:
+        g_value_set_int (value, fade->priv->height);
+        break;
+
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+        break;
+    }
+}
+
+static void
+mate_bg_crossfade_finalize (GObject *object)
+{
+    MateBGCrossfade *fade;
+
+    fade = MATE_BG_CROSSFADE (object);
+
+    mate_bg_crossfade_stop (fade);
+
+    if (fade->priv->fading_surface != NULL) {
+        cairo_surface_destroy (fade->priv->fading_surface);
+        fade->priv->fading_surface = NULL;
+    }
+
+    if (fade->priv->start_surface != NULL) {
+        cairo_surface_destroy (fade->priv->start_surface);
+        fade->priv->start_surface = NULL;
+    }
+
+    if (fade->priv->end_surface != NULL) {
+        cairo_surface_destroy (fade->priv->end_surface);
+        fade->priv->end_surface = NULL;
+    }
+}
+
+static void
+mate_bg_crossfade_class_init (MateBGCrossfadeClass *fade_class)
+{
+    GObjectClass *gobject_class;
+
+    gobject_class = G_OBJECT_CLASS (fade_class);
+
+    gobject_class->get_property = mate_bg_crossfade_get_property;
+    gobject_class->set_property = mate_bg_crossfade_set_property;
+    gobject_class->finalize = mate_bg_crossfade_finalize;
+
+    /**
+     * MateBGCrossfade:width:
+     *
+     * When a crossfade is running, this is width of the fading
+     * surface.
+     */
+    g_object_class_install_property (gobject_class,
+                                     PROP_WIDTH,
+                                     g_param_spec_int ("width",
+                                     "Window Width",
+                                     "Width of window to fade",
+                                     0, G_MAXINT, 0,
+                                     G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+
+    /**
+     * MateBGCrossfade:height:
+     *
+     * When a crossfade is running, this is height of the fading
+     * surface.
+     */
+    g_object_class_install_property (gobject_class,
+                                     PROP_HEIGHT,
+                                     g_param_spec_int ("height", "Window Height",
+                                     "Height of window to fade on",
+                                     0, G_MAXINT, 0,
+                                     G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+
+    /**
+     * MateBGCrossfade::finished:
+     * @fade: the #MateBGCrossfade that received the signal
+     * @window: the #GdkWindow the crossfade happend on.
+     *
+     * When a crossfade finishes, @window will have a copy
+     * of the end surface as its background, and this signal will
+     * get emitted.
+     */
+    signals[FINISHED] = g_signal_new ("finished",
+                                      G_OBJECT_CLASS_TYPE (gobject_class),
+                                      G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+                                      g_cclosure_marshal_VOID__OBJECT,
+                                      G_TYPE_NONE, 1, G_TYPE_OBJECT);
+}
+
+static void
+mate_bg_crossfade_init (MateBGCrossfade *fade)
+{
+    fade->priv = mate_bg_crossfade_get_instance_private (fade);
+
+    fade->priv->window = NULL;
+    fade->priv->widget = NULL;
+    fade->priv->fading_surface = NULL;
+    fade->priv->start_surface = NULL;
+    fade->priv->end_surface = NULL;
+    fade->priv->timeout_id = 0;
+}
+
+/**
+ * mate_bg_crossfade_new:
+ * @width: The width of the crossfading window
+ * @height: The height of the crossfading window
+ *
+ * Creates a new object to manage crossfading a
+ * window background between two #cairo_surface_ts.
+ *
+ * Return value: the new #MateBGCrossfade
+ **/
+MateBGCrossfade* mate_bg_crossfade_new (int width, int height)
+{
+    GObject* object;
+
+    object = g_object_new(MATE_TYPE_BG_CROSSFADE,
+                          "width", width,
+                          "height", height,
+                          NULL);
+
+    return (MateBGCrossfade*) object;
+}
+
+static cairo_surface_t *
+tile_surface (cairo_surface_t *surface,
+              int              width,
+              int              height)
+{
+    cairo_surface_t *copy;
+    cairo_t *cr;
+
+    if (surface == NULL)
+    {
+        copy = gdk_window_create_similar_surface (gdk_get_default_root_window (),
+                                                  CAIRO_CONTENT_COLOR,
+                                                  width, height);
+    }
+    else
+    {
+        copy = cairo_surface_create_similar (surface,
+                                             cairo_surface_get_content (surface),
+                                             width, height);
+    }
+
+    cr = cairo_create (copy);
+
+    if (surface != NULL)
+    {
+        cairo_pattern_t *pattern;
+        cairo_set_source_surface (cr, surface, 0.0, 0.0);
+        pattern = cairo_get_source (cr);
+        cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
+    }
+    else
+    {
+        static GtkCssProvider *provider = NULL;
+        GtkStyleContext *context;
+        GdkRGBA bg;
+
+        if (provider == NULL)
+              provider = gtk_css_provider_new ();
+
+        context = gtk_style_context_new ();
+        gtk_style_context_add_provider (context,
+                                        GTK_STYLE_PROVIDER (provider),
+                                        GTK_STYLE_PROVIDER_PRIORITY_THEME);
+        gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg);
+        gdk_cairo_set_source_rgba(cr, &bg);
+        g_object_unref (G_OBJECT (context));
+    }
+
+    cairo_paint (cr);
+
+    if (cairo_status (cr) != CAIRO_STATUS_SUCCESS)
+    {
+        cairo_surface_destroy (copy);
+        copy = NULL;
+    }
+
+    cairo_destroy(cr);
+
+    return copy;
+}
+
+/**
+ * mate_bg_crossfade_set_start_surface:
+ * @fade: a #MateBGCrossfade
+ * @surface: The cairo surface to fade from
+ *
+ * Before initiating a crossfade with mate_bg_crossfade_start()
+ * a start and end surface have to be set.  This function sets
+ * the surface shown at the beginning of the crossfade effect.
+ *
+ * Return value: %TRUE if successful, or %FALSE if the surface
+ * could not be copied.
+ **/
+gboolean
+mate_bg_crossfade_set_start_surface (MateBGCrossfade* fade, cairo_surface_t *surface)
+{
+    g_return_val_if_fail (MATE_IS_BG_CROSSFADE (fade), FALSE);
+
+    if (fade->priv->start_surface != NULL)
+    {
+        cairo_surface_destroy (fade->priv->start_surface);
+        fade->priv->start_surface = NULL;
+    }
+
+    fade->priv->start_surface = tile_surface (surface,
+                                              fade->priv->width,
+                                              fade->priv->height);
+
+    return fade->priv->start_surface != NULL;
+}
+
+#if GLIB_CHECK_VERSION(2,61,2)
+static gdouble
+get_current_time (void)
+{
+    const double microseconds_per_second = (double) G_USEC_PER_SEC;
+    gint64 tv;
+
+    tv = g_get_real_time ();
+
+    return (double) (tv / microseconds_per_second);
+}
+#else
+static gdouble
+get_current_time (void)
+{
+    const double microseconds_per_second = (double) G_USEC_PER_SEC;
+    double timestamp;
+    GTimeVal now;
+
+    g_get_current_time (&now);
+
+    timestamp = ((microseconds_per_second * now.tv_sec) + now.tv_usec) /
+                microseconds_per_second;
+
+    return timestamp;
+}
+#endif
+
+/**
+ * mate_bg_crossfade_set_end_surface:
+ * @fade: a #MateBGCrossfade
+ * @surface: The cairo surface to fade to
+ *
+ * Before initiating a crossfade with mate_bg_crossfade_start()
+ * a start and end surface have to be set.  This function sets
+ * the surface shown at the end of the crossfade effect.
+ *
+ * Return value: %TRUE if successful, or %FALSE if the surface
+ * could not be copied.
+ **/
+gboolean
+mate_bg_crossfade_set_end_surface (MateBGCrossfade* fade, cairo_surface_t *surface)
+{
+    g_return_val_if_fail (MATE_IS_BG_CROSSFADE (fade), FALSE);
+
+    if (fade->priv->end_surface != NULL) {
+        cairo_surface_destroy (fade->priv->end_surface);
+        fade->priv->end_surface = NULL;
+    }
+
+    fade->priv->end_surface = tile_surface (surface,
+                                            fade->priv->width,
+                                            fade->priv->height);
+
+    /* Reset timer in case we're called while animating
+     */
+    fade->priv->start_time = get_current_time ();
+    return fade->priv->end_surface != NULL;
+}
+
+static gboolean
+animations_are_disabled (MateBGCrossfade *fade)
+{
+    GtkSettings *settings;
+    GdkScreen *screen;
+    gboolean are_enabled;
+
+    g_assert (fade->priv->window != NULL);
+
+    screen = gdk_window_get_screen(fade->priv->window);
+
+    settings = gtk_settings_get_for_screen (screen);
+
+    g_object_get (settings, "gtk-enable-animations", &are_enabled, NULL);
+
+    return !are_enabled;
+}
+
+static void
+send_root_property_change_notification (MateBGCrossfade *fade)
+{
+        long zero_length_pixmap = 0;
+
+        /* We do a zero length append to force a change notification,
+         * without changing the value */
+        XChangeProperty (GDK_WINDOW_XDISPLAY (fade->priv->window),
+                         GDK_WINDOW_XID (fade->priv->window),
+                         gdk_x11_get_xatom_by_name ("_XROOTPMAP_ID"),
+                         XA_PIXMAP, 32, PropModeAppend,
+                         (unsigned char *) &zero_length_pixmap, 0);
+}
+
+static void
+draw_background (MateBGCrossfade *fade)
+{
+    if (fade->priv->widget != NULL) {
+        gtk_widget_queue_draw (fade->priv->widget);
+    } else if (gdk_window_get_window_type (fade->priv->window) != GDK_WINDOW_ROOT) {
+        cairo_t           *cr;
+        cairo_region_t    *region;
+        GdkDrawingContext *draw_context;
+
+        region = gdk_window_get_visible_region (fade->priv->window);
+        draw_context = gdk_window_begin_draw_frame (fade->priv->window,
+                                                    region);
+        cr = gdk_drawing_context_get_cairo_context (draw_context);
+        cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+        cairo_set_source_surface (cr, fade->priv->fading_surface, 0, 0);
+        cairo_paint (cr);
+        gdk_window_end_draw_frame (fade->priv->window, draw_context);
+        cairo_region_destroy (region);
+    } else {
+        Display *xdisplay = GDK_WINDOW_XDISPLAY (fade->priv->window);
+        GdkDisplay *display;
+        display = gdk_display_get_default ();
+        gdk_x11_display_error_trap_push (display);
+        XGrabServer (xdisplay);
+        XClearWindow (xdisplay, GDK_WINDOW_XID (fade->priv->window));
+        send_root_property_change_notification (fade);
+        XFlush (xdisplay);
+        XUngrabServer (xdisplay);
+        gdk_x11_display_error_trap_pop_ignored (display);
+    }
+}
+
+static gboolean
+on_widget_draw (GtkWidget       *widget,
+                cairo_t         *cr,
+                MateBGCrossfade *fade)
+{
+    g_assert (fade->priv->fading_surface != NULL);
+
+    cairo_set_source_surface (cr, fade->priv->fading_surface, 0, 0);
+    cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
+    cairo_paint (cr);
+
+    return FALSE;
+}
+
+static gboolean
+on_tick (MateBGCrossfade *fade)
+{
+    gdouble now, percent_done;
+    cairo_t *cr;
+    cairo_status_t status;
+
+    g_return_val_if_fail (MATE_IS_BG_CROSSFADE (fade), FALSE);
+
+    now = get_current_time ();
+
+    percent_done = (now - fade->priv->start_time) / fade->priv->total_duration;
+    percent_done = CLAMP (percent_done, 0.0, 1.0);
+
+    /* If it's taking a long time to get to the first frame,
+     * then lengthen the duration, so the user will get to see
+     * the effect.
+     */
+    if (fade->priv->is_first_frame && percent_done > .33) {
+        fade->priv->is_first_frame = FALSE;
+        fade->priv->total_duration *= 1.5;
+        return on_tick (fade);
+    }
+
+    if (fade->priv->fading_surface == NULL ||
+        fade->priv->end_surface == NULL) {
+        return FALSE;
+    }
+
+    if (animations_are_disabled (fade)) {
+        return FALSE;
+    }
+
+    /* We accumulate the results in place for performance reasons.
+     *
+     * This means 1) The fade is exponential, not linear (looks good!)
+     * 2) The rate of fade is not independent of frame rate. Slower machines
+     * will get a slower fade (but never longer than .75 seconds), and
+     * even the fastest machines will get *some* fade because the framerate
+     * is capped.
+     */
+    cr = cairo_create (fade->priv->fading_surface);
+
+    cairo_set_source_surface (cr, fade->priv->end_surface,
+                              0.0, 0.0);
+    cairo_paint_with_alpha (cr, percent_done);
+
+    status = cairo_status (cr);
+    cairo_destroy (cr);
+
+    if (status == CAIRO_STATUS_SUCCESS) {
+        draw_background (fade);
+    }
+    return percent_done <= .99;
+}
+
+static void
+on_finished (MateBGCrossfade *fade)
+{
+    cairo_t *cr;
+
+    if (fade->priv->timeout_id == 0)
+        return;
+
+    g_assert (fade->priv->fading_surface != NULL);
+    g_assert (fade->priv->end_surface != NULL);
+
+    cr = cairo_create (fade->priv->fading_surface);
+    cairo_set_source_surface (cr, fade->priv->end_surface, 0, 0);
+    cairo_paint (cr);
+    cairo_destroy (cr);
+    draw_background (fade);
+
+    cairo_surface_destroy (fade->priv->fading_surface);
+    fade->priv->fading_surface = NULL;
+
+    cairo_surface_destroy (fade->priv->end_surface);
+    fade->priv->end_surface = NULL;
+
+    g_assert (fade->priv->start_surface != NULL);
+
+    cairo_surface_destroy (fade->priv->start_surface);
+    fade->priv->start_surface = NULL;
+
+    if (fade->priv->widget != NULL) {
+        g_signal_handlers_disconnect_by_func (fade->priv->widget,
+                                              (GCallback) on_widget_draw,
+                                              fade);
+    }
+    fade->priv->widget = NULL;
+
+    fade->priv->timeout_id = 0;
+    g_signal_emit (fade, signals[FINISHED], 0, fade->priv->window);
+}
+
+/* This function queries the _XROOTPMAP_ID property from the root window
+ * to determine the current root window background pixmap and returns a
+ * surface to draw directly to it.
+ * If _XROOTPMAP_ID is not set, then NULL returned.
+ */
+static cairo_surface_t *
+get_root_pixmap_id_surface (GdkDisplay *display)
+{
+    GdkScreen       *screen;
+    Display         *xdisplay;
+    Visual          *xvisual;
+    Window           xroot;
+    Atom             type;
+    int              format, result;
+    unsigned long    nitems, bytes_after;
+    unsigned char   *data;
+    cairo_surface_t *surface = NULL;
+
+    g_return_val_if_fail (display != NULL, NULL);
+
+    screen   = gdk_display_get_default_screen (display);
+    xdisplay = GDK_DISPLAY_XDISPLAY (display);
+    xvisual  = GDK_VISUAL_XVISUAL (gdk_screen_get_system_visual (screen));
+    xroot    = RootWindow (xdisplay, GDK_SCREEN_XNUMBER (screen));
+
+    result = XGetWindowProperty (xdisplay, xroot,
+                                 gdk_x11_get_xatom_by_name ("_XROOTPMAP_ID"),
+                                 0L, 1L, False, XA_PIXMAP,
+                                 &type, &format, &nitems, &bytes_after,
+                                 &data);
+
+    if (result != Success || type != XA_PIXMAP ||
+        format != 32 || nitems != 1) {
+        XFree (data);
+        data = NULL;
+    }
+
+    if (data != NULL) {
+        Pixmap pixmap = *(Pixmap *) data;
+        Window root_ret;
+        int x_ret, y_ret;
+        unsigned int w_ret, h_ret, bw_ret, depth_ret;
+
+        gdk_x11_display_error_trap_push (display);
+        if (XGetGeometry (xdisplay, pixmap, &root_ret,
+                          &x_ret, &y_ret, &w_ret, &h_ret,
+                          &bw_ret, &depth_ret))
+        {
+            surface = cairo_xlib_surface_create (xdisplay,
+                                                 pixmap, xvisual,
+                                                 w_ret, h_ret);
+        }
+
+        gdk_x11_display_error_trap_pop_ignored (display);
+        XFree (data);
+    }
+
+    gdk_display_flush (display);
+    return surface;
+}
+
+/**
+ * mate_bg_crossfade_start:
+ * @fade: a #MateBGCrossfade
+ * @window: The #GdkWindow to draw crossfade on
+ *
+ * This function initiates a quick crossfade between two surfaces on
+ * the background of @window. Before initiating the crossfade both
+ * mate_bg_crossfade_set_start_surface() and
+ * mate_bg_crossfade_set_end_surface() need to be called. If animations
+ * are disabled, the crossfade is skipped, and the window background is
+ * set immediately to the end surface.
+ **/
+void
+mate_bg_crossfade_start (MateBGCrossfade *fade,
+                         GdkWindow       *window)
+{
+    GSource *source;
+    GMainContext *context;
+
+    g_return_if_fail (MATE_IS_BG_CROSSFADE (fade));
+    g_return_if_fail (window != NULL);
+    g_return_if_fail (fade->priv->start_surface != NULL);
+    g_return_if_fail (fade->priv->end_surface != NULL);
+    g_return_if_fail (!mate_bg_crossfade_is_started (fade));
+    g_return_if_fail (gdk_window_get_window_type (window) != GDK_WINDOW_FOREIGN);
+
+    /* If drawing is done on the root window,
+     * it is essential to have the root pixmap.
+     */
+    if (gdk_window_get_window_type (window) == GDK_WINDOW_ROOT) {
+        GdkDisplay *display = gdk_window_get_display (window);
+        cairo_surface_t *surface = get_root_pixmap_id_surface (display);
+
+        g_return_if_fail (surface != NULL);
+        cairo_surface_destroy (surface);
+    }
+
+    if (fade->priv->fading_surface != NULL) {
+        cairo_surface_destroy (fade->priv->fading_surface);
+        fade->priv->fading_surface = NULL;
+    }
+
+    fade->priv->window = window;
+    if (gdk_window_get_window_type (fade->priv->window) != GDK_WINDOW_ROOT) {
+        fade->priv->fading_surface = tile_surface (fade->priv->start_surface,
+                                                   fade->priv->width,
+                                                   fade->priv->height);
+        if (fade->priv->widget != NULL) {
+            g_signal_connect (fade->priv->widget, "draw",
+                              (GCallback) on_widget_draw, fade);
+        }
+    } else {
+        cairo_t   *cr;
+        GdkDisplay *display = gdk_window_get_display (fade->priv->window);
+
+        fade->priv->fading_surface = get_root_pixmap_id_surface (display);
+        cr = cairo_create (fade->priv->fading_surface);
+        cairo_set_source_surface (cr, fade->priv->start_surface, 0, 0);
+        cairo_paint (cr);
+        cairo_destroy (cr);
+    }
+    draw_background (fade);
+
+    source = g_timeout_source_new (1000 / 60.0);
+    g_source_set_callback (source,
+                           (GSourceFunc) on_tick,
+                           fade,
+                           (GDestroyNotify) on_finished);
+    context = g_main_context_default ();
+    fade->priv->timeout_id = g_source_attach (source, context);
+    g_source_unref (source);
+
+    fade->priv->is_first_frame = TRUE;
+    fade->priv->total_duration = .75;
+    fade->priv->start_time = get_current_time ();
+}
+
+/**
+ * mate_bg_crossfade_start_widget:
+ * @fade: a #MateBGCrossfade
+ * @widget: The #GtkWidget to draw crossfade on
+ *
+ * This function initiates a quick crossfade between two surfaces on
+ * the background of @widget. Before initiating the crossfade both
+ * mate_bg_crossfade_set_start_surface() and
+ * mate_bg_crossfade_set_end_surface() need to be called. If animations
+ * are disabled, the crossfade is skipped, and the window background is
+ * set immediately to the end surface.
+ **/
+void
+mate_bg_crossfade_start_widget (MateBGCrossfade *fade,
+                                GtkWidget       *widget)
+{
+    GdkWindow *window;
+
+    g_return_if_fail (MATE_IS_BG_CROSSFADE (fade));
+    g_return_if_fail (widget != NULL);
+
+    fade->priv->widget = widget;
+    gtk_widget_realize (fade->priv->widget);
+    window = gtk_widget_get_window (fade->priv->widget);
+
+    mate_bg_crossfade_start (fade, window);
+}
+
+/**
+ * mate_bg_crossfade_is_started:
+ * @fade: a #MateBGCrossfade
+ *
+ * This function reveals whether or not @fade is currently
+ * running on a window.  See mate_bg_crossfade_start() for
+ * information on how to initiate a crossfade.
+ *
+ * Return value: %TRUE if fading, or %FALSE if not fading
+ **/
+gboolean
+mate_bg_crossfade_is_started (MateBGCrossfade *fade)
+{
+    g_return_val_if_fail (MATE_IS_BG_CROSSFADE (fade), FALSE);
+
+    return fade->priv->timeout_id != 0;
+}
+
+/**
+ * mate_bg_crossfade_stop:
+ * @fade: a #MateBGCrossfade
+ *
+ * This function stops any in progress crossfades that may be
+ * happening.  It's harmless to call this function if @fade is
+ * already stopped.
+ **/
+void
+mate_bg_crossfade_stop (MateBGCrossfade *fade)
+{
+    g_return_if_fail (MATE_IS_BG_CROSSFADE (fade));
+
+    if (!mate_bg_crossfade_is_started (fade))
+        return;
+
+    g_assert (fade->priv->timeout_id != 0);
+    g_source_remove (fade->priv->timeout_id);
+    fade->priv->timeout_id = 0;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/66.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/66.html new file mode 100644 index 00000000..d899cbb1 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/66.html @@ -0,0 +1,397 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
/* mate-bg-crossfade.h - fade window background between two pixmaps
+
+   Copyright 2008, Red Hat, Inc.
+
+   This file is part of the Mate Library.
+
+   The Mate Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Mate 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Mate Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+   Floor, Boston, MA 02110-1301 US.
+
+   Author: Ray Strode <rstrode@redhat.com>
+*/
+
+#ifndef __MATE_BG_CROSSFADE_H__
+#define __MATE_BG_CROSSFADE_H__
+
+#ifndef MATE_DESKTOP_USE_UNSTABLE_API
+#error    MateBGCrossfade is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including mate-bg-crossfade.h
+#endif
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define MATE_TYPE_BG_CROSSFADE            (mate_bg_crossfade_get_type ())
+#define MATE_BG_CROSSFADE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_BG_CROSSFADE, MateBGCrossfade))
+#define MATE_BG_CROSSFADE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  MATE_TYPE_BG_CROSSFADE, MateBGCrossfadeClass))
+#define MATE_IS_BG_CROSSFADE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_BG_CROSSFADE))
+#define MATE_IS_BG_CROSSFADE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  MATE_TYPE_BG_CROSSFADE))
+#define MATE_BG_CROSSFADE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  MATE_TYPE_BG_CROSSFADE, MateBGCrossfadeClass))
+
+typedef struct _MateBGCrossfadePrivate MateBGCrossfadePrivate;
+typedef struct _MateBGCrossfade MateBGCrossfade;
+typedef struct _MateBGCrossfadeClass MateBGCrossfadeClass;
+
+struct _MateBGCrossfade
+{
+    GObject parent_object;
+
+    MateBGCrossfadePrivate *priv;
+};
+
+struct _MateBGCrossfadeClass
+{
+    GObjectClass parent_class;
+
+    void (* finished) (MateBGCrossfade *fade, GdkWindow *window);
+};
+
+GType             mate_bg_crossfade_get_type (void);
+MateBGCrossfade   *mate_bg_crossfade_new (int width, int height);
+
+gboolean          mate_bg_crossfade_set_start_surface (MateBGCrossfade *fade,
+                                                       cairo_surface_t *surface);
+gboolean          mate_bg_crossfade_set_end_surface (MateBGCrossfade *fade,
+                                                     cairo_surface_t *surface);
+
+void              mate_bg_crossfade_start (MateBGCrossfade *fade,
+                                           GdkWindow        *window);
+void              mate_bg_crossfade_start_widget (MateBGCrossfade *fade,
+                                                  GtkWidget       *widget);
+gboolean          mate_bg_crossfade_is_started (MateBGCrossfade *fade);
+void              mate_bg_crossfade_stop (MateBGCrossfade *fade);
+
+G_END_DECLS
+
+#endif
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/67.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/67.html new file mode 100644 index 00000000..ecf78ca7 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/67.html @@ -0,0 +1,6753 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+1545
+1546
+1547
+1548
+1549
+1550
+1551
+1552
+1553
+1554
+1555
+1556
+1557
+1558
+1559
+1560
+1561
+1562
+1563
+1564
+1565
+1566
+1567
+1568
+1569
+1570
+1571
+1572
+1573
+1574
+1575
+1576
+1577
+1578
+1579
+1580
+1581
+1582
+1583
+1584
+1585
+1586
+1587
+1588
+1589
+1590
+1591
+1592
+1593
+1594
+1595
+1596
+1597
+1598
+1599
+1600
+1601
+1602
+1603
+1604
+1605
+1606
+1607
+1608
+1609
+1610
+1611
+1612
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+1631
+1632
+1633
+1634
+1635
+1636
+1637
+1638
+1639
+1640
+1641
+1642
+1643
+1644
+1645
+1646
+1647
+1648
+1649
+1650
+1651
+1652
+1653
+1654
+1655
+1656
+1657
+1658
+1659
+1660
+1661
+1662
+1663
+1664
+1665
+1666
+1667
+1668
+1669
+1670
+1671
+1672
+1673
+1674
+1675
+1676
+1677
+1678
+1679
+1680
+1681
+1682
+1683
+1684
+1685
+1686
+1687
+1688
+1689
+1690
+1691
+1692
+1693
+1694
+1695
+1696
+1697
+1698
+1699
+1700
+1701
+1702
+1703
+1704
+1705
+1706
+1707
+1708
+1709
+1710
+1711
+1712
+1713
+1714
+1715
+1716
+1717
+1718
+1719
+1720
+1721
+1722
+1723
+1724
+1725
+1726
+1727
+1728
+1729
+1730
+1731
+1732
+1733
+1734
+1735
+1736
+1737
+1738
+1739
+1740
+1741
+1742
+1743
+1744
+1745
+1746
+1747
+1748
+1749
+1750
+1751
+1752
+1753
+1754
+1755
+1756
+1757
+1758
+1759
+1760
+1761
+1762
+1763
+1764
+1765
+1766
+1767
+1768
+1769
+1770
+1771
+1772
+1773
+1774
+1775
+1776
+1777
+1778
+1779
+1780
+1781
+1782
+1783
+1784
+1785
+1786
+1787
+1788
+1789
+1790
+1791
+1792
+1793
+1794
+1795
+1796
+1797
+1798
+1799
+1800
+1801
+1802
+1803
+1804
+1805
+1806
+1807
+1808
+1809
+1810
+1811
+1812
+1813
+1814
+1815
+1816
+1817
+1818
+1819
+1820
+1821
+1822
+1823
+1824
+1825
+1826
+1827
+1828
+1829
+1830
+1831
+1832
+1833
+1834
+1835
+1836
+1837
+1838
+1839
+1840
+1841
+1842
+1843
+1844
+1845
+1846
+1847
+1848
+1849
+1850
+1851
+1852
+1853
+1854
+1855
+1856
+1857
+1858
+1859
+1860
+1861
+1862
+1863
+1864
+1865
+1866
+1867
+1868
+1869
+1870
+1871
+1872
+1873
+1874
+1875
+1876
+1877
+1878
+1879
+1880
+1881
+1882
+1883
+1884
+1885
+1886
+1887
+1888
+1889
+1890
+1891
+1892
+1893
+1894
+1895
+1896
+1897
+1898
+1899
+1900
+1901
+1902
+1903
+1904
+1905
+1906
+1907
+1908
+1909
+1910
+1911
+1912
+1913
+1914
+1915
+1916
+1917
+1918
+1919
+1920
+1921
+1922
+1923
+1924
+1925
+1926
+1927
+1928
+1929
+1930
+1931
+1932
+1933
+1934
+1935
+1936
+1937
+1938
+1939
+1940
+1941
+1942
+1943
+1944
+1945
+1946
+1947
+1948
+1949
+1950
+1951
+1952
+1953
+1954
+1955
+1956
+1957
+1958
+1959
+1960
+1961
+1962
+1963
+1964
+1965
+1966
+1967
+1968
+1969
+1970
+1971
+1972
+1973
+1974
+1975
+1976
+1977
+1978
+1979
+1980
+1981
+1982
+1983
+1984
+1985
+1986
+1987
+1988
+1989
+1990
+1991
+1992
+1993
+1994
+1995
+1996
+1997
+1998
+1999
+2000
+2001
+2002
+2003
+2004
+2005
+2006
+2007
+2008
+2009
+2010
+2011
+2012
+2013
+2014
+2015
+2016
+2017
+2018
+2019
+2020
+2021
+2022
+2023
+2024
+2025
+2026
+2027
+2028
+2029
+2030
+2031
+2032
+2033
+2034
+2035
+2036
+2037
+2038
+2039
+2040
+2041
+2042
+2043
+2044
+2045
+2046
+2047
+2048
+2049
+2050
+2051
+2052
+2053
+2054
+2055
+2056
+2057
+2058
+2059
+2060
+2061
+2062
+2063
+2064
+2065
+2066
+2067
+2068
+2069
+2070
+2071
+2072
+2073
+2074
+2075
+2076
+2077
+2078
+2079
+2080
+2081
+2082
+2083
+2084
+2085
+2086
+2087
+2088
+2089
+2090
+2091
+2092
+2093
+2094
+2095
+2096
+2097
+2098
+2099
+2100
+2101
+2102
+2103
+2104
+2105
+2106
+2107
+2108
+2109
+2110
+2111
+2112
+2113
+2114
+2115
+2116
+2117
+2118
+2119
+2120
+2121
+2122
+2123
+2124
+2125
+2126
+2127
+2128
+2129
+2130
+2131
+2132
+2133
+2134
+2135
+2136
+2137
+2138
+2139
+2140
+2141
+2142
+2143
+2144
+2145
+2146
+2147
+2148
+2149
+2150
+2151
+2152
+2153
+2154
+2155
+2156
+2157
+2158
+2159
+2160
+2161
+2162
+2163
+2164
+2165
+2166
+2167
+2168
+2169
+2170
+2171
+2172
+2173
+2174
+2175
+2176
+2177
+2178
+2179
+2180
+2181
+2182
+2183
+2184
+2185
+2186
+2187
+2188
+2189
+2190
+2191
+2192
+2193
+2194
+2195
+2196
+2197
+2198
+2199
+2200
+2201
+2202
+2203
+2204
+2205
+2206
+2207
+2208
+2209
+2210
+2211
+2212
+2213
+2214
+2215
+2216
+2217
+2218
+2219
+2220
+2221
+2222
+2223
+2224
+2225
+2226
+2227
+2228
+2229
+2230
+2231
+2232
+2233
+2234
+2235
+2236
+2237
+2238
+2239
+2240
+2241
+2242
+2243
+2244
+2245
+2246
+2247
+2248
+2249
+2250
+2251
+2252
+2253
+2254
+2255
+2256
+2257
+2258
+2259
+2260
+2261
+2262
+2263
+2264
+2265
+2266
+2267
+2268
+2269
+2270
+2271
+2272
+2273
+2274
+2275
+2276
+2277
+2278
+2279
+2280
+2281
+2282
+2283
+2284
+2285
+2286
+2287
+2288
+2289
+2290
+2291
+2292
+2293
+2294
+2295
+2296
+2297
+2298
+2299
+2300
+2301
+2302
+2303
+2304
+2305
+2306
+2307
+2308
+2309
+2310
+2311
+2312
+2313
+2314
+2315
+2316
+2317
+2318
+2319
+2320
+2321
+2322
+2323
+2324
+2325
+2326
+2327
+2328
+2329
+2330
+2331
+2332
+2333
+2334
+2335
+2336
+2337
+2338
+2339
+2340
+2341
+2342
+2343
+2344
+2345
+2346
+2347
+2348
+2349
+2350
+2351
+2352
+2353
+2354
+2355
+2356
+2357
+2358
+2359
+2360
+2361
+2362
+2363
+2364
+2365
+2366
+2367
+2368
+2369
+2370
+2371
+2372
+2373
+2374
+2375
+2376
+2377
+2378
+2379
+2380
+2381
+2382
+2383
+2384
+2385
+2386
+2387
+2388
+2389
+2390
+2391
+2392
+2393
+2394
+2395
+2396
+2397
+2398
+2399
+2400
+2401
+2402
+2403
+2404
+2405
+2406
+2407
+2408
+2409
+2410
+2411
+2412
+2413
+2414
+2415
+2416
+2417
+2418
+2419
+2420
+2421
+2422
+2423
+2424
+2425
+2426
+2427
+2428
+2429
+2430
+2431
+2432
+2433
+2434
+2435
+2436
+2437
+2438
+2439
+2440
+2441
+2442
+2443
+2444
+2445
+2446
+2447
+2448
+2449
+2450
+2451
+2452
+2453
+2454
+2455
+2456
+2457
+2458
+2459
+2460
+2461
+2462
+2463
+2464
+2465
+2466
+2467
+2468
+2469
+2470
+2471
+2472
+2473
+2474
+2475
+2476
+2477
+2478
+2479
+2480
+2481
+2482
+2483
+2484
+2485
+2486
+2487
+2488
+2489
+2490
+2491
+2492
+2493
+2494
+2495
+2496
+2497
+2498
+2499
+2500
+2501
+2502
+2503
+2504
+2505
+2506
+2507
+2508
+2509
+2510
+2511
+2512
+2513
+2514
+2515
+2516
+2517
+2518
+2519
+2520
+2521
+2522
+2523
+2524
+2525
+2526
+2527
+2528
+2529
+2530
+2531
+2532
+2533
+2534
+2535
+2536
+2537
+2538
+2539
+2540
+2541
+2542
+2543
+2544
+2545
+2546
+2547
+2548
+2549
+2550
+2551
+2552
+2553
+2554
+2555
+2556
+2557
+2558
+2559
+2560
+2561
+2562
+2563
+2564
+2565
+2566
+2567
+2568
+2569
+2570
+2571
+2572
+2573
+2574
+2575
+2576
+2577
+2578
+2579
+2580
+2581
+2582
+2583
+2584
+2585
+2586
+2587
+2588
+2589
+2590
+2591
+2592
+2593
+2594
+2595
+2596
+2597
+2598
+2599
+2600
+2601
+2602
+2603
+2604
+2605
+2606
+2607
+2608
+2609
+2610
+2611
+2612
+2613
+2614
+2615
+2616
+2617
+2618
+2619
+2620
+2621
+2622
+2623
+2624
+2625
+2626
+2627
+2628
+2629
+2630
+2631
+2632
+2633
+2634
+2635
+2636
+2637
+2638
+2639
+2640
+2641
+2642
+2643
+2644
+2645
+2646
+2647
+2648
+2649
+2650
+2651
+2652
+2653
+2654
+2655
+2656
+2657
+2658
+2659
+2660
+2661
+2662
+2663
+2664
+2665
+2666
+2667
+2668
+2669
+2670
+2671
+2672
+2673
+2674
+2675
+2676
+2677
+2678
+2679
+2680
+2681
+2682
+2683
+2684
+2685
+2686
+2687
+2688
+2689
+2690
+2691
+2692
+2693
+2694
+2695
+2696
+2697
+2698
+2699
+2700
+2701
+2702
+2703
+2704
+2705
+2706
+2707
+2708
+2709
+2710
+2711
+2712
+2713
+2714
+2715
+2716
+2717
+2718
+2719
+2720
+2721
+2722
+2723
+2724
+2725
+2726
+2727
+2728
+2729
+2730
+2731
+2732
+2733
+2734
+2735
+2736
+2737
+2738
+2739
+2740
+2741
+2742
+2743
+2744
+2745
+2746
+2747
+2748
+2749
+2750
+2751
+2752
+2753
+2754
+2755
+2756
+2757
+2758
+2759
+2760
+2761
+2762
+2763
+2764
+2765
+2766
+2767
+2768
+2769
+2770
+2771
+2772
+2773
+2774
+2775
+2776
+2777
+2778
+2779
+2780
+2781
+2782
+2783
+2784
+2785
+2786
+2787
+2788
+2789
+2790
+2791
+2792
+2793
+2794
+2795
+2796
+2797
+2798
+2799
+2800
+2801
+2802
+2803
+2804
+2805
+2806
+2807
+2808
+2809
+2810
+2811
+2812
+2813
+2814
+2815
+2816
+2817
+2818
+2819
+2820
+2821
+2822
+2823
+2824
+2825
+2826
+2827
+2828
+2829
+2830
+2831
+2832
+2833
+2834
+2835
+2836
+2837
+2838
+2839
+2840
+2841
+2842
+2843
+2844
+2845
+2846
+2847
+2848
+2849
+2850
+2851
+2852
+2853
+2854
+2855
+2856
+2857
+2858
+2859
+2860
+2861
+2862
+2863
+2864
+2865
+2866
+2867
+2868
+2869
+2870
+2871
+2872
+2873
+2874
+2875
+2876
+2877
+2878
+2879
+2880
+2881
+2882
+2883
+2884
+2885
+2886
+2887
+2888
+2889
+2890
+2891
+2892
+2893
+2894
+2895
+2896
+2897
+2898
+2899
+2900
+2901
+2902
+2903
+2904
+2905
+2906
+2907
+2908
+2909
+2910
+2911
+2912
+2913
+2914
+2915
+2916
+2917
+2918
+2919
+2920
+2921
+2922
+2923
+2924
+2925
+2926
+2927
+2928
+2929
+2930
+2931
+2932
+2933
+2934
+2935
+2936
+2937
+2938
+2939
+2940
+2941
+2942
+2943
+2944
+2945
+2946
+2947
+2948
+2949
+2950
+2951
+2952
+2953
+2954
+2955
+2956
+2957
+2958
+2959
+2960
+2961
+2962
+2963
+2964
+2965
+2966
+2967
+2968
+2969
+2970
+2971
+2972
+2973
+2974
+2975
+2976
+2977
+2978
+2979
+2980
+2981
+2982
+2983
+2984
+2985
+2986
+2987
+2988
+2989
+2990
+2991
+2992
+2993
+2994
+2995
+2996
+2997
+2998
+2999
+3000
+3001
+3002
+3003
+3004
+3005
+3006
+3007
+3008
+3009
+3010
+3011
+3012
+3013
+3014
+3015
+3016
+3017
+3018
+3019
+3020
+3021
+3022
+3023
+3024
+3025
+3026
+3027
+3028
+3029
+3030
+3031
+3032
+3033
+3034
+3035
+3036
+3037
+3038
+3039
+3040
+3041
+3042
+3043
+3044
+3045
+3046
+3047
+3048
+3049
+3050
+3051
+3052
+3053
+3054
+3055
+3056
+3057
+3058
+3059
+3060
+3061
+3062
+3063
+3064
+3065
+3066
+3067
+3068
+3069
+3070
+3071
+3072
+3073
+3074
+3075
+3076
+3077
+3078
+3079
+3080
+3081
+3082
+3083
+3084
+3085
+3086
+3087
+3088
+3089
+3090
+3091
+3092
+3093
+3094
+3095
+3096
+3097
+3098
+3099
+3100
+3101
+3102
+3103
+3104
+3105
+3106
+3107
+3108
+3109
+3110
+3111
+3112
+3113
+3114
+3115
+3116
+3117
+3118
+3119
+3120
+3121
+3122
+3123
+3124
+3125
+3126
+3127
+3128
+3129
+3130
+3131
+3132
+3133
+3134
+3135
+3136
+3137
+3138
+3139
+3140
+3141
+3142
+3143
+3144
+3145
+3146
+3147
+3148
+3149
+3150
+3151
+3152
+3153
+3154
+3155
+3156
+3157
+3158
+3159
+3160
+3161
+3162
+3163
+3164
+3165
+3166
+3167
+3168
+3169
+3170
+3171
+3172
+3173
+3174
+3175
+3176
+3177
+3178
+3179
+3180
+3181
+3182
+3183
+3184
+3185
+3186
+3187
+3188
+3189
+3190
+3191
+3192
+3193
+3194
+3195
+3196
+3197
+3198
+3199
+3200
+3201
+3202
+3203
+3204
+3205
+3206
+3207
+3208
+3209
+3210
+3211
+3212
+3213
+3214
+3215
+3216
+3217
+3218
+3219
+3220
+3221
+3222
+3223
+3224
+3225
+3226
+3227
+3228
+3229
+3230
+3231
+3232
+3233
+3234
+3235
+3236
+3237
+3238
+3239
+3240
+3241
+3242
+3243
+3244
+3245
+3246
+3247
+3248
+3249
+3250
+3251
+3252
+3253
+3254
+3255
+3256
+3257
+3258
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+matebg.c: Object for the desktop background.
+
+Copyright (C) 2000 Eazel, Inc.
+Copyright (C) 2007-2008 Red Hat, Inc.
+Copyright (C) 2012 Jasmine Hassan <jasmine.aura@gmail.com>
+Copyright (C) 2012-2021 MATE Developers
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this program; if not, write to the
+Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+Boston, MA 02110-1301, USA.
+
+Derived from eel-background.c and eel-gdk-pixbuf-extensions.c by
+Darin Adler <darin@eazel.com> and Ramiro Estrugo <ramiro@eazel.com>
+
+Authors: Soren Sandmann <sandmann@redhat.com>
+	 Jasmine Hassan <jasmine.aura@gmail.com>
+
+*/
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <math.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdarg.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib/gstdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <X11/Xlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <X11/Xatom.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <cairo.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define MATE_DESKTOP_USE_UNSTABLE_API
+#include <mate-bg.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-bg-crossfade.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+# include <cairo-xlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define MATE_BG_CACHE_DIR "mate/background"
+
+/* We keep the large pixbufs around if the next update
+   in the slideshow is less than 60 seconds away */
+#define KEEP_EXPENSIVE_CACHE_SECS 60
+
+typedef struct _SlideShow SlideShow;
+typedef struct _Slide Slide;
+
+struct _Slide {
+	double duration; /* in seconds */
+	gboolean fixed;
+
+	GSList* file1;
+	GSList* file2; /* NULL if fixed is TRUE */
+};
+
+typedef struct _FileSize FileSize;
+struct _FileSize {
+	gint width;
+	gint height;
+
+	char* file;
+};
+
+#define THUMBNAIL_SIZE 256
+
+typedef struct FileCacheEntry FileCacheEntry;
+#define CACHE_SIZE 4
+
+/*
+ *   Implementation of the MateBG class
+ */
+struct _MateBG {
+	GObject		 parent_instance;
+	char		*filename;
+	MateBGPlacement	 placement;
+	MateBGColorType	 color_type;
+	GdkRGBA	 	 primary;
+	GdkRGBA	 	 secondary;
+	gboolean	 is_enabled;
+
+	GFileMonitor* file_monitor;
+
+	guint changed_id;
+	guint transitioned_id;
+	guint blow_caches_id;
+
+	/* Cached information, only access through cache accessor functions */
+	SlideShow* slideshow;
+	gint64 file_mtime;
+	GdkPixbuf* pixbuf_cache;
+	int timeout_id;
+
+	GList* file_cache;
+};
+
+struct _MateBGClass {
+	GObjectClass parent_class;
+};
+
+enum {
+	CHANGED,
+	TRANSITIONED,
+	N_SIGNALS
+};
+
+static guint signals[N_SIGNALS] = {0};
+
+G_DEFINE_TYPE(MateBG, mate_bg, G_TYPE_OBJECT)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
+
+static cairo_surface_t *make_root_pixmap     (GdkWindow  *window,
+                                              gint        width,
+                                              gint        height);
+
+/* Pixbuf utils */
+static void       pixbuf_average_value (GdkPixbuf  *pixbuf,
+                                        GdkRGBA    *result);
+static GdkPixbuf *pixbuf_scale_to_fit  (GdkPixbuf  *src,
+					int         max_width,
+					int         max_height);
+static GdkPixbuf *pixbuf_scale_to_min  (GdkPixbuf  *src,
+					int         min_width,
+					int         min_height);
+
+static void       pixbuf_draw_gradient (GdkPixbuf    *pixbuf,
+					gboolean      horizontal,
+					GdkRGBA     *c1,
+					GdkRGBA     *c2,
+					GdkRectangle *rect);
+
+static void       pixbuf_tile          (GdkPixbuf  *src,
+					GdkPixbuf  *dest);
+static void       pixbuf_blend         (GdkPixbuf  *src,
+					GdkPixbuf  *dest,
+					int         src_x,
+					int         src_y,
+					int         width,
+					int         height,
+					int         dest_x,
+					int         dest_y,
+					double      alpha);
+
+/* Thumbnail utilities */
+static GdkPixbuf *create_thumbnail_for_filename (MateDesktopThumbnailFactory *factory,
+						 const char            *filename);
+static gboolean   get_thumb_annotations (GdkPixbuf             *thumb,
+					 int                   *orig_width,
+					 int                   *orig_height);
+
+/* Cache */
+static GdkPixbuf *get_pixbuf_for_size  (MateBG               *bg,
+					gint                  num_monitor,
+					int                   width,
+					int                   height);
+static void       clear_cache          (MateBG               *bg);
+static gboolean   is_different         (MateBG               *bg,
+					const char            *filename);
+static gint64     get_mtime            (const char            *filename);
+static GdkPixbuf *create_img_thumbnail (MateBG               *bg,
+					MateDesktopThumbnailFactory *factory,
+					GdkScreen             *screen,
+					int                    dest_width,
+					int                    dest_height,
+					int		       frame_num);
+static SlideShow * get_as_slideshow    (MateBG               *bg,
+					const char 	      *filename);
+static Slide *     get_current_slide   (SlideShow 	      *show,
+		   			double    	      *alpha);
+static gboolean    slideshow_has_multiple_sizes (SlideShow *show);
+
+static SlideShow *read_slideshow_file (const char *filename,
+				       GError     **err);
+static SlideShow *slideshow_ref       (SlideShow  *show);
+static void       slideshow_unref     (SlideShow  *show);
+
+static FileSize   *find_best_size      (GSList                *sizes,
+					gint                   width,
+					gint                   height);
+
+static void
+color_from_string (const char *string,
+                   GdkRGBA    *colorp)
+{
+	if (!string || *string == '\0' || !gdk_rgba_parse (colorp, string))
+		gdk_rgba_parse (colorp, "#000000"); /* If all else fails use black */
+}
+
+static char *
+color_to_string (const GdkRGBA *color)
+{
+	return g_strdup_printf ("#%02x%02x%02x",
+				((guint) (color->red * 65535)) >> 8,
+				((guint) (color->green * 65535)) >> 8,
+				((guint) (color->blue * 65535)) >> 8);
+}
+
+static gboolean
+do_changed (MateBG *bg)
+{
+	bg->changed_id = 0;
+
+	g_signal_emit (G_OBJECT (bg), signals[CHANGED], 0);
+
+	return FALSE;
+}
+
+static void
+queue_changed (MateBG *bg)
+{
+	if (bg->changed_id > 0) {
+		g_source_remove (bg->changed_id);
+	}
+
+	bg->changed_id = g_timeout_add_full (G_PRIORITY_LOW,
+					     100,
+					     (GSourceFunc)do_changed,
+					     bg,
+					     NULL);
+}
+
+static gboolean
+do_transitioned (MateBG *bg)
+{
+	bg->transitioned_id = 0;
+
+	if (bg->pixbuf_cache) {
+		g_object_unref (bg->pixbuf_cache);
+		bg->pixbuf_cache = NULL;
+	}
+
+	g_signal_emit (G_OBJECT (bg), signals[TRANSITIONED], 0);
+
+	return FALSE;
+}
+
+static void
+queue_transitioned (MateBG *bg)
+{
+	if (bg->transitioned_id > 0) {
+		g_source_remove (bg->transitioned_id);
+	}
+
+	bg->transitioned_id = g_timeout_add_full (G_PRIORITY_LOW,
+						  100,
+						  (GSourceFunc)do_transitioned,
+						  bg,
+						  NULL);
+}
+
+/* This function loads the user's preferences */
+void
+mate_bg_load_from_preferences (MateBG *bg)
+{
+	GSettings *settings;
+	settings = g_settings_new (MATE_BG_SCHEMA);
+
+	mate_bg_load_from_gsettings (bg, settings);
+	g_object_unref (settings);
+
+	/* Queue change to force background redraw */
+	queue_changed (bg);
+}
+
+/* This function loads default system settings */
+void
+mate_bg_load_from_system_preferences (MateBG *bg)
+{
+	GSettings *settings;
+
+	/* FIXME: we need to bind system settings instead of user but
+	* that's currently impossible, not implemented yet.
+	* Hence, reset to system default values.
+	*/
+	settings = g_settings_new (MATE_BG_SCHEMA);
+
+	mate_bg_load_from_system_gsettings (bg, settings, FALSE);
+
+	g_object_unref (settings);
+}
+
+/* This function loads (and optionally resets to) default system settings */
+void
+mate_bg_load_from_system_gsettings (MateBG    *bg,
+				    GSettings *settings,
+				    gboolean   reset_apply)
+{
+	GSettingsSchema *schema;
+	gchar **keys;
+	gchar **k;
+
+	g_return_if_fail (MATE_IS_BG (bg));
+	g_return_if_fail (G_IS_SETTINGS (settings));
+
+	g_settings_delay (settings);
+
+	g_object_get (settings, "settings-schema", &schema, NULL);
+	keys = g_settings_schema_list_keys (schema);
+	g_settings_schema_unref (schema);
+
+	for (k = keys; *k; k++) {
+		g_settings_reset (settings, *k);
+	}
+	g_strfreev (keys);
+
+	if (reset_apply) {
+		/* Apply changes atomically. */
+		g_settings_apply (settings);
+	} else {
+		mate_bg_load_from_gsettings (bg, settings);
+		g_settings_revert (settings);
+	}
+}
+
+void
+mate_bg_load_from_gsettings (MateBG    *bg,
+			     GSettings *settings)
+{
+	char    *tmp;
+	char    *filename;
+	MateBGColorType ctype;
+	GdkRGBA c1, c2;
+	MateBGPlacement placement;
+
+	g_return_if_fail (MATE_IS_BG (bg));
+	g_return_if_fail (G_IS_SETTINGS (settings));
+
+	bg->is_enabled = g_settings_get_boolean (settings, MATE_BG_KEY_DRAW_BACKGROUND);
+
+	/* Filename */
+	filename = NULL;
+	tmp = g_settings_get_string (settings, MATE_BG_KEY_PICTURE_FILENAME);
+	if (tmp && *tmp != '\0') {
+		/* FIXME: UTF-8 checks should go away.
+		 * picture-filename is of type string, which can only be used for
+		 * UTF-8 strings, and some filenames are not, dependending on the
+		 * locale used.
+		 * It would be better (and simpler) to change to a URI instead,
+		 * as URIs are UTF-8 encoded strings.
+		 */
+		if (g_utf8_validate (tmp, -1, NULL) &&
+		    g_file_test (tmp, G_FILE_TEST_EXISTS)) {
+			filename = g_strdup (tmp);
+		} else {
+			filename = g_filename_from_utf8 (tmp, -1, NULL, NULL, NULL);
+		}
+
+		/* Fallback to default BG if the filename set is non-existent */
+		if (filename != NULL && !g_file_test (filename, G_FILE_TEST_EXISTS)) {
+
+			g_free (filename);
+
+			g_settings_delay (settings);
+			g_settings_reset (settings, MATE_BG_KEY_PICTURE_FILENAME);
+			filename = g_settings_get_string (settings, MATE_BG_KEY_PICTURE_FILENAME);
+			g_settings_revert (settings);
+
+			//* Check if default background exists, also */
+			if (filename != NULL && !g_file_test (filename, G_FILE_TEST_EXISTS)) {
+				g_free (filename);
+				filename = NULL;
+			}
+		}
+	}
+	g_free (tmp);
+
+	/* Colors */
+	tmp = g_settings_get_string (settings, MATE_BG_KEY_PRIMARY_COLOR);
+	color_from_string (tmp, &c1);
+	g_free (tmp);
+
+	tmp = g_settings_get_string (settings, MATE_BG_KEY_SECONDARY_COLOR);
+	color_from_string (tmp, &c2);
+	g_free (tmp);
+
+	/* Color type */
+	ctype = g_settings_get_enum (settings, MATE_BG_KEY_COLOR_TYPE);
+
+	/* Placement */
+	placement = g_settings_get_enum (settings, MATE_BG_KEY_PICTURE_PLACEMENT);
+
+	mate_bg_set_color (bg, ctype, &c1, &c2);
+	mate_bg_set_placement (bg, placement);
+	mate_bg_set_filename (bg, filename);
+
+	g_free (filename);
+}
+
+void
+mate_bg_save_to_preferences (MateBG *bg)
+{
+	GSettings *settings;
+	settings = g_settings_new (MATE_BG_SCHEMA);
+
+	mate_bg_save_to_gsettings (bg, settings);
+	g_object_unref (settings);
+}
+
+void
+mate_bg_save_to_gsettings (MateBG    *bg,
+			   GSettings *settings)
+{
+	gchar *primary;
+	gchar *secondary;
+
+	g_return_if_fail (MATE_IS_BG (bg));
+	g_return_if_fail (G_IS_SETTINGS (settings));
+
+	primary = color_to_string (&bg->primary);
+	secondary = color_to_string (&bg->secondary);
+
+	g_settings_delay (settings);
+
+	g_settings_set_boolean (settings, MATE_BG_KEY_DRAW_BACKGROUND, bg->is_enabled);
+	g_settings_set_string (settings, MATE_BG_KEY_PICTURE_FILENAME, bg->filename);
+	g_settings_set_enum (settings, MATE_BG_KEY_PICTURE_PLACEMENT, bg->placement);
+	g_settings_set_string (settings, MATE_BG_KEY_PRIMARY_COLOR, primary);
+	g_settings_set_string (settings, MATE_BG_KEY_SECONDARY_COLOR, secondary);
+	g_settings_set_enum (settings, MATE_BG_KEY_COLOR_TYPE, bg->color_type);
+
+	/* Apply changes atomically. */
+	g_settings_apply (settings);
+
+	g_free (primary);
+	g_free (secondary);
+}
+
+static void
+mate_bg_init (MateBG *bg)
+{
+}
+
+static void
+mate_bg_dispose (GObject *object)
+{
+	MateBG *bg = MATE_BG (object);
+
+	if (bg->file_monitor) {
+		g_object_unref (bg->file_monitor);
+		bg->file_monitor = NULL;
+	}
+
+	clear_cache (bg);
+
+	G_OBJECT_CLASS (mate_bg_parent_class)->dispose (object);
+}
+
+static void
+mate_bg_finalize (GObject *object)
+{
+	MateBG *bg = MATE_BG (object);
+
+	if (bg->changed_id != 0) {
+		g_source_remove (bg->changed_id);
+		bg->changed_id = 0;
+	}
+
+	if (bg->transitioned_id != 0) {
+		g_source_remove (bg->transitioned_id);
+		bg->transitioned_id = 0;
+	}
+
+	if (bg->blow_caches_id != 0) {
+		g_source_remove (bg->blow_caches_id);
+		bg->blow_caches_id = 0;
+	}
+
+	g_free (bg->filename);
+	bg->filename = NULL;
+
+	G_OBJECT_CLASS (mate_bg_parent_class)->finalize (object);
+}
+
+static void
+mate_bg_class_init (MateBGClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+	object_class->dispose = mate_bg_dispose;
+	object_class->finalize = mate_bg_finalize;
+
+	signals[CHANGED] = g_signal_new ("changed",
+					 G_OBJECT_CLASS_TYPE (object_class),
+					 G_SIGNAL_RUN_LAST,
+					 0,
+					 NULL, NULL,
+					 g_cclosure_marshal_VOID__VOID,
+					 G_TYPE_NONE, 0);
+
+	signals[TRANSITIONED] = g_signal_new ("transitioned",
+					 G_OBJECT_CLASS_TYPE (object_class),
+					 G_SIGNAL_RUN_LAST,
+					 0,
+					 NULL, NULL,
+					 g_cclosure_marshal_VOID__VOID,
+					 G_TYPE_NONE, 0);
+}
+
+MateBG *
+mate_bg_new (void)
+{
+	return g_object_new (MATE_TYPE_BG, NULL);
+}
+
+void
+mate_bg_set_color (MateBG *bg,
+		    MateBGColorType type,
+		    GdkRGBA *primary,
+		    GdkRGBA *secondary)
+{
+	g_return_if_fail (bg != NULL);
+	g_return_if_fail (primary != NULL);
+
+	if (bg->color_type != type			||
+	    !gdk_rgba_equal (&bg->primary, primary)			||
+	    (secondary && !gdk_rgba_equal (&bg->secondary, secondary))) {
+		bg->color_type = type;
+		bg->primary = *primary;
+		if (secondary) {
+			bg->secondary = *secondary;
+		}
+
+		queue_changed (bg);
+	}
+}
+
+void
+mate_bg_set_placement (MateBG		*bg,
+		       MateBGPlacement	 placement)
+{
+	g_return_if_fail (bg != NULL);
+
+	if (bg->placement != placement) {
+		bg->placement = placement;
+
+		queue_changed (bg);
+	}
+}
+
+MateBGPlacement
+mate_bg_get_placement (MateBG *bg)
+{
+	g_return_val_if_fail (bg != NULL, -1);
+
+	return bg->placement;
+}
+
+void
+mate_bg_get_color (MateBG		*bg,
+		   MateBGColorType	*type,
+		   GdkRGBA		*primary,
+		   GdkRGBA		*secondary)
+{
+	g_return_if_fail (bg != NULL);
+
+	if (type)
+		*type = bg->color_type;
+
+	if (primary)
+		*primary = bg->primary;
+
+	if (secondary)
+		*secondary = bg->secondary;
+}
+
+void
+mate_bg_set_draw_background (MateBG	*bg,
+			     gboolean	 draw_background)
+{
+	g_return_if_fail (bg != NULL);
+
+	if (bg->is_enabled != draw_background) {
+		bg->is_enabled = draw_background;
+
+		queue_changed (bg);
+	}
+}
+
+gboolean
+mate_bg_get_draw_background (MateBG *bg)
+{
+	g_return_val_if_fail (bg != NULL, FALSE);
+
+	return bg->is_enabled;
+}
+
+const gchar *
+mate_bg_get_filename (MateBG *bg)
+{
+	g_return_val_if_fail (bg != NULL, NULL);
+
+	return bg->filename;
+}
+
+static inline gchar *
+get_wallpaper_cache_dir (void)
+{
+	return g_build_filename (g_get_user_cache_dir(), MATE_BG_CACHE_DIR, NULL);
+}
+
+static inline gchar *
+get_wallpaper_cache_prefix_name (gint                     num_monitor,
+				 MateBGPlacement          placement,
+				 gint                     width,
+				 gint                     height)
+{
+	return g_strdup_printf ("%i_%i_%i_%i", num_monitor, (gint) placement, width, height);
+}
+
+static char *
+get_wallpaper_cache_filename (const char              *filename,
+			      gint                     num_monitor,
+			      MateBGPlacement          placement,
+			      gint                     width,
+			      gint                     height)
+{
+	gchar *cache_filename;
+	gchar *cache_prefix_name;
+	gchar *md5_filename;
+	gchar *cache_basename;
+	gchar *cache_dir;
+
+	md5_filename = g_compute_checksum_for_data (G_CHECKSUM_MD5, (const guchar *) filename,
+						    strlen (filename));
+	cache_prefix_name = get_wallpaper_cache_prefix_name (num_monitor, placement, width, height);
+	cache_basename = g_strdup_printf ("%s_%s", cache_prefix_name, md5_filename);
+	cache_dir = get_wallpaper_cache_dir ();
+	cache_filename = g_build_filename (cache_dir, cache_basename, NULL);
+
+	g_free (cache_prefix_name);
+	g_free (md5_filename);
+	g_free (cache_basename);
+	g_free (cache_dir);
+
+	return cache_filename;
+}
+
+static void
+cleanup_cache_for_monitor (gchar *cache_dir,
+			   gint   num_monitor)
+{
+	GDir            *g_cache_dir;
+	gchar           *monitor_prefix;
+	const gchar     *file;
+
+	g_cache_dir = g_dir_open (cache_dir, 0, NULL);
+	monitor_prefix = g_strdup_printf ("%i_", num_monitor);
+
+	file = g_dir_read_name (g_cache_dir);
+	while (file != NULL) {
+		gchar *path = g_build_filename (cache_dir, file, NULL);
+
+		/* purge files with same monitor id */
+		if (g_str_has_prefix (file, monitor_prefix) &&
+		    g_file_test (path, G_FILE_TEST_IS_REGULAR))
+			g_unlink (path);
+
+		g_free (path);
+
+		file = g_dir_read_name (g_cache_dir);
+	}
+
+	g_free (monitor_prefix);
+	g_dir_close (g_cache_dir);
+}
+
+static gboolean
+cache_file_is_valid (const char *filename,
+		     const char *cache_filename)
+{
+	if (!g_file_test (cache_filename, G_FILE_TEST_IS_REGULAR))
+		return FALSE;
+
+	return (get_mtime (filename) < get_mtime (cache_filename));
+}
+
+static void
+refresh_cache_file (MateBG     *bg,
+		    GdkPixbuf  *new_pixbuf,
+		    gint        num_monitor,
+		    gint        width,
+		    gint        height)
+{
+	gchar           *cache_filename;
+	gchar           *cache_dir;
+	GdkPixbufFormat *format;
+	gchar           *format_name;
+
+	if ((num_monitor == -1) || (width <= 300) || (height <= 300))
+		return;
+
+	cache_filename = get_wallpaper_cache_filename (bg->filename, num_monitor,
+							bg->placement, width, height);
+	cache_dir = get_wallpaper_cache_dir ();
+
+	/* Only refresh scaled file on disk if useful (and don't cache slideshow) */
+	if (!cache_file_is_valid (bg->filename, cache_filename)) {
+		format = gdk_pixbuf_get_file_info (bg->filename, NULL, NULL);
+
+		if (format != NULL) {
+			if (!g_file_test (cache_dir, G_FILE_TEST_IS_DIR)) {
+				g_mkdir_with_parents (cache_dir, 0700);
+			} else {
+				cleanup_cache_for_monitor (cache_dir, num_monitor);
+			}
+
+			format_name = gdk_pixbuf_format_get_name (format);
+
+			if (strcmp (format_name, "jpeg") == 0)
+				gdk_pixbuf_save (new_pixbuf, cache_filename, format_name,
+						 NULL, "quality", "100", NULL);
+			else
+				gdk_pixbuf_save (new_pixbuf, cache_filename, format_name,
+						 NULL, NULL);
+
+			g_free (format_name);
+		}
+	}
+
+	g_free (cache_filename);
+	g_free (cache_dir);
+}
+
+static void
+file_changed (GFileMonitor     *file_monitor,
+	      GFile            *child,
+	      GFile            *other_file,
+	      GFileMonitorEvent event_type,
+	      gpointer          user_data)
+{
+	MateBG *bg = MATE_BG (user_data);
+
+	clear_cache (bg);
+	queue_changed (bg);
+}
+
+void
+mate_bg_set_filename (MateBG	 *bg,
+		      const char *filename)
+{
+	g_return_if_fail (bg != NULL);
+
+	if (is_different (bg, filename)) {
+		g_free (bg->filename);
+
+		bg->filename = g_strdup (filename);
+		bg->file_mtime = get_mtime (bg->filename);
+
+		if (bg->file_monitor) {
+			g_object_unref (bg->file_monitor);
+			bg->file_monitor = NULL;
+		}
+
+		if (bg->filename) {
+			GFile *f = g_file_new_for_path (bg->filename);
+
+			bg->file_monitor = g_file_monitor_file (f, 0, NULL, NULL);
+			g_signal_connect (bg->file_monitor, "changed",
+					  G_CALLBACK (file_changed), bg);
+
+			g_object_unref (f);
+		}
+
+		clear_cache (bg);
+
+		queue_changed (bg);
+	}
+}
+
+static void
+draw_color_area (MateBG       *bg,
+		 GdkPixbuf    *dest,
+		 GdkRectangle *rect)
+{
+	guint32 pixel;
+	GdkRectangle extent;
+
+        extent.x = 0;
+        extent.y = 0;
+        extent.width = gdk_pixbuf_get_width (dest);
+        extent.height = gdk_pixbuf_get_height (dest);
+
+	gdk_rectangle_intersect (rect, &extent, rect);
+
+	switch (bg->color_type) {
+	case MATE_BG_COLOR_SOLID:
+		/* not really a big deal to ignore the area of interest */
+		pixel = ((guint) (bg->primary.red * 0xff) << 24)   |
+			((guint) (bg->primary.green * 0xff) << 16) |
+			((guint) (bg->primary.blue * 0xff) << 8)   |
+			(0xff);
+
+		gdk_pixbuf_fill (dest, pixel);
+		break;
+
+	case MATE_BG_COLOR_H_GRADIENT:
+		pixbuf_draw_gradient (dest, TRUE, &(bg->primary), &(bg->secondary), rect);
+		break;
+
+	case MATE_BG_COLOR_V_GRADIENT:
+		pixbuf_draw_gradient (dest, FALSE, &(bg->primary), &(bg->secondary), rect);
+		break;
+
+	default:
+		break;
+	}
+}
+
+static void
+draw_color (MateBG    *bg,
+	    GdkPixbuf *dest)
+{
+	GdkRectangle rect;
+
+	rect.x = 0;
+	rect.y = 0;
+	rect.width = gdk_pixbuf_get_width (dest);
+	rect.height = gdk_pixbuf_get_height (dest);
+	draw_color_area (bg, dest, &rect);
+}
+
+static void
+draw_color_each_monitor (MateBG    *bg,
+			 GdkPixbuf *dest,
+			 GdkScreen *screen)
+{
+	GdkDisplay *display;
+	GdkRectangle rect;
+	gint num_monitors;
+	int monitor;
+
+	display = gdk_screen_get_display (screen);
+	num_monitors = gdk_display_get_n_monitors (display);
+	for (monitor = 0; monitor < num_monitors; monitor++) {
+		gdk_monitor_get_geometry (gdk_display_get_monitor (display, monitor), &rect);
+		draw_color_area (bg, dest, &rect);
+	}
+}
+
+static GdkPixbuf *
+pixbuf_clip_to_fit (GdkPixbuf *src,
+		    int        max_width,
+		    int        max_height)
+{
+	int src_width, src_height;
+	int w, h;
+	int src_x, src_y;
+	GdkPixbuf *pixbuf;
+
+	src_width = gdk_pixbuf_get_width (src);
+	src_height = gdk_pixbuf_get_height (src);
+
+	if (src_width < max_width && src_height < max_height)
+		return g_object_ref (src);
+
+	w = MIN(src_width, max_width);
+	h = MIN(src_height, max_height);
+
+	pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
+				 gdk_pixbuf_get_has_alpha (src),
+				 8, w, h);
+
+	src_x = (src_width - w) / 2;
+	src_y = (src_height - h) / 2;
+	gdk_pixbuf_copy_area (src,
+			      src_x, src_y,
+			      w, h,
+			      pixbuf,
+			      0, 0);
+	return pixbuf;
+}
+
+static GdkPixbuf *
+get_scaled_pixbuf (MateBGPlacement  placement,
+		   GdkPixbuf       *pixbuf,
+		   int width, int height,
+		   int *x, int *y,
+		   int *w, int *h)
+{
+	GdkPixbuf *new;
+
+#if 0
+	g_print ("original_width: %d %d\n",
+		 gdk_pixbuf_get_width (pixbuf),
+		 gdk_pixbuf_get_height (pixbuf));
+#endif
+
+	switch (placement) {
+	case MATE_BG_PLACEMENT_SPANNED:
+                new = pixbuf_scale_to_fit (pixbuf, width, height);
+		break;
+	case MATE_BG_PLACEMENT_ZOOMED:
+		new = pixbuf_scale_to_min (pixbuf, width, height);
+		break;
+
+	case MATE_BG_PLACEMENT_FILL_SCREEN:
+		new = gdk_pixbuf_scale_simple (pixbuf, width, height,
+					       GDK_INTERP_BILINEAR);
+		break;
+
+	case MATE_BG_PLACEMENT_SCALED:
+		new = pixbuf_scale_to_fit (pixbuf, width, height);
+		break;
+
+	case MATE_BG_PLACEMENT_CENTERED:
+	case MATE_BG_PLACEMENT_TILED:
+	default:
+		new = pixbuf_clip_to_fit (pixbuf, width, height);
+		break;
+	}
+
+	*w = gdk_pixbuf_get_width (new);
+	*h = gdk_pixbuf_get_height (new);
+	*x = (width - *w) / 2;
+	*y = (height - *h) / 2;
+
+	return new;
+}
+
+static void
+draw_image_area (MateBG        *bg,
+		 gint           num_monitor,
+		 GdkPixbuf     *pixbuf,
+		 GdkPixbuf     *dest,
+		 GdkRectangle  *area)
+{
+	int dest_width = area->width;
+	int dest_height = area->height;
+	int x, y, w, h;
+	GdkPixbuf *scaled;
+
+	if (!pixbuf)
+		return;
+
+	scaled = get_scaled_pixbuf (bg->placement, pixbuf, dest_width, dest_height, &x, &y, &w, &h);
+
+	switch (bg->placement) {
+	case MATE_BG_PLACEMENT_TILED:
+		pixbuf_tile (scaled, dest);
+		break;
+	case MATE_BG_PLACEMENT_ZOOMED:
+	case MATE_BG_PLACEMENT_CENTERED:
+	case MATE_BG_PLACEMENT_FILL_SCREEN:
+	case MATE_BG_PLACEMENT_SCALED:
+		pixbuf_blend (scaled, dest, 0, 0, w, h, x + area->x, y + area->y, 1.0);
+		break;
+	case MATE_BG_PLACEMENT_SPANNED:
+		pixbuf_blend (scaled, dest, 0, 0, w, h, x, y, 1.0);
+		break;
+	default:
+		g_assert_not_reached ();
+		break;
+	}
+
+	refresh_cache_file (bg, scaled, num_monitor, dest_width, dest_height);
+
+	g_object_unref (scaled);
+}
+
+static void
+draw_image_for_thumb (MateBG     *bg,
+		      GdkPixbuf  *pixbuf,
+		      GdkPixbuf  *dest)
+{
+	GdkRectangle rect;
+
+	rect.x = 0;
+	rect.y = 0;
+	rect.width = gdk_pixbuf_get_width (dest);
+	rect.height = gdk_pixbuf_get_height (dest);
+
+	draw_image_area (bg, -1, pixbuf, dest, &rect);
+}
+
+static void
+draw_once (MateBG    *bg,
+	   GdkPixbuf *dest,
+	   gboolean   is_root)
+{
+	GdkRectangle rect;
+	GdkPixbuf   *pixbuf;
+	gint         monitor;
+
+	/* whether we're drawing on root window or normal (Caja) window */
+	monitor = (is_root) ? 0 : -1;
+
+	rect.x = 0;
+	rect.y = 0;
+	rect.width = gdk_pixbuf_get_width (dest);
+	rect.height = gdk_pixbuf_get_height (dest);
+
+	pixbuf = get_pixbuf_for_size (bg, monitor, rect.width, rect.height);
+	if (pixbuf) {
+		draw_image_area (bg, monitor, pixbuf, dest, &rect);
+
+		g_object_unref (pixbuf);
+	}
+}
+
+static void
+draw_each_monitor (MateBG    *bg,
+		   GdkPixbuf *dest,
+		   GdkScreen *screen)
+{
+	GdkDisplay *display;
+
+	display = gdk_screen_get_display (screen);
+	gint num_monitors = gdk_display_get_n_monitors (display);
+	gint monitor = 0;
+
+	for (; monitor < num_monitors; monitor++) {
+		GdkRectangle rect;
+		GdkPixbuf *pixbuf;
+
+		gdk_monitor_get_geometry (gdk_display_get_monitor (display, monitor), &rect);
+
+		pixbuf = get_pixbuf_for_size (bg, monitor, rect.width, rect.height);
+		if (pixbuf) {
+			draw_image_area (bg, monitor, pixbuf, dest, &rect);
+
+			g_object_unref (pixbuf);
+		}
+	}
+}
+
+void
+mate_bg_draw (MateBG     *bg,
+	       GdkPixbuf *dest,
+	       GdkScreen *screen,
+	       gboolean   is_root)
+{
+	if (!bg)
+		return;
+
+	if (is_root && (bg->placement != MATE_BG_PLACEMENT_SPANNED)) {
+		draw_color_each_monitor (bg, dest, screen);
+		if (bg->filename) {
+			draw_each_monitor (bg, dest, screen);
+		}
+	} else {
+		draw_color (bg, dest);
+		if (bg->filename) {
+			draw_once (bg, dest, is_root);
+		}
+	}
+}
+
+gboolean
+mate_bg_has_multiple_sizes (MateBG *bg)
+{
+	SlideShow *show;
+	gboolean ret;
+
+	g_return_val_if_fail (bg != NULL, FALSE);
+
+	ret = FALSE;
+
+	show = get_as_slideshow (bg, bg->filename);
+	if (show) {
+		ret = slideshow_has_multiple_sizes (show);
+		slideshow_unref (show);
+	}
+
+	return ret;
+}
+
+static void
+mate_bg_get_pixmap_size (MateBG   *bg,
+			  int        width,
+			  int        height,
+			  int       *pixmap_width,
+			  int       *pixmap_height)
+{
+	int dummy;
+
+	if (!pixmap_width)
+		pixmap_width = &dummy;
+	if (!pixmap_height)
+		pixmap_height = &dummy;
+
+	*pixmap_width = width;
+	*pixmap_height = height;
+
+	if (!bg->filename) {
+		switch (bg->color_type) {
+		case MATE_BG_COLOR_SOLID:
+			*pixmap_width = 1;
+			*pixmap_height = 1;
+			break;
+
+		case MATE_BG_COLOR_H_GRADIENT:
+		case MATE_BG_COLOR_V_GRADIENT:
+			break;
+		}
+
+		return;
+	}
+}
+
+/**
+ * mate_bg_create_surface:
+ * @bg: MateBG
+ * @window:
+ * @width:
+ * @height:
+ * @root:
+ *
+ * Create a surface that can be set as background for @window. If @root is
+ * TRUE, the surface created will be created by a temporary X server connection
+ * so that if someone calls XKillClient on it, it won't affect the application
+ * who created it.
+ **/
+cairo_surface_t *
+mate_bg_create_surface (MateBG      *bg,
+		 	GdkWindow   *window,
+			int	     width,
+			int	     height,
+			gboolean     root)
+{
+	return mate_bg_create_surface_scale (bg,
+					     window,
+					     width,
+					     height,
+					     1,
+					     root);
+}
+
+/**
+ * mate_bg_create_surface_scale:
+ * @bg: MateBG
+ * @window:
+ * @width:
+ * @height:
+ * @scale:
+ * @root:
+ *
+ * Create a scaled surface that can be set as background for @window. If @root is
+ * TRUE, the surface created will be created by a temporary X server connection
+ * so that if someone calls XKillClient on it, it won't affect the application
+ * who created it.
+ **/
+cairo_surface_t *
+mate_bg_create_surface_scale (MateBG      *bg,
+			      GdkWindow   *window,
+			      int          width,
+			      int          height,
+			      int          scale,
+			      gboolean     root)
+{
+	int pm_width, pm_height;
+
+	cairo_surface_t *surface;
+	cairo_t *cr;
+
+	g_return_val_if_fail (bg != NULL, NULL);
+	g_return_val_if_fail (window != NULL, NULL);
+
+	if (bg->pixbuf_cache &&
+	    (gdk_pixbuf_get_width (bg->pixbuf_cache) != width ||
+	     gdk_pixbuf_get_height (bg->pixbuf_cache) != height))
+	{
+		g_object_unref (bg->pixbuf_cache);
+		bg->pixbuf_cache = NULL;
+	}
+
+	mate_bg_get_pixmap_size (bg, width, height, &pm_width, &pm_height);
+
+	if (root)
+	{
+		surface = make_root_pixmap (window, pm_width * scale, pm_height * scale);
+	}
+	else
+	{
+		surface = gdk_window_create_similar_surface (window, CAIRO_CONTENT_COLOR,
+							     pm_width, pm_height);
+	}
+
+	cr = cairo_create (surface);
+	cairo_scale (cr, (double)scale, (double)scale);
+
+	if (!bg->filename && bg->color_type == MATE_BG_COLOR_SOLID) {
+		gdk_cairo_set_source_rgba (cr, &(bg->primary));
+	}
+	else
+	{
+		GdkPixbuf *pixbuf;
+
+		pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
+					 width, height);
+		mate_bg_draw (bg, pixbuf, gdk_window_get_screen (window), root);
+		gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
+		g_object_unref (pixbuf);
+	}
+
+	cairo_paint (cr);
+
+	cairo_destroy (cr);
+
+	return surface;
+}
+
+/* determine if a background is darker or lighter than average, to help
+ * clients know what colors to draw on top with
+ */
+gboolean
+mate_bg_is_dark (MateBG *bg,
+		  int      width,
+		  int      height)
+{
+	GdkRGBA color;
+	int intensity;
+	GdkPixbuf *pixbuf;
+
+	g_return_val_if_fail (bg != NULL, FALSE);
+
+	if (bg->color_type == MATE_BG_COLOR_SOLID) {
+		color = bg->primary;
+	} else {
+		color.red = (bg->primary.red + bg->secondary.red) / 2;
+		color.green = (bg->primary.green + bg->secondary.green) / 2;
+		color.blue = (bg->primary.blue + bg->secondary.blue) / 2;
+	}
+	pixbuf = get_pixbuf_for_size (bg, -1, width, height);
+	if (pixbuf) {
+		GdkRGBA argb;
+		guchar a, r, g, b;
+
+		pixbuf_average_value (pixbuf, &argb);
+		a = argb.alpha * 0xff;
+		r = argb.red * 0xff;
+		g = argb.green * 0xff;
+		b = argb.blue * 0xff;
+
+		color.red = (color.red * (0xFF - a) + r * 0x101 * a) / 0xFF;
+		color.green = (color.green * (0xFF - a) + g * 0x101 * a) / 0xFF;
+		color.blue = (color.blue * (0xFF - a) + b * 0x101 * a) / 0xFF;
+		g_object_unref (pixbuf);
+	}
+
+	intensity = ((guint) (color.red * 65535) * 77 +
+		     (guint) (color.green * 65535) * 150 +
+		     (guint) (color.blue * 65535) * 28) >> 16;
+
+	return intensity < 160; /* biased slightly to be dark */
+}
+
+/*
+ * Create a persistent pixmap. We create a separate display
+ * and set the closedown mode on it to RetainPermanent.
+ */
+static cairo_surface_t *
+make_root_pixmap (GdkWindow *window, gint width, gint height)
+{
+	GdkScreen *screen = gdk_window_get_screen(window);
+	char *disp_name = DisplayString (GDK_WINDOW_XDISPLAY (window));
+	Display *display;
+	Pixmap xpixmap;
+	cairo_surface_t *surface;
+	int depth;
+
+	/* Desktop background pixmap should be created from dummy X client since most
+	 * applications will try to kill it with XKillClient later when changing pixmap
+	 */
+	display = XOpenDisplay (disp_name);
+
+	if (display == NULL) {
+		g_warning ("Unable to open display '%s' when setting background pixmap\n",
+		           (disp_name) ? disp_name : "NULL");
+		return NULL;
+	}
+
+	depth = DefaultDepth (display, gdk_x11_screen_get_screen_number (screen));
+	xpixmap = XCreatePixmap (display, GDK_WINDOW_XID (window), width, height, depth);
+
+	XFlush (display);
+	XSetCloseDownMode (display, RetainPermanent);
+	XCloseDisplay (display);
+
+	surface = cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (screen), xpixmap,
+                                             GDK_VISUAL_XVISUAL (gdk_screen_get_system_visual (screen)),
+        				     width, height);
+
+	return surface;
+}
+
+static gboolean
+get_original_size (const char *filename,
+		   int        *orig_width,
+		   int        *orig_height)
+{
+	gboolean result;
+
+        if (gdk_pixbuf_get_file_info (filename, orig_width, orig_height))
+		result = TRUE;
+	else
+		result = FALSE;
+
+	return result;
+}
+
+static const char *
+get_filename_for_size (MateBG *bg, gint best_width, gint best_height)
+{
+	SlideShow *show;
+	Slide *slide;
+	FileSize *size;
+
+	if (!bg->filename)
+		return NULL;
+
+	show = get_as_slideshow (bg, bg->filename);
+	if (!show) {
+		return bg->filename;
+	}
+
+	slide = get_current_slide (show, NULL);
+	slideshow_unref (show);
+	size = find_best_size (slide->file1, best_width, best_height);
+	return size->file;
+}
+
+gboolean
+mate_bg_get_image_size (MateBG	       *bg,
+			 MateDesktopThumbnailFactory *factory,
+			 int                    best_width,
+			 int                    best_height,
+			 int		       *width,
+			 int		       *height)
+{
+	GdkPixbuf *thumb;
+	gboolean result = FALSE;
+	const gchar *filename;
+
+	g_return_val_if_fail (bg != NULL, FALSE);
+	g_return_val_if_fail (factory != NULL, FALSE);
+
+	if (!bg->filename)
+		return FALSE;
+
+	filename = get_filename_for_size (bg, best_width, best_height);
+	thumb = create_thumbnail_for_filename (factory, filename);
+	if (thumb) {
+		if (get_thumb_annotations (thumb, width, height))
+			result = TRUE;
+
+		g_object_unref (thumb);
+	}
+
+	if (!result) {
+		if (get_original_size (filename, width, height))
+			result = TRUE;
+	}
+
+	return result;
+}
+
+static double
+fit_factor (int from_width, int from_height,
+	    int to_width,   int to_height)
+{
+	return MIN (to_width  / (double) from_width, to_height / (double) from_height);
+}
+
+/**
+ * mate_bg_create_thumbnail:
+ *
+ * Returns: (transfer full): a #GdkPixbuf showing the background as a thumbnail
+ */
+GdkPixbuf *
+mate_bg_create_thumbnail (MateBG               *bg,
+		           MateDesktopThumbnailFactory *factory,
+			   GdkScreen             *screen,
+			   int                    dest_width,
+			   int                    dest_height)
+{
+	GdkPixbuf *result;
+	GdkPixbuf *thumb;
+
+	g_return_val_if_fail (bg != NULL, NULL);
+
+	result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, dest_width, dest_height);
+
+	draw_color (bg, result);
+
+	if (bg->filename) {
+		thumb = create_img_thumbnail (bg, factory, screen, dest_width, dest_height, -1);
+
+		if (thumb) {
+			draw_image_for_thumb (bg, thumb, result);
+			g_object_unref (thumb);
+		}
+	}
+
+	return result;
+}
+
+/**
+ * mate_bg_get_surface_from_root:
+ * @screen: a #GdkScreen
+ *
+ * This function queries the _XROOTPMAP_ID property from
+ * the root window associated with @screen to determine
+ * the current root window background surface and returns
+ * a copy of it. If the _XROOTPMAP_ID is not set, then
+ * a black surface is returned.
+ *
+ * Return value: a #cairo_surface_t if successful or %NULL
+ **/
+cairo_surface_t *
+mate_bg_get_surface_from_root (GdkScreen *screen)
+{
+	int result;
+	gint format;
+	gulong nitems;
+	gulong bytes_after;
+	guchar *data;
+	Atom type;
+	Display *display;
+	int screen_num;
+	cairo_surface_t *surface;
+	cairo_surface_t *source_pixmap;
+	GdkDisplay *gdkdisplay;
+	int width, height;
+	cairo_t *cr;
+
+	display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
+	screen_num = gdk_x11_screen_get_screen_number (screen);
+
+	result = XGetWindowProperty (display,
+				     RootWindow (display, screen_num),
+				     gdk_x11_get_xatom_by_name ("_XROOTPMAP_ID"),
+				     0L, 1L, False, XA_PIXMAP,
+				     &type, &format, &nitems, &bytes_after,
+				     &data);
+	surface = NULL;
+	source_pixmap = NULL;
+
+	if (result != Success || type != XA_PIXMAP ||
+	    format != 32 || nitems != 1) {
+		XFree (data);
+		data = NULL;
+	}
+
+	if (data != NULL) {
+		gdkdisplay = gdk_screen_get_display (screen);
+		gdk_x11_display_error_trap_push (gdkdisplay);
+
+		Pixmap xpixmap = *(Pixmap *) data;
+		Window root_return;
+		int x_ret, y_ret;
+		unsigned int w_ret, h_ret, bw_ret, depth_ret;
+
+		if (XGetGeometry (GDK_SCREEN_XDISPLAY (screen),
+				  xpixmap,
+				  &root_return,
+				  &x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret))
+		{
+			source_pixmap = cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (screen),
+								   xpixmap,
+								   GDK_VISUAL_XVISUAL (gdk_screen_get_system_visual (screen)),
+								   w_ret, h_ret);
+		}
+
+		gdk_x11_display_error_trap_pop_ignored (gdkdisplay);
+	}
+
+	width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen));
+	height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen));
+
+	if (source_pixmap) {
+		surface = cairo_surface_create_similar (source_pixmap,
+							CAIRO_CONTENT_COLOR,
+							width, height);
+
+		cr = cairo_create (surface);
+		cairo_set_source_surface (cr, source_pixmap, 0, 0);
+		cairo_paint (cr);
+
+		if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
+			cairo_surface_destroy (surface);
+			surface = NULL;
+		}
+
+		cairo_destroy (cr);
+	}
+
+	if (surface == NULL) {
+		surface = gdk_window_create_similar_surface (gdk_screen_get_root_window (screen),
+							     CAIRO_CONTENT_COLOR,
+							     width, height);
+	}
+
+	if (source_pixmap != NULL)
+		cairo_surface_destroy (source_pixmap);
+
+	if (data != NULL)
+		XFree (data);
+
+	return surface;
+}
+
+/* Sets the "ESETROOT_PMAP_ID" property to later be used to free the pixmap,
+ */
+static void
+mate_bg_set_root_pixmap_id (GdkScreen       *screen,
+			    Display         *display,
+			    Pixmap           xpixmap)
+{
+	Window   xroot   = RootWindow (display, gdk_x11_screen_get_screen_number (screen));
+	char    *atom_names[] = {"_XROOTPMAP_ID", "ESETROOT_PMAP_ID"};
+	Atom     atoms[G_N_ELEMENTS(atom_names)] = {0};
+
+	Atom     type;
+	int      format, result;
+	unsigned long nitems, after;
+	unsigned char *data_root, *data_esetroot;
+	GdkDisplay *gdkdisplay;
+
+	/* Get atoms for both properties in an array, only if they exist.
+	 * This method is to avoid multiple round-trips to Xserver
+	 */
+	if (XInternAtoms (display, atom_names, G_N_ELEMENTS(atom_names), True, atoms) &&
+	    atoms[0] != None && atoms[1] != None) {
+		result = XGetWindowProperty (display, xroot, atoms[0], 0L, 1L,
+		                             False, AnyPropertyType,
+		                             &type, &format, &nitems, &after,
+		                             &data_root);
+
+		if (data_root != NULL && result == Success &&
+		    type == XA_PIXMAP && format == 32 && nitems == 1) {
+			result = XGetWindowProperty (display, xroot, atoms[1],
+			                             0L, 1L, False,
+			                             AnyPropertyType,
+			                             &type, &format, &nitems,
+			                             &after, &data_esetroot);
+
+			if (data_esetroot != NULL && result == Success &&
+			    type == XA_PIXMAP && format == 32 && nitems == 1) {
+				Pixmap xrootpmap = *((Pixmap *) data_root);
+				Pixmap esetrootpmap = *((Pixmap *) data_esetroot);
+
+				gdkdisplay = gdk_screen_get_display (screen);
+				gdk_x11_display_error_trap_push (gdkdisplay);
+				if (xrootpmap && xrootpmap == esetrootpmap) {
+					XKillClient (display, xrootpmap);
+				}
+				if (esetrootpmap && esetrootpmap != xrootpmap) {
+					XKillClient (display, esetrootpmap);
+				}
+				gdk_x11_display_error_trap_pop_ignored (gdkdisplay);
+			}
+			if (data_esetroot != NULL) {
+				XFree (data_esetroot);
+			}
+		}
+		if (data_root != NULL) {
+			XFree (data_root);
+		}
+	}
+
+	/* Get atoms for both properties in an array, create them if needed.
+	 * This method is to avoid multiple round-trips to Xserver
+	 */
+	if (!XInternAtoms (display, atom_names, G_N_ELEMENTS(atom_names), False, atoms) ||
+	    atoms[0] == None || atoms[1] == None) {
+	    g_warning ("Could not create atoms needed to set root pixmap id/properties.\n");
+	    return;
+	}
+
+	/* Set new _XROOTMAP_ID and ESETROOT_PMAP_ID properties */
+	XChangeProperty (display, xroot, atoms[0], XA_PIXMAP, 32,
+			 PropModeReplace, (unsigned char *) &xpixmap, 1);
+
+	XChangeProperty (display, xroot, atoms[1], XA_PIXMAP, 32,
+			 PropModeReplace, (unsigned char *) &xpixmap, 1);
+}
+
+/**
+ * mate_bg_set_surface_as_root:
+ * @screen: the #GdkScreen to change root background on
+ * @surface: the #cairo_surface_t to set root background from.
+ *   Must be an xlib surface backing a pixmap.
+ *
+ * Set the root pixmap, and properties pointing to it. We
+ * do this atomically with a server grab to make sure that
+ * we won't leak the pixmap if somebody else it setting
+ * it at the same time. (This assumes that they follow the
+ * same conventions we do).  @surface should come from a call
+ * to mate_bg_create_surface().
+ **/
+void
+mate_bg_set_surface_as_root (GdkScreen *screen, cairo_surface_t *surface)
+{
+	g_return_if_fail (screen != NULL);
+	g_return_if_fail (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_XLIB);
+
+	/* Desktop background pixmap should be created from dummy X client since most
+	 * applications will try to kill it with XKillClient later when changing pixmap
+	 */
+	Display    *display      = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
+	Pixmap      pixmap_id    = cairo_xlib_surface_get_drawable (surface);
+	Window      xroot        = RootWindow (display, gdk_x11_screen_get_screen_number (screen));
+
+	XGrabServer (display);
+	mate_bg_set_root_pixmap_id (screen, display, pixmap_id);
+
+	XSetWindowBackgroundPixmap (display, xroot, pixmap_id);
+	XClearWindow (display, xroot);
+
+	XFlush (display);
+	XUngrabServer (display);
+}
+
+/**
+ * mate_bg_set_surface_as_root_with_crossfade:
+ * @screen: the #GdkScreen to change root background on
+ * @surface: the cairo xlib surface to set root background from
+ *
+ * Set the root pixmap, and properties pointing to it.
+ * This function differs from mate_bg_set_surface_as_root()
+ * in that it adds a subtle crossfade animation from the
+ * current root pixmap to the new one.
+ *
+ * Return value: (transfer full): a #MateBGCrossfade object
+ **/
+MateBGCrossfade *
+mate_bg_set_surface_as_root_with_crossfade (GdkScreen       *screen,
+		 			    cairo_surface_t *surface)
+{
+	GdkWindow       *root_window;
+	int              width, height;
+	MateBGCrossfade *fade;
+	cairo_t         *cr;
+	cairo_surface_t *old_surface;
+
+	g_return_val_if_fail (screen != NULL, NULL);
+	g_return_val_if_fail (surface != NULL, NULL);
+
+	root_window = gdk_screen_get_root_window (screen);
+	width       = gdk_window_get_width (root_window);
+	height      = gdk_window_get_height (root_window);
+	fade        = mate_bg_crossfade_new (width, height);
+	old_surface = mate_bg_get_surface_from_root (screen);
+
+	mate_bg_crossfade_set_start_surface (fade, old_surface);
+	mate_bg_crossfade_set_end_surface (fade, surface);
+
+	/* Before setting the surface as a root pixmap, let's have it draw
+	 * the old stuff, just so it won't be noticable
+	 * (crossfade will later get it back)
+	 */
+	cr = cairo_create (surface);
+	cairo_set_source_surface (cr, old_surface, 0, 0);
+	cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
+	cairo_paint (cr);
+	cairo_destroy (cr);
+	cairo_surface_destroy (old_surface);
+
+	mate_bg_set_surface_as_root (screen, surface);
+	mate_bg_crossfade_start (fade, root_window);
+
+	return fade;
+}
+
+/* Implementation of the pixbuf cache */
+struct _SlideShow
+{
+	gint ref_count;
+	double start_time;
+	double total_duration;
+
+	GQueue *slides;
+
+	gboolean has_multiple_sizes;
+
+	/* used during parsing */
+	struct tm start_tm;
+	GQueue *stack;
+};
+
+#if GLIB_CHECK_VERSION(2,61,2)
+static double
+now (void)
+{
+	const double microseconds_per_second = (double) G_USEC_PER_SEC;
+	gint64 tv;
+
+	tv = g_get_real_time ();
+
+	return (double) (tv / microseconds_per_second);
+}
+#else
+static double
+now (void)
+{
+	const double microseconds_per_second = (double) G_USEC_PER_SEC;
+	GTimeVal tv;
+
+	g_get_current_time (&tv);
+
+	return (double)tv.tv_sec + (tv.tv_usec / microseconds_per_second);
+}
+#endif
+
+static Slide *
+get_current_slide (SlideShow *show,
+		   double    *alpha)
+{
+	double delta = fmod (now() - show->start_time, show->total_duration);
+	GList *list;
+	double elapsed;
+	int i;
+
+	if (delta < 0)
+		delta += show->total_duration;
+
+	elapsed = 0;
+	i = 0;
+	for (list = show->slides->head; list != NULL; list = list->next) {
+		Slide *slide = list->data;
+
+		if (elapsed + slide->duration > delta) {
+			if (alpha)
+				*alpha = (delta - elapsed) / (double)slide->duration;
+			return slide;
+		}
+
+		i++;
+		elapsed += slide->duration;
+	}
+
+	/* this should never happen since we have slides and we should always
+	 * find a current slide for the elapsed time since beginning -- we're
+	 * looping with fmod() */
+	g_assert_not_reached ();
+
+	return NULL;
+}
+
+static GdkPixbuf *
+blend (GdkPixbuf *p1,
+       GdkPixbuf *p2,
+       double alpha)
+{
+	GdkPixbuf *result = gdk_pixbuf_copy (p1);
+	GdkPixbuf *tmp;
+
+	if (gdk_pixbuf_get_width (p2) != gdk_pixbuf_get_width (p1) ||
+            gdk_pixbuf_get_height (p2) != gdk_pixbuf_get_height (p1)) {
+		tmp = gdk_pixbuf_scale_simple (p2,
+					       gdk_pixbuf_get_width (p1),
+					       gdk_pixbuf_get_height (p1),
+					       GDK_INTERP_BILINEAR);
+	}
+        else {
+		tmp = g_object_ref (p2);
+	}
+
+	pixbuf_blend (tmp, result, 0, 0, -1, -1, 0, 0, alpha);
+
+        g_object_unref (tmp);
+
+	return result;
+}
+
+typedef	enum {
+	PIXBUF,
+	SLIDESHOW,
+	THUMBNAIL
+} FileType;
+
+struct FileCacheEntry
+{
+	FileType type;
+	char *filename;
+	union {
+		GdkPixbuf *pixbuf;
+		SlideShow *slideshow;
+		GdkPixbuf *thumbnail;
+	} u;
+};
+
+static void
+file_cache_entry_delete (FileCacheEntry *ent)
+{
+	g_free (ent->filename);
+
+	switch (ent->type) {
+	case PIXBUF:
+		g_object_unref (ent->u.pixbuf);
+		break;
+	case SLIDESHOW:
+		slideshow_unref (ent->u.slideshow);
+		break;
+	case THUMBNAIL:
+		g_object_unref (ent->u.thumbnail);
+		break;
+	}
+
+	g_free (ent);
+}
+
+static void
+bound_cache (MateBG *bg)
+{
+      while (g_list_length (bg->file_cache) >= CACHE_SIZE) {
+	      GList *last_link = g_list_last (bg->file_cache);
+	      FileCacheEntry *ent = last_link->data;
+
+	      file_cache_entry_delete (ent);
+
+	      bg->file_cache = g_list_delete_link (bg->file_cache, last_link);
+      }
+}
+
+static const FileCacheEntry *
+file_cache_lookup (MateBG *bg, FileType type, const char *filename)
+{
+	GList *list;
+
+	for (list = bg->file_cache; list != NULL; list = list->next) {
+		FileCacheEntry *ent = list->data;
+
+		if (ent && ent->type == type &&
+		    strcmp (ent->filename, filename) == 0) {
+			return ent;
+		}
+	}
+
+	return NULL;
+}
+
+static FileCacheEntry *
+file_cache_entry_new (MateBG *bg,
+		      FileType type,
+		      const char *filename)
+{
+	FileCacheEntry *ent = g_new0 (FileCacheEntry, 1);
+
+	g_assert (!file_cache_lookup (bg, type, filename));
+
+	ent->type = type;
+	ent->filename = g_strdup (filename);
+
+	bg->file_cache = g_list_prepend (bg->file_cache, ent);
+
+	bound_cache (bg);
+
+	return ent;
+}
+
+static void
+file_cache_add_pixbuf (MateBG *bg,
+		       const char *filename,
+		       GdkPixbuf *pixbuf)
+{
+	FileCacheEntry *ent = file_cache_entry_new (bg, PIXBUF, filename);
+	ent->u.pixbuf = g_object_ref (pixbuf);
+}
+
+static void
+file_cache_add_thumbnail (MateBG *bg,
+			  const char *filename,
+			  GdkPixbuf *pixbuf)
+{
+	FileCacheEntry *ent = file_cache_entry_new (bg, THUMBNAIL, filename);
+	ent->u.thumbnail = g_object_ref (pixbuf);
+}
+
+static void
+file_cache_add_slide_show (MateBG *bg,
+			   const char *filename,
+			   SlideShow *show)
+{
+	FileCacheEntry *ent = file_cache_entry_new (bg, SLIDESHOW, filename);
+	ent->u.slideshow = slideshow_ref (show);
+}
+
+static GdkPixbuf *
+load_from_cache_file (MateBG     *bg,
+		      const char *filename,
+		      gint        num_monitor,
+		      gint        best_width,
+		      gint        best_height)
+{
+	GdkPixbuf *pixbuf = NULL;
+	gchar *cache_filename;
+
+	cache_filename = get_wallpaper_cache_filename (filename, num_monitor, bg->placement,
+							best_width, best_height);
+
+	if (cache_file_is_valid (filename, cache_filename))
+		pixbuf = gdk_pixbuf_new_from_file (cache_filename, NULL);
+
+	g_free (cache_filename);
+
+	return pixbuf;
+}
+
+static GdkPixbuf *
+get_as_pixbuf_for_size (MateBG    *bg,
+			const char *filename,
+			gint         monitor,
+			gint         best_width,
+			gint         best_height)
+{
+	const FileCacheEntry *ent;
+	if ((ent = file_cache_lookup (bg, PIXBUF, filename))) {
+		return g_object_ref (ent->u.pixbuf);
+	} else {
+		GdkPixbufFormat *format;
+		GdkPixbuf *pixbuf = NULL;
+		gchar *tmp = NULL;
+		GdkPixbuf *tmp_pixbuf;
+
+		/* Try to hit local cache first if relevant */
+		if (monitor != -1)
+			pixbuf = load_from_cache_file (bg, filename, monitor,
+							best_width, best_height);
+
+		if (!pixbuf) {
+			/* If scalable choose maximum size */
+			format = gdk_pixbuf_get_file_info (filename, NULL, NULL);
+			if (format != NULL)
+				tmp = gdk_pixbuf_format_get_name (format);
+
+			if (g_strcmp0 (tmp, "svg") == 0 &&
+			    (best_width > 0 && best_height > 0) &&
+			    (bg->placement == MATE_BG_PLACEMENT_FILL_SCREEN ||
+			     bg->placement == MATE_BG_PLACEMENT_SCALED ||
+			     bg->placement == MATE_BG_PLACEMENT_ZOOMED))
+			{
+				pixbuf = gdk_pixbuf_new_from_file_at_size (filename,
+									   best_width,
+									   best_height, NULL);
+			} else {
+				pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+			}
+
+			if (tmp != NULL)
+				g_free (tmp);
+		}
+
+		if (pixbuf) {
+			tmp_pixbuf = gdk_pixbuf_apply_embedded_orientation (pixbuf);
+			g_object_unref (pixbuf);
+			pixbuf = tmp_pixbuf;
+			file_cache_add_pixbuf (bg, filename, pixbuf);
+		}
+
+		return pixbuf;
+	}
+}
+
+static SlideShow *
+get_as_slideshow (MateBG *bg, const char *filename)
+{
+	const FileCacheEntry *ent;
+	if ((ent = file_cache_lookup (bg, SLIDESHOW, filename))) {
+		return slideshow_ref (ent->u.slideshow);
+	}
+	else {
+		SlideShow *show = read_slideshow_file (filename, NULL);
+
+		if (show)
+			file_cache_add_slide_show (bg, filename, show);
+
+		return show;
+	}
+}
+
+static GdkPixbuf *
+get_as_thumbnail (MateBG *bg, MateDesktopThumbnailFactory *factory, const char *filename)
+{
+	const FileCacheEntry *ent;
+	if ((ent = file_cache_lookup (bg, THUMBNAIL, filename))) {
+		return g_object_ref (ent->u.thumbnail);
+	}
+	else {
+		GdkPixbuf *thumb = create_thumbnail_for_filename (factory, filename);
+
+		if (thumb)
+			file_cache_add_thumbnail (bg, filename, thumb);
+
+		return thumb;
+	}
+}
+
+static gboolean
+blow_expensive_caches (gpointer data)
+{
+	MateBG *bg = data;
+	GList *list, *next;
+
+	bg->blow_caches_id = 0;
+
+	for (list = bg->file_cache; list != NULL; list = next) {
+		FileCacheEntry *ent = list->data;
+		next = list->next;
+
+		if (ent->type == PIXBUF) {
+			file_cache_entry_delete (ent);
+			bg->file_cache = g_list_delete_link (bg->file_cache,
+							     list);
+		}
+	}
+
+	if (bg->pixbuf_cache) {
+		g_object_unref (bg->pixbuf_cache);
+		bg->pixbuf_cache = NULL;
+	}
+
+	return FALSE;
+}
+
+static void
+blow_expensive_caches_in_idle (MateBG *bg)
+{
+	if (bg->blow_caches_id == 0) {
+		bg->blow_caches_id =
+			g_idle_add (blow_expensive_caches,
+				    bg);
+	}
+}
+
+static gboolean
+on_timeout (gpointer data)
+{
+	MateBG *bg = data;
+
+	bg->timeout_id = 0;
+
+	queue_transitioned (bg);
+
+	return FALSE;
+}
+
+static double
+get_slide_timeout (Slide   *slide)
+{
+	double timeout;
+	if (slide->fixed) {
+		timeout = slide->duration;
+	} else {
+		/* Maybe the number of steps should be configurable? */
+
+		/* In the worst case we will do a fade from 0 to 256, which mean
+		 * we will never use more than 255 steps, however in most cases
+		 * the first and last value are similar and users can't percieve
+		 * changes in pixel values as small as 1/255th. So, lets not waste
+		 * CPU cycles on transitioning to often.
+		 *
+		 * 64 steps is enough for each step to be just detectable in a 16bit
+		 * color mode in the worst case, so we'll use this as an approximation
+		 * of whats detectable.
+		 */
+		timeout = slide->duration / 64.0;
+	}
+	return timeout;
+}
+
+static void
+ensure_timeout (MateBG *bg,
+		Slide   *slide)
+{
+	if (!bg->timeout_id) {
+		double timeout = get_slide_timeout (slide);
+
+		/* G_MAXUINT means "only one slide" */
+		if (timeout < G_MAXUINT) {
+			bg->timeout_id = g_timeout_add_full (
+				G_PRIORITY_LOW,
+				timeout * 1000, on_timeout, bg, NULL);
+		}
+
+	}
+}
+
+static gint64
+get_mtime (const char *filename)
+{
+	GFile     *file;
+	GFileInfo *info;
+	gint64     mtime = (gint64)-1;
+
+	if (filename) {
+		file = g_file_new_for_path (filename);
+		info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED,
+					  G_FILE_QUERY_INFO_NONE, NULL, NULL);
+		if (info) {
+			mtime = g_file_info_get_attribute_uint64 (info,
+								  G_FILE_ATTRIBUTE_TIME_MODIFIED);
+			g_object_unref (info);
+		}
+		g_object_unref (file);
+	}
+
+	return mtime;
+}
+
+static GdkPixbuf *
+scale_thumbnail (MateBGPlacement placement,
+		 const char *filename,
+		 GdkPixbuf *thumb,
+		 GdkScreen *screen,
+		 int	    dest_width,
+		 int	    dest_height)
+{
+	int o_width;
+	int o_height;
+
+	if (placement != MATE_BG_PLACEMENT_TILED &&
+	    placement != MATE_BG_PLACEMENT_CENTERED) {
+
+		/* In this case, the pixbuf will be scaled to fit the screen anyway,
+		 * so just return the pixbuf here
+		 */
+		return g_object_ref (thumb);
+	}
+
+	if (get_thumb_annotations (thumb, &o_width, &o_height)		||
+	    (filename && get_original_size (filename, &o_width, &o_height))) {
+
+		int scr_height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen));
+		int scr_width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen));
+		int thumb_width = gdk_pixbuf_get_width (thumb);
+		int thumb_height = gdk_pixbuf_get_height (thumb);
+		double screen_to_dest = fit_factor (scr_width, scr_height,
+						    dest_width, dest_height);
+		double thumb_to_orig  = fit_factor (thumb_width, thumb_height,
+						    o_width, o_height);
+		double f = thumb_to_orig * screen_to_dest;
+		int new_width, new_height;
+
+		new_width = floor (thumb_width * f + 0.5);
+		new_height = floor (thumb_height * f + 0.5);
+
+		if (placement == MATE_BG_PLACEMENT_TILED) {
+			/* Heuristic to make sure tiles don't become so small that
+			 * they turn into a blur.
+			 *
+			 * This is strictly speaking incorrect, but the resulting
+			 * thumbnail gives a much better idea what the background
+			 * will actually look like.
+			 */
+
+			if ((new_width < 32 || new_height < 32) &&
+			    (new_width < o_width / 4 || new_height < o_height / 4)) {
+				new_width = o_width / 4;
+				new_height = o_height / 4;
+			}
+		}
+
+		thumb = gdk_pixbuf_scale_simple (thumb, new_width, new_height,
+						 GDK_INTERP_BILINEAR);
+	}
+	else
+		g_object_ref (thumb);
+
+	return thumb;
+}
+
+/* frame_num determines which slide to thumbnail.
+ * -1 means 'current slide'.
+ */
+static GdkPixbuf *
+create_img_thumbnail (MateBG                      *bg,
+		      MateDesktopThumbnailFactory *factory,
+		      GdkScreen                    *screen,
+		      int                           dest_width,
+		      int                           dest_height,
+		      int                           frame_num)
+{
+	if (bg->filename) {
+		GdkPixbuf *thumb;
+
+		thumb = get_as_thumbnail (bg, factory, bg->filename);
+
+		if (thumb) {
+			GdkPixbuf *result;
+			result = scale_thumbnail (bg->placement,
+						  bg->filename,
+						  thumb,
+						  screen,
+						  dest_width,
+						  dest_height);
+			g_object_unref (thumb);
+			return result;
+		}
+		else {
+			SlideShow *show = get_as_slideshow (bg, bg->filename);
+
+			if (show) {
+				double alpha;
+				Slide *slide;
+
+				if (frame_num == -1)
+					slide = get_current_slide (show, &alpha);
+				else
+					slide = g_queue_peek_nth (show->slides, frame_num);
+
+				if (slide->fixed) {
+					GdkPixbuf *tmp;
+					FileSize *fs;
+					fs = find_best_size (slide->file1, dest_width, dest_height);
+					tmp = get_as_thumbnail (bg, factory, fs->file);
+					if (tmp) {
+						thumb = scale_thumbnail (bg->placement,
+									 fs->file,
+									 tmp,
+									 screen,
+									 dest_width,
+									 dest_height);
+						g_object_unref (tmp);
+					}
+				}
+				else {
+					FileSize *fs1, *fs2;
+					GdkPixbuf *p1, *p2;
+					fs1 = find_best_size (slide->file1, dest_width, dest_height);
+					p1 = get_as_thumbnail (bg, factory, fs1->file);
+
+					fs2 = find_best_size (slide->file2, dest_width, dest_height);
+					p2 = get_as_thumbnail (bg, factory, fs2->file);
+
+					if (p1 && p2) {
+						GdkPixbuf *thumb1, *thumb2;
+
+						thumb1 = scale_thumbnail (bg->placement,
+									  fs1->file,
+									  p1,
+									  screen,
+									  dest_width,
+									  dest_height);
+
+						thumb2 = scale_thumbnail (bg->placement,
+									  fs2->file,
+									  p2,
+									  screen,
+									  dest_width,
+									  dest_height);
+
+						thumb = blend (thumb1, thumb2, alpha);
+
+						g_object_unref (thumb1);
+						g_object_unref (thumb2);
+					}
+					if (p1)
+						g_object_unref (p1);
+					if (p2)
+						g_object_unref (p2);
+				}
+
+				ensure_timeout (bg, slide);
+
+				slideshow_unref (show);
+			}
+		}
+
+		return thumb;
+	}
+
+	return NULL;
+}
+
+/*
+ * Find the FileSize that best matches the given size.
+ * Do two passes; the first pass only considers FileSizes
+ * that are larger than the given size.
+ * We are looking for the image that best matches the aspect ratio.
+ * When two images have the same aspect ratio, prefer the one whose
+ * width is closer to the given width.
+ */
+static FileSize *
+find_best_size (GSList *sizes, gint width, gint height)
+{
+	GSList *s;
+	gdouble a, d, distance;
+	FileSize *best = NULL;
+	gint pass;
+
+	a = width/(gdouble)height;
+	distance = 10000.0;
+
+	for (pass = 0; pass < 2; pass++) {
+		for (s = sizes; s; s = s->next) {
+			FileSize *size = s->data;
+
+			if (pass == 0 && (size->width < width || size->height < height))
+				continue;
+
+			d = fabs (a - size->width/(gdouble)size->height);
+			if (d < distance) {
+				distance = d;
+				best = size;
+			}
+			else if (d == distance) {
+				if (best && (abs (size->width - width) < abs (best->width - width))) {
+					best = size;
+				}
+			}
+		}
+
+		if (best)
+			break;
+	}
+
+	return best;
+}
+
+static GdkPixbuf *
+get_pixbuf_for_size (MateBG *bg,
+		     gint monitor,
+		     gint best_width,
+		     gint best_height)
+{
+	guint time_until_next_change;
+	gboolean hit_cache = FALSE;
+
+	/* only hit the cache if the aspect ratio matches */
+	if (bg->pixbuf_cache) {
+		int width, height;
+		width = gdk_pixbuf_get_width (bg->pixbuf_cache);
+		height = gdk_pixbuf_get_height (bg->pixbuf_cache);
+		hit_cache = 0.2 > fabs ((best_width / (double)best_height) - (width / (double)height));
+		if (!hit_cache) {
+			g_object_unref (bg->pixbuf_cache);
+			bg->pixbuf_cache = NULL;
+		}
+	}
+
+	if (!hit_cache && bg->filename) {
+		bg->file_mtime = get_mtime (bg->filename);
+
+		bg->pixbuf_cache = get_as_pixbuf_for_size (bg, bg->filename, monitor,
+							   best_width, best_height);
+		time_until_next_change = G_MAXUINT;
+		if (!bg->pixbuf_cache) {
+			SlideShow *show = get_as_slideshow (bg, bg->filename);
+
+			if (show) {
+				double alpha;
+				double timeout;
+				Slide *slide;
+
+				slideshow_ref (show);
+
+				slide = get_current_slide (show, &alpha);
+				timeout = get_slide_timeout (slide);
+				time_until_next_change = (guint) timeout;
+				if (slide->fixed) {
+					FileSize *size = find_best_size (slide->file1,
+									 best_width, best_height);
+					bg->pixbuf_cache =
+						get_as_pixbuf_for_size (bg, size->file, monitor,
+									best_width, best_height);
+				} else {
+					FileSize *size;
+					GdkPixbuf *p1, *p2;
+
+					size = find_best_size (slide->file1,
+								best_width, best_height);
+					p1 = get_as_pixbuf_for_size (bg, size->file, monitor,
+								     best_width, best_height);
+
+					size = find_best_size (slide->file2,
+								best_width, best_height);
+					p2 = get_as_pixbuf_for_size (bg, size->file, monitor,
+								     best_width, best_height);
+
+					if (p1 && p2)
+						bg->pixbuf_cache = blend (p1, p2, alpha);
+					if (p1)
+						g_object_unref (p1);
+					if (p2)
+						g_object_unref (p2);
+				}
+
+				ensure_timeout (bg, slide);
+
+				slideshow_unref (show);
+			}
+		}
+
+		/* If the next slideshow step is a long time away then
+		   we blow away the expensive stuff (large pixbufs) from
+		   the cache */
+		if (time_until_next_change > KEEP_EXPENSIVE_CACHE_SECS)
+		    blow_expensive_caches_in_idle (bg);
+	}
+
+	if (bg->pixbuf_cache)
+		g_object_ref (bg->pixbuf_cache);
+
+	return bg->pixbuf_cache;
+}
+
+static gboolean
+is_different (MateBG    *bg,
+	      const char *filename)
+{
+	if (!filename && bg->filename) {
+		return TRUE;
+	}
+	else if (filename && !bg->filename) {
+		return TRUE;
+	}
+	else if (!filename && !bg->filename) {
+		return FALSE;
+	}
+	else {
+		if (get_mtime (filename) != bg->file_mtime)
+			return TRUE;
+
+		if (strcmp (filename, bg->filename) != 0)
+			return TRUE;
+
+		return FALSE;
+	}
+}
+
+static void
+clear_cache (MateBG *bg)
+{
+	GList *list;
+
+	if (bg->file_cache) {
+		for (list = bg->file_cache; list != NULL; list = list->next) {
+			FileCacheEntry *ent = list->data;
+
+			file_cache_entry_delete (ent);
+		}
+		g_list_free (bg->file_cache);
+		bg->file_cache = NULL;
+	}
+
+	if (bg->pixbuf_cache) {
+		g_object_unref (bg->pixbuf_cache);
+
+		bg->pixbuf_cache = NULL;
+	}
+
+	if (bg->timeout_id) {
+		g_source_remove (bg->timeout_id);
+
+		bg->timeout_id = 0;
+	}
+}
+
+/* Pixbuf utilities */
+static void
+pixbuf_average_value (GdkPixbuf *pixbuf,
+                      GdkRGBA   *result)
+{
+	guint64 a_total, r_total, g_total, b_total;
+	guint row, column;
+	int row_stride;
+	const guchar *pixels, *p;
+	int r, g, b, a;
+	guint64 dividend;
+	guint width, height;
+	gdouble dd;
+
+	width = gdk_pixbuf_get_width (pixbuf);
+	height = gdk_pixbuf_get_height (pixbuf);
+	row_stride = gdk_pixbuf_get_rowstride (pixbuf);
+	pixels = gdk_pixbuf_get_pixels (pixbuf);
+
+	/* iterate through the pixbuf, counting up each component */
+	a_total = 0;
+	r_total = 0;
+	g_total = 0;
+	b_total = 0;
+
+	if (gdk_pixbuf_get_has_alpha (pixbuf)) {
+		for (row = 0; row < height; row++) {
+			p = pixels + (row * row_stride);
+			for (column = 0; column < width; column++) {
+				r = *p++;
+				g = *p++;
+				b = *p++;
+				a = *p++;
+
+				a_total += a;
+				r_total += r * a;
+				g_total += g * a;
+				b_total += b * a;
+			}
+		}
+		dividend = height * width * 0xFF;
+		a_total *= 0xFF;
+	} else {
+		for (row = 0; row < height; row++) {
+			p = pixels + (row * row_stride);
+			for (column = 0; column < width; column++) {
+				r = *p++;
+				g = *p++;
+				b = *p++;
+
+				r_total += r;
+				g_total += g;
+				b_total += b;
+			}
+		}
+		dividend = height * width;
+		a_total = dividend * 0xFF;
+	}
+
+	dd = dividend * 0xFF;
+	result->alpha = a_total / dd;
+	result->red = r_total / dd;
+	result->green = g_total / dd;
+	result->blue = b_total / dd;
+}
+
+static GdkPixbuf *
+pixbuf_scale_to_fit (GdkPixbuf *src, int max_width, int max_height)
+{
+	double factor;
+	int src_width, src_height;
+	int new_width, new_height;
+
+	src_width = gdk_pixbuf_get_width (src);
+	src_height = gdk_pixbuf_get_height (src);
+
+	factor = MIN (max_width  / (double) src_width, max_height / (double) src_height);
+
+	new_width  = floor (src_width * factor + 0.5);
+	new_height = floor (src_height * factor + 0.5);
+
+	return gdk_pixbuf_scale_simple (src, new_width, new_height, GDK_INTERP_BILINEAR);
+}
+
+static GdkPixbuf *
+pixbuf_scale_to_min (GdkPixbuf *src, int min_width, int min_height)
+{
+	double factor;
+	int src_width, src_height;
+	int new_width, new_height;
+	GdkPixbuf *dest;
+
+	src_width = gdk_pixbuf_get_width (src);
+	src_height = gdk_pixbuf_get_height (src);
+
+	factor = MAX (min_width / (double) src_width, min_height / (double) src_height);
+
+	new_width = floor (src_width * factor + 0.5);
+	new_height = floor (src_height * factor + 0.5);
+
+	dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
+			       gdk_pixbuf_get_has_alpha (src),
+			       8, min_width, min_height);
+	if (!dest)
+		return NULL;
+
+	/* crop the result */
+	gdk_pixbuf_scale (src, dest,
+			  0, 0,
+			  min_width, min_height,
+			  (new_width - min_width) / -2,
+			  (new_height - min_height) / -2,
+			  factor,
+			  factor,
+			  GDK_INTERP_BILINEAR);
+	return dest;
+}
+
+static guchar *
+create_gradient (const GdkRGBA *primary,
+		 const GdkRGBA *secondary,
+		 int	         n_pixels)
+{
+	guchar *result = g_malloc (n_pixels * 3);
+	int i;
+
+	for (i = 0; i < n_pixels; ++i) {
+		double ratio = (i + 0.5) / n_pixels;
+
+		result[3 * i + 0] = (guchar) ((primary->red * (1 - ratio) + secondary->red * ratio) * 0x100);
+		result[3 * i + 1] = (guchar) ((primary->green * (1 - ratio) + secondary->green * ratio) * 0x100);
+		result[3 * i + 2] = (guchar) ((primary->blue * (1 - ratio) + secondary->blue * ratio) * 0x100);
+	}
+
+	return result;
+}
+
+static void
+pixbuf_draw_gradient (GdkPixbuf    *pixbuf,
+		      gboolean      horizontal,
+		      GdkRGBA      *primary,
+		      GdkRGBA      *secondary,
+		      GdkRectangle *rect)
+{
+	int width;
+	int height;
+	int rowstride;
+	guchar *dst;
+	int n_channels = 3;
+
+	rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+	width = rect->width;
+	height = rect->height;
+	dst = gdk_pixbuf_get_pixels (pixbuf) + rect->x * n_channels + rowstride * rect->y;
+
+	if (horizontal) {
+		guchar *gradient = create_gradient (primary, secondary, width);
+		int copy_bytes_per_row = width * n_channels;
+		int i;
+
+		for (i = 0; i < height; i++) {
+			guchar *d;
+			d = dst + rowstride * i;
+			memcpy (d, gradient, copy_bytes_per_row);
+		}
+		g_free (gradient);
+	} else {
+		guchar *gb, *gradient;
+		int i;
+
+		gradient = create_gradient (primary, secondary, height);
+		for (i = 0; i < height; i++) {
+			int j;
+			guchar *d;
+
+			d = dst + rowstride * i;
+			gb = gradient + n_channels * i;
+			for (j = width; j > 0; j--) {
+				int k;
+
+				for (k = 0; k < n_channels; k++) {
+					*(d++) = gb[k];
+				}
+			}
+		}
+
+		g_free (gradient);
+	}
+}
+
+static void
+pixbuf_blend (GdkPixbuf *src,
+	      GdkPixbuf *dest,
+	      int	 src_x,
+	      int	 src_y,
+	      int	 src_width,
+	      int        src_height,
+	      int	 dest_x,
+	      int	 dest_y,
+	      double	 alpha)
+{
+	int dest_width = gdk_pixbuf_get_width (dest);
+	int dest_height = gdk_pixbuf_get_height (dest);
+	int offset_x = dest_x - src_x;
+	int offset_y = dest_y - src_y;
+
+	if (src_width < 0)
+		src_width = gdk_pixbuf_get_width (src);
+
+	if (src_height < 0)
+		src_height = gdk_pixbuf_get_height (src);
+
+	if (dest_x < 0)
+		dest_x = 0;
+
+	if (dest_y < 0)
+		dest_y = 0;
+
+	if (dest_x + src_width > dest_width) {
+		src_width = dest_width - dest_x;
+	}
+
+	if (dest_y + src_height > dest_height) {
+		src_height = dest_height - dest_y;
+	}
+
+	gdk_pixbuf_composite (src, dest,
+			      dest_x, dest_y,
+			      src_width, src_height,
+			      offset_x, offset_y,
+			      1, 1, GDK_INTERP_NEAREST,
+			      alpha * 0xFF + 0.5);
+}
+
+static void
+pixbuf_tile (GdkPixbuf *src, GdkPixbuf *dest)
+{
+	int x, y;
+	int tile_width, tile_height;
+	int dest_width = gdk_pixbuf_get_width (dest);
+	int dest_height = gdk_pixbuf_get_height (dest);
+
+	tile_width = gdk_pixbuf_get_width (src);
+	tile_height = gdk_pixbuf_get_height (src);
+
+	for (y = 0; y < dest_height; y += tile_height) {
+		for (x = 0; x < dest_width; x += tile_width) {
+			pixbuf_blend (src, dest, 0, 0,
+				      tile_width, tile_height, x, y, 1.0);
+		}
+	}
+}
+
+static gboolean stack_is (SlideShow *parser, const char *s1, ...);
+
+/* Parser for fading background */
+static void
+handle_start_element (GMarkupParseContext *context,
+		      const gchar         *name,
+		      const gchar        **attr_names,
+		      const gchar        **attr_values,
+		      gpointer             user_data,
+		      GError             **err)
+{
+	SlideShow *parser = user_data;
+	gint i;
+
+	if (strcmp (name, "static") == 0 || strcmp (name, "transition") == 0) {
+		Slide *slide = g_new0 (Slide, 1);
+
+		if (strcmp (name, "static") == 0)
+			slide->fixed = TRUE;
+
+		g_queue_push_tail (parser->slides, slide);
+	}
+	else if (strcmp (name, "size") == 0) {
+		Slide *slide = parser->slides->tail->data;
+		FileSize *size = g_new0 (FileSize, 1);
+		for (i = 0; attr_names[i]; i++) {
+			if (strcmp (attr_names[i], "width") == 0)
+				size->width = atoi (attr_values[i]);
+			else if (strcmp (attr_names[i], "height") == 0)
+				size->height = atoi (attr_values[i]);
+		}
+		if (parser->stack->tail &&
+		    (strcmp (parser->stack->tail->data, "file") == 0 ||
+		     strcmp (parser->stack->tail->data, "from") == 0)) {
+			slide->file1 = g_slist_prepend (slide->file1, size);
+		}
+		else if (parser->stack->tail &&
+			 strcmp (parser->stack->tail->data, "to") == 0) {
+			slide->file2 = g_slist_prepend (slide->file2, size);
+		}
+		else
+			g_free (size);
+	}
+	g_queue_push_tail (parser->stack, g_strdup (name));
+}
+
+static void
+handle_end_element (GMarkupParseContext *context,
+		    const gchar         *name,
+		    gpointer             user_data,
+		    GError             **err)
+{
+	SlideShow *parser = user_data;
+
+	g_free (g_queue_pop_tail (parser->stack));
+}
+
+static gboolean
+stack_is (SlideShow *parser,
+	  const char *s1,
+	  ...)
+{
+	GList *stack = NULL;
+	const char *s;
+	GList *l1, *l2;
+	va_list args;
+
+	stack = g_list_prepend (stack, (gpointer)s1);
+
+	va_start (args, s1);
+
+	s = va_arg (args, const char *);
+	while (s) {
+		stack = g_list_prepend (stack, (gpointer)s);
+		s = va_arg (args, const char *);
+	}
+
+	va_end (args);
+
+	l1 = stack;
+	l2 = parser->stack->head;
+
+	while (l1 && l2) {
+		if (strcmp (l1->data, l2->data) != 0) {
+			g_list_free (stack);
+			return FALSE;
+		}
+
+		l1 = l1->next;
+		l2 = l2->next;
+	}
+
+	g_list_free (stack);
+
+	return (!l1 && !l2);
+}
+
+static int
+parse_int (const char *text)
+{
+	return strtol (text, NULL, 0);
+}
+
+static void
+handle_text (GMarkupParseContext *context,
+	     const gchar         *text,
+	     gsize                text_len,
+	     gpointer             user_data,
+	     GError             **err)
+{
+	SlideShow *parser = user_data;
+	FileSize *fs;
+	gint i;
+
+	g_return_if_fail (parser != NULL);
+	g_return_if_fail (parser->slides != NULL);
+
+	Slide *slide = parser->slides->tail ? parser->slides->tail->data : NULL;
+
+	if (stack_is (parser, "year", "starttime", "background", NULL)) {
+		parser->start_tm.tm_year = parse_int (text) - 1900;
+	}
+	else if (stack_is (parser, "month", "starttime", "background", NULL)) {
+		parser->start_tm.tm_mon = parse_int (text) - 1;
+	}
+	else if (stack_is (parser, "day", "starttime", "background", NULL)) {
+		parser->start_tm.tm_mday = parse_int (text);
+	}
+	else if (stack_is (parser, "hour", "starttime", "background", NULL)) {
+		parser->start_tm.tm_hour = parse_int (text) - 1;
+	}
+	else if (stack_is (parser, "minute", "starttime", "background", NULL)) {
+		parser->start_tm.tm_min = parse_int (text);
+	}
+	else if (stack_is (parser, "second", "starttime", "background", NULL)) {
+		parser->start_tm.tm_sec = parse_int (text);
+	}
+	else if (stack_is (parser, "duration", "static", "background", NULL) ||
+		 stack_is (parser, "duration", "transition", "background", NULL)) {
+		g_return_if_fail (slide != NULL);
+
+		slide->duration = g_strtod (text, NULL);
+		parser->total_duration += slide->duration;
+	}
+	else if (stack_is (parser, "file", "static", "background", NULL) ||
+		 stack_is (parser, "from", "transition", "background", NULL)) {
+		g_return_if_fail (slide != NULL);
+
+		for (i = 0; text[i]; i++) {
+			if (!g_ascii_isspace (text[i]))
+				break;
+		}
+		if (text[i] == 0)
+			return;
+		fs = g_new (FileSize, 1);
+		fs->width = -1;
+		fs->height = -1;
+		fs->file = g_strdup (text);
+		slide->file1 = g_slist_prepend (slide->file1, fs);
+		if (slide->file1->next != NULL)
+			parser->has_multiple_sizes = TRUE;
+	}
+	else if (stack_is (parser, "size", "file", "static", "background", NULL) ||
+		 stack_is (parser, "size", "from", "transition", "background", NULL)) {
+		g_return_if_fail (slide != NULL);
+
+		fs = slide->file1->data;
+		fs->file = g_strdup (text);
+		if (slide->file1->next != NULL)
+			parser->has_multiple_sizes = TRUE;
+	}
+	else if (stack_is (parser, "to", "transition", "background", NULL)) {
+		g_return_if_fail (slide != NULL);
+
+		for (i = 0; text[i]; i++) {
+			if (!g_ascii_isspace (text[i]))
+				break;
+		}
+		if (text[i] == 0)
+			return;
+		fs = g_new (FileSize, 1);
+		fs->width = -1;
+		fs->height = -1;
+		fs->file = g_strdup (text);
+		slide->file2 = g_slist_prepend (slide->file2, fs);
+		if (slide->file2->next != NULL)
+			parser->has_multiple_sizes = TRUE;
+	}
+	else if (stack_is (parser, "size", "to", "transition", "background", NULL)) {
+		g_return_if_fail (slide != NULL);
+
+		fs = slide->file2->data;
+		fs->file = g_strdup (text);
+		if (slide->file2->next != NULL)
+			parser->has_multiple_sizes = TRUE;
+	}
+}
+
+static SlideShow *
+slideshow_ref (SlideShow *show)
+{
+	show->ref_count++;
+	return show;
+}
+
+static void
+slideshow_unref (SlideShow *show)
+{
+	GList *list;
+	GSList *slist;
+	FileSize *size;
+
+	show->ref_count--;
+	if (show->ref_count > 0)
+		return;
+
+	for (list = show->slides->head; list != NULL; list = list->next) {
+		Slide *slide = list->data;
+
+		for (slist = slide->file1; slist != NULL; slist = slist->next) {
+			size = slist->data;
+			g_free (size->file);
+			g_free (size);
+		}
+		g_slist_free (slide->file1);
+
+		for (slist = slide->file2; slist != NULL; slist = slist->next) {
+			size = slist->data;
+			g_free (size->file);
+			g_free (size);
+		}
+		g_slist_free (slide->file2);
+
+		g_free (slide);
+	}
+
+	g_queue_free (show->slides);
+	g_queue_free_full (show->stack, g_free);
+	g_free (show);
+}
+
+static void
+dump_bg (SlideShow *show)
+{
+#if 0
+	GList *list;
+	GSList *slist;
+
+	for (list = show->slides->head; list != NULL; list = list->next)
+	{
+		Slide *slide = list->data;
+
+		g_print ("\nSlide: %s\n", slide->fixed? "fixed" : "transition");
+		g_print ("duration: %f\n", slide->duration);
+		g_print ("File1:\n");
+		for (slist = slide->file1; slist != NULL; slist = slist->next) {
+			FileSize *size = slist->data;
+			g_print ("\t%s (%dx%d)\n",
+				 size->file, size->width, size->height);
+		}
+		g_print ("File2:\n");
+		for (slist = slide->file2; slist != NULL; slist = slist->next) {
+			FileSize *size = slist->data;
+			g_print ("\t%s (%dx%d)\n",
+				 size->file, size->width, size->height);
+		}
+	}
+#endif
+}
+
+static void
+threadsafe_localtime (time_t time, struct tm *tm)
+{
+	struct tm *res;
+
+	G_LOCK_DEFINE_STATIC (localtime_mutex);
+
+	G_LOCK (localtime_mutex);
+
+	res = localtime (&time);
+	if (tm) {
+		*tm = *res;
+	}
+
+	G_UNLOCK (localtime_mutex);
+}
+
+static SlideShow *
+read_slideshow_file (const char *filename,
+		     GError     **err)
+{
+	GMarkupParser parser = {
+		handle_start_element,
+		handle_end_element,
+		handle_text,
+		NULL, /* passthrough */
+		NULL, /* error */
+	};
+
+	GFile *file;
+	char *contents = NULL;
+	gsize len;
+	SlideShow *show = NULL;
+	GMarkupParseContext *context = NULL;
+	time_t t;
+
+	if (!filename)
+		return NULL;
+
+	file = g_file_new_for_path (filename);
+	if (!g_file_load_contents (file, NULL, &contents, &len, NULL, NULL)) {
+		g_object_unref (file);
+		return NULL;
+	}
+	g_object_unref (file);
+
+	show = g_new0 (SlideShow, 1);
+	show->ref_count = 1;
+	threadsafe_localtime ((time_t)0, &show->start_tm);
+	show->stack = g_queue_new ();
+	show->slides = g_queue_new ();
+
+	context = g_markup_parse_context_new (&parser, 0, show, NULL);
+
+	if (!g_markup_parse_context_parse (context, contents, len, err)) {
+		slideshow_unref (show);
+		show = NULL;
+	}
+
+	if (show) {
+		if (!g_markup_parse_context_end_parse (context, err)) {
+			slideshow_unref (show);
+			show = NULL;
+		}
+	}
+
+	g_markup_parse_context_free (context);
+
+	if (show) {
+		guint num_items;
+
+		t = mktime (&show->start_tm);
+
+		show->start_time = (double)t;
+
+		dump_bg (show);
+
+		num_items = g_queue_get_length (show->slides);
+
+		/* no slides, that's not a slideshow */
+		if (num_items == 0) {
+			slideshow_unref (show);
+			show = NULL;
+		/* one slide, there's no transition */
+		} else if (num_items == 1) {
+			Slide *slide = show->slides->head->data;
+			slide->duration = show->total_duration = G_MAXUINT;
+		}
+	}
+
+	g_free (contents);
+
+	return show;
+}
+
+/* Thumbnail utilities */
+static GdkPixbuf *
+create_thumbnail_for_filename (MateDesktopThumbnailFactory *factory,
+			       const char            *filename)
+{
+	char *thumb;
+	gint64 mtime;
+	GdkPixbuf *orig, *result = NULL;
+	char *uri;
+
+	mtime = get_mtime (filename);
+	if (mtime == (gint64)-1)
+		return NULL;
+
+	uri = g_filename_to_uri (filename, NULL, NULL);
+
+	if (uri == NULL)
+		return NULL;
+
+	thumb = mate_desktop_thumbnail_factory_lookup (factory, uri, mtime);
+
+	if (thumb) {
+		result = gdk_pixbuf_new_from_file (thumb, NULL);
+		g_free (thumb);
+	}
+	else {
+		orig = gdk_pixbuf_new_from_file (filename, NULL);
+		if (orig) {
+			int orig_width = gdk_pixbuf_get_width (orig);
+			int orig_height = gdk_pixbuf_get_height (orig);
+
+			result = pixbuf_scale_to_fit (orig, THUMBNAIL_SIZE, THUMBNAIL_SIZE);
+
+			g_object_set_data_full (G_OBJECT (result), "mate-thumbnail-height",
+						g_strdup_printf ("%d", orig_height), g_free);
+			g_object_set_data_full (G_OBJECT (result), "mate-thumbnail-width",
+						g_strdup_printf ("%d", orig_width), g_free);
+
+			g_object_unref (orig);
+
+			mate_desktop_thumbnail_factory_save_thumbnail (factory, result, uri, mtime);
+		}
+		else {
+			mate_desktop_thumbnail_factory_create_failed_thumbnail (factory, uri, mtime);
+		}
+	}
+
+	g_free (uri);
+
+	return result;
+}
+
+static gboolean
+get_thumb_annotations (GdkPixbuf *thumb,
+		       int	 *orig_width,
+		       int	 *orig_height)
+{
+	char *end;
+	const char *wstr, *hstr;
+
+	wstr = gdk_pixbuf_get_option (thumb, "tEXt::Thumb::Image::Width");
+	hstr = gdk_pixbuf_get_option (thumb, "tEXt::Thumb::Image::Height");
+
+	if (hstr && wstr) {
+		*orig_width = strtol (wstr, &end, 10);
+		if (*end != 0)
+			return FALSE;
+
+		*orig_height = strtol (hstr, &end, 10);
+		if (*end != 0)
+			return FALSE;
+
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+static gboolean
+slideshow_has_multiple_sizes (SlideShow *show)
+{
+	return show->has_multiple_sizes;
+}
+
+/*
+ * Returns whether the background is a slideshow.
+ */
+gboolean
+mate_bg_changes_with_time (MateBG *bg)
+{
+	SlideShow *show;
+
+	g_return_val_if_fail (bg != NULL, FALSE);
+
+	if (!bg->filename)
+		return FALSE;
+
+	if ((show = get_as_slideshow (bg, bg->filename)) != NULL) {
+		gboolean result;
+
+		result = (g_queue_get_length (show->slides) > 1) ? TRUE : FALSE;
+		slideshow_unref (show);
+		return result;
+	}
+
+	return FALSE;
+}
+
+/**
+ * mate_bg_create_frame_thumbnail:
+ *
+ * Creates a thumbnail for a certain frame, where 'frame' is somewhat
+ * vaguely defined as 'suitable point to show while single-stepping
+ * through the slideshow'.
+ *
+ * Returns: (transfer full): the newly created thumbnail or
+ * or NULL if frame_num is out of bounds.
+ */
+GdkPixbuf *
+mate_bg_create_frame_thumbnail (MateBG			*bg,
+				 MateDesktopThumbnailFactory	*factory,
+				 GdkScreen			*screen,
+				 int				 dest_width,
+				 int				 dest_height,
+				 int				 frame_num)
+{
+	SlideShow *show;
+	GdkPixbuf *result;
+	GdkPixbuf *thumb;
+        GList *l;
+        int i, skipped;
+        gboolean found;
+
+	g_return_val_if_fail (bg != NULL, FALSE);
+
+	show = get_as_slideshow (bg, bg->filename);
+
+	if (!show)
+		return NULL;
+
+	if (frame_num < 0 || (guint) frame_num >= g_queue_get_length (show->slides))
+		return NULL;
+
+	i = 0;
+	skipped = 0;
+	found = FALSE;
+	for (l = show->slides->head; l; l = l->next) {
+		Slide *slide = l->data;
+		if (!slide->fixed) {
+			skipped++;
+			continue;
+		}
+		if (i == frame_num) {
+			found = TRUE;
+			break;
+		}
+		i++;
+	}
+	if (!found)
+		return NULL;
+
+	result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, dest_width, dest_height);
+
+	draw_color (bg, result);
+
+	if (bg->filename) {
+		thumb = create_img_thumbnail (bg, factory, screen,
+					      dest_width, dest_height,
+					      frame_num + skipped);
+
+		if (thumb) {
+			draw_image_for_thumb (bg, thumb, result);
+			g_object_unref (thumb);
+		}
+	}
+
+	return result;
+}
+
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/68.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/68.html new file mode 100644 index 00000000..80f65d58 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/68.html @@ -0,0 +1,2025 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
+875
+876
+877
+878
+879
+880
+881
+882
+883
+884
+885
+886
+887
+888
+889
+890
+891
+892
+893
+894
/*
+ * GTK - The GIMP Toolkit
+ * Copyright (C) 1998, 1999 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Gnome Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/* Color picker button for GNOME
+ *
+ * Author: Federico Mena <federico@nuclecu.unam.mx>
+ *
+ * Modified by the GTK+ Team and others 2003.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"<--- Include file: "config.h" not found.
+#include "private.h"
+
+#include "mate-colorbutton.h"
+#include "mate-colorsel.h"
+#include "mate-colorseldialog.h"
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkkeysyms.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk-pixbuf/gdk-pixbuf.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n-lib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+/* Size of checks and gray levels for alpha compositing checkerboard */
+#define CHECK_SIZE  4
+#define CHECK_DARK  (1.0 / 3.0)
+#define CHECK_LIGHT (2.0 / 3.0)
+
+struct _MateColorButtonPrivate
+{
+  GtkWidget *draw_area; /* Widget where we draw the color sample */
+  GtkWidget *cs_dialog; /* Color selection dialog */
+
+  gchar *title;         /* Title for the color selection window */
+
+  GdkColor color;
+  guint16 alpha;
+
+  guint use_alpha : 1;  /* Use alpha or not */
+};
+
+/* Properties */
+enum
+{
+  PROP_0,
+  PROP_USE_ALPHA,
+  PROP_TITLE,
+  PROP_COLOR,
+  PROP_ALPHA
+};
+
+/* Signals */
+enum
+{
+  COLOR_SET,
+  LAST_SIGNAL
+};
+
+/* gobject signals */
+static void mate_color_button_finalize      (GObject             *object);
+static void mate_color_button_set_property  (GObject        *object,
+					    guint           param_id,
+					    const GValue   *value,
+					    GParamSpec     *pspec);
+static void mate_color_button_get_property  (GObject        *object,
+					    guint           param_id,
+					    GValue         *value,
+					    GParamSpec     *pspec);
+
+/* gtkwidget signals */
+static void mate_color_button_state_changed (GtkWidget           *widget,
+					    GtkStateType         previous_state);
+
+/* gtkbutton signals */
+static void mate_color_button_clicked       (GtkButton           *button);
+
+/* source side drag signals */
+static void mate_color_button_drag_begin (GtkWidget        *widget,
+					 GdkDragContext   *context,
+					 gpointer          data);
+static void mate_color_button_drag_data_get (GtkWidget        *widget,
+                                            GdkDragContext   *context,
+                                            GtkSelectionData *selection_data,
+                                            guint             info,
+                                            guint             time,
+                                            MateColorButton   *color_button);
+
+/* target side drag signals */
+static void mate_color_button_drag_data_received (GtkWidget        *widget,
+						 GdkDragContext   *context,
+						 gint              x,
+						 gint              y,
+						 GtkSelectionData *selection_data,
+						 guint             info,
+						 guint32           time,
+						 MateColorButton   *color_button);
+
+static guint color_button_signals[LAST_SIGNAL] = { 0 };
+
+static const GtkTargetEntry drop_types[] = { { "application/x-color", 0, 0 } };
+
+G_DEFINE_TYPE_WITH_PRIVATE (MateColorButton, mate_color_button, GTK_TYPE_BUTTON)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
+
+static void
+mate_color_button_class_init (MateColorButtonClass *klass)
+{
+  GObjectClass *gobject_class;
+  GtkWidgetClass *widget_class;
+  GtkButtonClass *button_class;
+
+  gobject_class = G_OBJECT_CLASS (klass);
+  widget_class = GTK_WIDGET_CLASS (klass);
+  button_class = GTK_BUTTON_CLASS (klass);
+
+  gobject_class->get_property = mate_color_button_get_property;
+  gobject_class->set_property = mate_color_button_set_property;
+  gobject_class->finalize = mate_color_button_finalize;
+  widget_class->state_changed = mate_color_button_state_changed;
+  button_class->clicked = mate_color_button_clicked;
+  klass->color_set = NULL;
+
+  /**
+   * MateColorButton:use-alpha:
+   *
+   * If this property is set to %TRUE, the color swatch on the button is rendered against a
+   * checkerboard background to show its opacity and the opacity slider is displayed in the
+   * color selection dialog.
+   *
+   * Since: 1.9.1
+   */
+  g_object_class_install_property (gobject_class,
+                                   PROP_USE_ALPHA,
+                                   g_param_spec_boolean ("use-alpha", _("Use alpha"),
+                                                         _("Whether or not to give the color an alpha value"),
+                                                         FALSE,
+                                                         G_PARAM_READWRITE));
+
+  /**
+   * MateColorButton:title:
+   *
+   * The title of the color selection dialog
+   *
+   * Since: 1.9.1
+   */
+  g_object_class_install_property (gobject_class,
+                                   PROP_TITLE,
+                                   g_param_spec_string ("title",
+							_("Title"),
+                                                        _("The title of the color selection dialog"),
+                                                        _("Pick a Color"),
+                                                        G_PARAM_READWRITE));
+
+  /**
+   * MateColorButton:color:
+   *
+   * The selected color.
+   *
+   * Since: 1.9.1
+   */
+  g_object_class_install_property (gobject_class,
+                                   PROP_COLOR,
+                                   g_param_spec_boxed ("color",
+                                                       _("Current Color"),
+                                                       _("The selected color"),
+                                                       GDK_TYPE_COLOR,
+                                                       G_PARAM_READWRITE));
+
+  /**
+   * MateColorButton:alpha:
+   *
+   * The selected opacity value (0 fully transparent, 65535 fully opaque).
+   *
+   * Since: 1.9.1
+   */
+  g_object_class_install_property (gobject_class,
+                                   PROP_ALPHA,
+                                   g_param_spec_uint ("alpha",
+                                                      _("Current Alpha"),
+                                                      _("The selected opacity value (0 fully transparent, 65535 fully opaque)"),
+                                                      0, 65535, 65535,
+                                                      G_PARAM_READWRITE));
+
+  /**
+   * MateColorButton::color-set:
+   * @widget: the object which received the signal.
+   *
+   * The ::color-set signal is emitted when the user selects a color.
+   * When handling this signal, use mate_color_button_get_color() and
+   * mate_color_button_get_alpha() to find out which color was just selected.
+   *
+   * Note that this signal is only emitted when the <emphasis>user</emphasis>
+   * changes the color. If you need to react to programmatic color changes
+   * as well, use the notify::color signal.
+   *
+   * Since: 1.9.1
+   */
+  color_button_signals[COLOR_SET] = g_signal_new ("color-set",
+						  G_TYPE_FROM_CLASS (gobject_class),
+						  G_SIGNAL_RUN_FIRST,
+						  G_STRUCT_OFFSET (MateColorButtonClass, color_set),
+						  NULL, NULL,
+						  g_cclosure_marshal_VOID__VOID,
+						  G_TYPE_NONE, 0);
+}
+
+static gboolean
+mate_color_button_has_alpha (MateColorButton *color_button)
+{
+  return color_button->priv->use_alpha &&
+      color_button->priv->alpha < 65535;
+}
+
+static cairo_pattern_t *
+mate_color_button_get_checkered (void)
+{
+  /* need to respect pixman's stride being a multiple of 4 */
+  static unsigned char data[8] = { 0xFF, 0x00, 0x00, 0x00,
+                                   0x00, 0xFF, 0x00, 0x00 };
+  static cairo_surface_t *checkered = NULL;
+  cairo_pattern_t *pattern;
+
+  if (checkered == NULL)
+    {
+      checkered = cairo_image_surface_create_for_data (data,
+                                                       CAIRO_FORMAT_A8,
+                                                       2, 2, 4);
+    }
+
+  pattern = cairo_pattern_create_for_surface (checkered);
+  cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
+  cairo_pattern_set_filter (pattern, CAIRO_FILTER_NEAREST);
+
+  return pattern;
+}
+
+/* Handle exposure events for the color picker's drawing area */
+static gboolean
+draw (GtkWidget      *widget,
+      cairo_t        *cr,
+      gpointer        data)
+{
+  MateColorButton *color_button = MATE_COLOR_BUTTON (data);
+  cairo_pattern_t *checkered;
+  GtkStyleContext *context;
+  GdkRGBA  rgba;
+
+  mate_color_button_get_rgba (color_button, &rgba);
+  if (mate_color_button_has_alpha (color_button))
+    {
+      cairo_save (cr);
+
+      cairo_set_source_rgb (cr, CHECK_DARK, CHECK_DARK, CHECK_DARK);
+      cairo_paint (cr);
+
+      cairo_set_source_rgb (cr, CHECK_LIGHT, CHECK_LIGHT, CHECK_LIGHT);
+      cairo_scale (cr, CHECK_SIZE, CHECK_SIZE);
+
+      checkered = mate_color_button_get_checkered ();
+      cairo_mask (cr, checkered);
+      cairo_pattern_destroy (checkered);
+
+      cairo_restore (cr);
+
+      cairo_set_source_rgba (cr,
+                             rgba.red,
+                             rgba.green,
+                             rgba.blue,
+                             rgba.alpha);
+    }
+  else
+    {
+      gdk_cairo_set_source_rgba (cr, &rgba);
+    }
+
+  cairo_paint (cr);
+
+  if (!gtk_widget_is_sensitive (GTK_WIDGET (color_button)))
+    {
+      context = gtk_widget_get_style_context (widget);
+      gtk_style_context_get_color (context, GTK_STATE_FLAG_INSENSITIVE, &rgba);
+      gdk_cairo_set_source_rgba (cr, &rgba);
+      checkered = mate_color_button_get_checkered ();
+      cairo_mask (cr, checkered);
+      cairo_pattern_destroy (checkered);
+    }
+
+  return FALSE;
+}
+
+static void
+mate_color_button_state_changed (GtkWidget   *widget,
+                                GtkStateType previous_state)
+{
+  gtk_widget_queue_draw (widget);
+}
+
+static void
+mate_color_button_drag_data_received (GtkWidget        *widget,
+				     GdkDragContext   *context,
+				     gint              x,
+				     gint              y,
+				     GtkSelectionData *selection_data,
+				     guint             info,
+				     guint32           time,
+				     MateColorButton   *color_button)
+{
+  guint16 *dropped;
+
+  if (gtk_selection_data_get_length (selection_data) < 0)
+    return;
+
+  /* We accept drops with the wrong format, since the KDE color
+   * chooser incorrectly drops application/x-color with format 8.
+   */
+  if (gtk_selection_data_get_length (selection_data) != 8)
+    {
+      g_warning (_("Received invalid color data\n"));
+      return;
+    }
+
+  dropped = (guint16 *)gtk_selection_data_get_data (selection_data);
+
+  color_button->priv->color.red = dropped[0];
+  color_button->priv->color.green = dropped[1];
+  color_button->priv->color.blue = dropped[2];
+  color_button->priv->alpha = dropped[3];
+
+  gtk_widget_queue_draw (color_button->priv->draw_area);
+
+  g_signal_emit (color_button, color_button_signals[COLOR_SET], 0);
+
+  g_object_freeze_notify (G_OBJECT (color_button));
+  g_object_notify (G_OBJECT (color_button), "color");
+  g_object_notify (G_OBJECT (color_button), "alpha");
+  g_object_thaw_notify (G_OBJECT (color_button));
+}
+
+static void
+set_color_icon (GdkDragContext *context,
+		GdkColor       *color)
+{
+  GdkPixbuf *pixbuf;
+  guint32 pixel;
+
+  pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE,
+			   8, 48, 32);
+
+  pixel = ((color->red & 0xff00) << 16) |
+          ((color->green & 0xff00) << 8) |
+           (color->blue & 0xff00);
+
+  gdk_pixbuf_fill (pixbuf, pixel);
+
+  gtk_drag_set_icon_pixbuf (context, pixbuf, -2, -2);
+  g_object_unref (pixbuf);
+}
+
+static void
+mate_color_button_drag_begin (GtkWidget      *widget,
+			     GdkDragContext *context,
+			     gpointer        data)
+{
+  MateColorButton *color_button = data;
+
+  set_color_icon (context, &color_button->priv->color);
+}
+
+static void
+mate_color_button_drag_data_get (GtkWidget        *widget,
+				GdkDragContext   *context,
+				GtkSelectionData *selection_data,
+				guint             info,
+				guint             time,
+				MateColorButton   *color_button)
+{
+  guint16 dropped[4];
+
+  dropped[0] = color_button->priv->color.red;
+  dropped[1] = color_button->priv->color.green;
+  dropped[2] = color_button->priv->color.blue;
+  dropped[3] = color_button->priv->alpha;
+
+  gtk_selection_data_set (selection_data, gtk_selection_data_get_target (selection_data),
+			  16, (guchar *)dropped, 8);
+}
+
+static void
+mate_color_button_init (MateColorButton *color_button)
+{
+  GtkWidget *frame;
+  PangoLayout *layout;
+  PangoRectangle rect;
+
+  _mate_desktop_init_i18n ();
+
+  /* Create the widgets */
+  color_button->priv = mate_color_button_get_instance_private (color_button);
+
+  frame = gtk_frame_new (NULL);
+  gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
+  gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
+  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);
+  gtk_container_add (GTK_CONTAINER (color_button), frame);
+  gtk_widget_show (frame);
+
+  /* Just some widget we can hook to expose-event on */
+  color_button->priv->draw_area = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+  gtk_widget_set_valign (color_button->priv->draw_area, GTK_ALIGN_CENTER);
+  gtk_widget_set_halign (color_button->priv->draw_area, GTK_ALIGN_CENTER);
+
+  layout = gtk_widget_create_pango_layout (GTK_WIDGET (color_button), "Black");
+  pango_layout_get_pixel_extents (layout, NULL, &rect);
+  g_object_unref (layout);
+
+  gtk_widget_set_size_request (color_button->priv->draw_area, rect.width - 2, rect.height - 2);
+  g_signal_connect (color_button->priv->draw_area, "draw",
+                    G_CALLBACK (draw), color_button);
+  gtk_container_add (GTK_CONTAINER (frame), color_button->priv->draw_area);
+  gtk_widget_show (color_button->priv->draw_area);
+
+  color_button->priv->title = g_strdup (_("Pick a Color")); /* default title */
+
+  /* Start with opaque black, alpha disabled */
+
+  color_button->priv->color.red = 0;
+  color_button->priv->color.green = 0;
+  color_button->priv->color.blue = 0;
+  color_button->priv->alpha = 65535;
+  color_button->priv->use_alpha = FALSE;
+
+  gtk_drag_dest_set (GTK_WIDGET (color_button),
+                     GTK_DEST_DEFAULT_MOTION |
+                     GTK_DEST_DEFAULT_HIGHLIGHT |
+                     GTK_DEST_DEFAULT_DROP,
+                     drop_types, 1, GDK_ACTION_COPY);
+  gtk_drag_source_set (GTK_WIDGET(color_button),
+                       GDK_BUTTON1_MASK|GDK_BUTTON3_MASK,
+                       drop_types, 1,
+                       GDK_ACTION_COPY);
+  g_signal_connect (color_button, "drag-begin",
+		    G_CALLBACK (mate_color_button_drag_begin), color_button);
+  g_signal_connect (color_button, "drag-data-received",
+                    G_CALLBACK (mate_color_button_drag_data_received), color_button);
+  g_signal_connect (color_button, "drag-data-get",
+                    G_CALLBACK (mate_color_button_drag_data_get), color_button);
+}
+
+static void
+mate_color_button_finalize (GObject *object)
+{
+  MateColorButton *color_button = MATE_COLOR_BUTTON (object);
+
+  if (color_button->priv->cs_dialog != NULL)
+    gtk_widget_destroy (color_button->priv->cs_dialog);
+  color_button->priv->cs_dialog = NULL;
+
+  g_free (color_button->priv->title);
+  color_button->priv->title = NULL;
+
+  G_OBJECT_CLASS (mate_color_button_parent_class)->finalize (object);
+}
+
+/**
+ * mate_color_button_new:
+ *
+ * Creates a new color button. This returns a widget in the form of
+ * a small button containing a swatch representing the current selected
+ * color. When the button is clicked, a color-selection dialog will open,
+ * allowing the user to select a color. The swatch will be updated to reflect
+ * the new color when the user finishes.
+ *
+ * Returns: a new color button.
+ *
+ * Since: 1.9.1
+ */
+GtkWidget *
+mate_color_button_new (void)
+{
+  return g_object_new (MATE_TYPE_COLOR_BUTTON, NULL);
+}
+
+/**
+ * mate_color_button_new_with_color:
+ * @color: A #GdkColor to set the current color with.
+ *
+ * Creates a new color button.
+ *
+ * Returns: a new color button.
+ *
+ * Since: 1.9.1
+ */
+GtkWidget *
+mate_color_button_new_with_color (const GdkColor *color)
+{
+  return g_object_new (MATE_TYPE_COLOR_BUTTON, "color", color, NULL);
+}
+
+static void
+dialog_ok_clicked (GtkWidget *widget,
+		   gpointer   data)
+{
+  MateColorButton *color_button = MATE_COLOR_BUTTON (data);
+  MateColorSelection *color_selection;
+
+  color_selection = MATE_COLOR_SELECTION (MATE_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog)->colorsel);
+
+  mate_color_selection_get_current_color (color_selection, &color_button->priv->color);
+  color_button->priv->alpha = mate_color_selection_get_current_alpha (color_selection);
+
+  gtk_widget_hide (color_button->priv->cs_dialog);
+
+  gtk_widget_queue_draw (color_button->priv->draw_area);
+
+  g_signal_emit (color_button, color_button_signals[COLOR_SET], 0);
+
+  g_object_freeze_notify (G_OBJECT (color_button));
+  g_object_notify (G_OBJECT (color_button), "color");
+  g_object_notify (G_OBJECT (color_button), "alpha");
+  g_object_thaw_notify (G_OBJECT (color_button));
+}
+
+static gboolean
+dialog_destroy (GtkWidget *widget,
+		gpointer   data)
+{
+  MateColorButton *color_button = MATE_COLOR_BUTTON (data);
+
+  color_button->priv->cs_dialog = NULL;
+
+  return FALSE;
+}
+
+static void
+dialog_cancel_clicked (GtkWidget *widget,
+		       gpointer   data)
+{
+  MateColorButton *color_button = MATE_COLOR_BUTTON (data);
+
+  gtk_widget_hide (color_button->priv->cs_dialog);
+}
+
+static void
+mate_color_button_clicked (GtkButton *button)
+{
+  MateColorButton *color_button = MATE_COLOR_BUTTON (button);
+  MateColorSelectionDialog *color_dialog;
+
+  /* if dialog already exists, make sure it's shown and raised */
+  if (!color_button->priv->cs_dialog)
+    {
+      /* Create the dialog and connects its buttons */
+      GtkWidget *parent;
+
+      parent = gtk_widget_get_toplevel (GTK_WIDGET (color_button));
+
+      color_button->priv->cs_dialog = mate_color_selection_dialog_new (color_button->priv->title);
+
+      color_dialog = MATE_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);
+
+      if (gtk_widget_is_toplevel (parent) && GTK_IS_WINDOW (parent))
+        {
+          if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (color_dialog)))
+ 	    gtk_window_set_transient_for (GTK_WINDOW (color_dialog), GTK_WINDOW (parent));
+
+	  gtk_window_set_modal (GTK_WINDOW (color_dialog),
+				gtk_window_get_modal (GTK_WINDOW (parent)));
+	}
+
+      g_signal_connect (color_dialog->ok_button, "clicked",
+                        G_CALLBACK (dialog_ok_clicked), color_button);
+      g_signal_connect (color_dialog->cancel_button, "clicked",
+			G_CALLBACK (dialog_cancel_clicked), color_button);
+      g_signal_connect (color_dialog, "destroy",
+                        G_CALLBACK (dialog_destroy), color_button);
+    }
+
+  color_dialog = MATE_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);
+
+  mate_color_selection_set_has_opacity_control (MATE_COLOR_SELECTION (color_dialog->colorsel),
+                                               color_button->priv->use_alpha);
+
+  mate_color_selection_set_has_palette (MATE_COLOR_SELECTION (color_dialog->colorsel), TRUE);
+
+  mate_color_selection_set_previous_color (MATE_COLOR_SELECTION (color_dialog->colorsel),
+					  &color_button->priv->color);
+  mate_color_selection_set_previous_alpha (MATE_COLOR_SELECTION (color_dialog->colorsel),
+					  color_button->priv->alpha);
+
+  mate_color_selection_set_current_color (MATE_COLOR_SELECTION (color_dialog->colorsel),
+					 &color_button->priv->color);
+  mate_color_selection_set_current_alpha (MATE_COLOR_SELECTION (color_dialog->colorsel),
+					 color_button->priv->alpha);
+
+  gtk_window_present (GTK_WINDOW (color_button->priv->cs_dialog));
+}
+
+/**
+ * mate_color_button_set_color:
+ * @color_button: a #MateColorButton.
+ * @color: A #GdkColor to set the current color with.
+ *
+ * Sets the current color to be @color.
+ *
+ * Since: 1.9.1
+ **/
+void
+mate_color_button_set_color (MateColorButton *color_button,
+			    const GdkColor *color)
+{
+  g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button));
+  g_return_if_fail (color != NULL);
+
+  color_button->priv->color.red = color->red;
+  color_button->priv->color.green = color->green;
+  color_button->priv->color.blue = color->blue;
+
+  gtk_widget_queue_draw (color_button->priv->draw_area);
+
+  g_object_notify (G_OBJECT (color_button), "color");
+}
+
+/**
+ * mate_color_button_set_rgba:
+ * @color_button: a #MateColorButton.
+ * @color: A #GdkRGBA to set the current color with.
+ *
+ * Sets the current color to be @color.
+ *
+ * Since: 1.9.1
+ **/
+void
+mate_color_button_set_rgba (MateColorButton *color_button,
+			    const GdkRGBA *color)
+{
+  g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button));
+  g_return_if_fail (color != NULL);
+
+  color_button->priv->color.red = color->red * 65535;
+  color_button->priv->color.green = color->green * 65535;
+  color_button->priv->color.blue = color->blue * 65535;
+  color_button->priv->alpha = color->alpha * 65535;
+
+  gtk_widget_queue_draw (color_button->priv->draw_area);
+
+  g_object_notify (G_OBJECT (color_button), "color");
+}
+
+/**
+ * mate_color_button_set_alpha:
+ * @color_button: a #MateColorButton.
+ * @alpha: an integer between 0 and 65535.
+ *
+ * Sets the current opacity to be @alpha.
+ *
+ * Since: 1.9.1
+ **/
+void
+mate_color_button_set_alpha (MateColorButton *color_button,
+			    guint16         alpha)
+{
+  g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button));
+
+  color_button->priv->alpha = alpha;
+
+  gtk_widget_queue_draw (color_button->priv->draw_area);
+
+  g_object_notify (G_OBJECT (color_button), "alpha");
+}
+
+/**
+ * mate_color_button_get_color:
+ * @color_button: a #MateColorButton.
+ * @color: a #GdkColor to fill in with the current color.
+ *
+ * Sets @color to be the current color in the #MateColorButton widget.
+ *
+ * Since: 1.9.1
+ **/
+void
+mate_color_button_get_color (MateColorButton *color_button,
+			    GdkColor       *color)
+{
+  g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button));
+
+  color->red = color_button->priv->color.red;
+  color->green = color_button->priv->color.green;
+  color->blue = color_button->priv->color.blue;
+}
+
+/**
+ * mate_color_button_get_rgba:
+ * @color_button: a #MateColorButton.
+ * @color: a #GdkRGBA to fill in with the current color.
+ *
+ * Sets @color to be the current color in the #MateColorButton widget.
+ *
+ * Since: 1.9.1
+ **/
+void
+mate_color_button_get_rgba (MateColorButton *color_button,
+			                      GdkRGBA         *color)
+{
+  g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button));
+
+  color->red = color_button->priv->color.red / 65535.;
+  color->green = color_button->priv->color.green / 65535.;
+  color->blue = color_button->priv->color.blue / 65535.;
+  color->alpha = color_button->priv->alpha / 65535.;
+}
+
+/**
+ * mate_color_button_get_alpha:
+ * @color_button: a #MateColorButton.
+ *
+ * Returns the current alpha value.
+ *
+ * Return value: an integer between 0 and 65535.
+ *
+ * Since: 1.9.1
+ **/
+guint16
+mate_color_button_get_alpha (MateColorButton *color_button)
+{
+  g_return_val_if_fail (MATE_IS_COLOR_BUTTON (color_button), 0);
+
+  return color_button->priv->alpha;
+}
+
+/**
+ * mate_color_button_set_use_alpha:
+ * @color_button: a #MateColorButton.
+ * @use_alpha: %TRUE if color button should use alpha channel, %FALSE if not.
+ *
+ * Sets whether or not the color button should use the alpha channel.
+ *
+ * Since: 1.9.1
+ */
+void
+mate_color_button_set_use_alpha (MateColorButton *color_button,
+				gboolean        use_alpha)
+{
+  g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button));
+
+  use_alpha = (use_alpha != FALSE);
+
+  if (color_button->priv->use_alpha != use_alpha)
+    {
+      color_button->priv->use_alpha = (use_alpha != FALSE);
+
+      gtk_widget_queue_draw (color_button->priv->draw_area);
+
+      g_object_notify (G_OBJECT (color_button), "use-alpha");
+    }
+}
+
+/**
+ * mate_color_button_get_use_alpha:
+ * @color_button: a #MateColorButton.
+ *
+ * Does the color selection dialog use the alpha channel?
+ *
+ * Returns: %TRUE if the color sample uses alpha channel, %FALSE if not.
+ *
+ * Since: 1.9.1
+ */
+gboolean
+mate_color_button_get_use_alpha (MateColorButton *color_button)
+{
+  g_return_val_if_fail (MATE_IS_COLOR_BUTTON (color_button), FALSE);
+
+  return color_button->priv->use_alpha;
+}
+
+/**
+ * mate_color_button_set_title:
+ * @color_button: a #MateColorButton
+ * @title: String containing new window title.
+ *
+ * Sets the title for the color selection dialog.
+ *
+ * Since: 1.9.1
+ */
+void
+mate_color_button_set_title (MateColorButton *color_button,
+			    const gchar    *title)
+{
+  gchar *old_title;
+
+  g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button));
+
+  old_title = color_button->priv->title;
+  color_button->priv->title = g_strdup (title);
+  g_free (old_title);
+
+  if (color_button->priv->cs_dialog)
+    gtk_window_set_title (GTK_WINDOW (color_button->priv->cs_dialog),
+			  color_button->priv->title);
+
+  g_object_notify (G_OBJECT (color_button), "title");
+}
+
+/**
+ * mate_color_button_get_title:
+ * @color_button: a #MateColorButton
+ *
+ * Gets the title of the color selection dialog.
+ *
+ * Returns: An internal string, do not free the return value
+ *
+ * Since: 1.9.1
+ */
+const gchar *
+mate_color_button_get_title (MateColorButton *color_button)
+{
+  g_return_val_if_fail (MATE_IS_COLOR_BUTTON (color_button), NULL);
+
+  return color_button->priv->title;
+}
+
+static void
+mate_color_button_set_property (GObject      *object,
+			       guint         param_id,
+			       const GValue *value,
+			       GParamSpec   *pspec)
+{
+  MateColorButton *color_button = MATE_COLOR_BUTTON (object);
+
+  switch (param_id)
+    {
+    case PROP_USE_ALPHA:
+      mate_color_button_set_use_alpha (color_button, g_value_get_boolean (value));
+      break;
+    case PROP_TITLE:
+      mate_color_button_set_title (color_button, g_value_get_string (value));
+      break;
+    case PROP_COLOR:
+      mate_color_button_set_color (color_button, g_value_get_boxed (value));
+      break;
+    case PROP_ALPHA:
+      mate_color_button_set_alpha (color_button, g_value_get_uint (value));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+      break;
+    }
+}
+
+static void
+mate_color_button_get_property (GObject    *object,
+			       guint       param_id,
+			       GValue     *value,
+			       GParamSpec *pspec)
+{
+  MateColorButton *color_button = MATE_COLOR_BUTTON (object);
+  GdkColor color;
+
+  switch (param_id)
+    {
+    case PROP_USE_ALPHA:
+      g_value_set_boolean (value, mate_color_button_get_use_alpha (color_button));
+      break;
+    case PROP_TITLE:
+      g_value_set_string (value, mate_color_button_get_title (color_button));
+      break;
+    case PROP_COLOR:
+      mate_color_button_get_color (color_button, &color);
+      g_value_set_boxed (value, &color);
+      break;
+    case PROP_ALPHA:
+      g_value_set_uint (value, mate_color_button_get_alpha (color_button));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+      break;
+    }
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/69.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/69.html new file mode 100644 index 00000000..3945f00e --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/69.html @@ -0,0 +1,309 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
/* private.h: various private functions
+
+   Copyright 2009, Novell, Inc.
+
+   This file is part of the Mate Library.
+
+   The Mate Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Mate 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Mate Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+   Boston, MA 02110-1301, USA.
+
+   Author: Vincent Untz <vuntz@gnome.org>
+*/
+
+#ifndef __MATE_DESKTOP_PRIVATE_H__
+#define __MATE_DESKTOP_PRIVATE_H__
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+void _mate_desktop_init_i18n (void);
+
+G_END_DECLS
+
+#endif
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/7.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/7.html new file mode 100644 index 00000000..541252c6 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/7.html @@ -0,0 +1,937 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */
+/* battstat        A MATE battery meter for laptops.
+ * Copyright (C) 2000 by Jörgen Pehrson <jp@spektr.eu.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <sys/file.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/ioctl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#ifdef HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#ifdef HAVE_ERR_H
+#include <err.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "battstat-preferences.h"
+
+enum {
+  PROP_0,
+  PROP_PROGRESS_DATA
+};
+
+struct _BattstatPreferences
+{
+  GtkDialog parent;
+
+  GtkWidget *radio_text_1;
+  GtkWidget *radio_text_2;
+  GtkWidget *check_text;
+  GtkWidget *check_text_ptr;
+  GtkWidget *lowbatt_toggle;
+  GtkWidget *full_toggle;
+  GtkWidget *hbox_ptr;
+  GtkWidget *combo_ptr;
+  GtkWidget *spin_ptr;
+
+  ProgressData *battstat;
+};
+
+G_DEFINE_TYPE (BattstatPreferences, battstat_preferences, GTK_TYPE_DIALOG);
+
+static void
+combo_ptr_cb (GtkWidget *combo_ptr,
+              gpointer   data)
+{
+  BattstatPreferences *dialog = data;
+
+  if (gtk_combo_box_get_active (GTK_COMBO_BOX (combo_ptr)))
+    dialog->battstat->red_value_is_time = TRUE;
+  else
+    dialog->battstat->red_value_is_time = FALSE;
+
+  g_settings_set_boolean (dialog->battstat->settings,
+                          "red-value-is-time",
+                          dialog->battstat->red_value_is_time);
+}
+
+static void
+spin_ptr_cb (GtkWidget *spin_ptr,
+             gpointer   data)
+{
+  BattstatPreferences *dialog = data;
+  gdouble red_val = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spin_ptr));
+
+  dialog->battstat->red_val = (guint) red_val;
+  /* automatically calculate orangle and yellow values from the
+   * red value
+   */
+  dialog->battstat->orange_val = (guint) (ORANGE_MULTIPLIER * red_val);
+  dialog->battstat->orange_val = MIN (dialog->battstat->orange_val, 100);
+
+  dialog->battstat->yellow_val = (guint) (YELLOW_MULTIPLIER * red_val);
+  dialog->battstat->yellow_val = MIN (dialog->battstat->yellow_val, 100);
+
+  g_settings_set_int (dialog->battstat->settings,
+                      "red-value",
+                      dialog->battstat->red_val);
+}
+
+static void
+show_text_toggled (GtkToggleButton *button,
+                   gpointer         data)
+{
+  BattstatPreferences *dialog = data;
+  gboolean show_text_active;
+
+  show_text_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->check_text));
+  if (show_text_active) {
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->radio_text_1)))
+      dialog->battstat->showtext = APPLET_SHOW_TIME;
+    else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->radio_text_2)))
+      dialog->battstat->showtext = APPLET_SHOW_PERCENT;
+    else
+      dialog->battstat->showtext = APPLET_SHOW_NONE;
+  } else {
+    dialog->battstat->showtext = APPLET_SHOW_NONE;
+  }
+
+  dialog->battstat->refresh_label = TRUE;
+
+  reconfigure_layout (dialog->battstat);
+
+  g_settings_set_int (dialog->battstat->settings,
+                      "show-text",
+                      dialog->battstat->showtext);
+}
+
+static void
+lowbatt_toggled (GtkToggleButton *button,
+                 gpointer         data)
+{
+  BattstatPreferences *dialog = data;
+
+  dialog->battstat->lowbattnotification = gtk_toggle_button_get_active (button);
+}
+
+static void
+full_toggled (GtkToggleButton *button,
+              gpointer         data)
+{
+  BattstatPreferences *dialog = data;
+
+  dialog->battstat->fullbattnot = gtk_toggle_button_get_active (button);
+}
+
+static void
+response_cb (GtkDialog *dialog,
+             gint       id,
+             gpointer   data)
+{
+  BattstatPreferences *self = data;
+
+  if (id == GTK_RESPONSE_HELP)
+    battstat_show_help (self->battstat, "battstat-appearance");
+  else
+    gtk_widget_hide (GTK_WIDGET (dialog));
+}
+
+static void
+battstat_preferences_update (BattstatPreferences *dialog)
+{
+  gboolean check_text_active = TRUE;
+
+  if (!g_settings_is_writable (dialog->battstat->settings, "low-battery-notification")) {
+    gtk_widget_set_sensitive (dialog->lowbatt_toggle, FALSE);
+  }
+
+  gtk_widget_set_sensitive (dialog->hbox_ptr, dialog->battstat->lowbattnotification);
+
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->spin_ptr), dialog->battstat->red_val);
+
+  if (dialog->battstat->red_value_is_time)
+    gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->combo_ptr), 1);
+  else
+    gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->combo_ptr), 0);
+
+  if (!g_settings_is_writable (dialog->battstat->settings, "full-battery-notification"))
+    gtk_widget_set_sensitive (dialog->full_toggle, FALSE);
+
+  if (dialog->battstat->fullbattnot)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->full_toggle), TRUE);
+
+  if (dialog->battstat->lowbattnotification)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->lowbatt_toggle), TRUE);
+
+  if (!g_settings_is_writable (dialog->battstat->settings, "show-text"))
+  {
+    gtk_widget_set_sensitive (dialog->check_text, FALSE);
+    check_text_active = FALSE;
+  }
+  switch (dialog->battstat->showtext) {
+    case APPLET_SHOW_PERCENT:
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->check_text), TRUE);
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->radio_text_2), TRUE);
+      break;
+    case APPLET_SHOW_TIME:
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->check_text), TRUE);
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->radio_text_1), TRUE);
+      break;
+    case APPLET_SHOW_NONE:
+    default:
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->check_text), FALSE);
+      check_text_active = FALSE;
+  }
+  gtk_widget_set_sensitive (dialog->check_text_ptr, check_text_active);
+}
+
+static void
+battstat_preferences_set_property (GObject      *object,
+                                   guint         prop_id,
+                                   const GValue *value,
+                                   GParamSpec   *pspec)
+{
+  BattstatPreferences *dialog;
+
+  dialog = BATTSTAT_PREFERENCES (object);
+
+  switch (prop_id) {
+    case PROP_PROGRESS_DATA:
+      dialog->battstat = g_value_get_pointer (value);
+      break;
+    default:
+      /* We don't have any other property... */
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+battstat_preferences_get_property (GObject    *object,
+                                   guint       prop_id,
+                                   GValue     *value,
+                                   GParamSpec *pspec)
+{
+  BattstatPreferences *dialog;
+
+  dialog = BATTSTAT_PREFERENCES (object);
+
+  switch (prop_id) {
+    case PROP_PROGRESS_DATA:
+      g_value_set_pointer (value, dialog->battstat);
+      break;
+    default:
+      /* We don't have any other property... */
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+battstat_preferences_init (BattstatPreferences *dialog)
+{
+  gtk_widget_init_template (GTK_WIDGET (dialog));
+
+  g_object_bind_property (dialog->check_text, "active",
+                          dialog->check_text_ptr, "sensitive",
+                          G_BINDING_DEFAULT);
+
+  g_object_bind_property (dialog->lowbatt_toggle, "active",
+                          dialog->hbox_ptr, "sensitive",
+                          G_BINDING_DEFAULT);
+}
+
+static GObject*
+battstat_preferences_constructor (GType                  type,
+                                  guint                  n_construct_params,
+                                  GObjectConstructParam *construct_params)
+{
+  GObject *object;
+  BattstatPreferences *self;
+
+  object = G_OBJECT_CLASS (battstat_preferences_parent_class)->
+    constructor (type, n_construct_params, construct_params);
+  self = BATTSTAT_PREFERENCES (object);
+
+  battstat_preferences_update (self);
+
+  g_settings_bind (self->battstat->settings, "low-battery-notification",
+                   self->lowbatt_toggle, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind (self->battstat->settings, "full-battery-notification",
+                   self->full_toggle, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  return object;
+}
+
+GtkWidget*
+battstat_preferences_new (ProgressData *battstat)
+{
+  return g_object_new (BATTSTAT_TYPE_PREFERENCES,
+                       "progress-data", battstat,
+                       NULL);
+}
+
+static void
+battstat_preferences_class_init (BattstatPreferencesClass *klass)
+{
+  GObjectClass   *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->set_property = battstat_preferences_set_property;
+  object_class->get_property = battstat_preferences_get_property;
+  object_class->constructor  = battstat_preferences_constructor;
+
+  g_object_class_install_property (object_class,
+                                   PROP_PROGRESS_DATA,
+                                   g_param_spec_pointer ("progress-data",
+                                                         "Progress Data",
+                                                         "The Progress Data",
+                                                         G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+  gtk_widget_class_set_template_from_resource (widget_class,
+                                               BATTSTAT_RESOURCE_PATH "battstat-preferences.ui");
+
+  gtk_widget_class_bind_template_child (widget_class, BattstatPreferences, check_text);
+  gtk_widget_class_bind_template_child (widget_class, BattstatPreferences, check_text_ptr);
+  gtk_widget_class_bind_template_child (widget_class, BattstatPreferences, radio_text_1);
+  gtk_widget_class_bind_template_child (widget_class, BattstatPreferences, radio_text_2);
+  gtk_widget_class_bind_template_child (widget_class, BattstatPreferences, lowbatt_toggle);
+  gtk_widget_class_bind_template_child (widget_class, BattstatPreferences, full_toggle);
+  gtk_widget_class_bind_template_child (widget_class, BattstatPreferences, hbox_ptr);
+  gtk_widget_class_bind_template_child (widget_class, BattstatPreferences, combo_ptr);
+  gtk_widget_class_bind_template_child (widget_class, BattstatPreferences, spin_ptr);
+
+  gtk_widget_class_bind_template_callback (widget_class, lowbatt_toggled);
+  gtk_widget_class_bind_template_callback (widget_class, combo_ptr_cb);
+  gtk_widget_class_bind_template_callback (widget_class, spin_ptr_cb);
+  gtk_widget_class_bind_template_callback (widget_class, full_toggled);
+  gtk_widget_class_bind_template_callback (widget_class, show_text_toggled);
+  gtk_widget_class_bind_template_callback (widget_class, response_cb);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/70.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/70.html new file mode 100644 index 00000000..2bff82e8 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/70.html @@ -0,0 +1,437 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
/*
+ * GTK - The GIMP Toolkit
+ * Copyright (C) 1998, 1999 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Mate Library; see the file COPYING.LIB. If not,
+ * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* Color picker button for GNOME
+ *
+ * Author: Federico Mena <federico@nuclecu.unam.mx>
+ *
+ * Modified by the GTK+ Team and others 2003.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __MATE_COLOR_BUTTON_H__
+#define __MATE_COLOR_BUTTON_H__
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+/* The MateColorButton widget is a simple color picker in a button.
+ * The button displays a sample of the currently selected color.  When
+ * the user clicks on the button, a color selection dialog pops up.
+ * The color picker emits the "color_set" signal when the color is set.
+ */
+
+#define MATE_TYPE_COLOR_BUTTON             (mate_color_button_get_type ())
+#define MATE_COLOR_BUTTON(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_COLOR_BUTTON, MateColorButton))
+#define MATE_COLOR_BUTTON_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_COLOR_BUTTON, MateColorButtonClass))
+#define MATE_IS_COLOR_BUTTON(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_COLOR_BUTTON))
+#define MATE_IS_COLOR_BUTTON_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_COLOR_BUTTON))
+#define MATE_COLOR_BUTTON_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_COLOR_BUTTON, MateColorButtonClass))
+
+typedef struct _MateColorButton          MateColorButton;
+typedef struct _MateColorButtonClass     MateColorButtonClass;
+typedef struct _MateColorButtonPrivate   MateColorButtonPrivate;
+
+struct _MateColorButton {
+  GtkButton button;
+
+  /*< private >*/
+
+  MateColorButtonPrivate *priv;
+};
+
+struct _MateColorButtonClass {
+  GtkButtonClass parent_class;
+
+  void (* color_set) (MateColorButton *cp);
+
+  /* Padding for future expansion */
+  void (*_gtk_reserved1) (void);
+  void (*_gtk_reserved2) (void);
+  void (*_gtk_reserved3) (void);
+  void (*_gtk_reserved4) (void);
+};
+
+GType      mate_color_button_get_type       (void) G_GNUC_CONST;
+GtkWidget *mate_color_button_new            (void);
+GtkWidget *mate_color_button_new_with_color (const GdkColor *color);
+void       mate_color_button_set_color      (MateColorButton *color_button,
+					    const GdkColor *color);
+void       mate_color_button_set_rgba       (MateColorButton *color_button,
+					     const GdkRGBA   *color);
+void       mate_color_button_set_alpha      (MateColorButton *color_button,
+					    guint16         alpha);
+void       mate_color_button_get_color      (MateColorButton *color_button,
+					    GdkColor       *color);
+void       mate_color_button_get_rgba       (MateColorButton *color_button,
+					     GdkRGBA         *color);
+guint16    mate_color_button_get_alpha      (MateColorButton *color_button);
+void       mate_color_button_set_use_alpha  (MateColorButton *color_button,
+					    gboolean        use_alpha);
+gboolean   mate_color_button_get_use_alpha  (MateColorButton *color_button);
+void       mate_color_button_set_title      (MateColorButton *color_button,
+					    const gchar    *title);
+const gchar *mate_color_button_get_title (MateColorButton *color_button);
+
+G_END_DECLS
+
+#endif  /* __MATE_COLOR_BUTTON_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/71.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/71.html new file mode 100644 index 00000000..5e006a2f --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/71.html @@ -0,0 +1,489 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
/* GTK - The GIMP Toolkit
+ * Copyright (C) 2000 Red Hat, Inc.
+ * 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __MATE_COLOR_SELECTION_H__
+#define __MATE_COLOR_SELECTION_H__
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define MATE_TYPE_COLOR_SELECTION			(mate_color_selection_get_type ())
+#define MATE_COLOR_SELECTION(obj)			(G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_COLOR_SELECTION, MateColorSelection))
+#define MATE_COLOR_SELECTION_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_COLOR_SELECTION, MateColorSelectionClass))
+#define MATE_IS_COLOR_SELECTION(obj)			(G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_COLOR_SELECTION))
+#define MATE_IS_COLOR_SELECTION_CLASS(klass)		(G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_COLOR_SELECTION))
+#define MATE_COLOR_SELECTION_GET_CLASS(obj)              (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_COLOR_SELECTION, MateColorSelectionClass))
+
+typedef struct _MateColorSelection       MateColorSelection;
+typedef struct _MateColorSelectionClass  MateColorSelectionClass;
+typedef struct _MateColorSelectionPrivate    MateColorSelectionPrivate;
+
+typedef void (* MateColorSelectionChangePaletteFunc) (const GdkColor    *colors,
+                                                     gint               n_colors);
+typedef void (* MateColorSelectionChangePaletteWithScreenFunc) (GdkScreen         *screen,
+							       const GdkColor    *colors,
+							       gint               n_colors);
+
+struct _MateColorSelection
+{
+  GtkBox parent_instance;
+
+  /* < private_data > */
+  MateColorSelectionPrivate *private_data;
+};
+
+struct _MateColorSelectionClass
+{
+  GtkBoxClass parent_class;
+
+  void (*color_changed)	(MateColorSelection *color_selection);
+
+  /* Padding for future expansion */
+  void (*_gtk_reserved1) (void);
+  void (*_gtk_reserved2) (void);
+  void (*_gtk_reserved3) (void);
+  void (*_gtk_reserved4) (void);
+};
+
+/* ColorSelection */
+
+GType      mate_color_selection_get_type                (void) G_GNUC_CONST;
+GtkWidget *mate_color_selection_new                     (void);
+gboolean   mate_color_selection_get_has_opacity_control (MateColorSelection *colorsel);
+void       mate_color_selection_set_has_opacity_control (MateColorSelection *colorsel,
+							gboolean           has_opacity);
+gboolean   mate_color_selection_get_has_palette         (MateColorSelection *colorsel);
+void       mate_color_selection_set_has_palette         (MateColorSelection *colorsel,
+							gboolean           has_palette);
+
+void     mate_color_selection_set_current_color   (MateColorSelection *colorsel,
+						  const GdkColor    *color);
+void     mate_color_selection_set_current_alpha   (MateColorSelection *colorsel,
+						  guint16            alpha);
+void     mate_color_selection_get_current_color   (MateColorSelection *colorsel,
+						  GdkColor          *color);
+guint16  mate_color_selection_get_current_alpha   (MateColorSelection *colorsel);
+void     mate_color_selection_set_previous_color  (MateColorSelection *colorsel,
+						  const GdkColor    *color);
+void     mate_color_selection_set_previous_alpha  (MateColorSelection *colorsel,
+						  guint16            alpha);
+void     mate_color_selection_get_previous_color  (MateColorSelection *colorsel,
+						  GdkColor          *color);
+guint16  mate_color_selection_get_previous_alpha  (MateColorSelection *colorsel);
+
+gboolean mate_color_selection_is_adjusting        (MateColorSelection *colorsel);
+
+gboolean mate_color_selection_palette_from_string (const gchar       *str,
+                                                  GdkColor         **colors,
+                                                  gint              *n_colors);
+gchar*   mate_color_selection_palette_to_string   (const GdkColor    *colors,
+                                                  gint               n_colors);
+
+#ifndef GTK_DISABLE_DEPRECATED
+#ifndef GDK_MULTIHEAD_SAFE
+MateColorSelectionChangePaletteFunc           mate_color_selection_set_change_palette_hook             (MateColorSelectionChangePaletteFunc           func);
+#endif
+#endif
+
+MateColorSelectionChangePaletteWithScreenFunc mate_color_selection_set_change_palette_with_screen_hook (MateColorSelectionChangePaletteWithScreenFunc func);
+
+#ifndef GTK_DISABLE_DEPRECATED
+/* Deprecated calls: */
+void mate_color_selection_set_color         (MateColorSelection *colorsel,
+					    gdouble           *color);
+void mate_color_selection_get_color         (MateColorSelection *colorsel,
+					    gdouble           *color);
+#endif /* GTK_DISABLE_DEPRECATED */
+
+G_END_DECLS
+
+#endif /* __MATE_COLOR_SELECTION_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/72.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/72.html new file mode 100644 index 00000000..b1d77ffd --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/72.html @@ -0,0 +1,383 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
/* 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __MATE_COLOR_SELECTION_DIALOG_H__
+#define __MATE_COLOR_SELECTION_DIALOG_H__
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define MATE_TYPE_COLOR_SELECTION_DIALOG            (mate_color_selection_dialog_get_type ())
+#define MATE_COLOR_SELECTION_DIALOG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_COLOR_SELECTION_DIALOG, MateColorSelectionDialog))
+#define MATE_COLOR_SELECTION_DIALOG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_COLOR_SELECTION_DIALOG, MateColorSelectionDialogClass))
+#define MATE_IS_COLOR_SELECTION_DIALOG(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_COLOR_SELECTION_DIALOG))
+#define MATE_IS_COLOR_SELECTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_COLOR_SELECTION_DIALOG))
+#define MATE_COLOR_SELECTION_DIALOG_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_COLOR_SELECTION_DIALOG, MateColorSelectionDialogClass))
+
+typedef struct _MateColorSelectionDialog       MateColorSelectionDialog;
+typedef struct _MateColorSelectionDialogClass  MateColorSelectionDialogClass;
+
+struct _MateColorSelectionDialog
+{
+  GtkDialog parent_instance;
+
+  GtkWidget *colorsel;
+  GtkWidget *ok_button;
+  GtkWidget *cancel_button;
+  GtkWidget *help_button;
+};
+
+struct _MateColorSelectionDialogClass
+{
+  GtkDialogClass parent_class;
+
+  /* Padding for future expansion */
+  void (*_gtk_reserved1) (void);
+  void (*_gtk_reserved2) (void);
+  void (*_gtk_reserved3) (void);
+  void (*_gtk_reserved4) (void);
+};
+
+/* ColorSelectionDialog */
+GType      mate_color_selection_dialog_get_type            (void) G_GNUC_CONST;
+GtkWidget* mate_color_selection_dialog_new                 (const gchar *title);
+GtkWidget* mate_color_selection_dialog_get_color_selection (MateColorSelectionDialog *colorsel);
+
+G_END_DECLS
+
+#endif /* __MATE_COLOR_SELECTION_DIALOG_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/73.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/73.html new file mode 100644 index 00000000..14071110 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/73.html @@ -0,0 +1,6079 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+1545
+1546
+1547
+1548
+1549
+1550
+1551
+1552
+1553
+1554
+1555
+1556
+1557
+1558
+1559
+1560
+1561
+1562
+1563
+1564
+1565
+1566
+1567
+1568
+1569
+1570
+1571
+1572
+1573
+1574
+1575
+1576
+1577
+1578
+1579
+1580
+1581
+1582
+1583
+1584
+1585
+1586
+1587
+1588
+1589
+1590
+1591
+1592
+1593
+1594
+1595
+1596
+1597
+1598
+1599
+1600
+1601
+1602
+1603
+1604
+1605
+1606
+1607
+1608
+1609
+1610
+1611
+1612
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+1631
+1632
+1633
+1634
+1635
+1636
+1637
+1638
+1639
+1640
+1641
+1642
+1643
+1644
+1645
+1646
+1647
+1648
+1649
+1650
+1651
+1652
+1653
+1654
+1655
+1656
+1657
+1658
+1659
+1660
+1661
+1662
+1663
+1664
+1665
+1666
+1667
+1668
+1669
+1670
+1671
+1672
+1673
+1674
+1675
+1676
+1677
+1678
+1679
+1680
+1681
+1682
+1683
+1684
+1685
+1686
+1687
+1688
+1689
+1690
+1691
+1692
+1693
+1694
+1695
+1696
+1697
+1698
+1699
+1700
+1701
+1702
+1703
+1704
+1705
+1706
+1707
+1708
+1709
+1710
+1711
+1712
+1713
+1714
+1715
+1716
+1717
+1718
+1719
+1720
+1721
+1722
+1723
+1724
+1725
+1726
+1727
+1728
+1729
+1730
+1731
+1732
+1733
+1734
+1735
+1736
+1737
+1738
+1739
+1740
+1741
+1742
+1743
+1744
+1745
+1746
+1747
+1748
+1749
+1750
+1751
+1752
+1753
+1754
+1755
+1756
+1757
+1758
+1759
+1760
+1761
+1762
+1763
+1764
+1765
+1766
+1767
+1768
+1769
+1770
+1771
+1772
+1773
+1774
+1775
+1776
+1777
+1778
+1779
+1780
+1781
+1782
+1783
+1784
+1785
+1786
+1787
+1788
+1789
+1790
+1791
+1792
+1793
+1794
+1795
+1796
+1797
+1798
+1799
+1800
+1801
+1802
+1803
+1804
+1805
+1806
+1807
+1808
+1809
+1810
+1811
+1812
+1813
+1814
+1815
+1816
+1817
+1818
+1819
+1820
+1821
+1822
+1823
+1824
+1825
+1826
+1827
+1828
+1829
+1830
+1831
+1832
+1833
+1834
+1835
+1836
+1837
+1838
+1839
+1840
+1841
+1842
+1843
+1844
+1845
+1846
+1847
+1848
+1849
+1850
+1851
+1852
+1853
+1854
+1855
+1856
+1857
+1858
+1859
+1860
+1861
+1862
+1863
+1864
+1865
+1866
+1867
+1868
+1869
+1870
+1871
+1872
+1873
+1874
+1875
+1876
+1877
+1878
+1879
+1880
+1881
+1882
+1883
+1884
+1885
+1886
+1887
+1888
+1889
+1890
+1891
+1892
+1893
+1894
+1895
+1896
+1897
+1898
+1899
+1900
+1901
+1902
+1903
+1904
+1905
+1906
+1907
+1908
+1909
+1910
+1911
+1912
+1913
+1914
+1915
+1916
+1917
+1918
+1919
+1920
+1921
+1922
+1923
+1924
+1925
+1926
+1927
+1928
+1929
+1930
+1931
+1932
+1933
+1934
+1935
+1936
+1937
+1938
+1939
+1940
+1941
+1942
+1943
+1944
+1945
+1946
+1947
+1948
+1949
+1950
+1951
+1952
+1953
+1954
+1955
+1956
+1957
+1958
+1959
+1960
+1961
+1962
+1963
+1964
+1965
+1966
+1967
+1968
+1969
+1970
+1971
+1972
+1973
+1974
+1975
+1976
+1977
+1978
+1979
+1980
+1981
+1982
+1983
+1984
+1985
+1986
+1987
+1988
+1989
+1990
+1991
+1992
+1993
+1994
+1995
+1996
+1997
+1998
+1999
+2000
+2001
+2002
+2003
+2004
+2005
+2006
+2007
+2008
+2009
+2010
+2011
+2012
+2013
+2014
+2015
+2016
+2017
+2018
+2019
+2020
+2021
+2022
+2023
+2024
+2025
+2026
+2027
+2028
+2029
+2030
+2031
+2032
+2033
+2034
+2035
+2036
+2037
+2038
+2039
+2040
+2041
+2042
+2043
+2044
+2045
+2046
+2047
+2048
+2049
+2050
+2051
+2052
+2053
+2054
+2055
+2056
+2057
+2058
+2059
+2060
+2061
+2062
+2063
+2064
+2065
+2066
+2067
+2068
+2069
+2070
+2071
+2072
+2073
+2074
+2075
+2076
+2077
+2078
+2079
+2080
+2081
+2082
+2083
+2084
+2085
+2086
+2087
+2088
+2089
+2090
+2091
+2092
+2093
+2094
+2095
+2096
+2097
+2098
+2099
+2100
+2101
+2102
+2103
+2104
+2105
+2106
+2107
+2108
+2109
+2110
+2111
+2112
+2113
+2114
+2115
+2116
+2117
+2118
+2119
+2120
+2121
+2122
+2123
+2124
+2125
+2126
+2127
+2128
+2129
+2130
+2131
+2132
+2133
+2134
+2135
+2136
+2137
+2138
+2139
+2140
+2141
+2142
+2143
+2144
+2145
+2146
+2147
+2148
+2149
+2150
+2151
+2152
+2153
+2154
+2155
+2156
+2157
+2158
+2159
+2160
+2161
+2162
+2163
+2164
+2165
+2166
+2167
+2168
+2169
+2170
+2171
+2172
+2173
+2174
+2175
+2176
+2177
+2178
+2179
+2180
+2181
+2182
+2183
+2184
+2185
+2186
+2187
+2188
+2189
+2190
+2191
+2192
+2193
+2194
+2195
+2196
+2197
+2198
+2199
+2200
+2201
+2202
+2203
+2204
+2205
+2206
+2207
+2208
+2209
+2210
+2211
+2212
+2213
+2214
+2215
+2216
+2217
+2218
+2219
+2220
+2221
+2222
+2223
+2224
+2225
+2226
+2227
+2228
+2229
+2230
+2231
+2232
+2233
+2234
+2235
+2236
+2237
+2238
+2239
+2240
+2241
+2242
+2243
+2244
+2245
+2246
+2247
+2248
+2249
+2250
+2251
+2252
+2253
+2254
+2255
+2256
+2257
+2258
+2259
+2260
+2261
+2262
+2263
+2264
+2265
+2266
+2267
+2268
+2269
+2270
+2271
+2272
+2273
+2274
+2275
+2276
+2277
+2278
+2279
+2280
+2281
+2282
+2283
+2284
+2285
+2286
+2287
+2288
+2289
+2290
+2291
+2292
+2293
+2294
+2295
+2296
+2297
+2298
+2299
+2300
+2301
+2302
+2303
+2304
+2305
+2306
+2307
+2308
+2309
+2310
+2311
+2312
+2313
+2314
+2315
+2316
+2317
+2318
+2319
+2320
+2321
+2322
+2323
+2324
+2325
+2326
+2327
+2328
+2329
+2330
+2331
+2332
+2333
+2334
+2335
+2336
+2337
+2338
+2339
+2340
+2341
+2342
+2343
+2344
+2345
+2346
+2347
+2348
+2349
+2350
+2351
+2352
+2353
+2354
+2355
+2356
+2357
+2358
+2359
+2360
+2361
+2362
+2363
+2364
+2365
+2366
+2367
+2368
+2369
+2370
+2371
+2372
+2373
+2374
+2375
+2376
+2377
+2378
+2379
+2380
+2381
+2382
+2383
+2384
+2385
+2386
+2387
+2388
+2389
+2390
+2391
+2392
+2393
+2394
+2395
+2396
+2397
+2398
+2399
+2400
+2401
+2402
+2403
+2404
+2405
+2406
+2407
+2408
+2409
+2410
+2411
+2412
+2413
+2414
+2415
+2416
+2417
+2418
+2419
+2420
+2421
+2422
+2423
+2424
+2425
+2426
+2427
+2428
+2429
+2430
+2431
+2432
+2433
+2434
+2435
+2436
+2437
+2438
+2439
+2440
+2441
+2442
+2443
+2444
+2445
+2446
+2447
+2448
+2449
+2450
+2451
+2452
+2453
+2454
+2455
+2456
+2457
+2458
+2459
+2460
+2461
+2462
+2463
+2464
+2465
+2466
+2467
+2468
+2469
+2470
+2471
+2472
+2473
+2474
+2475
+2476
+2477
+2478
+2479
+2480
+2481
+2482
+2483
+2484
+2485
+2486
+2487
+2488
+2489
+2490
+2491
+2492
+2493
+2494
+2495
+2496
+2497
+2498
+2499
+2500
+2501
+2502
+2503
+2504
+2505
+2506
+2507
+2508
+2509
+2510
+2511
+2512
+2513
+2514
+2515
+2516
+2517
+2518
+2519
+2520
+2521
+2522
+2523
+2524
+2525
+2526
+2527
+2528
+2529
+2530
+2531
+2532
+2533
+2534
+2535
+2536
+2537
+2538
+2539
+2540
+2541
+2542
+2543
+2544
+2545
+2546
+2547
+2548
+2549
+2550
+2551
+2552
+2553
+2554
+2555
+2556
+2557
+2558
+2559
+2560
+2561
+2562
+2563
+2564
+2565
+2566
+2567
+2568
+2569
+2570
+2571
+2572
+2573
+2574
+2575
+2576
+2577
+2578
+2579
+2580
+2581
+2582
+2583
+2584
+2585
+2586
+2587
+2588
+2589
+2590
+2591
+2592
+2593
+2594
+2595
+2596
+2597
+2598
+2599
+2600
+2601
+2602
+2603
+2604
+2605
+2606
+2607
+2608
+2609
+2610
+2611
+2612
+2613
+2614
+2615
+2616
+2617
+2618
+2619
+2620
+2621
+2622
+2623
+2624
+2625
+2626
+2627
+2628
+2629
+2630
+2631
+2632
+2633
+2634
+2635
+2636
+2637
+2638
+2639
+2640
+2641
+2642
+2643
+2644
+2645
+2646
+2647
+2648
+2649
+2650
+2651
+2652
+2653
+2654
+2655
+2656
+2657
+2658
+2659
+2660
+2661
+2662
+2663
+2664
+2665
+2666
+2667
+2668
+2669
+2670
+2671
+2672
+2673
+2674
+2675
+2676
+2677
+2678
+2679
+2680
+2681
+2682
+2683
+2684
+2685
+2686
+2687
+2688
+2689
+2690
+2691
+2692
+2693
+2694
+2695
+2696
+2697
+2698
+2699
+2700
+2701
+2702
+2703
+2704
+2705
+2706
+2707
+2708
+2709
+2710
+2711
+2712
+2713
+2714
+2715
+2716
+2717
+2718
+2719
+2720
+2721
+2722
+2723
+2724
+2725
+2726
+2727
+2728
+2729
+2730
+2731
+2732
+2733
+2734
+2735
+2736
+2737
+2738
+2739
+2740
+2741
+2742
+2743
+2744
+2745
+2746
+2747
+2748
+2749
+2750
+2751
+2752
+2753
+2754
+2755
+2756
+2757
+2758
+2759
+2760
+2761
+2762
+2763
+2764
+2765
+2766
+2767
+2768
+2769
+2770
+2771
+2772
+2773
+2774
+2775
+2776
+2777
+2778
+2779
+2780
+2781
+2782
+2783
+2784
+2785
+2786
+2787
+2788
+2789
+2790
+2791
+2792
+2793
+2794
+2795
+2796
+2797
+2798
+2799
+2800
+2801
+2802
+2803
+2804
+2805
+2806
+2807
+2808
+2809
+2810
+2811
+2812
+2813
+2814
+2815
+2816
+2817
+2818
+2819
+2820
+2821
+2822
+2823
+2824
+2825
+2826
+2827
+2828
+2829
+2830
+2831
+2832
+2833
+2834
+2835
+2836
+2837
+2838
+2839
+2840
+2841
+2842
+2843
+2844
+2845
+2846
+2847
+2848
+2849
+2850
+2851
+2852
+2853
+2854
+2855
+2856
+2857
+2858
+2859
+2860
+2861
+2862
+2863
+2864
+2865
+2866
+2867
+2868
+2869
+2870
+2871
+2872
+2873
+2874
+2875
+2876
+2877
+2878
+2879
+2880
+2881
+2882
+2883
+2884
+2885
+2886
+2887
+2888
+2889
+2890
+2891
+2892
+2893
+2894
+2895
+2896
+2897
+2898
+2899
+2900
+2901
+2902
+2903
+2904
+2905
+2906
+2907
+2908
+2909
+2910
+2911
+2912
+2913
+2914
+2915
+2916
+2917
+2918
+2919
+2920
+2921
/* GTK - The GIMP Toolkit
+ * Copyright (C) 2000 Red Hat, Inc.
+ * 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2001.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"<--- Include file: "config.h" not found.
+#include "private.h"
+#include <math.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkkeysyms.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n-lib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "mate-colorsel.h"
+#include "mate-hsv.h"
+
+#define DEFAULT_COLOR_PALETTE "#ef2929:#fcaf3e:#fce94f:#8ae234:#729fcf:#ad7fa8:#e9b96e:#888a85:#eeeeec:#cc0000:#f57900:#edd400:#73d216:#3465a4:#75507b:#c17d11:#555753:#d3d7cf:#a40000:#ce5c00:#c4a000:#4e9a06:#204a87:#5c3566:#8f5902:#2e3436:#babdb6:#000000:#2e3436:#555753:#888a85:#babdb6:#d3d7cf:#eeeeec:#f3f3f3:#ffffff"
+
+/* Number of elements in the custom palatte */
+#define GTK_CUSTOM_PALETTE_WIDTH 9
+#define GTK_CUSTOM_PALETTE_HEIGHT 4
+
+#define CUSTOM_PALETTE_ENTRY_WIDTH   20
+#define CUSTOM_PALETTE_ENTRY_HEIGHT  20
+
+/* The cursor for the dropper */
+#define DROPPER_WIDTH 16
+#define DROPPER_HEIGHT 16
+#define DROPPER_STRIDE 64
+#define DROPPER_X_HOT 2
+#define DROPPER_Y_HOT 16
+
+#define CHECK_SIZE 16
+#define BIG_STEP 20
+
+/* Conversion between 0->1 double and and guint16. See
+ * scale_round() below for more general conversions
+ */
+#define SCALE(i) (i / 65535.)
+#define UNSCALE(d) ((guint16)(d * 65535 + 0.5))
+#define INTENSITY(r, g, b) ((r) * 0.30 + (g) * 0.59 + (b) * 0.11)
+
+enum {
+  COLOR_CHANGED,
+  LAST_SIGNAL
+};
+
+enum {
+  PROP_0,
+  PROP_HAS_PALETTE,
+  PROP_HAS_OPACITY_CONTROL,
+  PROP_CURRENT_COLOR,
+  PROP_CURRENT_ALPHA,
+  PROP_HEX_STRING
+};
+
+enum {
+  COLORSEL_RED = 0,
+  COLORSEL_GREEN = 1,
+  COLORSEL_BLUE = 2,
+  COLORSEL_OPACITY = 3,
+  COLORSEL_HUE,
+  COLORSEL_SATURATION,
+  COLORSEL_VALUE,
+  COLORSEL_NUM_CHANNELS
+};
+
+struct _MateColorSelectionPrivate
+{
+  guint has_opacity : 1;
+  guint has_palette : 1;
+  guint changing : 1;
+  guint default_set : 1;
+  guint default_alpha_set : 1;
+  guint has_grab : 1;
+
+  gdouble color[COLORSEL_NUM_CHANNELS];
+  gdouble old_color[COLORSEL_NUM_CHANNELS];
+
+  GtkWidget *triangle_colorsel;
+  GtkWidget *hue_spinbutton;
+  GtkWidget *sat_spinbutton;
+  GtkWidget *val_spinbutton;
+  GtkWidget *red_spinbutton;
+  GtkWidget *green_spinbutton;
+  GtkWidget *blue_spinbutton;
+  GtkWidget *opacity_slider;
+  GtkWidget *opacity_label;
+  GtkWidget *opacity_entry;
+  GtkWidget *palette_frame;
+  GtkWidget *hex_entry;
+
+  /* The Palette code */
+  GtkWidget *custom_palette [GTK_CUSTOM_PALETTE_WIDTH][GTK_CUSTOM_PALETTE_HEIGHT];
+
+  /* The color_sample stuff */
+  GtkWidget *sample_area;
+  GtkWidget *old_sample;
+  GtkWidget *cur_sample;
+  GtkWidget *colorsel;
+
+  /* Window for grabbing on */
+  GtkWidget *dropper_grab_widget;
+  guint32    grab_time;
+
+  /* Connection to settings */
+  gulong settings_connection;
+};
+
+static void mate_color_selection_dispose		(GObject		 *object);
+static void mate_color_selection_finalize        (GObject		 *object);
+static void update_color			(MateColorSelection	 *colorsel);
+static void mate_color_selection_set_property    (GObject                 *object,
+					         guint                    prop_id,
+					         const GValue            *value,
+					         GParamSpec              *pspec);
+static void mate_color_selection_get_property    (GObject                 *object,
+					         guint                    prop_id,
+					         GValue                  *value,
+					         GParamSpec              *pspec);
+
+static void mate_color_selection_realize         (GtkWidget               *widget);
+static void mate_color_selection_unrealize       (GtkWidget               *widget);
+static void mate_color_selection_show_all        (GtkWidget               *widget);
+static gboolean mate_color_selection_grab_broken (GtkWidget               *widget,
+						 GdkEventGrabBroken      *event);
+
+static void     mate_color_selection_set_palette_color   (MateColorSelection *colorsel,
+                                                         gint               index,
+                                                         GdkColor          *color);
+static void     default_noscreen_change_palette_func    (const GdkColor    *colors,
+							 gint               n_colors);
+static void     default_change_palette_func             (GdkScreen	   *screen,
+							 const GdkColor    *colors,
+							 gint               n_colors);
+static void     make_control_relations                  (AtkObject         *atk_obj,
+                                                         GtkWidget         *widget);
+static void     make_all_relations                      (AtkObject         *atk_obj,
+                                                         MateColorSelectionPrivate *priv);
+
+static void 	hsv_changed                             (GtkWidget         *hsv,
+							 gpointer           data);
+static void 	get_screen_color                        (GtkWidget         *button);
+static void 	adjustment_changed                      (GtkAdjustment     *adjustment,
+							 gpointer           data);
+static void 	opacity_entry_changed                   (GtkWidget 	   *opacity_entry,
+							 gpointer  	    data);
+static void 	hex_changed                             (GtkWidget 	   *hex_entry,
+							 gpointer  	    data);
+static gboolean hex_focus_out                           (GtkWidget     	   *hex_entry,
+							 GdkEventFocus 	   *event,
+							 gpointer      	    data);
+static void 	color_sample_new                        (MateColorSelection *colorsel);
+static void 	make_label_spinbutton     		(MateColorSelection *colorsel,
+	    				  		 GtkWidget        **spinbutton,
+	    				  		 gchar             *text,
+	    				  		 GtkWidget         *grid,
+	    				  		 gint               i,
+	    				  		 gint               j,
+	    				  		 gint               channel_type,
+	    				  		 const gchar       *tooltip);
+static void 	make_palette_frame                      (MateColorSelection *colorsel,
+							 GtkWidget         *grid,
+							 gint               i,
+							 gint               j);
+static void 	set_selected_palette                    (MateColorSelection *colorsel,
+							 int                x,
+							 int                y);
+static void 	set_focus_line_attributes               (GtkWidget 	   *drawing_area,
+							 cairo_t   	   *cr,
+							 gint      	   *focus_width);
+static gboolean mouse_press 		     	       	(GtkWidget         *invisible,
+                            		     	       	 GdkEventButton    *event,
+                            		     	       	 gpointer           data);
+static void  palette_change_notify_instance (GObject    *object,
+					     GParamSpec *pspec,
+					     gpointer    data);
+static void update_palette (MateColorSelection *colorsel);
+static void shutdown_eyedropper (GtkWidget *widget);
+
+static guint color_selection_signals[LAST_SIGNAL] = { 0 };
+
+static MateColorSelectionChangePaletteFunc noscreen_change_palette_hook = default_noscreen_change_palette_func;
+static MateColorSelectionChangePaletteWithScreenFunc change_palette_hook = default_change_palette_func;
+
+static const guchar dropper_bits[] = {
+"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0U\35\35\35\373\40\40\40\350\0\0\0""6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\"\0\0\0\265"
+  "\0\0\0\373\233\233\233\377\233\233\233\377\0\0\0\351\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0y\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\375\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0U555\374\0\0\0\377\0\0\0\377\0\0\0\366\0\0\0t\0\0\0\15\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0=EEE\377\362"
+  "\362\362\377HHH\377\0\0\0\377\0\0\0\332\0\0\0.\0\0\0\6\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0=ddd\370\352\352\352"
+  "\377xxx\377\5\5\5\305\0\0\0\256\0\0\0q\0\0\0\15\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0=EEE\377\353\353\353\377\206"
+  "\206\206\377\2\2\2\311\1\1\1=\0\0\0@\0\0\0-\0\0\0\4\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0=ddd\370\354\354\354\377xxx\377\2"
+  "\2\2\311\0\0\0\77\0\0\0\21\0\0\0\14\0\0\0\10\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<EEE\377\354\354\354\377\206\206\206\377"
+  "\2\2\2\311\2\2\2""6\0\0\0\20\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\316\374\374\374\377yyy\377\2\2"
+  "\2\311\0\0\0\77\0\0\0\20\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\32)))\351111\362\0\0\0\306\2\2\2""6"
+  "\0\0\0\20\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\21\0\0\0j\0\0\0g\0\0\0<\0\0\0\20\0\0\0\1\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\11\0\0\0(\0\0\0\40\0\0\0\14\0\0\0\1\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\3\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"};
+
+G_DEFINE_TYPE_WITH_PRIVATE (MateColorSelection, mate_color_selection, GTK_TYPE_BOX)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
+
+static void
+mate_color_selection_class_init (MateColorSelectionClass *klass)
+{
+  GObjectClass *gobject_class;
+  GtkWidgetClass *widget_class;
+
+  gobject_class = G_OBJECT_CLASS (klass);
+  gobject_class->finalize = mate_color_selection_finalize;
+  gobject_class->set_property = mate_color_selection_set_property;
+  gobject_class->get_property = mate_color_selection_get_property;
+
+  gobject_class->dispose = mate_color_selection_dispose;
+
+  widget_class = GTK_WIDGET_CLASS (klass);
+  widget_class->realize = mate_color_selection_realize;
+  widget_class->unrealize = mate_color_selection_unrealize;
+  widget_class->show_all = mate_color_selection_show_all;
+  widget_class->grab_broken_event = mate_color_selection_grab_broken;
+
+  g_object_class_install_property (gobject_class,
+                                   PROP_HAS_OPACITY_CONTROL,
+                                   g_param_spec_boolean ("has-opacity-control",
+							 _("Has Opacity Control"),
+							 _("Whether the color selector should allow setting opacity"),
+							 FALSE,
+							 G_PARAM_READWRITE));
+  g_object_class_install_property (gobject_class,
+                                   PROP_HAS_PALETTE,
+                                   g_param_spec_boolean ("has-palette",
+							 _("Has palette"),
+							 _("Whether a palette should be used"),
+							 FALSE,
+							 G_PARAM_READWRITE));
+  g_object_class_install_property (gobject_class,
+                                   PROP_CURRENT_COLOR,
+                                   g_param_spec_boxed ("current-color",
+                                                       _("Current Color"),
+                                                       _("The current color"),
+                                                       GDK_TYPE_COLOR,
+                                                       G_PARAM_READWRITE));
+  g_object_class_install_property (gobject_class,
+                                   PROP_CURRENT_ALPHA,
+                                   g_param_spec_uint ("current-alpha",
+						      _("Current Alpha"),
+						      _("The current opacity value (0 fully transparent, 65535 fully opaque)"),
+						      0, 65535, 65535,
+						      G_PARAM_READWRITE));
+  g_object_class_install_property (gobject_class,
+                                   PROP_HEX_STRING,
+                                   g_param_spec_string ("hex-string",
+                                                       _("HEX String"),
+                                                       _("The hexadecimal string of current color"),
+                                                       "",
+                                                       G_PARAM_READABLE));
+
+  color_selection_signals[COLOR_CHANGED] =
+    g_signal_new ("color-changed",
+		  G_OBJECT_CLASS_TYPE (gobject_class),
+		  G_SIGNAL_RUN_FIRST,
+		  G_STRUCT_OFFSET (MateColorSelectionClass, color_changed),
+		  NULL, NULL,
+		  g_cclosure_marshal_VOID__VOID,
+		  G_TYPE_NONE, 0);
+}
+
+static void
+mate_color_selection_init (MateColorSelection *colorsel)
+{
+  GtkWidget *top_hbox;
+  GtkWidget *top_right_vbox;
+  GtkWidget *grid, *label, *hbox, *frame, *vbox, *button;
+  GtkAdjustment *adjust;
+  GtkWidget *picker_image;
+  gint i, j;
+  MateColorSelectionPrivate *priv;
+  AtkObject *atk_obj;
+  GList *focus_chain = NULL;
+
+  _mate_desktop_init_i18n ();
+
+  priv = colorsel->private_data = mate_color_selection_get_instance_private (colorsel);
+  priv->changing = FALSE;
+  priv->default_set = FALSE;
+  priv->default_alpha_set = FALSE;
+
+  top_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+  gtk_box_pack_start (GTK_BOX (colorsel), top_hbox, FALSE, FALSE, 0);
+
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+  priv->triangle_colorsel = mate_hsv_new ();
+  g_signal_connect (priv->triangle_colorsel, "changed",
+                    G_CALLBACK (hsv_changed), colorsel);
+  mate_hsv_set_metrics (MATE_HSV (priv->triangle_colorsel), 174, 15);
+  gtk_box_pack_start (GTK_BOX (top_hbox), vbox, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), priv->triangle_colorsel, FALSE, FALSE, 0);
+  gtk_widget_set_tooltip_text (priv->triangle_colorsel,
+                        _("Select the color you want from the outer ring. Select the darkness or lightness of that color using the inner triangle."));
+
+  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+  gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+
+  frame = gtk_frame_new (NULL);
+  gtk_widget_set_size_request (frame, -1, 30);
+  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
+  color_sample_new (colorsel);
+  gtk_container_add (GTK_CONTAINER (frame), priv->sample_area);
+  gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
+
+  button = gtk_button_new ();
+
+  gtk_widget_set_events (button, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK);
+  g_object_set_data (G_OBJECT (button), "COLORSEL", colorsel);
+  g_signal_connect (button, "clicked",
+                    G_CALLBACK (get_screen_color), NULL);
+  picker_image = gtk_image_new_from_icon_name ("gtk-color-picker", GTK_ICON_SIZE_BUTTON);
+  gtk_container_add (GTK_CONTAINER (button), picker_image);
+  gtk_widget_show (GTK_WIDGET (picker_image));
+  gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+
+  gtk_widget_set_tooltip_text (button,
+                        _("Click the eyedropper, then click a color anywhere on your screen to select that color."));
+
+  top_right_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+  gtk_box_pack_start (GTK_BOX (top_hbox), top_right_vbox, FALSE, FALSE, 0);
+  grid = gtk_grid_new ();
+  gtk_box_pack_start (GTK_BOX (top_right_vbox), grid, FALSE, FALSE, 0);
+  gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
+  gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
+
+  make_label_spinbutton (colorsel, &priv->hue_spinbutton, _("_Hue:"), grid, 0, 0, COLORSEL_HUE,
+                         _("Position on the color wheel."));
+  gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (priv->hue_spinbutton), TRUE);
+  make_label_spinbutton (colorsel, &priv->sat_spinbutton, _("_Saturation:"), grid, 0, 1, COLORSEL_SATURATION,
+                         _("\"Deepness\" of the color."));
+  make_label_spinbutton (colorsel, &priv->val_spinbutton, _("_Value:"), grid, 0, 2, COLORSEL_VALUE,
+                         _("Brightness of the color."));
+  make_label_spinbutton (colorsel, &priv->red_spinbutton, _("_Red:"), grid, 6, 0, COLORSEL_RED,
+                         _("Amount of red light in the color."));
+  make_label_spinbutton (colorsel, &priv->green_spinbutton, _("_Green:"), grid, 6, 1, COLORSEL_GREEN,
+                         _("Amount of green light in the color."));
+  make_label_spinbutton (colorsel, &priv->blue_spinbutton, _("_Blue:"), grid, 6, 2, COLORSEL_BLUE,
+                         _("Amount of blue light in the color."));
+  gtk_grid_attach (GTK_GRID (grid), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), 0, 3, 8, 1);
+
+  priv->opacity_label = gtk_label_new_with_mnemonic (_("Op_acity:"));
+  gtk_label_set_xalign (GTK_LABEL (priv->opacity_label), 0.0);
+  gtk_grid_attach (GTK_GRID (grid), priv->opacity_label, 0, 4, 1, 1);
+  adjust = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 255.0, 1.0, 1.0, 0.0));
+  g_object_set_data (G_OBJECT (adjust), "COLORSEL", colorsel);
+  priv->opacity_slider = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjust);
+  gtk_widget_set_tooltip_text (priv->opacity_slider,
+                        _("Transparency of the color."));
+  gtk_label_set_mnemonic_widget (GTK_LABEL (priv->opacity_label),
+                                 priv->opacity_slider);
+  gtk_scale_set_draw_value (GTK_SCALE (priv->opacity_slider), FALSE);
+  g_signal_connect (adjust, "value-changed",
+                    G_CALLBACK (adjustment_changed),
+                    GINT_TO_POINTER (COLORSEL_OPACITY));
+  gtk_grid_attach (GTK_GRID (grid), priv->opacity_slider, 1, 4, 6, 1);
+  priv->opacity_entry = gtk_entry_new ();
+  gtk_widget_set_tooltip_text (priv->opacity_entry,
+                        _("Transparency of the color."));
+  gtk_widget_set_size_request (priv->opacity_entry, 40, -1);
+
+  g_signal_connect (priv->opacity_entry, "activate",
+                    G_CALLBACK (opacity_entry_changed), colorsel);
+  gtk_grid_attach (GTK_GRID (grid), priv->opacity_entry, 7, 4, 1, 1);
+
+  label = gtk_label_new_with_mnemonic (_("Color _name:"));
+  gtk_grid_attach (GTK_GRID (grid), label, 0, 5, 1, 1);
+  gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+  priv->hex_entry = gtk_entry_new ();
+
+  gtk_label_set_mnemonic_widget (GTK_LABEL (label), priv->hex_entry);
+
+  g_signal_connect (priv->hex_entry, "activate",
+                    G_CALLBACK (hex_changed), colorsel);
+
+  g_signal_connect (priv->hex_entry, "focus-out-event",
+                    G_CALLBACK (hex_focus_out), colorsel);
+
+  gtk_widget_set_tooltip_text (priv->hex_entry,
+                        _("You can enter an HTML-style hexadecimal color value, or simply a color name such as 'orange' in this entry."));
+
+  gtk_entry_set_width_chars (GTK_ENTRY (priv->hex_entry), 7);
+  gtk_grid_attach (GTK_GRID (grid), priv->hex_entry, 1, 5, 4, 1);
+
+  focus_chain = g_list_append (focus_chain, priv->hue_spinbutton);
+  focus_chain = g_list_append (focus_chain, priv->sat_spinbutton);
+  focus_chain = g_list_append (focus_chain, priv->val_spinbutton);
+  focus_chain = g_list_append (focus_chain, priv->red_spinbutton);
+  focus_chain = g_list_append (focus_chain, priv->green_spinbutton);
+  focus_chain = g_list_append (focus_chain, priv->blue_spinbutton);
+  focus_chain = g_list_append (focus_chain, priv->opacity_slider);
+  focus_chain = g_list_append (focus_chain, priv->opacity_entry);
+  focus_chain = g_list_append (focus_chain, priv->hex_entry);
+  gtk_container_set_focus_chain (GTK_CONTAINER (grid), focus_chain);
+  g_list_free (focus_chain);
+
+  /* Set up the palette */
+  grid = gtk_grid_new ();
+  gtk_grid_set_row_spacing (GTK_GRID (grid), 1);
+  gtk_grid_set_column_spacing (GTK_GRID (grid), 1);
+  for (i = 0; i < GTK_CUSTOM_PALETTE_WIDTH; i++)
+    {
+      for (j = 0; j < GTK_CUSTOM_PALETTE_HEIGHT; j++)
+	{
+	  make_palette_frame (colorsel, grid, i, j);
+	}
+    }
+  set_selected_palette (colorsel, 0, 0);
+  priv->palette_frame = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+  label = gtk_label_new_with_mnemonic (_("_Palette:"));
+
+  gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+  gtk_box_pack_start (GTK_BOX (priv->palette_frame), label, FALSE, FALSE, 0);
+
+  gtk_label_set_mnemonic_widget (GTK_LABEL (label),
+                                 priv->custom_palette[0][0]);
+
+  gtk_box_pack_end (GTK_BOX (top_right_vbox), priv->palette_frame, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (priv->palette_frame), grid, FALSE, FALSE, 0);
+
+  gtk_widget_show_all (top_hbox);
+
+  /* hide unused stuff */
+
+  if (priv->has_opacity == FALSE)
+    {
+      gtk_widget_hide (priv->opacity_label);
+      gtk_widget_hide (priv->opacity_slider);
+      gtk_widget_hide (priv->opacity_entry);
+    }
+
+  if (priv->has_palette == FALSE)
+    {
+      gtk_widget_hide (priv->palette_frame);
+    }
+
+  atk_obj = gtk_widget_get_accessible (priv->triangle_colorsel);
+  if (GTK_IS_ACCESSIBLE (atk_obj))
+    {
+      atk_object_set_name (atk_obj, _("Color Wheel"));
+      atk_object_set_role (gtk_widget_get_accessible (GTK_WIDGET (colorsel)), ATK_ROLE_COLOR_CHOOSER);
+      make_all_relations (atk_obj, priv);
+    }
+}
+
+/* GObject methods */
+static void
+mate_color_selection_finalize (GObject *object)
+{
+  G_OBJECT_CLASS (mate_color_selection_parent_class)->finalize (object);
+}
+
+static void
+mate_color_selection_set_property (GObject         *object,
+				  guint            prop_id,
+				  const GValue    *value,
+				  GParamSpec      *pspec)
+{
+  MateColorSelection *colorsel = MATE_COLOR_SELECTION (object);
+
+  switch (prop_id)
+    {
+    case PROP_HAS_OPACITY_CONTROL:
+      mate_color_selection_set_has_opacity_control (colorsel,
+						   g_value_get_boolean (value));
+      break;
+    case PROP_HAS_PALETTE:
+      mate_color_selection_set_has_palette (colorsel,
+					   g_value_get_boolean (value));
+      break;
+    case PROP_CURRENT_COLOR:
+      mate_color_selection_set_current_color (colorsel, g_value_get_boxed (value));
+      break;
+    case PROP_CURRENT_ALPHA:
+      mate_color_selection_set_current_alpha (colorsel, g_value_get_uint (value));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+
+}
+
+static void
+mate_color_selection_get_property (GObject     *object,
+				  guint        prop_id,
+				  GValue      *value,
+				  GParamSpec  *pspec)
+{
+  MateColorSelection *colorsel = MATE_COLOR_SELECTION (object);
+  MateColorSelectionPrivate *priv = colorsel->private_data;
+  GdkColor color;
+
+  switch (prop_id)
+    {
+    case PROP_HAS_OPACITY_CONTROL:
+      g_value_set_boolean (value, mate_color_selection_get_has_opacity_control (colorsel));
+      break;
+    case PROP_HAS_PALETTE:
+      g_value_set_boolean (value, mate_color_selection_get_has_palette (colorsel));
+      break;
+    case PROP_CURRENT_COLOR:
+      mate_color_selection_get_current_color (colorsel, &color);
+      g_value_set_boxed (value, &color);
+      break;
+    case PROP_CURRENT_ALPHA:
+      g_value_set_uint (value, mate_color_selection_get_current_alpha (colorsel));
+      break;
+    case PROP_HEX_STRING:
+      g_value_set_string (value, gtk_editable_get_chars (GTK_EDITABLE (priv->hex_entry), 0, -1));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+mate_color_selection_dispose (GObject *object)
+{
+  MateColorSelection *cselection = MATE_COLOR_SELECTION (object);
+  MateColorSelectionPrivate *priv = cselection->private_data;
+
+  if (priv->dropper_grab_widget)
+    {
+      gtk_widget_destroy (priv->dropper_grab_widget);
+      priv->dropper_grab_widget = NULL;
+    }
+
+  G_OBJECT_CLASS (mate_color_selection_parent_class)->dispose (object);
+}
+
+/* GtkWidget methods */
+
+static void
+mate_color_selection_realize (GtkWidget *widget)
+{
+  MateColorSelection *colorsel = MATE_COLOR_SELECTION (widget);
+  MateColorSelectionPrivate *priv = colorsel->private_data;
+  GtkSettings *settings = gtk_widget_get_settings (widget);
+
+  priv->settings_connection =  g_signal_connect (settings,
+						 "notify::gtk-color-palette",
+						 G_CALLBACK (palette_change_notify_instance),
+						 widget);
+  update_palette (colorsel);
+
+  GTK_WIDGET_CLASS (mate_color_selection_parent_class)->realize (widget);
+}
+
+static void
+mate_color_selection_unrealize (GtkWidget *widget)
+{
+  MateColorSelection *colorsel = MATE_COLOR_SELECTION (widget);
+  MateColorSelectionPrivate *priv = colorsel->private_data;
+  GtkSettings *settings = gtk_widget_get_settings (widget);
+
+  g_signal_handler_disconnect (settings, priv->settings_connection);
+
+  GTK_WIDGET_CLASS (mate_color_selection_parent_class)->unrealize (widget);
+}
+
+/* We override show-all since we have internal widgets that
+ * shouldn't be shown when you call show_all(), like the
+ * palette and opacity sliders.
+ */
+static void
+mate_color_selection_show_all (GtkWidget *widget)
+{
+  gtk_widget_show (widget);
+}
+
+static gboolean
+mate_color_selection_grab_broken (GtkWidget          *widget,
+				 GdkEventGrabBroken *event)
+{
+  shutdown_eyedropper (widget);
+
+  return TRUE;
+}
+
+/*
+ *
+ * The Sample Color
+ *
+ */
+
+static void color_sample_draw_sample (MateColorSelection *colorsel, cairo_t *cr, int which);
+static void color_sample_update_samples (MateColorSelection *colorsel);
+
+static void
+set_color_internal (MateColorSelection *colorsel,
+		    gdouble           *color)
+{
+  MateColorSelectionPrivate *priv;
+  gint i;
+
+  priv = colorsel->private_data;
+  priv->changing = TRUE;
+  priv->color[COLORSEL_RED] = color[0];
+  priv->color[COLORSEL_GREEN] = color[1];
+  priv->color[COLORSEL_BLUE] = color[2];
+  priv->color[COLORSEL_OPACITY] = color[3];
+  gtk_rgb_to_hsv (priv->color[COLORSEL_RED],
+		  priv->color[COLORSEL_GREEN],
+		  priv->color[COLORSEL_BLUE],
+		  &priv->color[COLORSEL_HUE],
+		  &priv->color[COLORSEL_SATURATION],
+		  &priv->color[COLORSEL_VALUE]);
+  if (priv->default_set == FALSE)
+    {
+      for (i = 0; i < COLORSEL_NUM_CHANNELS; i++)
+	priv->old_color[i] = priv->color[i];
+    }
+  priv->default_set = TRUE;
+  priv->default_alpha_set = TRUE;
+  update_color (colorsel);
+}
+
+static void
+set_color_icon (GdkDragContext *context,
+		gdouble        *colors)
+{
+  GdkPixbuf *pixbuf;
+  guint32 pixel;
+
+  pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE,
+			   8, 48, 32);
+
+  pixel = (((UNSCALE (colors[COLORSEL_RED])   & 0xff00) << 16) |
+	   ((UNSCALE (colors[COLORSEL_GREEN]) & 0xff00) << 8) |
+	   ((UNSCALE (colors[COLORSEL_BLUE])  & 0xff00)));
+
+  gdk_pixbuf_fill (pixbuf, pixel);
+
+  gtk_drag_set_icon_pixbuf (context, pixbuf, -2, -2);
+  g_object_unref (pixbuf);
+}
+
+static void
+color_sample_drag_begin (GtkWidget      *widget,
+			 GdkDragContext *context,
+			 gpointer        data)
+{
+  MateColorSelection *colorsel = data;
+  MateColorSelectionPrivate *priv;
+  gdouble *colsrc;
+
+  priv = colorsel->private_data;
+
+  if (widget == priv->old_sample)
+    colsrc = priv->old_color;
+  else
+    colsrc = priv->color;
+
+  set_color_icon (context, colsrc);
+}
+
+static void
+color_sample_drag_end (GtkWidget      *widget,
+		       GdkDragContext *context,
+		       gpointer        data)
+{
+  g_object_set_data (G_OBJECT (widget), "gtk-color-selection-drag-window", NULL);
+}
+
+static void
+color_sample_drop_handle (GtkWidget        *widget,
+			  GdkDragContext   *context,
+			  gint              x,
+			  gint              y,
+			  GtkSelectionData *selection_data,
+			  guint             info,
+			  guint             time,
+			  gpointer          data)
+{
+  MateColorSelection *colorsel = data;
+  MateColorSelectionPrivate *priv;
+  guint16 *vals;
+  gdouble color[4];
+  priv = colorsel->private_data;
+
+  /* This is currently a guint16 array of the format:
+   * R
+   * G
+   * B
+   * opacity
+   */
+
+  if (gtk_selection_data_get_length (selection_data) < 0)
+    return;
+
+  /* We accept drops with the wrong format, since the KDE color
+   * chooser incorrectly drops application/x-color with format 8.
+   */
+  if (gtk_selection_data_get_length (selection_data) != 8)
+    {
+      g_warning ("Received invalid color data\n");
+      return;
+    }
+
+  vals = (guint16 *) gtk_selection_data_get_data (selection_data);
+
+  if (widget == priv->cur_sample)
+    {
+      color[0] = (gdouble)vals[0] / 0xffff;
+      color[1] = (gdouble)vals[1] / 0xffff;
+      color[2] = (gdouble)vals[2] / 0xffff;
+      color[3] = (gdouble)vals[3] / 0xffff;
+
+      set_color_internal (colorsel, color);
+    }
+}
+
+static void
+color_sample_drag_handle (GtkWidget        *widget,
+			  GdkDragContext   *context,
+			  GtkSelectionData *selection_data,
+			  guint             info,
+			  guint             time,
+			  gpointer          data)
+{
+  MateColorSelection *colorsel = data;
+  MateColorSelectionPrivate *priv;
+  guint16 vals[4];
+  gdouble *colsrc;
+
+  priv = colorsel->private_data;
+
+  if (widget == priv->old_sample)
+    colsrc = priv->old_color;
+  else
+    colsrc = priv->color;
+
+  vals[0] = colsrc[COLORSEL_RED] * 0xffff;
+  vals[1] = colsrc[COLORSEL_GREEN] * 0xffff;
+  vals[2] = colsrc[COLORSEL_BLUE] * 0xffff;
+  vals[3] = priv->has_opacity ? colsrc[COLORSEL_OPACITY] * 0xffff : 0xffff;
+
+  gtk_selection_data_set (selection_data,
+			  gdk_atom_intern_static_string ("application/x-color"),
+			  16, (guchar *)vals, 8);
+}
+
+/* which = 0 means draw old sample, which = 1 means draw new */
+static void
+color_sample_draw_sample (MateColorSelection *colorsel, cairo_t *cr, int which)
+{
+  GtkWidget *da;
+  gint x, y, wid, heig, goff;
+  MateColorSelectionPrivate *priv;
+  GtkAllocation allocation;
+
+  g_return_if_fail (colorsel != NULL);
+  priv = colorsel->private_data;
+
+  g_return_if_fail (priv->sample_area != NULL);
+  if (!gtk_widget_is_drawable (priv->sample_area))
+    return;
+
+  if (which == 0)
+    {
+      da = priv->old_sample;
+      goff = 0;
+    }
+  else
+    {
+      da = priv->cur_sample;
+      gtk_widget_get_allocation (priv->old_sample, &allocation);
+      goff =  allocation.width % 32;
+    }
+
+  gtk_widget_get_allocation (da, &allocation);
+  wid = allocation.width;
+  heig = allocation.height;
+
+  /* Below needs tweaking for non-power-of-two */
+
+  if (priv->has_opacity)
+    {
+      /* Draw checks in background */
+
+      cairo_set_source_rgb (cr, 0.5, 0.5, 0.5);
+      cairo_rectangle (cr, 0, 0, wid, heig);
+      cairo_fill (cr);
+
+      cairo_set_source_rgb (cr, 0.75, 0.75, 0.75);
+      for (x = goff & -CHECK_SIZE; x < goff + wid; x += CHECK_SIZE)
+	for (y = 0; y < heig; y += CHECK_SIZE)
+	  if ((x / CHECK_SIZE + y / CHECK_SIZE) % 2 == 0)
+	    cairo_rectangle (cr, x - goff, y, CHECK_SIZE, CHECK_SIZE);
+      cairo_fill (cr);
+    }
+
+  if (which == 0)
+    {
+      cairo_set_source_rgba (cr,
+			     priv->old_color[COLORSEL_RED],
+			     priv->old_color[COLORSEL_GREEN],
+			     priv->old_color[COLORSEL_BLUE],
+			     priv->has_opacity ?
+			        priv->old_color[COLORSEL_OPACITY] : 1.0);
+    }
+  else
+    {
+      cairo_set_source_rgba (cr,
+			     priv->color[COLORSEL_RED],
+			     priv->color[COLORSEL_GREEN],
+			     priv->color[COLORSEL_BLUE],
+			     priv->has_opacity ?
+			       priv->color[COLORSEL_OPACITY] : 1.0);
+    }
+
+  cairo_rectangle (cr, 0, 0, wid, heig);
+  cairo_fill (cr);
+}
+
+static void
+color_sample_update_samples (MateColorSelection *colorsel)
+{
+  MateColorSelectionPrivate *priv = colorsel->private_data;
+  gtk_widget_queue_draw (priv->old_sample);
+  gtk_widget_queue_draw (priv->cur_sample);
+}
+
+static gboolean
+color_old_sample_draw (GtkWidget          *da,
+                       cairo_t            *cr,
+                       MateColorSelection *colorsel)
+{
+  color_sample_draw_sample (colorsel, cr, 0);
+  return FALSE;
+}
+
+static gboolean
+color_cur_sample_draw (GtkWidget          *da,
+                       cairo_t            *cr,
+                       MateColorSelection *colorsel)
+{
+  color_sample_draw_sample (colorsel, cr, 1);
+  return FALSE;
+}
+
+static void
+color_sample_setup_dnd (MateColorSelection *colorsel, GtkWidget *sample)
+{
+  static const GtkTargetEntry targets[] = {
+    { .target = "application/x-color", .flags = 0, .info = 0 }
+  };
+  MateColorSelectionPrivate *priv;
+  priv = colorsel->private_data;
+
+  gtk_drag_source_set (sample,
+		       GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
+		       targets, 1,
+		       GDK_ACTION_COPY | GDK_ACTION_MOVE);
+
+  g_signal_connect (sample, "drag-begin",
+		    G_CALLBACK (color_sample_drag_begin),
+		    colorsel);
+  if (sample == priv->cur_sample)
+    {
+
+      gtk_drag_dest_set (sample,
+			 GTK_DEST_DEFAULT_HIGHLIGHT |
+			 GTK_DEST_DEFAULT_MOTION |
+			 GTK_DEST_DEFAULT_DROP,
+			 targets, 1,
+			 GDK_ACTION_COPY);
+
+      g_signal_connect (sample, "drag-end",
+			G_CALLBACK (color_sample_drag_end),
+			colorsel);
+    }
+
+  g_signal_connect (sample, "drag-data-get",
+		    G_CALLBACK (color_sample_drag_handle),
+		    colorsel);
+  g_signal_connect (sample, "drag-data-received",
+		    G_CALLBACK (color_sample_drop_handle),
+		    colorsel);
+
+}
+
+static void
+update_tooltips (MateColorSelection *colorsel)
+{
+  MateColorSelectionPrivate *priv;
+
+  priv = colorsel->private_data;
+
+  if (priv->has_palette == TRUE)
+    {
+      gtk_widget_set_tooltip_text (priv->old_sample,
+                            _("The previously-selected color, for comparison to the color you're selecting now. You can drag this color to a palette entry, or select this color as current by dragging it to the other color swatch alongside."));
+
+      gtk_widget_set_tooltip_text (priv->cur_sample,
+                            _("The color you've chosen. You can drag this color to a palette entry to save it for use in the future."));
+    }
+  else
+    {
+      gtk_widget_set_tooltip_text (priv->old_sample,
+                            _("The previously-selected color, for comparison to the color you're selecting now."));
+
+      gtk_widget_set_tooltip_text (priv->cur_sample,
+                            _("The color you've chosen."));
+    }
+}
+
+static void
+color_sample_new (MateColorSelection *colorsel)
+{
+  MateColorSelectionPrivate *priv;
+
+  priv = colorsel->private_data;
+
+  priv->sample_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+  priv->old_sample = gtk_drawing_area_new ();
+  priv->cur_sample = gtk_drawing_area_new ();
+
+  gtk_box_pack_start (GTK_BOX (priv->sample_area), priv->old_sample,
+		      TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (priv->sample_area), priv->cur_sample,
+		      TRUE, TRUE, 0);
+
+  g_signal_connect (priv->old_sample, "draw",
+		    G_CALLBACK (color_old_sample_draw),
+		    colorsel);
+  g_signal_connect (priv->cur_sample, "draw",
+		    G_CALLBACK (color_cur_sample_draw),
+		    colorsel);
+
+  color_sample_setup_dnd (colorsel, priv->old_sample);
+  color_sample_setup_dnd (colorsel, priv->cur_sample);
+
+  update_tooltips (colorsel);
+
+  gtk_widget_show_all (priv->sample_area);
+}
+
+/*
+ *
+ * The palette area code
+ *
+ */
+
+static void
+palette_get_color (GtkWidget *drawing_area, gdouble *color)
+{
+  gdouble *color_val;
+
+  g_return_if_fail (color != NULL);
+
+  color_val = g_object_get_data (G_OBJECT (drawing_area), "color_val");
+  if (color_val == NULL)
+    {
+      /* Default to white for no good reason */
+      color[0] = 1.0;
+      color[1] = 1.0;
+      color[2] = 1.0;
+      color[3] = 1.0;
+      return;
+    }
+
+  color[0] = color_val[0];
+  color[1] = color_val[1];
+  color[2] = color_val[2];
+  color[3] = 1.0;
+}
+
+static void
+palette_paint (GtkWidget    *drawing_area,
+               cairo_t      *cr,
+               gpointer      data)
+{
+  gint focus_width;
+  GtkAllocation allocation;
+
+  if (gtk_widget_get_window (drawing_area) == NULL)
+    return;
+
+  gtk_widget_get_allocation (drawing_area, &allocation);
+
+  gdk_cairo_set_source_color (cr, &gtk_widget_get_style (drawing_area)->bg[GTK_STATE_NORMAL]);
+  cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
+  cairo_fill (cr);
+
+  if (gtk_widget_has_focus (drawing_area))
+    {
+      set_focus_line_attributes (drawing_area, cr, &focus_width);
+
+      cairo_rectangle (cr,
+		       focus_width / 2., focus_width / 2.,
+		       allocation.width - focus_width,
+		       allocation.height - focus_width);
+      cairo_stroke (cr);
+    }
+}
+
+static void
+set_focus_line_attributes (GtkWidget *drawing_area,
+			   cairo_t   *cr,
+			   gint      *focus_width)
+{
+  gdouble color[4];
+  gint8 *dash_list;
+
+  gtk_widget_style_get (drawing_area,
+			"focus-line-width", focus_width,
+			"focus-line-pattern", (gchar *)&dash_list,
+			NULL);
+
+  palette_get_color (drawing_area, color);
+
+  if (INTENSITY (color[0], color[1], color[2]) > 0.5)
+    cairo_set_source_rgb (cr, 0., 0., 0.);
+  else
+    cairo_set_source_rgb (cr, 1., 1., 1.);
+
+  cairo_set_line_width (cr, *focus_width);
+
+  if (dash_list[0])
+    {
+      gint n_dashes = strlen ((gchar *)dash_list);
+      gdouble *dashes = g_new (gdouble, n_dashes);
+      gdouble total_length = 0;
+      gdouble dash_offset;
+      gint i;
+
+      for (i = 0; i < n_dashes; i++)
+	{
+	  dashes[i] = dash_list[i];
+	  total_length += dash_list[i];
+	}
+
+      /* The dash offset here aligns the pattern to integer pixels
+       * by starting the dash at the right side of the left border
+       * Negative dash offsets in cairo don't work
+       * (https://bugs.freedesktop.org/show_bug.cgi?id=2729)
+       */
+      dash_offset = - *focus_width / 2.;
+      while (dash_offset < 0)
+	dash_offset += total_length;
+
+      cairo_set_dash (cr, dashes, n_dashes, dash_offset);
+      g_free (dashes);
+    }
+
+  g_free (dash_list);
+}
+
+static void
+palette_drag_begin (GtkWidget      *widget,
+		    GdkDragContext *context,
+		    gpointer        data)
+{
+  gdouble colors[4];
+
+  palette_get_color (widget, colors);
+  set_color_icon (context, colors);
+}
+
+static void
+palette_drag_handle (GtkWidget        *widget,
+		     GdkDragContext   *context,
+		     GtkSelectionData *selection_data,
+		     guint             info,
+		     guint             time,
+		     gpointer          data)
+{
+  guint16 vals[4];
+  gdouble colsrc[4];
+
+  palette_get_color (widget, colsrc);
+
+  vals[0] = colsrc[COLORSEL_RED] * 0xffff;
+  vals[1] = colsrc[COLORSEL_GREEN] * 0xffff;
+  vals[2] = colsrc[COLORSEL_BLUE] * 0xffff;
+  vals[3] = 0xffff;
+
+  gtk_selection_data_set (selection_data,
+			  gdk_atom_intern_static_string ("application/x-color"),
+			  16, (guchar *)vals, 8);
+}
+
+static void
+palette_drag_end (GtkWidget      *widget,
+		  GdkDragContext *context,
+		  gpointer        data)
+{
+  g_object_set_data (G_OBJECT (widget), "gtk-color-selection-drag-window", NULL);
+}
+
+static GdkColor *
+get_current_colors (MateColorSelection *colorsel)
+{
+  GdkColor *colors = NULL;
+  gint n_colors = 0;
+
+  mate_color_selection_palette_from_string (DEFAULT_COLOR_PALETTE,
+                                            &colors,
+                                            &n_colors);
+
+  /* make sure that we fill every slot */
+  g_assert (n_colors == GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT);
+
+  return colors;
+}
+
+/* Changes the model color */
+static void
+palette_change_color (GtkWidget         *drawing_area,
+                      MateColorSelection *colorsel,
+                      gdouble           *color)
+{
+  gint x, y;
+  MateColorSelectionPrivate *priv;
+  GdkColor gdk_color;
+  GdkColor *current_colors;
+  GdkScreen *screen;
+
+  g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel));
+  g_return_if_fail (GTK_IS_DRAWING_AREA (drawing_area));
+
+  priv = colorsel->private_data;
+
+  gdk_color.red = UNSCALE (color[0]);
+  gdk_color.green = UNSCALE (color[1]);
+  gdk_color.blue = UNSCALE (color[2]);
+  gdk_color.pixel = 0;
+
+  x = 0;
+  y = 0;			/* Quiet GCC */
+  while (x < GTK_CUSTOM_PALETTE_WIDTH)
+    {
+      y = 0;
+      while (y < GTK_CUSTOM_PALETTE_HEIGHT)
+        {
+          if (priv->custom_palette[x][y] == drawing_area)
+            goto out;
+
+          ++y;
+        }
+
+      ++x;
+    }
+
+ out:
+
+  g_assert (x < GTK_CUSTOM_PALETTE_WIDTH || y < GTK_CUSTOM_PALETTE_HEIGHT);
+
+  current_colors = get_current_colors (colorsel);
+  current_colors[y * GTK_CUSTOM_PALETTE_WIDTH + x] = gdk_color;
+
+  screen = gtk_widget_get_screen (GTK_WIDGET (colorsel));
+  if (change_palette_hook != default_change_palette_func)
+    (* change_palette_hook) (screen, current_colors,
+			     GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT);
+  else if (noscreen_change_palette_hook != default_noscreen_change_palette_func)
+    {
+      if (screen != gdk_screen_get_default ())
+	g_warning ("mate_color_selection_set_change_palette_hook used by widget is not on the default screen.");
+      (* noscreen_change_palette_hook) (current_colors,
+					GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT);
+    }
+  else
+    (* change_palette_hook) (screen, current_colors,
+			     GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT);
+
+  g_free (current_colors);
+}
+
+static void
+override_background_color (GtkWidget *widget,
+                           GdkRGBA   *rgba)
+{
+  gchar          *css;
+  GtkCssProvider *provider;
+
+  provider = gtk_css_provider_new ();
+
+  css = g_strdup_printf ("* { background-color: %s;}",
+                         gdk_rgba_to_string (rgba));
+  gtk_css_provider_load_from_data (provider, css, -1, NULL);
+  g_free (css);
+
+  gtk_style_context_add_provider (gtk_widget_get_style_context (widget),
+                                  GTK_STYLE_PROVIDER (provider),
+                                  GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  g_object_unref (provider);
+}
+
+/* Changes the view color */
+static void
+palette_set_color (GtkWidget         *drawing_area,
+		   MateColorSelection *colorsel,
+		   gdouble           *color)
+{
+  gpointer pointer;
+  gdouble *new_color = g_new (double, 4);
+  GdkRGBA  box_color;
+
+  box_color.red = color[0];
+  box_color.green = color[1];
+  box_color.blue = color[2];
+  box_color.alpha = 1;
+
+  override_background_color (drawing_area, &box_color);
+
+  pointer = g_object_get_data (G_OBJECT (drawing_area), "color_set");
+  if (!pointer || GPOINTER_TO_INT (pointer) == 0)
+    {
+      static const GtkTargetEntry targets[] = {
+	{ .target = "application/x-color", .flags = 0, .info = 0 }
+      };
+      gtk_drag_source_set (drawing_area,
+			   GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
+			   targets, 1,
+			   GDK_ACTION_COPY | GDK_ACTION_MOVE);
+
+      g_signal_connect (drawing_area, "drag-begin",
+			G_CALLBACK (palette_drag_begin),
+			colorsel);
+      g_signal_connect (drawing_area, "drag-data-get",
+			G_CALLBACK (palette_drag_handle),
+			colorsel);
+
+      g_object_set_data (G_OBJECT (drawing_area), "color_set",
+			 GINT_TO_POINTER (1));
+    }
+
+  new_color[0] = color[0];
+  new_color[1] = color[1];
+  new_color[2] = color[2];
+  new_color[3] = 1.0;
+
+  g_object_set_data_full (G_OBJECT (drawing_area), "color_val", new_color, (GDestroyNotify)g_free);
+}
+
+static gboolean
+palette_draw (GtkWidget      *drawing_area,
+		cairo_t        *cr,
+		gpointer        data)
+{
+  if (gtk_widget_get_window (drawing_area) == NULL)
+    return FALSE;
+
+  palette_paint (drawing_area, cr, data);
+
+  return FALSE;
+}
+
+static void
+popup_position_func (GtkMenu   *menu,
+                     gint      *x,
+                     gint      *y,
+                     gboolean  *push_in,
+                     gpointer	user_data)
+{
+  GtkWidget *widget;
+  GtkRequisition req;
+  gint root_x, root_y;
+  GdkScreen *screen;
+  GtkAllocation allocation;
+
+  widget = GTK_WIDGET (user_data);
+
+  g_return_if_fail (gtk_widget_get_realized (widget));
+
+  gdk_window_get_origin (gtk_widget_get_window (widget), &root_x, &root_y);
+
+  gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL);
+
+  /* Put corner of menu centered on color cell */
+  gtk_widget_get_allocation (widget, &allocation);
+  *x = root_x + allocation.width / 2;
+  *y = root_y + allocation.height / 2;
+
+  /* Ensure sanity */
+  screen = gtk_widget_get_screen (widget);
+  *x = CLAMP (*x, 0, MAX (0, WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) - req.width));
+  *y = CLAMP (*y, 0, MAX (0, HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) - req.height));
+}
+
+static void
+save_color_selected (GtkWidget *menuitem,
+                     gpointer   data)
+{
+  MateColorSelection *colorsel;
+  GtkWidget *drawing_area;
+  MateColorSelectionPrivate *priv;
+
+  drawing_area = GTK_WIDGET (data);
+
+  colorsel = MATE_COLOR_SELECTION (g_object_get_data (G_OBJECT (drawing_area),
+                                                     "gtk-color-sel"));
+
+  priv = colorsel->private_data;
+
+  palette_change_color (drawing_area, colorsel, priv->color);
+}
+
+static void
+do_popup (MateColorSelection *colorsel,
+          GtkWidget         *drawing_area,
+          guint32            timestamp)
+{
+  GtkWidget *menu;
+  GtkWidget *mi;
+
+  g_object_set_data (G_OBJECT (drawing_area),
+                     _("gtk-color-sel"),
+                     colorsel);
+
+  menu = gtk_menu_new ();
+
+  mi = gtk_menu_item_new_with_mnemonic (_("_Save color here"));
+
+  g_signal_connect (mi, "activate",
+                    G_CALLBACK (save_color_selected),
+                    drawing_area);
+
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
+
+  gtk_widget_show_all (mi);
+
+  gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
+                  popup_position_func, drawing_area,
+                  3, timestamp);
+}
+
+static gboolean
+palette_enter (GtkWidget        *drawing_area,
+	       GdkEventCrossing *event,
+	       gpointer        data)
+{
+  g_object_set_data (G_OBJECT (drawing_area),
+		     "gtk-colorsel-have-pointer",
+		     GUINT_TO_POINTER (TRUE));
+
+  return FALSE;
+}
+
+static gboolean
+palette_leave (GtkWidget        *drawing_area,
+	       GdkEventCrossing *event,
+	       gpointer        data)
+{
+  g_object_set_data (G_OBJECT (drawing_area),
+		     "gtk-colorsel-have-pointer",
+		     NULL);
+
+  return FALSE;
+}
+
+/* private function copied from gtk2/gtkmain.c */
+static gboolean
+_gtk_button_event_triggers_context_menu (GdkEventButton *event)
+{
+  if (event->type == GDK_BUTTON_PRESS)
+    {
+      if (event->button == 3 &&
+          ! (event->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK)))
+        return TRUE;
+
+#ifdef GDK_WINDOWING_QUARTZ
+      if (event->button == 1 &&
+          ! (event->state & (GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) &&
+          (event->state & GDK_CONTROL_MASK))
+        return TRUE;
+#endif
+    }
+
+  return FALSE;
+}
+
+static gboolean
+palette_press (GtkWidget      *drawing_area,
+	       GdkEventButton *event,
+	       gpointer        data)
+{
+  MateColorSelection *colorsel = MATE_COLOR_SELECTION (data);
+
+  gtk_widget_grab_focus (drawing_area);
+
+  if (_gtk_button_event_triggers_context_menu (event))
+    {
+      do_popup (colorsel, drawing_area, event->time);
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
+static gboolean
+palette_release (GtkWidget      *drawing_area,
+		 GdkEventButton *event,
+		 gpointer        data)
+{
+  MateColorSelection *colorsel = MATE_COLOR_SELECTION (data);
+
+  gtk_widget_grab_focus (drawing_area);
+
+  if (event->button == 1 &&
+      g_object_get_data (G_OBJECT (drawing_area),
+			 "gtk-colorsel-have-pointer") != NULL)
+    {
+      gpointer pointer = g_object_get_data (G_OBJECT (drawing_area), "color_set");
+      if (pointer && GPOINTER_TO_INT (pointer) != 0)
+        {
+          gdouble color[4];
+          palette_get_color (drawing_area, color);
+          set_color_internal (colorsel, color);
+        }
+    }
+
+  return FALSE;
+}
+
+static void
+palette_drop_handle (GtkWidget        *widget,
+		     GdkDragContext   *context,
+		     gint              x,
+		     gint              y,
+		     GtkSelectionData *selection_data,
+		     guint             info,
+		     guint             time,
+		     gpointer          data)
+{
+  MateColorSelection *colorsel = MATE_COLOR_SELECTION (data);
+  guint16 *vals;
+  gdouble color[4];
+
+  if (gtk_selection_data_get_length (selection_data) < 0)
+    return;
+
+  /* We accept drops with the wrong format, since the KDE color
+   * chooser incorrectly drops application/x-color with format 8.
+   */
+  if (gtk_selection_data_get_length (selection_data) != 8)
+    {
+      g_warning ("Received invalid color data\n");
+      return;
+    }
+
+  vals = (guint16 *) gtk_selection_data_get_data (selection_data);
+
+  color[0] = (gdouble)vals[0] / 0xffff;
+  color[1] = (gdouble)vals[1] / 0xffff;
+  color[2] = (gdouble)vals[2] / 0xffff;
+  color[3] = (gdouble)vals[3] / 0xffff;
+  palette_change_color (widget, colorsel, color);
+  set_color_internal (colorsel, color);
+}
+
+static gint
+palette_activate (GtkWidget   *widget,
+		  GdkEventKey *event,
+		  gpointer     data)
+{
+  /* should have a drawing area subclass with an activate signal */
+  if ((event->keyval == GDK_KEY_space) ||
+      (event->keyval == GDK_KEY_Return) ||
+      (event->keyval == GDK_KEY_ISO_Enter) ||
+      (event->keyval == GDK_KEY_KP_Enter) ||
+      (event->keyval == GDK_KEY_KP_Space))
+    {
+      gpointer pointer = g_object_get_data (G_OBJECT (widget), "color_set");
+      if (pointer && GPOINTER_TO_INT (pointer) != 0)
+        {
+          gdouble color[4];
+          palette_get_color (widget, color);
+          set_color_internal (MATE_COLOR_SELECTION (data), color);
+        }
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
+static gboolean
+palette_popup (GtkWidget *widget,
+               gpointer   data)
+{
+  MateColorSelection *colorsel = MATE_COLOR_SELECTION (data);
+
+  do_popup (colorsel, widget, GDK_CURRENT_TIME);
+  return TRUE;
+}
+
+static GtkWidget*
+palette_new (MateColorSelection *colorsel)
+{
+  static const GtkTargetEntry targets[] = {
+    { .target = "application/x-color", .flags = 0, .info = 0 }
+  };
+
+  GtkWidget *retval = gtk_drawing_area_new ();
+
+  gtk_widget_set_can_focus (retval, TRUE);
+
+  g_object_set_data (G_OBJECT (retval), "color_set", GINT_TO_POINTER (0));
+  gtk_widget_set_events (retval, GDK_BUTTON_PRESS_MASK
+                         | GDK_BUTTON_RELEASE_MASK
+                         | GDK_EXPOSURE_MASK
+                         | GDK_ENTER_NOTIFY_MASK
+                         | GDK_LEAVE_NOTIFY_MASK);
+
+  g_signal_connect (retval, "draw",
+		    G_CALLBACK (palette_draw), colorsel);
+  g_signal_connect (retval, "button-press-event",
+		    G_CALLBACK (palette_press), colorsel);
+  g_signal_connect (retval, "button-release-event",
+		    G_CALLBACK (palette_release), colorsel);
+  g_signal_connect (retval, "enter-notify-event",
+		    G_CALLBACK (palette_enter), colorsel);
+  g_signal_connect (retval, "leave-notify-event",
+		    G_CALLBACK (palette_leave), colorsel);
+  g_signal_connect (retval, "key-press-event",
+		    G_CALLBACK (palette_activate), colorsel);
+  g_signal_connect (retval, "popup-menu",
+		    G_CALLBACK (palette_popup), colorsel);
+
+  gtk_drag_dest_set (retval,
+		     GTK_DEST_DEFAULT_HIGHLIGHT |
+		     GTK_DEST_DEFAULT_MOTION |
+		     GTK_DEST_DEFAULT_DROP,
+		     targets, 1,
+		     GDK_ACTION_COPY);
+
+  g_signal_connect (retval, "drag-end",
+                    G_CALLBACK (palette_drag_end), NULL);
+  g_signal_connect (retval, "drag-data-received",
+                    G_CALLBACK (palette_drop_handle), colorsel);
+
+  gtk_widget_set_tooltip_text (retval,
+                        _("Click this palette entry to make it the current color. To change this entry, drag a color swatch here or right-click it and select \"Save color here.\""));
+  return retval;
+}
+
+/*
+ *
+ * The actual MateColorSelection widget
+ *
+ */
+
+static GdkCursor *
+make_picker_cursor (GdkScreen *screen)
+{
+  GdkCursor *cursor;
+
+  cursor = gdk_cursor_new_from_name (gdk_screen_get_display (screen),
+				     "color-picker");
+
+  if (!cursor)
+    {
+      GdkPixbuf *pixbuf;
+
+      pixbuf = gdk_pixbuf_new_from_data (dropper_bits,
+                                         GDK_COLORSPACE_RGB, TRUE, 8,
+                                         DROPPER_WIDTH, DROPPER_HEIGHT,
+                                         DROPPER_STRIDE,
+                                         NULL, NULL);
+
+      cursor = gdk_cursor_new_from_pixbuf (gdk_screen_get_display (screen),
+                                           pixbuf,
+                                           DROPPER_X_HOT, DROPPER_Y_HOT);
+      g_object_unref (pixbuf);
+    }
+
+  return cursor;
+}
+
+static GdkDevice *get_device (GdkDisplay *display)
+{
+  GdkSeat   *seat;
+  GdkDevice *device;
+
+  seat = gdk_display_get_default_seat (display);
+  device = gdk_seat_get_pointer (seat);
+
+  return device;
+}
+
+static void
+grab_color_at_mouse (GdkScreen *screen,
+		     gint       x_root,
+		     gint       y_root,
+		     gpointer   data)
+{
+  GdkPixbuf *pixbuf;
+  guchar *pixels;
+  MateColorSelection *colorsel = data;
+  MateColorSelectionPrivate *priv;
+  GdkColor color;
+  GdkWindow *root_window = gdk_screen_get_root_window (screen);
+
+  priv = colorsel->private_data;
+
+  pixbuf = gdk_pixbuf_get_from_window (root_window,
+                                       x_root, y_root,
+                                       1, 1);
+  if (!pixbuf)
+    {
+      gint x, y;
+      GdkDevice *device;
+      GdkDisplay *display = gdk_screen_get_display (screen);
+      device = get_device (display);
+      GdkWindow *window = gdk_device_get_window_at_position (device, &x, &y);
+      if (!window)
+	return;
+      pixbuf = gdk_pixbuf_get_from_window (window,
+                                           x, y,
+                                           1, 1);
+      if (!pixbuf)
+	return;
+    }
+  pixels = gdk_pixbuf_get_pixels (pixbuf);
+  color.red = pixels[0] * 0x101;
+  color.green = pixels[1] * 0x101;
+  color.blue = pixels[2] * 0x101;
+  g_object_unref (pixbuf);
+
+  priv->color[COLORSEL_RED] = SCALE (color.red);
+  priv->color[COLORSEL_GREEN] = SCALE (color.green);
+  priv->color[COLORSEL_BLUE] = SCALE (color.blue);
+
+  gtk_rgb_to_hsv (priv->color[COLORSEL_RED],
+		  priv->color[COLORSEL_GREEN],
+		  priv->color[COLORSEL_BLUE],
+		  &priv->color[COLORSEL_HUE],
+		  &priv->color[COLORSEL_SATURATION],
+		  &priv->color[COLORSEL_VALUE]);
+
+  update_color (colorsel);
+}
+
+static void
+shutdown_eyedropper (GtkWidget *widget)
+{
+  MateColorSelection *colorsel;
+  MateColorSelectionPrivate *priv;
+  GdkDisplay *display = gtk_widget_get_display (widget);
+  GdkSeat   *seat = gdk_display_get_default_seat (display);
+
+  colorsel = MATE_COLOR_SELECTION (widget);
+  priv = colorsel->private_data;
+
+  if (priv->has_grab)
+    {
+      gdk_seat_ungrab (seat);
+      gtk_grab_remove (priv->dropper_grab_widget);
+
+      priv->has_grab = FALSE;
+    }
+}
+
+static void
+mouse_motion (GtkWidget      *invisible,
+	      GdkEventMotion *event,
+	      gpointer        data)
+{
+  grab_color_at_mouse (gdk_event_get_screen ((GdkEvent *)event),
+		       event->x_root, event->y_root, data);
+}
+
+static gboolean
+mouse_release (GtkWidget      *invisible,
+	       GdkEventButton *event,
+	       gpointer        data)
+{
+  /* MateColorSelection *colorsel = data; */
+
+  if (event->button != 1)
+    return FALSE;
+
+  grab_color_at_mouse (gdk_event_get_screen ((GdkEvent *)event),
+		       event->x_root, event->y_root, data);
+
+  shutdown_eyedropper (GTK_WIDGET (data));
+
+  g_signal_handlers_disconnect_by_func (invisible,
+					mouse_motion,
+					data);
+  g_signal_handlers_disconnect_by_func (invisible,
+					mouse_release,
+					data);
+
+  return TRUE;
+}
+
+/* Helper Functions */
+
+static gboolean
+key_press (GtkWidget   *invisible,
+           GdkEventKey *event,
+           gpointer     data)
+{
+  GdkDevice *device;
+  GdkDisplay *display = gtk_widget_get_display (invisible);
+  GdkScreen *screen = gdk_event_get_screen ((GdkEvent *)event);
+  guint state = event->state & gtk_accelerator_get_default_mod_mask ();
+  gint x, y;
+  gint dx, dy;
+
+  device = get_device (display);
+  gdk_device_get_position (device, NULL, &x, &y);
+
+  dx = 0;
+  dy = 0;
+
+  switch (event->keyval)
+    {
+    case GDK_KEY_space:
+    case GDK_KEY_Return:
+    case GDK_KEY_ISO_Enter:
+    case GDK_KEY_KP_Enter:
+    case GDK_KEY_KP_Space:
+      grab_color_at_mouse (screen, x, y, data);
+      /* fall through */
+
+    case GDK_KEY_Escape:
+      shutdown_eyedropper (data);
+
+      g_signal_handlers_disconnect_by_func (invisible,
+					    mouse_press,
+					    data);
+      g_signal_handlers_disconnect_by_func (invisible,
+					    key_press,
+					    data);
+
+      return TRUE;
+
+#if defined GDK_WINDOWING_X11
+    case GDK_KEY_Up:
+    case GDK_KEY_KP_Up:
+      dy = state == GDK_MOD1_MASK ? -BIG_STEP : -1;
+      break;
+
+    case GDK_KEY_Down:
+    case GDK_KEY_KP_Down:
+      dy = state == GDK_MOD1_MASK ? BIG_STEP : 1;
+      break;
+
+    case GDK_KEY_Left:
+    case GDK_KEY_KP_Left:
+      dx = state == GDK_MOD1_MASK ? -BIG_STEP : -1;
+      break;
+
+    case GDK_KEY_Right:
+    case GDK_KEY_KP_Right:
+      dx = state == GDK_MOD1_MASK ? BIG_STEP : 1;
+      break;
+#endif
+
+    default:
+      return FALSE;
+    }
+
+  gdk_device_warp (device, screen, x + dx, y + dy);
+
+  return TRUE;
+
+}
+
+static gboolean
+mouse_press (GtkWidget      *invisible,
+	     GdkEventButton *event,
+	     gpointer        data)
+{
+  /* MateColorSelection *colorsel = data; */
+
+  if (event->type == GDK_BUTTON_PRESS &&
+      event->button == 1)
+    {
+      g_signal_connect (invisible, "motion-notify-event",
+                        G_CALLBACK (mouse_motion),
+                        data);
+      g_signal_connect (invisible, "button-release-event",
+                        G_CALLBACK (mouse_release),
+                        data);
+      g_signal_handlers_disconnect_by_func (invisible,
+					    mouse_press,
+					    data);
+      g_signal_handlers_disconnect_by_func (invisible,
+					    key_press,
+					    data);
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
+/* when the button is clicked */
+static void
+get_screen_color (GtkWidget *button)
+{
+  MateColorSelection *colorsel = g_object_get_data (G_OBJECT (button), "COLORSEL");
+  MateColorSelectionPrivate *priv = colorsel->private_data;
+  GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (button));
+  GdkCursor *picker_cursor;
+  GdkGrabStatus grab_status;
+  GtkWidget *grab_widget, *toplevel;
+  GdkDisplay *display;
+  GdkEvent   *event;
+  GdkSeat    *seat;
+
+  guint32 time = gtk_get_current_event_time ();
+  event = gtk_get_current_event ();
+  if (priv->dropper_grab_widget == NULL)
+    {
+      grab_widget = gtk_window_new (GTK_WINDOW_POPUP);
+      gtk_window_set_screen (GTK_WINDOW (grab_widget), screen);
+      gtk_window_resize (GTK_WINDOW (grab_widget), 1, 1);
+      gtk_window_move (GTK_WINDOW (grab_widget), -100, -100);
+      gtk_widget_show (grab_widget);
+
+      gtk_widget_add_events (grab_widget,
+                             GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK);
+
+      toplevel = gtk_widget_get_toplevel (GTK_WIDGET (colorsel));
+
+      if (GTK_IS_WINDOW (toplevel))
+	{
+	  if (gtk_window_get_group (GTK_WINDOW (toplevel)))
+	    gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)),
+					 GTK_WINDOW (grab_widget));
+	}
+
+      priv->dropper_grab_widget = grab_widget;
+    }
+
+  display = gtk_widget_get_display (priv->dropper_grab_widget);
+  seat = gdk_display_get_default_seat (display);
+
+  if (gdk_seat_grab (seat, gtk_widget_get_window (priv->dropper_grab_widget),
+                     GDK_SEAT_CAPABILITY_KEYBOARD, FALSE, NULL,
+                     event,
+                     NULL, NULL) != GDK_GRAB_SUCCESS)
+  {
+    gdk_event_free (event);
+    return;
+  }
+
+  picker_cursor = make_picker_cursor (screen);
+  grab_status = gdk_seat_grab (seat, gtk_widget_get_window (priv->dropper_grab_widget),
+                               GDK_SEAT_CAPABILITY_POINTER, FALSE, picker_cursor,
+                               event,
+                               NULL, NULL);
+  gdk_event_free (event);
+  g_object_unref (picker_cursor);
+
+  if (grab_status != GDK_GRAB_SUCCESS)
+    {
+      gdk_seat_ungrab (seat);
+      return;
+    }
+
+  gtk_grab_add (priv->dropper_grab_widget);
+  priv->grab_time = time;
+  priv->has_grab = TRUE;
+
+  g_signal_connect (priv->dropper_grab_widget, "button-press-event",
+                    G_CALLBACK (mouse_press), colorsel);
+  g_signal_connect (priv->dropper_grab_widget, "key-press-event",
+                    G_CALLBACK (key_press), colorsel);
+}
+
+static void
+hex_changed (GtkWidget *hex_entry,
+	     gpointer   data)
+{
+  MateColorSelection *colorsel;
+  MateColorSelectionPrivate *priv;
+  GdkColor color;
+  gchar *text;
+
+  colorsel = MATE_COLOR_SELECTION (data);
+  priv = colorsel->private_data;
+
+  if (priv->changing)
+    return;
+
+  text = gtk_editable_get_chars (GTK_EDITABLE (priv->hex_entry), 0, -1);
+  if (gdk_color_parse (text, &color))
+    {
+      priv->color[COLORSEL_RED] = CLAMP (color.red/65535.0, 0.0, 1.0);
+      priv->color[COLORSEL_GREEN] = CLAMP (color.green/65535.0, 0.0, 1.0);
+      priv->color[COLORSEL_BLUE] = CLAMP (color.blue/65535.0, 0.0, 1.0);
+      gtk_rgb_to_hsv (priv->color[COLORSEL_RED],
+		      priv->color[COLORSEL_GREEN],
+		      priv->color[COLORSEL_BLUE],
+		      &priv->color[COLORSEL_HUE],
+		      &priv->color[COLORSEL_SATURATION],
+		      &priv->color[COLORSEL_VALUE]);
+      update_color (colorsel);
+    }
+  g_free (text);
+}
+
+static gboolean
+hex_focus_out (GtkWidget     *hex_entry,
+	       GdkEventFocus *event,
+	       gpointer       data)
+{
+  hex_changed (hex_entry, data);
+
+  return FALSE;
+}
+
+static void
+hsv_changed (GtkWidget *hsv,
+	     gpointer   data)
+{
+  MateColorSelection *colorsel;
+  MateColorSelectionPrivate *priv;
+
+  colorsel = MATE_COLOR_SELECTION (data);
+  priv = colorsel->private_data;
+
+  if (priv->changing)
+    return;
+
+  mate_hsv_get_color (MATE_HSV (hsv),
+		      &priv->color[COLORSEL_HUE],
+		      &priv->color[COLORSEL_SATURATION],
+		      &priv->color[COLORSEL_VALUE]);
+  gtk_hsv_to_rgb (priv->color[COLORSEL_HUE],
+		  priv->color[COLORSEL_SATURATION],
+		  priv->color[COLORSEL_VALUE],
+		  &priv->color[COLORSEL_RED],
+		  &priv->color[COLORSEL_GREEN],
+		  &priv->color[COLORSEL_BLUE]);
+  update_color (colorsel);
+}
+
+static void
+adjustment_changed (GtkAdjustment *adjustment,
+		    gpointer       data)
+{
+  MateColorSelection *colorsel;
+  MateColorSelectionPrivate *priv;
+  gdouble value;
+
+  colorsel = MATE_COLOR_SELECTION (g_object_get_data (G_OBJECT (adjustment), "COLORSEL"));
+  priv = colorsel->private_data;
+  value = gtk_adjustment_get_value (adjustment);
+
+  if (priv->changing)
+    return;
+
+  switch (GPOINTER_TO_INT (data))
+    {
+    case COLORSEL_SATURATION:
+    case COLORSEL_VALUE:
+      priv->color[GPOINTER_TO_INT (data)] = value / 100;
+      gtk_hsv_to_rgb (priv->color[COLORSEL_HUE],
+		      priv->color[COLORSEL_SATURATION],
+		      priv->color[COLORSEL_VALUE],
+		      &priv->color[COLORSEL_RED],
+		      &priv->color[COLORSEL_GREEN],
+		      &priv->color[COLORSEL_BLUE]);
+      break;
+    case COLORSEL_HUE:
+      priv->color[GPOINTER_TO_INT (data)] = value / 360;
+      gtk_hsv_to_rgb (priv->color[COLORSEL_HUE],
+		      priv->color[COLORSEL_SATURATION],
+		      priv->color[COLORSEL_VALUE],
+		      &priv->color[COLORSEL_RED],
+		      &priv->color[COLORSEL_GREEN],
+		      &priv->color[COLORSEL_BLUE]);
+      break;
+    case COLORSEL_RED:
+    case COLORSEL_GREEN:
+    case COLORSEL_BLUE:
+      priv->color[GPOINTER_TO_INT (data)] = value / 255;
+
+      gtk_rgb_to_hsv (priv->color[COLORSEL_RED],
+		      priv->color[COLORSEL_GREEN],
+		      priv->color[COLORSEL_BLUE],
+		      &priv->color[COLORSEL_HUE],
+		      &priv->color[COLORSEL_SATURATION],
+		      &priv->color[COLORSEL_VALUE]);
+      break;
+    default:
+      priv->color[GPOINTER_TO_INT (data)] = value / 255;
+      break;
+    }
+  update_color (colorsel);
+}
+
+static void
+opacity_entry_changed (GtkWidget *opacity_entry,
+		       gpointer   data)
+{
+  MateColorSelection *colorsel;
+  MateColorSelectionPrivate *priv;
+  GtkAdjustment *adj;
+  gchar *text;
+
+  colorsel = MATE_COLOR_SELECTION (data);
+  priv = colorsel->private_data;
+
+  if (priv->changing)
+    return;
+
+  text = gtk_editable_get_chars (GTK_EDITABLE (priv->opacity_entry), 0, -1);
+  adj = gtk_range_get_adjustment (GTK_RANGE (priv->opacity_slider));
+  gtk_adjustment_set_value (adj, g_strtod (text, NULL));
+
+  update_color (colorsel);
+
+  g_free (text);
+}
+
+static void
+make_label_spinbutton (MateColorSelection *colorsel,
+		       GtkWidget        **spinbutton,
+		       gchar             *text,
+		       GtkWidget         *grid,
+		       gint               i,
+		       gint               j,
+		       gint               channel_type,
+                       const gchar       *tooltip)
+{
+  GtkWidget *label;
+  GtkAdjustment *adjust;
+
+  if (channel_type == COLORSEL_HUE)
+    {
+      adjust = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 360.0, 1.0, 1.0, 0.0));
+    }
+  else if (channel_type == COLORSEL_SATURATION ||
+	   channel_type == COLORSEL_VALUE)
+    {
+      adjust = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 100.0, 1.0, 1.0, 0.0));
+    }
+  else
+    {
+      adjust = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 255.0, 1.0, 1.0, 0.0));
+    }
+  g_object_set_data (G_OBJECT (adjust), "COLORSEL", colorsel);
+  *spinbutton = gtk_spin_button_new (adjust, 10.0, 0);
+
+  gtk_widget_set_tooltip_text (*spinbutton, tooltip);
+
+  g_signal_connect (adjust, "value-changed",
+                    G_CALLBACK (adjustment_changed),
+                    GINT_TO_POINTER (channel_type));
+  label = gtk_label_new_with_mnemonic (text);
+  gtk_label_set_mnemonic_widget (GTK_LABEL (label), *spinbutton);
+
+  gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+  gtk_grid_attach (GTK_GRID (grid), label, i, j, 1, 1);
+  gtk_grid_attach (GTK_GRID (grid), *spinbutton, i+1, j, 1, 1);
+}
+
+static void
+make_palette_frame (MateColorSelection *colorsel,
+		    GtkWidget         *grid,
+		    gint               i,
+		    gint               j)
+{
+  GtkWidget *frame;
+  MateColorSelectionPrivate *priv;
+
+  priv = colorsel->private_data;
+  frame = gtk_frame_new (NULL);
+  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
+  priv->custom_palette[i][j] = palette_new (colorsel);
+  gtk_widget_set_size_request (priv->custom_palette[i][j], CUSTOM_PALETTE_ENTRY_WIDTH, CUSTOM_PALETTE_ENTRY_HEIGHT);
+  gtk_container_add (GTK_CONTAINER (frame), priv->custom_palette[i][j]);
+  gtk_widget_set_hexpand (frame, TRUE);
+  gtk_grid_attach (GTK_GRID (grid), frame, i, j, 1, 1);
+}
+
+/* Set the palette entry [x][y] to be the currently selected one. */
+static void
+set_selected_palette (MateColorSelection *colorsel, int x, int y)
+{
+  MateColorSelectionPrivate *priv = colorsel->private_data;
+
+  gtk_widget_grab_focus (priv->custom_palette[x][y]);
+}
+
+static double
+scale_round (double val, double factor)
+{
+  val = floor (val * factor + 0.5);
+  val = MAX (val, 0);
+  val = MIN (val, factor);
+  return val;
+}
+
+static void
+update_color (MateColorSelection *colorsel)
+{
+  MateColorSelectionPrivate *priv = colorsel->private_data;
+  gchar entryval[12];
+  gchar opacity_text[32];
+  gchar *ptr;
+  double r;
+  double g;
+  double b;
+
+  priv->changing = TRUE;
+  color_sample_update_samples (colorsel);
+
+  mate_hsv_set_color (MATE_HSV (priv->triangle_colorsel),
+		      priv->color[COLORSEL_HUE],
+		      priv->color[COLORSEL_SATURATION],
+		      priv->color[COLORSEL_VALUE]);
+  gtk_adjustment_set_value (gtk_spin_button_get_adjustment
+			    (GTK_SPIN_BUTTON (priv->hue_spinbutton)),
+			    scale_round (priv->color[COLORSEL_HUE], 360));
+  gtk_adjustment_set_value (gtk_spin_button_get_adjustment
+			    (GTK_SPIN_BUTTON (priv->sat_spinbutton)),
+			    scale_round (priv->color[COLORSEL_SATURATION], 100));
+  gtk_adjustment_set_value (gtk_spin_button_get_adjustment
+			    (GTK_SPIN_BUTTON (priv->val_spinbutton)),
+			    scale_round (priv->color[COLORSEL_VALUE], 100));
+  gtk_adjustment_set_value (gtk_spin_button_get_adjustment
+			    (GTK_SPIN_BUTTON (priv->red_spinbutton)),
+			    scale_round (priv->color[COLORSEL_RED], 255));
+  gtk_adjustment_set_value (gtk_spin_button_get_adjustment
+			    (GTK_SPIN_BUTTON (priv->green_spinbutton)),
+			    scale_round (priv->color[COLORSEL_GREEN], 255));
+  gtk_adjustment_set_value (gtk_spin_button_get_adjustment
+			    (GTK_SPIN_BUTTON (priv->blue_spinbutton)),
+			    scale_round (priv->color[COLORSEL_BLUE], 255));
+  gtk_adjustment_set_value (gtk_range_get_adjustment
+			    (GTK_RANGE (priv->opacity_slider)),
+			    scale_round (priv->color[COLORSEL_OPACITY], 255));
+
+  g_snprintf (opacity_text, 32, "%.0f", scale_round (priv->color[COLORSEL_OPACITY], 255));
+  gtk_entry_set_text (GTK_ENTRY (priv->opacity_entry), opacity_text);
+
+  r = scale_round (priv->color[COLORSEL_RED],   255);
+  g = scale_round (priv->color[COLORSEL_GREEN], 255);
+  b = scale_round (priv->color[COLORSEL_BLUE],  255);
+  g_snprintf (entryval, 11, "#%2X%2X%2X", (guint) r, (guint) g, (guint) b);
+
+  for (ptr = entryval; *ptr; ptr++)
+    if (*ptr == ' ')
+      *ptr = '0';
+  gtk_entry_set_text (GTK_ENTRY (priv->hex_entry), entryval);
+  priv->changing = FALSE;
+
+  g_object_ref (colorsel);
+
+  g_signal_emit (colorsel, color_selection_signals[COLOR_CHANGED], 0);
+
+  g_object_freeze_notify (G_OBJECT (colorsel));
+  g_object_notify (G_OBJECT (colorsel), "current-color");
+  g_object_notify (G_OBJECT (colorsel), "current-alpha");
+  g_object_thaw_notify (G_OBJECT (colorsel));
+
+  g_object_unref (colorsel);
+}
+
+static void
+update_palette (MateColorSelection *colorsel)
+{
+  GdkColor *current_colors;
+  gint i, j;
+
+  current_colors = get_current_colors (colorsel);
+
+  for (i = 0; i < GTK_CUSTOM_PALETTE_HEIGHT; i++)
+    {
+      for (j = 0; j < GTK_CUSTOM_PALETTE_WIDTH; j++)
+	{
+          gint index;
+
+          index = i * GTK_CUSTOM_PALETTE_WIDTH + j;
+
+          mate_color_selection_set_palette_color (colorsel,
+                                                 index,
+                                                 &current_colors[index]);
+	}
+    }
+
+  g_free (current_colors);
+}
+
+static void
+palette_change_notify_instance (GObject    *object,
+                                GParamSpec *pspec,
+                                gpointer    data)
+{
+  update_palette (MATE_COLOR_SELECTION (data));
+}
+
+static void
+default_noscreen_change_palette_func (const GdkColor *colors,
+				      gint            n_colors)
+{
+  default_change_palette_func (gdk_screen_get_default (), colors, n_colors);
+}
+
+static void
+default_change_palette_func (GdkScreen	    *screen,
+			     const GdkColor *colors,
+                             gint            n_colors)
+{
+  gchar *str;
+
+  str = mate_color_selection_palette_to_string (colors, n_colors);
+
+  gtk_settings_set_string_property (gtk_settings_get_for_screen (screen),
+                                    "gtk-color-palette",
+                                    str,
+                                    "mate_color_selection_palette_to_string");
+
+  g_free (str);
+}
+
+/**
+ * mate_color_selection_new:
+ *
+ * Creates a new MateColorSelection.
+ *
+ * Return value: a new #MateColorSelection
+ **/
+GtkWidget *
+mate_color_selection_new (void)
+{
+  MateColorSelection *colorsel;
+  MateColorSelectionPrivate *priv;
+  gdouble color[4];
+  color[0] = 1.0;
+  color[1] = 1.0;
+  color[2] = 1.0;
+  color[3] = 1.0;
+
+  colorsel = g_object_new (MATE_TYPE_COLOR_SELECTION, "orientation", GTK_ORIENTATION_VERTICAL, NULL);
+  priv = colorsel->private_data;
+  set_color_internal (colorsel, color);
+  mate_color_selection_set_has_opacity_control (colorsel, TRUE);
+
+  /* We want to make sure that default_set is FALSE */
+  /* This way the user can still set it */
+  priv->default_set = FALSE;
+  priv->default_alpha_set = FALSE;
+
+  return GTK_WIDGET (colorsel);
+}
+
+/**
+ * mate_color_selection_get_has_opacity_control:
+ * @colorsel: a #MateColorSelection.
+ *
+ * Determines whether the colorsel has an opacity control.
+ *
+ * Return value: %TRUE if the @colorsel has an opacity control.  %FALSE if it does't.
+ **/
+gboolean
+mate_color_selection_get_has_opacity_control (MateColorSelection *colorsel)
+{
+  MateColorSelectionPrivate *priv;
+
+  g_return_val_if_fail (MATE_IS_COLOR_SELECTION (colorsel), FALSE);
+
+  priv = colorsel->private_data;
+
+  return priv->has_opacity;
+}
+
+/**
+ * mate_color_selection_set_has_opacity_control:
+ * @colorsel: a #MateColorSelection.
+ * @has_opacity: %TRUE if @colorsel can set the opacity, %FALSE otherwise.
+ *
+ * Sets the @colorsel to use or not use opacity.
+ *
+ **/
+void
+mate_color_selection_set_has_opacity_control (MateColorSelection *colorsel,
+					     gboolean           has_opacity)
+{
+  MateColorSelectionPrivate *priv;
+
+  g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel));
+
+  priv = colorsel->private_data;
+  has_opacity = has_opacity != FALSE;
+
+  if (priv->has_opacity != has_opacity)
+    {
+      priv->has_opacity = (has_opacity != FALSE);
+      if (has_opacity)
+	{
+	  gtk_widget_show (priv->opacity_slider);
+	  gtk_widget_show (priv->opacity_label);
+	  gtk_widget_show (priv->opacity_entry);
+	}
+      else
+	{
+	  gtk_widget_hide (priv->opacity_slider);
+	  gtk_widget_hide (priv->opacity_label);
+	  gtk_widget_hide (priv->opacity_entry);
+	}
+      color_sample_update_samples (colorsel);
+
+      g_object_notify (G_OBJECT (colorsel), "has-opacity-control");
+    }
+}
+
+/**
+ * mate_color_selection_get_has_palette:
+ * @colorsel: a #MateColorSelection.
+ *
+ * Determines whether the color selector has a color palette.
+ *
+ * Return value: %TRUE if the selector has a palette.  %FALSE if it hasn't.
+ **/
+gboolean
+mate_color_selection_get_has_palette (MateColorSelection *colorsel)
+{
+  MateColorSelectionPrivate *priv;
+
+  g_return_val_if_fail (MATE_IS_COLOR_SELECTION (colorsel), FALSE);
+
+  priv = colorsel->private_data;
+
+  return priv->has_palette;
+}
+
+/**
+ * mate_color_selection_set_has_palette:
+ * @colorsel: a #MateColorSelection.
+ * @has_palette: %TRUE if palette is to be visible, %FALSE otherwise.
+ *
+ * Shows and hides the palette based upon the value of @has_palette.
+ *
+ **/
+void
+mate_color_selection_set_has_palette (MateColorSelection *colorsel,
+				     gboolean           has_palette)
+{
+  MateColorSelectionPrivate *priv;
+  g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel));
+
+  priv = colorsel->private_data;
+  has_palette = has_palette != FALSE;
+
+  if (priv->has_palette != has_palette)
+    {
+      priv->has_palette = (has_palette != FALSE);
+      if (has_palette)
+	gtk_widget_show (priv->palette_frame);
+      else
+	gtk_widget_hide (priv->palette_frame);
+
+      update_tooltips (colorsel);
+
+      g_object_notify (G_OBJECT (colorsel), "has-palette");
+    }
+}
+
+/**
+ * mate_color_selection_set_current_color:
+ * @colorsel: a #MateColorSelection.
+ * @color: A #GdkColor to set the current color with.
+ *
+ * Sets the current color to be @color.  The first time this is called, it will
+ * also set the original color to be @color too.
+ **/
+void
+mate_color_selection_set_current_color (MateColorSelection *colorsel,
+				       const GdkColor    *color)
+{
+  MateColorSelectionPrivate *priv;
+  gint i;
+
+  g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel));
+  g_return_if_fail (color != NULL);
+
+  priv = colorsel->private_data;
+  priv->changing = TRUE;
+  priv->color[COLORSEL_RED] = SCALE (color->red);
+  priv->color[COLORSEL_GREEN] = SCALE (color->green);
+  priv->color[COLORSEL_BLUE] = SCALE (color->blue);
+  gtk_rgb_to_hsv (priv->color[COLORSEL_RED],
+		  priv->color[COLORSEL_GREEN],
+		  priv->color[COLORSEL_BLUE],
+		  &priv->color[COLORSEL_HUE],
+		  &priv->color[COLORSEL_SATURATION],
+		  &priv->color[COLORSEL_VALUE]);
+  if (priv->default_set == FALSE)
+    {
+      for (i = 0; i < COLORSEL_NUM_CHANNELS; i++)
+	priv->old_color[i] = priv->color[i];
+    }
+  priv->default_set = TRUE;
+  update_color (colorsel);
+}
+
+/**
+ * mate_color_selection_set_current_alpha:
+ * @colorsel: a #MateColorSelection.
+ * @alpha: an integer between 0 and 65535.
+ *
+ * Sets the current opacity to be @alpha.  The first time this is called, it will
+ * also set the original opacity to be @alpha too.
+ **/
+void
+mate_color_selection_set_current_alpha (MateColorSelection *colorsel,
+				       guint16            alpha)
+{
+  MateColorSelectionPrivate *priv;
+  gint i;
+
+  g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel));
+
+  priv = colorsel->private_data;
+  priv->changing = TRUE;
+  priv->color[COLORSEL_OPACITY] = SCALE (alpha);
+  if (priv->default_alpha_set == FALSE)
+    {
+      for (i = 0; i < COLORSEL_NUM_CHANNELS; i++)
+	priv->old_color[i] = priv->color[i];
+    }
+  priv->default_alpha_set = TRUE;
+  update_color (colorsel);
+}
+
+/**
+ * mate_color_selection_set_color:
+ * @colorsel: a #MateColorSelection.
+ * @color: an array of 4 doubles specifying the red, green, blue and opacity
+ *   to set the current color to.
+ *
+ * Sets the current color to be @color.  The first time this is called, it will
+ * also set the original color to be @color too.
+ *
+ * Deprecated: 2.0: Use mate_color_selection_set_current_color() instead.
+ **/
+void
+mate_color_selection_set_color (MateColorSelection    *colorsel,
+			       gdouble              *color)
+{
+  g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel));
+
+  set_color_internal (colorsel, color);
+}
+
+/**
+ * mate_color_selection_get_current_color:
+ * @colorsel: a #MateColorSelection.
+ * @color: (out): a #GdkColor to fill in with the current color.
+ *
+ * Sets @color to be the current color in the MateColorSelection widget.
+ **/
+void
+mate_color_selection_get_current_color (MateColorSelection *colorsel,
+				       GdkColor          *color)
+{
+  MateColorSelectionPrivate *priv;
+
+  g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel));
+  g_return_if_fail (color != NULL);
+
+  priv = colorsel->private_data;
+  color->red = UNSCALE (priv->color[COLORSEL_RED]);
+  color->green = UNSCALE (priv->color[COLORSEL_GREEN]);
+  color->blue = UNSCALE (priv->color[COLORSEL_BLUE]);
+}
+
+/**
+ * mate_color_selection_get_current_alpha:
+ * @colorsel: a #MateColorSelection.
+ *
+ * Returns the current alpha value.
+ *
+ * Return value: an integer between 0 and 65535.
+ **/
+guint16
+mate_color_selection_get_current_alpha (MateColorSelection *colorsel)
+{
+  MateColorSelectionPrivate *priv;
+
+  g_return_val_if_fail (MATE_IS_COLOR_SELECTION (colorsel), 0);
+
+  priv = colorsel->private_data;
+  return priv->has_opacity ? UNSCALE (priv->color[COLORSEL_OPACITY]) : 65535;
+}
+
+/**
+ * mate_color_selection_get_color:
+ * @colorsel: a #MateColorSelection.
+ * @color: an array of 4 #gdouble to fill in with the current color.
+ *
+ * Sets @color to be the current color in the MateColorSelection widget.
+ *
+ * Deprecated: 2.0: Use mate_color_selection_get_current_color() instead.
+ **/
+void
+mate_color_selection_get_color (MateColorSelection *colorsel,
+			       gdouble           *color)
+{
+  MateColorSelectionPrivate *priv;
+
+  g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel));
+
+  priv = colorsel->private_data;
+  color[0] = priv->color[COLORSEL_RED];
+  color[1] = priv->color[COLORSEL_GREEN];
+  color[2] = priv->color[COLORSEL_BLUE];
+  color[3] = priv->has_opacity ? priv->color[COLORSEL_OPACITY] : 65535;
+}
+
+/**
+ * mate_color_selection_set_previous_color:
+ * @colorsel: a #MateColorSelection.
+ * @color: a #GdkColor to set the previous color with.
+ *
+ * Sets the 'previous' color to be @color.  This function should be called with
+ * some hesitations, as it might seem confusing to have that color change.
+ * Calling mate_color_selection_set_current_color() will also set this color the first
+ * time it is called.
+ **/
+void
+mate_color_selection_set_previous_color (MateColorSelection *colorsel,
+					const GdkColor    *color)
+{
+  MateColorSelectionPrivate *priv;
+
+  g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel));
+  g_return_if_fail (color != NULL);
+
+  priv = colorsel->private_data;
+  priv->changing = TRUE;
+  priv->old_color[COLORSEL_RED] = SCALE (color->red);
+  priv->old_color[COLORSEL_GREEN] = SCALE (color->green);
+  priv->old_color[COLORSEL_BLUE] = SCALE (color->blue);
+  gtk_rgb_to_hsv (priv->old_color[COLORSEL_RED],
+		  priv->old_color[COLORSEL_GREEN],
+		  priv->old_color[COLORSEL_BLUE],
+		  &priv->old_color[COLORSEL_HUE],
+		  &priv->old_color[COLORSEL_SATURATION],
+		  &priv->old_color[COLORSEL_VALUE]);
+  color_sample_update_samples (colorsel);
+  priv->default_set = TRUE;
+  priv->changing = FALSE;
+}
+
+/**
+ * mate_color_selection_set_previous_alpha:
+ * @colorsel: a #MateColorSelection.
+ * @alpha: an integer between 0 and 65535.
+ *
+ * Sets the 'previous' alpha to be @alpha.  This function should be called with
+ * some hesitations, as it might seem confusing to have that alpha change.
+ **/
+void
+mate_color_selection_set_previous_alpha (MateColorSelection *colorsel,
+					guint16            alpha)
+{
+  MateColorSelectionPrivate *priv;
+
+  g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel));
+
+  priv = colorsel->private_data;
+  priv->changing = TRUE;
+  priv->old_color[COLORSEL_OPACITY] = SCALE (alpha);
+  color_sample_update_samples (colorsel);
+  priv->default_alpha_set = TRUE;
+  priv->changing = FALSE;
+}
+
+/**
+ * mate_color_selection_get_previous_color:
+ * @colorsel: a #MateColorSelection.
+ * @color: (out): a #GdkColor to fill in with the original color value.
+ *
+ * Fills @color in with the original color value.
+ **/
+void
+mate_color_selection_get_previous_color (MateColorSelection *colorsel,
+					GdkColor           *color)
+{
+  MateColorSelectionPrivate *priv;
+
+  g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel));
+  g_return_if_fail (color != NULL);
+
+  priv = colorsel->private_data;
+  color->red = UNSCALE (priv->old_color[COLORSEL_RED]);
+  color->green = UNSCALE (priv->old_color[COLORSEL_GREEN]);
+  color->blue = UNSCALE (priv->old_color[COLORSEL_BLUE]);
+}
+
+/**
+ * mate_color_selection_get_previous_alpha:
+ * @colorsel: a #MateColorSelection.
+ *
+ * Returns the previous alpha value.
+ *
+ * Return value: an integer between 0 and 65535.
+ **/
+guint16
+mate_color_selection_get_previous_alpha (MateColorSelection *colorsel)
+{
+  MateColorSelectionPrivate *priv;
+
+  g_return_val_if_fail (MATE_IS_COLOR_SELECTION (colorsel), 0);
+
+  priv = colorsel->private_data;
+  return priv->has_opacity ? UNSCALE (priv->old_color[COLORSEL_OPACITY]) : 65535;
+}
+
+/**
+ * mate_color_selection_set_palette_color:
+ * @colorsel: a #MateColorSelection.
+ * @index: the color index of the palette.
+ * @color: A #GdkColor to set the palette with.
+ *
+ * Sets the palette located at @index to have @color as its color.
+ *
+ **/
+static void
+mate_color_selection_set_palette_color (MateColorSelection   *colorsel,
+				       gint                 index,
+				       GdkColor            *color)
+{
+  MateColorSelectionPrivate *priv;
+  gint x, y;
+  gdouble col[3];
+
+  g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel));
+  g_return_if_fail (index >= 0  && index < GTK_CUSTOM_PALETTE_WIDTH*GTK_CUSTOM_PALETTE_HEIGHT);
+
+  x = index % GTK_CUSTOM_PALETTE_WIDTH;
+  y = index / GTK_CUSTOM_PALETTE_WIDTH;
+
+  priv = colorsel->private_data;
+  col[0] = SCALE (color->red);
+  col[1] = SCALE (color->green);
+  col[2] = SCALE (color->blue);
+
+  palette_set_color (priv->custom_palette[x][y], colorsel, col);
+}
+
+/**
+ * mate_color_selection_is_adjusting:
+ * @colorsel: a #MateColorSelection.
+ *
+ * Gets the current state of the @colorsel.
+ *
+ * Return value: %TRUE if the user is currently dragging a color around, and %FALSE
+ * if the selection has stopped.
+ **/
+gboolean
+mate_color_selection_is_adjusting (MateColorSelection *colorsel)
+{
+  MateColorSelectionPrivate *priv;
+
+  g_return_val_if_fail (MATE_IS_COLOR_SELECTION (colorsel), FALSE);
+
+  priv = colorsel->private_data;
+
+  return (mate_hsv_is_adjusting (MATE_HSV (priv->triangle_colorsel)));
+}
+
+/**
+ * mate_color_selection_palette_from_string:
+ * @str: a string encoding a color palette.
+ * @colors: (out) (array length=n_colors): return location for allocated
+ *          array of #GdkColor.
+ * @n_colors: return location for length of array.
+ *
+ * Parses a color palette string; the string is a colon-separated
+ * list of color names readable by gdk_color_parse().
+ *
+ * Return value: %TRUE if a palette was successfully parsed.
+ **/
+gboolean
+mate_color_selection_palette_from_string (const gchar *str,
+                                         GdkColor   **colors,
+                                         gint        *n_colors)
+{
+  GdkColor *retval;
+  gint count;
+  gchar *p;
+  gchar *start;
+  gchar *copy;
+
+  count = 0;
+  retval = NULL;
+  copy = g_strdup (str);
+
+  start = copy;
+  p = copy;
+  while (TRUE)
+    {
+      if (*p == ':' || *p == '\0')
+        {
+          gboolean done = TRUE;
+
+          if (start == p)
+            {
+              goto failed; /* empty entry */
+            }
+
+          if (*p)
+            {
+              *p = '\0';
+              done = FALSE;
+            }
+
+          retval = g_renew (GdkColor, retval, count + 1);
+          if (!gdk_color_parse (start, retval + count))
+            {
+              goto failed;
+            }
+
+          ++count;
+
+          if (done)
+            break;
+          else
+            start = p + 1;
+        }
+
+      ++p;
+    }
+
+  g_free (copy);
+
+  if (colors)
+    *colors = retval;
+  else
+    g_free (retval);
+
+  if (n_colors)
+    *n_colors = count;
+
+  return TRUE;
+
+ failed:
+  g_free (copy);
+  g_free (retval);
+
+  if (colors)
+    *colors = NULL;
+  if (n_colors)
+    *n_colors = 0;
+
+  return FALSE;
+}
+
+/**
+ * mate_color_selection_palette_to_string:
+ * @colors: (array length=n_colors): an array of colors.
+ * @n_colors: length of the array.
+ *
+ * Encodes a palette as a string, useful for persistent storage.
+ *
+ * Return value: allocated string encoding the palette.
+ **/
+gchar*
+mate_color_selection_palette_to_string (const GdkColor *colors,
+                                       gint            n_colors)
+{
+  gint i;
+  gchar **strs = NULL;
+  gchar *retval;
+
+  if (n_colors == 0)
+    return g_strdup ("");
+
+  strs = g_new0 (gchar*, n_colors + 1);
+
+  i = 0;
+  while (i < n_colors)
+    {
+      gchar *ptr;
+
+      strs[i] =
+        g_strdup_printf ("#%2X%2X%2X",
+                         colors[i].red / 256,
+                         colors[i].green / 256,
+                         colors[i].blue / 256);
+
+      for (ptr = strs[i]; *ptr; ptr++)
+        if (*ptr == ' ')
+          *ptr = '0';
+
+      ++i;
+    }
+
+  retval = g_strjoinv (":", strs);
+
+  g_strfreev (strs);
+
+  return retval;
+}
+
+/**
+ * mate_color_selection_set_change_palette_hook:
+ * @func: a function to call when the custom palette needs saving.
+ *
+ * Installs a global function to be called whenever the user tries to
+ * modify the palette in a color selection. This function should save
+ * the new palette contents, and update the GtkSettings property
+ * "gtk-color-palette" so all MateColorSelection widgets will be modified.
+ *
+ * Return value: the previous change palette hook (that was replaced).
+ *
+ * Deprecated: 2.4: This function does not work in multihead environments.
+ *     Use mate_color_selection_set_change_palette_with_screen_hook() instead.
+ *
+ **/
+MateColorSelectionChangePaletteFunc
+mate_color_selection_set_change_palette_hook (MateColorSelectionChangePaletteFunc func)
+{
+  MateColorSelectionChangePaletteFunc old;
+
+  old = noscreen_change_palette_hook;
+
+  noscreen_change_palette_hook = func;
+
+  return old;
+}
+
+/**
+ * mate_color_selection_set_change_palette_with_screen_hook:
+ * @func: a function to call when the custom palette needs saving.
+ *
+ * Installs a global function to be called whenever the user tries to
+ * modify the palette in a color selection. This function should save
+ * the new palette contents, and update the GtkSettings property
+ * "gtk-color-palette" so all MateColorSelection widgets will be modified.
+ *
+ * Return value: the previous change palette hook (that was replaced).
+ *
+ * Since: 1.9.1
+ **/
+MateColorSelectionChangePaletteWithScreenFunc
+mate_color_selection_set_change_palette_with_screen_hook (MateColorSelectionChangePaletteWithScreenFunc func)
+{
+  MateColorSelectionChangePaletteWithScreenFunc old;
+
+  old = change_palette_hook;
+
+  change_palette_hook = func;
+
+  return old;
+}
+
+static void
+make_control_relations (AtkObject *atk_obj,
+                        GtkWidget *widget)
+{
+  AtkObject *obj;
+
+  obj = gtk_widget_get_accessible (widget);
+  atk_object_add_relationship (atk_obj, ATK_RELATION_CONTROLLED_BY, obj);
+  atk_object_add_relationship (obj, ATK_RELATION_CONTROLLER_FOR, atk_obj);
+}
+
+static void
+make_all_relations (AtkObject *atk_obj,
+                    MateColorSelectionPrivate *priv)
+{
+  make_control_relations (atk_obj, priv->hue_spinbutton);
+  make_control_relations (atk_obj, priv->sat_spinbutton);
+  make_control_relations (atk_obj, priv->val_spinbutton);
+  make_control_relations (atk_obj, priv->red_spinbutton);
+  make_control_relations (atk_obj, priv->green_spinbutton);
+  make_control_relations (atk_obj, priv->blue_spinbutton);
+}
+
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/74.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/74.html new file mode 100644 index 00000000..cfb08c7e --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/74.html @@ -0,0 +1,433 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
/* HSV color selector for GTK+
+ *
+ * Copyright (C) 1999 The Free Software Foundation
+ * Copyright (C) 2019-2021 MATE Developers
+ *
+ * Authors: Simon Budig <Simon.Budig@unix-ag.org> (original code)
+ *          Federico Mena-Quintero <federico@gimp.org> (cleanup for GTK+)
+ *          Jonathan Blandford <jrb@redhat.com> (cleanup for GTK+)
+ *
+ * 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/>.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ *
+ * Modified to work internally in mate-desktop by Pablo Barciela 2019
+ */
+
+#ifndef __MATE_HSV_H__
+#define __MATE_HSV_H__
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define MATE_TYPE_HSV            (mate_hsv_get_type ())
+#define MATE_HSV(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_HSV, MateHSV))
+#define MATE_HSV_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_HSV, MateHSVClass))
+#define MATE_IS_HSV(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_HSV))
+#define MATE_IS_HSV_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_HSV))
+#define MATE_HSV_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_HSV, MateHSVClass))
+
+typedef struct _MateHSV              MateHSV;
+typedef struct _MateHSVPrivate       MateHSVPrivate;
+typedef struct _MateHSVClass         MateHSVClass;
+
+struct _MateHSV
+{
+  GtkWidget parent_instance;
+
+  /*< private >*/
+  MateHSVPrivate *priv;
+};
+
+struct _MateHSVClass
+{
+  GtkWidgetClass parent_class;
+
+  /* Notification signals */
+  void (* changed) (MateHSV         *hsv);
+
+  /* Keybindings */
+  void (* move)    (MateHSV         *hsv,
+                    GtkDirectionType type);
+
+  /* Padding for future expansion */
+  void (*_gtk_reserved1) (void);
+  void (*_gtk_reserved2) (void);
+  void (*_gtk_reserved3) (void);
+  void (*_gtk_reserved4) (void);
+};
+
+GType      mate_hsv_get_type     (void) G_GNUC_CONST;
+GtkWidget* mate_hsv_new          (void);
+void       mate_hsv_set_color    (MateHSV    *hsv,
+				  double      h,
+				  double      s,
+				  double      v);
+void       mate_hsv_get_color    (MateHSV    *hsv,
+				  gdouble    *h,
+				  gdouble    *s,
+				  gdouble    *v);
+void       mate_hsv_set_metrics  (MateHSV    *hsv,
+				  gint        size,
+				  gint        ring_width);
+void       mate_hsv_get_metrics  (MateHSV    *hsv,
+				  gint       *size,
+				  gint       *ring_width);
+gboolean   mate_hsv_is_adjusting (MateHSV    *hsv);
+
+G_END_DECLS
+
+#endif /* __MATE_HSV_H__ */
+
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/75.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/75.html new file mode 100644 index 00000000..8cef29a0 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/75.html @@ -0,0 +1,725 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
/* 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+#include "config.h"<--- Include file: "config.h" not found.
+#include "private.h"
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n-lib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "mate-colorsel.h"
+#include "mate-colorseldialog.h"
+
+enum {
+  PROP_0,
+  PROP_COLOR_SELECTION,
+  PROP_OK_BUTTON,
+  PROP_CANCEL_BUTTON,
+  PROP_HELP_BUTTON
+};
+
+/***************************/
+/* MateColorSelectionDialog */
+/***************************/
+
+static void mate_color_selection_dialog_buildable_interface_init     (GtkBuildableIface *iface);
+static GObject * mate_color_selection_dialog_buildable_get_internal_child (GtkBuildable *buildable,
+									  GtkBuilder   *builder,
+									  const gchar  *childname);
+
+G_DEFINE_TYPE_WITH_CODE (MateColorSelectionDialog, mate_color_selection_dialog,<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_CODE is a macro then please configure it.
+           GTK_TYPE_DIALOG,
+           G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
+                      mate_color_selection_dialog_buildable_interface_init))
+
+static GtkBuildableIface *parent_buildable_iface;
+
+static void
+mate_color_selection_dialog_get_property (GObject         *object,
+					 guint            prop_id,
+					 GValue          *value,
+					 GParamSpec      *pspec)
+{
+  MateColorSelectionDialog *colorsel;
+
+  colorsel = MATE_COLOR_SELECTION_DIALOG (object);
+
+  switch (prop_id)
+    {
+    case PROP_COLOR_SELECTION:
+      g_value_set_object (value, colorsel->colorsel);
+      break;
+    case PROP_OK_BUTTON:
+      g_value_set_object (value, colorsel->ok_button);
+      break;
+    case PROP_CANCEL_BUTTON:
+      g_value_set_object (value, colorsel->cancel_button);
+      break;
+    case PROP_HELP_BUTTON:
+      g_value_set_object (value, colorsel->help_button);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+mate_color_selection_dialog_class_init (MateColorSelectionDialogClass *klass)
+{
+  GObjectClass   *gobject_class = G_OBJECT_CLASS (klass);
+  gobject_class->get_property = mate_color_selection_dialog_get_property;
+
+  g_object_class_install_property (gobject_class,
+				   PROP_COLOR_SELECTION,
+				   g_param_spec_object ("color-selection",
+						     _("Color Selection"),
+						     _("The color selection embedded in the dialog."),
+						     GTK_TYPE_WIDGET,
+						     G_PARAM_READABLE));
+  g_object_class_install_property (gobject_class,
+				   PROP_OK_BUTTON,
+				   g_param_spec_object ("ok-button",
+						     _("OK Button"),
+						     _("The OK button of the dialog."),
+						     GTK_TYPE_WIDGET,
+						     G_PARAM_READABLE));
+  g_object_class_install_property (gobject_class,
+				   PROP_CANCEL_BUTTON,
+				   g_param_spec_object ("cancel-button",
+						     _("Cancel Button"),
+						     _("The cancel button of the dialog."),
+						     GTK_TYPE_WIDGET,
+						     G_PARAM_READABLE));
+  g_object_class_install_property (gobject_class,
+				   PROP_HELP_BUTTON,
+				   g_param_spec_object ("help-button",
+						     _("Help Button"),
+						     _("The help button of the dialog."),
+						     GTK_TYPE_WIDGET,
+						     G_PARAM_READABLE));
+}
+
+static GtkWidget*
+mate_add_dialog_button (GtkDialog      *dialog,
+                        const char     *label,
+                        const char     *icon,
+                        GtkResponseType response)
+{
+    GtkWidget *widget;
+    GtkWidget *image;
+
+    widget = gtk_button_new_with_mnemonic (label);
+    image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_BUTTON);
+    gtk_button_set_image (GTK_BUTTON (widget), image);
+    gtk_dialog_add_action_widget (dialog, widget, response);
+
+    return widget;
+}
+
+static void
+mate_color_selection_dialog_init (MateColorSelectionDialog *colorseldiag)
+{
+  GtkDialog *dialog = GTK_DIALOG (colorseldiag);
+
+  _mate_desktop_init_i18n ();
+
+  gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+  gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (dialog)), 2); /* 2 * 5 + 2 = 12 */
+  gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (dialog)), 5);
+  gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (dialog)), 6);
+
+  colorseldiag->colorsel = mate_color_selection_new ();
+  gtk_container_set_border_width (GTK_CONTAINER (colorseldiag->colorsel), 5);
+  mate_color_selection_set_has_palette (MATE_COLOR_SELECTION(colorseldiag->colorsel), FALSE);
+  mate_color_selection_set_has_opacity_control (MATE_COLOR_SELECTION(colorseldiag->colorsel), FALSE);
+  gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (colorseldiag))), colorseldiag->colorsel);
+  gtk_widget_show (colorseldiag->colorsel);
+
+  colorseldiag->cancel_button = mate_add_dialog_button (GTK_DIALOG (colorseldiag),
+                                                        _("_Cancel"),
+                                                        "gtk-cancel",
+                                                        GTK_RESPONSE_CANCEL);
+
+  colorseldiag->ok_button = mate_add_dialog_button (GTK_DIALOG (colorseldiag),
+                                                    _("_OK"),
+                                                    "gtk-ok",
+                                                    GTK_RESPONSE_OK);
+
+  gtk_widget_set_can_default (colorseldiag->ok_button, TRUE);
+  gtk_widget_grab_default (colorseldiag->ok_button);
+
+  colorseldiag->help_button = mate_add_dialog_button (GTK_DIALOG (colorseldiag),
+                                                      _("Help"),
+                                                      "help-browser",
+                                                      GTK_RESPONSE_HELP);
+
+  gtk_widget_hide (colorseldiag->help_button);
+  gtk_widget_show (colorseldiag->cancel_button);
+  gtk_widget_show (colorseldiag->ok_button);
+
+  gtk_window_set_title (GTK_WINDOW (colorseldiag),
+                        _("Color Selection"));
+
+  //_gtk_dialog_set_ignore_separator (dialog, TRUE);
+}
+
+GtkWidget*
+mate_color_selection_dialog_new (const gchar *title)
+{
+  MateColorSelectionDialog *colorseldiag;
+
+  colorseldiag = g_object_new (MATE_TYPE_COLOR_SELECTION_DIALOG, NULL);
+
+  if (title)
+    gtk_window_set_title (GTK_WINDOW (colorseldiag), title);
+
+  gtk_window_set_resizable (GTK_WINDOW (colorseldiag), FALSE);
+
+  return GTK_WIDGET (colorseldiag);
+}
+
+/**
+ * mate_color_selection_dialog_get_color_selection:
+ * @colorsel: a #MateColorSelectionDialog
+ *
+ * Retrieves the #MateColorSelection widget embedded in the dialog.
+ *
+ * Returns: (transfer none): the embedded #MateColorSelection
+ *
+ * Since: 1.9.1
+ **/
+GtkWidget*
+mate_color_selection_dialog_get_color_selection (MateColorSelectionDialog *colorsel)
+{
+  g_return_val_if_fail (MATE_IS_COLOR_SELECTION_DIALOG (colorsel), NULL);
+
+  return colorsel->colorsel;
+}
+
+static void
+mate_color_selection_dialog_buildable_interface_init (GtkBuildableIface *iface)
+{
+  parent_buildable_iface = g_type_interface_peek_parent (iface);
+  iface->get_internal_child = mate_color_selection_dialog_buildable_get_internal_child;
+}
+
+static GObject *
+mate_color_selection_dialog_buildable_get_internal_child (GtkBuildable *buildable,
+							 GtkBuilder   *builder,
+							 const gchar  *childname)
+{
+    if (strcmp(childname, "ok_button") == 0)
+	return G_OBJECT (MATE_COLOR_SELECTION_DIALOG (buildable)->ok_button);
+    else if (strcmp(childname, "cancel_button") == 0)
+	return G_OBJECT (MATE_COLOR_SELECTION_DIALOG (buildable)->cancel_button);
+    else if (strcmp(childname, "help_button") == 0)
+	return G_OBJECT (MATE_COLOR_SELECTION_DIALOG(buildable)->help_button);
+    else if (strcmp(childname, "color_selection") == 0)
+	return G_OBJECT (MATE_COLOR_SELECTION_DIALOG(buildable)->colorsel);
+
+    return parent_buildable_iface->get_internal_child (buildable, builder, childname);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/76.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/76.html new file mode 100644 index 00000000..64994c8c --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/76.html @@ -0,0 +1,533 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
/*
+ * mate-dconf.c: helper API for dconf
+ *
+ * Copyright (C) 2011 Novell, Inc.
+ * Copyright (C) 2013 Stefano Karapetsas
+ * Copyright (C) 2013-2021 MATE Developers
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * Authors:
+ *  Vincent Untz <vuntz@gnome.org>
+ *  Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <dconf.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "mate-dconf.h"
+
+static DConfClient *
+mate_dconf_client_get (void)
+{
+    return dconf_client_new ();
+}
+
+/**
+ * mate_dconf_write_sync:
+ * @key: the key to write.
+ * @value: the value to write.
+ * @error: a variable to store the error, or NULL.
+ *
+ * Allow to write a value to dconf.
+ *
+ * Since: 1.7.1
+ */
+gboolean
+mate_dconf_write_sync (const gchar  *key,
+                       GVariant     *value,
+                       GError      **error)
+{
+    gboolean     ret;
+    DConfClient *client = mate_dconf_client_get ();
+
+    ret = dconf_client_write_sync (client, key, value, NULL, NULL, error);
+
+    g_object_unref (client);
+
+    return ret;
+}
+
+/**
+ * mate_dconf_recursive_reset:
+ * @dir: the dconf directory to reset.
+ * @error: a variable to store the error, or NULL.
+ *
+ * Allow to reset a dconf path.
+ *
+ * Since: 1.7.1
+ */
+gboolean
+mate_dconf_recursive_reset (const gchar  *dir,
+                            GError      **error)
+{
+    gboolean     ret;
+    DConfClient *client = mate_dconf_client_get ();
+
+    ret = dconf_client_write_sync (client, dir, NULL, NULL, NULL, error);
+
+    g_object_unref (client);
+
+    return ret;
+}
+
+/**
+ * mate_dconf_list_subdirs:
+ * @dir: the dconf directory.
+ * @remove_trailing_slash: whether to remove the trailing slash from
+ * paths.
+ *
+ * Returns the list of subdirectories of the given dconf directory.
+ *
+ * Return value: the list of subdirectories.
+ *
+ * Since: 1.7.1
+ */
+gchar **
+mate_dconf_list_subdirs (const gchar *dir,
+                         gboolean     remove_trailing_slash)
+{
+    GArray       *array;
+    gchar       **children;
+    int       len;
+    int       i;
+    DConfClient  *client = mate_dconf_client_get ();
+
+    array = g_array_new (TRUE, TRUE, sizeof (gchar *));
+
+    children = dconf_client_list (client, dir, &len);
+
+    g_object_unref (client);
+
+    for (i = 0; children[i] != NULL; i++) {
+        if (dconf_is_rel_dir (children[i], NULL)) {
+            char *val = g_strdup (children[i]);
+
+            if (remove_trailing_slash)
+                val[strlen (val) - 1] = '\0';
+
+            array = g_array_append_val (array, val);
+        }
+    }
+
+    g_strfreev (children);
+
+    return (gchar **) g_array_free (array, FALSE);
+}
+
+/**
+ * mate_dconf_sync:
+ *
+ * Ensure dconf daemon syncs the written values.
+ *
+ * Since: 1.7.1
+ */
+void mate_dconf_sync (void)
+{
+    DConfClient  *client = mate_dconf_client_get ();
+    dconf_client_sync (client);
+    g_object_unref (client);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/77.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/77.html new file mode 100644 index 00000000..a09d1e1d --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/77.html @@ -0,0 +1,335 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
/*
+ * mate-dconf.h: helper API for dconf
+ *
+ * Copyright (C) 2011 Novell, Inc.
+ * Copyright (C) 2013 Stefano Karapetsas
+ * Copyright (C) 2013-2021 MATE Developers
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * Authors:
+ *  Vincent Untz <vuntz@gnome.org>
+ *  Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifndef __MATE_DCONF_H__
+#define __MATE_DCONF_H__
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+gboolean mate_dconf_write_sync (const gchar  *key,
+                                GVariant     *value,
+                                GError      **error);
+
+gboolean mate_dconf_recursive_reset (const gchar  *dir,
+                                     GError     **error);
+
+gchar **mate_dconf_list_subdirs (const gchar *dir,
+                                 gboolean     remove_trailing_slash);
+
+void mate_dconf_sync (void);
+
+G_END_DECLS
+
+#endif /* __MATE_DCONF_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/78.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/78.html new file mode 100644 index 00000000..9a2c23ae --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/78.html @@ -0,0 +1,8907 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+1545
+1546
+1547
+1548
+1549
+1550
+1551
+1552
+1553
+1554
+1555
+1556
+1557
+1558
+1559
+1560
+1561
+1562
+1563
+1564
+1565
+1566
+1567
+1568
+1569
+1570
+1571
+1572
+1573
+1574
+1575
+1576
+1577
+1578
+1579
+1580
+1581
+1582
+1583
+1584
+1585
+1586
+1587
+1588
+1589
+1590
+1591
+1592
+1593
+1594
+1595
+1596
+1597
+1598
+1599
+1600
+1601
+1602
+1603
+1604
+1605
+1606
+1607
+1608
+1609
+1610
+1611
+1612
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+1631
+1632
+1633
+1634
+1635
+1636
+1637
+1638
+1639
+1640
+1641
+1642
+1643
+1644
+1645
+1646
+1647
+1648
+1649
+1650
+1651
+1652
+1653
+1654
+1655
+1656
+1657
+1658
+1659
+1660
+1661
+1662
+1663
+1664
+1665
+1666
+1667
+1668
+1669
+1670
+1671
+1672
+1673
+1674
+1675
+1676
+1677
+1678
+1679
+1680
+1681
+1682
+1683
+1684
+1685
+1686
+1687
+1688
+1689
+1690
+1691
+1692
+1693
+1694
+1695
+1696
+1697
+1698
+1699
+1700
+1701
+1702
+1703
+1704
+1705
+1706
+1707
+1708
+1709
+1710
+1711
+1712
+1713
+1714
+1715
+1716
+1717
+1718
+1719
+1720
+1721
+1722
+1723
+1724
+1725
+1726
+1727
+1728
+1729
+1730
+1731
+1732
+1733
+1734
+1735
+1736
+1737
+1738
+1739
+1740
+1741
+1742
+1743
+1744
+1745
+1746
+1747
+1748
+1749
+1750
+1751
+1752
+1753
+1754
+1755
+1756
+1757
+1758
+1759
+1760
+1761
+1762
+1763
+1764
+1765
+1766
+1767
+1768
+1769
+1770
+1771
+1772
+1773
+1774
+1775
+1776
+1777
+1778
+1779
+1780
+1781
+1782
+1783
+1784
+1785
+1786
+1787
+1788
+1789
+1790
+1791
+1792
+1793
+1794
+1795
+1796
+1797
+1798
+1799
+1800
+1801
+1802
+1803
+1804
+1805
+1806
+1807
+1808
+1809
+1810
+1811
+1812
+1813
+1814
+1815
+1816
+1817
+1818
+1819
+1820
+1821
+1822
+1823
+1824
+1825
+1826
+1827
+1828
+1829
+1830
+1831
+1832
+1833
+1834
+1835
+1836
+1837
+1838
+1839
+1840
+1841
+1842
+1843
+1844
+1845
+1846
+1847
+1848
+1849
+1850
+1851
+1852
+1853
+1854
+1855
+1856
+1857
+1858
+1859
+1860
+1861
+1862
+1863
+1864
+1865
+1866
+1867
+1868
+1869
+1870
+1871
+1872
+1873
+1874
+1875
+1876
+1877
+1878
+1879
+1880
+1881
+1882
+1883
+1884
+1885
+1886
+1887
+1888
+1889
+1890
+1891
+1892
+1893
+1894
+1895
+1896
+1897
+1898
+1899
+1900
+1901
+1902
+1903
+1904
+1905
+1906
+1907
+1908
+1909
+1910
+1911
+1912
+1913
+1914
+1915
+1916
+1917
+1918
+1919
+1920
+1921
+1922
+1923
+1924
+1925
+1926
+1927
+1928
+1929
+1930
+1931
+1932
+1933
+1934
+1935
+1936
+1937
+1938
+1939
+1940
+1941
+1942
+1943
+1944
+1945
+1946
+1947
+1948
+1949
+1950
+1951
+1952
+1953
+1954
+1955
+1956
+1957
+1958
+1959
+1960
+1961
+1962
+1963
+1964
+1965
+1966
+1967
+1968
+1969
+1970
+1971
+1972
+1973
+1974
+1975
+1976
+1977
+1978
+1979
+1980
+1981
+1982
+1983
+1984
+1985
+1986
+1987
+1988
+1989
+1990
+1991
+1992
+1993
+1994
+1995
+1996
+1997
+1998
+1999
+2000
+2001
+2002
+2003
+2004
+2005
+2006
+2007
+2008
+2009
+2010
+2011
+2012
+2013
+2014
+2015
+2016
+2017
+2018
+2019
+2020
+2021
+2022
+2023
+2024
+2025
+2026
+2027
+2028
+2029
+2030
+2031
+2032
+2033
+2034
+2035
+2036
+2037
+2038
+2039
+2040
+2041
+2042
+2043
+2044
+2045
+2046
+2047
+2048
+2049
+2050
+2051
+2052
+2053
+2054
+2055
+2056
+2057
+2058
+2059
+2060
+2061
+2062
+2063
+2064
+2065
+2066
+2067
+2068
+2069
+2070
+2071
+2072
+2073
+2074
+2075
+2076
+2077
+2078
+2079
+2080
+2081
+2082
+2083
+2084
+2085
+2086
+2087
+2088
+2089
+2090
+2091
+2092
+2093
+2094
+2095
+2096
+2097
+2098
+2099
+2100
+2101
+2102
+2103
+2104
+2105
+2106
+2107
+2108
+2109
+2110
+2111
+2112
+2113
+2114
+2115
+2116
+2117
+2118
+2119
+2120
+2121
+2122
+2123
+2124
+2125
+2126
+2127
+2128
+2129
+2130
+2131
+2132
+2133
+2134
+2135
+2136
+2137
+2138
+2139
+2140
+2141
+2142
+2143
+2144
+2145
+2146
+2147
+2148
+2149
+2150
+2151
+2152
+2153
+2154
+2155
+2156
+2157
+2158
+2159
+2160
+2161
+2162
+2163
+2164
+2165
+2166
+2167
+2168
+2169
+2170
+2171
+2172
+2173
+2174
+2175
+2176
+2177
+2178
+2179
+2180
+2181
+2182
+2183
+2184
+2185
+2186
+2187
+2188
+2189
+2190
+2191
+2192
+2193
+2194
+2195
+2196
+2197
+2198
+2199
+2200
+2201
+2202
+2203
+2204
+2205
+2206
+2207
+2208
+2209
+2210
+2211
+2212
+2213
+2214
+2215
+2216
+2217
+2218
+2219
+2220
+2221
+2222
+2223
+2224
+2225
+2226
+2227
+2228
+2229
+2230
+2231
+2232
+2233
+2234
+2235
+2236
+2237
+2238
+2239
+2240
+2241
+2242
+2243
+2244
+2245
+2246
+2247
+2248
+2249
+2250
+2251
+2252
+2253
+2254
+2255
+2256
+2257
+2258
+2259
+2260
+2261
+2262
+2263
+2264
+2265
+2266
+2267
+2268
+2269
+2270
+2271
+2272
+2273
+2274
+2275
+2276
+2277
+2278
+2279
+2280
+2281
+2282
+2283
+2284
+2285
+2286
+2287
+2288
+2289
+2290
+2291
+2292
+2293
+2294
+2295
+2296
+2297
+2298
+2299
+2300
+2301
+2302
+2303
+2304
+2305
+2306
+2307
+2308
+2309
+2310
+2311
+2312
+2313
+2314
+2315
+2316
+2317
+2318
+2319
+2320
+2321
+2322
+2323
+2324
+2325
+2326
+2327
+2328
+2329
+2330
+2331
+2332
+2333
+2334
+2335
+2336
+2337
+2338
+2339
+2340
+2341
+2342
+2343
+2344
+2345
+2346
+2347
+2348
+2349
+2350
+2351
+2352
+2353
+2354
+2355
+2356
+2357
+2358
+2359
+2360
+2361
+2362
+2363
+2364
+2365
+2366
+2367
+2368
+2369
+2370
+2371
+2372
+2373
+2374
+2375
+2376
+2377
+2378
+2379
+2380
+2381
+2382
+2383
+2384
+2385
+2386
+2387
+2388
+2389
+2390
+2391
+2392
+2393
+2394
+2395
+2396
+2397
+2398
+2399
+2400
+2401
+2402
+2403
+2404
+2405
+2406
+2407
+2408
+2409
+2410
+2411
+2412
+2413
+2414
+2415
+2416
+2417
+2418
+2419
+2420
+2421
+2422
+2423
+2424
+2425
+2426
+2427
+2428
+2429
+2430
+2431
+2432
+2433
+2434
+2435
+2436
+2437
+2438
+2439
+2440
+2441
+2442
+2443
+2444
+2445
+2446
+2447
+2448
+2449
+2450
+2451
+2452
+2453
+2454
+2455
+2456
+2457
+2458
+2459
+2460
+2461
+2462
+2463
+2464
+2465
+2466
+2467
+2468
+2469
+2470
+2471
+2472
+2473
+2474
+2475
+2476
+2477
+2478
+2479
+2480
+2481
+2482
+2483
+2484
+2485
+2486
+2487
+2488
+2489
+2490
+2491
+2492
+2493
+2494
+2495
+2496
+2497
+2498
+2499
+2500
+2501
+2502
+2503
+2504
+2505
+2506
+2507
+2508
+2509
+2510
+2511
+2512
+2513
+2514
+2515
+2516
+2517
+2518
+2519
+2520
+2521
+2522
+2523
+2524
+2525
+2526
+2527
+2528
+2529
+2530
+2531
+2532
+2533
+2534
+2535
+2536
+2537
+2538
+2539
+2540
+2541
+2542
+2543
+2544
+2545
+2546
+2547
+2548
+2549
+2550
+2551
+2552
+2553
+2554
+2555
+2556
+2557
+2558
+2559
+2560
+2561
+2562
+2563
+2564
+2565
+2566
+2567
+2568
+2569
+2570
+2571
+2572
+2573
+2574
+2575
+2576
+2577
+2578
+2579
+2580
+2581
+2582
+2583
+2584
+2585
+2586
+2587
+2588
+2589
+2590
+2591
+2592
+2593
+2594
+2595
+2596
+2597
+2598
+2599
+2600
+2601
+2602
+2603
+2604
+2605
+2606
+2607
+2608
+2609
+2610
+2611
+2612
+2613
+2614
+2615
+2616
+2617
+2618
+2619
+2620
+2621
+2622
+2623
+2624
+2625
+2626
+2627
+2628
+2629
+2630
+2631
+2632
+2633
+2634
+2635
+2636
+2637
+2638
+2639
+2640
+2641
+2642
+2643
+2644
+2645
+2646
+2647
+2648
+2649
+2650
+2651
+2652
+2653
+2654
+2655
+2656
+2657
+2658
+2659
+2660
+2661
+2662
+2663
+2664
+2665
+2666
+2667
+2668
+2669
+2670
+2671
+2672
+2673
+2674
+2675
+2676
+2677
+2678
+2679
+2680
+2681
+2682
+2683
+2684
+2685
+2686
+2687
+2688
+2689
+2690
+2691
+2692
+2693
+2694
+2695
+2696
+2697
+2698
+2699
+2700
+2701
+2702
+2703
+2704
+2705
+2706
+2707
+2708
+2709
+2710
+2711
+2712
+2713
+2714
+2715
+2716
+2717
+2718
+2719
+2720
+2721
+2722
+2723
+2724
+2725
+2726
+2727
+2728
+2729
+2730
+2731
+2732
+2733
+2734
+2735
+2736
+2737
+2738
+2739
+2740
+2741
+2742
+2743
+2744
+2745
+2746
+2747
+2748
+2749
+2750
+2751
+2752
+2753
+2754
+2755
+2756
+2757
+2758
+2759
+2760
+2761
+2762
+2763
+2764
+2765
+2766
+2767
+2768
+2769
+2770
+2771
+2772
+2773
+2774
+2775
+2776
+2777
+2778
+2779
+2780
+2781
+2782
+2783
+2784
+2785
+2786
+2787
+2788
+2789
+2790
+2791
+2792
+2793
+2794
+2795
+2796
+2797
+2798
+2799
+2800
+2801
+2802
+2803
+2804
+2805
+2806
+2807
+2808
+2809
+2810
+2811
+2812
+2813
+2814
+2815
+2816
+2817
+2818
+2819
+2820
+2821
+2822
+2823
+2824
+2825
+2826
+2827
+2828
+2829
+2830
+2831
+2832
+2833
+2834
+2835
+2836
+2837
+2838
+2839
+2840
+2841
+2842
+2843
+2844
+2845
+2846
+2847
+2848
+2849
+2850
+2851
+2852
+2853
+2854
+2855
+2856
+2857
+2858
+2859
+2860
+2861
+2862
+2863
+2864
+2865
+2866
+2867
+2868
+2869
+2870
+2871
+2872
+2873
+2874
+2875
+2876
+2877
+2878
+2879
+2880
+2881
+2882
+2883
+2884
+2885
+2886
+2887
+2888
+2889
+2890
+2891
+2892
+2893
+2894
+2895
+2896
+2897
+2898
+2899
+2900
+2901
+2902
+2903
+2904
+2905
+2906
+2907
+2908
+2909
+2910
+2911
+2912
+2913
+2914
+2915
+2916
+2917
+2918
+2919
+2920
+2921
+2922
+2923
+2924
+2925
+2926
+2927
+2928
+2929
+2930
+2931
+2932
+2933
+2934
+2935
+2936
+2937
+2938
+2939
+2940
+2941
+2942
+2943
+2944
+2945
+2946
+2947
+2948
+2949
+2950
+2951
+2952
+2953
+2954
+2955
+2956
+2957
+2958
+2959
+2960
+2961
+2962
+2963
+2964
+2965
+2966
+2967
+2968
+2969
+2970
+2971
+2972
+2973
+2974
+2975
+2976
+2977
+2978
+2979
+2980
+2981
+2982
+2983
+2984
+2985
+2986
+2987
+2988
+2989
+2990
+2991
+2992
+2993
+2994
+2995
+2996
+2997
+2998
+2999
+3000
+3001
+3002
+3003
+3004
+3005
+3006
+3007
+3008
+3009
+3010
+3011
+3012
+3013
+3014
+3015
+3016
+3017
+3018
+3019
+3020
+3021
+3022
+3023
+3024
+3025
+3026
+3027
+3028
+3029
+3030
+3031
+3032
+3033
+3034
+3035
+3036
+3037
+3038
+3039
+3040
+3041
+3042
+3043
+3044
+3045
+3046
+3047
+3048
+3049
+3050
+3051
+3052
+3053
+3054
+3055
+3056
+3057
+3058
+3059
+3060
+3061
+3062
+3063
+3064
+3065
+3066
+3067
+3068
+3069
+3070
+3071
+3072
+3073
+3074
+3075
+3076
+3077
+3078
+3079
+3080
+3081
+3082
+3083
+3084
+3085
+3086
+3087
+3088
+3089
+3090
+3091
+3092
+3093
+3094
+3095
+3096
+3097
+3098
+3099
+3100
+3101
+3102
+3103
+3104
+3105
+3106
+3107
+3108
+3109
+3110
+3111
+3112
+3113
+3114
+3115
+3116
+3117
+3118
+3119
+3120
+3121
+3122
+3123
+3124
+3125
+3126
+3127
+3128
+3129
+3130
+3131
+3132
+3133
+3134
+3135
+3136
+3137
+3138
+3139
+3140
+3141
+3142
+3143
+3144
+3145
+3146
+3147
+3148
+3149
+3150
+3151
+3152
+3153
+3154
+3155
+3156
+3157
+3158
+3159
+3160
+3161
+3162
+3163
+3164
+3165
+3166
+3167
+3168
+3169
+3170
+3171
+3172
+3173
+3174
+3175
+3176
+3177
+3178
+3179
+3180
+3181
+3182
+3183
+3184
+3185
+3186
+3187
+3188
+3189
+3190
+3191
+3192
+3193
+3194
+3195
+3196
+3197
+3198
+3199
+3200
+3201
+3202
+3203
+3204
+3205
+3206
+3207
+3208
+3209
+3210
+3211
+3212
+3213
+3214
+3215
+3216
+3217
+3218
+3219
+3220
+3221
+3222
+3223
+3224
+3225
+3226
+3227
+3228
+3229
+3230
+3231
+3232
+3233
+3234
+3235
+3236
+3237
+3238
+3239
+3240
+3241
+3242
+3243
+3244
+3245
+3246
+3247
+3248
+3249
+3250
+3251
+3252
+3253
+3254
+3255
+3256
+3257
+3258
+3259
+3260
+3261
+3262
+3263
+3264
+3265
+3266
+3267
+3268
+3269
+3270
+3271
+3272
+3273
+3274
+3275
+3276
+3277
+3278
+3279
+3280
+3281
+3282
+3283
+3284
+3285
+3286
+3287
+3288
+3289
+3290
+3291
+3292
+3293
+3294
+3295
+3296
+3297
+3298
+3299
+3300
+3301
+3302
+3303
+3304
+3305
+3306
+3307
+3308
+3309
+3310
+3311
+3312
+3313
+3314
+3315
+3316
+3317
+3318
+3319
+3320
+3321
+3322
+3323
+3324
+3325
+3326
+3327
+3328
+3329
+3330
+3331
+3332
+3333
+3334
+3335
+3336
+3337
+3338
+3339
+3340
+3341
+3342
+3343
+3344
+3345
+3346
+3347
+3348
+3349
+3350
+3351
+3352
+3353
+3354
+3355
+3356
+3357
+3358
+3359
+3360
+3361
+3362
+3363
+3364
+3365
+3366
+3367
+3368
+3369
+3370
+3371
+3372
+3373
+3374
+3375
+3376
+3377
+3378
+3379
+3380
+3381
+3382
+3383
+3384
+3385
+3386
+3387
+3388
+3389
+3390
+3391
+3392
+3393
+3394
+3395
+3396
+3397
+3398
+3399
+3400
+3401
+3402
+3403
+3404
+3405
+3406
+3407
+3408
+3409
+3410
+3411
+3412
+3413
+3414
+3415
+3416
+3417
+3418
+3419
+3420
+3421
+3422
+3423
+3424
+3425
+3426
+3427
+3428
+3429
+3430
+3431
+3432
+3433
+3434
+3435
+3436
+3437
+3438
+3439
+3440
+3441
+3442
+3443
+3444
+3445
+3446
+3447
+3448
+3449
+3450
+3451
+3452
+3453
+3454
+3455
+3456
+3457
+3458
+3459
+3460
+3461
+3462
+3463
+3464
+3465
+3466
+3467
+3468
+3469
+3470
+3471
+3472
+3473
+3474
+3475
+3476
+3477
+3478
+3479
+3480
+3481
+3482
+3483
+3484
+3485
+3486
+3487
+3488
+3489
+3490
+3491
+3492
+3493
+3494
+3495
+3496
+3497
+3498
+3499
+3500
+3501
+3502
+3503
+3504
+3505
+3506
+3507
+3508
+3509
+3510
+3511
+3512
+3513
+3514
+3515
+3516
+3517
+3518
+3519
+3520
+3521
+3522
+3523
+3524
+3525
+3526
+3527
+3528
+3529
+3530
+3531
+3532
+3533
+3534
+3535
+3536
+3537
+3538
+3539
+3540
+3541
+3542
+3543
+3544
+3545
+3546
+3547
+3548
+3549
+3550
+3551
+3552
+3553
+3554
+3555
+3556
+3557
+3558
+3559
+3560
+3561
+3562
+3563
+3564
+3565
+3566
+3567
+3568
+3569
+3570
+3571
+3572
+3573
+3574
+3575
+3576
+3577
+3578
+3579
+3580
+3581
+3582
+3583
+3584
+3585
+3586
+3587
+3588
+3589
+3590
+3591
+3592
+3593
+3594
+3595
+3596
+3597
+3598
+3599
+3600
+3601
+3602
+3603
+3604
+3605
+3606
+3607
+3608
+3609
+3610
+3611
+3612
+3613
+3614
+3615
+3616
+3617
+3618
+3619
+3620
+3621
+3622
+3623
+3624
+3625
+3626
+3627
+3628
+3629
+3630
+3631
+3632
+3633
+3634
+3635
+3636
+3637
+3638
+3639
+3640
+3641
+3642
+3643
+3644
+3645
+3646
+3647
+3648
+3649
+3650
+3651
+3652
+3653
+3654
+3655
+3656
+3657
+3658
+3659
+3660
+3661
+3662
+3663
+3664
+3665
+3666
+3667
+3668
+3669
+3670
+3671
+3672
+3673
+3674
+3675
+3676
+3677
+3678
+3679
+3680
+3681
+3682
+3683
+3684
+3685
+3686
+3687
+3688
+3689
+3690
+3691
+3692
+3693
+3694
+3695
+3696
+3697
+3698
+3699
+3700
+3701
+3702
+3703
+3704
+3705
+3706
+3707
+3708
+3709
+3710
+3711
+3712
+3713
+3714
+3715
+3716
+3717
+3718
+3719
+3720
+3721
+3722
+3723
+3724
+3725
+3726
+3727
+3728
+3729
+3730
+3731
+3732
+3733
+3734
+3735
+3736
+3737
+3738
+3739
+3740
+3741
+3742
+3743
+3744
+3745
+3746
+3747
+3748
+3749
+3750
+3751
+3752
+3753
+3754
+3755
+3756
+3757
+3758
+3759
+3760
+3761
+3762
+3763
+3764
+3765
+3766
+3767
+3768
+3769
+3770
+3771
+3772
+3773
+3774
+3775
+3776
+3777
+3778
+3779
+3780
+3781
+3782
+3783
+3784
+3785
+3786
+3787
+3788
+3789
+3790
+3791
+3792
+3793
+3794
+3795
+3796
+3797
+3798
+3799
+3800
+3801
+3802
+3803
+3804
+3805
+3806
+3807
+3808
+3809
+3810
+3811
+3812
+3813
+3814
+3815
+3816
+3817
+3818
+3819
+3820
+3821
+3822
+3823
+3824
+3825
+3826
+3827
+3828
+3829
+3830
+3831
+3832
+3833
+3834
+3835
+3836
+3837
+3838
+3839
+3840
+3841
+3842
+3843
+3844
+3845
+3846
+3847
+3848
+3849
+3850
+3851
+3852
+3853
+3854
+3855
+3856
+3857
+3858
+3859
+3860
+3861
+3862
+3863
+3864
+3865
+3866
+3867
+3868
+3869
+3870
+3871
+3872
+3873
+3874
+3875
+3876
+3877
+3878
+3879
+3880
+3881
+3882
+3883
+3884
+3885
+3886
/* -*- Mode: C; c-set-style: linux indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* mate-desktop-item.c - MATE Desktop File Representation
+
+   Copyright (C) 1999, 2000 Red Hat Inc.
+   Copyright (C) 2001 Sid Vicious
+   All rights reserved.
+
+   This file is part of the Mate Library.
+
+   Developed by Elliot Lee <sopwith@redhat.com> and Sid Vicious
+
+   The Mate Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Mate 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Mate Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+/*
+  @NOTATION@
+ */
+
+#include "config.h"<--- Include file: "config.h" not found.
+
+#include <limits.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <ctype.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <dirent.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n-lib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <locale.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#ifdef HAVE_STARTUP_NOTIFICATION
+#define SN_API_NOT_YET_FROZEN
+#include <libsn/sn.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#define MATE_DESKTOP_USE_UNSTABLE_API
+#undef MATE_DISABLE_DEPRECATED
+#include <mate-desktop-item.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-desktop-utils.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "private.h"
+
+struct _MateDesktopItem {
+	int refcount;
+
+	/* all languages used */
+	GList *languages;
+
+	MateDesktopItemType type;
+
+	/* `modified' means that the ditem has been
+	 * modified since the last save. */
+	gboolean modified;
+
+	/* Keys of the main section only */
+	GList *keys;
+
+	GList *sections;
+
+	/* This includes ALL keys, including
+	 * other sections, separated by '/' */
+	GHashTable *main_hash;
+
+	char *location;
+
+	gint64 mtime;
+
+	guint32 launch_time;
+};
+
+/* If mtime is set to this, set_location won't update mtime,
+ * this is to be used internally only. */
+#define DONT_UPDATE_MTIME ((gint64)-2)
+
+typedef struct {
+	char *name;
+	GList *keys;
+} Section;
+
+typedef enum {
+	ENCODING_UNKNOWN,
+	ENCODING_UTF8,
+	ENCODING_LEGACY_MIXED
+} Encoding;
+
+/*
+ * IO reading utils, that look like the libc buffered io stuff
+ */
+
+#define READ_BUF_SIZE (32 * 1024)
+
+typedef struct {
+	GFile *file;
+	GFileInputStream *stream;
+	char *uri;
+	char *buf;
+	gboolean buf_needs_free;
+	gboolean past_first_read;
+	gboolean eof;
+	guint64 size;
+	gsize pos;
+} ReadBuf;
+
+static MateDesktopItem *ditem_load (ReadBuf           *rb,
+				     gboolean           no_translations,
+				     GError           **error);
+static gboolean          ditem_save (MateDesktopItem  *item,
+				     const char        *uri,
+				     GError           **error);
+
+static void mate_desktop_item_set_location_gfile (MateDesktopItem *item,
+						   GFile            *file);
+
+static MateDesktopItem *mate_desktop_item_new_from_gfile (GFile *file,
+							    MateDesktopItemLoadFlags flags,
+							    GError **error);
+
+static int
+readbuf_getc (ReadBuf *rb)
+{
+	if (rb->eof)
+		return EOF;
+
+	if (rb->size == 0 ||
+	    rb->pos == rb->size) {
+		gssize bytes_read;
+
+		if (rb->stream == NULL)
+			bytes_read = 0;
+		else
+			bytes_read = g_input_stream_read (G_INPUT_STREAM (rb->stream),
+							  rb->buf,
+							  READ_BUF_SIZE,
+							  NULL, NULL);
+
+		/* FIXME: handle errors other than EOF */
+		if (bytes_read <= 0) {
+			rb->eof = TRUE;
+			return EOF;
+		}
+
+		if (rb->size != 0)
+			rb->past_first_read = TRUE;
+		rb->size = bytes_read;
+		rb->pos = 0;
+
+	}
+
+	return (guchar) rb->buf[rb->pos++];
+}
+
+/* Note, does not include the trailing \n */
+static char *
+readbuf_gets (char *buf, gsize bufsize, ReadBuf *rb)
+{
+	int c;
+	gsize pos;
+
+	g_return_val_if_fail (buf != NULL, NULL);
+	g_return_val_if_fail (rb != NULL, NULL);
+
+	pos = 0;
+	buf[0] = '\0';
+
+	do {
+		c = readbuf_getc (rb);
+		if (c == EOF || c == '\n')
+			break;
+		buf[pos++] = c;
+	} while (pos < bufsize-1);
+
+	if (c == EOF && pos == 0)
+		return NULL;
+
+	buf[pos++] = '\0';
+
+	return buf;
+}
+
+static ReadBuf *
+readbuf_open (GFile *file, GError **error)
+{
+	GError *local_error;
+	GFileInputStream *stream;
+	char *uri;
+	ReadBuf *rb;
+
+	g_return_val_if_fail (file != NULL, NULL);
+
+	uri = g_file_get_uri (file);
+	local_error = NULL;
+	stream = g_file_read (file, NULL, &local_error);
+
+	if (stream == NULL) {
+		g_set_error (error,
+			     /* FIXME: better errors */
+			     MATE_DESKTOP_ITEM_ERROR,
+			     MATE_DESKTOP_ITEM_ERROR_CANNOT_OPEN,
+			     _("Error reading file '%s': %s"),
+			     uri, local_error->message);
+		g_error_free (local_error);
+		g_free (uri);
+		return NULL;
+	}
+
+	rb = g_new0 (ReadBuf, 1);
+	rb->stream = stream;
+	rb->file = g_file_dup (file);
+	rb->uri = uri;
+	rb->buf = g_malloc (READ_BUF_SIZE);
+	rb->buf_needs_free = TRUE;
+	/* rb->past_first_read = FALSE; */
+	/* rb->eof = FALSE; */
+	/* rb->size = 0; */
+	/* rb->pos = 0; */
+
+	return rb;
+}
+
+static ReadBuf *
+readbuf_new_from_string (const char *uri, const char *string, gssize length)
+{
+	ReadBuf *rb;
+
+	g_return_val_if_fail (string != NULL, NULL);
+	g_return_val_if_fail (length >= 0, NULL);
+
+	rb = g_new0 (ReadBuf, 1);
+	/* rb->file = NULL; */
+	/* rb->stream = NULL; */
+	rb->uri = g_strdup (uri);
+	rb->buf = (char *) string;
+	/* rb->buf_needs_free = FALSE; */
+	/* rb->past_first_read = FALSE; */
+	/* rb->eof = FALSE; */
+	rb->size = length;
+	/* rb->pos = 0; */
+
+	return rb;
+}
+
+static gboolean
+readbuf_rewind (ReadBuf *rb, GError **error)
+{
+	GError *local_error;
+
+	rb->eof = FALSE;
+	rb->pos = 0;
+
+	if (!rb->past_first_read)
+		return TRUE;
+
+	rb->size = 0;
+
+	if (g_seekable_seek (G_SEEKABLE (rb->stream),
+			     0, G_SEEK_SET, NULL, NULL))
+		return TRUE;
+
+	g_object_unref (rb->stream);
+	local_error = NULL;
+	rb->stream = g_file_read (rb->file, NULL, &local_error);
+
+	if (rb->stream == NULL) {
+		g_set_error (
+			error, MATE_DESKTOP_ITEM_ERROR,
+			MATE_DESKTOP_ITEM_ERROR_CANNOT_OPEN,
+			_("Error rewinding file '%s': %s"),
+			rb->uri, local_error->message);
+		g_error_free (local_error);
+
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static void
+readbuf_close (ReadBuf *rb)
+{
+	if (rb->stream != NULL)
+		g_object_unref (rb->stream);
+	if (rb->file != NULL)
+		g_object_unref (rb->file);
+	g_free (rb->uri);
+	if (rb->buf_needs_free)
+		g_free (rb->buf);
+	g_free (rb);
+}
+
+static MateDesktopItemType
+type_from_string (const char *type)
+{
+	if (!type)
+		return MATE_DESKTOP_ITEM_TYPE_NULL;
+
+	switch (type [0]) {
+	case 'A':
+		if (!strcmp (type, "Application"))
+			return MATE_DESKTOP_ITEM_TYPE_APPLICATION;
+		break;
+	case 'L':
+		if (!strcmp (type, "Link"))
+			return MATE_DESKTOP_ITEM_TYPE_LINK;
+		break;
+	case 'F':
+		if (!strcmp (type, "FSDevice"))
+			return MATE_DESKTOP_ITEM_TYPE_FSDEVICE;
+		break;
+	case 'M':
+		if (!strcmp (type, "MimeType"))
+			return MATE_DESKTOP_ITEM_TYPE_MIME_TYPE;
+		break;
+	case 'D':
+		if (!strcmp (type, "Directory"))
+			return MATE_DESKTOP_ITEM_TYPE_DIRECTORY;
+		break;
+	case 'S':
+		if (!strcmp (type, "Service"))
+			return MATE_DESKTOP_ITEM_TYPE_SERVICE;
+
+		else if (!strcmp (type, "ServiceType"))
+			return MATE_DESKTOP_ITEM_TYPE_SERVICE_TYPE;
+		break;
+	default:
+		break;
+	}
+
+	return MATE_DESKTOP_ITEM_TYPE_OTHER;
+}
+
+/**
+ * mate_desktop_item_new:
+ *
+ * Creates a MateDesktopItem object. The reference count on the returned value is set to '1'.
+ *
+ * Returns: The new MateDesktopItem
+ */
+MateDesktopItem *
+mate_desktop_item_new (void)
+{
+	MateDesktopItem *retval;
+
+	_mate_desktop_init_i18n ();
+
+	retval = g_new0 (MateDesktopItem, 1);
+
+	retval->refcount++;
+
+	retval->main_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
+						   (GDestroyNotify) g_free,
+						   (GDestroyNotify) g_free);
+
+	/* These are guaranteed to be set */
+	mate_desktop_item_set_string (retval,
+				       MATE_DESKTOP_ITEM_NAME,
+				       /* Translators: the "name" mentioned
+					* here is the name of an application or
+					* a document */
+				       _("No name"));
+	mate_desktop_item_set_string (retval,
+				       MATE_DESKTOP_ITEM_ENCODING,
+				       "UTF-8");
+	mate_desktop_item_set_string (retval,
+				       MATE_DESKTOP_ITEM_VERSION,
+				       "1.0");
+
+	retval->launch_time = 0;
+
+	return retval;
+}
+
+static Section *
+dup_section (Section *sec)
+{
+	GList *li;
+	Section *retval = g_new0 (Section, 1);
+
+	retval->name = g_strdup (sec->name);
+
+	retval->keys = g_list_copy (sec->keys);
+	for (li = retval->keys; li != NULL; li = li->next)
+		li->data = g_strdup (li->data);
+
+	return retval;
+}
+
+static void
+copy_string_hash (gpointer key, gpointer value, gpointer user_data)
+{
+	GHashTable *copy = user_data;
+	g_hash_table_replace (copy,
+			      g_strdup (key),
+			      g_strdup (value));
+}
+
+/**
+ * mate_desktop_item_copy:
+ * @item: The item to be copied
+ *
+ * Creates a copy of a MateDesktopItem.  The new copy has a refcount of 1.
+ * Note: Section stack is NOT copied.
+ *
+ * Returns: The new copy
+ */
+MateDesktopItem *
+mate_desktop_item_copy (const MateDesktopItem *item)
+{
+	GList *li;
+	MateDesktopItem *retval;
+
+	g_return_val_if_fail (item != NULL, NULL);
+	g_return_val_if_fail (item->refcount > 0, NULL);
+
+	retval = mate_desktop_item_new ();
+
+	retval->type = item->type;
+	retval->modified = item->modified;
+	retval->location = g_strdup (item->location);
+	retval->mtime = item->mtime;
+	retval->launch_time = item->launch_time;
+
+	/* Languages */
+	retval->languages = g_list_copy (item->languages);
+	for (li = retval->languages; li != NULL; li = li->next)
+		li->data = g_strdup (li->data);
+
+	/* Keys */
+	retval->keys = g_list_copy (item->keys);
+	for (li = retval->keys; li != NULL; li = li->next)
+		li->data = g_strdup (li->data);
+
+	/* Sections */
+	retval->sections = g_list_copy (item->sections);
+	for (li = retval->sections; li != NULL; li = li->next)
+		li->data = dup_section (li->data);
+
+	retval->main_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
+						   (GDestroyNotify) g_free,
+						   (GDestroyNotify) g_free);
+
+	g_hash_table_foreach (item->main_hash,
+			      copy_string_hash,
+			      retval->main_hash);
+
+	return retval;
+}
+
+static void
+read_sort_order (MateDesktopItem *item, GFile *dir)
+{
+	GFile *child;
+	char buf[BUFSIZ];
+	GString *str;
+	ReadBuf *rb;
+
+	child = g_file_get_child (dir, ".order");
+
+	rb = readbuf_open (child, NULL);
+	g_object_unref (child);
+
+	if (rb == NULL)
+		return;
+
+	str = NULL;
+	while (readbuf_gets (buf, sizeof (buf), rb) != NULL) {
+		if (str == NULL)
+			str = g_string_new (buf);
+		else
+			g_string_append (str, buf);
+		g_string_append_c (str, ';');
+	}
+	readbuf_close (rb);
+	if (str != NULL) {
+		mate_desktop_item_set_string (item, MATE_DESKTOP_ITEM_SORT_ORDER,
+					       str->str);
+		g_string_free (str, TRUE);
+	}
+}
+
+static MateDesktopItem *
+make_fake_directory (GFile *dir)
+{
+	MateDesktopItem *item;
+	GFile *child;
+
+	item = mate_desktop_item_new ();
+	mate_desktop_item_set_entry_type (item,
+					   MATE_DESKTOP_ITEM_TYPE_DIRECTORY);
+
+	item->mtime = DONT_UPDATE_MTIME; /* it doesn't exist, we know that */
+	child = g_file_get_child (dir, ".directory");
+	mate_desktop_item_set_location_gfile (item, child);
+	item->mtime = 0;
+	g_object_unref (child);
+
+	read_sort_order (item, dir);
+
+	return item;
+}
+
+/**
+ * mate_desktop_item_new_from_file:
+ * @file: The filename or directory path to load the MateDesktopItem from
+ * @flags: Flags to influence the loading process
+ *
+ * This function loads 'file' and turns it into a MateDesktopItem.
+ *
+ * Returns: The newly loaded item.
+ */
+MateDesktopItem *
+mate_desktop_item_new_from_file (const char *file,
+				  MateDesktopItemLoadFlags flags,
+				  GError **error)
+{
+	MateDesktopItem *retval;
+	GFile *gfile;
+
+	g_return_val_if_fail (file != NULL, NULL);
+
+	gfile = g_file_new_for_path (file);
+	retval = mate_desktop_item_new_from_gfile (gfile, flags, error);
+	g_object_unref (gfile);
+
+	return retval;
+}
+
+/**
+ * mate_desktop_item_new_from_uri:
+ * @uri: URI to load the MateDesktopItem from
+ * @flags: Flags to influence the loading process
+ *
+ * This function loads 'uri' and turns it into a MateDesktopItem.
+ *
+ * Returns: The newly loaded item.
+ */
+MateDesktopItem *
+mate_desktop_item_new_from_uri (const char *uri,
+				 MateDesktopItemLoadFlags flags,
+				 GError **error)
+{
+	MateDesktopItem *retval;
+	GFile *file;
+
+	g_return_val_if_fail (uri != NULL, NULL);
+
+	file = g_file_new_for_uri (uri);
+	retval = mate_desktop_item_new_from_gfile (file, flags, error);
+	g_object_unref (file);
+
+	return retval;
+}
+
+static MateDesktopItem *
+mate_desktop_item_new_from_gfile (GFile *file,
+				   MateDesktopItemLoadFlags flags,
+				   GError **error)
+{
+	MateDesktopItem *retval;
+	GFile *subfn;
+	GFileInfo *info;
+	GFileType type;
+	GFile *parent;
+	gint64 mtime = 0;
+	ReadBuf *rb;
+
+	g_return_val_if_fail (file != NULL, NULL);
+
+	info = g_file_query_info (file,
+			          G_FILE_ATTRIBUTE_STANDARD_TYPE","G_FILE_ATTRIBUTE_TIME_MODIFIED,
+				  G_FILE_QUERY_INFO_NONE, NULL, error);
+	if (info == NULL)
+		return NULL;
+
+	type = g_file_info_get_file_type (info);
+
+	if (type != G_FILE_TYPE_REGULAR && type != G_FILE_TYPE_DIRECTORY) {
+		char *uri;
+
+		uri = g_file_get_uri (file);
+		g_set_error (error,
+			     /* FIXME: better errors */
+			     MATE_DESKTOP_ITEM_ERROR,
+			     MATE_DESKTOP_ITEM_ERROR_INVALID_TYPE,
+			     _("File '%s' is not a regular file or directory."),
+			     uri);
+
+		g_free (uri);
+		g_object_unref (info);
+
+		return NULL;
+	}
+
+	mtime = g_file_info_get_attribute_uint64 (info,
+						  G_FILE_ATTRIBUTE_TIME_MODIFIED);
+
+	g_object_unref (info);
+
+	if (type == G_FILE_TYPE_DIRECTORY) {
+		GFile *child;
+		GFileInfo *child_info;
+
+		child = g_file_get_child (file, ".directory");
+		child_info = g_file_query_info (child,
+						G_FILE_ATTRIBUTE_TIME_MODIFIED,
+						G_FILE_QUERY_INFO_NONE,
+						NULL, NULL);
+
+		if (child_info == NULL) {
+			g_object_unref (child);
+
+			if (flags & MATE_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS) {
+				return NULL;
+			} else {
+				return make_fake_directory (file);
+			}
+		}
+
+		mtime = g_file_info_get_attribute_uint64 (child_info,
+							  G_FILE_ATTRIBUTE_TIME_MODIFIED);
+		g_object_unref (child_info);
+
+		subfn = child;
+	} else {
+		subfn = g_file_dup (file);
+	}
+
+	rb = readbuf_open (subfn, error);
+
+	if (rb == NULL) {
+		g_object_unref (subfn);
+		return NULL;
+	}
+
+	retval = ditem_load (rb,
+			     (flags & MATE_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS) != 0,
+			     error);
+
+	if (retval == NULL) {
+		g_object_unref (subfn);
+		return NULL;
+	}
+
+	if (flags & MATE_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS &&
+	    ! mate_desktop_item_exists (retval)) {
+		mate_desktop_item_unref (retval);
+		g_object_unref (subfn);
+		return NULL;
+	}
+
+	retval->mtime = DONT_UPDATE_MTIME;
+	mate_desktop_item_set_location_gfile (retval, subfn);
+	retval->mtime = mtime;
+
+	parent = g_file_get_parent (file);
+	if (parent != NULL) {
+		read_sort_order (retval, parent);
+		g_object_unref (parent);
+	}
+
+	g_object_unref (subfn);
+
+	return retval;
+}
+
+/**
+ * mate_desktop_item_new_from_string:
+ * @string: string to load the MateDesktopItem from
+ * @length: length of string, or -1 to use strlen
+ * @flags: Flags to influence the loading process
+ * @error: place to put errors
+ *
+ * This function turns the contents of the string into a MateDesktopItem.
+ *
+ * Returns: The newly loaded item.
+ */
+MateDesktopItem *
+mate_desktop_item_new_from_string (const char *uri,
+				    const char *string,
+				    gssize length,
+				    MateDesktopItemLoadFlags flags,
+				    GError **error)
+{
+	MateDesktopItem *retval;
+	ReadBuf *rb;
+
+	g_return_val_if_fail (string != NULL, NULL);
+	g_return_val_if_fail (length >= -1, NULL);
+
+	if (length == -1) {
+		length = strlen (string);
+	}
+
+	rb = readbuf_new_from_string (uri, string, length);
+
+	retval = ditem_load (rb,
+			     (flags & MATE_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS) != 0,
+			     error);
+
+	if (retval == NULL) {
+		return NULL;
+	}
+
+	/* FIXME: Sort order? */
+
+	return retval;
+}
+
+static char *
+lookup_desktop_file_in_data_dir (const char *desktop_file,
+                                 const char *data_dir)
+{
+	char *path;
+
+	path = g_build_filename (data_dir, "applications", desktop_file, NULL);
+	if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+		g_free (path);
+		return NULL;
+	}
+	return path;
+}
+
+static char *
+file_from_basename (const char *basename)
+{
+	const char * const *system_data_dirs;
+	const char         *user_data_dir;
+	char               *retval;
+	int                 i;
+
+	user_data_dir = g_get_user_data_dir ();
+	system_data_dirs = g_get_system_data_dirs ();
+
+	if ((retval = lookup_desktop_file_in_data_dir (basename, user_data_dir))) {
+		return retval;
+	}
+	for (i = 0; system_data_dirs[i]; i++) {
+		if ((retval = lookup_desktop_file_in_data_dir (basename, system_data_dirs[i]))) {
+			return retval;
+		}
+	}
+	return NULL;
+}
+
+/**
+ * mate_desktop_item_new_from_basename:
+ * @basename: The basename of the MateDesktopItem to load.
+ * @flags: Flags to influence the loading process
+ *
+ * This function loads 'basename' from a system data directory and
+ * returns its MateDesktopItem.
+ *
+ * Returns: The newly loaded item.
+ */
+MateDesktopItem *
+mate_desktop_item_new_from_basename (const char *basename,
+                                      MateDesktopItemLoadFlags flags,
+                                      GError **error)
+{
+	MateDesktopItem *retval;
+	char *file;
+
+	g_return_val_if_fail (basename != NULL, NULL);
+
+	if (!(file = file_from_basename (basename))) {
+		g_set_error (error,
+			     MATE_DESKTOP_ITEM_ERROR,
+			     MATE_DESKTOP_ITEM_ERROR_CANNOT_OPEN,
+			     _("Cannot find file '%s'"),
+			     basename);
+		return NULL;
+	}
+
+	retval = mate_desktop_item_new_from_file (file, flags, error);
+	g_free (file);
+
+	return retval;
+}
+
+/**
+ * mate_desktop_item_save:
+ * @item: A desktop item
+ * @under: A new uri (location) for this #MateDesktopItem
+ * @force: Save even if it wasn't modified
+ * @error: #GError return
+ *
+ * Writes the specified item to disk.  If the 'under' is NULL, the original
+ * location is used.  It sets the location of this entry to point to the
+ * new location.
+ *
+ * Returns: boolean. %TRUE if the file was saved, %FALSE otherwise
+ */
+gboolean
+mate_desktop_item_save (MateDesktopItem *item,
+			 const char *under,
+			 gboolean force,
+			 GError **error)
+{
+	const char *uri;
+
+	if (under == NULL &&
+	    ! force &&
+	    ! item->modified)
+		return TRUE;
+
+	if (under == NULL)
+		uri = item->location;
+	else
+		uri = under;
+
+	if (uri == NULL) {
+		g_set_error (error,
+			     MATE_DESKTOP_ITEM_ERROR,
+			     MATE_DESKTOP_ITEM_ERROR_NO_FILENAME,
+			     _("No filename to save to"));
+		return FALSE;
+	}
+
+	if ( ! ditem_save (item, uri, error))
+		return FALSE;
+
+	item->modified = FALSE;
+	item->mtime = g_get_real_time () / G_USEC_PER_SEC;
+
+	return TRUE;
+}
+
+/**
+ * mate_desktop_item_ref:
+ * @item: A desktop item
+ *
+ * Description: Increases the reference count of the specified item.
+ *
+ * Returns: the newly referenced @item
+ */
+MateDesktopItem *
+mate_desktop_item_ref (MateDesktopItem *item)
+{
+	g_return_val_if_fail (item != NULL, NULL);
+
+	item->refcount++;
+
+	return item;
+}
+
+static void
+free_section (gpointer data)
+{
+	Section *section = data;
+
+	g_free (section->name);
+	section->name = NULL;
+
+	g_list_free_full (section->keys, g_free);
+	section->keys = NULL;
+
+	g_free (section);
+}
+
+/**
+ * mate_desktop_item_unref:
+ * @item: A desktop item
+ *
+ * Decreases the reference count of the specified item, and destroys the item if there are no more references left.
+ */
+void
+mate_desktop_item_unref (MateDesktopItem *item)
+{
+	g_return_if_fail (item != NULL);
+	g_return_if_fail (item->refcount > 0);
+
+	item->refcount--;
+
+	if(item->refcount != 0)
+		return;
+
+	g_list_free_full (item->languages, g_free);
+	item->languages = NULL;
+
+	g_list_free_full (item->keys, g_free);
+	item->keys = NULL;
+
+	g_list_free_full (item->sections, (GDestroyNotify) free_section);
+	item->sections = NULL;
+
+	g_hash_table_destroy (item->main_hash);
+	item->main_hash = NULL;
+
+	g_free (item->location);
+	item->location = NULL;
+
+	g_free (item);
+}
+
+static Section *
+find_section (MateDesktopItem *item, const char *section)
+{
+	GList *li;<--- Variable 'li' can be declared as pointer to const
+	Section *sec;
+
+	if (section == NULL)
+		return NULL;
+	if (strcmp (section, "Desktop Entry") == 0)
+		return NULL;
+
+	for (li = item->sections; li != NULL; li = li->next) {
+		sec = li->data;
+		if (strcmp (sec->name, section) == 0)
+			return sec;
+	}
+
+	sec = g_new0 (Section, 1);
+	sec->name = g_strdup (section);
+	sec->keys = NULL;
+
+	item->sections = g_list_append (item->sections, sec);
+
+	/* Don't mark the item modified, this is just an empty section,
+	 * it won't be saved even */
+
+	return sec;
+}
+
+static Section *
+section_from_key (MateDesktopItem *item, const char *key)
+{
+	char *p;<--- Variable 'p' can be declared as pointer to const
+	char *name;
+	Section *sec;
+
+	if (key == NULL)
+		return NULL;
+
+	p = strchr (key, '/');
+	if (p == NULL)
+		return NULL;
+
+	name = g_strndup (key, p - key);
+
+	sec = find_section (item, name);
+
+	g_free (name);
+
+	return sec;
+}
+
+static const char *
+key_basename (const char *key)
+{
+	char *p = strrchr (key, '/');
+	if (p != NULL)
+		return p+1;
+	else
+		return key;
+}
+
+static const char *
+lookup (const MateDesktopItem *item, const char *key)
+{
+	return g_hash_table_lookup (item->main_hash, key);
+}
+
+static const char *
+lookup_locale (const MateDesktopItem *item, const char *key, const char *locale)
+{
+	if (locale == NULL ||
+	    strcmp (locale, "C") == 0) {
+		return lookup (item, key);
+	} else {
+		const char *ret;
+		char *full = g_strdup_printf ("%s[%s]", key, locale);
+		ret = lookup (item, full);
+		g_free (full);
+		return ret;
+	}
+}
+
+static const char *
+lookup_best_locale (const MateDesktopItem *item, const char *key)
+{
+	const char * const *langs_pointer;
+	int                 i;
+
+	langs_pointer = g_get_language_names ();
+	for (i = 0; langs_pointer[i] != NULL; i++) {
+		const char *ret = NULL;
+
+		ret = lookup_locale (item, key, langs_pointer[i]);
+		if (ret != NULL)
+			return ret;
+	}
+
+	return NULL;
+}
+
+static void
+set (MateDesktopItem *item, const char *key, const char *value)
+{
+	Section *sec = section_from_key (item, key);
+
+	if (sec != NULL) {
+		if (value != NULL) {
+			if (g_hash_table_lookup (item->main_hash, key) == NULL)
+				sec->keys = g_list_append
+					(sec->keys,
+					 g_strdup (key_basename (key)));
+
+			g_hash_table_replace (item->main_hash,
+					      g_strdup (key),
+					      g_strdup (value));
+		} else {
+			GList *list = g_list_find_custom
+				(sec->keys, key_basename (key),
+				 (GCompareFunc)strcmp);
+			if (list != NULL) {
+				g_free (list->data);
+				sec->keys =
+					g_list_delete_link (sec->keys, list);
+			}
+			g_hash_table_remove (item->main_hash, key);
+		}
+	} else {
+		if (value != NULL) {
+			if (g_hash_table_lookup (item->main_hash, key) == NULL)
+				item->keys = g_list_append (item->keys,
+							    g_strdup (key));
+
+			g_hash_table_replace (item->main_hash,
+					      g_strdup (key),
+					      g_strdup (value));
+		} else {
+			GList *list = g_list_find_custom
+				(item->keys, key, (GCompareFunc)strcmp);
+			if (list != NULL) {
+				g_free (list->data);
+				item->keys =
+					g_list_delete_link (item->keys, list);
+			}
+			g_hash_table_remove (item->main_hash, key);
+		}
+	}
+	item->modified = TRUE;
+}
+
+static void
+set_locale (MateDesktopItem *item, const char *key,
+	    const char *locale, const char *value)
+{
+	if (locale == NULL ||
+	    strcmp (locale, "C") == 0) {
+		set (item, key, value);
+	} else {
+		char *full = g_strdup_printf ("%s[%s]", key, locale);
+		set (item, full, value);
+		g_free (full);
+
+		/* add the locale to the list of languages if it wasn't there
+		 * before */
+		if (g_list_find_custom (item->languages, locale,
+					(GCompareFunc)strcmp) == NULL)
+			item->languages = g_list_prepend (item->languages,
+							  g_strdup (locale));
+	}
+}
+
+static char **
+list_to_vector (GSList *list)
+{
+	int len = g_slist_length (list);
+	char **argv;
+	int i;
+	GSList *li;
+
+	argv = g_new0 (char *, len+1);
+
+	for (i = 0, li = list;
+	     li != NULL;
+	     li = li->next, i++) {
+		argv[i] = g_strdup (li->data);
+	}
+	argv[i] = NULL;
+
+	return argv;
+}
+
+static GSList *
+make_args (GList *files)
+{
+	GSList *list = NULL;
+	GList *li;
+
+	for (li = files; li != NULL; li = li->next) {
+		GFile *gfile;
+		const char *file = li->data;
+		if (file == NULL)
+			continue;
+		gfile = g_file_new_for_uri (file);
+		list = g_slist_prepend (list, gfile);
+	}
+
+	return g_slist_reverse (list);
+}
+
+static void
+free_args (GSList *list)
+{
+	GSList *li;
+
+	for (li = list; li != NULL; li = li->next) {
+		g_object_unref (G_FILE (li->data));
+		li->data = NULL;
+	}
+	g_slist_free (list);
+}
+
+static char *
+escape_single_quotes (const char *s,
+		      gboolean in_single_quotes,
+		      gboolean in_double_quotes)
+{
+	const char *p;
+	GString *gs;
+	const char *pre = "";
+	const char *post = "";
+
+	if ( ! in_single_quotes && ! in_double_quotes) {
+		pre = "'";
+		post = "'";
+	} else if ( ! in_single_quotes && in_double_quotes) {
+		pre = "\"'";
+		post = "'\"";
+	}
+
+	if (strchr (s, '\'') == NULL) {
+		return g_strconcat (pre, s, post, NULL);
+	}
+
+	gs = g_string_new (pre);
+
+	for (p = s; *p != '\0'; p++) {
+		if (*p == '\'')
+			g_string_append (gs, "'\\''");
+		else
+			g_string_append_c (gs, *p);
+	}
+
+	g_string_append (gs, post);
+
+	return g_string_free (gs, FALSE);
+}
+
+typedef enum {
+	URI_TO_STRING,
+	URI_TO_LOCAL_PATH,
+	URI_TO_LOCAL_DIRNAME,
+	URI_TO_LOCAL_BASENAME
+} ConversionType;
+
+static char *
+convert_uri (GFile          *file,
+	     ConversionType  conversion)
+{
+	char *retval = NULL;
+
+	switch (conversion) {
+	case URI_TO_STRING:
+		retval = g_file_get_uri (file);
+		break;
+	case URI_TO_LOCAL_PATH:
+		retval = g_file_get_path (file);
+		break;
+	case URI_TO_LOCAL_DIRNAME:
+		{
+			char *local_path;
+
+			local_path = g_file_get_path (file);
+			retval = g_path_get_dirname (local_path);
+			g_free (local_path);
+		}
+		break;
+	case URI_TO_LOCAL_BASENAME:
+		retval = g_file_get_basename (file);
+		break;
+	default:
+		g_assert_not_reached ();
+	}
+
+	return retval;
+}
+
+typedef enum {
+	ADDED_NONE = 0,
+	ADDED_SINGLE,
+	ADDED_ALL
+} AddedStatus;
+
+static AddedStatus
+append_all_converted (GString        *str,
+		      ConversionType  conversion,
+		      GSList         *args,
+		      gboolean        in_single_quotes,
+		      gboolean        in_double_quotes,
+		      AddedStatus     added_status)
+{
+	GSList *l;
+
+	for (l = args; l; l = l->next) {
+		char *converted;
+		char *escaped;
+
+		if (!(converted = convert_uri (l->data, conversion)))
+			continue;
+
+		g_string_append (str, " ");
+
+		escaped = escape_single_quotes (converted,
+						in_single_quotes,
+						in_double_quotes);
+		g_string_append (str, escaped);
+
+		g_free (escaped);
+		g_free (converted);
+	}
+
+	return ADDED_ALL;
+}
+
+static AddedStatus
+append_first_converted (GString         *str,
+			ConversionType   conversion,
+			GSList         **arg_ptr,
+			gboolean         in_single_quotes,
+			gboolean         in_double_quotes,
+			AddedStatus      added_status)
+{
+	GSList *l;
+	char   *converted = NULL;
+	char   *escaped;
+
+	for (l = *arg_ptr; l; l = l->next) {
+		if ((converted = convert_uri (l->data, conversion)))
+			break;
+
+		*arg_ptr = l->next;
+	}
+
+	if (!converted)
+		return added_status;
+
+	escaped = escape_single_quotes (converted, in_single_quotes, in_double_quotes);
+	g_string_append (str, escaped);
+	g_free (escaped);
+	g_free (converted);
+
+	return added_status != ADDED_ALL ? ADDED_SINGLE : added_status;
+}
+
+static gboolean
+do_percent_subst (const MateDesktopItem  *item,
+		  const char              *arg,
+		  GString                 *str,
+		  gboolean                 in_single_quotes,
+		  gboolean                 in_double_quotes,
+		  GSList                  *args,
+		  GSList                 **arg_ptr,
+		  AddedStatus             *added_status)
+{
+	char *esc;
+	const char *cs;
+
+	if (arg[0] != '%' || arg[1] == '\0') {
+		return FALSE;
+	}
+
+	switch (arg[1]) {
+	case '%':
+		g_string_append_c (str, '%');
+		break;
+	case 'U':
+		*added_status = append_all_converted (str,
+						      URI_TO_STRING,
+						      args,
+						      in_single_quotes,
+						      in_double_quotes,
+						      *added_status);
+		break;
+	case 'F':
+		*added_status = append_all_converted (str,
+						      URI_TO_LOCAL_PATH,
+						      args,
+						      in_single_quotes,
+						      in_double_quotes,
+						      *added_status);
+		break;
+	case 'N':
+		*added_status = append_all_converted (str,
+						      URI_TO_LOCAL_BASENAME,
+						      args,
+						      in_single_quotes,
+						      in_double_quotes,
+						      *added_status);
+		break;
+	case 'D':
+		*added_status = append_all_converted (str,
+						      URI_TO_LOCAL_DIRNAME,
+						      args,
+						      in_single_quotes,
+						      in_double_quotes,
+						      *added_status);
+		break;
+	case 'f':
+		*added_status = append_first_converted (str,
+							URI_TO_LOCAL_PATH,
+							arg_ptr,
+							in_single_quotes,
+							in_double_quotes,
+							*added_status);
+		break;
+	case 'u':
+		*added_status = append_first_converted (str,
+							URI_TO_STRING,
+							arg_ptr,
+							in_single_quotes,
+							in_double_quotes,
+							*added_status);
+		break;
+	case 'd':
+		*added_status = append_first_converted (str,
+							URI_TO_LOCAL_DIRNAME,
+							arg_ptr,
+							in_single_quotes,
+							in_double_quotes,
+							*added_status);
+		break;
+	case 'n':
+		*added_status = append_first_converted (str,
+							URI_TO_LOCAL_BASENAME,
+							arg_ptr,
+							in_single_quotes,
+							in_double_quotes,
+							*added_status);
+		break;
+	case 'm':
+		/* Note: v0.9.4 of the spec says this is deprecated
+		 * and replace with --miniicon iconname */
+		cs = mate_desktop_item_get_string (item, MATE_DESKTOP_ITEM_MINI_ICON);
+		if (cs != NULL) {
+			g_string_append (str, "--miniicon=");
+			esc = escape_single_quotes (cs, in_single_quotes, in_double_quotes);
+			g_string_append (str, esc);
+		}
+		break;
+	case 'i':
+		/* Note: v0.9.4 of the spec says replace with --icon iconname */
+		cs = mate_desktop_item_get_string (item, MATE_DESKTOP_ITEM_ICON);
+		if (cs != NULL) {
+			g_string_append (str, "--icon=");
+			esc = escape_single_quotes (cs, in_single_quotes, in_double_quotes);
+			g_string_append (str, esc);
+		}
+		break;
+	case 'c':
+		cs = mate_desktop_item_get_localestring (item, MATE_DESKTOP_ITEM_NAME);
+		if (cs != NULL) {
+			esc = escape_single_quotes (cs, in_single_quotes, in_double_quotes);
+			g_string_append (str, esc);
+			g_free (esc);
+		}
+		break;
+	case 'k':
+		if (item->location != NULL) {
+			esc = escape_single_quotes (item->location, in_single_quotes, in_double_quotes);
+			g_string_append (str, esc);
+			g_free (esc);
+		}
+		break;
+	case 'v':
+		cs = mate_desktop_item_get_localestring (item, MATE_DESKTOP_ITEM_DEV);
+		if (cs != NULL) {
+			esc = escape_single_quotes (cs, in_single_quotes, in_double_quotes);
+			g_string_append (str, esc);
+			g_free (esc);
+		}
+		break;
+	default:
+		/* Maintain special characters - e.g. "%20" */
+		if (g_ascii_isdigit (arg [1]))
+			g_string_append_c (str, '%');
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static char *
+expand_string (const MateDesktopItem  *item,
+	       const char              *s,
+	       GSList                  *args,
+	       GSList                 **arg_ptr,
+	       AddedStatus             *added_status)
+{
+	const char *p;
+	gboolean escape = FALSE;
+	gboolean single_quot = FALSE;
+	gboolean double_quot = FALSE;
+	GString *gs = g_string_new (NULL);
+
+	for (p = s; *p != '\0'; p++) {
+		if (escape) {
+			escape = FALSE;
+			g_string_append_c (gs, *p);
+		} else if (*p == '\\') {
+			if ( ! single_quot)
+				escape = TRUE;
+			g_string_append_c (gs, *p);
+		} else if (*p == '\'') {
+			g_string_append_c (gs, *p);
+			if ( ! single_quot && ! double_quot) {
+				single_quot = TRUE;
+			} else if (single_quot) {
+				single_quot = FALSE;
+			}
+		} else if (*p == '"') {
+			g_string_append_c (gs, *p);
+			if ( ! single_quot && ! double_quot) {
+				double_quot = TRUE;
+			} else if (double_quot) {
+				double_quot = FALSE;
+			}
+		} else if (*p == '%') {
+			if (do_percent_subst (item, p, gs,
+					      single_quot, double_quot,
+					      args, arg_ptr,
+					      added_status)) {
+				p++;
+			}
+		} else {
+			g_string_append_c (gs, *p);
+		}
+	}
+	return g_string_free (gs, FALSE);
+}
+
+#ifdef HAVE_STARTUP_NOTIFICATION
+static void
+sn_error_trap_push (SnDisplay *display,
+		    Display   *xdisplay)
+{
+	GdkDisplay *gdkdisplay;
+
+	gdkdisplay = gdk_display_get_default ();
+	gdk_x11_display_error_trap_push (gdkdisplay);
+}
+
+static void
+sn_error_trap_pop (SnDisplay *display,
+		   Display   *xdisplay)
+{
+	GdkDisplay *gdkdisplay;
+
+	gdkdisplay = gdk_display_get_default ();
+	gdk_x11_display_error_trap_pop_ignored (gdkdisplay);
+}
+
+static char **
+make_spawn_environment_for_sn_context (SnLauncherContext *sn_context,
+				       char             **envp)
+{
+	char **retval;
+	char **freeme;
+	int    i, j;
+	int    desktop_startup_id_len;
+
+	retval = freeme = NULL;
+
+	if (envp == NULL) {
+		envp = freeme = g_listenv ();
+		for (i = 0; envp[i]; i++) {
+			char *name = envp[i];
+
+			envp[i] = g_strjoin ("=", name, g_getenv (name), NULL);
+			g_free (name);
+		}
+	} else {
+		for (i = 0; envp[i]; i++)
+			;
+	}
+
+	retval = g_new (char *, i + 2);
+
+	desktop_startup_id_len = strlen ("DESKTOP_STARTUP_ID");
+
+	for (i = 0, j = 0; envp[i]; i++) {
+		if (strncmp (envp[i], "DESKTOP_STARTUP_ID", desktop_startup_id_len) != 0) {
+			retval[j] = g_strdup (envp[i]);
+			++j;
+	        }
+	}
+
+	retval[j] = g_strdup_printf ("DESKTOP_STARTUP_ID=%s",
+				     sn_launcher_context_get_startup_id (sn_context));
+	++j;
+	retval[j] = NULL;
+
+	g_strfreev (freeme);
+
+	return retval;
+}
+
+/* This should be fairly long, as it's confusing to users if a startup
+ * ends when it shouldn't (it appears that the startup failed, and
+ * they have to relaunch the app). Also the timeout only matters when
+ * there are bugs and apps don't end their own startup sequence.
+ *
+ * This timeout is a "last resort" timeout that ignores whether the
+ * startup sequence has shown activity or not.  Marco and the
+ * tasklist have smarter, and correspondingly able-to-be-shorter
+ * timeouts. The reason our timeout is dumb is that we don't monitor
+ * the sequence (don't use an SnMonitorContext)
+ */
+#define STARTUP_TIMEOUT_LENGTH_SEC 30 /* seconds */
+#define STARTUP_TIMEOUT_LENGTH (STARTUP_TIMEOUT_LENGTH_SEC * 1000)
+
+typedef struct
+{
+	GdkScreen *screen;
+	GSList *contexts;
+	guint timeout_id;
+} StartupTimeoutData;
+
+static void
+free_startup_timeout (void *data)
+{
+	StartupTimeoutData *std = data;
+
+	g_slist_free_full (std->contexts, (GDestroyNotify) sn_launcher_context_unref);
+
+	if (std->timeout_id != 0) {
+		g_source_remove (std->timeout_id);
+		std->timeout_id = 0;
+	}
+
+	g_free (std);
+}
+
+static gboolean
+startup_timeout (void *data)
+{
+	StartupTimeoutData *std = data;
+	GSList *tmp;
+	int min_timeout;
+
+	min_timeout = STARTUP_TIMEOUT_LENGTH;
+
+#if GLIB_CHECK_VERSION(2,61,2)
+	gint64 now = g_get_real_time ();
+#else
+	GTimeVal now;
+	g_get_current_time (&now);
+#endif
+
+	tmp = std->contexts;
+	while (tmp != NULL) {
+		SnLauncherContext *sn_context = tmp->data;
+		GSList *next = tmp->next;
+		double elapsed;
+
+#if GLIB_CHECK_VERSION(2,61,2)
+		time_t tv_sec;
+		suseconds_t tv_usec;
+		gint64 tv;
+
+		sn_launcher_context_get_last_active_time (sn_context, &tv_sec, &tv_usec);
+		tv = (tv_sec * G_USEC_PER_SEC) + tv_usec;
+		elapsed = (double) (now - tv) / 1000.0;
+#else
+		long tv_sec, tv_usec;
+
+		sn_launcher_context_get_last_active_time (sn_context,
+							  &tv_sec, &tv_usec);
+
+		elapsed =
+			((((double)now.tv_sec - tv_sec) * G_USEC_PER_SEC +
+			  (now.tv_usec - tv_usec))) / 1000.0;
+#endif
+
+		if (elapsed >= STARTUP_TIMEOUT_LENGTH) {
+			std->contexts = g_slist_remove (std->contexts,
+							sn_context);
+			sn_launcher_context_complete (sn_context);
+			sn_launcher_context_unref (sn_context);
+		} else {
+			min_timeout = MIN (min_timeout, (STARTUP_TIMEOUT_LENGTH - elapsed));
+		}
+
+		tmp = next;
+	}
+
+	/* we'll use seconds for the timeout */
+	if (min_timeout < 1000)
+		min_timeout = 1000;
+
+	if (std->contexts == NULL) {
+		std->timeout_id = 0;
+	} else {
+		std->timeout_id = g_timeout_add_seconds (min_timeout / 1000,
+							 startup_timeout,
+							 std);
+	}
+
+	/* always remove this one, but we may have reinstalled another one. */
+	return FALSE;
+}
+
+static void
+add_startup_timeout (GdkScreen         *screen,
+		     SnLauncherContext *sn_context)
+{
+	StartupTimeoutData *data;
+
+	data = g_object_get_data (G_OBJECT (screen), "mate-startup-data");
+	if (data == NULL) {
+		data = g_new (StartupTimeoutData, 1);
+		data->screen = screen;
+		data->contexts = NULL;
+		data->timeout_id = 0;
+
+		g_object_set_data_full (G_OBJECT (screen), "mate-startup-data",
+					data, free_startup_timeout);
+	}
+
+	sn_launcher_context_ref (sn_context);
+	data->contexts = g_slist_prepend (data->contexts, sn_context);
+
+	if (data->timeout_id == 0) {
+		data->timeout_id = g_timeout_add_seconds (
+						STARTUP_TIMEOUT_LENGTH_SEC,
+						startup_timeout,
+						data);
+	}
+}
+#endif /* HAVE_STARTUP_NOTIFICATION */
+
+static inline char *
+stringify_uris (GSList *args)
+{
+	GString *str;
+
+	str = g_string_new (NULL);
+
+	append_all_converted (str, URI_TO_STRING, args, FALSE, FALSE, ADDED_NONE);
+
+	return g_string_free (str, FALSE);
+}
+
+static inline char *
+stringify_files (GSList *args)
+{
+	GString *str;
+
+	str = g_string_new (NULL);
+
+	append_all_converted (str, URI_TO_LOCAL_PATH, args, FALSE, FALSE, ADDED_NONE);
+
+	return g_string_free (str, FALSE);
+}
+
+static char **
+make_environment_for_screen (GdkScreen  *screen,
+			     char      **envp)
+{
+	GdkDisplay *display;
+	char      **retval;
+	char      **freeme;
+	char       *display_name;
+	int         display_index = -1;
+	int         i, env_len;
+
+	g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+
+	retval = freeme = NULL;
+
+	if (envp == NULL) {
+		envp = freeme = g_listenv ();
+		for (i = 0; envp [i]; i++) {
+			char *name = envp[i];
+
+			envp[i] = g_strjoin ("=", name, g_getenv (name), NULL);
+			g_free (name);
+		}
+	}
+
+	for (env_len = 0; envp [env_len]; env_len++)
+		if (strncmp (envp [env_len], "DISPLAY", strlen ("DISPLAY")) == 0)
+			display_index = env_len;
+
+	retval = g_new (char *, env_len + 1);
+	retval [env_len] = NULL;
+
+	display = gdk_screen_get_display (screen);
+	display_name = g_strdup (gdk_display_get_name (display));
+
+	for (i = 0; i < env_len; i++)
+		if (i == display_index)
+			retval [i] = g_strconcat ("DISPLAY=", display_name, NULL);
+		else
+			retval [i] = g_strdup (envp[i]);
+
+	g_assert (i == env_len);
+
+	g_free (display_name);
+	g_strfreev (freeme);
+
+	return retval;
+}
+
+static void
+dummy_child_watch (GPid         pid,
+		   gint         status,
+		   gpointer user_data)
+{
+	/* Nothing, this is just to ensure we don't double fork
+	 * and break pkexec:
+	 * https://bugzilla.gnome.org/show_bug.cgi?id=675789
+	 */
+}
+
+static int
+ditem_execute (const MateDesktopItem *item,
+	       const char *exec,
+	       GList *file_list,
+	       GdkScreen *screen,
+	       int workspace,
+               char **envp,
+	       gboolean launch_only_one,
+	       gboolean use_current_dir,
+	       gboolean append_uris,
+	       gboolean append_paths,
+	       gboolean do_not_reap_child,
+	       GError **error)
+{
+	char **free_me = NULL;
+	char **real_argv;
+	int i, ret;
+	char **term_argv = NULL;
+	int term_argc = 0;
+	GSList *vector_list;
+	GSList *args, *arg_ptr;
+	AddedStatus added_status;
+	const char *working_dir = NULL;
+	char **temp_argv = NULL;
+	int temp_argc = 0;
+	char *new_exec, *uris, *temp;
+	char *exec_locale;
+	int launched = 0;
+	GPid pid;
+#ifdef HAVE_STARTUP_NOTIFICATION
+	GdkDisplay *gdkdisplay;
+	SnLauncherContext *sn_context;
+	SnDisplay *sn_display;
+	const char *startup_class;
+#endif
+
+	g_return_val_if_fail (item, -1);
+
+	if (item->type == MATE_DESKTOP_ITEM_TYPE_APPLICATION) {
+		working_dir = mate_desktop_item_get_string (item, MATE_DESKTOP_ITEM_PATH);
+		if (working_dir &&
+		    !g_file_test (working_dir, G_FILE_TEST_IS_DIR))
+			working_dir = NULL;
+	}
+
+	if (working_dir == NULL && !use_current_dir)
+		working_dir = g_get_home_dir ();
+
+	if (mate_desktop_item_get_boolean (item, MATE_DESKTOP_ITEM_TERMINAL)) {
+		const char *options =
+			mate_desktop_item_get_string (item, MATE_DESKTOP_ITEM_TERMINAL_OPTIONS);
+
+		if (options != NULL) {
+			g_shell_parse_argv (options,
+					    &term_argc,
+					    &term_argv,
+					    NULL /* error */);
+			/* ignore errors */
+		}
+
+		mate_desktop_prepend_terminal_to_vector (&term_argc, &term_argv);
+	}
+
+	args = make_args (file_list);
+	arg_ptr = make_args (file_list);
+
+#ifdef HAVE_STARTUP_NOTIFICATION
+	if (screen)
+		gdkdisplay = gdk_screen_get_display (screen);
+	else
+		gdkdisplay = gdk_display_get_default ();
+
+	sn_display = sn_display_new (GDK_DISPLAY_XDISPLAY (gdkdisplay),
+				     sn_error_trap_push,
+				     sn_error_trap_pop);
+
+	/* Only initiate notification if desktop file supports it.
+	 * (we could avoid setting up the SnLauncherContext if we aren't going
+	 * to initiate, but why bother)
+	 */
+
+	startup_class = mate_desktop_item_get_string (item,
+						       "StartupWMClass");
+	if (startup_class ||
+	    mate_desktop_item_get_boolean (item, "StartupNotify")) {
+		const char *name;
+		const char *icon;
+
+		sn_context = sn_launcher_context_new (sn_display,
+						      screen ? gdk_x11_screen_get_screen_number (screen) :
+						      DefaultScreen (GDK_DISPLAY_XDISPLAY (gdkdisplay)));
+
+		name = mate_desktop_item_get_localestring (item,
+							    MATE_DESKTOP_ITEM_NAME);
+
+		if (name == NULL)
+			name = mate_desktop_item_get_localestring (item,
+								    MATE_DESKTOP_ITEM_GENERIC_NAME);
+
+		if (name != NULL) {
+			char *description;
+
+			sn_launcher_context_set_name (sn_context, name);
+
+			description = g_strdup_printf (_("Starting %s"), name);
+
+			sn_launcher_context_set_description (sn_context, description);
+
+			g_free (description);
+		}
+
+		icon = mate_desktop_item_get_string (item,
+						      MATE_DESKTOP_ITEM_ICON);
+
+		if (icon != NULL)
+			sn_launcher_context_set_icon_name (sn_context, icon);
+
+		sn_launcher_context_set_workspace (sn_context, workspace);
+
+		if (startup_class != NULL)
+			sn_launcher_context_set_wmclass (sn_context,
+							 startup_class);
+	} else {
+		sn_context = NULL;
+	}
+#endif
+
+	if (screen) {
+		envp = make_environment_for_screen (screen, envp);
+		if (free_me)
+			g_strfreev (free_me);
+		free_me = envp;
+	}
+
+	exec_locale = g_filename_from_utf8 (exec, -1, NULL, NULL, NULL);
+
+	if (exec_locale == NULL) {
+		exec_locale = g_strdup ("");
+	}
+
+	do {
+		added_status = ADDED_NONE;
+		new_exec = expand_string (item,
+					  exec_locale,
+					  args, &arg_ptr, &added_status);
+
+		if (launched == 0 && added_status == ADDED_NONE && append_uris) {
+			uris = stringify_uris (args);
+			temp = g_strconcat (new_exec, " ", uris, NULL);
+			g_free (uris);
+			g_free (new_exec);
+			new_exec = temp;
+			added_status = ADDED_ALL;
+		}
+
+		/* append_uris and append_paths are mutually exlusive */
+		if (launched == 0 && added_status == ADDED_NONE && append_paths) {
+			uris = stringify_files (args);
+			temp = g_strconcat (new_exec, " ", uris, NULL);
+			g_free (uris);
+			g_free (new_exec);
+			new_exec = temp;
+			added_status = ADDED_ALL;
+		}
+
+		if (launched > 0 && added_status == ADDED_NONE) {
+			g_free (new_exec);
+			break;
+		}
+
+		if ( ! g_shell_parse_argv (new_exec,
+					   &temp_argc, &temp_argv, error)) {
+			/* The error now comes from g_shell_parse_argv */
+			g_free (new_exec);
+			ret = -1;
+			break;
+		}
+		g_free (new_exec);
+
+		vector_list = NULL;
+		for(i = 0; i < term_argc; i++)
+			vector_list = g_slist_append (vector_list,
+						      g_strdup (term_argv[i]));
+
+		for(i = 0; i < temp_argc; i++)
+			vector_list = g_slist_append (vector_list,
+						      g_strdup (temp_argv[i]));
+
+		g_strfreev (temp_argv);
+
+		real_argv = list_to_vector (vector_list);
+		g_slist_free_full (vector_list, g_free);
+
+#ifdef HAVE_STARTUP_NOTIFICATION
+		if (sn_context != NULL &&
+		    !sn_launcher_context_get_initiated (sn_context)) {
+			guint32 launch_time;
+
+			/* This means that we always use the first real_argv[0]
+			 * we select for the "binary name", but it's probably
+			 * OK to do that. Binary name isn't super-important
+			 * anyway, and we can't initiate twice, and we
+			 * must initiate prior to fork/exec.
+			 */
+
+			sn_launcher_context_set_binary_name (sn_context,
+							     real_argv[0]);
+
+			if (item->launch_time > 0)
+				launch_time = item->launch_time;
+			else
+				launch_time = gdk_x11_display_get_user_time (gdkdisplay);
+
+			sn_launcher_context_initiate (sn_context,
+						      g_get_prgname () ? g_get_prgname () : "unknown",
+						      real_argv[0],
+						      launch_time);
+
+			/* Don't allow accidental reuse of same timestamp */
+			((MateDesktopItem *)item)->launch_time = 0;
+
+			envp = make_spawn_environment_for_sn_context (sn_context, envp);
+			if (free_me)
+				g_strfreev (free_me);
+			free_me = envp;
+		}
+#endif
+
+		if ( ! g_spawn_async (working_dir,
+				      real_argv,
+				      envp,
+				      (do_not_reap_child ? G_SPAWN_DO_NOT_REAP_CHILD : 0) | G_SPAWN_SEARCH_PATH /* flags */,
+				      NULL, /* child_setup_func */
+				      NULL, /* child_setup_func_data */
+				      (do_not_reap_child ? &pid : NULL) /* child_pid */,
+				      error)) {
+			/* The error was set for us,
+			 * we just can't launch this thingie */
+			ret = -1;
+			g_strfreev (real_argv);
+			break;
+		} else if (do_not_reap_child) {
+			g_child_watch_add (pid, dummy_child_watch, NULL);
+		}
+
+		launched ++;
+
+		g_strfreev (real_argv);
+
+		if (arg_ptr != NULL)
+			arg_ptr = arg_ptr->next;
+
+	/* rinse, repeat until we run out of arguments (That
+	 * is if we were adding singles anyway) */
+	} while (added_status == ADDED_SINGLE &&
+		 arg_ptr != NULL &&
+		 ! launch_only_one);
+
+	g_free (exec_locale);
+#ifdef HAVE_STARTUP_NOTIFICATION
+	if (sn_context != NULL) {
+		if (ret < 0)
+			sn_launcher_context_complete (sn_context); /* end sequence */
+		else
+			add_startup_timeout (screen ? screen :
+					     gdk_display_get_default_screen (gdk_display_get_default ()),
+					     sn_context);
+		sn_launcher_context_unref (sn_context);
+	}
+
+	sn_display_unref (sn_display);
+#endif /* HAVE_STARTUP_NOTIFICATION */
+
+	free_args (args);
+
+	if (term_argv)
+		g_strfreev (term_argv);
+
+	if (free_me)
+		g_strfreev (free_me);
+
+	return ret;
+}
+
+/* strip any trailing &, return FALSE if bad things happen and
+   we end up with an empty string */
+static gboolean
+strip_the_amp (char *exec)
+{
+	size_t exec_len;
+
+	g_strstrip (exec);
+	if (*exec == '\0')
+		return FALSE;
+
+	exec_len = strlen (exec);
+	/* kill any trailing '&' */
+	if (exec[exec_len-1] == '&') {
+		exec[exec_len-1] = '\0';
+		g_strchomp (exec);
+	}
+
+	/* can't exactly launch an empty thing */
+	if (*exec == '\0')
+		return FALSE;
+
+	return TRUE;
+}
+
+static int
+mate_desktop_item_launch_on_screen_with_env (
+		const MateDesktopItem       *item,
+		GList                        *file_list,
+		MateDesktopItemLaunchFlags   flags,
+		GdkScreen                    *screen,
+		int                           workspace,
+		char                        **envp,
+		GError                      **error)
+{
+	const char *exec;
+	char *the_exec;
+	int ret;
+
+	exec = mate_desktop_item_get_string (item, MATE_DESKTOP_ITEM_EXEC);
+	/* This is a URL, so launch it as a url */
+	if (item->type == MATE_DESKTOP_ITEM_TYPE_LINK) {
+		const char *url;
+		gboolean    retval;
+
+		url = mate_desktop_item_get_string (item, MATE_DESKTOP_ITEM_URL);
+		/* Mate panel used to put this in Exec */
+		if (!(url && url[0] != '\0'))
+			url = exec;
+
+		if (!(url && url[0] != '\0')) {
+			g_set_error (error,
+				     MATE_DESKTOP_ITEM_ERROR,
+				     MATE_DESKTOP_ITEM_ERROR_NO_URL,
+				     _("No URL to launch"));
+			return -1;
+		}
+
+		retval = gtk_show_uri_on_window  (NULL,
+		                                  url,
+		                                  GDK_CURRENT_TIME,
+		                                  error);
+		return retval ? 0 : -1;
+	}
+
+	/* check the type, if there is one set */
+	if (item->type != MATE_DESKTOP_ITEM_TYPE_APPLICATION) {
+		g_set_error (error,
+			     MATE_DESKTOP_ITEM_ERROR,
+			     MATE_DESKTOP_ITEM_ERROR_NOT_LAUNCHABLE,
+			     _("Not a launchable item"));
+		return -1;
+	}
+
+	if (exec == NULL ||
+	    exec[0] == '\0') {
+		g_set_error (error,
+			     MATE_DESKTOP_ITEM_ERROR,
+			     MATE_DESKTOP_ITEM_ERROR_NO_EXEC_STRING,
+			     _("No command (Exec) to launch"));
+		return -1;
+	}
+
+	/* make a new copy and get rid of spaces */
+	the_exec = g_alloca (strlen (exec) + 1);
+	g_strlcpy (the_exec, exec, strlen (exec) + 1);
+
+	if ( ! strip_the_amp (the_exec)) {
+		g_set_error (error,
+			     MATE_DESKTOP_ITEM_ERROR,
+			     MATE_DESKTOP_ITEM_ERROR_BAD_EXEC_STRING,
+			     _("Bad command (Exec) to launch"));
+		return -1;
+	}
+
+	ret = ditem_execute (item, the_exec, file_list, screen, workspace, envp,
+			     (flags & MATE_DESKTOP_ITEM_LAUNCH_ONLY_ONE),
+			     (flags & MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR),
+			     (flags & MATE_DESKTOP_ITEM_LAUNCH_APPEND_URIS),
+			     (flags & MATE_DESKTOP_ITEM_LAUNCH_APPEND_PATHS),
+			     (flags & MATE_DESKTOP_ITEM_LAUNCH_DO_NOT_REAP_CHILD),
+			     error);
+
+	return ret;
+}
+
+/**
+ * mate_desktop_item_launch:
+ * @item: A desktop item
+ * @file_list:  Files/URIs to launch this item with, can be %NULL
+ * @flags: FIXME
+ * @error: FIXME
+ *
+ * This function runs the program listed in the specified 'item',
+ * optionally appending additional arguments to its command line.  It uses
+ * #g_shell_parse_argv to parse the the exec string into a vector which is
+ * then passed to #g_spawn_async for execution. This can return all
+ * the errors from MateURL, #g_shell_parse_argv and #g_spawn_async,
+ * in addition to it's own.  The files are
+ * only added if the entry defines one of the standard % strings in it's
+ * Exec field.
+ *
+ * Returns: The the pid of the process spawned.  If more then one
+ * process was spawned the last pid is returned.  On error -1
+ * is returned and @error is set.
+ */
+int
+mate_desktop_item_launch (const MateDesktopItem       *item,
+			   GList                        *file_list,
+			   MateDesktopItemLaunchFlags   flags,
+			   GError                      **error)
+{
+	return mate_desktop_item_launch_on_screen_with_env (
+			item, file_list, flags, NULL, -1, NULL, error);
+}
+
+/**
+ * mate_desktop_item_launch_with_env:
+ * @item: A desktop item
+ * @file_list:  Files/URIs to launch this item with, can be %NULL
+ * @flags: FIXME
+ * @envp: child's environment, or %NULL to inherit parent's
+ * @error: FIXME
+ *
+ * See mate_desktop_item_launch for a full description. This function
+ * additionally passes an environment vector for the child process
+ * which is to be launched.
+ *
+ * Returns: The the pid of the process spawned.  If more then one
+ * process was spawned the last pid is returned.  On error -1
+ * is returned and @error is set.
+ */
+int
+mate_desktop_item_launch_with_env (const MateDesktopItem       *item,
+				    GList                        *file_list,
+				    MateDesktopItemLaunchFlags   flags,
+				    char                        **envp,
+				    GError                      **error)
+{
+	return mate_desktop_item_launch_on_screen_with_env (
+			item, file_list, flags,
+			NULL, -1, envp, error);
+}
+
+/**
+ * mate_desktop_item_launch_on_screen:
+ * @item: A desktop item
+ * @file_list:  Files/URIs to launch this item with, can be %NULL
+ * @flags: FIXME
+ * @screen: the %GdkScreen on which the application should be launched
+ * @workspace: the workspace on which the app should be launched (-1 for current)
+ * @error: FIXME
+ *
+ * See mate_desktop_item_launch for a full description. This function
+ * additionally attempts to launch the application on a given screen
+ * and workspace.
+ *
+ * Returns: The the pid of the process spawned.  If more then one
+ * process was spawned the last pid is returned.  On error -1
+ * is returned and @error is set.
+ */
+int
+mate_desktop_item_launch_on_screen (const MateDesktopItem       *item,
+				     GList                        *file_list,
+				     MateDesktopItemLaunchFlags   flags,
+				     GdkScreen                    *screen,
+				     int                           workspace,
+				     GError                      **error)
+{
+	return mate_desktop_item_launch_on_screen_with_env (
+			item, file_list, flags,
+			screen, workspace, NULL, error);
+}
+
+/**
+ * mate_desktop_item_drop_uri_list:
+ * @item: A desktop item
+ * @uri_list: text as gotten from a text/uri-list
+ * @flags: FIXME
+ * @error: FIXME
+ *
+ * A list of files or urls dropped onto an icon, the proper (Url or File)
+ * exec is run you can pass directly string that you got as the
+ * text/uri-list.  This just parses the list and calls
+ *
+ * Returns: The value returned by #mate_execute_async() upon execution of
+ * the specified item or -1 on error.  If multiple instances are run, the
+ * return of the last one is returned.
+ */
+int
+mate_desktop_item_drop_uri_list (const MateDesktopItem *item,
+				  const char *uri_list,
+				  MateDesktopItemLaunchFlags flags,
+				  GError **error)
+{
+	return mate_desktop_item_drop_uri_list_with_env (item, uri_list,
+							  flags, NULL, error);
+}
+
+/**
+* mate_desktop_item_drop_uri_list_with_env:
+* @item: A desktop item
+* @uri_list: text as gotten from a text/uri-list
+* @flags: FIXME
+* @envp: child's environment
+* @error: FIXME
+*
+* See mate_desktop_item_drop_uri_list for a full description. This function
+* additionally passes an environment vector for the child process
+* which is to be launched.
+*
+* Returns: The value returned by #mate_execute_async() upon execution of
+* the specified item or -1 on error.  If multiple instances are run, the
+* return of the last one is returned.
+*/
+int
+mate_desktop_item_drop_uri_list_with_env (const MateDesktopItem *item,
+					   const char *uri_list,
+					   MateDesktopItemLaunchFlags flags,
+					   char                        **envp,
+					   GError **error)
+{
+	int ret;
+	char  *uri;
+	char **uris;
+	GList *list = NULL;
+
+	uris = g_uri_list_extract_uris (uri_list);
+
+	for (uri = uris[0]; uri != NULL; uri++) {
+		list = g_list_prepend (list, uri);
+	}
+	list = g_list_reverse (list);
+
+	ret =  mate_desktop_item_launch_with_env (
+			item, list, flags, envp, error);
+
+	g_strfreev (uris);
+	g_list_free (list);
+
+	return ret;
+}
+
+static gboolean
+exec_exists (const char *exec)
+{
+	if (g_path_is_absolute (exec)) {
+		if (access (exec, X_OK) == 0)
+			return TRUE;
+		else
+			return FALSE;
+	} else {
+		char *tryme;
+
+		tryme = g_find_program_in_path (exec);
+		if (tryme != NULL) {
+			g_free (tryme);
+			return TRUE;
+		}
+		return FALSE;
+	}
+}
+
+/**
+ * mate_desktop_item_exists:
+ * @item: A desktop item
+ *
+ * Attempt to figure out if the program that can be executed by this item
+ * actually exists.  First it tries the TryExec attribute to see if that
+ * contains a program that is in the path.  Then if there is no such
+ * attribute, it tries the first word of the Exec attribute.
+ *
+ * Returns: A boolean, %TRUE if it exists, %FALSE otherwise.
+ */
+gboolean
+mate_desktop_item_exists (const MateDesktopItem *item)
+{
+	const char *try_exec;
+	const char *exec;
+
+	g_return_val_if_fail (item != NULL, FALSE);
+
+	try_exec = lookup (item, MATE_DESKTOP_ITEM_TRY_EXEC);
+
+	if (try_exec != NULL &&
+	    ! exec_exists (try_exec)) {
+		return FALSE;
+	}
+
+	if (item->type == MATE_DESKTOP_ITEM_TYPE_APPLICATION) {
+		int argc;
+		char **argv;
+		const char *exe;
+
+		exec = lookup (item, MATE_DESKTOP_ITEM_EXEC);
+		if (exec == NULL)
+			return FALSE;
+
+		if ( ! g_shell_parse_argv (exec, &argc, &argv, NULL))
+			return FALSE;
+
+		if (argc < 1) {
+			g_strfreev (argv);
+			return FALSE;
+		}
+
+		exe = argv[0];
+
+		if ( ! exec_exists (exe)) {
+			g_strfreev (argv);
+			return FALSE;
+		}
+		g_strfreev (argv);
+	}
+
+	return TRUE;
+}
+
+/**
+ * mate_desktop_item_get_entry_type:
+ * @item: A desktop item
+ *
+ * Gets the type attribute (the 'Type' field) of the item.  This should
+ * usually be 'Application' for an application, but it can be 'Directory'
+ * for a directory description.  There are other types available as well.
+ * The type usually indicates how the desktop item should be handeled and
+ * how the 'Exec' field should be handeled.
+ *
+ * Returns: The type of the specified 'item'. The returned
+ * memory remains owned by the MateDesktopItem and should not be freed.
+ */
+MateDesktopItemType
+mate_desktop_item_get_entry_type (const MateDesktopItem *item)
+{
+	g_return_val_if_fail (item != NULL, 0);
+	g_return_val_if_fail (item->refcount > 0, 0);
+
+	return item->type;
+}
+
+void
+mate_desktop_item_set_entry_type (MateDesktopItem *item,
+				   MateDesktopItemType type)
+{
+	g_return_if_fail (item != NULL);
+	g_return_if_fail (item->refcount > 0);
+
+	item->type = type;
+
+	switch (type) {
+	case MATE_DESKTOP_ITEM_TYPE_NULL:
+		set (item, MATE_DESKTOP_ITEM_TYPE, NULL);
+		break;
+	case MATE_DESKTOP_ITEM_TYPE_APPLICATION:
+		set (item, MATE_DESKTOP_ITEM_TYPE, "Application");
+		break;
+	case MATE_DESKTOP_ITEM_TYPE_LINK:
+		set (item, MATE_DESKTOP_ITEM_TYPE, "Link");
+		break;
+	case MATE_DESKTOP_ITEM_TYPE_FSDEVICE:
+		set (item, MATE_DESKTOP_ITEM_TYPE, "FSDevice");
+		break;
+	case MATE_DESKTOP_ITEM_TYPE_MIME_TYPE:
+		set (item, MATE_DESKTOP_ITEM_TYPE, "MimeType");
+		break;
+	case MATE_DESKTOP_ITEM_TYPE_DIRECTORY:
+		set (item, MATE_DESKTOP_ITEM_TYPE, "Directory");
+		break;
+	case MATE_DESKTOP_ITEM_TYPE_SERVICE:
+		set (item, MATE_DESKTOP_ITEM_TYPE, "Service");
+		break;
+	case MATE_DESKTOP_ITEM_TYPE_SERVICE_TYPE:
+		set (item, MATE_DESKTOP_ITEM_TYPE, "ServiceType");
+		break;
+	default:
+		break;
+	}
+}
+
+/**
+ * mate_desktop_item_get_file_status:
+ * @item: A desktop item
+ *
+ * This function checks the modification time of the on-disk file to
+ * see if it is more recent than the in-memory data.
+ *
+ * Returns: An enum value that specifies whether the item has changed since being loaded.
+ */
+MateDesktopItemStatus
+mate_desktop_item_get_file_status (const MateDesktopItem *item)
+{
+	MateDesktopItemStatus retval;
+	GFile *file;
+	GFileInfo *info;
+
+	g_return_val_if_fail (item != NULL, MATE_DESKTOP_ITEM_DISAPPEARED);
+	g_return_val_if_fail (item->refcount > 0, MATE_DESKTOP_ITEM_DISAPPEARED);
+
+	if (item->location == NULL)
+		return MATE_DESKTOP_ITEM_DISAPPEARED;
+
+	file = g_file_new_for_uri (item->location);
+	info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED,
+				  G_FILE_QUERY_INFO_NONE, NULL, NULL);
+
+	retval = MATE_DESKTOP_ITEM_UNCHANGED;
+
+	if (!g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_TIME_MODIFIED))
+		retval = MATE_DESKTOP_ITEM_DISAPPEARED;
+	else if (((guint64) item->mtime) < g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED))
+		retval = MATE_DESKTOP_ITEM_CHANGED;
+
+	g_object_unref (info);
+	g_object_unref (file);
+
+	return retval;
+}
+
+/**
+ * mate_desktop_item_find_icon:
+ * @icon_theme: a #GtkIconTheme
+ * @icon: icon name, something you'd get out of the Icon key
+ * @desired_size: FIXME
+ * @flags: FIXME
+ *
+ * Description:  This function goes and looks for the icon file.  If the icon
+ * is not an absolute filename, this will look for it in the standard places.
+ * If it can't find the icon, it will return %NULL
+ *
+ * Returns: A newly allocated string
+ */
+char *
+mate_desktop_item_find_icon (GtkIconTheme *icon_theme,
+			      const char *icon,
+			      int desired_size,
+			      int flags)
+{
+	GtkIconInfo *info;
+	char *full = NULL;
+
+	g_return_val_if_fail (icon_theme == NULL ||
+			      GTK_IS_ICON_THEME (icon_theme), NULL);
+
+	if (icon == NULL || strcmp(icon,"") == 0) {
+		return NULL;
+	} else if (g_path_is_absolute (icon)) {
+		if (g_file_test (icon, G_FILE_TEST_EXISTS)) {
+			return g_strdup (icon);
+		} else {
+			return NULL;
+		}
+	} else {
+		char *icon_no_extension;
+		char *p;
+
+		if (icon_theme == NULL)
+			icon_theme = gtk_icon_theme_get_default ();
+
+		icon_no_extension = g_strdup (icon);
+		p = strrchr (icon_no_extension, '.');
+		if (p &&
+		    (strcmp (p, ".png") == 0 ||
+		     strcmp (p, ".xpm") == 0 ||
+		     strcmp (p, ".svg") == 0)) {
+		    *p = 0;
+		}
+
+		info = gtk_icon_theme_lookup_icon (icon_theme,
+						   icon_no_extension,
+						   desired_size,
+						   0);
+
+		full = NULL;
+		if (info) {
+			full = g_strdup (gtk_icon_info_get_filename (info));
+			g_object_unref (info);
+		}
+		g_free (icon_no_extension);
+	}
+
+	return full;
+
+}
+
+/**
+ * mate_desktop_item_get_icon:
+ * @icon_theme: a #GtkIconTheme
+ * @item: A desktop item
+ *
+ * Description:  This function goes and looks for the icon file.  If the icon
+ * is not set as an absolute filename, this will look for it in the standard places.
+ * If it can't find the icon, it will return %NULL
+ *
+ * Returns: A newly allocated string
+ */
+char *
+mate_desktop_item_get_icon (const MateDesktopItem *item,
+			     GtkIconTheme *icon_theme)
+{
+	/* maybe this function should be deprecated in favour of find icon
+	 * -George */
+	const char *icon;
+
+	g_return_val_if_fail (item != NULL, NULL);
+	g_return_val_if_fail (item->refcount > 0, NULL);
+
+	icon = mate_desktop_item_get_string (item, MATE_DESKTOP_ITEM_ICON);
+
+	return mate_desktop_item_find_icon (icon_theme, icon,
+					     48 /* desired_size */,
+					     0 /* flags */);
+}
+
+/**
+ * mate_desktop_item_get_location:
+ * @item: A desktop item
+ *
+ * Returns: The file location associated with 'item'.
+ *
+ */
+const char *
+mate_desktop_item_get_location (const MateDesktopItem *item)
+{
+	g_return_val_if_fail (item != NULL, NULL);
+	g_return_val_if_fail (item->refcount > 0, NULL);
+
+	return item->location;
+}
+
+/**
+ * mate_desktop_item_set_location:
+ * @item: A desktop item
+ * @location: A uri string specifying the file location of this particular item.
+ *
+ * Set's the 'location' uri of this item.
+ */
+void
+mate_desktop_item_set_location (MateDesktopItem *item, const char *location)
+{
+	g_return_if_fail (item != NULL);
+	g_return_if_fail (item->refcount > 0);
+
+	if (item->location != NULL &&
+	    location != NULL &&
+	    strcmp (item->location, location) == 0)
+		return;
+
+	g_free (item->location);
+	item->location = g_strdup (location);
+
+	/* This is ugly, but useful internally */
+	if (item->mtime != DONT_UPDATE_MTIME) {
+		item->mtime = 0;
+
+		if (item->location) {
+			GFile     *file;
+			GFileInfo *info;
+
+			file = g_file_new_for_uri (item->location);
+
+			info = g_file_query_info (file,
+						  G_FILE_ATTRIBUTE_TIME_MODIFIED,
+						  G_FILE_QUERY_INFO_NONE,
+						  NULL, NULL);
+			if (info) {
+				if (g_file_info_has_attribute (info,
+							       G_FILE_ATTRIBUTE_TIME_MODIFIED))
+					item->mtime = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
+				g_object_unref (info);
+			}
+
+			g_object_unref (file);
+		}
+	}
+
+	/* Make sure that save actually saves */
+	item->modified = TRUE;
+}
+
+/**
+ * mate_desktop_item_set_location_file:
+ * @item: A desktop item
+ * @file: A local filename specifying the file location of this particular item.
+ *
+ * Set's the 'location' uri of this item to the given @file.
+ */
+void
+mate_desktop_item_set_location_file (MateDesktopItem *item, const char *file)
+{
+	g_return_if_fail (item != NULL);
+	g_return_if_fail (item->refcount > 0);
+
+	if (file != NULL) {
+		GFile *gfile;
+
+		gfile = g_file_new_for_path (file);
+		mate_desktop_item_set_location_gfile (item, gfile);
+		g_object_unref (gfile);
+	} else {
+		mate_desktop_item_set_location (item, NULL);
+	}
+}
+
+static void
+mate_desktop_item_set_location_gfile (MateDesktopItem *item, GFile *file)
+{
+	g_return_if_fail (item != NULL);
+	g_return_if_fail (item->refcount > 0);
+
+	if (file != NULL) {
+		char *uri;
+
+		uri = g_file_get_uri (file);
+		mate_desktop_item_set_location (item, uri);
+		g_free (uri);
+	} else {
+		mate_desktop_item_set_location (item, NULL);
+	}
+}
+
+/*
+ * Reading/Writing different sections, NULL is the standard section
+ */
+
+gboolean
+mate_desktop_item_attr_exists (const MateDesktopItem *item,
+				const char *attr)
+{
+	g_return_val_if_fail (item != NULL, FALSE);
+	g_return_val_if_fail (item->refcount > 0, FALSE);
+	g_return_val_if_fail (attr != NULL, FALSE);
+
+	return lookup (item, attr) != NULL;
+}
+
+/*
+ * String type
+ */
+const char *
+mate_desktop_item_get_string (const MateDesktopItem *item,
+			       const char *attr)
+{
+	g_return_val_if_fail (item != NULL, NULL);
+	g_return_val_if_fail (item->refcount > 0, NULL);
+	g_return_val_if_fail (attr != NULL, NULL);
+
+	return lookup (item, attr);
+}
+
+void
+mate_desktop_item_set_string (MateDesktopItem *item,
+			       const char *attr,
+			       const char *value)
+{
+	g_return_if_fail (item != NULL);
+	g_return_if_fail (item->refcount > 0);
+	g_return_if_fail (attr != NULL);
+
+	set (item, attr, value);
+
+	if (strcmp (attr, MATE_DESKTOP_ITEM_TYPE) == 0)
+		item->type = type_from_string (value);
+}
+
+/*
+ * LocaleString type
+ */
+const char* mate_desktop_item_get_localestring(const MateDesktopItem* item, const char* attr)
+{
+	g_return_val_if_fail(item != NULL, NULL);
+	g_return_val_if_fail(item->refcount > 0, NULL);
+	g_return_val_if_fail(attr != NULL, NULL);
+
+	return lookup_best_locale(item, attr);
+}
+
+const char* mate_desktop_item_get_localestring_lang(const MateDesktopItem* item, const char* attr, const char* language)
+{
+	g_return_val_if_fail(item != NULL, NULL);
+	g_return_val_if_fail(item->refcount > 0, NULL);
+	g_return_val_if_fail(attr != NULL, NULL);
+
+	return lookup_locale(item, attr, language);
+}
+
+/**
+ * mate_desktop_item_get_string_locale:
+ * @item: A desktop item
+ * @attr: An attribute name
+ *
+ * Returns the current locale that is used for the given attribute.
+ * This might not be the same for all attributes. For example, if your
+ * locale is "en_US.ISO8859-1" but attribute FOO only has "en_US" then
+ * that would be returned for attr = "FOO". If attribute BAR has
+ * "en_US.ISO8859-1" then that would be returned for "BAR".
+ *
+ * Returns: a string equal to the current locale or NULL
+ * if the attribute is invalid or there is no matching locale.
+ */
+const char *
+mate_desktop_item_get_attr_locale (const MateDesktopItem *item,
+				    const char             *attr)
+{
+	const char * const *langs_pointer;
+	int                 i;
+
+	langs_pointer = g_get_language_names ();
+	for (i = 0; langs_pointer[i] != NULL; i++) {
+		const char *value = NULL;
+
+		value = lookup_locale (item, attr, langs_pointer[i]);
+		if (value)
+			return langs_pointer[i];
+	}
+
+	return NULL;
+}
+
+GList *
+mate_desktop_item_get_languages (const MateDesktopItem *item,
+				  const char *attr)
+{
+	GList *li;
+	GList *list = NULL;
+
+	g_return_val_if_fail (item != NULL, NULL);
+	g_return_val_if_fail (item->refcount > 0, NULL);
+
+	for (li = item->languages; li != NULL; li = li->next) {
+		char *language = li->data;
+		if (attr == NULL ||
+		    lookup_locale (item, attr, language) != NULL) {
+			list = g_list_prepend (list, language);
+		}
+	}
+
+	return g_list_reverse (list);
+}
+
+static const char *
+get_language (void)
+{
+	const char * const *langs_pointer;
+	int                 i;
+
+	langs_pointer = g_get_language_names ();
+	for (i = 0; langs_pointer[i] != NULL; i++) {
+		/* find first without encoding  */
+		if (strchr (langs_pointer[i], '.') == NULL) {
+			return langs_pointer[i];
+		}
+	}
+	return NULL;
+}
+
+void
+mate_desktop_item_set_localestring (MateDesktopItem *item,
+				     const char *attr,
+				     const char *value)
+{
+	g_return_if_fail (item != NULL);
+	g_return_if_fail (item->refcount > 0);
+	g_return_if_fail (attr != NULL);
+
+	set_locale (item, attr, get_language (), value);
+}
+
+void
+mate_desktop_item_set_localestring_lang (MateDesktopItem *item,
+					  const char *attr,
+					  const char *language,
+					  const char *value)
+{
+	g_return_if_fail (item != NULL);
+	g_return_if_fail (item->refcount > 0);
+	g_return_if_fail (attr != NULL);
+
+	set_locale (item, attr, language, value);
+}
+
+void
+mate_desktop_item_clear_localestring (MateDesktopItem *item,
+				       const char *attr)
+{
+	GList *l;<--- Variable 'l' can be declared as pointer to const
+
+	g_return_if_fail (item != NULL);
+	g_return_if_fail (item->refcount > 0);
+	g_return_if_fail (attr != NULL);
+
+	for (l = item->languages; l != NULL; l = l->next)
+		set_locale (item, attr, l->data, NULL);
+
+	set (item, attr, NULL);
+}
+
+/*
+ * Strings, Regexps types
+ */
+
+char **
+mate_desktop_item_get_strings (const MateDesktopItem *item,
+				const char *attr)
+{
+	const char *value;
+
+	g_return_val_if_fail (item != NULL, NULL);
+	g_return_val_if_fail (item->refcount > 0, NULL);
+	g_return_val_if_fail (attr != NULL, NULL);
+
+	value = lookup (item, attr);
+	if (value == NULL)
+		return NULL;
+
+	/* FIXME: there's no way to escape semicolons apparently */
+	return g_strsplit (value, ";", -1);
+}
+
+void
+mate_desktop_item_set_strings (MateDesktopItem *item,
+				const char *attr,
+				char **strings)
+{
+	char *str, *str2;
+
+	g_return_if_fail (item != NULL);
+	g_return_if_fail (item->refcount > 0);
+	g_return_if_fail (attr != NULL);
+
+	str = g_strjoinv (";", strings);
+	str2 = g_strconcat (str, ";", NULL);
+	/* FIXME: there's no way to escape semicolons apparently */
+	set (item, attr, str2);
+	g_free (str);
+	g_free (str2);
+}
+
+/*
+ * Boolean type
+ */
+gboolean
+mate_desktop_item_get_boolean (const MateDesktopItem *item,
+				const char *attr)
+{
+	const char *value;
+
+	g_return_val_if_fail (item != NULL, FALSE);
+	g_return_val_if_fail (item->refcount > 0, FALSE);
+	g_return_val_if_fail (attr != NULL, FALSE);
+
+	value = lookup (item, attr);
+	if (value == NULL)
+		return FALSE;
+
+	return (value[0] == 'T' ||
+		value[0] == 't' ||
+		value[0] == 'Y' ||
+		value[0] == 'y' ||
+		atoi (value) != 0);
+}
+
+void
+mate_desktop_item_set_boolean (MateDesktopItem *item,
+				const char *attr,
+				gboolean value)
+{
+	g_return_if_fail (item != NULL);
+	g_return_if_fail (item->refcount > 0);
+	g_return_if_fail (attr != NULL);
+
+	set (item, attr, value ? "true" : "false");
+}
+
+void
+mate_desktop_item_set_launch_time (MateDesktopItem *item,
+				    guint32           timestamp)
+{
+	g_return_if_fail (item != NULL);
+
+	item->launch_time = timestamp;
+}
+
+/*
+ * Clearing attributes
+ */
+void
+mate_desktop_item_clear_section (MateDesktopItem *item,
+				  const char *section)
+{
+	Section *sec;
+	GList *li;
+
+	g_return_if_fail (item != NULL);
+	g_return_if_fail (item->refcount > 0);
+
+	sec = find_section (item, section);
+
+	if (sec == NULL) {
+		for (li = item->keys; li != NULL; li = li->next) {
+			g_hash_table_remove (item->main_hash, li->data);
+			g_free (li->data);
+			li->data = NULL;
+		}
+		g_list_free (item->keys);
+		item->keys = NULL;
+	} else {
+		for (li = sec->keys; li != NULL; li = li->next) {
+			char *key = li->data;
+			char *full = g_strdup_printf ("%s/%s",
+						      sec->name, key);
+			g_hash_table_remove (item->main_hash, full);
+			g_free (full);
+			g_free (key);
+			li->data = NULL;
+		}
+		g_list_free (sec->keys);
+		sec->keys = NULL;
+	}
+	item->modified = TRUE;
+}
+
+/************************************************************
+ * Parser:                                                  *
+ ************************************************************/
+
+static gboolean G_GNUC_CONST
+standard_is_boolean (const char * key)
+{
+	static GHashTable *bools = NULL;
+
+	if (bools == NULL) {
+		bools = g_hash_table_new (g_str_hash, g_str_equal);
+		g_hash_table_insert (bools,
+				     MATE_DESKTOP_ITEM_NO_DISPLAY,
+				     MATE_DESKTOP_ITEM_NO_DISPLAY);
+		g_hash_table_insert (bools,
+				     MATE_DESKTOP_ITEM_HIDDEN,
+				     MATE_DESKTOP_ITEM_HIDDEN);
+		g_hash_table_insert (bools,
+				     MATE_DESKTOP_ITEM_TERMINAL,
+				     MATE_DESKTOP_ITEM_TERMINAL);
+		g_hash_table_insert (bools,
+				     MATE_DESKTOP_ITEM_READ_ONLY,
+				     MATE_DESKTOP_ITEM_READ_ONLY);
+	}
+
+	return g_hash_table_lookup (bools, key) != NULL;
+}
+
+static gboolean G_GNUC_CONST
+standard_is_strings (const char *key)
+{
+	static GHashTable *strings = NULL;
+
+	if (strings == NULL) {
+		strings = g_hash_table_new (g_str_hash, g_str_equal);
+		g_hash_table_insert (strings,
+				     MATE_DESKTOP_ITEM_FILE_PATTERN,
+				     MATE_DESKTOP_ITEM_FILE_PATTERN);
+		g_hash_table_insert (strings,
+				     MATE_DESKTOP_ITEM_ACTIONS,
+				     MATE_DESKTOP_ITEM_ACTIONS);
+		g_hash_table_insert (strings,
+				     MATE_DESKTOP_ITEM_MIME_TYPE,
+				     MATE_DESKTOP_ITEM_MIME_TYPE);
+		g_hash_table_insert (strings,
+				     MATE_DESKTOP_ITEM_PATTERNS,
+				     MATE_DESKTOP_ITEM_PATTERNS);
+		g_hash_table_insert (strings,
+				     MATE_DESKTOP_ITEM_SORT_ORDER,
+				     MATE_DESKTOP_ITEM_SORT_ORDER);
+	}
+
+	return g_hash_table_lookup (strings, key) != NULL;
+}
+
+/* If no need to cannonize, returns NULL */
+static char *
+cannonize (const char *key, const char *value)
+{
+	if (standard_is_boolean (key)) {
+		if (value[0] == 'T' ||
+		    value[0] == 't' ||
+		    value[0] == 'Y' ||
+		    value[0] == 'y' ||
+		    atoi (value) != 0) {
+			return g_strdup ("true");
+		} else {
+			return g_strdup ("false");
+		}
+	} else if (standard_is_strings (key)) {
+		int len = strlen (value);
+		if (len == 0 || value[len-1] != ';') {
+			return g_strconcat (value, ";", NULL);
+		}
+	}
+	/* XXX: Perhaps we should canonize numeric values as well, but this
+	 * has caused some subtle problems before so it needs to be done
+	 * carefully if at all */
+	return NULL;
+}
+
+static char *
+decode_string_and_dup (const char *s)
+{
+	char *p = g_malloc (strlen (s) + 1);
+	char *q = p;
+
+	do {
+		if (*s == '\\'){
+			switch (*(++s)){
+			case 's':
+				*p++ = ' ';
+				break;
+			case 't':
+				*p++ = '\t';
+				break;
+			case 'n':
+				*p++ = '\n';
+				break;
+			case '\\':
+				*p++ = '\\';
+				break;
+			case 'r':
+				*p++ = '\r';
+				break;
+			default:
+				*p++ = '\\';
+				*p++ = *s;
+				break;
+			}
+		} else {
+			*p++ = *s;
+		}
+	} while (*s++);
+
+	return q;
+}
+
+static char *
+escape_string_and_dup (const char *s)
+{
+	char *return_value, *p;
+	const char *q;
+	int len = 0;
+
+	if (s == NULL)
+		return g_strdup("");
+
+	q = s;
+	while (*q){
+		len++;
+		if (strchr ("\n\r\t\\", *q) != NULL)
+			len++;
+		q++;
+	}
+	return_value = p = (char *) g_malloc (len + 1);
+	do {
+		switch (*s){
+		case '\t':
+			*p++ = '\\';
+			*p++ = 't';
+			break;
+		case '\n':
+			*p++ = '\\';
+			*p++ = 'n';
+			break;
+		case '\r':
+			*p++ = '\\';
+			*p++ = 'r';
+			break;
+		case '\\':
+			*p++ = '\\';
+			*p++ = '\\';
+			break;
+		default:
+			*p++ = *s;
+		}
+	} while (*s++);
+	return return_value;
+}
+
+static gboolean
+check_locale (const char *locale)
+{
+	GIConv cd = g_iconv_open ("UTF-8", locale);
+	if ((GIConv)-1 == cd)
+		return FALSE;
+	g_iconv_close (cd);
+	return TRUE;
+}
+
+static void
+insert_locales (GHashTable *encodings, char *enc, ...)
+{
+	va_list args;
+	char *s;
+
+	va_start (args, enc);
+	for (;;) {
+		s = va_arg (args, char *);
+		if (s == NULL)
+			break;
+		g_hash_table_insert (encodings, s, enc);
+	}
+	va_end (args);
+}
+
+/* make a standard conversion table from the desktop standard spec */
+static GHashTable *
+init_encodings (void)
+{
+	GHashTable *encodings = g_hash_table_new (g_str_hash, g_str_equal);
+
+	/* "C" is plain ascii */
+	insert_locales (encodings, "ASCII", "C", NULL);
+
+	insert_locales (encodings, "ARMSCII-8", "by", NULL);
+	insert_locales (encodings, "BIG5", "zh_TW", NULL);
+	insert_locales (encodings, "CP1251", "be", "bg", NULL);
+	if (check_locale ("EUC-CN")) {
+		insert_locales (encodings, "EUC-CN", "zh_CN", NULL);
+	} else {
+		insert_locales (encodings, "GB2312", "zh_CN", NULL);
+	}
+	insert_locales (encodings, "EUC-JP", "ja", NULL);
+	insert_locales (encodings, "EUC-KR", "ko", NULL);
+	/*insert_locales (encodings, "GEORGIAN-ACADEMY", NULL);*/
+	insert_locales (encodings, "GEORGIAN-PS", "ka", NULL);
+	insert_locales (encodings, "ISO-8859-1", "br", "ca", "da", "de", "en", "es", "eu", "fi", "fr", "gl", "it", "nl", "wa", "no", "pt", "pt", "sv", NULL);
+	insert_locales (encodings, "ISO-8859-2", "cs", "hr", "hu", "pl", "ro", "sk", "sl", "sq", "sr", NULL);
+	insert_locales (encodings, "ISO-8859-3", "eo", NULL);
+	insert_locales (encodings, "ISO-8859-5", "mk", "sp", NULL);
+	insert_locales (encodings, "ISO-8859-7", "el", NULL);
+	insert_locales (encodings, "ISO-8859-9", "tr", NULL);
+	insert_locales (encodings, "ISO-8859-13", "lt", "lv", "mi", NULL);
+	insert_locales (encodings, "ISO-8859-14", "ga", "cy", NULL);
+	insert_locales (encodings, "ISO-8859-15", "et", NULL);
+	insert_locales (encodings, "KOI8-R", "ru", NULL);
+	insert_locales (encodings, "KOI8-U", "uk", NULL);
+	if (check_locale ("TCVN-5712")) {
+		insert_locales (encodings, "TCVN-5712", "vi", NULL);
+	} else {
+		insert_locales (encodings, "TCVN", "vi", NULL);
+	}
+	insert_locales (encodings, "TIS-620", "th", NULL);
+	/*insert_locales (encodings, "VISCII", NULL);*/
+
+	return encodings;
+}
+
+static const char *
+get_encoding_from_locale (const char *locale)
+{
+	char lang[3];
+	const char *encoding;
+	static GHashTable *encodings = NULL;
+
+	if (locale == NULL)
+		return NULL;
+
+	/* if locale includes encoding, use it */
+	encoding = strchr (locale, '.');
+	if (encoding != NULL) {
+		return encoding+1;
+	}
+
+	if (encodings == NULL)
+		encodings = init_encodings ();
+
+	/* first try the entire locale (at this point ll_CC) */
+	encoding = g_hash_table_lookup (encodings, locale);
+	if (encoding != NULL)
+		return encoding;
+
+	/* Try just the language */
+	strncpy (lang, locale, 2);
+	lang[2] = '\0';
+	return g_hash_table_lookup (encodings, lang);
+}
+
+static Encoding
+get_encoding (ReadBuf *rb)
+{
+	gboolean old_kde = FALSE;
+	char     buf [BUFSIZ];
+	gboolean all_valid_utf8 = TRUE;
+
+	while (readbuf_gets (buf, sizeof (buf), rb) != NULL) {
+		if (strncmp (MATE_DESKTOP_ITEM_ENCODING,
+			     buf,
+			     strlen (MATE_DESKTOP_ITEM_ENCODING)) == 0) {
+			char *p = &buf[strlen (MATE_DESKTOP_ITEM_ENCODING)];
+			if (*p == ' ')
+				p++;
+			if (*p != '=')
+				continue;
+			p++;
+			if (*p == ' ')
+				p++;
+			if (strcmp (p, "UTF-8") == 0) {
+				return ENCODING_UTF8;
+			} else if (strcmp (p, "Legacy-Mixed") == 0) {
+				return ENCODING_LEGACY_MIXED;
+			} else {
+				/* According to the spec we're not supposed
+				 * to read a file like this */
+				return ENCODING_UNKNOWN;
+			}
+		} else if (strcmp ("[KDE Desktop Entry]", buf) == 0) {
+			old_kde = TRUE;
+			/* don't break yet, we still want to support
+			 * Encoding even here */
+		}
+		if (all_valid_utf8 && ! g_utf8_validate (buf, -1, NULL))
+			all_valid_utf8 = FALSE;
+	}
+
+	if (old_kde)
+		return ENCODING_LEGACY_MIXED;
+
+	/* try to guess by location */
+	if (rb->uri != NULL && strstr (rb->uri, "mate/apps/") != NULL) {
+		/* old mate */
+		return ENCODING_LEGACY_MIXED;
+	}
+
+	/* A dilemma, new KDE files are in UTF-8 but have no Encoding
+	 * info, at this time we really can't tell.  The best thing to
+	 * do right now is to just assume UTF-8 if the whole file
+	 * validates as utf8 I suppose */
+
+	if (all_valid_utf8)
+		return ENCODING_UTF8;
+	else
+		return ENCODING_LEGACY_MIXED;
+}
+
+static char *
+decode_string (const char *value, Encoding encoding, const char *locale)
+{
+	char *retval = NULL;
+
+	/* if legacy mixed, then convert */
+	if (locale != NULL && encoding == ENCODING_LEGACY_MIXED) {
+		const char *char_encoding = get_encoding_from_locale (locale);
+		char *utf8_string;
+		if (char_encoding == NULL)
+			return NULL;
+		if (strcmp (char_encoding, "ASCII") == 0) {
+			return decode_string_and_dup (value);
+		}
+		utf8_string = g_convert (value, -1, "UTF-8", char_encoding,
+					NULL, NULL, NULL);
+		if (utf8_string == NULL)
+			return NULL;
+		retval = decode_string_and_dup (utf8_string);
+		g_free (utf8_string);
+		return retval;
+	/* if utf8, then validate */
+	} else if (locale != NULL && encoding == ENCODING_UTF8) {
+		if ( ! g_utf8_validate (value, -1, NULL))
+			/* invalid utf8, ignore this key */
+			return NULL;
+		return decode_string_and_dup (value);
+	} else {
+		/* Meaning this is not a localized string */
+		return decode_string_and_dup (value);
+	}
+}
+
+static char *
+snarf_locale_from_key (const char *key)
+{
+	const char *brace;
+	char *locale, *p;
+
+	brace = strchr (key, '[');
+	if (brace == NULL)
+		return NULL;
+
+	locale = g_strdup (brace + 1);
+	if (*locale == '\0') {
+		g_free (locale);
+		return NULL;
+	}
+	p = strchr (locale, ']');
+	if (p == NULL) {
+		g_free (locale);
+		return NULL;
+	}
+	*p = '\0';
+	return locale;
+}
+
+static void
+insert_key (MateDesktopItem *item,
+	    Section *cur_section,
+	    Encoding encoding,
+	    const char *key,
+	    const char *value,
+	    gboolean old_kde,
+	    gboolean no_translations)
+{
+	char *k;
+	char *val;
+	/* we always store everything in UTF-8 */
+	if (cur_section == NULL &&
+	    strcmp (key, MATE_DESKTOP_ITEM_ENCODING) == 0) {
+		k = g_strdup (key);
+		val = g_strdup ("UTF-8");
+	} else {
+		char *locale = snarf_locale_from_key (key);
+		/* If we're ignoring translations */
+		if (no_translations && locale != NULL) {
+			g_free (locale);
+			return;
+		}
+		val = decode_string (value, encoding, locale);
+
+		/* Ignore this key, it's whacked */
+		if (val == NULL) {
+			g_free (locale);
+			return;
+		}
+
+		g_strchomp (val);
+
+		/* For old KDE entries, we can also split by a comma
+		 * on sort order, so convert to semicolons */
+		if (old_kde &&
+		    cur_section == NULL &&
+		    strcmp (key, MATE_DESKTOP_ITEM_SORT_ORDER) == 0 &&
+		    strchr (val, ';') == NULL) {
+			int i;
+			for (i = 0; val[i] != '\0'; i++) {
+				if (val[i] == ',')
+					val[i] = ';';
+			}
+		}
+
+		/* Check some types, not perfect, but catches a lot
+		 * of things */
+		if (cur_section == NULL) {
+			char *cannon = cannonize (key, val);
+			if (cannon != NULL) {
+				g_free (val);
+				val = cannon;
+			}
+		}
+
+		k = g_strdup (key);
+
+		/* Take care of the language part */
+		if (locale != NULL &&
+		    strcmp (locale, "C") == 0) {
+			char *p;
+			/* Whack C locale */
+			p = strchr (k, '[');
+			*p = '\0';
+			g_free (locale);
+		} else if (locale != NULL) {
+			char *p, *brace;<--- Variable 'brace' can be declared as pointer to const
+
+			/* Whack the encoding part */
+			p = strchr (locale, '.');
+			if (p != NULL)
+				*p = '\0';
+
+			if (g_list_find_custom (item->languages, locale,
+						(GCompareFunc)strcmp) == NULL) {
+				item->languages = g_list_prepend
+					(item->languages, locale);
+			} else {
+				g_free (locale);
+			}
+
+			/* Whack encoding from encoding in the key */
+			brace = strchr (k, '[');
+			p = strchr (brace, '.');
+			if (p != NULL) {
+				*p = ']';
+				*(p+1) = '\0';
+			}
+		}
+	}
+
+	if (cur_section == NULL) {
+		/* only add to list if we haven't seen it before */
+		if (g_hash_table_lookup (item->main_hash, k) == NULL) {
+			item->keys = g_list_prepend (item->keys,
+						     g_strdup (k));
+		}
+		/* later duplicates override earlier ones */
+		g_hash_table_replace (item->main_hash, k, val);
+	} else {
+		char *full = g_strdup_printf
+			("%s/%s",
+			 cur_section->name, k);
+		/* only add to list if we haven't seen it before */
+		if (g_hash_table_lookup (item->main_hash, full) == NULL) {
+			cur_section->keys =
+				g_list_prepend (cur_section->keys, k);
+		}
+		/* later duplicates override earlier ones */
+		g_hash_table_replace (item->main_hash,
+				      full, val);
+	}
+}
+
+static void
+setup_type (MateDesktopItem *item, const char *uri)
+{
+	const char *type = g_hash_table_lookup (item->main_hash,
+						MATE_DESKTOP_ITEM_TYPE);
+	if (type == NULL && uri != NULL) {
+		char *base = g_path_get_basename (uri);
+		if (base != NULL &&
+		    strcmp (base, ".directory") == 0) {
+			/* This gotta be a directory */
+			g_hash_table_replace (item->main_hash,
+					      g_strdup (MATE_DESKTOP_ITEM_TYPE),
+					      g_strdup ("Directory"));
+			item->keys = g_list_prepend
+				(item->keys, g_strdup (MATE_DESKTOP_ITEM_TYPE));
+			item->type = MATE_DESKTOP_ITEM_TYPE_DIRECTORY;
+		} else {
+			item->type = MATE_DESKTOP_ITEM_TYPE_NULL;
+		}
+		g_free (base);
+	} else {
+		item->type = type_from_string (type);
+	}
+}
+
+/* fallback to find something suitable for C locale */
+static char *
+try_english_key (MateDesktopItem *item, const char *key)<--- Parameter 'item' can be declared as pointer to const
+{
+	char *str;
+	char *locales[] = { "en_US", "en_GB", "en_AU", "en", NULL };
+	int i;
+
+	str = NULL;
+	for (i = 0; locales[i] != NULL && str == NULL; i++) {
+		str = g_strdup (lookup_locale (item, key, locales[i]));
+	}
+	if (str != NULL) {
+		/* We need a 7-bit ascii string, so whack all
+		 * above 127 chars */
+		guchar *p;
+		for (p = (guchar *)str; *p != '\0'; p++) {
+			if (*p > 127)
+				*p = '?';
+		}
+	}
+	return str;
+}
+
+static void
+sanitize (MateDesktopItem *item, const char *uri)
+{
+	const char *type;
+
+	type = lookup (item, MATE_DESKTOP_ITEM_TYPE);
+
+	/* understand old mate style url exec thingies */
+	if (type != NULL && strcmp (type, "URL") == 0) {
+		const char *exec = lookup (item, MATE_DESKTOP_ITEM_EXEC);
+		set (item, MATE_DESKTOP_ITEM_TYPE, "Link");
+		if (exec != NULL) {
+			/* Note, this must be in this order */
+			set (item, MATE_DESKTOP_ITEM_URL, exec);
+			set (item, MATE_DESKTOP_ITEM_EXEC, NULL);
+		}
+	}
+
+	/* we make sure we have Name, Encoding and Version */
+	if (lookup (item, MATE_DESKTOP_ITEM_NAME) == NULL) {
+		char *name = try_english_key (item, MATE_DESKTOP_ITEM_NAME);
+		/* If no name, use the basename */
+		if (name == NULL && uri != NULL)
+			name = g_path_get_basename (uri);
+		/* If no uri either, use same default as mate_desktop_item_new */
+		if (name == NULL) {
+		       /* Translators: the "name" mentioned here is the name of
+			* an application or a document */
+			name = g_strdup (_("No name"));
+		}
+		g_hash_table_replace (item->main_hash,
+				      g_strdup (MATE_DESKTOP_ITEM_NAME),
+				      name);
+		item->keys = g_list_prepend
+			(item->keys, g_strdup (MATE_DESKTOP_ITEM_NAME));
+	}
+	if (lookup (item, MATE_DESKTOP_ITEM_ENCODING) == NULL) {
+		/* We store everything in UTF-8 so write that down */
+		g_hash_table_replace (item->main_hash,
+				      g_strdup (MATE_DESKTOP_ITEM_ENCODING),
+				      g_strdup ("UTF-8"));
+		item->keys = g_list_prepend
+			(item->keys, g_strdup (MATE_DESKTOP_ITEM_ENCODING));
+	}
+	if (lookup (item, MATE_DESKTOP_ITEM_VERSION) == NULL) {
+		/* this is the version that we follow, so write it down */
+		g_hash_table_replace (item->main_hash,
+				      g_strdup (MATE_DESKTOP_ITEM_VERSION),
+				      g_strdup ("1.0"));
+		item->keys = g_list_prepend
+			(item->keys, g_strdup (MATE_DESKTOP_ITEM_VERSION));
+	}
+}
+
+enum {
+	FirstBrace,
+	OnSecHeader,
+	IgnoreToEOL,
+	IgnoreToEOLFirst,
+	KeyDef,
+	KeyDefOnKey,
+	KeyValue
+};
+
+static MateDesktopItem *
+ditem_load (ReadBuf *rb,
+	    gboolean no_translations,
+	    GError **error)
+{
+	int state;
+	char CharBuffer [1024];
+	char *next = CharBuffer;
+	int c;
+	Encoding encoding;
+	MateDesktopItem *item;
+	Section *cur_section = NULL;
+	char *key = NULL;
+	gboolean old_kde = FALSE;
+
+	encoding = get_encoding (rb);
+	if (encoding == ENCODING_UNKNOWN) {
+		/* spec says, don't read this file */
+		g_set_error (error,
+			     MATE_DESKTOP_ITEM_ERROR,
+			     MATE_DESKTOP_ITEM_ERROR_UNKNOWN_ENCODING,
+			     _("Unknown encoding of: %s"),
+			     rb->uri);
+		readbuf_close (rb);
+		return NULL;
+	}
+
+	/* Rewind since get_encoding goes through the file */
+	if (! readbuf_rewind (rb, error)) {
+		readbuf_close (rb);
+		/* spec says, don't read this file */
+		return NULL;
+	}
+
+	item = mate_desktop_item_new ();
+	item->modified = FALSE;
+
+	/* Note: location and mtime are filled in by the new_from_file
+	 * function since it has those values */
+
+#define OVERFLOW (next == &CharBuffer [sizeof(CharBuffer)-1])
+
+	state = FirstBrace;
+	while ((c = readbuf_getc (rb)) != EOF) {
+		if (c == '\r')		/* Ignore Carriage Return */
+			continue;
+
+		switch (state) {
+
+		case OnSecHeader:
+			if (c == ']' || OVERFLOW) {
+				*next = '\0';
+				next = CharBuffer;
+
+				/* keys were inserted in reverse */
+				if (cur_section != NULL &&
+				    cur_section->keys != NULL) {
+					cur_section->keys = g_list_reverse
+						(cur_section->keys);
+				}
+				if (strcmp (CharBuffer,
+					    "KDE Desktop Entry") == 0) {
+					/* Main section */
+					cur_section = NULL;
+					old_kde = TRUE;
+				} else if (strcmp (CharBuffer,
+						   "Desktop Entry") == 0) {
+					/* Main section */
+					cur_section = NULL;
+				} else {
+					cur_section = g_new0 (Section, 1);
+					cur_section->name =
+						g_strdup (CharBuffer);
+					cur_section->keys = NULL;
+					item->sections = g_list_prepend
+						(item->sections, cur_section);
+				}
+				state = IgnoreToEOL;
+			} else if (c == '[') {
+				/* FIXME: probably error out instead of ignoring this */
+			} else {
+				*next++ = c;
+			}
+			break;
+
+		case IgnoreToEOL:
+		case IgnoreToEOLFirst:
+			if (c == '\n'){
+				if (state == IgnoreToEOLFirst)
+					state = FirstBrace;
+				else
+					state = KeyDef;
+				next = CharBuffer;
+			}
+			break;
+
+		case FirstBrace:
+		case KeyDef:
+		case KeyDefOnKey:
+			if (c == '#') {
+				if (state == FirstBrace)
+					state = IgnoreToEOLFirst;
+				else
+					state = IgnoreToEOL;
+				break;
+			}
+
+			if (c == '[' && state != KeyDefOnKey){
+				state = OnSecHeader;
+				next = CharBuffer;
+				g_free (key);
+				key = NULL;
+				break;
+			}
+			/* On first pass, don't allow dangling keys */
+			if (state == FirstBrace)
+				break;
+
+			if ((c == ' ' && state != KeyDefOnKey) || c == '\t')
+				break;
+
+			if (c == '\n' || OVERFLOW) { /* Abort Definition */
+				next = CharBuffer;
+				state = KeyDef;
+				break;
+			}
+
+			if (c == '=' || OVERFLOW){
+				*next = '\0';
+
+				g_free (key);
+				key = g_strdup (CharBuffer);
+				state = KeyValue;
+				next = CharBuffer;
+			} else {
+				*next++ = c;
+				state = KeyDefOnKey;
+			}
+			break;
+
+		case KeyValue:
+			if (OVERFLOW || c == '\n'){
+				*next = '\0';
+
+				insert_key (item, cur_section, encoding,
+					    key, CharBuffer, old_kde,
+					    no_translations);
+
+				g_free (key);
+				key = NULL;
+
+				state = (c == '\n') ? KeyDef : IgnoreToEOL;
+				next = CharBuffer;
+			} else {
+				*next++ = c;
+			}
+			break;
+
+		} /* switch */
+
+	} /* while ((c = getc_unlocked (f)) != EOF) */
+	if (c == EOF && state == KeyValue) {
+		*next = '\0';
+
+		insert_key (item, cur_section, encoding,
+			    key, CharBuffer, old_kde,
+			    no_translations);
+
+		g_free (key);
+		key = NULL;
+	}
+
+#undef OVERFLOW
+
+	/* keys were inserted in reverse */
+	if (cur_section != NULL &&
+	    cur_section->keys != NULL) {
+		cur_section->keys = g_list_reverse (cur_section->keys);
+	}
+	/* keys were inserted in reverse */
+	item->keys = g_list_reverse (item->keys);
+	/* sections were inserted in reverse */
+	item->sections = g_list_reverse (item->sections);
+
+	/* sanitize some things */
+	sanitize (item, rb->uri);
+
+	/* make sure that we set up the type */
+	setup_type (item, rb->uri);
+
+	readbuf_close (rb);
+
+	return item;
+}
+
+static void stream_printf (GFileOutputStream *stream,
+			   const char *format, ...) G_GNUC_PRINTF (2, 3);
+
+static void
+stream_printf (GFileOutputStream *stream, const char *format, ...)
+{
+    va_list args;
+    gchar *s;
+
+    va_start (args, format);
+    s = g_strdup_vprintf (format, args);
+    va_end (args);
+
+    /* FIXME: what about errors */
+    g_output_stream_write (G_OUTPUT_STREAM (stream), s, strlen (s),
+		    	   NULL, NULL);
+    g_free (s);
+}
+
+static void
+dump_section (MateDesktopItem *item, GFileOutputStream *stream, Section *section)
+{
+	GList *li;
+
+	stream_printf (stream, "[%s]\n", section->name);
+	for (li = section->keys; li != NULL; li = li->next) {
+		const char *key = li->data;
+		char *full = g_strdup_printf ("%s/%s", section->name, key);
+		const char *value = g_hash_table_lookup (item->main_hash, full);
+		if (value != NULL) {
+			char *val = escape_string_and_dup (value);
+			stream_printf (stream, "%s=%s\n", key, val);
+			g_free (val);
+		}
+		g_free (full);
+	}
+}
+
+static gboolean
+ditem_save (MateDesktopItem *item, const char *uri, GError **error)
+{
+	GList *li;
+	GFile *file;
+	GFileOutputStream *stream;
+
+	file = g_file_new_for_uri (uri);
+	stream = g_file_replace (file, NULL, FALSE, G_FILE_CREATE_NONE,
+				 NULL, error);
+	if (stream == NULL)
+		return FALSE;
+
+	stream_printf (stream, "[Desktop Entry]\n");
+	for (li = item->keys; li != NULL; li = li->next) {
+		const char *key = li->data;
+		const char *value = g_hash_table_lookup (item->main_hash, key);
+		if (value != NULL) {
+			char *val = escape_string_and_dup (value);
+			stream_printf (stream, "%s=%s\n", key, val);
+			g_free (val);
+		}
+	}
+
+	if (item->sections != NULL)
+		stream_printf (stream, "\n");
+
+	for (li = item->sections; li != NULL; li = li->next) {
+		Section *section = li->data;
+
+		/* Don't write empty sections */
+		if (section->keys == NULL)
+			continue;
+
+		dump_section (item, stream, section);
+
+		if (li->next != NULL)
+			stream_printf (stream, "\n");
+	}
+
+	g_object_unref (stream);
+	g_object_unref (file);
+
+	return TRUE;
+}
+
+static gpointer
+_mate_desktop_item_copy (gpointer boxed)
+{
+	return mate_desktop_item_copy (boxed);
+}
+
+static void
+_mate_desktop_item_free (gpointer boxed)
+{
+	mate_desktop_item_unref (boxed);
+}
+
+GType
+mate_desktop_item_get_type (void)
+{
+	static GType type = 0;
+
+	if (type == 0) {
+		type = g_boxed_type_register_static ("MateDesktopItem",
+						     _mate_desktop_item_copy,
+						     _mate_desktop_item_free);
+	}
+
+	return type;
+}
+
+GQuark
+mate_desktop_item_error_quark (void)
+{
+	static GQuark q = 0;
+	if (q == 0)
+		q = g_quark_from_static_string ("mate-desktop-item-error-quark");
+
+	return q;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/79.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/79.html new file mode 100644 index 00000000..27f56729 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/79.html @@ -0,0 +1,2941 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
/*
+ * mate-thumbnail.c: Utilities for handling thumbnails
+ *
+ * Copyright (C) 2002 Red Hat, Inc.
+ * Copyright (C) 2010 Carlos Garcia Campos <carlosgc@gnome.org>
+ *
+ * This file is part of the Mate Library.
+ *
+ * The Mate Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Mate 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Mate Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gstdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gdk-pixbuf/gdk-pixbuf.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define MATE_DESKTOP_USE_UNSTABLE_API
+#include "mate-desktop-thumbnail.h"
+
+static void
+thumbnailers_directory_changed (GFileMonitor                 *monitor,
+                                GFile                        *file,
+                                GFile                        *other_file,
+                                GFileMonitorEvent             event_type,
+                                MateDesktopThumbnailFactory  *factory);
+
+struct _MateDesktopThumbnailFactoryPrivate {
+  MateDesktopThumbnailSize size;
+
+  GMutex lock;
+
+  GList *thumbnailers;
+  GHashTable *mime_types_map;
+  GList *monitors;
+
+  GSettings *settings;
+  gboolean loaded : 1;
+  gboolean disabled : 1;
+  gchar **disabled_types;
+};
+
+static const char *appname = "mate-thumbnail-factory";
+
+G_DEFINE_TYPE_WITH_PRIVATE (MateDesktopThumbnailFactory,<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
+                            mate_desktop_thumbnail_factory,
+                            G_TYPE_OBJECT)
+
+#define parent_class mate_desktop_thumbnail_factory_parent_class
+
+#define THUMBNAILER_ENTRY_GROUP "Thumbnailer Entry"
+#define THUMBNAILER_EXTENSION   ".thumbnailer"
+
+typedef struct {
+    volatile gint ref_count;
+    gchar  *path;
+    gchar  *try_exec;
+    gchar  *command;
+    gchar **mime_types;
+} Thumbnailer;
+
+static Thumbnailer *
+thumbnailer_ref (Thumbnailer *thumb)
+{
+  g_return_val_if_fail (thumb != NULL, NULL);
+  g_return_val_if_fail (thumb->ref_count > 0, NULL);
+
+  g_atomic_int_inc (&thumb->ref_count);
+  return thumb;
+}
+
+static void
+thumbnailer_unref (Thumbnailer *thumb)
+{
+  g_return_if_fail (thumb != NULL);
+  g_return_if_fail (thumb->ref_count > 0);
+
+  if (g_atomic_int_dec_and_test (&thumb->ref_count))
+    {
+      g_free (thumb->path);
+      g_free (thumb->try_exec);
+      g_free (thumb->command);
+      g_strfreev (thumb->mime_types);
+      g_slice_free (Thumbnailer, thumb);
+    }
+}
+
+static Thumbnailer *
+thumbnailer_load (Thumbnailer *thumb)
+{
+  GKeyFile *key_file;
+  GError *error = NULL;
+
+  key_file = g_key_file_new ();
+  if (!g_key_file_load_from_file (key_file, thumb->path, 0, &error))
+    {
+      g_warning ("Failed to load thumbnailer from \"%s\": %s\n", thumb->path, error->message);
+      g_error_free (error);
+      thumbnailer_unref (thumb);
+      g_key_file_free (key_file);
+
+      return NULL;
+    }
+
+  if (!g_key_file_has_group (key_file, THUMBNAILER_ENTRY_GROUP))
+    {
+      g_warning ("Invalid thumbnailer: missing group \"%s\"\n", THUMBNAILER_ENTRY_GROUP);
+      thumbnailer_unref (thumb);
+      g_key_file_free (key_file);
+
+      return NULL;
+    }
+
+  thumb->command = g_key_file_get_string (key_file, THUMBNAILER_ENTRY_GROUP, "Exec", NULL);
+  if (!thumb->command)
+    {
+      g_warning ("Invalid thumbnailer: missing Exec key\n");
+      thumbnailer_unref (thumb);
+      g_key_file_free (key_file);
+
+      return NULL;
+    }
+
+  thumb->mime_types = g_key_file_get_string_list (key_file, THUMBNAILER_ENTRY_GROUP, "MimeType", NULL, NULL);
+  if (!thumb->mime_types)
+    {
+      g_warning ("Invalid thumbnailer: missing MimeType key\n");
+      thumbnailer_unref (thumb);
+      g_key_file_free (key_file);
+
+      return NULL;
+    }
+
+  thumb->try_exec = g_key_file_get_string (key_file, THUMBNAILER_ENTRY_GROUP, "TryExec", NULL);
+
+  g_key_file_free (key_file);
+
+  return thumb;
+}
+
+static Thumbnailer *
+thumbnailer_reload (Thumbnailer *thumb)
+{
+  g_return_val_if_fail (thumb != NULL, NULL);
+
+  g_free (thumb->command);
+  thumb->command = NULL;
+  g_strfreev (thumb->mime_types);
+  thumb->mime_types = NULL;
+  g_free (thumb->try_exec);
+  thumb->try_exec = NULL;
+
+  return thumbnailer_load (thumb);
+}
+
+static Thumbnailer *
+thumbnailer_new (const gchar *path)
+{
+  Thumbnailer *thumb;
+
+  thumb = g_slice_new0 (Thumbnailer);
+  thumb->ref_count = 1;
+  thumb->path = g_strdup (path);
+
+  return thumbnailer_load (thumb);
+}
+
+static gboolean
+thumbnailer_try_exec (Thumbnailer *thumb)
+{
+  gchar *path;
+  gboolean retval;
+
+  if (G_UNLIKELY (!thumb))
+    return FALSE;
+
+  /* TryExec is optional, but Exec isn't, so we assume
+   * the thumbnailer can be run when TryExec is not present
+   */
+  if (!thumb->try_exec)
+    return TRUE;
+
+  path = g_find_program_in_path (thumb->try_exec);
+  retval = path != NULL;
+  g_free (path);
+
+  return retval;
+}
+
+static gpointer
+init_thumbnailers_dirs (gpointer data)
+{
+  const gchar * const *data_dirs;
+  GPtrArray *thumbs_dirs;
+  guint i;
+
+  data_dirs = g_get_system_data_dirs ();
+  thumbs_dirs = g_ptr_array_new ();
+
+  g_ptr_array_add (thumbs_dirs, g_build_filename (g_get_user_data_dir (), "thumbnailers", NULL));
+  for (i = 0; data_dirs[i] != NULL; i++)
+    g_ptr_array_add (thumbs_dirs, g_build_filename (data_dirs[i], "thumbnailers", NULL));
+  g_ptr_array_add (thumbs_dirs, NULL);
+
+  return g_ptr_array_free (thumbs_dirs, FALSE);
+}
+
+static const gchar * const *
+get_thumbnailers_dirs (void)
+{
+  static GOnce once_init = G_ONCE_INIT;
+  return g_once (&once_init, init_thumbnailers_dirs, NULL);
+}
+
+/* These should be called with the lock held */
+static void
+mate_desktop_thumbnail_factory_register_mime_types (MateDesktopThumbnailFactory *factory,
+                                                     Thumbnailer                  *thumb)
+{
+  MateDesktopThumbnailFactoryPrivate *priv = factory->priv;
+  gint i;
+
+  for (i = 0; thumb->mime_types[i]; i++)
+    {
+      if (!g_hash_table_lookup (priv->mime_types_map, thumb->mime_types[i]))
+        g_hash_table_insert (priv->mime_types_map,
+                             g_strdup (thumb->mime_types[i]),
+                             thumbnailer_ref (thumb));
+    }
+}
+
+static void
+mate_desktop_thumbnail_factory_add_thumbnailer (MateDesktopThumbnailFactory *factory,
+                                                 Thumbnailer                  *thumb)
+{
+  MateDesktopThumbnailFactoryPrivate *priv = factory->priv;
+
+  mate_desktop_thumbnail_factory_register_mime_types (factory, thumb);
+  priv->thumbnailers = g_list_prepend (priv->thumbnailers, thumb);
+}
+
+static gboolean
+mate_desktop_thumbnail_factory_is_disabled (MateDesktopThumbnailFactory *factory,
+                                             const gchar                  *mime_type)
+{
+  MateDesktopThumbnailFactoryPrivate *priv = factory->priv;
+  guint i;
+
+  if (priv->disabled)
+    return TRUE;
+
+  if (!priv->disabled_types)
+    return FALSE;
+
+  for (i = 0; priv->disabled_types[i]; i++)
+    {
+      if (g_strcmp0 (priv->disabled_types[i], mime_type) == 0)
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
+static gboolean
+remove_thumbnailer_from_mime_type_map (gchar       *key,
+                                       Thumbnailer *value,
+                                       gchar       *path)
+{
+  return (strcmp (value->path, path) == 0);
+}
+
+static void
+update_or_create_thumbnailer (MateDesktopThumbnailFactory *factory,
+                              const gchar                 *path)
+{
+  MateDesktopThumbnailFactoryPrivate *priv = factory->priv;
+  GList *l;
+  Thumbnailer *thumb;
+  gboolean found = FALSE;
+
+  g_mutex_lock (&priv->lock);
+
+  for (l = priv->thumbnailers; l && !found; l = g_list_next (l))
+    {
+      thumb = (Thumbnailer *)l->data;
+
+      if (strcmp (thumb->path, path) == 0)
+        {
+          found = TRUE;
+
+          /* First remove the mime_types associated to this thumbnailer */
+          g_hash_table_foreach_remove (priv->mime_types_map,
+                                       (GHRFunc)remove_thumbnailer_from_mime_type_map,
+                                       (gpointer)path);
+          if (!thumbnailer_reload (thumb))
+              priv->thumbnailers = g_list_delete_link (priv->thumbnailers, l);
+          else
+              mate_desktop_thumbnail_factory_register_mime_types (factory, thumb);
+        }
+    }
+
+  if (!found)
+    {
+      thumb = thumbnailer_new (path);
+      if (thumb)
+        mate_desktop_thumbnail_factory_add_thumbnailer (factory, thumb);
+    }
+
+  g_mutex_unlock (&priv->lock);
+}
+
+static void
+remove_thumbnailer (MateDesktopThumbnailFactory *factory,
+                    const gchar                 *path)
+{
+  MateDesktopThumbnailFactoryPrivate *priv = factory->priv;
+  GList *l;
+  Thumbnailer *thumb;
+
+  g_mutex_lock (&priv->lock);
+
+  for (l = priv->thumbnailers; l; l = g_list_next (l))
+    {
+      thumb = (Thumbnailer *)l->data;
+
+      if (strcmp (thumb->path, path) == 0)
+        {
+          priv->thumbnailers = g_list_delete_link (priv->thumbnailers, l);
+          g_hash_table_foreach_remove (priv->mime_types_map,
+                                       (GHRFunc)remove_thumbnailer_from_mime_type_map,
+                                       (gpointer)path);
+          thumbnailer_unref (thumb);
+
+          break;
+        }
+    }
+
+  g_mutex_unlock (&priv->lock);
+}
+
+static void
+remove_thumbnailers_for_dir (MateDesktopThumbnailFactory *factory,
+                             const gchar                 *thumbnailer_dir,
+                             GFileMonitor                *monitor)
+{
+  MateDesktopThumbnailFactoryPrivate *priv = factory->priv;
+  GList *l;
+  Thumbnailer *thumb;
+
+  g_mutex_lock (&priv->lock);
+
+  /* Remove all the thumbnailers inside this @thumbnailer_dir. */
+  for (l = priv->thumbnailers; l; l = g_list_next (l))
+    {
+      thumb = (Thumbnailer *)l->data;
+
+      if (g_str_has_prefix (thumb->path, thumbnailer_dir) == TRUE)
+        {
+          priv->thumbnailers = g_list_delete_link (priv->thumbnailers, l);
+          g_hash_table_foreach_remove (priv->mime_types_map,
+                                       (GHRFunc)remove_thumbnailer_from_mime_type_map,
+                                       (gpointer)thumb->path);
+          thumbnailer_unref (thumb);
+
+          break;
+        }
+    }
+
+  /* Remove the monitor for @thumbnailer_dir. */
+  priv->monitors = g_list_remove (priv->monitors, monitor);
+  g_signal_handlers_disconnect_by_func (monitor, thumbnailers_directory_changed, factory);
+
+  g_mutex_unlock (&priv->lock);
+}
+
+static void
+mate_desktop_thumbnail_factory_load_thumbnailers_for_dir (MateDesktopThumbnailFactory *factory,
+                                                          const gchar                 *path)
+{
+  MateDesktopThumbnailFactoryPrivate *priv = factory->priv;
+  GDir *dir;
+  GFile *dir_file;
+  GFileMonitor *monitor;
+  const gchar *dirent;
+
+  dir = g_dir_open (path, 0, NULL);
+  if (!dir)
+      return;
+
+  /* Monitor dir */
+  dir_file = g_file_new_for_path (path);
+  monitor = g_file_monitor_directory (dir_file,
+                                      G_FILE_MONITOR_NONE,
+                                      NULL, NULL);
+  if (monitor)
+    {
+      g_signal_connect (monitor, "changed",
+                        G_CALLBACK (thumbnailers_directory_changed),
+                        factory);
+      priv->monitors = g_list_prepend (priv->monitors, monitor);
+    }
+  g_object_unref (dir_file);
+
+  while ((dirent = g_dir_read_name (dir)))
+    {
+      Thumbnailer *thumb;
+      gchar       *filename;
+
+      if (!g_str_has_suffix (dirent, THUMBNAILER_EXTENSION))
+          continue;
+
+      filename = g_build_filename (path, dirent, NULL);
+      thumb = thumbnailer_new (filename);
+      g_free (filename);
+
+      if (thumb)
+          mate_desktop_thumbnail_factory_add_thumbnailer (factory, thumb);
+    }
+
+  g_dir_close (dir);
+}
+
+static void
+thumbnailers_directory_changed (GFileMonitor                *monitor,
+                                GFile                       *file,
+                                GFile                       *other_file,
+                                GFileMonitorEvent            event_type,
+                                MateDesktopThumbnailFactory *factory)
+{
+  gchar *path;
+
+  switch (event_type)
+    {
+    case G_FILE_MONITOR_EVENT_CREATED:
+    case G_FILE_MONITOR_EVENT_CHANGED:
+    case G_FILE_MONITOR_EVENT_DELETED:
+      path = g_file_get_path (file);
+      if (!g_str_has_suffix (path, THUMBNAILER_EXTENSION))
+        {
+          g_free (path);
+          return;
+        }
+
+      if (event_type == G_FILE_MONITOR_EVENT_DELETED)
+        remove_thumbnailer (factory, path);
+      else
+        update_or_create_thumbnailer (factory, path);
+
+      g_free (path);
+      break;
+    case G_FILE_MONITOR_EVENT_UNMOUNTED:
+    case G_FILE_MONITOR_EVENT_MOVED:
+      path = g_file_get_path (file);
+      remove_thumbnailers_for_dir (factory, path, monitor);
+
+      if (event_type == G_FILE_MONITOR_EVENT_MOVED)
+          mate_desktop_thumbnail_factory_load_thumbnailers_for_dir (factory, path);
+
+      g_free (path);
+      break;
+    case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
+    case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
+    case G_FILE_MONITOR_EVENT_PRE_UNMOUNT:
+    default:
+      break;
+    }
+}
+
+static void
+mate_desktop_thumbnail_factory_load_thumbnailers (MateDesktopThumbnailFactory *factory)
+{
+  MateDesktopThumbnailFactoryPrivate *priv = factory->priv;
+  const gchar * const *dirs;
+  guint i;
+
+  if (priv->loaded)
+    return;
+
+  dirs = get_thumbnailers_dirs ();
+  for (i = 0; dirs[i]; i++)
+    {
+      mate_desktop_thumbnail_factory_load_thumbnailers_for_dir (factory, dirs[i]);
+    }
+
+  priv->loaded = TRUE;
+}
+
+static void
+external_thumbnailers_disabled_all_changed_cb (GSettings                   *settings,
+                                               const gchar                 *key,
+                                               MateDesktopThumbnailFactory *factory)
+{
+  MateDesktopThumbnailFactoryPrivate *priv = factory->priv;
+
+  g_mutex_lock (&priv->lock);
+
+  priv->disabled = g_settings_get_boolean (priv->settings, "disable-all");
+  if (priv->disabled)
+    {
+      g_strfreev (priv->disabled_types);
+      priv->disabled_types = NULL;
+    }
+  else
+    {
+      priv->disabled_types = g_settings_get_strv (priv->settings, "disable");
+      mate_desktop_thumbnail_factory_load_thumbnailers (factory);
+    }
+
+  g_mutex_unlock (&priv->lock);
+}
+
+static void
+external_thumbnailers_disabled_changed_cb (GSettings                   *settings,
+                                           const gchar                 *key,
+                                           MateDesktopThumbnailFactory *factory)
+{
+  MateDesktopThumbnailFactoryPrivate *priv = factory->priv;
+
+  g_mutex_lock (&priv->lock);
+
+  if (!priv->disabled)
+    {
+      g_strfreev (priv->disabled_types);
+      priv->disabled_types = g_settings_get_strv (priv->settings, "disable");
+    }
+
+  g_mutex_unlock (&priv->lock);
+}
+
+static void
+mate_desktop_thumbnail_factory_init (MateDesktopThumbnailFactory *factory)
+{
+  MateDesktopThumbnailFactoryPrivate *priv;
+
+  factory->priv = mate_desktop_thumbnail_factory_get_instance_private (factory);
+
+  priv = factory->priv;
+
+  priv->size = MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL;
+
+  priv->mime_types_map = g_hash_table_new_full (g_str_hash,
+                                                g_str_equal,
+                                                (GDestroyNotify)g_free,
+                                                (GDestroyNotify)thumbnailer_unref);
+
+  g_mutex_init (&priv->lock);
+
+  priv->settings = g_settings_new ("org.mate.thumbnailers");
+
+  g_signal_connect (priv->settings, "changed::disable-all",
+                    G_CALLBACK (external_thumbnailers_disabled_all_changed_cb),
+                    factory);
+  g_signal_connect (priv->settings, "changed::disable",
+                    G_CALLBACK (external_thumbnailers_disabled_changed_cb),
+                    factory);
+
+  priv->disabled = g_settings_get_boolean (priv->settings, "disable-all");
+
+  if (!priv->disabled)
+    priv->disabled_types = g_settings_get_strv (priv->settings, "disable");
+
+  if (!priv->disabled)
+    mate_desktop_thumbnail_factory_load_thumbnailers (factory);
+}
+
+static void
+mate_desktop_thumbnail_factory_finalize (GObject *object)
+{
+  MateDesktopThumbnailFactory *factory;
+  MateDesktopThumbnailFactoryPrivate *priv;
+
+  factory = MATE_DESKTOP_THUMBNAIL_FACTORY (object);
+
+  priv = factory->priv;
+
+  if (priv->thumbnailers)
+    {
+      g_list_free_full (priv->thumbnailers, (GDestroyNotify)thumbnailer_unref);
+      priv->thumbnailers = NULL;
+    }
+
+  g_clear_pointer (&priv->mime_types_map, g_hash_table_destroy);
+
+  if (priv->monitors)
+    {
+      g_list_free_full (priv->monitors, (GDestroyNotify)g_object_unref);
+      priv->monitors = NULL;
+    }
+
+  g_mutex_clear (&priv->lock);
+
+  g_clear_pointer (&priv->disabled_types, g_strfreev);
+
+  if (priv->settings)
+    {
+      g_signal_handlers_disconnect_by_func (priv->settings,
+                                            external_thumbnailers_disabled_all_changed_cb,
+                                            factory);
+      g_signal_handlers_disconnect_by_func (priv->settings,
+                                            external_thumbnailers_disabled_changed_cb,
+                                            factory);
+      g_clear_object (&priv->settings);
+    }
+
+  if (G_OBJECT_CLASS (parent_class)->finalize)
+    (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+}
+
+static void
+mate_desktop_thumbnail_factory_class_init (MateDesktopThumbnailFactoryClass *class)
+{
+  GObjectClass *gobject_class;
+
+  gobject_class = G_OBJECT_CLASS (class);
+
+  gobject_class->finalize = mate_desktop_thumbnail_factory_finalize;
+}
+
+/**
+ * mate_desktop_thumbnail_factory_new:
+ * @size: The thumbnail size to use
+ *
+ * Creates a new #MateDesktopThumbnailFactory.
+ *
+ * This function must be called on the main thread.
+ *
+ * Return value: a new #MateDesktopThumbnailFactory
+ *
+ * Since: 2.2
+ **/
+MateDesktopThumbnailFactory *
+mate_desktop_thumbnail_factory_new (MateDesktopThumbnailSize size)
+{
+  MateDesktopThumbnailFactory *factory;
+
+  factory = g_object_new (MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, NULL);
+
+  factory->priv->size = size;
+
+  return factory;
+}
+
+static char *
+thumbnail_filename (const char *uri)
+{
+  GChecksum *checksum;
+  guint8 digest[16];
+  gsize digest_len = sizeof (digest);
+  char *file;
+
+  checksum = g_checksum_new (G_CHECKSUM_MD5);
+  g_checksum_update (checksum, (const guchar *) uri, strlen (uri));
+
+  g_checksum_get_digest (checksum, digest, &digest_len);
+  g_assert (digest_len == 16);
+
+  file = g_strconcat (g_checksum_get_string (checksum), ".png", NULL);
+
+  g_checksum_free (checksum);
+
+  return file;
+}
+
+static char *
+thumbnail_path (const char               *uri,
+                MateDesktopThumbnailSize  size)
+{
+  char *path, *file;
+
+  file = thumbnail_filename (uri);
+  path = g_build_filename (g_get_user_cache_dir (),
+                           "thumbnails",
+                           size == MATE_DESKTOP_THUMBNAIL_SIZE_LARGE ? "large" : "normal",
+                           file,
+                           NULL);
+  g_free (file);
+  return path;
+}
+
+static char *
+thumbnail_failed_path (const char *uri)
+{
+  char *path, *file;
+
+  file = thumbnail_filename (uri);
+  /* XXX: appname is only used for failed thumbnails. Is this a mistake? */
+  path = g_build_filename (g_get_user_cache_dir (),
+                           "thumbnails",
+                           "fail",
+                           appname,
+                           file,
+                           NULL);
+  g_free (file);
+  return path;
+}
+
+static char *
+validate_thumbnail_path (char                     *path,
+                         const char               *uri,
+                         time_t                    mtime,
+                         MateDesktopThumbnailSize  size)
+{
+  GdkPixbuf *pixbuf;
+
+  pixbuf = gdk_pixbuf_new_from_file (path, NULL);
+  if (pixbuf == NULL ||
+      !mate_desktop_thumbnail_is_valid (pixbuf, uri, mtime)) {
+      g_free (path);
+      return NULL;
+  }
+
+  g_clear_object (&pixbuf);
+
+  return path;
+}
+
+static char *
+lookup_thumbnail_path (const char               *uri,
+                       time_t                    mtime,
+                       MateDesktopThumbnailSize  size)
+{
+  char *path = thumbnail_path (uri, size);
+  return validate_thumbnail_path (path, uri, mtime, size);
+}
+
+static char *
+lookup_failed_thumbnail_path (const char               *uri,
+                              time_t                    mtime,
+                              MateDesktopThumbnailSize  size)
+{
+  char *path = thumbnail_failed_path (uri);
+  return validate_thumbnail_path (path, uri, mtime, size);
+}
+
+/**
+ * mate_desktop_thumbnail_factory_lookup:
+ * @factory: a #MateDesktopThumbnailFactory
+ * @uri: the uri of a file
+ * @mtime: the mtime of the file
+ *
+ * Tries to locate an existing thumbnail for the file specified.
+ *
+ * Usage of this function is threadsafe.
+ *
+ * Return value: (transfer full): The absolute path of the thumbnail, or %NULL if none exist.
+ *
+ * Since: 2.2
+ **/
+char *
+mate_desktop_thumbnail_factory_lookup (MateDesktopThumbnailFactory *factory,
+                                       const char                  *uri,
+                                       time_t                       mtime)
+{
+  MateDesktopThumbnailFactoryPrivate *priv = factory->priv;
+
+  g_return_val_if_fail (uri != NULL, NULL);
+
+  return lookup_thumbnail_path (uri, mtime, priv->size);
+}
+
+/**
+ * mate_desktop_thumbnail_factory_has_valid_failed_thumbnail:
+ * @factory: a #MateDesktopThumbnailFactory
+ * @uri: the uri of a file
+ * @mtime: the mtime of the file
+ *
+ * Tries to locate an failed thumbnail for the file specified. Writing
+ * and looking for failed thumbnails is important to avoid to try to
+ * thumbnail e.g. broken images several times.
+ *
+ * Usage of this function is threadsafe.
+ *
+ * Return value: TRUE if there is a failed thumbnail for the file.
+ *
+ * Since: 2.2
+ **/
+gboolean
+mate_desktop_thumbnail_factory_has_valid_failed_thumbnail (MateDesktopThumbnailFactory *factory,
+                                                           const char                  *uri,
+                                                           time_t                       mtime)
+{
+  char *path;
+
+  g_return_val_if_fail (uri != NULL, FALSE);
+
+  path = lookup_failed_thumbnail_path (uri, mtime, factory->priv->size);
+  if (path == NULL)
+    return FALSE;
+
+  g_free (path);
+
+  return TRUE;
+}
+
+/**
+ * mate_desktop_thumbnail_factory_can_thumbnail:
+ * @factory: a #MateDesktopThumbnailFactory
+ * @uri: the uri of a file
+ * @mime_type: the mime type of the file
+ * @mtime: the mtime of the file
+ *
+ * Returns TRUE if this MateDesktopThumbnailFactory can (at least try) to thumbnail
+ * this file. Thumbnails or files with failed thumbnails won't be thumbnailed.
+ *
+ * Usage of this function is threadsafe.
+ *
+ * Return value: TRUE if the file can be thumbnailed.
+ *
+ * Since: 2.2
+ **/
+gboolean
+mate_desktop_thumbnail_factory_can_thumbnail (MateDesktopThumbnailFactory *factory,
+                                              const char                  *uri,
+                                              const char                  *mime_type,
+                                              time_t                       mtime)
+{
+  gboolean have_script = FALSE;
+
+  /* Don't thumbnail thumbnails */
+  if (uri &&
+      strncmp (uri, "file:/", 6) == 0 &&
+      (strstr (uri, "/.thumbnails/") != NULL ||
+      strstr (uri, "/.cache/thumbnails/") != NULL))
+    return FALSE;
+
+  if (!mime_type)
+    return FALSE;
+
+  g_mutex_lock (&factory->priv->lock);
+  if (!mate_desktop_thumbnail_factory_is_disabled (factory, mime_type))
+    {
+      Thumbnailer *thumb;
+
+      thumb = g_hash_table_lookup (factory->priv->mime_types_map, mime_type);
+      have_script = thumbnailer_try_exec (thumb);
+    }
+  g_mutex_unlock (&factory->priv->lock);
+
+  if (uri && (have_script ))
+    {
+      return !mate_desktop_thumbnail_factory_has_valid_failed_thumbnail (factory,
+                                                                         uri,
+                                                                         mtime);
+    }
+
+  return FALSE;
+}
+
+static char *
+expand_thumbnailing_elem (const char *elem,
+                          const int   size,
+                          const char *inuri,
+                          const char *outfile,
+                          gboolean   *got_input,
+                          gboolean   *got_output)
+{
+  GString *str;
+  const char *p, *last;
+  char *localfile;
+
+  str = g_string_new (NULL);
+
+  last = elem;
+  while ((p = strchr (last, '%')) != NULL)
+    {
+      g_string_append_len (str, last, p - last);
+      p++;
+
+      switch (*p) {
+      case 'u':
+       g_string_append (str, inuri);
+       *got_input = TRUE;
+       p++;
+       break;
+      case 'i':
+       localfile = g_filename_from_uri (inuri, NULL, NULL);
+       if (localfile)
+         {
+           g_string_append (str, localfile);
+           *got_input = TRUE;
+           g_free (localfile);
+         }
+       p++;
+       break;
+      case 'o':
+       g_string_append (str, outfile);
+       *got_output = TRUE;
+       p++;
+       break;
+      case 's':
+       g_string_append_printf (str, "%d", size);
+       p++;
+       break;
+      case '%':
+       g_string_append_c (str, '%');
+       p++;
+       break;
+      case 0:
+      default:
+        break;
+      }
+      last = p;
+    }
+  g_string_append (str, last);
+
+  return g_string_free (str, FALSE);
+}
+
+static char **
+expand_thumbnailing_script (const char  *script,
+                            const int    size,
+                            const char  *inuri,
+                            const char  *outfile,
+                            GError     **error)
+{
+  GPtrArray *array;
+  char **script_elems;
+  guint i;
+  gboolean got_in, got_out;
+
+  if (!g_shell_parse_argv (script, NULL, &script_elems, error))
+    return NULL;
+
+  array = g_ptr_array_new_with_free_func (g_free);
+
+  got_in = got_out = FALSE;
+  for (i = 0; script_elems[i] != NULL; i++)
+    {
+      char *expanded;
+
+      expanded = expand_thumbnailing_elem (script_elems[i],
+                                           size,
+                                           inuri,
+                                           outfile,
+                                           &got_in,
+                                           &got_out);
+
+      g_ptr_array_add (array, expanded);
+    }
+  g_strfreev (script_elems);
+
+  if (!got_in)
+    {
+      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                           "Input file could not be set");
+      goto bail;
+    }
+  else if (!got_out)
+    {
+      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                           "Output file could not be set");
+      goto bail;
+    }
+
+  g_ptr_array_add (array, NULL);
+
+  return (char **) g_ptr_array_free (array, FALSE);
+
+bail:
+  g_ptr_array_free (array, TRUE);
+  return NULL;
+}
+
+static GdkPixbuf *
+get_preview_thumbnail (const char *uri,
+                       int         size)
+{
+    GdkPixbuf *pixbuf;
+    GFile *file;
+    GFileInfo *file_info;
+    GInputStream *input_stream;
+    GObject *object;
+
+    g_return_val_if_fail (uri != NULL, NULL);
+
+    input_stream = NULL;
+
+    file = g_file_new_for_uri (uri);
+
+    /* First see if we can get an input stream via preview::icon  */
+    file_info = g_file_query_info (file,
+                                   G_FILE_ATTRIBUTE_PREVIEW_ICON,
+                                   G_FILE_QUERY_INFO_NONE,
+                                   NULL,  /* GCancellable */
+                                   NULL); /* return location for GError */
+    g_object_unref (file);
+
+    if (file_info == NULL)
+      return NULL;
+
+    object = g_file_info_get_attribute_object (file_info,
+                                               G_FILE_ATTRIBUTE_PREVIEW_ICON);
+    if (object)
+        g_object_ref (object);
+    g_object_unref (file_info);
+
+    if (!object)
+      return NULL;
+    if (!G_IS_LOADABLE_ICON (object)) {
+      g_object_unref (object);
+      return NULL;
+    }
+
+    input_stream = g_loadable_icon_load (G_LOADABLE_ICON (object),
+                                         0,     /* size */
+                                         NULL,  /* return location for type */
+                                         NULL,  /* GCancellable */
+                                         NULL); /* return location for GError */
+    g_object_unref (object);
+
+    if (!input_stream)
+      return NULL;
+
+    pixbuf = gdk_pixbuf_new_from_stream_at_scale (input_stream,
+                                                  size, size,
+                                                  TRUE, NULL, NULL);
+    g_object_unref (input_stream);
+
+    return pixbuf;
+}
+
+/**
+ * mate_desktop_thumbnail_factory_generate_thumbnail:
+ * @factory: a #MateDesktopThumbnailFactory
+ * @uri: the uri of a file
+ * @mime_type: the mime type of the file
+ *
+ * Tries to generate a thumbnail for the specified file. If it succeeds
+ * it returns a pixbuf that can be used as a thumbnail.
+ *
+ * Usage of this function is threadsafe.
+ *
+ * Return value: (transfer full): thumbnail pixbuf if thumbnailing succeeded, %NULL otherwise.
+ *
+ * Since: 2.2
+ **/
+GdkPixbuf *
+mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory *factory,
+                                                   const char                  *uri,
+                                                   const char                  *mime_type)
+{
+  GdkPixbuf *pixbuf;
+  char *script;
+  int size;
+  int exit_status;
+  char *tmpname;
+
+  g_return_val_if_fail (uri != NULL, NULL);
+  g_return_val_if_fail (mime_type != NULL, NULL);
+
+  /* Doesn't access any volatile fields in factory, so it's threadsafe */
+
+  size = 128;
+  if (factory->priv->size == MATE_DESKTOP_THUMBNAIL_SIZE_LARGE)
+    size = 256;
+
+  pixbuf = NULL;
+
+  pixbuf = get_preview_thumbnail (uri, size);
+  if (pixbuf != NULL)
+    return pixbuf;
+
+  script = NULL;
+  g_mutex_lock (&factory->priv->lock);
+  if (!mate_desktop_thumbnail_factory_is_disabled (factory, mime_type))
+    {
+      Thumbnailer *thumb;
+
+      thumb = g_hash_table_lookup (factory->priv->mime_types_map, mime_type);
+      if (thumb)
+        script = g_strdup (thumb->command);
+    }
+  g_mutex_unlock (&factory->priv->lock);
+
+  if (script)
+    {
+      int fd;
+
+      fd = g_file_open_tmp (".mate_desktop_thumbnail.XXXXXX", &tmpname, NULL);
+
+      if (fd != -1)
+    {
+      char **expanded_script;
+      GError *error = NULL;
+
+      close (fd);
+
+      expanded_script = expand_thumbnailing_script (script, size, uri, tmpname, &error);
+      if (expanded_script == NULL)
+        {
+          g_warning ("Failed to expand script '%s': %s", script, error->message);
+          g_error_free (error);
+        }
+      else
+        {
+          gboolean ret;
+
+          ret = g_spawn_sync (NULL, expanded_script, NULL, G_SPAWN_SEARCH_PATH,
+                              NULL, NULL, NULL, NULL, &exit_status, NULL);
+          if (ret && exit_status == 0)
+            pixbuf = gdk_pixbuf_new_from_file (tmpname, NULL);
+
+          g_strfreev (expanded_script);
+        }
+
+      g_unlink (tmpname);
+      g_free (tmpname);
+    }
+
+      g_free (script);
+    }
+
+  return pixbuf;
+}
+
+static gboolean
+save_thumbnail (GdkPixbuf  *pixbuf,
+                char       *path,
+                const char *uri,
+                time_t      mtime)
+{
+  char *dirname;
+  char *tmp_path = NULL;
+  int tmp_fd;
+  gchar *mtime_str;
+  gboolean ret = FALSE;
+  GError *error = NULL;
+  const char *width, *height;
+
+  if (pixbuf == NULL)
+    return FALSE;
+
+  dirname = g_path_get_dirname (path);
+
+  if (g_mkdir_with_parents (dirname, 0700) != 0)
+
+    goto out;
+
+  tmp_path = g_strconcat (path, ".XXXXXX", NULL);
+  tmp_fd = g_mkstemp (tmp_path);
+
+  if (tmp_fd == -1)
+    goto out;
+  close (tmp_fd);
+
+  mtime_str = g_strdup_printf ("%" G_GINT64_FORMAT,  (gint64) mtime);
+  width = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Width");
+  height = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Height");
+
+  error = NULL;
+  if (width != NULL && height != NULL)
+    ret = gdk_pixbuf_save (pixbuf,
+                           tmp_path,
+                           "png", &error,
+                           "tEXt::Thumb::Image::Width", width,
+                           "tEXt::Thumb::Image::Height", height,
+                           "tEXt::Thumb::URI", uri,
+                           "tEXt::Thumb::MTime", mtime_str,
+                           "tEXt::Software", "MATE::ThumbnailFactory",
+                           NULL);
+  else
+    ret = gdk_pixbuf_save (pixbuf,
+                           tmp_path,
+                           "png", &error,
+                           "tEXt::Thumb::URI", uri,
+                           "tEXt::Thumb::MTime", mtime_str,
+                           "tEXt::Software", "MATE::ThumbnailFactory",
+                           NULL);
+  g_free (mtime_str);
+
+  if (!ret)
+    goto out;
+
+  g_chmod (tmp_path, 0600);
+  g_rename (tmp_path, path);
+
+ out:
+  if (error != NULL)
+    {
+      g_warning ("Failed to create thumbnail %s: %s", tmp_path, error->message);
+      g_error_free (error);
+    }
+  g_unlink (tmp_path);
+  g_free (tmp_path);
+  g_free (dirname);
+  return ret;
+}
+
+static GdkPixbuf *
+make_failed_thumbnail (void)
+{
+  GdkPixbuf *pixbuf;
+
+  pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, 1, 1);
+  gdk_pixbuf_fill (pixbuf, 0x00000000);
+  return pixbuf;
+}
+
+/**
+ * mate_desktop_thumbnail_factory_save_thumbnail:
+ * @factory: a #MateDesktopThumbnailFactory
+ * @thumbnail: the thumbnail as a pixbuf
+ * @uri: the uri of a file
+ * @original_mtime: the modification time of the original file
+ *
+ * Saves @thumbnail at the right place. If the save fails a
+ * failed thumbnail is written.
+ *
+ * Usage of this function is threadsafe.
+ *
+ * Since: 2.2
+ **/
+void
+mate_desktop_thumbnail_factory_save_thumbnail (MateDesktopThumbnailFactory *factory,
+                                               GdkPixbuf                   *thumbnail,
+                                               const char                  *uri,
+                                               time_t                       original_mtime)
+{
+  char *path;
+
+  path = thumbnail_path (uri, factory->priv->size);
+  if (!save_thumbnail (thumbnail, path, uri, original_mtime))
+    {
+      thumbnail = make_failed_thumbnail ();
+      g_free (path);
+      path = thumbnail_failed_path (uri);
+      save_thumbnail (thumbnail, path, uri, original_mtime);
+      g_object_unref (thumbnail);
+    }
+  g_free (path);
+}
+
+/**
+ * mate_desktop_thumbnail_factory_create_failed_thumbnail:
+ * @factory: a #MateDesktopThumbnailFactory
+ * @uri: the uri of a file
+ * @mtime: the modification time of the file
+ *
+ * Creates a failed thumbnail for the file so that we don't try
+ * to re-thumbnail the file later.
+ *
+ * Usage of this function is threadsafe.
+ *
+ * Since: 2.2
+ **/
+void
+mate_desktop_thumbnail_factory_create_failed_thumbnail (MateDesktopThumbnailFactory *factory,
+                                                        const char                  *uri,
+                                                        time_t                      mtime)
+{
+  char *path;
+  GdkPixbuf *pixbuf;
+
+  path = thumbnail_failed_path (uri);
+  pixbuf = make_failed_thumbnail ();
+  save_thumbnail (pixbuf, path, uri, mtime);
+
+  g_free (path);
+  g_object_unref (pixbuf);
+}
+
+/**
+ * mate_desktop_thumbnail_path_for_uri:
+ * @uri: an uri
+ * @size: a thumbnail size
+ *
+ * Returns the filename that a thumbnail of size @size for @uri would have.
+ *
+ * Return value: an absolute filename
+ *
+ * Since: 2.2
+ **/
+char *
+mate_desktop_thumbnail_path_for_uri (const char               *uri,
+                                     MateDesktopThumbnailSize  size)
+{
+  return thumbnail_path (uri, size);
+}
+
+/**
+ * mate_desktop_thumbnail_has_uri:
+ * @pixbuf: an loaded thumbnail pixbuf
+ * @uri: a uri
+ *
+ * Returns whether the thumbnail has the correct uri embedded in the
+ * Thumb::URI option in the png.
+ *
+ * Return value: TRUE if the thumbnail is for @uri
+ *
+ * Since: 2.2
+ **/
+gboolean
+mate_desktop_thumbnail_has_uri (GdkPixbuf          *pixbuf,
+                                const char         *uri)
+{
+  const char *thumb_uri;
+
+  thumb_uri = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::URI");
+  return (g_strcmp0 (uri, thumb_uri) == 0);
+}
+
+/**
+ * mate_desktop_thumbnail_is_valid:
+ * @pixbuf: an loaded thumbnail #GdkPixbuf
+ * @uri: a uri
+ * @mtime: the mtime
+ *
+ * Returns whether the thumbnail has the correct uri and mtime embedded in the
+ * png options.
+ *
+ * Return value: TRUE if the thumbnail has the right @uri and @mtime
+ *
+ * Since: 2.2
+ **/
+gboolean
+mate_desktop_thumbnail_is_valid (GdkPixbuf          *pixbuf,
+                                 const char         *uri,
+                                 time_t              mtime)
+{
+  const char *thumb_uri, *thumb_mtime_str;
+  time_t thumb_mtime;
+
+  thumb_uri = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::URI");
+  if (g_strcmp0 (uri, thumb_uri) != 0)
+    return FALSE;
+
+  thumb_mtime_str = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::MTime");
+  if (!thumb_mtime_str)
+    return FALSE;
+  thumb_mtime = (time_t)g_ascii_strtoll (thumb_mtime_str, (gchar**)NULL, 10);
+  if (mtime != thumb_mtime)
+    return FALSE;
+
+  return TRUE;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/8.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/8.html new file mode 100644 index 00000000..529351a5 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/8.html @@ -0,0 +1,315 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */
+/* battstat        A MATE battery meter for laptops.
+ * Copyright (C) 2000 by Jörgen Pehrson <jp@spektr.eu.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ $Id$
+ */
+
+#ifndef __BATTSTAT_PREFERENCES_H__
+#define __BATTSTAT_PREFERENCES_H__
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "battstat.h"
+
+G_BEGIN_DECLS
+
+#define BATTSTAT_TYPE_PREFERENCES battstat_preferences_get_type ()
+G_DECLARE_FINAL_TYPE (BattstatPreferences, battstat_preferences,
+                      BATTSTAT, PREFERENCES, GtkDialog)
+
+GtkWidget        *battstat_preferences_new              (ProgressData *battstat);
+
+G_END_DECLS
+
+#endif /* __BATTSTAT_PREFERENCES_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/80.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/80.html new file mode 100644 index 00000000..9a7fa6fa --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/80.html @@ -0,0 +1,439 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
/*
+ * mate-thumbnail.h: Utilities for handling thumbnails
+ *
+ * Copyright (C) 2002 Red Hat, Inc.
+ *
+ * This file is part of the Mate Library.
+ *
+ * The Mate Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Mate 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Mate Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef MATE_DESKTOP_THUMBNAIL_H
+#define MATE_DESKTOP_THUMBNAIL_H
+
+#ifndef MATE_DESKTOP_USE_UNSTABLE_API
+#error    MateDesktopThumbnail is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including mate-desktop-thumbnail.h
+#endif
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <time.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk-pixbuf/gdk-pixbuf.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+typedef enum {
+  MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL,
+  MATE_DESKTOP_THUMBNAIL_SIZE_LARGE
+} MateDesktopThumbnailSize;
+
+#define MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY    (mate_desktop_thumbnail_factory_get_type ())
+#define MATE_DESKTOP_THUMBNAIL_FACTORY(obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, MateDesktopThumbnailFactory))
+#define MATE_DESKTOP_THUMBNAIL_FACTORY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, MateDesktopThumbnailFactoryClass))
+#define MATE_DESKTOP_IS_THUMBNAIL_FACTORY(obj)    (G_TYPE_INSTANCE_CHECK_TYPE ((obj), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY))
+#define MATE_DESKTOP_IS_THUMBNAIL_FACTORY_CLASS(klass)    (G_TYPE_CLASS_CHECK_CLASS_TYPE ((klass), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY))
+
+typedef struct _MateDesktopThumbnailFactory        MateDesktopThumbnailFactory;
+typedef struct _MateDesktopThumbnailFactoryClass   MateDesktopThumbnailFactoryClass;
+typedef struct _MateDesktopThumbnailFactoryPrivate MateDesktopThumbnailFactoryPrivate;
+
+struct _MateDesktopThumbnailFactory {
+    GObject parent;
+
+    MateDesktopThumbnailFactoryPrivate *priv;
+};
+
+struct _MateDesktopThumbnailFactoryClass {
+    GObjectClass parent;
+};
+
+GType      mate_desktop_thumbnail_factory_get_type (void);
+MateDesktopThumbnailFactory *mate_desktop_thumbnail_factory_new      (MateDesktopThumbnailSize     size);
+
+char *     mate_desktop_thumbnail_factory_lookup   (MateDesktopThumbnailFactory *factory,
+                                                    const char                  *uri,
+                                                    time_t                       mtime);
+
+gboolean   mate_desktop_thumbnail_factory_has_valid_failed_thumbnail (MateDesktopThumbnailFactory *factory,
+                                                                      const char                  *uri,
+                                                                      time_t                       mtime);
+gboolean   mate_desktop_thumbnail_factory_can_thumbnail (MateDesktopThumbnailFactory *factory,
+                                                         const char                  *uri,
+                                                         const char                  *mime_type,
+                                                         time_t                       mtime);
+GdkPixbuf *  mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory *factory,
+                                                                const char                  *uri,
+                                                                const char                  *mime_type);
+void       mate_desktop_thumbnail_factory_save_thumbnail (MateDesktopThumbnailFactory *factory,
+                                                          GdkPixbuf                   *thumbnail,
+                                                          const char                  *uri,
+                                                          time_t                       original_mtime);
+void       mate_desktop_thumbnail_factory_create_failed_thumbnail (MateDesktopThumbnailFactory *factory,
+                                                                   const char                  *uri,
+                                                                   time_t                       mtime);
+
+/* Thumbnailing utils: */
+gboolean   mate_desktop_thumbnail_has_uri           (GdkPixbuf          *pixbuf,
+                                                     const char         *uri);
+gboolean   mate_desktop_thumbnail_is_valid          (GdkPixbuf          *pixbuf,
+                                                     const char         *uri,
+                                                     time_t              mtime);
+char *     mate_desktop_thumbnail_path_for_uri      (const char         *uri,
+                                                     MateDesktopThumbnailSize  size);
+
+G_END_DECLS
+
+#endif /* MATE_DESKTOP_THUMBNAIL_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/81.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/81.html new file mode 100644 index 00000000..938e8fab --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/81.html @@ -0,0 +1,1159 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
/* -*- Mode: C; c-set-style: linux indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* mate-desktop-utils.c - Utilities for the MATE Desktop
+
+   Copyright (C) 1998 Tom Tromey
+   All rights reserved.
+
+   This file is part of the Mate Library.
+
+   The Mate Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Mate 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Mate Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+/*
+  @NOTATION@
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n-lib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define MATE_DESKTOP_USE_UNSTABLE_API
+#include <mate-desktop-utils.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "private.h"
+
+static void
+gtk_style_shade (GdkRGBA *a,
+                 GdkRGBA *b,
+                 gdouble  k);
+
+static void
+rgb_to_hls (gdouble *r,
+            gdouble *g,
+            gdouble *b);
+
+static void
+hls_to_rgb (gdouble *h,
+            gdouble *l,
+            gdouble *s);
+
+/**
+ * mate_desktop_prepend_terminal_to_vector:
+ * @argc: a pointer to the vector size
+ * @argv: a pointer to the vector
+ *
+ * Prepends a terminal (either the one configured as default in the user's
+ * MATE setup, or one of the common xterm emulators) to the passed in vector,
+ * modifying it in the process.  The vector should be allocated with #g_malloc,
+ * as this will #g_free the original vector.  Also all elements must have been
+ * allocated separately.  That is the standard glib/MATE way of doing vectors
+ * however.  If the integer that @argc points to is negative, the size will
+ * first be computed.  Also note that passing in pointers to a vector that is
+ * empty, will just create a new vector for you.
+ **/
+void
+mate_desktop_prepend_terminal_to_vector (int *argc, char ***argv)
+{
+        char **real_argv;
+        int real_argc;
+        int i, j;
+	char **term_argv = NULL;
+	int term_argc = 0;
+	GSettings *settings;
+
+	gchar *terminal;
+
+	char **the_argv;
+
+        g_return_if_fail (argc != NULL);
+        g_return_if_fail (argv != NULL);
+
+        _mate_desktop_init_i18n ();
+
+	/* sanity */
+        if(*argv == NULL)
+                *argc = 0;
+
+	the_argv = *argv;
+
+	/* compute size if not given */
+	if (*argc < 0) {
+		for (i = 0; the_argv[i] != NULL; i++)
+			;
+		*argc = i;
+	}
+
+	settings = g_settings_new ("org.mate.applications-terminal");
+	terminal = g_settings_get_string (settings, "exec");
+
+	if (terminal && *terminal != '\0') {
+		gchar *command_line;
+		gchar *exec_flag;
+
+		exec_flag = g_settings_get_string (settings, "exec-arg");
+
+		if (!exec_flag || *exec_flag == '\0')
+			command_line = g_strdup (terminal);
+		else
+			command_line = g_strdup_printf ("%s %s", terminal,
+							exec_flag);
+
+		g_shell_parse_argv (command_line,
+				    &term_argc,
+				    &term_argv,
+				    NULL /* error */);
+
+		g_free (command_line);
+		g_free (exec_flag);
+	}
+	g_free (terminal);
+	g_object_unref (settings);
+
+	if (term_argv == NULL) {
+		char *check;
+
+		term_argc = 2;
+		term_argv = g_new0 (char *, 3);
+
+		check = g_find_program_in_path ("mate-terminal");
+		if (check != NULL) {<--- first condition
+			term_argv[0] = check;
+			/* Note that mate-terminal takes -x and
+			 * as -e in mate-terminal is broken we use that. */
+			term_argv[1] = g_strdup ("-x");
+		} else {
+			if (check == NULL)<--- else if condition is opposite to first condition
+				check = g_find_program_in_path ("nxterm");
+			if (check == NULL)
+				check = g_find_program_in_path ("color-xterm");
+			if (check == NULL)
+				check = g_find_program_in_path ("rxvt");
+			if (check == NULL)
+				check = g_find_program_in_path ("xterm");
+			if (check == NULL)
+				check = g_find_program_in_path ("dtterm");
+			if (check == NULL) {
+				g_warning (_("Cannot find a terminal, using "
+					     "xterm, even if it may not work"));
+				check = g_strdup ("xterm");
+			}
+			term_argv[0] = check;
+			term_argv[1] = g_strdup ("-e");
+		}
+	}
+
+        real_argc = term_argc + *argc;
+        real_argv = g_new (char *, real_argc + 1);
+
+        for (i = 0; i < term_argc; i++)
+                real_argv[i] = term_argv[i];
+
+        for (j = 0; j < *argc; j++, i++)
+                real_argv[i] = (char *)the_argv[j];
+
+	real_argv[i] = NULL;
+
+	g_free (*argv);
+	*argv = real_argv;
+	*argc = real_argc;
+
+	/* we use g_free here as we sucked all the inner strings
+	 * out from it into real_argv */
+	g_free (term_argv);
+}
+
+/**
+ * mate_gdk_spawn_command_line_on_screen:
+ * @screen: a GdkScreen
+ * @command: a command line
+ * @error: return location for errors
+ *
+ * This is a replacement for gdk_spawn_command_line_on_screen, deprecated
+ * in GDK 2.24 and removed in GDK 3.0.
+ *
+ * gdk_spawn_command_line_on_screen is like g_spawn_command_line_async(),
+ * except the child process is spawned in such an environment that on
+ * calling gdk_display_open() it would be returned a GdkDisplay with
+ * screen as the default screen.
+ *
+ * This is useful for applications which wish to launch an application
+ * on a specific screen.
+ *
+ * Returns: TRUE on success, FALSE if error is set.
+ *
+ * Since: 1.7.1
+ **/
+gboolean
+mate_gdk_spawn_command_line_on_screen (GdkScreen *screen, const gchar *command, GError **error)
+{
+	GAppInfo *appinfo = NULL;
+	GdkAppLaunchContext *context = NULL;
+	gboolean res = FALSE;
+
+	appinfo = g_app_info_create_from_commandline (command, NULL, G_APP_INFO_CREATE_NONE, error);
+
+	if (appinfo) {
+		context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
+		res = g_app_info_launch (appinfo, NULL, G_APP_LAUNCH_CONTEXT (context), error);
+		g_object_unref (context);
+		g_object_unref (appinfo);
+	}
+
+	return res;
+}
+
+void
+_mate_desktop_init_i18n (void) {
+	static gboolean initialized = FALSE;
+
+	if (!initialized) {
+		bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+		bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
+		initialized = TRUE;
+	}
+}
+
+/**
+ * gtk_style_shade:
+ * @a:  the starting colour
+ * @b:  [out] the resulting colour
+ * @k:  amount to scale lightness and saturation by
+ *
+ * Takes a colour "a", scales the lightness and saturation by a certain amount,
+ * and sets "b" to the resulting colour.
+ * gtkstyle.c cut-and-pastage.
+ */
+static void
+gtk_style_shade (GdkRGBA *a,<--- Parameter 'a' can be declared as pointer to const
+                 GdkRGBA *b,
+                 gdouble  k)
+{
+	gdouble red;
+	gdouble green;
+	gdouble blue;
+
+	red = a->red;
+	green = a->green;
+	blue = a->blue;
+
+	rgb_to_hls (&red, &green, &blue);
+
+	green *= k;
+	if (green > 1.0)
+		green = 1.0;
+	else if (green < 0.0)
+		green = 0.0;
+
+	blue *= k;
+	if (blue > 1.0)
+		blue = 1.0;
+	else if (blue < 0.0)
+		blue = 0.0;
+
+	hls_to_rgb (&red, &green, &blue);
+
+	b->red = red;
+	b->green = green;
+	b->blue = blue;
+}
+
+/**
+ * rgb_to_hls:
+ * @r:  on input, red; on output, hue
+ * @g:  on input, green; on output, lightness
+ * @b:  on input, blue; on output, saturation
+ *
+ * Converts a red/green/blue triplet to a hue/lightness/saturation triplet.
+ */
+static void
+rgb_to_hls (gdouble *r,
+            gdouble *g,
+            gdouble *b)
+{
+	gdouble min;
+	gdouble max;
+	gdouble red;
+	gdouble green;
+	gdouble blue;
+	gdouble h, l, s;
+	gdouble delta;
+
+	red = *r;
+	green = *g;
+	blue = *b;
+
+	if (red > green)
+	{
+		if (red > blue)
+			max = red;
+		else
+			max = blue;
+
+		if (green < blue)
+			min = green;
+		else
+			min = blue;
+	}
+	else
+	{
+		if (green > blue)
+			max = green;
+		else
+			max = blue;
+
+		if (red < blue)
+			min = red;
+		else
+			min = blue;
+	}
+
+	l = (max + min) / 2;
+	s = 0;
+	h = 0;
+
+	if (max != min)
+	{
+		if (l <= 0.5)
+			s = (max - min) / (max + min);
+		else
+			s = (max - min) / (2 - max - min);
+
+		delta = max -min;
+		if (red == max)
+			h = (green - blue) / delta;
+		else if (green == max)
+			h = 2 + (blue - red) / delta;
+		else if (blue == max)
+			h = 4 + (red - green) / delta;
+
+		h *= 60;
+		if (h < 0.0)
+			h += 360;
+	}
+
+	*r = h;
+	*g = l;
+	*b = s;
+}
+
+/**
+ * hls_to_rgb:
+ * @h: on input, hue; on output, red
+ * @l: on input, lightness; on output, green
+ * @s  on input, saturation; on output, blue
+ *
+ * Converts a hue/lightness/saturation triplet to a red/green/blue triplet.
+ */
+static void
+hls_to_rgb (gdouble *h,
+            gdouble *l,
+            gdouble *s)
+{
+	gdouble hue;
+	gdouble lightness;
+	gdouble saturation;
+	gdouble m1, m2;
+	gdouble r, g, b;
+
+	lightness = *l;
+	saturation = *s;
+
+	if (lightness <= 0.5)
+		m2 = lightness * (1 + saturation);
+	else
+		m2 = lightness + saturation - lightness * saturation;
+	m1 = 2 * lightness - m2;
+
+	if (saturation == 0)
+	{
+		*h = lightness;
+		*l = lightness;
+		*s = lightness;
+	}
+	else
+	{
+		hue = *h + 120;
+		while (hue > 360)
+			hue -= 360;
+		while (hue < 0)
+			hue += 360;
+
+		if (hue < 60)
+			r = m1 + (m2 - m1) * hue / 60;
+		else if (hue < 180)
+			r = m2;
+		else if (hue < 240)
+			r = m1 + (m2 - m1) * (240 - hue) / 60;
+		else
+			r = m1;
+
+		hue = *h;
+		while (hue > 360)
+			hue -= 360;
+		while (hue < 0)
+			hue += 360;
+
+		if (hue < 60)
+			g = m1 + (m2 - m1) * hue / 60;
+		else if (hue < 180)
+			g = m2;
+		else if (hue < 240)
+			g = m1 + (m2 - m1) * (240 - hue) / 60;
+		else
+			g = m1;
+
+		hue = *h - 120;
+		while (hue > 360)
+			hue -= 360;
+		while (hue < 0)
+			hue += 360;
+
+		if (hue < 60)
+			b = m1 + (m2 - m1) * hue / 60;
+		else if (hue < 180)
+			b = m2;
+		else if (hue < 240)
+			b = m1 + (m2 - m1) * (240 - hue) / 60;
+		else
+			b = m1;
+
+		*h = r;
+		*l = g;
+		*s = b;
+	}
+}
+
+/* Based on set_color() in gtkstyle.c */
+#define LIGHTNESS_MULT 1.3
+#define DARKNESS_MULT  0.7
+void
+mate_desktop_gtk_style_get_light_color (GtkStyleContext *style,
+                                        GtkStateFlags    state,
+                                        GdkRGBA         *color)
+{
+	gtk_style_context_get_background_color (style, state, color);
+	gtk_style_shade (color, color, LIGHTNESS_MULT);
+}
+
+void
+mate_desktop_gtk_style_get_dark_color (GtkStyleContext *style,
+                                       GtkStateFlags    state,
+                                       GdkRGBA         *color)
+{
+	gtk_style_context_get_background_color (style, state, color);
+	gtk_style_shade (color, color, DARKNESS_MULT);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/82.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/82.html new file mode 100644 index 00000000..a53f16c6 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/82.html @@ -0,0 +1,339 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
/*
+ * mate-gsettings.h: helper API for GSettings
+ *
+ * Copyright (C) 2013 Stefano Karapetsas
+ * Copyright (C) 2013-2021 MATE Developers
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * Authors:
+ *  Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifndef __MATE_GSETTINGS_H__
+#define __MATE_GSETTINGS_H__
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+gboolean mate_gsettings_schema_exists (const gchar* schema);
+
+gboolean mate_gsettings_is_valid_keyname (const gchar  *key,
+                                          GError      **error);
+
+gboolean mate_gsettings_append_strv (GSettings         *settings,
+                                     const gchar       *key,
+                                     const gchar       *value);
+
+gboolean mate_gsettings_remove_all_from_strv (GSettings         *settings,
+                                              const gchar       *key,
+                                              const gchar       *value);
+
+GSList*  mate_gsettings_strv_to_gslist (const gchar *const *array);
+
+G_END_DECLS
+
+#endif /* __MATE_GSETTINGS_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/83.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/83.html new file mode 100644 index 00000000..db6094e1 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/83.html @@ -0,0 +1,3107 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
/* HSV color selector for GTK+
+ *
+ * Copyright (C) 1999 The Free Software Foundation
+ * Copyright (C) 2019-2021 MATE Developers
+ *
+ * Authors: Simon Budig <Simon.Budig@unix-ag.org> (original code)
+ *          Federico Mena-Quintero <federico@gimp.org> (cleanup for GTK+)
+ *          Jonathan Blandford <jrb@redhat.com> (cleanup for GTK+)
+ *
+ * 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/>.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ *
+ * Modified to work internally in mate-desktop by Pablo Barciela 2019
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"<--- Include file: "config.h" not found.
+#endif
+
+#include "mate-hsv.h"
+
+#include <math.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define I_(string) g_intern_static_string (string)
+
+/**
+ * SECTION:mate-hsv
+ * @Short_description: A “color wheel” widget
+ * @Title: MateHSV
+ *
+ * #MateHSV is the “color wheel” part of a complete color selector widget.
+ * It allows to select a color by determining its HSV components in an
+ * intuitive way. Moving the selection around the outer ring changes the hue,
+ * and moving the selection point inside the inner triangle changes value and
+ * saturation.
+ */
+
+/* Default width/height */
+#define DEFAULT_SIZE 100
+
+/* Default ring width */
+#define DEFAULT_RING_WIDTH 10
+
+/* Dragging modes */
+typedef enum {
+  DRAG_NONE,
+  DRAG_H,
+  DRAG_SV
+} DragMode;
+
+/* Private part of the MateHSV structure */
+struct _MateHSVPrivate
+{
+  /* Color value */
+  double h;
+  double s;
+  double v;
+
+  /* Size and ring width */
+  int size;
+  int ring_width;
+
+  /* Window for capturing events */
+  GdkWindow *window;
+
+  /* Dragging mode */
+  DragMode mode;
+
+  guint focus_on_ring : 1;
+};
+
+/* Signal IDs */
+
+enum {
+  CHANGED,
+  MOVE,
+  LAST_SIGNAL
+};
+
+static void     mate_hsv_destroy              (GtkWidget          *widget);
+static void     mate_hsv_realize              (GtkWidget          *widget);
+static void     mate_hsv_unrealize            (GtkWidget          *widget);
+static void     mate_hsv_get_preferred_width  (GtkWidget          *widget,
+                                               gint               *minimum,
+                                               gint               *natural);
+static void     mate_hsv_get_preferred_height (GtkWidget          *widget,
+                                               gint               *minimum,
+                                               gint               *natural);
+static void     mate_hsv_size_allocate        (GtkWidget          *widget,
+                                               GtkAllocation      *allocation);
+static gboolean mate_hsv_button_press         (GtkWidget          *widget,
+                                               GdkEventButton     *event);
+static gboolean mate_hsv_button_release       (GtkWidget          *widget,
+                                               GdkEventButton     *event);
+static gboolean mate_hsv_motion               (GtkWidget          *widget,
+                                               GdkEventMotion     *event);
+static gboolean mate_hsv_draw                 (GtkWidget          *widget,
+                                               cairo_t            *cr);
+static gboolean mate_hsv_grab_broken          (GtkWidget          *widget,
+                                               GdkEventGrabBroken *event);
+static gboolean mate_hsv_focus                (GtkWidget          *widget,
+                                               GtkDirectionType    direction);
+static void     mate_hsv_move                 (MateHSV            *hsv,
+                                               GtkDirectionType    dir);
+
+static guint hsv_signals[LAST_SIGNAL];
+
+G_DEFINE_TYPE_WITH_PRIVATE (MateHSV, mate_hsv, GTK_TYPE_WIDGET)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
+
+/* Class initialization function for the HSV color selector */
+static void
+mate_hsv_class_init (MateHSVClass *class)
+{
+  GObjectClass    *gobject_class;
+  GtkWidgetClass  *widget_class;
+  MateHSVClass    *hsv_class;
+  GtkBindingSet   *binding_set;
+
+  gobject_class = (GObjectClass *) class;
+  widget_class = (GtkWidgetClass *) class;
+  hsv_class = MATE_HSV_CLASS (class);
+
+  widget_class->destroy = mate_hsv_destroy;
+  widget_class->realize = mate_hsv_realize;
+  widget_class->unrealize = mate_hsv_unrealize;
+  widget_class->get_preferred_width = mate_hsv_get_preferred_width;
+  widget_class->get_preferred_height = mate_hsv_get_preferred_height;
+  widget_class->size_allocate = mate_hsv_size_allocate;
+  widget_class->button_press_event = mate_hsv_button_press;
+  widget_class->button_release_event = mate_hsv_button_release;
+  widget_class->motion_notify_event = mate_hsv_motion;
+  widget_class->draw = mate_hsv_draw;
+  widget_class->focus = mate_hsv_focus;
+  widget_class->grab_broken_event = mate_hsv_grab_broken;
+
+  gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_COLOR_CHOOSER);
+
+  hsv_class->move = mate_hsv_move;
+
+  hsv_signals[CHANGED] =
+    g_signal_new (I_("changed"),
+                  G_OBJECT_CLASS_TYPE (gobject_class),
+                  G_SIGNAL_RUN_FIRST,
+                  G_STRUCT_OFFSET (MateHSVClass, changed),
+                  NULL, NULL,
+                  NULL,
+                  G_TYPE_NONE, 0);
+
+  hsv_signals[MOVE] =
+    g_signal_new (I_("move"),
+                  G_OBJECT_CLASS_TYPE (gobject_class),
+                  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                  G_STRUCT_OFFSET (MateHSVClass, move),
+                  NULL, NULL,
+                  NULL,
+                  G_TYPE_NONE, 1,
+                  GTK_TYPE_DIRECTION_TYPE);
+
+  binding_set = gtk_binding_set_by_class (class);
+
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_Up, 0,
+                                "move", 1,
+                                G_TYPE_ENUM, GTK_DIR_UP);
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Up, 0,
+                                "move", 1,
+                                G_TYPE_ENUM, GTK_DIR_UP);
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_Down, 0,
+                                "move", 1,
+                                G_TYPE_ENUM, GTK_DIR_DOWN);
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Down, 0,
+                                "move", 1,
+                                G_TYPE_ENUM, GTK_DIR_DOWN);
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_Right, 0,
+                                "move", 1,
+                                G_TYPE_ENUM, GTK_DIR_RIGHT);
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Right, 0,
+                                "move", 1,
+                                G_TYPE_ENUM, GTK_DIR_RIGHT);
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_Left, 0,
+                                "move", 1,
+                                G_TYPE_ENUM, GTK_DIR_LEFT);
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Left, 0,
+                                "move", 1,
+                                G_TYPE_ENUM, GTK_DIR_LEFT);
+}
+
+static void
+mate_hsv_init (MateHSV *hsv)
+{
+  MateHSVPrivate *priv;
+
+  priv = mate_hsv_get_instance_private (hsv);
+  hsv->priv = priv;
+
+  gtk_widget_set_has_window (GTK_WIDGET (hsv), FALSE);
+  gtk_widget_set_can_focus (GTK_WIDGET (hsv), TRUE);
+
+  priv->h = 0.0;
+  priv->s = 0.0;
+  priv->v = 0.0;
+
+  priv->size = DEFAULT_SIZE;
+  priv->ring_width = DEFAULT_RING_WIDTH;
+}
+
+static void
+mate_hsv_destroy (GtkWidget *widget)
+{
+  GTK_WIDGET_CLASS (mate_hsv_parent_class)->destroy (widget);
+}
+
+static void
+mate_hsv_realize (GtkWidget *widget)
+{
+  MateHSV *hsv = MATE_HSV (widget);
+  MateHSVPrivate *priv = hsv->priv;
+  GtkAllocation allocation;
+  GdkWindow *parent_window;
+  GdkWindowAttr attr;
+  int attr_mask;
+
+  gtk_widget_set_realized (widget, TRUE);
+
+  gtk_widget_get_allocation (widget, &allocation);
+
+  attr.window_type = GDK_WINDOW_CHILD;
+  attr.x = allocation.x;
+  attr.y = allocation.y;
+  attr.width = allocation.width;
+  attr.height = allocation.height;
+  attr.wclass = GDK_INPUT_ONLY;
+  attr.event_mask = gtk_widget_get_events (widget);
+  attr.event_mask |= (GDK_KEY_PRESS_MASK
+                      | GDK_BUTTON_PRESS_MASK
+                      | GDK_BUTTON_RELEASE_MASK
+                      | GDK_POINTER_MOTION_MASK
+                      | GDK_ENTER_NOTIFY_MASK
+                      | GDK_LEAVE_NOTIFY_MASK);
+  attr_mask = GDK_WA_X | GDK_WA_Y;
+
+  parent_window = gtk_widget_get_parent_window (widget);
+  gtk_widget_set_window (widget, parent_window);
+  g_object_ref (parent_window);
+
+  priv->window = gdk_window_new (parent_window, &attr, attr_mask);
+  gdk_window_set_user_data (priv->window, hsv);
+  gdk_window_show (priv->window);
+}
+
+static void
+mate_hsv_unrealize (GtkWidget *widget)
+{
+  MateHSV *hsv = MATE_HSV (widget);
+  MateHSVPrivate *priv = hsv->priv;
+
+  gdk_window_set_user_data (priv->window, NULL);
+  gdk_window_destroy (priv->window);
+  priv->window = NULL;
+
+  GTK_WIDGET_CLASS (mate_hsv_parent_class)->unrealize (widget);
+}
+
+static void
+mate_hsv_get_preferred_width (GtkWidget *widget,
+                              gint      *minimum,
+                              gint      *natural)
+{
+  MateHSV *hsv = MATE_HSV (widget);
+  MateHSVPrivate *priv = hsv->priv;
+  gint focus_width;
+  gint focus_pad;
+
+  gtk_widget_style_get (widget,
+                        "focus-line-width", &focus_width,
+                        "focus-padding", &focus_pad,
+                        NULL);
+
+  *minimum = priv->size + 2 * (focus_width + focus_pad);
+  *natural = priv->size + 2 * (focus_width + focus_pad);
+}
+
+static void
+mate_hsv_get_preferred_height (GtkWidget *widget,
+                               gint      *minimum,
+                               gint      *natural)
+{
+  MateHSV *hsv = MATE_HSV (widget);
+  MateHSVPrivate *priv = hsv->priv;
+  gint focus_width;
+  gint focus_pad;
+
+  gtk_widget_style_get (widget,
+                        "focus-line-width", &focus_width,
+                        "focus-padding", &focus_pad,
+                        NULL);
+
+  *minimum = priv->size + 2 * (focus_width + focus_pad);
+  *natural = priv->size + 2 * (focus_width + focus_pad);
+}
+
+static void
+mate_hsv_size_allocate (GtkWidget     *widget,
+                        GtkAllocation *allocation)
+{
+  MateHSV *hsv = MATE_HSV (widget);
+  MateHSVPrivate *priv = hsv->priv;
+
+  gtk_widget_set_allocation (widget, allocation);
+
+  if (gtk_widget_get_realized (widget))
+    gdk_window_move_resize (priv->window,
+                            allocation->x,
+                            allocation->y,
+                            allocation->width,
+                            allocation->height);
+}
+
+/* Utility functions */
+
+#define INTENSITY(r, g, b) ((r) * 0.30 + (g) * 0.59 + (b) * 0.11)
+
+/* Converts from HSV to RGB */
+static void
+hsv_to_rgb (gdouble *h,
+            gdouble *s,
+            gdouble *v)
+{
+  gdouble hue, saturation, value;
+  gdouble f, p, q, t;
+
+  if (*s == 0.0)
+    {
+      *h = *v;
+      *s = *v;
+      *v = *v; /* heh */
+    }
+  else
+    {
+      hue = *h * 6.0;
+      saturation = *s;
+      value = *v;
+
+      if (hue == 6.0)
+        hue = 0.0;
+
+      f = hue - (int) hue;
+      p = value * (1.0 - saturation);
+      q = value * (1.0 - saturation * f);
+      t = value * (1.0 - saturation * (1.0 - f));
+
+      switch ((int) hue)
+        {
+        case 0:
+          *h = value;
+          *s = t;
+          *v = p;
+          break;
+
+        case 1:
+          *h = q;
+          *s = value;
+          *v = p;
+          break;
+
+        case 2:
+          *h = p;
+          *s = value;
+          *v = t;
+          break;
+
+        case 3:
+          *h = p;
+          *s = q;
+          *v = value;
+          break;
+
+        case 4:
+          *h = t;
+          *s = p;
+          *v = value;
+          break;
+
+        case 5:
+          *h = value;
+          *s = p;
+          *v = q;
+          break;
+
+        default:
+          g_assert_not_reached ();
+        }
+    }
+}
+
+/* Computes the vertices of the saturation/value triangle */
+static void
+compute_triangle (MateHSV *hsv,
+                  gint    *hx,
+                  gint    *hy,
+                  gint    *sx,
+                  gint    *sy,
+                  gint    *vx,
+                  gint    *vy)
+{
+  MateHSVPrivate *priv = hsv->priv;
+  GtkWidget *widget = GTK_WIDGET (hsv);
+  gdouble center_x;
+  gdouble center_y;
+  gdouble inner, outer;
+  gdouble angle;
+
+  center_x = gtk_widget_get_allocated_width (widget) / 2.0;
+  center_y = gtk_widget_get_allocated_height (widget) / 2.0;
+  outer = priv->size / 2.0;
+  inner = outer - priv->ring_width;
+  angle = priv->h * 2.0 * G_PI;
+
+  *hx = floor (center_x + cos (angle) * inner + 0.5);
+  *hy = floor (center_y - sin (angle) * inner + 0.5);
+  *sx = floor (center_x + cos (angle + 2.0 * G_PI / 3.0) * inner + 0.5);
+  *sy = floor (center_y - sin (angle + 2.0 * G_PI / 3.0) * inner + 0.5);
+  *vx = floor (center_x + cos (angle + 4.0 * G_PI / 3.0) * inner + 0.5);
+  *vy = floor (center_y - sin (angle + 4.0 * G_PI / 3.0) * inner + 0.5);
+}
+
+/* Computes whether a point is inside the hue ring */
+static gboolean
+is_in_ring (MateHSV *hsv,
+            gdouble  x,
+            gdouble  y)
+{
+  MateHSVPrivate *priv = hsv->priv;
+  GtkWidget *widget = GTK_WIDGET (hsv);
+  gdouble dx, dy, dist;
+  gdouble center_x;
+  gdouble center_y;
+  gdouble inner, outer;
+
+  center_x = gtk_widget_get_allocated_width (widget) / 2.0;
+  center_y = gtk_widget_get_allocated_height (widget) / 2.0;
+  outer = priv->size / 2.0;
+  inner = outer - priv->ring_width;
+
+  dx = x - center_x;
+  dy = center_y - y;
+  dist = dx * dx + dy * dy;
+
+  return (dist >= inner * inner && dist <= outer * outer);
+}
+
+/* Computes a saturation/value pair based on the mouse coordinates */
+static void
+compute_sv (MateHSV  *hsv,
+            gdouble   x,
+            gdouble   y,
+            gdouble  *s,
+            gdouble  *v)
+{
+  GtkWidget *widget = GTK_WIDGET (hsv);
+  int ihx, ihy, isx, isy, ivx, ivy;
+  double hx, hy, sx, sy, vx, vy;
+  double center_x;
+  double center_y;
+
+  compute_triangle (hsv, &ihx, &ihy, &isx, &isy, &ivx, &ivy);
+  center_x = gtk_widget_get_allocated_width (widget) / 2.0;
+  center_y = gtk_widget_get_allocated_height (widget) / 2.0;
+  hx = ihx - center_x;
+  hy = center_y - ihy;
+  sx = isx - center_x;
+  sy = center_y - isy;
+  vx = ivx - center_x;
+  vy = center_y - ivy;
+  x -= center_x;
+  y = center_y - y;
+
+  if (vx * (x - sx) + vy * (y - sy) < 0.0)
+    {
+      *s = 1.0;
+      *v = (((x - sx) * (hx - sx) + (y - sy) * (hy-sy))
+            / ((hx - sx) * (hx - sx) + (hy - sy) * (hy - sy)));
+
+      if (*v < 0.0)
+        *v = 0.0;
+      else if (*v > 1.0)
+        *v = 1.0;
+    }
+  else if (hx * (x - sx) + hy * (y - sy) < 0.0)
+    {
+      *s = 0.0;
+      *v = (((x - sx) * (vx - sx) + (y - sy) * (vy - sy))
+            / ((vx - sx) * (vx - sx) + (vy - sy) * (vy - sy)));
+
+      if (*v < 0.0)
+        *v = 0.0;
+      else if (*v > 1.0)
+        *v = 1.0;
+    }
+  else if (sx * (x - hx) + sy * (y - hy) < 0.0)
+    {
+      *v = 1.0;
+      *s = (((x - vx) * (hx - vx) + (y - vy) * (hy - vy)) /
+            ((hx - vx) * (hx - vx) + (hy - vy) * (hy - vy)));
+
+      if (*s < 0.0)
+        *s = 0.0;
+      else if (*s > 1.0)
+        *s = 1.0;
+    }
+  else
+    {
+      *v = (((x - sx) * (hy - vy) - (y - sy) * (hx - vx))
+            / ((vx - sx) * (hy - vy) - (vy - sy) * (hx - vx)));
+
+      if (*v<= 0.0)
+        {
+          *v = 0.0;
+          *s = 0.0;
+        }
+      else
+        {
+          if (*v > 1.0)
+            *v = 1.0;
+
+          if (fabs (hy - vy) < fabs (hx - vx))
+            *s = (x - sx - *v * (vx - sx)) / (*v * (hx - vx));
+          else
+            *s = (y - sy - *v * (vy - sy)) / (*v * (hy - vy));
+
+          if (*s < 0.0)
+            *s = 0.0;
+          else if (*s > 1.0)
+            *s = 1.0;
+        }
+    }
+}
+
+/* Computes whether a point is inside the saturation/value triangle */
+static gboolean
+is_in_triangle (MateHSV *hsv,
+                gdouble  x,
+                gdouble  y)
+{
+  int hx, hy, sx, sy, vx, vy;
+  double det, s, v;
+
+  compute_triangle (hsv, &hx, &hy, &sx, &sy, &vx, &vy);
+
+  det = (vx - sx) * (hy - sy) - (vy - sy) * (hx - sx);
+
+  s = ((x - sx) * (hy - sy) - (y - sy) * (hx - sx)) / det;
+  v = ((vx - sx) * (y - sy) - (vy - sy) * (x - sx)) / det;
+
+  return (s >= 0.0 && v >= 0.0 && s + v <= 1.0);
+}
+
+/* Computes a value based on the mouse coordinates */
+static double
+compute_v (MateHSV *hsv,
+           gdouble  x,
+           gdouble  y)
+{
+  GtkWidget *widget = GTK_WIDGET (hsv);
+  double center_x;
+  double center_y;
+  double dx, dy;
+  double angle;
+
+  center_x = gtk_widget_get_allocated_width (widget) / 2.0;
+  center_y = gtk_widget_get_allocated_height (widget) / 2.0;
+  dx = x - center_x;
+  dy = center_y - y;
+
+  angle = atan2 (dy, dx);
+  if (angle < 0.0)
+    angle += 2.0 * G_PI;
+
+  return angle / (2.0 * G_PI);
+}
+
+/* Event handlers */
+
+static void
+set_cross_grab (MateHSV   *hsv,
+                GdkDevice *device,
+                guint32    time)
+{
+  MateHSVPrivate *priv = hsv->priv;
+  GdkCursor *cursor;
+
+  cursor = gdk_cursor_new_for_display (gtk_widget_get_display (GTK_WIDGET (hsv)),
+                                       GDK_CROSSHAIR);
+  gdk_seat_grab (gdk_device_get_seat (device),
+                 priv->window,
+                 GDK_SEAT_CAPABILITY_ALL_POINTING,
+                 FALSE,
+                 cursor,
+                 NULL,
+                 NULL,
+                 NULL);
+  g_object_unref (cursor);
+}
+
+static gboolean
+mate_hsv_grab_broken (GtkWidget          *widget,
+                      GdkEventGrabBroken *event)
+{
+  MateHSV *hsv = MATE_HSV (widget);
+  MateHSVPrivate *priv = hsv->priv;
+
+  priv->mode = DRAG_NONE;
+
+  return TRUE;
+}
+
+static gint
+mate_hsv_button_press (GtkWidget      *widget,
+                       GdkEventButton *event)
+{
+  MateHSV *hsv = MATE_HSV (widget);
+  MateHSVPrivate *priv = hsv->priv;
+  double x, y;
+
+  if (priv->mode != DRAG_NONE || event->button != GDK_BUTTON_PRIMARY)
+    return FALSE;
+
+  x = event->x;
+  y = event->y;
+
+  if (is_in_ring (hsv, x, y))
+    {
+      priv->mode = DRAG_H;
+      set_cross_grab (hsv, gdk_event_get_device ((GdkEvent *) event), event->time);
+
+      mate_hsv_set_color (hsv,
+                         compute_v (hsv, x, y),
+                         priv->s,
+                         priv->v);
+
+      gtk_widget_grab_focus (widget);
+      priv->focus_on_ring = TRUE;
+
+      return TRUE;
+    }
+
+  if (is_in_triangle (hsv, x, y))
+    {
+      gdouble s, v;
+
+      priv->mode = DRAG_SV;
+      set_cross_grab (hsv, gdk_event_get_device ((GdkEvent *) event), event->time);
+
+      compute_sv (hsv, x, y, &s, &v);
+      mate_hsv_set_color (hsv, priv->h, s, v);
+
+      gtk_widget_grab_focus (widget);
+      priv->focus_on_ring = FALSE;
+
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
+static gint
+mate_hsv_button_release (GtkWidget      *widget,
+                         GdkEventButton *event)
+{
+  MateHSV *hsv = MATE_HSV (widget);
+  MateHSVPrivate *priv = hsv->priv;
+  DragMode mode;
+  gdouble x, y;
+
+  if (priv->mode == DRAG_NONE || event->button != GDK_BUTTON_PRIMARY)
+    return FALSE;
+
+  /* Set the drag mode to DRAG_NONE so that signal handlers for "catched"
+   * can see that this is the final color state.
+   */
+  mode = priv->mode;
+  priv->mode = DRAG_NONE;
+
+  x = event->x;
+  y = event->y;
+
+  if (mode == DRAG_H)
+    {
+      mate_hsv_set_color (hsv, compute_v (hsv, x, y), priv->s, priv->v);
+    }
+  else if (mode == DRAG_SV)
+    {
+      gdouble s, v;
+
+      compute_sv (hsv, x, y, &s, &v);
+      mate_hsv_set_color (hsv, priv->h, s, v);
+    }
+  else
+    {
+      g_assert_not_reached ();
+    }
+
+  gdk_seat_ungrab (gdk_device_get_seat (gdk_event_get_device ((GdkEvent *) event)));
+
+  return TRUE;
+}
+
+static gint
+mate_hsv_motion (GtkWidget      *widget,
+                 GdkEventMotion *event)
+{
+  MateHSV *hsv = MATE_HSV (widget);
+  MateHSVPrivate *priv = hsv->priv;
+  gdouble x, y;
+
+  if (priv->mode == DRAG_NONE)
+    return FALSE;
+
+  gdk_event_request_motions (event);
+  x = event->x;
+  y = event->y;
+
+  if (priv->mode == DRAG_H)
+    {
+      mate_hsv_set_color (hsv, compute_v (hsv, x, y), priv->s, priv->v);
+      return TRUE;
+    }
+  else if (priv->mode == DRAG_SV)
+    {
+      gdouble s, v;
+
+      compute_sv (hsv, x, y, &s, &v);
+      mate_hsv_set_color (hsv, priv->h, s, v);
+      return TRUE;
+    }
+
+  g_assert_not_reached ();
+
+  return FALSE;
+}
+
+/* Redrawing */
+
+/* Paints the hue ring */
+static void
+paint_ring (MateHSV *hsv,
+            cairo_t *cr)
+{
+  MateHSVPrivate *priv = hsv->priv;
+  GtkWidget *widget = GTK_WIDGET (hsv);
+  int xx, yy, width, height;
+  gdouble dx, dy, dist;
+  gdouble center_x;
+  gdouble center_y;
+  gdouble inner, outer;
+  guint32 *buf, *p;
+  gdouble angle;
+  gdouble hue;
+  gdouble r, g, b;
+  cairo_surface_t *source;
+  cairo_t *source_cr;
+  gint stride;
+
+  width = gtk_widget_get_allocated_width (widget);
+  height = gtk_widget_get_allocated_height (widget);
+
+  center_x = width / 2.0;
+  center_y = height / 2.0;
+
+  outer = priv->size / 2.0;
+  inner = outer - priv->ring_width;
+
+  /* Create an image initialized with the ring colors */
+
+  stride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, width);
+  buf = g_new (guint32, height * stride / 4);
+
+  for (yy = 0; yy < height; yy++)
+    {
+      p = buf + yy * width;
+
+      dy = -(yy - center_y);
+
+      for (xx = 0; xx < width; xx++)
+        {
+          dx = xx - center_x;
+
+          dist = dx * dx + dy * dy;
+          if (dist < ((inner-1) * (inner-1)) || dist > ((outer+1) * (outer+1)))
+            {
+              *p++ = 0;
+              continue;
+            }
+
+          angle = atan2 (dy, dx);
+          if (angle < 0.0)
+            angle += 2.0 * G_PI;
+
+          hue = angle / (2.0 * G_PI);
+
+          r = hue;
+          g = 1.0;
+          b = 1.0;
+          hsv_to_rgb (&r, &g, &b);
+
+          *p++ = (((int)(r * 255.0) << 16) |
+                  ((int)(g * 255.0) << 8) |
+                  (int)(b * 255.0));
+        }
+    }
+
+  source = cairo_image_surface_create_for_data ((unsigned char *)buf,
+                                                CAIRO_FORMAT_RGB24,
+                                                width, height, stride);
+
+  /* Now draw the value marker onto the source image, so that it
+   * will get properly clipped at the edges of the ring
+   */
+  source_cr = cairo_create (source);
+
+  r = priv->h;
+  g = 1.0;
+  b = 1.0;
+  hsv_to_rgb (&r, &g, &b);
+
+  if (INTENSITY (r, g, b) > 0.5)
+    cairo_set_source_rgb (source_cr, 0., 0., 0.);
+  else
+    cairo_set_source_rgb (source_cr, 1., 1., 1.);
+
+  cairo_move_to (source_cr, center_x, center_y);
+  cairo_line_to (source_cr,
+                 center_x + cos (priv->h * 2.0 * G_PI) * priv->size / 2,
+                 center_y - sin (priv->h * 2.0 * G_PI) * priv->size / 2);
+  cairo_stroke (source_cr);
+  cairo_destroy (source_cr);
+
+  /* Draw the ring using the source image */
+
+  cairo_save (cr);
+
+  cairo_set_source_surface (cr, source, 0, 0);
+  cairo_surface_destroy (source);
+
+  cairo_set_line_width (cr, priv->ring_width);
+  cairo_new_path (cr);
+  cairo_arc (cr,
+             center_x, center_y,
+             priv->size / 2. - priv->ring_width / 2.,
+             0, 2 * G_PI);
+  cairo_stroke (cr);
+
+  cairo_restore (cr);
+
+  g_free (buf);
+}
+
+/* Converts an HSV triplet to an integer RGB triplet */
+static void
+get_color (gdouble h,
+           gdouble s,
+           gdouble v,
+           gint   *r,
+           gint   *g,
+           gint   *b)
+{
+  hsv_to_rgb (&h, &s, &v);
+
+  *r = floor (h * 255 + 0.5);
+  *g = floor (s * 255 + 0.5);
+  *b = floor (v * 255 + 0.5);
+}
+
+#define SWAP(a, b, t) ((t) = (a), (a) = (b), (b) = (t))
+
+#define LERP(a, b, v1, v2, i) (((v2) - (v1) != 0)                                       \
+                               ? ((a) + ((b) - (a)) * ((i) - (v1)) / ((v2) - (v1)))     \
+                               : (a))
+
+/* Number of pixels we extend out from the edges when creating
+ * color source to avoid artifacts
+ */
+#define PAD 3
+
+/* Paints the HSV triangle */
+static void
+paint_triangle (MateHSV  *hsv,
+                cairo_t  *cr,
+                gboolean  draw_focus)
+{
+  MateHSVPrivate *priv = hsv->priv;
+  GtkWidget *widget = GTK_WIDGET (hsv);
+  gint hx, hy, sx, sy, vx, vy; /* HSV vertices */
+  gint x1, y1, r1, g1, b1; /* First vertex in scanline order */
+  gint x2, y2, r2, g2, b2; /* Second vertex */
+  gint x3, y3, r3, g3, b3; /* Third vertex */
+  gint t;
+  guint32 *buf, *p, c;
+  gint xl, xr, rl, rr, gl, gr, bl, br; /* Scanline data */
+  gint xx, yy;
+  gint x_interp, y_interp;
+  gint x_start, x_end;
+  cairo_surface_t *source;
+  gdouble r, g, b;
+  gint stride;
+  int width, height;
+  GtkStyleContext *context;
+
+  width = gtk_widget_get_allocated_width (widget);
+  height = gtk_widget_get_allocated_height (widget);
+  /* Compute triangle's vertices */
+
+  compute_triangle (hsv, &hx, &hy, &sx, &sy, &vx, &vy);
+
+  x1 = hx;
+  y1 = hy;
+  get_color (priv->h, 1.0, 1.0, &r1, &g1, &b1);
+
+  x2 = sx;
+  y2 = sy;
+  get_color (priv->h, 1.0, 0.0, &r2, &g2, &b2);
+
+  x3 = vx;
+  y3 = vy;
+  get_color (priv->h, 0.0, 1.0, &r3, &g3, &b3);
+
+  if (y2 > y3)
+    {
+      SWAP (x2, x3, t);
+      SWAP (y2, y3, t);
+      SWAP (r2, r3, t);
+      SWAP (g2, g3, t);
+      SWAP (b2, b3, t);
+    }
+
+  if (y1 > y3)
+    {
+      SWAP (x1, x3, t);
+      SWAP (y1, y3, t);
+      SWAP (r1, r3, t);
+      SWAP (g1, g3, t);
+      SWAP (b1, b3, t);
+    }
+
+  if (y1 > y2)
+    {
+      SWAP (x1, x2, t);
+      SWAP (y1, y2, t);
+      SWAP (r1, r2, t);
+      SWAP (g1, g2, t);
+      SWAP (b1, b2, t);
+    }
+
+  /* Shade the triangle */
+
+  stride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, width);
+  buf = g_new (guint32, height * stride / 4);
+
+  for (yy = 0; yy < height; yy++)
+    {
+      p = buf + yy * width;
+
+      if (yy >= y1 - PAD && yy < y3 + PAD) {
+        y_interp = CLAMP (yy, y1, y3);
+
+        if (y_interp < y2)
+          {
+            xl = LERP (x1, x2, y1, y2, y_interp);
+
+            rl = LERP (r1, r2, y1, y2, y_interp);
+            gl = LERP (g1, g2, y1, y2, y_interp);
+            bl = LERP (b1, b2, y1, y2, y_interp);
+          }
+        else
+          {
+            xl = LERP (x2, x3, y2, y3, y_interp);
+
+            rl = LERP (r2, r3, y2, y3, y_interp);
+            gl = LERP (g2, g3, y2, y3, y_interp);
+            bl = LERP (b2, b3, y2, y3, y_interp);
+          }
+
+        xr = LERP (x1, x3, y1, y3, y_interp);
+
+        rr = LERP (r1, r3, y1, y3, y_interp);
+        gr = LERP (g1, g3, y1, y3, y_interp);
+        br = LERP (b1, b3, y1, y3, y_interp);
+
+        if (xl > xr)
+          {
+            SWAP (xl, xr, t);
+            SWAP (rl, rr, t);
+            SWAP (gl, gr, t);
+            SWAP (bl, br, t);
+          }
+
+        x_start = MAX (xl - PAD, 0);
+        x_end = MIN (xr + PAD, width);
+        x_start = MIN (x_start, x_end);
+
+        c = (rl << 16) | (gl << 8) | bl;
+
+        for (xx = 0; xx < x_start; xx++)
+          *p++ = c;
+
+        for (; xx < x_end; xx++)
+          {
+            x_interp = CLAMP (xx, xl, xr);
+
+            *p++ = ((LERP (rl, rr, xl, xr, x_interp) << 16) |
+                    (LERP (gl, gr, xl, xr, x_interp) << 8) |
+                    LERP (bl, br, xl, xr, x_interp));
+          }
+
+        c = (rr << 16) | (gr << 8) | br;
+
+        for (; xx < width; xx++)
+          *p++ = c;
+      }
+    }
+
+  source = cairo_image_surface_create_for_data ((unsigned char *)buf,
+                                                CAIRO_FORMAT_RGB24,
+                                                width, height, stride);
+
+  /* Draw a triangle with the image as a source */
+
+  cairo_set_source_surface (cr, source, 0, 0);
+  cairo_surface_destroy (source);
+
+  cairo_move_to (cr, x1, y1);
+  cairo_line_to (cr, x2, y2);
+  cairo_line_to (cr, x3, y3);
+  cairo_close_path (cr);
+  cairo_fill (cr);
+
+  g_free (buf);
+
+  /* Draw value marker */
+
+  xx = floor (sx + (vx - sx) * priv->v + (hx - vx) * priv->s * priv->v + 0.5);
+  yy = floor (sy + (vy - sy) * priv->v + (hy - vy) * priv->s * priv->v + 0.5);
+
+  r = priv->h;
+  g = priv->s;
+  b = priv->v;
+  hsv_to_rgb (&r, &g, &b);
+
+  context = gtk_widget_get_style_context (widget);
+
+  gtk_style_context_save (context);
+
+  if (INTENSITY (r, g, b) > 0.5)
+    {
+      gtk_style_context_add_class (context, "light-area-focus");
+      cairo_set_source_rgb (cr, 0., 0., 0.);
+    }
+  else
+    {
+      gtk_style_context_add_class (context, "dark-area-focus");
+      cairo_set_source_rgb (cr, 1., 1., 1.);
+    }
+
+#define RADIUS 4
+#define FOCUS_RADIUS 6
+
+  cairo_new_path (cr);
+  cairo_arc (cr, xx, yy, RADIUS, 0, 2 * G_PI);
+  cairo_stroke (cr);
+
+  /* Draw focus outline */
+
+  if (draw_focus && !priv->focus_on_ring)
+    {
+      gint focus_width;
+      gint focus_pad;
+
+      gtk_widget_style_get (widget,
+                            "focus-line-width", &focus_width,
+                            "focus-padding", &focus_pad,
+                            NULL);
+
+      gtk_render_focus (context, cr,
+                        xx - FOCUS_RADIUS - focus_width - focus_pad,
+                        yy - FOCUS_RADIUS - focus_width - focus_pad,
+                        2 * (FOCUS_RADIUS + focus_width + focus_pad),
+                        2 * (FOCUS_RADIUS + focus_width + focus_pad));
+    }
+
+  gtk_style_context_restore (context);
+}
+
+/* Paints the contents of the HSV color selector */
+static gboolean
+mate_hsv_draw (GtkWidget *widget,
+               cairo_t   *cr)
+{
+  MateHSV *hsv = MATE_HSV (widget);
+  MateHSVPrivate *priv = hsv->priv;
+  gboolean draw_focus;
+
+  draw_focus = gtk_widget_has_visible_focus (widget);
+
+  paint_ring (hsv, cr);
+  paint_triangle (hsv, cr, draw_focus);
+
+  if (draw_focus && priv->focus_on_ring)
+    {
+      GtkStyleContext *context;
+
+      context = gtk_widget_get_style_context (widget);
+
+      gtk_render_focus (context, cr, 0, 0,
+                        gtk_widget_get_allocated_width (widget),
+                        gtk_widget_get_allocated_height (widget));
+    }
+
+  return FALSE;
+}
+
+static gboolean
+mate_hsv_focus (GtkWidget       *widget,
+                GtkDirectionType dir)
+{
+  MateHSV *hsv = MATE_HSV (widget);
+  MateHSVPrivate *priv = hsv->priv;
+
+  if (!gtk_widget_has_focus (widget))
+    {
+      if (dir == GTK_DIR_TAB_BACKWARD)
+        priv->focus_on_ring = FALSE;
+      else
+        priv->focus_on_ring = TRUE;
+
+      gtk_widget_grab_focus (GTK_WIDGET (hsv));
+      return TRUE;
+    }
+
+  switch (dir)
+    {
+    case GTK_DIR_UP:
+      if (priv->focus_on_ring)
+        return FALSE;
+      else
+        priv->focus_on_ring = TRUE;
+      break;
+
+    case GTK_DIR_DOWN:
+      if (priv->focus_on_ring)
+        priv->focus_on_ring = FALSE;
+      else
+        return FALSE;
+      break;
+
+    case GTK_DIR_LEFT:
+    case GTK_DIR_TAB_BACKWARD:
+      if (priv->focus_on_ring)
+        return FALSE;
+      else
+        priv->focus_on_ring = TRUE;
+      break;
+
+    case GTK_DIR_RIGHT:
+    case GTK_DIR_TAB_FORWARD:
+      if (priv->focus_on_ring)
+        priv->focus_on_ring = FALSE;
+      else
+        return FALSE;
+      break;
+    }
+
+  gtk_widget_queue_draw (GTK_WIDGET (hsv));
+
+  return TRUE;
+}
+
+/**
+ * mate_hsv_new:
+ *
+ * Creates a new HSV color selector.
+ *
+ * Returns: A newly-created HSV color selector.
+ */
+GtkWidget*
+mate_hsv_new (void)
+{
+  return g_object_new (MATE_TYPE_HSV, NULL);
+}
+
+/**
+ * mate_hsv_set_color:
+ * @hsv: An HSV color selector
+ * @h: Hue
+ * @s: Saturation
+ * @v: Value
+ *
+ * Sets the current color in an HSV color selector.
+ * Color component values must be in the [0.0, 1.0] range.
+ */
+void
+mate_hsv_set_color (MateHSV *hsv,
+                    gdouble  h,
+                    gdouble  s,
+                    gdouble  v)
+{
+  MateHSVPrivate *priv;
+
+  g_return_if_fail (MATE_IS_HSV (hsv));
+  g_return_if_fail (h >= 0.0 && h <= 1.0);
+  g_return_if_fail (s >= 0.0 && s <= 1.0);
+  g_return_if_fail (v >= 0.0 && v <= 1.0);
+
+  priv = hsv->priv;
+
+  priv->h = h;
+  priv->s = s;
+  priv->v = v;
+
+  g_signal_emit (hsv, hsv_signals[CHANGED], 0);
+
+  gtk_widget_queue_draw (GTK_WIDGET (hsv));
+}
+
+/**
+ * mate_hsv_get_color:
+ * @hsv: An HSV color selector
+ * @h: (out): Return value for the hue
+ * @s: (out): Return value for the saturation
+ * @v: (out): Return value for the value
+ *
+ * Queries the current color in an HSV color selector.
+ * Returned values will be in the [0.0, 1.0] range.
+ */
+void
+mate_hsv_get_color (MateHSV *hsv,
+                    double  *h,
+                    double  *s,
+                    double  *v)
+{
+  MateHSVPrivate *priv;
+
+  g_return_if_fail (MATE_IS_HSV (hsv));
+
+  priv = hsv->priv;
+
+  if (h)
+    *h = priv->h;
+
+  if (s)
+    *s = priv->s;
+
+  if (v)
+    *v = priv->v;
+}
+
+/**
+ * mate_hsv_set_metrics:
+ * @hsv: An HSV color selector
+ * @size: Diameter for the hue ring
+ * @ring_width: Width of the hue ring
+ *
+ * Sets the size and ring width of an HSV color selector.
+ */
+void
+mate_hsv_set_metrics (MateHSV *hsv,
+                      gint     size,
+                      gint     ring_width)
+{
+  MateHSVPrivate *priv;
+  int same_size;
+
+  g_return_if_fail (MATE_IS_HSV (hsv));
+  g_return_if_fail (size > 0);
+  g_return_if_fail (ring_width > 0);
+  g_return_if_fail (2 * ring_width + 1 <= size);
+
+  priv = hsv->priv;
+
+  same_size = (priv->size == size);
+
+  priv->size = size;
+  priv->ring_width = ring_width;
+
+  if (same_size)
+    gtk_widget_queue_draw (GTK_WIDGET (hsv));
+  else
+    gtk_widget_queue_resize (GTK_WIDGET (hsv));
+}
+
+/**
+ * mate_hsv_get_metrics:
+ * @hsv: An HSV color selector
+ * @size: (out): Return value for the diameter of the hue ring
+ * @ring_width: (out): Return value for the width of the hue ring
+ *
+ * Queries the size and ring width of an HSV color selector.
+ */
+void
+mate_hsv_get_metrics (MateHSV *hsv,
+                      gint    *size,
+                      gint    *ring_width)
+{
+  MateHSVPrivate *priv;
+
+  g_return_if_fail (MATE_IS_HSV (hsv));
+
+  priv = hsv->priv;
+
+  if (size)
+    *size = priv->size;
+
+  if (ring_width)
+    *ring_width = priv->ring_width;
+}
+
+/**
+ * mate_hsv_is_adjusting:
+ * @hsv: A #MateHSV
+ *
+ * An HSV color selector can be said to be adjusting if multiple rapid
+ * changes are being made to its value, for example, when the user is
+ * adjusting the value with the mouse. This function queries whether
+ * the HSV color selector is being adjusted or not.
+ *
+ * Returns: %TRUE if clients can ignore changes to the color value,
+ *     since they may be transitory, or %FALSE if they should consider
+ *     the color value status to be final.
+ */
+gboolean
+mate_hsv_is_adjusting (MateHSV *hsv)
+{
+  MateHSVPrivate *priv;
+
+  g_return_val_if_fail (MATE_IS_HSV (hsv), FALSE);
+
+  priv = hsv->priv;
+
+  return priv->mode != DRAG_NONE;
+}
+
+static void
+mate_hsv_move (MateHSV         *hsv,
+               GtkDirectionType dir)
+{
+  MateHSVPrivate *priv = hsv->priv;
+  gdouble hue, sat, val;
+  gint hx, hy, sx, sy, vx, vy; /* HSV vertices */
+  gint x, y; /* position in triangle */
+
+  hue = priv->h;
+  sat = priv->s;
+  val = priv->v;
+
+  compute_triangle (hsv, &hx, &hy, &sx, &sy, &vx, &vy);
+
+  x = floor (sx + (vx - sx) * priv->v + (hx - vx) * priv->s * priv->v + 0.5);
+  y = floor (sy + (vy - sy) * priv->v + (hy - vy) * priv->s * priv->v + 0.5);
+
+#define HUE_DELTA 0.002
+  switch (dir)
+    {
+    case GTK_DIR_UP:
+      if (priv->focus_on_ring)
+        hue += HUE_DELTA;
+      else
+        {
+          y -= 1;
+          compute_sv (hsv, x, y, &sat, &val);
+        }
+      break;
+
+    case GTK_DIR_DOWN:
+      if (priv->focus_on_ring)
+        hue -= HUE_DELTA;
+      else
+        {
+          y += 1;
+          compute_sv (hsv, x, y, &sat, &val);
+        }
+      break;
+
+    case GTK_DIR_LEFT:
+      if (priv->focus_on_ring)
+        hue += HUE_DELTA;
+      else
+        {
+          x -= 1;
+          compute_sv (hsv, x, y, &sat, &val);
+        }
+      break;
+
+    case GTK_DIR_RIGHT:
+      if (priv->focus_on_ring)
+        hue -= HUE_DELTA
+          ;
+      else
+        {
+          x += 1;
+          compute_sv (hsv, x, y, &sat, &val);
+        }
+      break;
+
+    default:
+      /* we don't care about the tab directions */
+      break;
+    }
+
+  /* Wrap */
+  if (hue < 0.0)
+    hue = 1.0;
+  else if (hue > 1.0)
+    hue = 0.0;
+
+  mate_hsv_set_color (hsv, hue, sat, val);
+}
+
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/84.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/84.html new file mode 100644 index 00000000..7356463c --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/84.html @@ -0,0 +1,1341 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
/*
+ * Copyright (C) 2023 zhuyaliang.
+ *
+ * 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/>.
+ */
+
+#include "config.h"<--- Include file: "config.h" not found.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gstdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "mate-image-menu-item.h"
+
+struct _MateImageMenuItem
+{
+    GtkMenuItem  menu_item;
+    GtkWidget   *image;
+    gchar       *label;
+};
+
+enum {
+    PROP_0,
+    PROP_IMAGE,
+};
+
+G_DEFINE_TYPE (MateImageMenuItem, mate_image_menu_item, GTK_TYPE_MENU_ITEM)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
+
+static void
+mate_image_menu_item_destroy (GtkWidget *widget)
+{
+    MateImageMenuItem *image_menu_item = MATE_IMAGE_MENU_ITEM (widget);
+
+    if (image_menu_item->image)
+        gtk_container_remove (GTK_CONTAINER (image_menu_item),
+                              image_menu_item->image);
+
+    GTK_WIDGET_CLASS (mate_image_menu_item_parent_class)->destroy (widget);
+}
+
+static void
+mate_image_menu_item_get_preferred_width (GtkWidget *widget,
+                                          gint      *minimum,
+                                          gint      *natural)
+{
+    MateImageMenuItem *image_menu_item = MATE_IMAGE_MENU_ITEM (widget);
+    GtkPackDirection pack_dir;
+    GtkWidget *parent;
+
+    parent = gtk_widget_get_parent (widget);
+
+    if (GTK_IS_MENU_BAR (parent))
+        pack_dir = gtk_menu_bar_get_child_pack_direction (GTK_MENU_BAR (parent));
+    else
+        pack_dir = GTK_PACK_DIRECTION_LTR;
+
+    GTK_WIDGET_CLASS (mate_image_menu_item_parent_class)->get_preferred_width (widget, minimum, natural);
+
+    if ((pack_dir == GTK_PACK_DIRECTION_TTB || pack_dir == GTK_PACK_DIRECTION_BTT) &&
+        image_menu_item->image &&
+        gtk_widget_get_visible (image_menu_item->image))
+    {
+        gint child_minimum, child_natural;
+
+        gtk_widget_get_preferred_width (image_menu_item->image, &child_minimum, &child_natural);
+
+        *minimum = MAX (*minimum, child_minimum);
+        *natural = MAX (*natural, child_natural);
+    }
+}
+
+static void
+mate_image_menu_item_get_preferred_height (GtkWidget *widget,
+                                           gint      *minimum,
+                                           gint      *natural)
+{
+    MateImageMenuItem *image_menu_item = MATE_IMAGE_MENU_ITEM (widget);
+    gint child_height = 0;
+    GtkPackDirection pack_dir;
+    GtkWidget *parent;
+
+    parent = gtk_widget_get_parent (widget);
+
+    if (GTK_IS_MENU_BAR (parent))
+        pack_dir = gtk_menu_bar_get_child_pack_direction (GTK_MENU_BAR (parent));
+    else
+        pack_dir = GTK_PACK_DIRECTION_LTR;
+
+    if (image_menu_item->image && gtk_widget_get_visible (image_menu_item->image))
+    {
+        GtkRequisition child_requisition;
+
+        gtk_widget_get_preferred_size (image_menu_item->image, &child_requisition, NULL);
+
+        child_height = child_requisition.height;
+    }
+
+    GTK_WIDGET_CLASS (mate_image_menu_item_parent_class)->get_preferred_height (widget, minimum, natural);
+
+    if (pack_dir == GTK_PACK_DIRECTION_RTL || pack_dir == GTK_PACK_DIRECTION_LTR)
+    {
+        *minimum = MAX (*minimum, child_height);
+        *natural = MAX (*natural, child_height);
+    }
+}
+
+static void
+mate_image_menu_item_get_preferred_height_for_width (GtkWidget *widget,
+                                                     gint       width,
+                                                     gint      *minimum,
+                                                     gint      *natural)
+{
+    MateImageMenuItem *image_menu_item = MATE_IMAGE_MENU_ITEM (widget);
+    gint child_height = 0;
+    GtkPackDirection pack_dir;
+    GtkWidget *parent;
+
+    parent = gtk_widget_get_parent (widget);
+
+    if (GTK_IS_MENU_BAR (parent))
+        pack_dir = gtk_menu_bar_get_child_pack_direction (GTK_MENU_BAR (parent));
+    else
+        pack_dir = GTK_PACK_DIRECTION_LTR;
+
+    if (image_menu_item->image && gtk_widget_get_visible (image_menu_item->image))
+    {
+        GtkRequisition child_requisition;
+
+        gtk_widget_get_preferred_size (image_menu_item->image, &child_requisition, NULL);
+
+        child_height = child_requisition.height;
+    }
+
+    GTK_WIDGET_CLASS (mate_image_menu_item_parent_class)->get_preferred_height_for_width (widget, width, minimum, natural);
+
+    if (pack_dir == GTK_PACK_DIRECTION_RTL || pack_dir == GTK_PACK_DIRECTION_LTR)
+    {
+        *minimum = MAX (*minimum, child_height);
+        *natural = MAX (*natural, child_height);
+    }
+}
+
+static void
+mate_image_menu_item_size_allocate (GtkWidget     *widget,
+                                    GtkAllocation *allocation)
+{
+    MateImageMenuItem *image_menu_item = MATE_IMAGE_MENU_ITEM (widget);
+    GtkAllocation widget_allocation;
+    GtkRequisition image_requisition;
+    GtkPackDirection pack_dir;
+    GtkTextDirection text_dir;
+    GtkAllocation image_allocation;
+    GtkStyleContext *context;
+    GtkStateFlags state;
+    GtkBorder padding;
+    GtkWidget *parent;
+    gint toggle_size;
+    gint x;
+    gint y;
+
+    parent = gtk_widget_get_parent (widget);
+
+    if (GTK_IS_MENU_BAR (parent))
+        pack_dir = gtk_menu_bar_get_child_pack_direction (GTK_MENU_BAR (parent));
+    else
+        pack_dir = GTK_PACK_DIRECTION_LTR;
+
+    GTK_WIDGET_CLASS (mate_image_menu_item_parent_class)->size_allocate (widget, allocation);
+
+    if (!image_menu_item->image || !gtk_widget_get_visible (image_menu_item->image))
+        return;
+
+    gtk_widget_get_allocation (widget, &widget_allocation);
+    gtk_widget_get_preferred_size (image_menu_item->image, &image_requisition, NULL);
+
+    context = gtk_widget_get_style_context (widget);
+    state = gtk_style_context_get_state (context);
+    gtk_style_context_get_padding (context, state, &padding);
+
+    toggle_size = 0;
+    gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (image_menu_item), &toggle_size);
+
+    text_dir = gtk_widget_get_direction (widget);
+
+    if (pack_dir == GTK_PACK_DIRECTION_LTR || pack_dir == GTK_PACK_DIRECTION_RTL)
+    {
+        if ((text_dir == GTK_TEXT_DIR_LTR) == (pack_dir == GTK_PACK_DIRECTION_LTR))
+        {
+            x = padding.left + (toggle_size - image_requisition.width) / 2;
+        }
+        else
+        {
+            x = widget_allocation.width - padding.right - toggle_size +
+                (toggle_size - image_requisition.width) / 2;
+        }
+
+        y = (widget_allocation.height - image_requisition.height) / 2;
+    }
+    else
+    {
+        if ((text_dir == GTK_TEXT_DIR_LTR) == (pack_dir == GTK_PACK_DIRECTION_TTB))
+        {
+            y = padding.top + (toggle_size - image_requisition.height) / 2;
+        }
+        else
+        {
+            y = widget_allocation.height - padding.bottom - toggle_size +
+                (toggle_size - image_requisition.height) / 2;
+        }
+
+        x = (widget_allocation.width - image_requisition.width) / 2;
+    }
+
+    image_allocation.x = widget_allocation.x + MAX (0, x);
+    image_allocation.y = widget_allocation.y + MAX (0, y);
+    image_allocation.width = image_requisition.width;
+    image_allocation.height = image_requisition.height;
+
+    gtk_widget_size_allocate (image_menu_item->image, &image_allocation);
+}
+
+static void
+mate_image_menu_item_add (GtkContainer *container,
+                          GtkWidget    *widget)
+{
+    GTK_CONTAINER_CLASS (mate_image_menu_item_parent_class)->add (container, widget);
+}
+
+static void
+mate_image_menu_item_forall (GtkContainer   *container,
+                             gboolean        include_internals,
+                             GtkCallback     callback,
+                             gpointer        callback_data)
+{
+    MateImageMenuItem *image_menu_item = MATE_IMAGE_MENU_ITEM (container);
+
+    GTK_CONTAINER_CLASS (mate_image_menu_item_parent_class)->forall (container,
+                                                                     include_internals,
+                                                                     callback,
+                                                                     callback_data);
+
+    if (include_internals && image_menu_item->image)
+        (* callback) (image_menu_item->image, callback_data);
+}
+
+static void
+mate_image_menu_item_remove (GtkContainer *container,
+                             GtkWidget    *child)
+{
+    MateImageMenuItem *image_menu_item = MATE_IMAGE_MENU_ITEM (container);
+
+    if (child == image_menu_item->image)
+    {
+        gboolean widget_was_visible;
+
+        widget_was_visible = gtk_widget_get_visible (child);
+
+        gtk_widget_unparent (child);
+        image_menu_item->image = NULL;
+
+        if (widget_was_visible &&
+            gtk_widget_get_visible (GTK_WIDGET (container)))
+            gtk_widget_queue_resize (GTK_WIDGET (container));
+
+        g_object_notify (G_OBJECT (image_menu_item), "image");
+    }
+    else
+    {
+        GTK_CONTAINER_CLASS (mate_image_menu_item_parent_class)->remove (container, child);
+    }
+}
+
+static void
+mate_image_menu_item_toggle_size_request (GtkMenuItem *menu_item,
+                                          gint        *requisition)
+{
+    MateImageMenuItem *image_menu_item = MATE_IMAGE_MENU_ITEM (menu_item);
+    GtkPackDirection pack_dir;
+    GtkWidget *parent;
+    GtkWidget *widget = GTK_WIDGET (menu_item);
+
+    parent = gtk_widget_get_parent (widget);
+
+    if (GTK_IS_MENU_BAR (parent))
+        pack_dir = gtk_menu_bar_get_child_pack_direction (GTK_MENU_BAR (parent));
+    else
+        pack_dir = GTK_PACK_DIRECTION_LTR;
+
+    *requisition = 0;
+
+    if (image_menu_item->image && gtk_widget_get_visible (image_menu_item->image))
+    {
+        GtkRequisition image_requisition;
+        guint toggle_spacing;
+
+        gtk_widget_get_preferred_size (image_menu_item->image, &image_requisition, NULL);
+
+        gtk_widget_style_get (GTK_WIDGET (menu_item),
+                             "toggle-spacing", &toggle_spacing,
+                              NULL);
+
+        if (pack_dir == GTK_PACK_DIRECTION_LTR || pack_dir == GTK_PACK_DIRECTION_RTL)
+        {
+            if (image_requisition.width > 0)
+              *requisition = image_requisition.width + toggle_spacing;
+        }
+        else
+        {
+            if (image_requisition.height > 0)
+              *requisition = image_requisition.height + toggle_spacing;
+        }
+    }
+}
+
+static void
+mate_image_menu_item_set_label (GtkMenuItem *menu_item,
+                                const gchar *label)
+{
+    MateImageMenuItem *image_menu_item = MATE_IMAGE_MENU_ITEM (menu_item);
+
+    if (image_menu_item->label != label)
+    {
+        g_free (image_menu_item->label);
+        image_menu_item->label = g_strdup (label);
+        GTK_MENU_ITEM_CLASS (mate_image_menu_item_parent_class)->set_label (menu_item, label);
+        g_object_notify (G_OBJECT (menu_item), "label");
+    }
+}
+
+static const gchar *
+mate_image_menu_item_get_label (GtkMenuItem *menu_item)
+{
+    MateImageMenuItem *image_menu_item = MATE_IMAGE_MENU_ITEM (menu_item);
+
+    return image_menu_item->label;
+}
+
+static void
+mate_image_menu_item_finalize (GObject *object)
+{
+    MateImageMenuItem *image_menu_item = MATE_IMAGE_MENU_ITEM (object);
+
+    g_free (image_menu_item->label);
+    image_menu_item->label  = NULL;
+
+    G_OBJECT_CLASS (mate_image_menu_item_parent_class)->finalize (object);
+}
+
+static void
+mate_image_menu_item_set_property (GObject      *object,
+                                   guint         prop_id,
+                                   const GValue *value,
+                                   GParamSpec   *pspec)
+{
+    MateImageMenuItem *image_menu_item = MATE_IMAGE_MENU_ITEM (object);
+
+    switch (prop_id)
+    {
+        case PROP_IMAGE:
+            mate_image_menu_item_set_image (image_menu_item, (GtkWidget *) g_value_get_object (value));
+            break;
+
+        default:
+            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+            break;
+    }
+}
+
+static void
+mate_image_menu_item_get_property (GObject    *object,
+                                   guint       prop_id,
+                                   GValue     *value,
+                                   GParamSpec *pspec)
+{
+    MateImageMenuItem *image_menu_item = MATE_IMAGE_MENU_ITEM (object);
+
+    switch (prop_id)
+    {
+        case PROP_IMAGE:
+            g_value_set_object (value, mate_image_menu_item_get_image (image_menu_item));
+            break;
+        default:
+            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+            break;
+    }
+}
+
+static void
+mate_image_menu_item_class_init (MateImageMenuItemClass *class)
+{
+    GObjectClass *gobject_class = (GObjectClass*) class;
+    GtkWidgetClass *widget_class = (GtkWidgetClass*) class;
+    GtkMenuItemClass *menu_item_class = (GtkMenuItemClass*) class;
+    GtkContainerClass *container_class = (GtkContainerClass*) class;
+
+    widget_class->destroy = mate_image_menu_item_destroy;
+    widget_class->get_preferred_width = mate_image_menu_item_get_preferred_width;
+    widget_class->get_preferred_height = mate_image_menu_item_get_preferred_height;
+    widget_class->get_preferred_height_for_width = mate_image_menu_item_get_preferred_height_for_width;
+    widget_class->size_allocate = mate_image_menu_item_size_allocate;
+
+    container_class->add    = mate_image_menu_item_add;
+    container_class->forall = mate_image_menu_item_forall;
+    container_class->remove = mate_image_menu_item_remove;
+
+    menu_item_class->toggle_size_request = mate_image_menu_item_toggle_size_request;
+    menu_item_class->set_label           = mate_image_menu_item_set_label;
+    menu_item_class->get_label           = mate_image_menu_item_get_label;
+
+    gobject_class->finalize     = mate_image_menu_item_finalize;
+    gobject_class->set_property = mate_image_menu_item_set_property;
+    gobject_class->get_property = mate_image_menu_item_get_property;
+
+  /**
+   * MateImageMenuItem:image:
+   *
+   * Child widget to appear next to the menu text.
+   *
+   */
+    g_object_class_install_property (gobject_class,
+                                     PROP_IMAGE,
+                                     g_param_spec_object ("image",
+                                                          _("Image widget"),
+                                                          _("Child widget to appear next to the menu text"),
+                                                          GTK_TYPE_WIDGET,
+                                                          G_PARAM_READWRITE | G_PARAM_DEPRECATED));
+}
+
+static void
+mate_image_menu_item_init (MateImageMenuItem *image_menu_item)
+{
+    image_menu_item->image = NULL;
+    image_menu_item->label  = NULL;
+}
+
+/**
+ * mate_image_menu_item_new:
+ *
+ * Creates a new #MateImageMenuItem with an empty label.
+ *
+ * Returns: a new #MateImageMenuItem
+ *
+ */
+GtkWidget*
+mate_image_menu_item_new (void)
+{
+    return g_object_new (MATE_TYPE_IMAGE_MENU_ITEM, NULL);
+}
+
+/**
+ * mate_image_menu_item_new_with_label:
+ * @label: the text of the menu item.
+ *
+ * Creates a new #MateImageMenuItem containing a label.
+ *
+ * Returns: a new #MateImageMenuItem.
+ *
+ */
+GtkWidget*
+mate_image_menu_item_new_with_label (const gchar *label)
+{
+    return g_object_new (MATE_TYPE_IMAGE_MENU_ITEM,
+                         "label", label,
+                         NULL);
+}
+
+/**
+ * mate_image_menu_item_new_with_mnemonic:
+ * @label: the text of the menu item, with an underscore in front of the
+ *         mnemonic character
+ *
+ * Creates a new #MateImageMenuItem containing a label. The label
+ * will be created using gtk_label_new_with_mnemonic(), so underscores
+ * in @label indicate the mnemonic for the menu item.
+ *
+ * Returns: a new #MateImageMenuItem
+ *
+ */
+GtkWidget*
+mate_image_menu_item_new_with_mnemonic (const gchar *label)
+{
+    return g_object_new (MATE_TYPE_IMAGE_MENU_ITEM,
+                         "use-underline", TRUE,
+                         "label", label,
+                         NULL);
+}
+
+/**
+ * mate_image_menu_item_set_image:
+ * @image_menu_item: a #MateImageMenuItem.
+ * @image: (allow-none): a widget to set as the image for the menu item.
+ *
+ * Sets the image of @image_menu_item to the given widget.
+ * Note that it depends on the show-menu-images setting whether
+ * the image will be displayed or not.
+ *
+ */
+void
+mate_image_menu_item_set_image (MateImageMenuItem *image_menu_item,
+                                GtkWidget         *image)
+{
+    g_return_if_fail (MATE_IS_IMAGE_MENU_ITEM (image_menu_item));
+
+    if (image == image_menu_item->image)
+        return;
+
+    if (image_menu_item->image)
+        gtk_container_remove (GTK_CONTAINER (image_menu_item),
+                              image_menu_item->image);
+
+    image_menu_item->image = image;
+
+    if (image == NULL)
+        return;
+
+    gtk_widget_set_parent (image, GTK_WIDGET (image_menu_item));
+    g_object_set (image,
+                  "visible", TRUE,
+                  "no-show-all", TRUE,
+                  NULL);
+    gtk_image_set_pixel_size (GTK_IMAGE (image), 16);
+
+    g_object_notify (G_OBJECT (image_menu_item), "image");
+}
+
+/**
+ * mate_image_menu_item_get_image:
+ * @image_menu_item: a #MateImageMenuItem
+ *
+ * Gets the widget that is currently set as the image of @image_menu_item.
+ * See mate_image_menu_item_set_image().
+ *
+ * Returns: (transfer none): the widget set as image of @image_menu_item
+ *
+ **/
+GtkWidget*
+mate_image_menu_item_get_image (MateImageMenuItem *image_menu_item)
+{
+    g_return_val_if_fail (MATE_IS_IMAGE_MENU_ITEM (image_menu_item), NULL);
+
+    return image_menu_item->image;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/85.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/85.html new file mode 100644 index 00000000..aabae452 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/85.html @@ -0,0 +1,321 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
/*
+ * Copyright (C) 2023 zhuyaliang.
+ *
+ * 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/>.
+ */
+
+#ifndef __MATE_IMAGE_MENU_ITEM_H__
+#define __MATE_IMAGE_MENU_ITEM_H__
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define MATE_TYPE_IMAGE_MENU_ITEM            (mate_image_menu_item_get_type ())
+
+G_DECLARE_FINAL_TYPE (MateImageMenuItem, mate_image_menu_item, MATE, IMAGE_MENU_ITEM, GtkMenuItem);
+
+GtkWidget* mate_image_menu_item_new               (void);
+
+GtkWidget* mate_image_menu_item_new_with_label    (const gchar       *label);
+
+GtkWidget* mate_image_menu_item_new_with_mnemonic (const gchar       *label);
+
+void       mate_image_menu_item_set_image         (MateImageMenuItem *image_menu_item,
+                                                   GtkWidget         *image);
+
+GtkWidget* mate_image_menu_item_get_image         (MateImageMenuItem *image_menu_item);
+
+G_END_DECLS
+
+#endif /* __GTK_IMAGE_MENU_ITEM_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/86.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/86.html new file mode 100644 index 00000000..bc581e7c --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/86.html @@ -0,0 +1,2915 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright 2008  Red Hat, Inc,
+ *           2007  William Jon McCann <mccann@jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Written by : William Jon McCann <mccann@jhu.edu>
+ *              Ray Strode <rstrode@redhat.com>
+ */
+
+#include "config.h"<--- Include file: "config.h" not found.
+
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <errno.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <dirent.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <locale.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <langinfo.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/stat.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gstdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define MATE_DESKTOP_USE_UNSTABLE_API
+#include "mate-languages.h"
+
+#include <langinfo.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#ifndef __LC_LAST
+#define __LC_LAST       13
+#endif
+
+#define ISO_CODES_DATADIR ISO_CODES_PREFIX "/share/xml/iso-codes"
+#define ISO_CODES_LOCALESDIR ISO_CODES_PREFIX "/share/locale"
+
+typedef struct _MateLocale {
+        char *id;
+        char *name;
+        char *language_code;
+        char *territory_code;
+        char *codeset;
+        char *modifier;
+} MateLocale;
+
+static GHashTable *mate_languages_map;
+static GHashTable *mate_territories_map;
+static GHashTable *mate_available_locales_map;
+static GHashTable *mate_language_count_map;
+static GHashTable *mate_territory_count_map;
+
+static char * construct_language_name (const char *language,
+                                       const char *territory,
+                                       const char *codeset,
+                                       const char *modifier);
+
+static gboolean language_name_is_valid (const char *language_name);
+
+static void
+mate_locale_free (MateLocale *locale)
+{
+        if (locale == NULL) {
+                return;
+        }
+
+        g_free (locale->id);
+        g_free (locale->name);
+        g_free (locale->codeset);
+        g_free (locale->modifier);
+        g_free (locale->language_code);
+        g_free (locale->territory_code);
+        g_free (locale);
+}
+
+static char *
+normalize_codeset (const char *codeset)
+{
+        if (codeset == NULL)
+                return NULL;
+
+        if (g_str_equal (codeset, "UTF-8") ||
+            g_str_equal (codeset, "utf8"))
+                return g_strdup ("UTF-8");
+
+        return g_strdup (codeset);
+}
+
+/**
+ * mate_parse_locale:
+ * @locale: a locale string
+ * @language_codep: (out) (allow-none) (transfer full): location to
+ * store the language code, or %NULL
+ * @country_codep: (out) (allow-none) (transfer full): location to
+ * store the country code, or %NULL
+ * @codesetp: (out) (allow-none) (transfer full): location to
+ * store the codeset, or %NULL
+ * @modifierp: (out) (allow-none) (transfer full): location to
+ * store the modifier, or %NULL
+ *
+ * Extracts the various components of a locale string of the form
+ * [language[_country][.codeset][@modifier]]. See
+ * http://en.wikipedia.org/wiki/Locale.
+ *
+ * Return value: %TRUE if parsing was successful.
+ *
+ * Since: 1.22
+ */
+gboolean
+mate_parse_locale (const char *locale,
+                    char      **language_codep,
+                    char      **country_codep,
+                    char      **codesetp,
+                    char      **modifierp)
+{
+        static GRegex *re = NULL;
+        GMatchInfo *match_info;
+        gboolean    res;
+        gchar      *normalized_codeset = NULL;
+        gchar      *normalized_name = NULL;
+        gboolean    retval;
+
+        match_info = NULL;
+        retval = FALSE;
+
+        if (re == NULL) {
+                GError *error = NULL;
+                re = g_regex_new ("^(?P<language>[^_.@[:space:]]+)"
+                                  "(_(?P<territory>[[:upper:]]+))?"
+                                  "(\\.(?P<codeset>[-_0-9a-zA-Z]+))?"
+                                  "(@(?P<modifier>[[:ascii:]]+))?$",
+                                  0, 0, &error);
+                if (re == NULL) {
+                        g_warning ("%s", error->message);
+                        g_error_free (error);
+                        goto out;
+                }
+        }
+
+        if (!g_regex_match (re, locale, 0, &match_info) ||
+            g_match_info_is_partial_match (match_info)) {
+                g_warning ("locale '%s' isn't valid\n", locale);
+                goto out;
+        }
+
+        res = g_match_info_matches (match_info);
+        if (! res) {
+                g_warning ("Unable to parse locale: %s", locale);
+                goto out;
+        }
+
+        retval = TRUE;
+
+        if (language_codep != NULL) {
+                *language_codep = g_match_info_fetch_named (match_info, "language");
+        }
+
+        if (country_codep != NULL) {
+                *country_codep = g_match_info_fetch_named (match_info, "territory");
+
+                if (*country_codep != NULL &&
+                    *country_codep[0] == '\0') {
+                        g_free (*country_codep);
+                        *country_codep = NULL;
+                }
+        }
+
+        if (codesetp != NULL) {
+                *codesetp = g_match_info_fetch_named (match_info, "codeset");
+
+                if (*codesetp != NULL &&
+                    *codesetp[0] == '\0') {
+                        g_free (*codesetp);
+                        *codesetp = NULL;
+                }
+        }
+
+        if (modifierp != NULL) {
+                *modifierp = g_match_info_fetch_named (match_info, "modifier");
+
+                if (*modifierp != NULL &&
+                    *modifierp[0] == '\0') {
+                        g_free (*modifierp);
+                        *modifierp = NULL;
+                }
+        }
+
+        if (codesetp != NULL && *codesetp != NULL) {
+                normalized_codeset = normalize_codeset (*codesetp);
+                normalized_name = construct_language_name (language_codep ? *language_codep : NULL,
+                                                           country_codep ? *country_codep : NULL,
+                                                           normalized_codeset,
+                                                           modifierp ? *modifierp : NULL);
+
+                if (language_name_is_valid (normalized_name)) {
+                        g_free (*codesetp);
+                        *codesetp = normalized_codeset;
+                } else {
+                        g_free (normalized_codeset);
+                }
+                g_free (normalized_name);
+        }
+
+ out:
+        g_match_info_free (match_info);
+
+        return retval;
+}
+
+static char *
+construct_language_name (const char *language,
+                         const char *territory,
+                         const char *codeset,
+                         const char *modifier)
+{
+        char *name;
+
+        g_assert (language != NULL && language[0] != 0);
+        g_assert (territory == NULL || territory[0] != 0);
+        g_assert (codeset == NULL || codeset[0] != 0);
+        g_assert (modifier == NULL || modifier[0] != 0);
+
+        name = g_strdup_printf ("%s%s%s%s%s%s%s",
+                                language,
+                                territory != NULL? "_" : "",
+                                territory != NULL? territory : "",
+                                codeset != NULL? "." : "",
+                                codeset != NULL? codeset : "",
+                                modifier != NULL? "@" : "",
+                                modifier != NULL? modifier : "");
+
+        return name;
+}
+
+/**
+ * mate_normalize_locale:
+ * @locale: a locale string
+ *
+ * Gets the normalized locale string in the form
+ * [language[_country][.codeset][@modifier]] for @name.
+ *
+ * Return value: (transfer full): normalized locale string. Caller
+ * takes ownership.
+ *
+ * Since: 1.22
+ */
+char *
+mate_normalize_locale (const char *locale)
+{
+        char *normalized_name;
+        gboolean valid;
+        g_autofree char *language_code = NULL;
+        g_autofree char *territory_code = NULL;
+        g_autofree char *codeset = NULL;
+        g_autofree char *modifier = NULL;
+
+        if (locale[0] == '\0') {
+                return NULL;
+        }
+
+        valid = mate_parse_locale (locale,
+                                    &language_code,
+                                    &territory_code,
+                                    &codeset, &modifier);
+        if (!valid)
+                return NULL;
+
+        normalized_name = construct_language_name (language_code,
+                                                   territory_code,
+                                                   codeset, modifier);
+        return normalized_name;
+}
+
+static gboolean
+language_name_is_valid (const char *language_name)
+{
+        gboolean  is_valid;
+        int lc_type_id = LC_MESSAGES;
+        g_autofree char *old_locale = NULL;
+
+        old_locale = g_strdup (setlocale (lc_type_id, NULL));
+        is_valid = setlocale (lc_type_id, language_name) != NULL;
+        setlocale (lc_type_id, old_locale);
+
+        return is_valid;
+}
+
+static void
+language_name_get_codeset_details (const char  *language_name,
+                                   char       **pcodeset,
+                                   gboolean    *is_utf8)
+{
+        g_autofree char *old_locale = NULL;
+        g_autofree char *codeset = NULL;
+
+        old_locale = g_strdup (setlocale (LC_CTYPE, NULL));
+
+        if (setlocale (LC_CTYPE, language_name) == NULL)
+                return;
+
+        codeset = nl_langinfo (CODESET);
+
+        if (pcodeset != NULL) {
+                *pcodeset = g_strdup (codeset);
+        }
+
+        if (is_utf8 != NULL) {
+                codeset = normalize_codeset (codeset);
+
+                *is_utf8 = strcmp (codeset, "UTF-8") == 0;
+        }
+
+        setlocale (LC_CTYPE, old_locale);
+}
+
+static gboolean
+locale_dir_has_mo_files (const gchar* path)
+{
+        GDir        *dir;
+        const char  *name;
+        gboolean     has_translations;
+
+        has_translations = FALSE;
+        dir = g_dir_open (path, 0, NULL);
+
+        if (dir == NULL) {
+                goto out;
+        }
+
+        do {
+                name = g_dir_read_name (dir);
+
+                if (name == NULL) {
+                        break;
+                }
+
+                if (g_str_has_suffix (name, ".mo")) {
+                        has_translations = TRUE;
+                        break;
+                }
+        } while (name != NULL);
+        g_dir_close (dir);
+
+ out:
+        return has_translations;
+}
+
+/**
+ * mate_language_has_translations:
+ * @code: an ISO 639 code string
+ *
+ * Returns %TRUE if there are translations for language @code.
+ *
+ * Return value: %TRUE if there are translations for language @code.
+ *
+ * Since: 1.22
+ */
+gboolean
+mate_language_has_translations (const char *code)
+{
+        gboolean has_translations;
+        gchar *path;
+
+        path = g_build_filename (MATELOCALEDIR, code, "LC_MESSAGES", NULL);
+        has_translations = locale_dir_has_mo_files (path);
+
+        if (!has_translations) {
+                const char * const *system_data_dirs;
+                int i = 0;
+
+                system_data_dirs = g_get_system_data_dirs ();
+                while ((system_data_dirs[i] != NULL) && (has_translations == FALSE)) {
+                        g_free (path);
+                        path = g_build_filename (system_data_dirs[i], "locale", code, "LC_MESSAGES", NULL);
+                        has_translations = locale_dir_has_mo_files (path);
+                        ++i;
+                }
+        }
+
+        g_free (path);
+        return has_translations;
+}
+
+static gboolean
+add_locale (const char *language_name,
+            gboolean    utf8_only)
+{
+        MateLocale *locale;
+        MateLocale *old_locale;<--- Variable 'old_locale' can be declared as pointer to const
+        g_autofree char *name = NULL;
+        gboolean   is_utf8 = FALSE;
+        gboolean   valid = FALSE;
+
+        g_return_val_if_fail (language_name != NULL, FALSE);
+        g_return_val_if_fail (*language_name != '\0', FALSE);
+
+        language_name_get_codeset_details (language_name, NULL, &is_utf8);
+
+        if (is_utf8) {
+                name = g_strdup (language_name);
+        } else if (utf8_only) {
+
+                if (strchr (language_name, '.'))
+                        return FALSE;
+
+                /* If the locale name has no dot, assume that its
+                 * encoding part is missing and try again after adding
+                 * ".UTF-8". This catches locale names like "de_DE".
+                 */
+                name = g_strdup_printf ("%s.UTF-8", language_name);
+
+                language_name_get_codeset_details (name, NULL, &is_utf8);
+                if (!is_utf8)
+                        return FALSE;
+        } else {
+                name = g_strdup (language_name);
+        }
+
+        if (!language_name_is_valid (name)) {
+                g_debug ("Ignoring '%s' as a locale, since it's invalid", name);
+                return FALSE;
+        }
+
+        locale = g_new0 (MateLocale, 1);
+        valid = mate_parse_locale (name,
+                                    &locale->language_code,
+                                    &locale->territory_code,
+                                    &locale->codeset,
+                                    &locale->modifier);
+        if (!valid) {
+                mate_locale_free (locale);
+                return FALSE;
+        }
+
+        locale->id = construct_language_name (locale->language_code, locale->territory_code,
+                                              NULL, locale->modifier);
+        locale->name = construct_language_name (locale->language_code, locale->territory_code,
+                                                locale->codeset, locale->modifier);
+
+        if (!mate_language_has_translations (locale->name) &&
+            !mate_language_has_translations (locale->id) &&
+            !mate_language_has_translations (locale->language_code) &&
+            utf8_only) {
+                g_debug ("Ignoring '%s' as a locale, since it lacks translations", locale->name);
+                mate_locale_free (locale);
+                return FALSE;
+        }
+
+        if (!utf8_only) {
+                g_free (locale->id);
+                locale->id = g_strdup (locale->name);
+        }
+
+        old_locale = g_hash_table_lookup (mate_available_locales_map, locale->id);
+        if (old_locale != NULL) {
+                if (strlen (old_locale->name) > strlen (locale->name)) {
+                        mate_locale_free (locale);
+                        return FALSE;
+                }
+        }
+
+        g_hash_table_insert (mate_available_locales_map, g_strdup (locale->id), locale);
+
+        return TRUE;
+}
+
+static int
+select_dirs (const struct dirent *dirent)
+{
+        int result = 0;
+
+        if (strcmp (dirent->d_name, ".") != 0 && strcmp (dirent->d_name, "..") != 0) {
+                mode_t mode = 0;
+
+#ifdef _DIRENT_HAVE_D_TYPE
+                if (dirent->d_type != DT_UNKNOWN && dirent->d_type != DT_LNK) {
+                        mode = DTTOIF (dirent->d_type);
+                } else
+#endif
+                        {
+                                struct stat st;
+                                g_autofree char *path = NULL;
+
+                                path = g_build_filename (MATELOCALEDIR, dirent->d_name, NULL);
+                                if (g_stat (path, &st) == 0) {
+                                        mode = st.st_mode;
+                                }
+                        }
+
+                result = S_ISDIR (mode);
+        }
+
+        return result;
+}
+
+static gboolean
+collect_locales_from_directory (void)
+{
+        gboolean found_locales = FALSE;
+        struct dirent **dirents;
+        int             ndirents;
+        int             cnt;
+
+        ndirents = scandir (MATELOCALEDIR, &dirents, select_dirs, alphasort);
+
+        for (cnt = 0; cnt < ndirents; ++cnt) {
+                if (add_locale (dirents[cnt]->d_name, TRUE))
+                        found_locales = TRUE;
+        }
+
+        if (ndirents > 0) {
+                free (dirents);
+        }
+        return found_locales;
+}
+
+static gboolean
+collect_locales_from_localebin (void)
+{
+        gboolean found_locales = FALSE;
+        const gchar *argv[] = { "locale", "-a", NULL };
+        gchar **linep;
+        g_auto (GStrv) lines = NULL;
+        g_autofree gchar *output = NULL;
+
+        if (g_spawn_sync (NULL, (gchar **) argv, NULL,
+                          G_SPAWN_SEARCH_PATH|G_SPAWN_STDERR_TO_DEV_NULL,
+                          NULL, NULL, &output, NULL, NULL, NULL) == FALSE)
+                return FALSE;
+
+        g_return_val_if_fail (output != NULL, FALSE);
+
+        lines = g_strsplit (output, "\n", 0);
+        if (lines) {
+                linep = lines;
+                while (*linep) {
+                        if (*linep[0] && add_locale (*linep, TRUE))
+                                found_locales = TRUE;
+                        linep++;
+                }
+        }
+
+        return found_locales;
+}
+
+static void
+fill_count_map (GHashTable *count_map,
+                const char *code)
+{
+        int count;
+        gpointer pointer;
+
+        if (code == NULL)
+                return;
+
+        if ((pointer = g_hash_table_lookup (count_map, code)) != NULL)
+                count = GPOINTER_TO_INT (pointer) + 1;
+        else
+                count = 1;
+
+        g_hash_table_insert (count_map, g_strdup (code), GINT_TO_POINTER (count));
+}
+
+static void
+count_languages_and_territories (void)
+{
+	gpointer value;
+	GHashTableIter iter;
+
+	mate_language_count_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+	mate_territory_count_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+        g_hash_table_iter_init (&iter, mate_available_locales_map);
+        while (g_hash_table_iter_next (&iter, NULL, &value)) {
+                MateLocale *locale = (MateLocale *) value;<--- Variable 'locale' can be declared as pointer to const
+                fill_count_map (mate_language_count_map, locale->language_code);
+                fill_count_map (mate_territory_count_map, locale->territory_code);
+        }
+}
+
+static void
+collect_locales (void)
+{
+        gboolean found_localebin_locales = FALSE;
+        gboolean found_dir_locales = FALSE;
+
+        if (mate_available_locales_map == NULL) {
+                mate_available_locales_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) mate_locale_free);
+        }
+
+        found_localebin_locales = collect_locales_from_localebin ();
+
+        found_dir_locales = collect_locales_from_directory ();
+
+        if (!(found_localebin_locales || found_dir_locales)) {
+                g_warning ("Could not read list of available locales from libc, "
+                           "guessing possible locales from available translations, "
+                           "but list may be incomplete!");
+        }
+
+	count_languages_and_territories ();
+}
+
+static gint
+get_language_count (const char *language)
+{
+        gint count = 0;
+        gpointer pointer;
+
+        if (mate_language_count_map == NULL)
+                collect_locales ();
+
+        if ((pointer = g_hash_table_lookup (mate_language_count_map, language)) != NULL)
+                count = GPOINTER_TO_INT (pointer);
+
+        return count;
+}
+
+static gboolean
+is_unique_language (const char *language)
+{
+        return get_language_count (language) == 1;
+}
+
+static gint
+get_territory_count (const char *territory)
+{
+        gint count = 0;
+        gpointer pointer;
+
+        if (mate_territory_count_map == NULL)
+                collect_locales ();
+
+        if ((pointer = g_hash_table_lookup (mate_territory_count_map, territory)) != NULL)
+                count = GPOINTER_TO_INT (pointer);
+
+        return count;
+}
+
+static gboolean
+is_unique_territory (const char *territory)
+{
+        return get_territory_count (territory) == 1;
+}
+
+static gboolean
+is_fallback_language (const char *code)
+{
+        const char *fallback_language_names[] = { "C", "POSIX", NULL };
+        int i;
+
+        for (i = 0; fallback_language_names[i] != NULL; i++) {
+                if (strcmp (code, fallback_language_names[i]) == 0) {
+                        return TRUE;
+                }
+        }
+
+        return FALSE;
+}
+
+static const char *
+get_language (const char *code)
+{
+        const char *name;
+        int         len;
+
+        g_assert (code != NULL);
+
+        if (is_fallback_language (code)) {
+                return "Unspecified";
+        }
+
+        len = strlen (code);
+        if (len != 2 && len != 3) {
+                return NULL;
+        }
+
+        name = (const char *) g_hash_table_lookup (mate_languages_map, code);
+
+        return name;
+}
+
+static char *
+get_first_item_in_semicolon_list (const char *list)
+{
+        char **items;
+        char  *item;
+
+        /* Some entries in iso codes have multiple values, separated
+         * by semicolons.  Not really sure which one to pick, so
+         * we just arbitrarily pick the first one.
+         */
+        items = g_strsplit (list, "; ", 2);
+
+        item = g_strdup (items[0]);
+        g_strfreev (items);
+
+        return item;
+}
+
+static char *
+capitalize_utf8_string (const char *str)
+{
+        char first[8] = { 0 };
+
+        if (!str)
+                return NULL;
+
+        g_unichar_to_utf8 (g_unichar_totitle (g_utf8_get_char (str)), first);
+
+        return g_strconcat (first, g_utf8_offset_to_pointer (str, 1), NULL);
+}
+
+static char *
+get_translated_language (const char *code,
+                         const char *locale)
+{
+        const char *language;
+        char *name;
+
+        language = get_language (code);
+
+        name = NULL;
+        if (language != NULL) {
+                const char  *translated_name;
+                g_autofree char *old_locale = NULL;
+
+                if (locale != NULL) {
+                        old_locale = g_strdup (setlocale (LC_MESSAGES, NULL));
+                        setlocale (LC_MESSAGES, locale);
+                }
+
+                if (is_fallback_language (code)) {
+                        name = g_strdup (_("Unspecified"));
+                } else {
+                        g_autofree char *tmp = NULL;
+                        translated_name = dgettext ("iso_639", language);
+                        tmp = get_first_item_in_semicolon_list (translated_name);
+                        name = capitalize_utf8_string (tmp);
+                }
+
+                if (locale != NULL) {
+                        setlocale (LC_MESSAGES, old_locale);
+                }
+        }
+
+        return name;
+}
+
+static const char *
+get_territory (const char *code)
+{
+        const char *name;
+        int         len;
+
+        g_assert (code != NULL);
+
+        len = strlen (code);
+        if (len != 2 && len != 3) {
+                return NULL;
+        }
+
+        name = (const char *) g_hash_table_lookup (mate_territories_map, code);
+
+        return name;
+}
+
+static char *
+get_translated_territory (const char *code,
+                          const char *locale)
+{
+        const char *territory;
+        char       *name;
+
+        territory = get_territory (code);
+
+        name = NULL;
+        if (territory != NULL) {
+                const char *translated_territory;
+                g_autofree char *old_locale = NULL;
+                g_autofree char *tmp = NULL;
+
+                if (locale != NULL) {
+                        old_locale = g_strdup (setlocale (LC_MESSAGES, NULL));
+                        setlocale (LC_MESSAGES, locale);
+                }
+
+                translated_territory = dgettext ("iso_3166", territory);
+                tmp = get_first_item_in_semicolon_list (translated_territory);
+                name = capitalize_utf8_string (tmp);
+
+                if (locale != NULL) {
+                        setlocale (LC_MESSAGES, old_locale);
+                }
+        }
+
+        return name;
+}
+
+static void
+languages_parse_start_tag (GMarkupParseContext      *ctx,
+                           const char               *element_name,
+                           const char              **attr_names,
+                           const char              **attr_values,
+                           gpointer                  user_data,
+                           GError                  **error)
+{
+        const char *ccode_longB;
+        const char *ccode_longT;
+        const char *ccode;
+        const char *ccode_id;
+        const char *lang_name;
+
+        if (! (g_str_equal (element_name, "iso_639_entry") || g_str_equal (element_name, "iso_639_3_entry"))
+            || attr_names == NULL || attr_values == NULL) {
+                return;
+        }
+
+        ccode = NULL;
+        ccode_longB = NULL;
+        ccode_longT = NULL;
+        ccode_id = NULL;
+        lang_name = NULL;
+
+        while (*attr_names && *attr_values) {
+                if (g_str_equal (*attr_names, "iso_639_1_code")) {
+                        /* skip if empty */
+                        if (**attr_values) {
+                                if (strlen (*attr_values) != 2) {
+                                        return;
+                                }
+                                ccode = *attr_values;
+                        }
+                } else if (g_str_equal (*attr_names, "iso_639_2B_code")) {
+                        /* skip if empty */
+                        if (**attr_values) {
+                                if (strlen (*attr_values) != 3) {
+                                        return;
+                                }
+                                ccode_longB = *attr_values;
+                        }
+                } else if (g_str_equal (*attr_names, "iso_639_2T_code")) {
+                        /* skip if empty */
+                        if (**attr_values) {
+                                if (strlen (*attr_values) != 3) {
+                                        return;
+                                }
+                                ccode_longT = *attr_values;
+                        }
+                } else if (g_str_equal (*attr_names, "id")) {
+                        /* skip if empty */
+                        if (**attr_values) {
+                                if (strlen (*attr_values) != 2 &&
+                                    strlen (*attr_values) != 3) {
+                                        return;
+                                }
+                                ccode_id = *attr_values;
+                        }
+                } else if (g_str_equal (*attr_names, "name")) {
+                        lang_name = *attr_values;
+                }
+
+                ++attr_names;
+                ++attr_values;
+        }
+
+        if (lang_name == NULL) {
+                return;
+        }
+
+        if (ccode != NULL) {
+                g_hash_table_insert (mate_languages_map,
+                                     g_strdup (ccode),
+                                     g_strdup (lang_name));
+        }
+        if (ccode_longB != NULL) {
+                g_hash_table_insert (mate_languages_map,
+                                     g_strdup (ccode_longB),
+                                     g_strdup (lang_name));
+        }
+        if (ccode_longT != NULL) {
+                g_hash_table_insert (mate_languages_map,
+                                     g_strdup (ccode_longT),
+                                     g_strdup (lang_name));
+        }
+        if (ccode_id != NULL) {
+                g_hash_table_insert (mate_languages_map,
+                                     g_strdup (ccode_id),
+                                     g_strdup (lang_name));
+        }
+}
+
+static void
+territories_parse_start_tag (GMarkupParseContext      *ctx,
+                             const char               *element_name,
+                             const char              **attr_names,
+                             const char              **attr_values,
+                             gpointer                  user_data,
+                             GError                  **error)
+{
+        const char *acode_2;
+        const char *acode_3;
+        const char *ncode;
+        const char *territory_common_name;
+        const char *territory_name;
+
+        if (! g_str_equal (element_name, "iso_3166_entry") || attr_names == NULL || attr_values == NULL) {
+                return;
+        }
+
+        acode_2 = NULL;
+        acode_3 = NULL;
+        ncode = NULL;
+        territory_common_name = NULL;
+        territory_name = NULL;
+
+        while (*attr_names && *attr_values) {
+                if (g_str_equal (*attr_names, "alpha_2_code")) {
+                        /* skip if empty */
+                        if (**attr_values) {
+                                if (strlen (*attr_values) != 2) {
+                                        return;
+                                }
+                                acode_2 = *attr_values;
+                        }
+                } else if (g_str_equal (*attr_names, "alpha_3_code")) {
+                        /* skip if empty */
+                        if (**attr_values) {
+                                if (strlen (*attr_values) != 3) {
+                                        return;
+                                }
+                                acode_3 = *attr_values;
+                        }
+                } else if (g_str_equal (*attr_names, "numeric_code")) {
+                        /* skip if empty */
+                        if (**attr_values) {
+                                if (strlen (*attr_values) != 3) {
+                                        return;
+                                }
+                                ncode = *attr_values;
+                        }
+                } else if (g_str_equal (*attr_names, "common_name")) {
+                        /* skip if empty */
+                        if (**attr_values) {
+                                territory_common_name = *attr_values;
+                        }
+                } else if (g_str_equal (*attr_names, "name")) {
+                        territory_name = *attr_values;
+                }
+
+                ++attr_names;
+                ++attr_values;
+        }
+
+        if (territory_common_name != NULL) {
+                territory_name = territory_common_name;
+        }
+
+        if (territory_name == NULL) {
+                return;
+        }
+
+        if (acode_2 != NULL) {
+                g_hash_table_insert (mate_territories_map,
+                                     g_strdup (acode_2),
+                                     g_strdup (territory_name));
+        }
+        if (acode_3 != NULL) {
+                g_hash_table_insert (mate_territories_map,
+                                     g_strdup (acode_3),
+                                     g_strdup (territory_name));
+        }
+        if (ncode != NULL) {
+                g_hash_table_insert (mate_territories_map,
+                                     g_strdup (ncode),
+                                     g_strdup (territory_name));
+        }
+}
+
+static void
+languages_variant_init (const char *variant)
+{
+        gboolean res;
+        gsize    buf_len;
+        g_autofree char *buf = NULL;
+        g_autofree char *filename = NULL;
+        g_autoptr (GError) error = NULL;
+
+        bindtextdomain (variant, ISO_CODES_LOCALESDIR);
+        bind_textdomain_codeset (variant, "UTF-8");
+
+        error = NULL;
+        filename = g_strdup_printf (ISO_CODES_DATADIR "/%s.xml", variant);
+        res = g_file_get_contents (filename,
+                                   &buf,
+                                   &buf_len,
+                                   &error);
+        if (res) {
+                g_autoptr (GMarkupParseContext) ctx = NULL;
+                GMarkupParser        parser = { languages_parse_start_tag, NULL, NULL, NULL, NULL };
+
+                ctx = g_markup_parse_context_new (&parser, 0, NULL, NULL);
+
+                error = NULL;
+                res = g_markup_parse_context_parse (ctx, buf, buf_len, &error);
+
+                if (! res) {
+                        g_warning ("Failed to parse '%s': %s\n",
+                                   filename,
+                                   error->message);
+                }
+        } else {
+                g_warning ("Failed to load '%s': %s\n",
+                           filename,
+                           error->message);
+        }
+}
+
+static void
+languages_init (void)
+{
+        if (mate_languages_map)
+                return;
+
+        mate_languages_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+        languages_variant_init ("iso_639");
+        languages_variant_init ("iso_639_3");
+}
+
+static void
+territories_init (void)
+{
+        gboolean res;
+        gsize    buf_len;
+        g_autofree char *buf = NULL;
+        g_autoptr (GError) error = NULL;
+
+        if (mate_territories_map)
+                return;
+
+        bindtextdomain ("iso_3166", ISO_CODES_LOCALESDIR);
+        bind_textdomain_codeset ("iso_3166", "UTF-8");
+
+        mate_territories_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+        error = NULL;
+        res = g_file_get_contents (ISO_CODES_DATADIR "/iso_3166.xml",
+                                   &buf,
+                                   &buf_len,
+                                   &error);
+        if (res) {
+                g_autoptr (GMarkupParseContext) ctx = NULL;
+                GMarkupParser        parser = { territories_parse_start_tag, NULL, NULL, NULL, NULL };
+
+                ctx = g_markup_parse_context_new (&parser, 0, NULL, NULL);
+
+                error = NULL;
+                res = g_markup_parse_context_parse (ctx, buf, buf_len, &error);
+
+                if (! res) {
+                        g_warning ("Failed to parse '%s': %s\n",
+                                   ISO_CODES_DATADIR "/iso_3166.xml",
+                                   error->message);
+                }
+        } else {
+                g_warning ("Failed to load '%s': %s\n",
+                           ISO_CODES_DATADIR "/iso_3166.xml",
+                           error->message);
+        }
+}
+
+/**
+ * mate_get_language_from_locale:
+ * @locale: a locale string
+ * @translation: (allow-none): a locale string
+ *
+ * Gets the language description for @locale. If @translation is
+ * provided the returned string is translated accordingly.
+ *
+ * Return value: (transfer full): the language description. Caller
+ * takes ownership.
+ *
+ * Since: 1.22
+ */
+char *
+mate_get_language_from_locale (const char *locale,
+                                const char *translation)
+{
+        GString *full_language;
+        g_autofree char *language_code = NULL;
+        g_autofree char *territory_code = NULL;
+        g_autofree char *codeset_code = NULL;
+        g_autofree char *langinfo_codeset = NULL;
+        g_autofree char *translated_language = NULL;
+        g_autofree char *translated_territory = NULL;
+        gboolean is_utf8 = TRUE;
+
+        g_return_val_if_fail (locale != NULL, NULL);
+        g_return_val_if_fail (*locale != '\0', NULL);
+
+        full_language = g_string_new (NULL);
+
+        languages_init ();
+        territories_init ();
+
+        mate_parse_locale (locale,
+                            &language_code,
+                            &territory_code,
+                            &codeset_code,
+                            NULL);
+
+        if (language_code == NULL) {
+                goto out;
+        }
+
+        translated_language = get_translated_language (language_code, translation);
+        if (translated_language == NULL) {
+                goto out;
+        }
+
+        full_language = g_string_append (full_language, translated_language);
+
+	if (is_unique_language (language_code)) {
+		goto out;
+	}
+
+        if (territory_code != NULL) {
+                translated_territory = get_translated_territory (territory_code, translation);
+        }
+        if (translated_territory != NULL) {
+                g_string_append_printf (full_language,
+                                        " (%s)",
+                                        translated_territory);
+        }
+
+        language_name_get_codeset_details (locale, &langinfo_codeset, &is_utf8);
+
+        if (codeset_code == NULL && langinfo_codeset != NULL) {
+                codeset_code = g_strdup (langinfo_codeset);
+        }
+
+        if (!is_utf8 && codeset_code) {
+                g_string_append_printf (full_language,
+                                        " [%s]",
+                                        codeset_code);
+        }
+
+ out:
+        if (full_language->len == 0) {
+                g_string_free (full_language, TRUE);
+                return NULL;
+        }
+
+        return g_string_free (full_language, FALSE);
+}
+
+/**
+ * mate_get_country_from_locale:
+ * @locale: a locale string
+ * @translation: (allow-none): a locale string
+ *
+ * Gets the country description for @locale. If @translation is
+ * provided the returned string is translated accordingly.
+ *
+ * Return value: (transfer full): the country description. Caller
+ * takes ownership.
+ *
+ * Since: 1.22
+ */
+char *
+mate_get_country_from_locale (const char *locale,
+                               const char *translation)
+{
+        GString *full_name;
+        g_autofree char *language_code = NULL;
+        g_autofree char *territory_code = NULL;
+        g_autofree char *codeset_code = NULL;
+        g_autofree char *langinfo_codeset = NULL;
+        g_autofree char *translated_language = NULL;
+        g_autofree char *translated_territory = NULL;
+        gboolean is_utf8 = TRUE;
+
+        g_return_val_if_fail (locale != NULL, NULL);
+        g_return_val_if_fail (*locale != '\0', NULL);
+
+        full_name = g_string_new (NULL);
+
+        languages_init ();
+        territories_init ();
+
+        mate_parse_locale (locale,
+                            &language_code,
+                            &territory_code,
+                            &codeset_code,
+                            NULL);
+
+        if (territory_code == NULL) {
+                goto out;
+        }
+
+        translated_territory = get_translated_territory (territory_code, translation);
+        g_string_append (full_name, translated_territory);
+
+	if (is_unique_territory (territory_code)) {
+		goto out;
+	}
+
+        if (language_code != NULL) {
+                translated_language = get_translated_language (language_code, translation);
+        }
+        if (translated_language != NULL) {
+                g_string_append_printf (full_name,
+                                        " (%s)",
+                                        translated_language);
+        }
+
+        language_name_get_codeset_details (translation, &langinfo_codeset, &is_utf8);
+
+        if (codeset_code == NULL && langinfo_codeset != NULL) {
+                codeset_code = g_strdup (langinfo_codeset);
+        }
+
+        if (!is_utf8 && codeset_code) {
+                g_string_append_printf (full_name,
+                                        " [%s]",
+                                        codeset_code);
+        }
+
+ out:
+        if (full_name->len == 0) {
+                g_string_free (full_name, TRUE);
+                return NULL;
+        }
+
+        return g_string_free (full_name, FALSE);
+}
+
+/**
+ * mate_get_all_locales:
+ *
+ * Gets all locales.
+ *
+ * Return value: (array zero-terminated=1) (element-type utf8) (transfer full):
+ *   a newly allocated %NULL-terminated string array containing the
+ *   all locales. Free with g_strfreev().
+ *
+ * Since: 1.22
+ */
+char **
+mate_get_all_locales (void)
+{
+        GHashTableIter iter;
+        gpointer key, value;
+        GPtrArray *array;
+
+        if (mate_available_locales_map == NULL) {
+                collect_locales ();
+        }
+
+        array = g_ptr_array_new ();
+        g_hash_table_iter_init (&iter, mate_available_locales_map);
+        while (g_hash_table_iter_next (&iter, &key, &value)) {
+                MateLocale *locale;
+
+                locale = (MateLocale *) value;
+
+                g_ptr_array_add (array, g_strdup (locale->name));
+        }
+        g_ptr_array_add (array, NULL);
+
+        return (char **) g_ptr_array_free (array, FALSE);
+}
+
+/**
+ * mate_get_language_from_code:
+ * @code: an ISO 639 code string
+ * @translation: (allow-none): a locale string
+ *
+ * Gets the language name for @code. If @locale is provided the
+ * returned string is translated accordingly.
+ *
+ * Return value: (transfer full): the language name. Caller takes
+ * ownership.
+ *
+ * Since: 1.22
+ */
+char *
+mate_get_language_from_code (const char *code,
+                              const char *translation)
+{
+        g_return_val_if_fail (code != NULL, NULL);
+
+        languages_init ();
+
+        return get_translated_language (code, translation);
+}
+
+/**
+ * mate_get_country_from_code:
+ * @code: an ISO 3166 code string
+ * @translation: (allow-none): a locale string
+ *
+ * Gets the country name for @code. If @locale is provided the
+ * returned string is translated accordingly.
+ *
+ * Return value: (transfer full): the country name. Caller takes
+ * ownership.
+ *
+ * Since: 1.22
+ */
+char *
+mate_get_country_from_code (const char *code,
+                             const char *translation)
+{
+        g_return_val_if_fail (code != NULL, NULL);
+
+        territories_init ();
+
+        return get_translated_territory (code, translation);
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/87.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/87.html new file mode 100644 index 00000000..f1b5f3f5 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/87.html @@ -0,0 +1,343 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright 2008 Red Hat, Inc.
+ * Copyright 2007 William Jon McCann <mccann@jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Written by: Ray Strode
+ *             William Jon McCann
+ */
+
+#ifndef __MATE_LANGUAGES_H
+#define __MATE_LANGUAGES_H
+
+#ifndef MATE_DESKTOP_USE_UNSTABLE_API
+#error    This is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including mate-languages.h
+#endif
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+char *        mate_get_language_from_locale    (const char *locale,
+                                                 const char *translation);
+char *        mate_get_country_from_locale     (const char *locale,
+                                                 const char *translation);
+char **       mate_get_all_locales             (void);
+gboolean      mate_parse_locale                (const char *locale,
+                                                 char      **language_codep,
+                                                 char      **country_codep,
+                                                 char      **codesetp,
+                                                 char      **modifierp);
+char *        mate_normalize_locale            (const char *locale);
+gboolean      mate_language_has_translations   (const char *code);
+char *        mate_get_language_from_code      (const char *code,
+                                                 const char *translation);
+char *        mate_get_country_from_code       (const char *code,
+                                                 const char *translation);
+
+G_END_DECLS
+
+#endif /* __MATE_LANGUAGES_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/88.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/88.html new file mode 100644 index 00000000..ce774334 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/88.html @@ -0,0 +1,4187 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+1545
+1546
+1547
+1548
+1549
+1550
+1551
+1552
+1553
+1554
+1555
+1556
+1557
+1558
+1559
+1560
+1561
+1562
+1563
+1564
+1565
+1566
+1567
+1568
+1569
+1570
+1571
+1572
+1573
+1574
+1575
+1576
+1577
+1578
+1579
+1580
+1581
+1582
+1583
+1584
+1585
+1586
+1587
+1588
+1589
+1590
+1591
+1592
+1593
+1594
+1595
+1596
+1597
+1598
+1599
+1600
+1601
+1602
+1603
+1604
+1605
+1606
+1607
+1608
+1609
+1610
+1611
+1612
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+1631
+1632
+1633
+1634
+1635
+1636
+1637
+1638
+1639
+1640
+1641
+1642
+1643
+1644
+1645
+1646
+1647
+1648
+1649
+1650
+1651
+1652
+1653
+1654
+1655
+1656
+1657
+1658
+1659
+1660
+1661
+1662
+1663
+1664
+1665
+1666
+1667
+1668
+1669
+1670
+1671
+1672
+1673
+1674
+1675
+1676
+1677
+1678
+1679
+1680
+1681
+1682
+1683
+1684
+1685
+1686
+1687
+1688
+1689
+1690
+1691
+1692
+1693
+1694
+1695
+1696
+1697
+1698
+1699
+1700
+1701
+1702
+1703
+1704
+1705
+1706
+1707
+1708
+1709
+1710
+1711
+1712
+1713
+1714
+1715
+1716
+1717
+1718
+1719
+1720
+1721
+1722
+1723
+1724
+1725
+1726
+1727
+1728
+1729
+1730
+1731
+1732
+1733
+1734
+1735
+1736
+1737
+1738
+1739
+1740
+1741
+1742
+1743
+1744
+1745
+1746
+1747
+1748
+1749
+1750
+1751
+1752
+1753
+1754
+1755
+1756
+1757
+1758
+1759
+1760
+1761
+1762
+1763
+1764
+1765
+1766
+1767
+1768
+1769
+1770
+1771
+1772
+1773
+1774
+1775
+1776
+1777
+1778
+1779
+1780
+1781
+1782
+1783
+1784
+1785
+1786
+1787
+1788
+1789
+1790
+1791
+1792
+1793
+1794
+1795
+1796
+1797
+1798
+1799
+1800
+1801
+1802
+1803
+1804
+1805
+1806
+1807
+1808
+1809
+1810
+1811
+1812
+1813
+1814
+1815
+1816
+1817
+1818
+1819
+1820
+1821
+1822
+1823
+1824
+1825
+1826
+1827
+1828
+1829
+1830
+1831
+1832
+1833
+1834
+1835
+1836
+1837
+1838
+1839
+1840
+1841
+1842
+1843
+1844
+1845
+1846
+1847
+1848
+1849
+1850
+1851
+1852
+1853
+1854
+1855
+1856
+1857
+1858
+1859
+1860
+1861
+1862
+1863
+1864
+1865
+1866
+1867
+1868
+1869
+1870
+1871
+1872
+1873
+1874
+1875
+1876
+1877
+1878
+1879
+1880
+1881
+1882
+1883
+1884
+1885
+1886
+1887
+1888
+1889
+1890
+1891
+1892
+1893
+1894
+1895
+1896
+1897
+1898
+1899
+1900
+1901
+1902
+1903
+1904
+1905
+1906
+1907
+1908
+1909
+1910
+1911
+1912
+1913
+1914
+1915
+1916
+1917
+1918
+1919
+1920
+1921
+1922
+1923
+1924
+1925
+1926
+1927
+1928
+1929
+1930
+1931
+1932
+1933
+1934
+1935
+1936
+1937
+1938
+1939
+1940
+1941
+1942
+1943
+1944
+1945
+1946
+1947
+1948
+1949
+1950
+1951
+1952
+1953
+1954
+1955
+1956
+1957
+1958
+1959
+1960
+1961
+1962
+1963
+1964
+1965
+1966
+1967
+1968
+1969
+1970
+1971
+1972
+1973
+1974
+1975
/* mate-rr-config.c
+ * -*- c-basic-offset: 4 -*-
+ *
+ * Copyright 2007, 2008, Red Hat, Inc.
+ * Copyright 2010 Giovanni Campagna
+ *
+ * This file is part of the Mate Library.
+ *
+ * The Mate Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Mate 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Mate Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Author: Soren Sandmann <sandmann@redhat.com>
+ */
+
+#define MATE_DESKTOP_USE_UNSTABLE_API
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n-lib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gstdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <X11/Xlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "mate-rr-config.h"
+
+#include "edid.h"
+#include "mate-rr-private.h"
+
+#define CONFIG_INTENDED_BASENAME "monitors.xml"
+#define CONFIG_BACKUP_BASENAME "monitors.xml.backup"
+
+/* In version 0 of the config file format, we had several <configuration>
+ * toplevel elements and no explicit version number.  So, the filed looked
+ * like
+ *
+ *   <configuration>
+ *     ...
+ *   </configuration>
+ *   <configuration>
+ *     ...
+ *   </configuration>
+ *
+ * Since version 1 of the config file, the file has a toplevel <monitors>
+ * element to group all the configurations.  That element has a "version"
+ * attribute which is an integer. So, the file looks like this:
+ *
+ *   <monitors version="1">
+ *     <configuration>
+ *       ...
+ *     </configuration>
+ *     <configuration>
+ *       ...
+ *     </configuration>
+ *   </monitors>
+ */
+
+/* A helper wrapper around the GMarkup parser stuff */
+static gboolean parse_file_gmarkup (const gchar *file,
+				    const GMarkupParser *parser,
+				    gpointer data,
+				    GError **err);
+
+typedef struct CrtcAssignment CrtcAssignment;
+
+static gboolean         crtc_assignment_apply (CrtcAssignment   *assign,
+					       guint32           timestamp,
+					       GError          **error);
+static CrtcAssignment  *crtc_assignment_new   (MateRRScreen      *screen,
+					       MateRROutputInfo **outputs,
+					       GError            **error);
+static void             crtc_assignment_free  (CrtcAssignment   *assign);
+
+enum {
+  PROP_0,
+  PROP_SCREEN,
+  PROP_LAST
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (MateRRConfig, mate_rr_config, G_TYPE_OBJECT)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
+
+typedef struct Parser Parser;
+
+/* Parser for monitor configurations */
+struct Parser
+{
+    int			config_file_version;
+    MateRROutputInfo *	output;
+    MateRRConfig *	configuration;
+    GPtrArray *		outputs;
+    GPtrArray *		configurations;
+    GQueue *		stack;
+};
+
+static int
+parse_int (const char *text)
+{
+    return strtol (text, NULL, 0);
+}
+
+static guint
+parse_uint (const char *text)
+{
+    return strtoul (text, NULL, 0);
+}
+
+static gboolean
+stack_is (Parser *parser,
+	  const char *s1,
+	  ...)
+{
+    GList *stack = NULL;
+    const char *s;
+    GList *l1, *l2;
+    va_list args;
+
+    stack = g_list_prepend (stack, (gpointer)s1);
+
+    va_start (args, s1);
+
+    s = va_arg (args, const char *);
+    while (s)
+    {
+	stack = g_list_prepend (stack, (gpointer)s);
+	s = va_arg (args, const char *);
+    }
+
+    va_end (args);
+
+    l1 = stack;
+    l2 = parser->stack->head;
+
+    while (l1 && l2)
+    {
+	if (strcmp (l1->data, l2->data) != 0)
+	{
+	    g_list_free (stack);
+	    return FALSE;
+	}
+
+	l1 = l1->next;
+	l2 = l2->next;
+    }
+
+    g_list_free (stack);
+
+    return (!l1 && !l2);
+}
+
+static void
+handle_start_element (GMarkupParseContext *context,
+		      const gchar         *name,
+		      const gchar        **attr_names,
+		      const gchar        **attr_values,
+		      gpointer             user_data,
+		      GError             **err)
+{
+    Parser *parser = user_data;
+
+    if (strcmp (name, "output") == 0)
+    {
+	int i;
+	g_assert (parser->output == NULL);
+
+	parser->output = g_object_new (MATE_TYPE_RR_OUTPUT_INFO, NULL);
+	parser->output->priv->rotation = 0;
+
+	for (i = 0; attr_names[i] != NULL; ++i)
+	{
+	    if (strcmp (attr_names[i], "name") == 0)
+	    {
+		parser->output->priv->name = g_strdup (attr_values[i]);
+		break;
+	    }
+	}
+
+	if (!parser->output->priv->name)
+	{
+	    /* This really shouldn't happen, but it's better to make
+	     * something up than to crash later.
+	     */
+	    g_warning ("Malformed monitor configuration file");
+
+	    parser->output->priv->name = g_strdup ("default");
+	}
+	parser->output->priv->connected = FALSE;
+	parser->output->priv->on = FALSE;
+	parser->output->priv->primary = FALSE;
+    }
+    else if (strcmp (name, "configuration") == 0)
+    {
+	g_assert (parser->configuration == NULL);
+
+	parser->configuration = g_object_new (MATE_TYPE_RR_CONFIG, NULL);
+	parser->configuration->priv->clone = FALSE;
+	parser->configuration->priv->outputs = NULL;
+    }
+    else if (strcmp (name, "monitors") == 0)
+    {
+	int i;
+
+	for (i = 0; attr_names[i] != NULL; i++)
+	{
+	    if (strcmp (attr_names[i], "version") == 0)
+	    {
+		parser->config_file_version = parse_int (attr_values[i]);
+		break;
+	    }
+	}
+    }
+
+    g_queue_push_tail (parser->stack, g_strdup (name));
+}
+
+static void
+handle_end_element (GMarkupParseContext *context,
+		    const gchar         *name,
+		    gpointer             user_data,
+		    GError             **err)
+{
+    Parser *parser = user_data;
+
+    if (strcmp (name, "output") == 0)
+    {
+	/* If no rotation properties were set, just use MATE_RR_ROTATION_0 */
+	if (parser->output->priv->rotation == 0)
+	    parser->output->priv->rotation = MATE_RR_ROTATION_0;
+
+	g_ptr_array_add (parser->outputs, parser->output);
+
+	parser->output = NULL;
+    }
+    else if (strcmp (name, "configuration") == 0)
+    {
+	g_ptr_array_add (parser->outputs, NULL);
+	parser->configuration->priv->outputs =
+	    (MateRROutputInfo **)g_ptr_array_free (parser->outputs, FALSE);
+	parser->outputs = g_ptr_array_new ();
+	g_ptr_array_add (parser->configurations, parser->configuration);
+	parser->configuration = NULL;
+    }
+
+    g_free (g_queue_pop_tail (parser->stack));
+}
+
+#define TOPLEVEL_ELEMENT (parser->config_file_version > 0 ? "monitors" : NULL)
+
+static void
+handle_text (GMarkupParseContext *context,
+	     const gchar         *text,
+	     gsize                text_len,
+	     gpointer             user_data,
+	     GError             **err)
+{
+    Parser *parser = user_data;
+
+    if (stack_is (parser, "vendor", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
+    {
+	parser->output->priv->connected = TRUE;
+
+	strncpy ((gchar*) parser->output->priv->vendor, text, 3);
+	parser->output->priv->vendor[3] = 0;
+    }
+    else if (stack_is (parser, "clone", "configuration", TOPLEVEL_ELEMENT, NULL))
+    {
+	if (strcmp (text, "yes") == 0)
+	    parser->configuration->priv->clone = TRUE;
+    }
+    else if (stack_is (parser, "product", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
+    {
+	parser->output->priv->connected = TRUE;
+
+	parser->output->priv->product = parse_int (text);
+    }
+    else if (stack_is (parser, "serial", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
+    {
+	parser->output->priv->connected = TRUE;
+
+	parser->output->priv->serial = parse_uint (text);
+    }
+    else if (stack_is (parser, "width", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
+    {
+	parser->output->priv->on = TRUE;
+
+	parser->output->priv->width = parse_int (text);
+    }
+    else if (stack_is (parser, "x", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
+    {
+	parser->output->priv->on = TRUE;
+
+	parser->output->priv->x = parse_int (text);
+    }
+    else if (stack_is (parser, "y", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
+    {
+	parser->output->priv->on = TRUE;
+
+	parser->output->priv->y = parse_int (text);
+    }
+    else if (stack_is (parser, "height", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
+    {
+	parser->output->priv->on = TRUE;
+
+	parser->output->priv->height = parse_int (text);
+    }
+    else if (stack_is (parser, "rate", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
+    {
+	parser->output->priv->on = TRUE;
+
+	parser->output->priv->rate = parse_int (text);
+    }
+    else if (stack_is (parser, "rotation", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
+    {
+	if (strcmp (text, "normal") == 0)
+	{
+	    parser->output->priv->rotation |= MATE_RR_ROTATION_0;
+	}
+	else if (strcmp (text, "left") == 0)
+	{
+	    parser->output->priv->rotation |= MATE_RR_ROTATION_90;
+	}
+	else if (strcmp (text, "upside_down") == 0)
+	{
+	    parser->output->priv->rotation |= MATE_RR_ROTATION_180;
+	}
+	else if (strcmp (text, "right") == 0)
+	{
+	    parser->output->priv->rotation |= MATE_RR_ROTATION_270;
+	}
+    }
+    else if (stack_is (parser, "reflect_x", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
+    {
+	if (strcmp (text, "yes") == 0)
+	{
+	    parser->output->priv->rotation |= MATE_RR_REFLECT_X;
+	}
+    }
+    else if (stack_is (parser, "reflect_y", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
+    {
+	if (strcmp (text, "yes") == 0)
+	{
+	    parser->output->priv->rotation |= MATE_RR_REFLECT_Y;
+	}
+    }
+    else if (stack_is (parser, "primary", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
+    {
+	if (strcmp (text, "yes") == 0)
+	{
+	    parser->output->priv->primary = TRUE;
+	}
+    }
+    else
+    {
+	/* Ignore other properties so we can expand the format in the future */
+    }
+}
+
+static void
+parser_free (Parser *parser)
+{
+    guint i;
+    GList *list;
+
+    g_assert (parser != NULL);
+
+    if (parser->output)
+	g_object_unref (parser->output);
+
+    if (parser->configuration)
+	g_object_unref (parser->configuration);
+
+    for (i = 0; i < parser->outputs->len; ++i)
+    {
+	MateRROutputInfo *output = parser->outputs->pdata[i];
+
+	g_object_unref (output);
+    }
+
+    g_ptr_array_free (parser->outputs, TRUE);
+
+    for (i = 0; i < parser->configurations->len; ++i)
+    {
+	MateRRConfig *config = parser->configurations->pdata[i];
+
+	g_object_unref (config);
+    }
+
+    g_ptr_array_free (parser->configurations, TRUE);
+
+    for (list = parser->stack->head; list; list = list->next)
+	g_free (list->data);
+    g_queue_free (parser->stack);
+
+    g_free (parser);
+}
+
+static MateRRConfig **
+configurations_read_from_file (const gchar *filename, GError **error)
+{
+    Parser *parser = g_new0 (Parser, 1);
+    MateRRConfig **result;
+    GMarkupParser callbacks = {
+	handle_start_element,
+	handle_end_element,
+	handle_text,
+	NULL, /* passthrough */
+	NULL, /* error */
+    };
+
+    parser->config_file_version = 0;
+    parser->configurations = g_ptr_array_new ();
+    parser->outputs = g_ptr_array_new ();
+    parser->stack = g_queue_new ();
+
+    if (!parse_file_gmarkup (filename, &callbacks, parser, error))
+    {
+	result = NULL;
+
+	g_assert (parser->outputs);
+	goto out;
+    }
+
+    g_assert (parser->outputs);
+
+    g_ptr_array_add (parser->configurations, NULL);
+    result = (MateRRConfig **)g_ptr_array_free (parser->configurations, FALSE);
+    parser->configurations = g_ptr_array_new ();
+
+    g_assert (parser->outputs);
+out:
+    parser_free (parser);
+
+    return result;
+}
+
+static void
+mate_rr_config_init (MateRRConfig *self)
+{
+    self->priv = mate_rr_config_get_instance_private (self);
+
+    self->priv->clone = FALSE;
+    self->priv->screen = NULL;
+    self->priv->outputs = NULL;
+}
+
+static void
+mate_rr_config_set_property (GObject *gobject, guint property_id, const GValue *value, GParamSpec *property)
+{
+    MateRRConfig *self = MATE_RR_CONFIG (gobject);
+
+    switch (property_id) {
+	case PROP_SCREEN:
+	    self->priv->screen = g_value_dup_object (value);
+	    return;
+	default:
+	    G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, property);
+    }
+}
+
+static void
+mate_rr_config_finalize (GObject *gobject)
+{
+    MateRRConfig *self = MATE_RR_CONFIG (gobject);
+
+    if (self->priv->screen)
+	g_object_unref (self->priv->screen);
+
+    if (self->priv->outputs) {
+	int i;
+
+        for (i = 0; self->priv->outputs[i] != NULL; i++) {
+	    MateRROutputInfo *output = self->priv->outputs[i];
+	    g_object_unref (output);
+	}
+	g_free (self->priv->outputs);
+    }
+
+    G_OBJECT_CLASS (mate_rr_config_parent_class)->finalize (gobject);
+}
+
+gboolean
+mate_rr_config_load_current (MateRRConfig *config, GError **error)
+{
+    GPtrArray *a;
+    MateRROutput **rr_outputs;
+    int i;
+    int clone_width = -1;
+    int clone_height = -1;
+    int last_x;
+
+    g_return_val_if_fail (MATE_IS_RR_CONFIG (config), FALSE);
+
+    a = g_ptr_array_new ();
+    rr_outputs = mate_rr_screen_list_outputs (config->priv->screen);
+
+    config->priv->clone = FALSE;
+
+    for (i = 0; rr_outputs[i] != NULL; ++i)
+    {
+	MateRROutput *rr_output = rr_outputs[i];
+	MateRROutputInfo *output = g_object_new (MATE_TYPE_RR_OUTPUT_INFO, NULL);
+	MateRRMode *mode = NULL;
+	const guint8 *edid_data = mate_rr_output_get_edid_data (rr_output);
+	MateRRCrtc *crtc;
+
+	output->priv->name = g_strdup (mate_rr_output_get_name (rr_output));
+	output->priv->connected = mate_rr_output_is_connected (rr_output);
+
+	if (!output->priv->connected)
+	{
+	    output->priv->x = -1;
+	    output->priv->y = -1;
+	    output->priv->width = -1;
+	    output->priv->height = -1;
+	    output->priv->rate = -1;
+	    output->priv->rotation = MATE_RR_ROTATION_0;
+	}
+	else
+	{
+	    MonitorInfo *info = NULL;
+
+	    if (edid_data)
+		info = decode_edid (edid_data);
+
+	    if (info)
+	    {
+		memcpy (output->priv->vendor, info->manufacturer_code,
+			sizeof (output->priv->vendor));
+
+		output->priv->product = info->product_code;
+		output->priv->serial = info->serial_number;
+		output->priv->aspect = info->aspect_ratio;
+	    }
+	    else
+	    {
+		g_strlcpy (output->priv->vendor, "???", sizeof (output->priv->vendor));
+		output->priv->product = 0;
+		output->priv->serial = 0;
+	    }
+
+	    if (mate_rr_output_is_laptop (rr_output))
+		output->priv->display_name = g_strdup (_("Laptop"));
+	    else
+		output->priv->display_name = make_display_name (info);
+
+	    g_free (info);
+
+	    crtc = mate_rr_output_get_crtc (rr_output);
+	    mode = crtc? mate_rr_crtc_get_current_mode (crtc) : NULL;
+
+	    if (crtc && mode)
+	    {
+		output->priv->on = TRUE;
+
+		mate_rr_crtc_get_position (crtc, &output->priv->x, &output->priv->y);
+		output->priv->width = mate_rr_mode_get_width (mode);
+		output->priv->height = mate_rr_mode_get_height (mode);
+		output->priv->rate = mate_rr_mode_get_freq (mode);
+		output->priv->rotation = mate_rr_crtc_get_current_rotation (crtc);
+
+		if (output->priv->x == 0 && output->priv->y == 0) {
+			if (clone_width == -1) {
+				clone_width = output->priv->width;
+				clone_height = output->priv->height;
+			} else if (clone_width == output->priv->width &&
+				   clone_height == output->priv->height) {
+				config->priv->clone = TRUE;
+			}
+		}
+	    }
+	    else
+	    {
+		output->priv->on = FALSE;
+		config->priv->clone = FALSE;
+	    }
+
+	    /* Get preferred size for the monitor */
+	    mode = mate_rr_output_get_preferred_mode (rr_output);
+
+	    if (!mode)
+	    {
+		MateRRMode **modes = mate_rr_output_list_modes (rr_output);
+
+		/* FIXME: we should pick the "best" mode here, where best is
+		 * sorted wrt
+		 *
+		 * - closest aspect ratio
+		 * - mode area
+		 * - refresh rate
+		 * - We may want to extend randrwrap so that get_preferred
+		 *   returns that - although that could also depend on
+		 *   the crtc.
+		 */
+		if (modes[0])
+		    mode = modes[0];
+	    }
+
+	    if (mode)
+	    {
+		output->priv->pref_width = mate_rr_mode_get_width (mode);
+		output->priv->pref_height = mate_rr_mode_get_height (mode);
+	    }
+	    else
+	    {
+		/* Pick some random numbers. This should basically never happen */
+		output->priv->pref_width = 1024;
+		output->priv->pref_height = 768;
+	    }
+	}
+
+        output->priv->primary = mate_rr_output_get_is_primary (rr_output);
+
+	g_ptr_array_add (a, output);
+    }
+
+    g_ptr_array_add (a, NULL);
+
+    config->priv->outputs = (MateRROutputInfo **)g_ptr_array_free (a, FALSE);
+
+    /* Walk the outputs computing the right-most edge of all
+     * lit-up displays
+     */
+    last_x = 0;
+    for (i = 0; config->priv->outputs[i] != NULL; ++i)
+    {
+	MateRROutputInfo *output = config->priv->outputs[i];
+
+	if (output->priv->on)
+	{
+	    last_x = MAX (last_x, output->priv->x + output->priv->width);
+	}
+    }
+
+    /* Now position all off displays to the right of the
+     * on displays
+     */
+    for (i = 0; config->priv->outputs[i] != NULL; ++i)
+    {
+	MateRROutputInfo *output = config->priv->outputs[i];
+
+	if (output->priv->connected && !output->priv->on)
+	{
+	    output->priv->x = last_x;
+	    last_x = output->priv->x + output->priv->width;
+	}
+    }
+
+    g_assert (mate_rr_config_match (config, config));
+
+    return TRUE;
+}
+
+gboolean
+mate_rr_config_load_filename (MateRRConfig *result, const char *filename, GError **error)
+{
+    MateRRConfig *current;
+    MateRRConfig **configs;
+    gboolean found = FALSE;
+
+    g_return_val_if_fail (MATE_IS_RR_CONFIG (result), FALSE);
+    g_return_val_if_fail (filename != NULL, FALSE);
+    g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+    if (filename == NULL)
+      filename = mate_rr_config_get_intended_filename ();
+
+    current = mate_rr_config_new_current (result->priv->screen, error);
+
+    configs = configurations_read_from_file (filename, error);
+
+    if (configs)
+    {
+	int i;
+
+	for (i = 0; configs[i] != NULL; ++i)
+	{
+	    if (mate_rr_config_match (configs[i], current))
+	    {
+		int j;
+		GPtrArray *array;
+		result->priv->clone = configs[i]->priv->clone;
+
+		array = g_ptr_array_new ();
+		for (j = 0; configs[i]->priv->outputs[j] != NULL; j++) {
+		    g_object_ref (configs[i]->priv->outputs[j]);
+		    g_ptr_array_add (array, configs[i]->priv->outputs[j]);
+		}
+		g_ptr_array_add (array, NULL);
+		result->priv->outputs = (MateRROutputInfo **) g_ptr_array_free (array, FALSE);
+
+		found = TRUE;
+		break;
+	    }
+	    g_object_unref (configs[i]);
+	}
+	g_free (configs);
+
+	if (!found)
+	    g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_NO_MATCHING_CONFIG,
+			 _("none of the saved display configurations matched the active configuration"));
+    }
+
+    g_object_unref (current);
+    return found;
+}
+
+static void
+mate_rr_config_class_init (MateRRConfigClass *klass)
+{
+    GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+    gobject_class->set_property = mate_rr_config_set_property;
+    gobject_class->finalize = mate_rr_config_finalize;
+
+    g_object_class_install_property (gobject_class, PROP_SCREEN,
+				     g_param_spec_object ("screen", "Screen", "The MateRRScreen this config applies to", MATE_TYPE_RR_SCREEN,
+							  G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+}
+
+MateRRConfig *
+mate_rr_config_new_current (MateRRScreen *screen, GError **error)
+{
+    MateRRConfig *self = g_object_new (MATE_TYPE_RR_CONFIG, "screen", screen, NULL);
+
+    if (mate_rr_config_load_current (self, error))
+      return self;
+    else
+      {
+	g_object_unref (self);
+	return NULL;
+      }
+}
+
+MateRRConfig *
+mate_rr_config_new_stored (MateRRScreen *screen, GError **error)
+{
+    MateRRConfig *self = g_object_new (MATE_TYPE_RR_CONFIG, "screen", screen, NULL);
+    char *filename;
+    gboolean success;
+
+    filename = mate_rr_config_get_intended_filename ();
+
+    success = mate_rr_config_load_filename (self, filename, error);
+
+    g_free (filename);
+
+    if (success)
+      return self;
+    else
+      {
+	g_object_unref (self);
+	return NULL;
+      }
+}
+
+static gboolean
+parse_file_gmarkup (const gchar          *filename,
+		    const GMarkupParser  *parser,
+		    gpointer             data,
+		    GError              **err)
+{
+    GMarkupParseContext *context = NULL;
+    gchar *contents = NULL;
+    gboolean result = TRUE;
+    gsize len;
+
+    if (!g_file_get_contents (filename, &contents, &len, err))
+    {
+	result = FALSE;
+	goto out;
+    }
+
+    context = g_markup_parse_context_new (parser, 0, data, NULL);
+
+    if (!g_markup_parse_context_parse (context, contents, len, err))
+    {
+	result = FALSE;
+	goto out;
+    }
+
+    if (!g_markup_parse_context_end_parse (context, err))
+    {
+	result = FALSE;
+	goto out;
+    }
+
+out:
+    if (contents)
+	g_free (contents);
+
+    if (context)
+	g_markup_parse_context_free (context);
+
+    return result;
+}
+
+static gboolean
+output_match (MateRROutputInfo *output1, MateRROutputInfo *output2)
+{
+    g_assert (MATE_IS_RR_OUTPUT_INFO (output1));
+    g_assert (MATE_IS_RR_OUTPUT_INFO (output2));
+
+    if (strcmp (output1->priv->name, output2->priv->name) != 0)
+	return FALSE;
+
+    if (strcmp (output1->priv->vendor, output2->priv->vendor) != 0)
+	return FALSE;
+
+    if (output1->priv->product != output2->priv->product)
+	return FALSE;
+
+    if (output1->priv->serial != output2->priv->serial)
+	return FALSE;
+
+    if (output1->priv->connected != output2->priv->connected)
+	return FALSE;
+
+    return TRUE;
+}
+
+static gboolean
+output_equal (MateRROutputInfo *output1, MateRROutputInfo *output2)
+{
+    g_assert (MATE_IS_RR_OUTPUT_INFO (output1));
+    g_assert (MATE_IS_RR_OUTPUT_INFO (output2));
+
+    if (!output_match (output1, output2))
+	return FALSE;
+
+    if (output1->priv->on != output2->priv->on)
+	return FALSE;
+
+    if (output1->priv->on)
+    {
+	if (output1->priv->width != output2->priv->width)
+	    return FALSE;
+
+	if (output1->priv->height != output2->priv->height)
+	    return FALSE;
+
+	if (output1->priv->rate != output2->priv->rate)
+	    return FALSE;
+
+	if (output1->priv->x != output2->priv->x)
+	    return FALSE;
+
+	if (output1->priv->y != output2->priv->y)
+	    return FALSE;
+
+	if (output1->priv->rotation != output2->priv->rotation)
+	    return FALSE;
+    }
+
+    return TRUE;
+}
+
+static MateRROutputInfo *
+find_output (MateRRConfig *config, const char *name)
+{
+    int i;
+
+    for (i = 0; config->priv->outputs[i] != NULL; ++i)
+    {
+	MateRROutputInfo *output = config->priv->outputs[i];
+
+	if (strcmp (name, output->priv->name) == 0)
+	    return output;
+    }
+
+    return NULL;
+}
+
+/* Match means "these configurations apply to the same hardware
+ * setups"
+ */
+gboolean
+mate_rr_config_match (MateRRConfig *c1, MateRRConfig *c2)
+{
+    int i;
+    g_return_val_if_fail (MATE_IS_RR_CONFIG (c1), FALSE);
+    g_return_val_if_fail (MATE_IS_RR_CONFIG (c2), FALSE);
+
+    for (i = 0; c1->priv->outputs[i] != NULL; ++i)
+    {
+	MateRROutputInfo *output1 = c1->priv->outputs[i];
+	MateRROutputInfo *output2;
+
+	output2 = find_output (c2, output1->priv->name);
+	if (!output2 || !output_match (output1, output2))
+	    return FALSE;
+    }
+
+    return TRUE;
+}
+
+/* Equal means "the configurations will result in the same
+ * modes being set on the outputs"
+ */
+gboolean
+mate_rr_config_equal (MateRRConfig  *c1,
+		       MateRRConfig  *c2)
+{
+    int i;
+    g_return_val_if_fail (MATE_IS_RR_CONFIG (c1), FALSE);
+    g_return_val_if_fail (MATE_IS_RR_CONFIG (c2), FALSE);
+
+    for (i = 0; c1->priv->outputs[i] != NULL; ++i)
+    {
+	MateRROutputInfo *output1 = c1->priv->outputs[i];
+	MateRROutputInfo *output2;
+
+	output2 = find_output (c2, output1->priv->name);
+	if (!output2 || !output_equal (output1, output2))
+	    return FALSE;
+    }
+
+    return TRUE;
+}
+
+static MateRROutputInfo **
+make_outputs (MateRRConfig *config)
+{
+    GPtrArray *outputs;
+    MateRROutputInfo *first_on;
+    int i;
+
+    outputs = g_ptr_array_new ();
+
+    first_on = NULL;
+
+    for (i = 0; config->priv->outputs[i] != NULL; ++i)
+    {
+	MateRROutputInfo *old = config->priv->outputs[i];
+	MateRROutputInfo *new = g_object_new (MATE_TYPE_RR_OUTPUT_INFO, NULL);
+	*(new->priv) = *(old->priv);
+	if (old->priv->name)
+	    new->priv->name = g_strdup (old->priv->name);
+	if (old->priv->display_name)
+	    new->priv->display_name = g_strdup (old->priv->display_name);
+
+	if (old->priv->on && !first_on)
+	    first_on = old;
+
+	if (config->priv->clone && new->priv->on)
+	{
+	    g_assert (first_on);
+
+	    new->priv->width = first_on->priv->width;
+	    new->priv->height = first_on->priv->height;
+	    new->priv->rotation = first_on->priv->rotation;
+	    new->priv->x = 0;
+	    new->priv->y = 0;
+	}
+
+	g_ptr_array_add (outputs, new);
+    }
+
+    g_ptr_array_add (outputs, NULL);
+
+    return (MateRROutputInfo **)g_ptr_array_free (outputs, FALSE);
+}
+
+gboolean
+mate_rr_config_applicable (MateRRConfig  *configuration,
+			    MateRRScreen  *screen,
+			    GError        **error)
+{
+    MateRROutputInfo **outputs;
+    CrtcAssignment *assign;
+    gboolean result;
+    int i;
+
+    g_return_val_if_fail (MATE_IS_RR_CONFIG (configuration), FALSE);
+    g_return_val_if_fail (MATE_IS_RR_SCREEN (screen), FALSE);
+    g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+    outputs = make_outputs (configuration);
+    assign = crtc_assignment_new (screen, outputs, error);
+
+    if (assign)
+    {
+	result = TRUE;
+	crtc_assignment_free (assign);
+    }
+    else
+    {
+	result = FALSE;
+    }
+
+    for (i = 0; outputs[i] != NULL; i++) {
+	 g_object_unref (outputs[i]);
+    }
+
+    return result;
+}
+
+/* Database management */
+
+static void
+ensure_config_directory (void)
+{
+    g_mkdir_with_parents (g_get_user_config_dir (), 0700);
+}
+
+char *
+mate_rr_config_get_backup_filename (void)
+{
+    ensure_config_directory ();
+    return g_build_filename (g_get_user_config_dir (), CONFIG_BACKUP_BASENAME, NULL);
+}
+
+char *
+mate_rr_config_get_intended_filename (void)
+{
+    ensure_config_directory ();
+    return g_build_filename (g_get_user_config_dir (), CONFIG_INTENDED_BASENAME, NULL);
+}
+
+static const char *
+get_rotation_name (MateRRRotation r)
+{
+    if (r & MATE_RR_ROTATION_0)
+	return "normal";
+    if (r & MATE_RR_ROTATION_90)
+	return "left";
+    if (r & MATE_RR_ROTATION_180)
+	return "upside_down";
+    if (r & MATE_RR_ROTATION_270)
+	return "right";
+
+    return "normal";
+}
+
+static const char *
+yes_no (int x)
+{
+    return x? "yes" : "no";
+}
+
+static const char *
+get_reflect_x (MateRRRotation r)
+{
+    return yes_no (r & MATE_RR_REFLECT_X);
+}
+
+static const char *
+get_reflect_y (MateRRRotation r)
+{
+    return yes_no (r & MATE_RR_REFLECT_Y);
+}
+
+static void
+emit_configuration (MateRRConfig *config,
+		    GString *string)
+{
+    int j;
+
+    g_string_append_printf (string, "  <configuration>\n");
+
+    g_string_append_printf (string, "      <clone>%s</clone>\n", yes_no (config->priv->clone));
+
+    for (j = 0; config->priv->outputs[j] != NULL; ++j)
+    {
+	MateRROutputInfo *output = config->priv->outputs[j];
+
+	g_string_append_printf (
+	    string, "      <output name=\"%s\">\n", output->priv->name);
+
+	if (output->priv->connected && *output->priv->vendor != '\0')
+	{
+	    g_string_append_printf (
+		string, "          <vendor>%s</vendor>\n", output->priv->vendor);
+	    g_string_append_printf (
+		string, "          <product>0x%04x</product>\n", output->priv->product);
+	    g_string_append_printf (
+		string, "          <serial>0x%08x</serial>\n", output->priv->serial);
+	}
+
+	/* An unconnected output which is on does not make sense */
+	if (output->priv->connected && output->priv->on)
+	{
+	    g_string_append_printf (
+		string, "          <width>%d</width>\n", output->priv->width);
+	    g_string_append_printf (
+		string, "          <height>%d</height>\n", output->priv->height);
+	    g_string_append_printf (
+		string, "          <rate>%d</rate>\n", output->priv->rate);
+	    g_string_append_printf (
+		string, "          <x>%d</x>\n", output->priv->x);
+	    g_string_append_printf (
+		string, "          <y>%d</y>\n", output->priv->y);
+	    g_string_append_printf (
+		string, "          <rotation>%s</rotation>\n", get_rotation_name (output->priv->rotation));
+	    g_string_append_printf (
+		string, "          <reflect_x>%s</reflect_x>\n", get_reflect_x (output->priv->rotation));
+	    g_string_append_printf (
+		string, "          <reflect_y>%s</reflect_y>\n", get_reflect_y (output->priv->rotation));
+            g_string_append_printf (
+                string, "          <primary>%s</primary>\n", yes_no (output->priv->primary));
+	}
+
+	g_string_append_printf (string, "      </output>\n");
+    }
+
+    g_string_append_printf (string, "  </configuration>\n");
+}
+
+void
+mate_rr_config_sanitize (MateRRConfig *config)
+{
+    int i;
+    int x_offset, y_offset;
+    gboolean found;
+
+    /* Offset everything by the top/left-most coordinate to
+     * make sure the configuration starts at (0, 0)
+     */
+    x_offset = y_offset = G_MAXINT;
+    for (i = 0; config->priv->outputs[i]; ++i)
+    {
+	MateRROutputInfo *output = config->priv->outputs[i];
+
+	if (output->priv->on)
+	{
+	    x_offset = MIN (x_offset, output->priv->x);
+	    y_offset = MIN (y_offset, output->priv->y);
+	}
+    }
+
+    for (i = 0; config->priv->outputs[i]; ++i)
+    {
+	MateRROutputInfo *output = config->priv->outputs[i];
+
+	if (output->priv->on)
+	{
+	    output->priv->x -= x_offset;
+	    output->priv->y -= y_offset;
+	}
+    }
+
+    /* Only one primary, please */
+    found = FALSE;
+    for (i = 0; config->priv->outputs[i]; ++i)
+    {
+        if (config->priv->outputs[i]->priv->primary)
+        {
+            if (found)
+            {
+                config->priv->outputs[i]->priv->primary = FALSE;
+            }
+            else
+            {
+                found = TRUE;
+            }
+        }
+    }
+}
+
+gboolean
+mate_rr_config_ensure_primary (MateRRConfig *configuration)
+{
+        int              i;
+        MateRROutputInfo  *laptop;
+        MateRROutputInfo  *top_left;
+        gboolean        found;
+        MateRRConfigPrivate *priv;
+
+        g_return_val_if_fail (MATE_IS_RR_CONFIG (configuration), FALSE);
+
+        laptop = NULL;
+        top_left = NULL;
+        found = FALSE;
+        priv = configuration->priv;
+
+        for (i = 0; priv->outputs[i] != NULL; ++i) {
+                MateRROutputInfo *info = priv->outputs[i];
+
+                if (! info->priv->on) {
+                        info->priv->primary = FALSE;
+                        continue;
+		}
+
+                /* ensure only one */
+                if (info->priv->primary) {
+                        if (found) {
+                                info->priv->primary = FALSE;
+                        } else {
+                                found = TRUE;
+                        }
+                }
+
+                if (top_left == NULL
+                    || (info->priv->x < top_left->priv->x
+                        && info->priv->y < top_left->priv->y)) {
+                        top_left = info;
+                }
+                if (laptop == NULL
+                    && _mate_rr_output_name_is_laptop (info->priv->name)) {
+                        laptop = info;
+                }
+        }
+
+        if (!found) {
+                if (laptop != NULL) {
+                        laptop->priv->primary = TRUE;
+                } else if (top_left != NULL) {
+		        /* Note: top_left can be NULL if all outputs are off */
+                        top_left->priv->primary = TRUE;
+                }
+        }
+
+        return !found;
+}
+
+gboolean
+mate_rr_config_save (MateRRConfig *configuration, GError **error)
+{
+    MateRRConfig **configurations;
+    GString *output;
+    int i;
+    gchar *intended_filename;
+    gchar *backup_filename;
+    gboolean result;
+
+    g_return_val_if_fail (MATE_IS_RR_CONFIG (configuration), FALSE);
+    g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+    output = g_string_new ("");
+
+    backup_filename = mate_rr_config_get_backup_filename ();
+    intended_filename = mate_rr_config_get_intended_filename ();
+
+    configurations = configurations_read_from_file (intended_filename, NULL); /* NULL-GError */
+
+    g_string_append_printf (output, "<monitors version=\"1\">\n");
+
+    if (configurations)
+    {
+	for (i = 0; configurations[i] != NULL; ++i)
+	{
+	    if (!mate_rr_config_match (configurations[i], configuration))
+		emit_configuration (configurations[i], output);
+	    g_object_unref (configurations[i]);
+	}
+
+	g_free (configurations);
+    }
+
+    emit_configuration (configuration, output);
+
+    g_string_append_printf (output, "</monitors>\n");
+
+    /* backup the file first */
+    rename (intended_filename, backup_filename); /* no error checking because the intended file may not even exist */
+
+    result = g_file_set_contents (intended_filename, output->str, -1, error);
+
+    if (!result)
+	rename (backup_filename, intended_filename); /* no error checking because the backup may not even exist */
+
+    g_free (backup_filename);
+    g_free (intended_filename);
+    g_string_free (output, TRUE);
+
+    return result;
+}
+
+gboolean
+mate_rr_config_apply_with_time (MateRRConfig *config,
+				 MateRRScreen *screen,
+				 guint32        timestamp,
+				 GError       **error)
+{
+    CrtcAssignment *assignment;
+    MateRROutputInfo **outputs;
+    gboolean result = FALSE;
+    int i;
+    GdkDisplay *display;
+
+    g_return_val_if_fail (MATE_IS_RR_CONFIG (config), FALSE);
+    g_return_val_if_fail (MATE_IS_RR_SCREEN (screen), FALSE);
+
+    outputs = make_outputs (config);
+
+    assignment = crtc_assignment_new (screen, outputs, error);
+
+    for (i = 0; outputs[i] != NULL; i++)
+	g_object_unref (outputs[i]);
+    g_free (outputs);
+
+    if (assignment)
+    {
+	if (crtc_assignment_apply (assignment, timestamp, error))
+	    result = TRUE;
+
+	crtc_assignment_free (assignment);
+
+	display = gdk_display_get_default ();
+	gdk_display_flush (display);
+    }
+
+    return result;
+}
+
+/* mate_rr_config_apply_from_filename_with_time:
+ * @screen: A #MateRRScreen
+ * @filename: Path of the file to look in for stored RANDR configurations.
+ * @timestamp: X server timestamp from the event that causes the screen configuration to change (a user's button press, for example)
+ * @error: Location to store error, or %NULL
+ *
+ * First, this function refreshes the @screen to match the current RANDR
+ * configuration from the X server.  Then, it tries to load the file in
+ * @filename and looks for suitable matching RANDR configurations in the file;
+ * if one is found, that configuration will be applied to the current set of
+ * RANDR outputs.
+ *
+ * Typically, @filename is the result of mate_rr_config_get_intended_filename() or
+ * mate_rr_config_get_backup_filename().
+ *
+ * Returns: TRUE if the RANDR configuration was loaded and applied from
+ * $(XDG_CONFIG_HOME)/monitors.xml, or FALSE otherwise:
+ *
+ * If the current RANDR configuration could not be refreshed, the @error will
+ * have a domain of #MATE_RR_ERROR and a corresponding error code.
+ *
+ * If the file in question is loaded successfully but the configuration cannot
+ * be applied, the @error will have a domain of #MATE_RR_ERROR.  Note that an
+ * error code of #MATE_RR_ERROR_NO_MATCHING_CONFIG is not a real error; it
+ * simply means that there were no stored configurations that match the current
+ * set of RANDR outputs.
+ *
+ * If the file in question cannot be loaded, the @error will have a domain of
+ * #G_FILE_ERROR.  Note that an error code of G_FILE_ERROR_NOENT is not really
+ * an error, either; it means that there was no stored configuration file and so
+ * nothing is changed.
+ */
+gboolean
+mate_rr_config_apply_from_filename_with_time (MateRRScreen *screen, const char *filename, guint32 timestamp, GError **error)
+{
+    MateRRConfig *stored;
+    GError *my_error;
+
+    g_return_val_if_fail (MATE_IS_RR_SCREEN (screen), FALSE);
+    g_return_val_if_fail (filename != NULL, FALSE);
+    g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+    my_error = NULL;
+    if (!mate_rr_screen_refresh (screen, &my_error)) {
+	    if (my_error) {
+		    g_propagate_error (error, my_error);
+		    return FALSE; /* This is a genuine error */
+	    }
+
+	    /* This means the screen didn't change, so just proceed */
+    }
+
+    stored = g_object_new (MATE_TYPE_RR_CONFIG, "screen", screen, NULL);
+
+    if (mate_rr_config_load_filename (stored, filename, error))
+    {
+	gboolean result;
+
+	mate_rr_config_ensure_primary (stored);
+	result = mate_rr_config_apply_with_time (stored, screen, timestamp, error);
+
+	g_object_unref (stored);
+
+	return result;
+    }
+    else
+    {
+        g_object_unref (stored);
+	return FALSE;
+    }
+}
+
+/**
+ * mate_rr_config_get_outputs:
+ *
+ * Returns: (array zero-terminated=1) (element-type MateDesktop.RROutputInfo) (transfer none): the output configuration for this #MateRRConfig
+ */
+MateRROutputInfo **
+mate_rr_config_get_outputs (MateRRConfig *self)
+{
+    g_return_val_if_fail (MATE_IS_RR_CONFIG (self), NULL);
+
+    return self->priv->outputs;
+}
+
+/**
+ * mate_rr_config_get_clone:
+ *
+ * Returns: whether at least two outputs are at (0, 0) offset and they
+ * have the same width/height.  Those outputs are of course connected and on
+ * (i.e. they have a CRTC assigned).
+ */
+gboolean
+mate_rr_config_get_clone (MateRRConfig *self)
+{
+    g_return_val_if_fail (MATE_IS_RR_CONFIG (self), FALSE);
+
+    return self->priv->clone;
+}
+
+void
+mate_rr_config_set_clone (MateRRConfig *self, gboolean clone)
+{
+    g_return_if_fail (MATE_IS_RR_CONFIG (self));
+
+    self->priv->clone = clone;
+}
+
+/*
+ * CRTC assignment
+ */
+typedef struct CrtcInfo CrtcInfo;
+
+struct CrtcInfo
+{
+    MateRRMode    *mode;
+    int        x;
+    int        y;
+    MateRRRotation rotation;
+    GPtrArray *outputs;
+};
+
+struct CrtcAssignment
+{
+    MateRRScreen *screen;
+    GHashTable *info;
+    MateRROutput *primary;
+};
+
+static gboolean
+can_clone (CrtcInfo *info,
+	   MateRROutput *output)
+{
+    guint i;
+
+    for (i = 0; i < info->outputs->len; ++i)
+    {
+	MateRROutput *clone = info->outputs->pdata[i];
+
+	if (!mate_rr_output_can_clone (clone, output))
+	    return FALSE;
+    }
+
+    return TRUE;
+}
+
+static gboolean
+crtc_assignment_assign (CrtcAssignment   *assign,
+			MateRRCrtc      *crtc,
+			MateRRMode      *mode,
+			int               x,
+			int               y,
+			MateRRRotation   rotation,
+                        gboolean          primary,
+			MateRROutput    *output,
+			GError          **error)
+{
+    CrtcInfo *info = g_hash_table_lookup (assign->info, crtc);
+    guint32 crtc_id;
+    const char *output_name;
+
+    crtc_id = mate_rr_crtc_get_id (crtc);
+    output_name = mate_rr_output_get_name (output);
+
+    if (!mate_rr_crtc_can_drive_output (crtc, output))
+    {
+	g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_CRTC_ASSIGNMENT,
+		     _("CRTC %d cannot drive output %s"), crtc_id, output_name);
+	return FALSE;
+    }
+
+    if (!mate_rr_output_supports_mode (output, mode))
+    {
+	g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_CRTC_ASSIGNMENT,
+		     _("output %s does not support mode %dx%d@%dHz"),
+		     output_name,
+		     mate_rr_mode_get_width (mode),
+		     mate_rr_mode_get_height (mode),
+		     mate_rr_mode_get_freq (mode));
+	return FALSE;
+    }
+
+    if (!mate_rr_crtc_supports_rotation (crtc, rotation))
+    {
+	g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_CRTC_ASSIGNMENT,
+		     _("CRTC %d does not support rotation=%s"),
+		     crtc_id,
+		     get_rotation_name (rotation));
+	return FALSE;
+    }
+
+    if (info)
+    {
+	if (!(info->mode == mode	&&
+	      info->x == x		&&
+	      info->y == y		&&
+	      info->rotation == rotation))
+	{
+	    g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_CRTC_ASSIGNMENT,
+			 _("output %s does not have the same parameters as another cloned output:\n"
+			   "existing mode = %d, new mode = %d\n"
+			   "existing coordinates = (%d, %d), new coordinates = (%d, %d)\n"
+			   "existing rotation = %s, new rotation = %s"),
+			 output_name,
+			 mate_rr_mode_get_id (info->mode), mate_rr_mode_get_id (mode),
+			 info->x, info->y,
+			 x, y,
+			 get_rotation_name (info->rotation), get_rotation_name (rotation));
+	    return FALSE;
+	}
+
+	if (!can_clone (info, output))
+	{
+	    g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_CRTC_ASSIGNMENT,
+			 _("cannot clone to output %s"),
+			 output_name);
+	    return FALSE;
+	}
+
+	g_ptr_array_add (info->outputs, output);
+
+	if (primary && !assign->primary)
+	{
+	    assign->primary = output;
+	}
+
+	return TRUE;
+    }
+    else
+    {
+	info = g_new0 (CrtcInfo, 1);
+
+	info->mode = mode;
+	info->x = x;
+	info->y = y;
+	info->rotation = rotation;
+	info->outputs = g_ptr_array_new ();
+
+	g_ptr_array_add (info->outputs, output);
+
+	g_hash_table_insert (assign->info, crtc, info);
+
+        if (primary && !assign->primary)
+        {
+            assign->primary = output;
+        }
+
+	return TRUE;
+    }
+}
+
+static void
+crtc_assignment_unassign (CrtcAssignment *assign,
+			  MateRRCrtc         *crtc,
+			  MateRROutput       *output)
+{
+    CrtcInfo *info = g_hash_table_lookup (assign->info, crtc);
+
+    if (info)
+    {
+	g_ptr_array_remove (info->outputs, output);
+
+        if (assign->primary == output)
+        {
+            assign->primary = NULL;
+        }
+
+	if (info->outputs->len == 0)
+	    g_hash_table_remove (assign->info, crtc);
+    }
+}
+
+static void
+crtc_assignment_free (CrtcAssignment *assign)
+{
+    g_hash_table_destroy (assign->info);
+
+    g_free (assign);
+}
+
+typedef struct {
+    guint32 timestamp;
+    gboolean has_error;
+    GError **error;
+} ConfigureCrtcState;
+
+static void
+configure_crtc (gpointer key,
+		gpointer value,
+		gpointer data)
+{
+    MateRRCrtc *crtc = key;
+    CrtcInfo *info = value;
+    ConfigureCrtcState *state = data;
+
+    if (state->has_error)
+	return;
+
+    if (!mate_rr_crtc_set_config_with_time (crtc,
+					     state->timestamp,
+					     info->x, info->y,
+					     info->mode,
+					     info->rotation,
+					     (MateRROutput **)info->outputs->pdata,
+					     info->outputs->len,
+					     state->error))
+	state->has_error = TRUE;
+}
+
+static gboolean
+mode_is_rotated (CrtcInfo *info)
+{
+    if ((info->rotation & MATE_RR_ROTATION_270)		||
+	(info->rotation & MATE_RR_ROTATION_90))
+    {
+	return TRUE;
+    }
+    return FALSE;
+}
+
+static gboolean
+crtc_is_rotated (MateRRCrtc *crtc)
+{
+    MateRRRotation r = mate_rr_crtc_get_current_rotation (crtc);
+
+    if ((r & MATE_RR_ROTATION_270)		||
+	(r & MATE_RR_ROTATION_90))
+    {
+	return TRUE;
+    }
+
+    return FALSE;
+}
+
+static void
+accumulate_error (GString *accumulated_error, GError *error)
+{
+    g_string_append_printf (accumulated_error, "    %s\n", error->message);
+    g_error_free (error);
+}
+
+/* Check whether the given set of settings can be used
+ * at the same time -- ie. whether there is an assignment
+ * of CRTC's to outputs.
+ *
+ * Brute force - the number of objects involved is small
+ * enough that it doesn't matter.
+ */
+static gboolean
+real_assign_crtcs (MateRRScreen *screen,
+		   MateRROutputInfo **outputs,
+		   CrtcAssignment *assignment,
+		   GError **error)
+{
+    MateRRCrtc **crtcs = mate_rr_screen_list_crtcs (screen);
+    MateRROutputInfo *output;
+    int i;
+    gboolean tried_mode;
+    GError *my_error;
+    GString *accumulated_error;
+    gboolean success;
+
+    output = *outputs;
+    if (!output)
+	return TRUE;
+
+    /* It is always allowed for an output to be turned off */
+    if (!output->priv->on)
+    {
+	return real_assign_crtcs (screen, outputs + 1, assignment, error);
+    }
+
+    success = FALSE;
+    tried_mode = FALSE;
+    accumulated_error = g_string_new (NULL);
+
+    for (i = 0; crtcs[i] != NULL; ++i)
+    {
+	MateRRCrtc *crtc = crtcs[i];
+	int crtc_id = mate_rr_crtc_get_id (crtc);
+	int pass;
+
+	g_string_append_printf (accumulated_error,
+				_("Trying modes for CRTC %d\n"),
+				crtc_id);
+
+	/* Make two passes, one where frequencies must match, then
+	 * one where they don't have to
+	 */
+	for (pass = 0; pass < 2; ++pass)
+	{
+	    MateRROutput *mate_rr_output = mate_rr_screen_get_output_by_name (screen, output->priv->name);
+	    MateRRMode **modes = mate_rr_output_list_modes (mate_rr_output);
+	    int j;
+
+	    for (j = 0; modes[j] != NULL; ++j)
+	    {
+		MateRRMode *mode = modes[j];
+		int mode_width;
+		int mode_height;
+		int mode_freq;
+
+		mode_width = mate_rr_mode_get_width (mode);
+		mode_height = mate_rr_mode_get_height (mode);
+		mode_freq = mate_rr_mode_get_freq (mode);
+
+		g_string_append_printf (accumulated_error,
+					_("CRTC %d: trying mode %dx%d@%dHz with output at %dx%d@%dHz (pass %d)\n"),
+					crtc_id,
+					mode_width, mode_height, mode_freq,
+					output->priv->width, output->priv->height, output->priv->rate,
+					pass);
+
+		if (mode_width == output->priv->width	&&
+		    mode_height == output->priv->height &&
+		    (pass == 1 || mode_freq == output->priv->rate))
+		{
+		    tried_mode = TRUE;
+
+		    my_error = NULL;
+		    if (crtc_assignment_assign (
+			    assignment, crtc, modes[j],
+			    output->priv->x, output->priv->y,
+			    output->priv->rotation,
+                            output->priv->primary,
+			    mate_rr_output,
+			    &my_error))
+		    {
+			my_error = NULL;
+			if (real_assign_crtcs (screen, outputs + 1, assignment, &my_error)) {
+			    success = TRUE;
+			    goto out;
+			} else
+			    accumulate_error (accumulated_error, my_error);
+
+			crtc_assignment_unassign (assignment, crtc, mate_rr_output);
+		    } else
+			accumulate_error (accumulated_error, my_error);
+		}
+	    }
+	}
+    }
+
+out:
+
+    if (success)
+	g_string_free (accumulated_error, TRUE);
+    else {
+	char *str;
+
+	str = g_string_free (accumulated_error, FALSE);
+
+	if (tried_mode)
+	    g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_CRTC_ASSIGNMENT,
+			 _("could not assign CRTCs to outputs:\n%s"),
+			 str);
+	else
+	    g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_CRTC_ASSIGNMENT,
+			 _("none of the selected modes were compatible with the possible modes:\n%s"),
+			 str);
+
+	g_free (str);
+    }
+
+    return success;
+}
+
+static void
+crtc_info_free (CrtcInfo *info)
+{
+    g_ptr_array_free (info->outputs, TRUE);
+    g_free (info);
+}
+
+static void
+get_required_virtual_size (CrtcAssignment *assign, int *width, int *height)
+{
+    GList *active_crtcs = g_hash_table_get_keys (assign->info);
+    GList *list;
+    int d;
+
+    if (!width)
+	width = &d;
+    if (!height)
+	height = &d;
+
+    /* Compute size of the screen */
+    *width = *height = 1;
+    for (list = active_crtcs; list != NULL; list = list->next)
+    {
+	MateRRCrtc *crtc = list->data;
+	CrtcInfo *info = g_hash_table_lookup (assign->info, crtc);
+	int w, h;
+
+	w = mate_rr_mode_get_width (info->mode);
+	h = mate_rr_mode_get_height (info->mode);
+
+	if (mode_is_rotated (info))
+	{
+	    int tmp = h;
+	    h = w;
+	    w = tmp;
+	}
+
+	*width = MAX (*width, info->x + w);
+	*height = MAX (*height, info->y + h);
+    }
+
+    g_list_free (active_crtcs);
+}
+
+static CrtcAssignment *
+crtc_assignment_new (MateRRScreen *screen, MateRROutputInfo **outputs, GError **error)
+{
+    CrtcAssignment *assignment = g_new0 (CrtcAssignment, 1);
+
+    assignment->info = g_hash_table_new_full (
+	g_direct_hash, g_direct_equal, NULL, (GFreeFunc)crtc_info_free);
+
+    if (real_assign_crtcs (screen, outputs, assignment, error))
+    {
+	int width, height;
+	int min_width, max_width, min_height, max_height;
+	int required_pixels, min_pixels, max_pixels;
+
+	get_required_virtual_size (assignment, &width, &height);
+
+	mate_rr_screen_get_ranges (
+	    screen, &min_width, &max_width, &min_height, &max_height);
+
+	required_pixels = width * height;
+	min_pixels = min_width * min_height;
+	max_pixels = max_width * max_height;
+
+	if (required_pixels < min_pixels || required_pixels > max_pixels)
+	{
+	    g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_BOUNDS_ERROR,
+			 /* Translators: the "requested", "minimum", and
+			  * "maximum" words here are not keywords; please
+			  * translate them as usual. */
+			 _("required virtual size does not fit available size: "
+			   "requested=(%d, %d), minimum=(%d, %d), maximum=(%d, %d)"),
+			 width, height,
+			 min_width, min_height,
+			 max_width, max_height);
+	    goto fail;
+	}
+
+	assignment->screen = screen;
+
+	return assignment;
+    }
+
+fail:
+    crtc_assignment_free (assignment);
+
+    return NULL;
+}
+
+static gboolean
+crtc_assignment_apply (CrtcAssignment *assign, guint32 timestamp, GError **error)
+{
+    MateRRCrtc **all_crtcs = mate_rr_screen_list_crtcs (assign->screen);
+    int width, height;
+    int i;
+    int min_width, max_width, min_height, max_height;
+    int width_mm, height_mm;
+    gboolean success = TRUE;
+
+    /* Compute size of the screen */
+    get_required_virtual_size (assign, &width, &height);
+
+    mate_rr_screen_get_ranges (
+	assign->screen, &min_width, &max_width, &min_height, &max_height);
+
+    /* We should never get here if the dimensions don't fit in the virtual size,
+     * but just in case we do, fix it up.
+     */
+    width = MAX (min_width, width);
+    width = MIN (max_width, width);
+    height = MAX (min_height, height);
+    height = MIN (max_height, height);
+
+    /* FMQ: do we need to check the sizes instead of clamping them? */
+
+    /* Grab the server while we fiddle with the CRTCs and the screen, so that
+     * apps that listen for RANDR notifications will only receive the final
+     * status.
+     */
+
+    gdk_x11_display_grab (gdk_screen_get_display (assign->screen->priv->gdk_screen));
+
+    /* Turn off all crtcs that are currently displaying outside the new screen,
+     * or are not used in the new setup
+     */
+    for (i = 0; all_crtcs[i] != NULL; ++i)
+    {
+	MateRRCrtc *crtc = all_crtcs[i];
+	MateRRMode *mode = mate_rr_crtc_get_current_mode (crtc);
+	int x, y;
+
+	if (mode)
+	{
+	    int w, h;
+	    mate_rr_crtc_get_position (crtc, &x, &y);
+
+	    w = mate_rr_mode_get_width (mode);
+	    h = mate_rr_mode_get_height (mode);
+
+	    if (crtc_is_rotated (crtc))
+	    {
+		int tmp = h;
+		h = w;
+		w = tmp;
+	    }
+
+	    if (x + w > width || y + h > height || !g_hash_table_lookup (assign->info, crtc))
+	    {
+		if (!mate_rr_crtc_set_config_with_time (crtc, timestamp, 0, 0, NULL, MATE_RR_ROTATION_0, NULL, 0, error))
+		{
+		    success = FALSE;
+		    break;
+		}
+
+	    }
+	}
+    }
+
+    /* The 'physical size' of an X screen is meaningless if that screen
+     * can consist of many monitors. So just pick a size that make the
+     * dpi 96.
+     *
+     * Firefox and Evince apparently believe what X tells them.
+     */
+    width_mm = (width / 96.0) * 25.4 + 0.5;
+    height_mm = (height / 96.0) * 25.4 + 0.5;
+
+    if (success)
+    {
+	ConfigureCrtcState state;
+
+	mate_rr_screen_set_size (assign->screen, width, height, width_mm, height_mm);
+
+	state.timestamp = timestamp;
+	state.has_error = FALSE;
+	state.error = error;
+
+	g_hash_table_foreach (assign->info, configure_crtc, &state);
+
+	success = !state.has_error;
+    }
+
+    mate_rr_screen_set_primary_output (assign->screen, assign->primary);
+
+    gdk_x11_display_ungrab (gdk_screen_get_display (assign->screen->priv->gdk_screen));
+
+    return success;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/89.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/89.html new file mode 100644 index 00000000..d8255b82 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/89.html @@ -0,0 +1,637 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
/* mate-rr.h
+ *
+ * Copyright 2007, 2008, Red Hat, Inc.
+ *
+ * This file is part of the Mate Library.
+ *
+ * The Mate Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Mate 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Mate Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ *
+ * Author: Soren Sandmann <sandmann@redhat.com>
+ */
+#ifndef MATE_RR_H
+#define MATE_RR_H
+
+#ifndef MATE_DESKTOP_USE_UNSTABLE_API
+#error    MateRR is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including materr.h
+#endif
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+typedef struct MateRRScreenPrivate MateRRScreenPrivate;
+typedef struct MateRROutput MateRROutput;
+typedef struct MateRRCrtc MateRRCrtc;
+typedef struct MateRRMode MateRRMode;
+
+typedef struct {
+    GObject parent;
+
+    MateRRScreenPrivate* priv;
+} MateRRScreen;
+
+typedef struct {
+    GObjectClass parent_class;
+
+        void (* changed) (void);
+} MateRRScreenClass;
+
+typedef enum
+{
+    MATE_RR_ROTATION_0 =	(1 << 0),
+    MATE_RR_ROTATION_90 =	(1 << 1),
+    MATE_RR_ROTATION_180 =	(1 << 2),
+    MATE_RR_ROTATION_270 =	(1 << 3),
+    MATE_RR_REFLECT_X =	(1 << 4),
+    MATE_RR_REFLECT_Y =	(1 << 5)
+} MateRRRotation;
+
+/* Error codes */
+
+#define MATE_RR_ERROR (mate_rr_error_quark ())
+
+GQuark mate_rr_error_quark (void);
+
+typedef enum {
+    MATE_RR_ERROR_UNKNOWN,		/* generic "fail" */
+    MATE_RR_ERROR_NO_RANDR_EXTENSION,	/* RANDR extension is not present */
+    MATE_RR_ERROR_RANDR_ERROR,		/* generic/undescribed error from the underlying XRR API */
+    MATE_RR_ERROR_BOUNDS_ERROR,	/* requested bounds of a CRTC are outside the maximum size */
+    MATE_RR_ERROR_CRTC_ASSIGNMENT,	/* could not assign CRTCs to outputs */
+    MATE_RR_ERROR_NO_MATCHING_CONFIG,	/* none of the saved configurations matched the current configuration */
+} MateRRError;
+
+#define MATE_RR_CONNECTOR_TYPE_PANEL "Panel"  /* This is a laptop's built-in LCD */
+
+#define MATE_TYPE_RR_SCREEN                  (mate_rr_screen_get_type())
+#define MATE_RR_SCREEN(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_RR_SCREEN, MateRRScreen))
+#define MATE_IS_RR_SCREEN(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_RR_SCREEN))
+#define MATE_RR_SCREEN_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_RR_SCREEN, MateRRScreenClass))
+#define MATE_IS_RR_SCREEN_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_RR_SCREEN))
+#define MATE_RR_SCREEN_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_RR_SCREEN, MateRRScreenClass))
+
+#define MATE_TYPE_RR_OUTPUT (mate_rr_output_get_type())
+#define MATE_TYPE_RR_CRTC   (mate_rr_crtc_get_type())
+#define MATE_TYPE_RR_MODE   (mate_rr_mode_get_type())
+
+GType mate_rr_screen_get_type (void);
+GType mate_rr_output_get_type (void);
+GType mate_rr_crtc_get_type (void);
+GType mate_rr_mode_get_type (void);
+
+/* MateRRScreen */
+MateRRScreen * mate_rr_screen_new                (GdkScreen             *screen,
+						    GError               **error);
+MateRROutput **mate_rr_screen_list_outputs       (MateRRScreen         *screen);
+MateRRCrtc **  mate_rr_screen_list_crtcs         (MateRRScreen         *screen);
+MateRRMode **  mate_rr_screen_list_modes         (MateRRScreen         *screen);
+MateRRMode **  mate_rr_screen_list_clone_modes   (MateRRScreen	  *screen);
+void            mate_rr_screen_set_size           (MateRRScreen         *screen,
+						    int                    width,
+						    int                    height,
+						    int                    mm_width,
+						    int                    mm_height);
+MateRRCrtc *   mate_rr_screen_get_crtc_by_id     (MateRRScreen         *screen,
+						    guint32                id);
+gboolean        mate_rr_screen_refresh            (MateRRScreen         *screen,
+						    GError               **error);
+MateRROutput * mate_rr_screen_get_output_by_id   (MateRRScreen         *screen,
+						    guint32                id);
+MateRROutput * mate_rr_screen_get_output_by_name (MateRRScreen         *screen,
+						    const char            *name);
+void            mate_rr_screen_get_ranges         (MateRRScreen         *screen,
+						    int                   *min_width,
+						    int                   *max_width,
+						    int                   *min_height,
+						    int                   *max_height);
+void            mate_rr_screen_get_timestamps     (MateRRScreen         *screen,
+						    guint32               *change_timestamp_ret,
+						    guint32               *config_timestamp_ret);
+
+void            mate_rr_screen_set_primary_output (MateRRScreen         *screen,
+                                                    MateRROutput         *output);
+
+/* MateRROutput */
+guint32         mate_rr_output_get_id             (MateRROutput         *output);
+const char *    mate_rr_output_get_name           (MateRROutput         *output);
+gboolean        mate_rr_output_is_connected       (MateRROutput         *output);
+int             mate_rr_output_get_size_inches    (MateRROutput         *output);
+int             mate_rr_output_get_width_mm       (MateRROutput         *outout);
+int             mate_rr_output_get_height_mm      (MateRROutput         *output);
+const guint8 *  mate_rr_output_get_edid_data      (MateRROutput         *output);
+MateRRCrtc **  mate_rr_output_get_possible_crtcs (MateRROutput         *output);
+MateRRMode *   mate_rr_output_get_current_mode   (MateRROutput         *output);
+MateRRCrtc *   mate_rr_output_get_crtc           (MateRROutput         *output);
+const char *    mate_rr_output_get_connector_type (MateRROutput         *output);
+gboolean        mate_rr_output_is_laptop          (MateRROutput         *output);
+void            mate_rr_output_get_position       (MateRROutput         *output,
+						    int                   *x,
+						    int                   *y);
+gboolean        mate_rr_output_can_clone          (MateRROutput         *output,
+						    MateRROutput         *clone);
+MateRRMode **  mate_rr_output_list_modes         (MateRROutput         *output);
+MateRRMode *   mate_rr_output_get_preferred_mode (MateRROutput         *output);
+gboolean        mate_rr_output_supports_mode      (MateRROutput         *output,
+						    MateRRMode           *mode);
+gboolean        mate_rr_output_get_is_primary     (MateRROutput         *output);
+
+/* MateRRMode */
+guint32         mate_rr_mode_get_id               (MateRRMode           *mode);
+guint           mate_rr_mode_get_width            (MateRRMode           *mode);
+guint           mate_rr_mode_get_height           (MateRRMode           *mode);
+int             mate_rr_mode_get_freq             (MateRRMode           *mode);
+
+/* MateRRCrtc */
+guint32         mate_rr_crtc_get_id               (MateRRCrtc           *crtc);
+
+#ifndef MATE_DISABLE_DEPRECATED
+gboolean        mate_rr_crtc_set_config           (MateRRCrtc           *crtc,
+						    int                    x,
+						    int                    y,
+						    MateRRMode           *mode,
+						    MateRRRotation        rotation,
+						    MateRROutput        **outputs,
+						    int                    n_outputs,
+						    GError               **error);
+#endif
+
+gboolean        mate_rr_crtc_set_config_with_time (MateRRCrtc           *crtc,
+						    guint32                timestamp,
+						    int                    x,
+						    int                    y,
+						    MateRRMode           *mode,
+						    MateRRRotation        rotation,
+						    MateRROutput        **outputs,
+						    int                    n_outputs,
+						    GError               **error);
+gboolean        mate_rr_crtc_can_drive_output     (MateRRCrtc           *crtc,
+						    MateRROutput         *output);
+MateRRMode *   mate_rr_crtc_get_current_mode     (MateRRCrtc           *crtc);
+void            mate_rr_crtc_get_position         (MateRRCrtc           *crtc,
+						    int                   *x,
+						    int                   *y);
+MateRRRotation mate_rr_crtc_get_current_rotation (MateRRCrtc           *crtc);
+MateRRRotation mate_rr_crtc_get_rotations        (MateRRCrtc           *crtc);
+gboolean        mate_rr_crtc_supports_rotation    (MateRRCrtc           *crtc,
+						    MateRRRotation        rotation);
+
+gboolean        mate_rr_crtc_get_gamma            (MateRRCrtc           *crtc,
+						    int                   *size,
+						    unsigned short       **red,
+						    unsigned short       **green,
+						    unsigned short       **blue);
+void            mate_rr_crtc_set_gamma            (MateRRCrtc           *crtc,
+						    int                    size,
+						    unsigned short        *red,
+						    unsigned short        *green,
+						    unsigned short        *blue);
+#endif /* MATE_RR_H */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/9.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/9.html new file mode 100644 index 00000000..39db5e90 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/9.html @@ -0,0 +1,563 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
/*
+ * Copyright (C) 2000 by Jörgen Pehrson <jp@spektr.eu.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ $Id$
+ */
+
+#ifndef _battstat_h_
+#define _battstat_h_
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <mate-panel-applet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <mate-panel-applet-gsettings.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define DEBUG 0
+
+#define PROGLEN 33.0
+
+/* I made these multipliers up
+ *  --davyd
+ */
+#define ORANGE_MULTIPLIER 1.5
+#define YELLOW_MULTIPLIER 2.5
+
+typedef enum
+{
+  APPLET_SHOW_NONE = 0,
+  APPLET_SHOW_PERCENT,
+  APPLET_SHOW_TIME
+} AppletTextType;
+
+typedef enum
+{
+  STATUS_PIXMAP_BATTERY,
+  STATUS_PIXMAP_METER,
+  STATUS_PIXMAP_AC,
+  STATUS_PIXMAP_CHARGE,
+  STATUS_PIXMAP_WARNING,
+  STATUS_PIXMAP_NUM
+} StatusPixmapIndex;
+
+typedef enum
+{
+  POWER_STATUS_OFF = 0,
+  POWER_STATUS_ON,
+  POWER_STATUS_UNKNOWN
+} PowerStatus;
+
+typedef struct
+{
+  PowerStatus on_ac_power;
+  PowerStatus charging;
+  gboolean    present;
+  gint        minutes;
+  gint        percent;
+} BatteryStatus;
+
+typedef enum
+{
+  LAYOUT_NONE,
+  LAYOUT_LONG,
+  LAYOUT_TOPLEFT,
+  LAYOUT_TOP,
+  LAYOUT_LEFT,
+  LAYOUT_CENTRE,
+  LAYOUT_RIGHT,
+  LAYOUT_BOTTOM
+} LayoutLocation;
+
+typedef struct
+{
+  LayoutLocation status;
+  LayoutLocation text;
+  LayoutLocation battery;
+} LayoutConfiguration;
+
+typedef struct _ProgressData {
+  GtkWidget *applet;
+
+  /* flags set from gsettings or the properties dialog */
+  GSettings *settings;
+  guint red_val;
+  guint orange_val;
+  guint yellow_val;
+  gboolean red_value_is_time;
+  gboolean lowbattnotification;
+  gboolean fullbattnot;
+  gboolean beep;
+  AppletTextType showtext;
+
+  /* label changed type (% <-> h:mm) and must be refreshed */
+  gboolean refresh_label;
+
+  /* the main grid that contains the visual elements */
+  GtkWidget *grid;
+
+  /* the visual elements */
+  GtkWidget *battery;
+  GtkWidget *status;
+  GtkWidget *percent;
+
+  /* dialog boxes that might be displayed */
+  GtkWidget *prop_win;
+  GtkWidget *battery_low_dialog;
+
+  /* text label inside the low battery dialog */
+  GtkLabel *battery_low_label;
+
+  /* our height/width as given to us by size_allocate */
+  gint width, height;
+
+  /* should the battery meter be drawn horizontally? */
+  gboolean horizont;
+
+  /* on a vertical or horizontal panel? (up/down/left/right) */
+  MatePanelAppletOrient orienttype;
+
+  /* the current layout of the visual elements inside the grid */
+  LayoutConfiguration layout;
+
+  /* g_timeout source identifier */
+  int timeout_id;
+  int timeout;
+
+  /* last_* for the benefit of the check_for_updates function */
+  guint             last_batt_life;
+  StatusPixmapIndex last_pixmap_index;
+  PowerStatus       last_acline_status;
+  PowerStatus       last_charging;
+  gboolean          last_present;
+  guint             last_minutes;
+} ProgressData;
+
+/* battstat_applet.c */
+void reconfigure_layout (ProgressData *battstat);
+void battstat_show_help (ProgressData *battstat, const char *section);
+void prop_cb (GtkAction *, ProgressData *);
+
+/* power-management.c */
+const char *power_management_getinfo (BatteryStatus *status);
+const char *power_management_initialise (void (*callback) (void));
+void power_management_cleanup (void);
+
+gboolean power_management_using_upower (void);
+
+#endif /* _battstat_h_ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/90.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/90.html new file mode 100644 index 00000000..0bf312a1 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/90.html @@ -0,0 +1,537 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
/* mate-rr-config.h
+ * -*- c-basic-offset: 4 -*-
+ *
+ * Copyright 2007, 2008, Red Hat, Inc.
+ * Copyright 2010 Giovanni Campagna
+ *
+ * This file is part of the Mate Library.
+ *
+ * The Mate Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Mate 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Mate Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ *
+ * Author: Soren Sandmann <sandmann@redhat.com>
+ */
+#ifndef MATE_RR_CONFIG_H
+#define MATE_RR_CONFIG_H
+
+#ifndef MATE_DESKTOP_USE_UNSTABLE_API
+#error   mate-rr-config.h is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including mate-rr-config.h
+#endif
+
+#include "mate-rr.h"
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+typedef struct MateRROutputInfoPrivate MateRROutputInfoPrivate;
+typedef struct MateRRConfigPrivate MateRRConfigPrivate;
+
+typedef struct
+{
+    GObject parent;
+
+    /*< private >*/
+    MateRROutputInfoPrivate *priv;
+} MateRROutputInfo;
+
+typedef struct
+{
+    GObjectClass parent_class;
+} MateRROutputInfoClass;
+
+#define MATE_TYPE_RR_OUTPUT_INFO                  (mate_rr_output_info_get_type())
+#define MATE_RR_OUTPUT_INFO(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_RR_OUTPUT_INFO, MateRROutputInfo))
+#define MATE_IS_RR_OUTPUT_INFO(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_RR_OUTPUT_INFO))
+#define MATE_RR_OUTPUT_INFO_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_RR_OUTPUT_INFO, MateRROutputInfoClass))
+#define MATE_IS_RR_OUTPUT_INFO_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_RR_OUTPUT_INFO))
+#define MATE_RR_OUTPUT_INFO_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_RR_OUTPUT_INFO, MateRROutputInfoClass))
+
+GType mate_rr_output_info_get_type (void);
+
+char *mate_rr_output_info_get_name (MateRROutputInfo *self);
+
+gboolean mate_rr_output_info_is_active  (MateRROutputInfo *self);
+void     mate_rr_output_info_set_active (MateRROutputInfo *self, gboolean active);
+
+void mate_rr_output_info_get_geometry (MateRROutputInfo *self, int *x, int *y, int *width, int *height);
+void mate_rr_output_info_set_geometry (MateRROutputInfo *self, int  x, int  y, int  width, int  height);
+
+int  mate_rr_output_info_get_refresh_rate (MateRROutputInfo *self);
+void mate_rr_output_info_set_refresh_rate (MateRROutputInfo *self, int rate);
+
+MateRRRotation mate_rr_output_info_get_rotation (MateRROutputInfo *self);
+void            mate_rr_output_info_set_rotation (MateRROutputInfo *self, MateRRRotation rotation);
+
+gboolean mate_rr_output_info_is_connected     (MateRROutputInfo *self);
+void     mate_rr_output_info_get_vendor       (MateRROutputInfo *self, gchar* vendor);
+guint    mate_rr_output_info_get_product      (MateRROutputInfo *self);
+guint    mate_rr_output_info_get_serial       (MateRROutputInfo *self);
+double   mate_rr_output_info_get_aspect_ratio (MateRROutputInfo *self);
+char    *mate_rr_output_info_get_display_name (MateRROutputInfo *self);
+
+gboolean mate_rr_output_info_get_primary (MateRROutputInfo *self);
+void     mate_rr_output_info_set_primary (MateRROutputInfo *self, gboolean primary);
+
+int mate_rr_output_info_get_preferred_width  (MateRROutputInfo *self);
+int mate_rr_output_info_get_preferred_height (MateRROutputInfo *self);
+
+typedef struct
+{
+    GObject parent;
+
+    /*< private >*/
+    MateRRConfigPrivate *priv;
+} MateRRConfig;
+
+typedef struct
+{
+    GObjectClass parent_class;
+} MateRRConfigClass;
+
+#define MATE_TYPE_RR_CONFIG                  (mate_rr_config_get_type())
+#define MATE_RR_CONFIG(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_RR_CONFIG, MateRRConfig))
+#define MATE_IS_RR_CONFIG(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_RR_CONFIG))
+#define MATE_RR_CONFIG_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_RR_CONFIG, MateRRConfigClass))
+#define MATE_IS_RR_CONFIG_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_RR_CONFIG))
+#define MATE_RR_CONFIG_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_RR_CONFIG, MateRRConfigClass))
+
+GType               mate_rr_config_get_type     (void);
+
+MateRRConfig      *mate_rr_config_new_current  (MateRRScreen  *screen,
+						  GError        **error);
+MateRRConfig      *mate_rr_config_new_stored   (MateRRScreen  *screen,
+						  GError        **error);
+gboolean                mate_rr_config_load_current (MateRRConfig  *self,
+						      GError        **error);
+gboolean                mate_rr_config_load_filename (MateRRConfig  *self,
+						       const gchar    *filename,
+						       GError        **error);
+gboolean            mate_rr_config_match        (MateRRConfig  *config1,
+						  MateRRConfig  *config2);
+gboolean            mate_rr_config_equal	 (MateRRConfig  *config1,
+						  MateRRConfig  *config2);
+gboolean            mate_rr_config_save         (MateRRConfig  *configuration,
+						  GError        **error);
+void                mate_rr_config_sanitize     (MateRRConfig  *configuration);
+gboolean            mate_rr_config_ensure_primary (MateRRConfig  *configuration);
+
+gboolean	    mate_rr_config_apply_with_time (MateRRConfig  *configuration,
+						     MateRRScreen  *screen,
+						     guint32         timestamp,
+						     GError        **error);
+
+gboolean            mate_rr_config_apply_from_filename_with_time (MateRRScreen  *screen,
+								   const char     *filename,
+								   guint32         timestamp,
+								   GError        **error);
+
+gboolean            mate_rr_config_applicable   (MateRRConfig  *configuration,
+						  MateRRScreen  *screen,
+						  GError        **error);
+
+gboolean            mate_rr_config_get_clone    (MateRRConfig  *configuration);
+void                mate_rr_config_set_clone    (MateRRConfig  *configuration, gboolean clone);
+MateRROutputInfo **mate_rr_config_get_outputs  (MateRRConfig  *configuration);
+
+char *mate_rr_config_get_backup_filename (void);
+char *mate_rr_config_get_intended_filename (void);
+
+#endif
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/91.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/91.html new file mode 100644 index 00000000..6809b51d --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/91.html @@ -0,0 +1,405 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
#ifndef MATE_RR_PRIVATE_H
+#define MATE_RR_PRIVATE_H
+
+#include <X11/Xlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#ifdef HAVE_RANDR
+#include <X11/extensions/Xrandr.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+typedef struct ScreenInfo ScreenInfo;
+
+struct ScreenInfo
+{
+    int			min_width;
+    int			max_width;
+    int			min_height;
+    int			max_height;
+
+#ifdef HAVE_RANDR
+    XRRScreenResources *resources;
+#endif
+
+    MateRROutput **	outputs;
+    MateRRCrtc **	crtcs;
+    MateRRMode **	modes;
+
+    MateRRScreen *	screen;
+
+    MateRRMode **	clone_modes;
+
+#ifdef HAVE_RANDR
+    RROutput            primary;
+#endif
+};
+
+struct MateRRScreenPrivate
+{
+    GdkScreen *			gdk_screen;
+    GdkWindow *			gdk_root;
+    Display *			xdisplay;
+    Screen *			xscreen;
+    Window			xroot;
+    ScreenInfo *		info;
+
+    int				randr_event_base;
+    int				rr_major_version;
+    int				rr_minor_version;
+
+    Atom                        connector_type_atom;
+};
+
+struct MateRROutputInfoPrivate
+{
+    char *		name;
+
+    gboolean		on;
+    int			width;
+    int			height;
+    int			rate;
+    int			x;
+    int			y;
+    MateRRRotation	rotation;
+
+    gboolean		connected;
+    gchar		vendor[4];
+    guint		product;
+    guint		serial;
+    double		aspect;
+    int			pref_width;
+    int			pref_height;
+    char *		display_name;
+    gboolean            primary;
+};
+
+struct MateRRConfigPrivate
+{
+  gboolean clone;
+  MateRRScreen *screen;
+  MateRROutputInfo **outputs;
+};
+
+gboolean _mate_rr_output_name_is_laptop (const char *name);
+
+#endif
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/92.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/92.html new file mode 100644 index 00000000..3bc191f7 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/92.html @@ -0,0 +1,1333 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * mate-rr-labeler.c - Utility to label monitors to identify them
+ * while they are being configured.
+ *
+ * Copyright 2008, Novell, Inc.
+ *
+ * This file is part of the Mate Library.
+ *
+ * The Mate Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Mate 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Mate Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Author: Federico Mena-Quintero <federico@novell.com>
+ */
+
+#define MATE_DESKTOP_USE_UNSTABLE_API
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n-lib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <X11/Xproto.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <X11/Xlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <X11/Xutil.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <X11/Xatom.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "mate-rr-labeler.h"
+
+struct _MateRRLabelerPrivate {
+	MateRRConfig *config;
+
+	int num_outputs;
+
+	GdkRGBA *palette;
+	GtkWidget **windows;
+
+	GdkScreen  *screen;
+	Atom        workarea_atom;
+};
+
+enum {
+	PROP_0,
+	PROP_CONFIG,
+	PROP_LAST
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (MateRRLabeler, mate_rr_labeler, G_TYPE_OBJECT);
+
+static void mate_rr_labeler_finalize (GObject *object);
+static void create_label_windows (MateRRLabeler *labeler);
+static void setup_from_config (MateRRLabeler *labeler);
+
+static int
+get_current_desktop (GdkScreen *screen)
+{
+        Display *display;
+        Window win;
+        Atom current_desktop, type;
+        int format;
+        unsigned long n_items, bytes_after;
+        unsigned char *data_return = NULL;
+        int workspace = 0;
+
+        display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
+        win = XRootWindow (display, GDK_SCREEN_XNUMBER (screen));
+
+        current_desktop = XInternAtom (display, "_NET_CURRENT_DESKTOP", True);
+
+        XGetWindowProperty (display,
+                            win,
+                            current_desktop,
+                            0, G_MAXLONG,
+                            False, XA_CARDINAL,
+                            &type, &format, &n_items, &bytes_after,
+                            &data_return);
+
+        if (type == XA_CARDINAL && format == 32 && n_items > 0)
+                workspace = (int) data_return[0];
+        if (data_return)
+                XFree (data_return);
+
+        return workspace;
+}
+
+static gboolean
+get_work_area (MateRRLabeler *labeler,
+	       GdkRectangle   *rect)
+{
+	Atom            workarea;
+	Atom            type;
+	Window          win;
+	int             format;
+	gulong          num;
+	gulong          leftovers;
+	gulong          max_len = 4 * 32;
+	guchar         *ret_workarea;
+	long           *workareas;<--- Variable 'workareas' can be declared as pointer to const
+	int             result;
+	int             disp_screen;
+	int             desktop;
+	Display        *display;
+
+	display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (labeler->priv->screen));
+	workarea = XInternAtom (display, "_NET_WORKAREA", True);
+
+	disp_screen = GDK_SCREEN_XNUMBER (labeler->priv->screen);
+
+	/* Defaults in case of error */
+	rect->x = 0;
+	rect->y = 0;
+	rect->width = WidthOfScreen (gdk_x11_screen_get_xscreen (labeler->priv->screen));
+	rect->height = HeightOfScreen (gdk_x11_screen_get_xscreen (labeler->priv->screen));
+
+	if (workarea == None)
+		return FALSE;
+
+	win = XRootWindow (display, disp_screen);
+	result = XGetWindowProperty (display,
+				     win,
+				     workarea,
+				     0,
+				     max_len,
+				     False,
+				     AnyPropertyType,
+				     &type,
+				     &format,
+				     &num,
+				     &leftovers,
+				     &ret_workarea);
+
+	if (result != Success
+	    || type == None
+	    || format == 0
+	    || leftovers
+	    || num % 4) {
+		return FALSE;
+	}
+
+	desktop = get_current_desktop (labeler->priv->screen);
+
+	workareas = (long *) ret_workarea;
+	rect->x = workareas[desktop * 4];
+	rect->y = workareas[desktop * 4 + 1];
+	rect->width = workareas[desktop * 4 + 2];
+	rect->height = workareas[desktop * 4 + 3];
+
+	XFree (ret_workarea);
+
+	return TRUE;
+}
+
+static GdkFilterReturn
+screen_xevent_filter (GdkXEvent      *xevent,
+		      GdkEvent       *event,
+		      MateRRLabeler *labeler)
+{
+	XEvent *xev;<--- Variable 'xev' can be declared as pointer to const
+
+	xev = (XEvent *) xevent;
+
+	if (xev->type == PropertyNotify &&
+	    xev->xproperty.atom == labeler->priv->workarea_atom) {
+		/* update label positions */
+		mate_rr_labeler_hide (labeler);
+		create_label_windows (labeler);
+	}
+
+	return GDK_FILTER_CONTINUE;
+}
+
+static void
+mate_rr_labeler_init (MateRRLabeler *labeler)
+{
+	GdkWindow *gdkwindow;
+
+	labeler->priv = mate_rr_labeler_get_instance_private (labeler);
+
+	labeler->priv->workarea_atom = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
+						    "_NET_WORKAREA",
+						    True);
+
+	labeler->priv->screen = gdk_screen_get_default ();
+	/* code is not really designed to handle multiple screens so *shrug* */
+	gdkwindow = gdk_screen_get_root_window (labeler->priv->screen);
+	gdk_window_add_filter (gdkwindow, (GdkFilterFunc) screen_xevent_filter, labeler);
+	gdk_window_set_events (gdkwindow, gdk_window_get_events (gdkwindow) | GDK_PROPERTY_CHANGE_MASK);
+}
+
+static void
+mate_rr_labeler_set_property (GObject *gobject, guint property_id, const GValue *value, GParamSpec *param_spec)
+{
+	MateRRLabeler *self = MATE_RR_LABELER (gobject);
+
+	switch (property_id) {
+	case PROP_CONFIG:
+		self->priv->config = MATE_RR_CONFIG (g_value_dup_object (value));
+		return;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, param_spec);
+	}
+}
+
+static GObject *
+mate_rr_labeler_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties)
+{
+	MateRRLabeler *self = (MateRRLabeler*) G_OBJECT_CLASS (mate_rr_labeler_parent_class)->constructor (type, n_construct_properties, construct_properties);
+
+	setup_from_config (self);
+
+	return (GObject*) self;
+}
+
+static void
+mate_rr_labeler_class_init (MateRRLabelerClass *klass)
+{
+	GObjectClass *object_class;
+
+	object_class = (GObjectClass *) klass;
+
+	object_class->set_property = mate_rr_labeler_set_property;
+	object_class->finalize = mate_rr_labeler_finalize;
+	object_class->constructor = mate_rr_labeler_constructor;
+
+	g_object_class_install_property (object_class, PROP_CONFIG, g_param_spec_object ("config",
+											 "Configuration",
+											 "RandR configuration to label",
+											 MATE_TYPE_RR_CONFIG,
+											 G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
+											 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+}
+
+static void
+mate_rr_labeler_finalize (GObject *object)
+{
+	MateRRLabeler *labeler;
+	GdkWindow      *gdkwindow;
+
+	labeler = MATE_RR_LABELER (object);
+
+	gdkwindow = gdk_screen_get_root_window (labeler->priv->screen);
+	gdk_window_remove_filter (gdkwindow, (GdkFilterFunc) screen_xevent_filter, labeler);
+
+	if (labeler->priv->config != NULL) {
+		g_object_unref (labeler->priv->config);
+	}
+
+	if (labeler->priv->windows != NULL) {
+		mate_rr_labeler_hide (labeler);
+		g_free (labeler->priv->windows);
+	}
+
+	g_free (labeler->priv->palette);
+
+	G_OBJECT_CLASS (mate_rr_labeler_parent_class)->finalize (object);
+}
+
+static int
+count_outputs (MateRRConfig *config)
+{
+	int i;
+	MateRROutputInfo **outputs = mate_rr_config_get_outputs (config);
+
+	for (i = 0; outputs[i] != NULL; i++)
+		;
+
+	return i;
+}
+
+static void
+make_palette (MateRRLabeler *labeler)
+{
+	/* The idea is that we go around an hue color wheel.  We want to start
+	 * at red, go around to green/etc. and stop at blue --- because magenta
+	 * is evil.  Eeeeek, no magenta, please!
+	 *
+	 * Purple would be nice, though.  Remember that we are watered down
+	 * (i.e. low saturation), so that would be like Like berries with cream.
+	 * Mmmmm, berries.
+	 */
+	double start_hue;
+	double end_hue;
+	int i;
+
+	g_assert (labeler->priv->num_outputs > 0);
+
+	labeler->priv->palette = g_new (GdkRGBA, labeler->priv->num_outputs);
+
+	start_hue = 0.0; /* red */
+	end_hue   = 2.0/3; /* blue */
+
+	for (i = 0; i < labeler->priv->num_outputs; i++) {
+		double h, s, v;
+		double r, g, b;
+
+		h = start_hue + (end_hue - start_hue) / labeler->priv->num_outputs * i;
+		s = 1.0 / 3;
+		v = 1.0;
+
+		gtk_hsv_to_rgb (h, s, v, &r, &g, &b);
+
+		labeler->priv->palette[i].red   = r;
+		labeler->priv->palette[i].green = g;
+		labeler->priv->palette[i].blue  = b;
+		labeler->priv->palette[i].alpha  = 1.0;
+	}
+}
+
+#define LABEL_WINDOW_EDGE_THICKNESS 2
+#define LABEL_WINDOW_PADDING 12
+
+static gboolean
+label_window_draw_event_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
+{
+	GdkRGBA *color;
+	GtkAllocation allocation;
+
+	color = g_object_get_data (G_OBJECT (widget), "color");
+	gtk_widget_get_allocation (widget, &allocation);
+
+	/* edge outline */
+
+	cairo_set_source_rgb (cr, 0, 0, 0);
+	cairo_rectangle (cr,
+			 LABEL_WINDOW_EDGE_THICKNESS / 2.0,
+			 LABEL_WINDOW_EDGE_THICKNESS / 2.0,
+			 allocation.width - LABEL_WINDOW_EDGE_THICKNESS,
+			 allocation.height - LABEL_WINDOW_EDGE_THICKNESS);
+	cairo_set_line_width (cr, LABEL_WINDOW_EDGE_THICKNESS);
+	cairo_stroke (cr);
+
+	/* fill */
+	gdk_cairo_set_source_rgba (cr, color);
+	cairo_rectangle (cr,
+			 LABEL_WINDOW_EDGE_THICKNESS,
+			 LABEL_WINDOW_EDGE_THICKNESS,
+			 allocation.width - LABEL_WINDOW_EDGE_THICKNESS * 2,
+			 allocation.height - LABEL_WINDOW_EDGE_THICKNESS * 2);
+	cairo_fill (cr);
+
+	return FALSE;
+}
+
+static void
+position_window (MateRRLabeler  *labeler,
+		 GtkWidget       *window,
+		 int              x,
+		 int              y)
+{
+	GdkRectangle    workarea;
+	GdkRectangle    monitor;
+	GdkMonitor     *monitor_num;
+
+	get_work_area (labeler, &workarea);
+	monitor_num = gdk_display_get_monitor_at_point (gdk_screen_get_display (labeler->priv->screen), x, y);
+	gdk_monitor_get_geometry (monitor_num, &monitor);
+	gdk_rectangle_intersect (&monitor, &workarea, &workarea);
+
+	gtk_window_move (GTK_WINDOW (window), workarea.x, workarea.y);
+}
+
+static GtkWidget *
+create_label_window (MateRRLabeler *labeler, MateRROutputInfo *output, GdkRGBA *color)
+{
+	GtkWidget *window;
+	GtkWidget *widget;
+	char *str;
+	char *display_name;
+	GdkRGBA black = { 0, 0, 0, 1.0 };
+	int x,y;
+
+	window = gtk_window_new (GTK_WINDOW_POPUP);
+	gtk_widget_set_app_paintable (window, TRUE);
+
+	gtk_container_set_border_width (GTK_CONTAINER (window), LABEL_WINDOW_PADDING + LABEL_WINDOW_EDGE_THICKNESS);
+
+	/* This is semi-dangerous.  The color is part of the labeler->palette
+	 * array.  Note that in mate_rr_labeler_finalize(), we are careful to
+	 * free the palette only after we free the windows.
+	 */
+	g_object_set_data (G_OBJECT (window), "color", color);
+
+	g_signal_connect (window, "draw",
+			  G_CALLBACK (label_window_draw_event_cb), labeler);
+
+	if (mate_rr_config_get_clone (labeler->priv->config)) {
+		/* Keep this string in sync with mate-control-center/capplets/display/xrandr-capplet.c:get_display_name() */
+
+		/* Translators:  this is the feature where what you see on your laptop's
+		 * screen is the same as your external monitor.  Here, "Mirror" is being
+		 * used as an adjective, not as a verb.  For example, the Spanish
+		 * translation could be "Pantallas en Espejo", *not* "Espejar Pantallas".
+		 */
+		display_name = g_strdup_printf (_("Mirror Screens"));
+		str = g_strdup_printf ("<b>%s</b>", display_name);
+	} else {
+		display_name = g_strdup_printf ("<b>%s</b>\n<small>%s</small>", mate_rr_output_info_get_display_name (output), mate_rr_output_info_get_name (output));
+		str = g_strdup_printf ("%s", display_name);
+	}
+	g_free (display_name);
+
+	widget = gtk_label_new (NULL);
+	gtk_label_set_markup (GTK_LABEL (widget), str);
+	g_free (str);
+
+	/* Make the label explicitly black.  We don't want it to follow the
+	 * theme's colors, since the label is always shown against a light
+	 * pastel background.  See bgo#556050
+	 */
+	gtk_widget_override_color (widget, gtk_widget_get_state_flags (widget), &black);
+
+	gtk_container_add (GTK_CONTAINER (window), widget);
+
+	/* Should we center this at the top edge of the monitor, instead of using the upper-left corner? */
+	mate_rr_output_info_get_geometry (output, &x, &y, NULL, NULL);
+	position_window (labeler, window, x, y);
+
+	gtk_widget_show_all (window);
+
+	return window;
+}
+
+static void
+create_label_windows (MateRRLabeler *labeler)
+{
+	int i;
+	gboolean created_window_for_clone;
+	MateRROutputInfo **outputs;
+
+	labeler->priv->windows = g_new (GtkWidget *, labeler->priv->num_outputs);
+
+	created_window_for_clone = FALSE;
+
+	outputs = mate_rr_config_get_outputs (labeler->priv->config);
+
+	for (i = 0; i < labeler->priv->num_outputs; i++) {
+		if (!created_window_for_clone && mate_rr_output_info_is_active (outputs[i])) {
+			labeler->priv->windows[i] = create_label_window (labeler, outputs[i], labeler->priv->palette + i);
+
+			if (mate_rr_config_get_clone (labeler->priv->config))
+				created_window_for_clone = TRUE;
+		} else
+			labeler->priv->windows[i] = NULL;
+	}
+}
+
+static void
+setup_from_config (MateRRLabeler *labeler)
+{
+	labeler->priv->num_outputs = count_outputs (labeler->priv->config);
+
+	make_palette (labeler);
+
+	create_label_windows (labeler);
+}
+
+/**
+ * mate_rr_labeler_new:
+ * @config: Configuration of the screens to label
+ *
+ * Create a GUI element that will display colored labels on each connected monitor.
+ * This is useful when users are required to identify which monitor is which, e.g. for
+ * for configuring multiple monitors.
+ * The labels will be shown by default, use mate_rr_labeler_hide to hide them.
+ *
+ * Returns: A new #MateRRLabeler
+ */
+MateRRLabeler *
+mate_rr_labeler_new (MateRRConfig *config)
+{
+	g_return_val_if_fail (MATE_IS_RR_CONFIG (config), NULL);
+
+	return g_object_new (MATE_TYPE_RR_LABELER, "config", config, NULL);
+}
+
+/**
+ * mate_rr_labeler_hide:
+ * @labeler: A #MateRRLabeler
+ *
+ * Hide ouput labels.
+ */
+void
+mate_rr_labeler_hide (MateRRLabeler *labeler)
+{
+	int i;
+	MateRRLabelerPrivate *priv;
+
+	g_return_if_fail (MATE_IS_RR_LABELER (labeler));
+
+	priv = labeler->priv;
+
+	if (priv->windows == NULL)
+		return;
+
+	for (i = 0; i < priv->num_outputs; i++)
+		if (priv->windows[i] != NULL) {
+			gtk_widget_destroy (priv->windows[i]);
+			priv->windows[i] = NULL;
+	}
+	g_free (priv->windows);
+	priv->windows = NULL;
+}
+
+/**
+ * mate_rr_labeler_get_rgba_for_output:
+ * @labeler: A #MateRRLabeler
+ * @output: Output device (i.e. monitor) to query
+ * @color_out: (out): Color of selected monitor.
+ *
+ * Get the color used for the label on a given output (monitor).
+ */
+void
+mate_rr_labeler_get_rgba_for_output (MateRRLabeler *labeler, MateRROutputInfo *output, GdkRGBA *color_out)
+{
+	int i;
+	MateRROutputInfo **outputs;
+
+	g_return_if_fail (MATE_IS_RR_LABELER (labeler));
+	g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (output));
+	g_return_if_fail (color_out != NULL);
+
+	outputs = mate_rr_config_get_outputs (labeler->priv->config);
+
+	for (i = 0; i < labeler->priv->num_outputs; i++)
+		if (outputs[i] == output) {
+			*color_out = labeler->priv->palette[i];
+			return;
+		}
+
+	g_warning ("trying to get the color for unknown MateOutputInfo %p; returning magenta!", output);
+
+	color_out->red   = 1.0;
+	color_out->green = 0.0;
+	color_out->blue  = 1.0;
+	color_out->alpha = 1.0;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/93.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/93.html new file mode 100644 index 00000000..ad3120cb --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/93.html @@ -0,0 +1,741 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
/* mate-rr-output-info.c
+ * -*- c-basic-offset: 4 -*-
+ *
+ * Copyright 2010 Giovanni Campagna
+ *
+ * This file is part of the Mate Desktop Library.
+ *
+ * The Mate Desktop Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Mate 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Mate Desktop Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#define MATE_DESKTOP_USE_UNSTABLE_API
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "mate-rr-config.h"
+
+#include "edid.h"
+#include "mate-rr-private.h"
+
+G_DEFINE_TYPE_WITH_PRIVATE (MateRROutputInfo, mate_rr_output_info, G_TYPE_OBJECT)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
+
+static void
+mate_rr_output_info_init (MateRROutputInfo *self)
+{
+    self->priv = mate_rr_output_info_get_instance_private (self);
+
+    self->priv->name = NULL;
+    self->priv->on = FALSE;
+    self->priv->display_name = NULL;
+}
+
+static void
+mate_rr_output_info_finalize (GObject *gobject)
+{
+    MateRROutputInfo *self = MATE_RR_OUTPUT_INFO (gobject);
+
+    g_free (self->priv->name);
+    g_free (self->priv->display_name);
+
+    G_OBJECT_CLASS (mate_rr_output_info_parent_class)->finalize (gobject);
+}
+
+static void
+mate_rr_output_info_class_init (MateRROutputInfoClass *klass)
+{
+    GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+    gobject_class->finalize = mate_rr_output_info_finalize;
+}
+
+/**
+ * mate_rr_output_info_get_name:
+ *
+ * Returns: (transfer none): the output name
+ */
+char *mate_rr_output_info_get_name (MateRROutputInfo *self)
+{
+    g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), NULL);
+
+    return self->priv->name;
+}
+
+/**
+ * mate_rr_output_info_is_active:
+ *
+ * Returns: whether there is a CRTC assigned to this output (i.e. a signal is being sent to it)
+ */
+gboolean mate_rr_output_info_is_active (MateRROutputInfo *self)
+{
+    g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), FALSE);
+
+    return self->priv->on;
+}
+
+void mate_rr_output_info_set_active (MateRROutputInfo *self, gboolean active)
+{
+    g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (self));
+
+    self->priv->on = active;
+}
+
+/**
+ * mate_rr_output_info_get_geometry:
+ * @self: a #MateRROutputInfo
+ * @x: (out) (allow-none):
+ * @y: (out) (allow-none):
+ * @width: (out) (allow-none):
+ * @height: (out) (allow-none):
+ */
+void mate_rr_output_info_get_geometry (MateRROutputInfo *self, int *x, int *y, int *width, int *height)
+{
+    g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (self));
+
+    if (x)
+	*x = self->priv->x;
+    if (y)
+	*y = self->priv->y;
+    if (width)
+	*width = self->priv->width;
+    if (height)
+	*height = self->priv->height;
+}
+
+/**
+ * mate_rr_output_info_set_geometry:
+ * @self: a #MateRROutputInfo
+ * @x: x offset for monitor
+ * @y: y offset for monitor
+ * @width: monitor width
+ * @height: monitor height
+ *
+ * Set the geometry for the monitor connected to the specified output.
+ */
+void mate_rr_output_info_set_geometry (MateRROutputInfo *self, int  x, int  y, int  width, int  height)
+{
+    g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (self));
+
+    self->priv->x = x;
+    self->priv->y = y;
+    self->priv->width = width;
+    self->priv->height = height;
+}
+
+int mate_rr_output_info_get_refresh_rate (MateRROutputInfo *self)
+{
+    g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), 0);
+
+    return self->priv->rate;
+}
+
+void mate_rr_output_info_set_refresh_rate (MateRROutputInfo *self, int rate)
+{
+    g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (self));
+
+    self->priv->rate = rate;
+}
+
+MateRRRotation mate_rr_output_info_get_rotation (MateRROutputInfo *self)
+{
+    g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), MATE_RR_ROTATION_0);
+
+    return self->priv->rotation;
+}
+
+void mate_rr_output_info_set_rotation (MateRROutputInfo *self, MateRRRotation rotation)
+{
+    g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (self));
+
+    self->priv->rotation = rotation;
+}
+
+/**
+ * mate_rr_output_info_is_connected:
+ *
+ * Returns: whether the output is physically connected to a monitor
+ */
+gboolean mate_rr_output_info_is_connected (MateRROutputInfo *self)
+{
+    g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), FALSE);
+
+    return self->priv->connected;
+}
+
+/**
+ * mate_rr_output_info_get_vendor:
+ * @self: a #MateRROutputInfo
+ * @vendor: (out caller-allocates) (array fixed-size=4):
+ */
+void mate_rr_output_info_get_vendor (MateRROutputInfo *self, gchar* vendor)
+{
+    g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (self));
+    g_return_if_fail (vendor != NULL);
+
+    vendor[0] = self->priv->vendor[0];
+    vendor[1] = self->priv->vendor[1];
+    vendor[2] = self->priv->vendor[2];
+    vendor[3] = self->priv->vendor[3];
+}
+
+guint mate_rr_output_info_get_product (MateRROutputInfo *self)
+{
+    g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), 0);
+
+    return self->priv->product;
+}
+
+guint mate_rr_output_info_get_serial (MateRROutputInfo *self)
+{
+    g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), 0);
+
+    return self->priv->serial;
+}
+
+double mate_rr_output_info_get_aspect_ratio (MateRROutputInfo *self)
+{
+    g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), 0);
+
+    return self->priv->aspect;
+}
+
+/**
+ * mate_rr_output_info_get_display_name:
+ *
+ * Returns: (transfer none): the display name of this output
+ */
+char *mate_rr_output_info_get_display_name (MateRROutputInfo *self)
+{
+    g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), NULL);
+
+    return self->priv->display_name;
+}
+
+gboolean mate_rr_output_info_get_primary (MateRROutputInfo *self)
+{
+    g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), FALSE);
+
+    return self->priv->primary;
+}
+
+void mate_rr_output_info_set_primary (MateRROutputInfo *self, gboolean primary)
+{
+    g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (self));
+
+    self->priv->primary = primary;
+}
+
+int mate_rr_output_info_get_preferred_width (MateRROutputInfo *self)
+{
+    g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), 0);
+
+    return self->priv->pref_width;
+}
+
+int mate_rr_output_info_get_preferred_height (MateRROutputInfo *self)
+{
+    g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), 0);
+
+    return self->priv->pref_height;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/94.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/94.html new file mode 100644 index 00000000..1d3316bb --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/94.html @@ -0,0 +1,4569 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+1545
+1546
+1547
+1548
+1549
+1550
+1551
+1552
+1553
+1554
+1555
+1556
+1557
+1558
+1559
+1560
+1561
+1562
+1563
+1564
+1565
+1566
+1567
+1568
+1569
+1570
+1571
+1572
+1573
+1574
+1575
+1576
+1577
+1578
+1579
+1580
+1581
+1582
+1583
+1584
+1585
+1586
+1587
+1588
+1589
+1590
+1591
+1592
+1593
+1594
+1595
+1596
+1597
+1598
+1599
+1600
+1601
+1602
+1603
+1604
+1605
+1606
+1607
+1608
+1609
+1610
+1611
+1612
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+1631
+1632
+1633
+1634
+1635
+1636
+1637
+1638
+1639
+1640
+1641
+1642
+1643
+1644
+1645
+1646
+1647
+1648
+1649
+1650
+1651
+1652
+1653
+1654
+1655
+1656
+1657
+1658
+1659
+1660
+1661
+1662
+1663
+1664
+1665
+1666
+1667
+1668
+1669
+1670
+1671
+1672
+1673
+1674
+1675
+1676
+1677
+1678
+1679
+1680
+1681
+1682
+1683
+1684
+1685
+1686
+1687
+1688
+1689
+1690
+1691
+1692
+1693
+1694
+1695
+1696
+1697
+1698
+1699
+1700
+1701
+1702
+1703
+1704
+1705
+1706
+1707
+1708
+1709
+1710
+1711
+1712
+1713
+1714
+1715
+1716
+1717
+1718
+1719
+1720
+1721
+1722
+1723
+1724
+1725
+1726
+1727
+1728
+1729
+1730
+1731
+1732
+1733
+1734
+1735
+1736
+1737
+1738
+1739
+1740
+1741
+1742
+1743
+1744
+1745
+1746
+1747
+1748
+1749
+1750
+1751
+1752
+1753
+1754
+1755
+1756
+1757
+1758
+1759
+1760
+1761
+1762
+1763
+1764
+1765
+1766
+1767
+1768
+1769
+1770
+1771
+1772
+1773
+1774
+1775
+1776
+1777
+1778
+1779
+1780
+1781
+1782
+1783
+1784
+1785
+1786
+1787
+1788
+1789
+1790
+1791
+1792
+1793
+1794
+1795
+1796
+1797
+1798
+1799
+1800
+1801
+1802
+1803
+1804
+1805
+1806
+1807
+1808
+1809
+1810
+1811
+1812
+1813
+1814
+1815
+1816
+1817
+1818
+1819
+1820
+1821
+1822
+1823
+1824
+1825
+1826
+1827
+1828
+1829
+1830
+1831
+1832
+1833
+1834
+1835
+1836
+1837
+1838
+1839
+1840
+1841
+1842
+1843
+1844
+1845
+1846
+1847
+1848
+1849
+1850
+1851
+1852
+1853
+1854
+1855
+1856
+1857
+1858
+1859
+1860
+1861
+1862
+1863
+1864
+1865
+1866
+1867
+1868
+1869
+1870
+1871
+1872
+1873
+1874
+1875
+1876
+1877
+1878
+1879
+1880
+1881
+1882
+1883
+1884
+1885
+1886
+1887
+1888
+1889
+1890
+1891
+1892
+1893
+1894
+1895
+1896
+1897
+1898
+1899
+1900
+1901
+1902
+1903
+1904
+1905
+1906
+1907
+1908
+1909
+1910
+1911
+1912
+1913
+1914
+1915
+1916
+1917
+1918
+1919
+1920
+1921
+1922
+1923
+1924
+1925
+1926
+1927
+1928
+1929
+1930
+1931
+1932
+1933
+1934
+1935
+1936
+1937
+1938
+1939
+1940
+1941
+1942
+1943
+1944
+1945
+1946
+1947
+1948
+1949
+1950
+1951
+1952
+1953
+1954
+1955
+1956
+1957
+1958
+1959
+1960
+1961
+1962
+1963
+1964
+1965
+1966
+1967
+1968
+1969
+1970
+1971
+1972
+1973
+1974
+1975
+1976
+1977
+1978
+1979
+1980
+1981
+1982
+1983
+1984
+1985
+1986
+1987
+1988
+1989
+1990
+1991
+1992
+1993
+1994
+1995
+1996
+1997
+1998
+1999
+2000
+2001
+2002
+2003
+2004
+2005
+2006
+2007
+2008
+2009
+2010
+2011
+2012
+2013
+2014
+2015
+2016
+2017
+2018
+2019
+2020
+2021
+2022
+2023
+2024
+2025
+2026
+2027
+2028
+2029
+2030
+2031
+2032
+2033
+2034
+2035
+2036
+2037
+2038
+2039
+2040
+2041
+2042
+2043
+2044
+2045
+2046
+2047
+2048
+2049
+2050
+2051
+2052
+2053
+2054
+2055
+2056
+2057
+2058
+2059
+2060
+2061
+2062
+2063
+2064
+2065
+2066
+2067
+2068
+2069
+2070
+2071
+2072
+2073
+2074
+2075
+2076
+2077
+2078
+2079
+2080
+2081
+2082
+2083
+2084
+2085
+2086
+2087
+2088
+2089
+2090
+2091
+2092
+2093
+2094
+2095
+2096
+2097
+2098
+2099
+2100
+2101
+2102
+2103
+2104
+2105
+2106
+2107
+2108
+2109
+2110
+2111
+2112
+2113
+2114
+2115
+2116
+2117
+2118
+2119
+2120
+2121
+2122
+2123
+2124
+2125
+2126
+2127
+2128
+2129
+2130
+2131
+2132
+2133
+2134
+2135
+2136
+2137
+2138
+2139
+2140
+2141
+2142
+2143
+2144
+2145
+2146
+2147
+2148
+2149
+2150
+2151
+2152
+2153
+2154
+2155
+2156
+2157
+2158
+2159
+2160
+2161
+2162
+2163
+2164
+2165
+2166
/* mate-rr.c
+ *
+ * Copyright 2007, 2008, Red Hat, Inc.
+ *
+ * This file is part of the Mate Library.
+ *
+ * The Mate Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Mate 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Mate Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Author: Soren Sandmann <sandmann@redhat.com>
+ */
+
+#define MATE_DESKTOP_USE_UNSTABLE_API
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n-lib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <X11/Xlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#ifdef HAVE_RANDR
+#include <X11/extensions/Xrandr.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <X11/Xatom.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#undef MATE_DISABLE_DEPRECATED
+#include "mate-rr.h"
+#include "mate-rr-config.h"
+
+#include "private.h"
+#include "mate-rr-private.h"
+
+#define DISPLAY(o) ((o)->info->screen->priv->xdisplay)
+
+#ifndef HAVE_RANDR
+/* This is to avoid a ton of ifdefs wherever we use a type from libXrandr */
+typedef int RROutput;
+typedef int RRCrtc;
+typedef int RRMode;
+typedef int Rotation;
+#define RR_Rotate_0		1
+#define RR_Rotate_90		2
+#define RR_Rotate_180		4
+#define RR_Rotate_270		8
+#define RR_Reflect_X		16
+#define RR_Reflect_Y		32
+#endif
+
+enum {
+    SCREEN_PROP_0,
+    SCREEN_PROP_GDK_SCREEN,
+    SCREEN_PROP_LAST,
+};
+
+enum {
+    SCREEN_CHANGED,
+    SCREEN_SIGNAL_LAST,
+};
+
+gint screen_signals[SCREEN_SIGNAL_LAST];
+
+struct MateRROutput
+{
+    ScreenInfo *	info;
+    RROutput		id;
+
+    char *		name;
+    MateRRCrtc *	current_crtc;
+    gboolean		connected;
+    gulong		width_mm;
+    gulong		height_mm;
+    MateRRCrtc **	possible_crtcs;
+    MateRROutput **	clones;
+    MateRRMode **	modes;
+    int			n_preferred;
+    guint8 *		edid_data;
+    int         edid_size;
+    char *              connector_type;
+};
+
+struct MateRROutputWrap
+{
+    RROutput		id;
+};
+
+struct MateRRCrtc
+{
+    ScreenInfo *	info;
+    RRCrtc		id;
+
+    MateRRMode *	current_mode;
+    MateRROutput **	current_outputs;
+    MateRROutput **	possible_outputs;
+    int			x;
+    int			y;
+
+    MateRRRotation	current_rotation;
+    MateRRRotation	rotations;
+    int			gamma_size;
+};
+
+struct MateRRMode
+{
+    ScreenInfo *	info;
+    RRMode		id;
+    char *		name;
+    int			width;
+    int			height;
+    int			freq;		/* in mHz */
+};
+
+/* MateRRCrtc */
+static MateRRCrtc *  crtc_new          (ScreenInfo         *info,
+					 RRCrtc              id);
+static MateRRCrtc *  crtc_copy         (const MateRRCrtc  *from);
+static void           crtc_free         (MateRRCrtc        *crtc);
+
+#ifdef HAVE_RANDR
+static gboolean       crtc_initialize   (MateRRCrtc        *crtc,
+					 XRRScreenResources *res,
+					 GError            **error);
+#endif
+
+/* MateRROutput */
+static MateRROutput *output_new        (ScreenInfo         *info,
+					 RROutput            id);
+
+#ifdef HAVE_RANDR
+static gboolean       output_initialize (MateRROutput      *output,
+					 XRRScreenResources *res,
+					 GError            **error);
+#endif
+
+static MateRROutput *output_copy       (const MateRROutput *from);
+static void           output_free       (MateRROutput      *output);
+
+/* MateRRMode */
+static MateRRMode *  mode_new          (ScreenInfo         *info,
+					 RRMode              id);
+
+#ifdef HAVE_RANDR
+static void           mode_initialize   (MateRRMode        *mode,
+					 XRRModeInfo        *info);
+#endif
+
+static MateRRMode *  mode_copy         (const MateRRMode  *from);
+static void           mode_free         (MateRRMode        *mode);
+
+static void mate_rr_screen_finalize (GObject*);
+static void mate_rr_screen_set_property (GObject*, guint, const GValue*, GParamSpec*);
+static void mate_rr_screen_get_property (GObject*, guint, GValue*, GParamSpec*);
+static gboolean mate_rr_screen_initable_init (GInitable*, GCancellable*, GError**);
+static void mate_rr_screen_initable_iface_init (GInitableIface *iface);
+G_DEFINE_TYPE_WITH_CODE (MateRRScreen, mate_rr_screen, G_TYPE_OBJECT,<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_CODE is a macro then please configure it.
+                         G_ADD_PRIVATE(MateRRScreen)
+                         G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, mate_rr_screen_initable_iface_init))
+
+G_DEFINE_BOXED_TYPE (MateRRCrtc, mate_rr_crtc, crtc_copy, crtc_free)
+G_DEFINE_BOXED_TYPE (MateRROutput, mate_rr_output, output_copy, output_free)
+G_DEFINE_BOXED_TYPE (MateRRMode, mate_rr_mode, mode_copy, mode_free)
+
+/* Errors */
+
+/**
+ * mate_rr_error_quark:
+ *
+ * Returns the #GQuark that will be used for #GError values returned by the
+ * MateRR API.
+ *
+ * Return value: a #GQuark used to identify errors coming from the MateRR API.
+ */
+GQuark
+mate_rr_error_quark (void)
+{
+    return g_quark_from_static_string ("mate-rr-error-quark");
+}
+
+/* Screen */
+static MateRROutput *
+mate_rr_output_by_id (ScreenInfo *info, RROutput id)
+{
+    MateRROutput **output;
+
+    g_assert (info != NULL);
+
+    for (output = info->outputs; *output; ++output)
+    {
+	if ((*output)->id == id)
+	    return *output;
+    }
+
+    return NULL;
+}
+
+static MateRRCrtc *
+crtc_by_id (ScreenInfo *info, RRCrtc id)
+{
+    MateRRCrtc **crtc;
+
+    if (!info)
+        return NULL;
+
+    for (crtc = info->crtcs; *crtc; ++crtc)
+    {
+	if ((*crtc)->id == id)
+	    return *crtc;
+    }
+
+    return NULL;
+}
+
+static MateRRMode *
+mode_by_id (ScreenInfo *info, RRMode id)
+{
+    MateRRMode **mode;
+
+    g_assert (info != NULL);
+
+    for (mode = info->modes; *mode; ++mode)
+    {
+	if ((*mode)->id == id)
+	    return *mode;
+    }
+
+    return NULL;
+}
+
+static void
+screen_info_free (ScreenInfo *info)
+{
+    MateRROutput **output;
+    MateRRCrtc **crtc;
+    MateRRMode **mode;
+
+    g_assert (info != NULL);
+
+#ifdef HAVE_RANDR
+    if (info->resources)
+    {
+	XRRFreeScreenResources (info->resources);
+
+	info->resources = NULL;
+    }
+#endif
+
+    if (info->outputs)
+    {
+	for (output = info->outputs; *output; ++output)
+	    output_free (*output);
+	g_free (info->outputs);
+    }
+
+    if (info->crtcs)
+    {
+	for (crtc = info->crtcs; *crtc; ++crtc)
+	    crtc_free (*crtc);
+	g_free (info->crtcs);
+    }
+
+    if (info->modes)
+    {
+	for (mode = info->modes; *mode; ++mode)
+	    mode_free (*mode);
+	g_free (info->modes);
+    }
+
+    if (info->clone_modes)
+    {
+	/* The modes themselves were freed above */
+	g_free (info->clone_modes);
+    }
+
+    g_free (info);
+}
+
+static gboolean
+has_similar_mode (MateRROutput *output, MateRRMode *mode)
+{
+    int i;
+    MateRRMode **modes = mate_rr_output_list_modes (output);
+    guint width = mate_rr_mode_get_width (mode);
+    guint height = mate_rr_mode_get_height (mode);
+
+    for (i = 0; modes[i] != NULL; ++i)
+    {
+	MateRRMode *m = modes[i];
+
+	if (mate_rr_mode_get_width (m) == width	&&
+	    mate_rr_mode_get_height (m) == height)
+	{
+	    return TRUE;
+	}
+    }
+
+    return FALSE;
+}
+
+static void
+gather_clone_modes (ScreenInfo *info)
+{
+    int i;
+    GPtrArray *result = g_ptr_array_new ();
+
+    for (i = 0; info->outputs[i] != NULL; ++i)
+    {
+	int j;
+	MateRROutput *output1, *output2;
+
+	output1 = info->outputs[i];
+
+	if (!output1->connected)
+	    continue;
+
+	for (j = 0; output1->modes[j] != NULL; ++j)
+	{
+	    MateRRMode *mode = output1->modes[j];
+	    gboolean valid;
+	    int k;
+
+	    valid = TRUE;
+	    for (k = 0; info->outputs[k] != NULL; ++k)
+	    {
+		output2 = info->outputs[k];
+
+		if (!output2->connected)
+		    continue;
+
+		if (!has_similar_mode (output2, mode))
+		{
+		    valid = FALSE;
+		    break;
+		}
+	    }
+
+	    if (valid)
+		g_ptr_array_add (result, mode);
+	}
+    }
+
+    g_ptr_array_add (result, NULL);
+
+    info->clone_modes = (MateRRMode **)g_ptr_array_free (result, FALSE);
+}
+
+#ifdef HAVE_RANDR
+static gboolean
+fill_screen_info_from_resources (ScreenInfo *info,
+				 XRRScreenResources *resources,
+				 GError **error)
+{
+    int i;
+    GPtrArray *a;
+    MateRRCrtc **crtc;
+    MateRROutput **output;
+
+    info->resources = resources;
+
+    /* We create all the structures before initializing them, so
+     * that they can refer to each other.
+     */
+    a = g_ptr_array_new ();
+    for (i = 0; i < resources->ncrtc; ++i)
+    {
+	g_ptr_array_add (a, crtc_new (info, resources->crtcs[i]));
+    }
+    g_ptr_array_add (a, NULL);
+    info->crtcs = (MateRRCrtc **)g_ptr_array_free (a, FALSE);
+
+    a = g_ptr_array_new ();
+    for (i = 0; i < resources->noutput; ++i)
+    {
+	g_ptr_array_add (a, output_new (info, resources->outputs[i]));
+    }
+    g_ptr_array_add (a, NULL);
+    info->outputs = (MateRROutput **)g_ptr_array_free (a, FALSE);
+
+    a = g_ptr_array_new ();
+    for (i = 0;  i < resources->nmode; ++i)
+    {
+	MateRRMode *mode = mode_new (info, resources->modes[i].id);
+
+	g_ptr_array_add (a, mode);
+    }
+    g_ptr_array_add (a, NULL);
+    info->modes = (MateRRMode **)g_ptr_array_free (a, FALSE);
+
+    /* Initialize */
+    for (crtc = info->crtcs; *crtc; ++crtc)
+    {
+	if (!crtc_initialize (*crtc, resources, error))
+	    return FALSE;
+    }
+
+    for (output = info->outputs; *output; ++output)
+    {
+	if (!output_initialize (*output, resources, error))
+	    return FALSE;
+    }
+
+    for (i = 0; i < resources->nmode; ++i)
+    {
+	MateRRMode *mode = mode_by_id (info, resources->modes[i].id);
+
+	mode_initialize (mode, &(resources->modes[i]));
+    }
+
+    gather_clone_modes (info);
+
+    return TRUE;
+}
+#endif /* HAVE_RANDR */
+
+static gboolean
+fill_out_screen_info (Display *xdisplay,
+		      Window xroot,
+		      ScreenInfo *info,
+		      gboolean needs_reprobe,
+		      GError **error)
+{
+#ifdef HAVE_RANDR
+    XRRScreenResources *resources;
+	GdkDisplay *display;
+
+    g_assert (xdisplay != NULL);
+    g_assert (info != NULL);
+
+    /* First update the screen resources */
+
+    if (needs_reprobe)
+        resources = XRRGetScreenResources (xdisplay, xroot);
+    else
+        resources = XRRGetScreenResourcesCurrent (xdisplay, xroot);
+
+    if (resources)
+    {
+	if (!fill_screen_info_from_resources (info, resources, error))
+	    return FALSE;
+    }
+    else
+    {
+	g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_RANDR_ERROR,
+		     /* Translators: a CRTC is a CRT Controller (this is X terminology). */
+		     _("could not get the screen resources (CRTCs, outputs, modes)"));
+	return FALSE;
+    }
+
+    /* Then update the screen size range.  We do this after XRRGetScreenResources() so that
+     * the X server will already have an updated view of the outputs.
+     */
+
+    if (needs_reprobe) {
+	gboolean success;
+
+	display = gdk_display_get_default ();
+    gdk_x11_display_error_trap_push (display);
+	success = XRRGetScreenSizeRange (xdisplay, xroot,
+					 &(info->min_width),
+					 &(info->min_height),
+					 &(info->max_width),
+					 &(info->max_height));
+	gdk_display_flush (display);
+	if (gdk_x11_display_error_trap_pop (display)) {
+	    g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_UNKNOWN,
+			 _("unhandled X error while getting the range of screen sizes"));
+	    return FALSE;
+	}
+
+	if (!success) {
+	    g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_RANDR_ERROR,
+			 _("could not get the range of screen sizes"));
+            return FALSE;
+        }
+    }
+    else
+    {
+        mate_rr_screen_get_ranges (info->screen,
+					 &(info->min_width),
+					 &(info->max_width),
+					 &(info->min_height),
+					 &(info->max_height));
+    }
+
+    info->primary = None;
+	display = gdk_display_get_default ();
+    gdk_x11_display_error_trap_push (display);
+    info->primary = XRRGetOutputPrimary (xdisplay, xroot);
+    gdk_x11_display_error_trap_pop_ignored (display);
+
+    return TRUE;
+#else
+    return FALSE;
+#endif /* HAVE_RANDR */
+}
+
+static ScreenInfo *
+screen_info_new (MateRRScreen *screen, gboolean needs_reprobe, GError **error)
+{
+    ScreenInfo *info = g_new0 (ScreenInfo, 1);
+    MateRRScreenPrivate *priv;
+
+    g_assert (screen != NULL);
+
+    priv = screen->priv;
+
+    info->outputs = NULL;
+    info->crtcs = NULL;
+    info->modes = NULL;
+    info->screen = screen;
+
+    if (fill_out_screen_info (priv->xdisplay, priv->xroot, info, needs_reprobe, error))
+    {
+	return info;
+    }
+    else
+    {
+	screen_info_free (info);
+	return NULL;
+    }
+}
+
+static gboolean
+screen_update (MateRRScreen *screen, gboolean force_callback, gboolean needs_reprobe, GError **error)
+{
+    ScreenInfo *info;
+    gboolean changed = FALSE;
+
+    g_assert (screen != NULL);
+
+    info = screen_info_new (screen, needs_reprobe, error);
+    if (!info)
+	    return FALSE;
+
+#ifdef HAVE_RANDR
+    if (info->resources->configTimestamp != screen->priv->info->resources->configTimestamp)
+	    changed = TRUE;
+#endif
+
+    screen_info_free (screen->priv->info);
+
+    screen->priv->info = info;
+
+    if (changed || force_callback)
+	g_signal_emit (G_OBJECT (screen), screen_signals[SCREEN_CHANGED], 0);
+
+    return changed;
+}
+
+static GdkFilterReturn
+screen_on_event (GdkXEvent *xevent,
+		 GdkEvent *event,
+		 gpointer data)
+{
+#ifdef HAVE_RANDR
+    MateRRScreen *screen = data;
+    MateRRScreenPrivate *priv = screen->priv;
+    XEvent *e = xevent;
+    int event_num;
+
+    if (!e)
+	return GDK_FILTER_CONTINUE;
+
+    event_num = e->type - priv->randr_event_base;
+
+    if (event_num == RRScreenChangeNotify) {
+	/* We don't reprobe the hardware; we just fetch the X server's latest
+	 * state.  The server already knows the new state of the outputs; that's
+	 * why it sent us an event!
+	 */
+        screen_update (screen, TRUE, FALSE, NULL); /* NULL-GError */
+#if 0
+	/* Enable this code to get a dialog showing the RANDR timestamps, for debugging purposes */
+	{
+	    GtkWidget *dialog;
+	    XRRScreenChangeNotifyEvent *rr_event;
+	    static int dialog_num;
+
+	    rr_event = (XRRScreenChangeNotifyEvent *) e;
+
+	    dialog = gtk_message_dialog_new (NULL,
+					     0,
+					     GTK_MESSAGE_INFO,
+					     GTK_BUTTONS_CLOSE,
+					     "RRScreenChangeNotify timestamps (%d):\n"
+					     "event change: %u\n"
+					     "event config: %u\n"
+					     "event serial: %lu\n"
+					     "----------------------"
+					     "screen change: %u\n"
+					     "screen config: %u\n",
+					     dialog_num++,
+					     (guint32) rr_event->timestamp,
+					     (guint32) rr_event->config_timestamp,
+					     rr_event->serial,
+					     (guint32) priv->info->resources->timestamp,
+					     (guint32) priv->info->resources->configTimestamp);
+	    g_signal_connect (dialog, "response",
+			      G_CALLBACK (gtk_widget_destroy), NULL);
+	    gtk_widget_show (dialog);
+	}
+#endif
+    }
+#if 0
+    /* WHY THIS CODE IS DISABLED:
+     *
+     * Note that in mate_rr_screen_new(), we only select for
+     * RRScreenChangeNotifyMask.  We used to select for other values in
+     * RR*NotifyMask, but we weren't really doing anything useful with those
+     * events.  We only care about "the screens changed in some way or another"
+     * for now.
+     *
+     * If we ever run into a situtation that could benefit from processing more
+     * detailed events, we can enable this code again.
+     *
+     * Note that the X server sends RRScreenChangeNotify in conjunction with the
+     * more detailed events from RANDR 1.2 - see xserver/randr/randr.c:TellChanged().
+     */
+    else if (event_num == RRNotify)
+    {
+	/* Other RandR events */
+
+	XRRNotifyEvent *event = (XRRNotifyEvent *)e;
+
+	/* Here we can distinguish between RRNotify events supported
+	 * since RandR 1.2 such as RRNotify_OutputProperty.  For now, we
+	 * don't have anything special to do for particular subevent types, so
+	 * we leave this as an empty switch().
+	 */
+	switch (event->subtype)
+	{
+	default:
+	    break;
+	}
+
+	/* No need to reprobe hardware here */
+	screen_update (screen, TRUE, FALSE, NULL); /* NULL-GError */
+    }
+#endif
+
+#endif /* HAVE_RANDR */
+
+    /* Pass the event on to GTK+ */
+    return GDK_FILTER_CONTINUE;
+}
+
+static gboolean
+mate_rr_screen_initable_init (GInitable *initable, GCancellable *canc, GError **error)
+
+{
+    MateRRScreen *self = MATE_RR_SCREEN (initable);
+    MateRRScreenPrivate *priv = self->priv;
+    Display *dpy = GDK_SCREEN_XDISPLAY (self->priv->gdk_screen);
+    int event_base;
+    int ignore;
+
+    priv->connector_type_atom = XInternAtom (dpy, "ConnectorType", FALSE);
+
+#ifdef HAVE_RANDR
+    if (XRRQueryExtension (dpy, &event_base, &ignore))
+    {
+        priv->randr_event_base = event_base;
+
+        XRRQueryVersion (dpy, &priv->rr_major_version, &priv->rr_minor_version);
+        if (priv->rr_major_version < 1 || (priv->rr_major_version == 1 && priv->rr_minor_version < 3)) {
+            g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_NO_RANDR_EXTENSION,
+                "RANDR extension is too old (must be at least 1.3)");
+            return FALSE;
+        }
+
+        priv->info = screen_info_new (self, TRUE, error);
+
+        if (!priv->info) {
+	    return FALSE;
+	}
+
+        XRRSelectInput (priv->xdisplay,
+            priv->xroot,
+            RRScreenChangeNotifyMask);
+        gdk_x11_register_standard_event_type (gdk_screen_get_display (priv->gdk_screen),
+                          event_base,
+                          RRNotify + 1);
+        gdk_window_add_filter (priv->gdk_root, screen_on_event, self);
+
+        return TRUE;
+    }
+    else
+    {
+#endif /* HAVE_RANDR */
+    g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_NO_RANDR_EXTENSION,
+        _("RANDR extension is not present"));
+
+    return FALSE;
+
+#ifdef HAVE_RANDR
+   }
+#endif
+}
+
+void
+mate_rr_screen_initable_iface_init (GInitableIface *iface)
+{
+    iface->init = mate_rr_screen_initable_init;
+}
+
+void
+    mate_rr_screen_finalize (GObject *gobject)
+{
+    MateRRScreen *screen = MATE_RR_SCREEN (gobject);
+
+    gdk_window_remove_filter (screen->priv->gdk_root, screen_on_event, screen);
+
+    if (screen->priv->info)
+      screen_info_free (screen->priv->info);
+
+    G_OBJECT_CLASS (mate_rr_screen_parent_class)->finalize (gobject);
+}
+
+void
+mate_rr_screen_set_property (GObject *gobject, guint property_id, const GValue *value, GParamSpec *property)
+{
+    MateRRScreen *self = MATE_RR_SCREEN (gobject);
+    MateRRScreenPrivate *priv = self->priv;
+
+    switch (property_id)
+    {
+    case SCREEN_PROP_GDK_SCREEN:
+        priv->gdk_screen = g_value_get_object (value);
+        priv->gdk_root = gdk_screen_get_root_window (priv->gdk_screen);
+        priv->xroot = GDK_WINDOW_XID (priv->gdk_root);
+        priv->xdisplay = GDK_SCREEN_XDISPLAY (priv->gdk_screen);
+        priv->xscreen = gdk_x11_screen_get_xscreen (priv->gdk_screen);
+        return;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, property);
+        return;
+    }
+}
+
+void
+mate_rr_screen_get_property (GObject *gobject, guint property_id, GValue *value, GParamSpec *property)
+{
+    MateRRScreen *self = MATE_RR_SCREEN (gobject);
+    MateRRScreenPrivate *priv = self->priv;
+
+    switch (property_id)
+    {
+    case SCREEN_PROP_GDK_SCREEN:
+        g_value_set_object (value, priv->gdk_screen);
+        return;
+     default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, property);
+        return;
+    }
+}
+
+void
+mate_rr_screen_class_init (MateRRScreenClass *klass)
+{
+    GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+    gobject_class->set_property = mate_rr_screen_set_property;
+    gobject_class->get_property = mate_rr_screen_get_property;
+    gobject_class->finalize = mate_rr_screen_finalize;
+
+    g_object_class_install_property(
+        gobject_class,
+        SCREEN_PROP_GDK_SCREEN,
+        g_param_spec_object (
+            "gdk-screen",
+            "GDK Screen",
+            "The GDK Screen represented by this MateRRScreen",
+            GDK_TYPE_SCREEN,
+	    G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)
+        );
+
+    screen_signals[SCREEN_CHANGED] = g_signal_new("changed",
+        G_TYPE_FROM_CLASS (gobject_class),
+        G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
+        G_STRUCT_OFFSET (MateRRScreenClass, changed),
+        NULL,
+        NULL,
+        g_cclosure_marshal_VOID__VOID,
+        G_TYPE_NONE,
+        0);
+}
+
+void
+mate_rr_screen_init (MateRRScreen *self)
+{
+    MateRRScreenPrivate *priv = mate_rr_screen_get_instance_private (self);
+    self->priv = priv;
+
+    priv->gdk_screen = NULL;
+    priv->gdk_root = NULL;
+    priv->xdisplay = NULL;
+    priv->xroot = None;
+    priv->xscreen = NULL;
+    priv->info = NULL;
+    priv->rr_major_version = 0;
+    priv->rr_minor_version = 0;
+}
+
+/**
+ * mate_rr_screen_new:
+ * @screen: the #GdkScreen on which to operate
+ * @error: will be set if XRandR is not supported
+ *
+ * Creates a new #MateRRScreen instance
+ *
+ * Returns: a new #MateRRScreen instance or NULL if screen could not be created,
+ * for instance if the driver does not support Xrandr 1.2
+ */
+MateRRScreen *
+mate_rr_screen_new (GdkScreen *screen,
+                    GError **error)
+{
+    _mate_desktop_init_i18n ();
+    return g_initable_new (MATE_TYPE_RR_SCREEN, NULL, error, "gdk-screen", screen, NULL);
+}
+
+void
+mate_rr_screen_set_size (MateRRScreen *screen,
+			  int	      width,
+			  int       height,
+			  int       mm_width,
+			  int       mm_height)
+{
+    g_return_if_fail (MATE_IS_RR_SCREEN (screen));
+
+#ifdef HAVE_RANDR
+	GdkDisplay *display;
+
+	display = gdk_display_get_default ();
+    gdk_x11_display_error_trap_push (display);
+    XRRSetScreenSize (screen->priv->xdisplay, screen->priv->xroot,
+		      width, height, mm_width, mm_height);
+    gdk_x11_display_error_trap_pop_ignored (display);
+#endif
+}
+
+/**
+ * mate_rr_screen_get_ranges:
+ * @screen: a #MateRRScreen
+ * @min_width: (out): the minimum width
+ * @max_width: (out): the maximum width
+ * @min_height: (out): the minimum height
+ * @max_height: (out): the maximum height
+ *
+ * Get the ranges of the screen
+ */
+void
+mate_rr_screen_get_ranges (MateRRScreen *screen,
+			    int	          *min_width,
+			    int	          *max_width,
+			    int           *min_height,
+			    int	          *max_height)
+{
+    MateRRScreenPrivate *priv;
+
+    g_return_if_fail (MATE_IS_RR_SCREEN (screen));
+
+    priv = screen->priv;
+
+    if (min_width)
+	*min_width = priv->info->min_width;
+
+    if (max_width)
+	*max_width = priv->info->max_width;
+
+    if (min_height)
+	*min_height = priv->info->min_height;
+
+    if (max_height)
+	*max_height = priv->info->max_height;
+}
+
+/**
+ * mate_rr_screen_get_timestamps:
+ * @screen: a #MateRRScreen
+ * @change_timestamp_ret: (out): Location in which to store the timestamp at which the RANDR configuration was last changed
+ * @config_timestamp_ret: (out): Location in which to store the timestamp at which the RANDR configuration was last obtained
+ *
+ * Queries the two timestamps that the X RANDR extension maintains.  The X
+ * server will prevent change requests for stale configurations, those whose
+ * timestamp is not equal to that of the latest request for configuration.  The
+ * X server will also prevent change requests that have an older timestamp to
+ * the latest change request.
+ */
+void
+mate_rr_screen_get_timestamps (MateRRScreen *screen,
+				guint32       *change_timestamp_ret,
+				guint32       *config_timestamp_ret)
+{
+    MateRRScreenPrivate *priv;
+
+    g_return_if_fail (MATE_IS_RR_SCREEN (screen));
+
+    priv = screen->priv;
+
+#ifdef HAVE_RANDR
+    if (change_timestamp_ret)
+	*change_timestamp_ret = priv->info->resources->timestamp;
+
+    if (config_timestamp_ret)
+	*config_timestamp_ret = priv->info->resources->configTimestamp;
+#endif
+}
+
+static gboolean
+force_timestamp_update (MateRRScreen *screen)
+{
+#ifdef HAVE_RANDR
+    MateRRScreenPrivate *priv = screen->priv;
+    MateRRCrtc *crtc;
+    XRRCrtcInfo *current_info;
+	GdkDisplay *display;
+    Status status;
+    gboolean timestamp_updated;
+
+    timestamp_updated = FALSE;
+
+    crtc = priv->info->crtcs[0];
+
+    if (crtc == NULL)
+	goto out;
+
+    current_info = XRRGetCrtcInfo (priv->xdisplay,
+				   priv->info->resources,
+				   crtc->id);
+
+    if (current_info == NULL)
+	  goto out;
+
+	display = gdk_display_get_default ();
+    gdk_x11_display_error_trap_push (display);
+    status = XRRSetCrtcConfig (priv->xdisplay,
+			       priv->info->resources,
+			       crtc->id,
+			       current_info->timestamp,
+			       current_info->x,
+			       current_info->y,
+			       current_info->mode,
+			       current_info->rotation,
+			       current_info->outputs,
+			       current_info->noutput);
+
+    XRRFreeCrtcInfo (current_info);
+
+    gdk_display_flush (display);
+    if (gdk_x11_display_error_trap_pop (display))
+	goto out;
+
+    if (status == RRSetConfigSuccess)
+	timestamp_updated = TRUE;
+out:
+    return timestamp_updated;
+#else
+    return FALSE;
+#endif
+}
+
+/**
+ * mate_rr_screen_refresh:
+ * @screen: a #MateRRScreen
+ * @error: location to store error, or %NULL
+ *
+ * Refreshes the screen configuration, and calls the screen's callback if it
+ * exists and if the screen's configuration changed.
+ *
+ * Return value: TRUE if the screen's configuration changed; otherwise, the
+ * function returns FALSE and a NULL error if the configuration didn't change,
+ * or FALSE and a non-NULL error if there was an error while refreshing the
+ * configuration.
+ */
+gboolean
+mate_rr_screen_refresh (MateRRScreen *screen,
+			 GError       **error)
+{
+    gboolean refreshed;
+
+    g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+    gdk_x11_display_grab (gdk_screen_get_display (screen->priv->gdk_screen));
+
+    refreshed = screen_update (screen, FALSE, TRUE, error);
+    force_timestamp_update (screen); /* this is to keep other clients from thinking that the X server re-detected things by itself - bgo#621046 */
+
+    gdk_x11_display_ungrab (gdk_screen_get_display (screen->priv->gdk_screen));
+
+    return refreshed;
+}
+
+/**
+ * mate_rr_screen_list_modes:
+ *
+ * List available XRandR modes
+ *
+ * Returns: (array zero-terminated=1) (transfer none):
+ */
+MateRRMode **
+mate_rr_screen_list_modes (MateRRScreen *screen)
+{
+    g_return_val_if_fail (MATE_IS_RR_SCREEN (screen), NULL);
+    g_return_val_if_fail (screen->priv->info != NULL, NULL);
+
+    return screen->priv->info->modes;
+}
+
+/**
+ * mate_rr_screen_list_clone_modes:
+ *
+ * List available XRandR clone modes
+ *
+ * Returns: (array zero-terminated=1) (transfer none):
+ */
+MateRRMode **
+mate_rr_screen_list_clone_modes   (MateRRScreen *screen)
+{
+    g_return_val_if_fail (MATE_IS_RR_SCREEN (screen), NULL);
+    g_return_val_if_fail (screen->priv->info != NULL, NULL);
+
+    return screen->priv->info->clone_modes;
+}
+
+/**
+ * mate_rr_screen_list_crtcs:
+ *
+ * List all CRTCs
+ *
+ * Returns: (array zero-terminated=1) (transfer none):
+ */
+MateRRCrtc **
+mate_rr_screen_list_crtcs (MateRRScreen *screen)
+{
+    g_return_val_if_fail (MATE_IS_RR_SCREEN (screen), NULL);
+    g_return_val_if_fail (screen->priv->info != NULL, NULL);
+
+    return screen->priv->info->crtcs;
+}
+
+/**
+ * mate_rr_screen_list_outputs:
+ *
+ * List all outputs
+ *
+ * Returns: (array zero-terminated=1) (transfer none):
+ */
+MateRROutput **
+mate_rr_screen_list_outputs (MateRRScreen *screen)
+{
+    g_return_val_if_fail (MATE_IS_RR_SCREEN (screen), NULL);
+    g_return_val_if_fail (screen->priv->info != NULL, NULL);
+
+    return screen->priv->info->outputs;
+}
+
+/**
+ * mate_rr_screen_get_crtc_by_id:
+ *
+ * Returns: (transfer none): the CRTC identified by @id
+ */
+MateRRCrtc *
+mate_rr_screen_get_crtc_by_id (MateRRScreen *screen,
+				guint32        id)
+{
+    MateRRCrtc **crtcs;
+    int i;
+
+    g_return_val_if_fail (MATE_IS_RR_SCREEN (screen), NULL);
+    g_return_val_if_fail (screen->priv->info != NULL, NULL);
+
+    crtcs = screen->priv->info->crtcs;
+
+    for (i = 0; crtcs[i] != NULL; ++i)
+    {
+	if (crtcs[i]->id == id)
+	    return crtcs[i];
+    }
+
+    return NULL;
+}
+
+/**
+ * mate_rr_screen_get_output_by_id:
+ *
+ * Returns: (transfer none): the output identified by @id
+ */
+MateRROutput *
+mate_rr_screen_get_output_by_id (MateRRScreen *screen,
+				  guint32        id)
+{
+    MateRROutput **outputs;
+    int i;
+
+    g_return_val_if_fail (MATE_IS_RR_SCREEN (screen), NULL);
+    g_return_val_if_fail (screen->priv->info != NULL, NULL);
+
+    outputs = screen->priv->info->outputs;
+
+    for (i = 0; outputs[i] != NULL; ++i)
+    {
+	if (outputs[i]->id == id)
+	    return outputs[i];
+    }
+
+    return NULL;
+}
+
+/* MateRROutput */
+static MateRROutput *
+output_new (ScreenInfo *info, RROutput id)
+{
+    MateRROutput *output = g_slice_new0 (MateRROutput);
+
+    output->id = id;
+    output->info = info;
+
+    return output;
+}
+
+static guint8 *
+get_property (Display *dpy,
+	      RROutput output,
+	      Atom atom,
+	      int *len)
+{
+#ifdef HAVE_RANDR
+    unsigned char *prop;
+    int actual_format;
+    unsigned long nitems, bytes_after;
+    Atom actual_type;
+    guint8 *result;
+
+    XRRGetOutputProperty (dpy, output, atom,
+			  0, 100, False, False,
+			  AnyPropertyType,
+			  &actual_type, &actual_format,
+			  &nitems, &bytes_after, &prop);
+
+    if (actual_type == XA_INTEGER && actual_format == 8)
+    {
+#ifdef GLIB_VERSION_2_68
+	result = g_memdup2 (prop, nitems);
+#else
+	result = g_memdup (prop, nitems);
+#endif
+	if (len)
+	    *len = nitems;
+    }
+    else
+    {
+	result = NULL;
+    }
+
+    XFree (prop);
+
+    return result;
+#else
+    return NULL;
+#endif /* HAVE_RANDR */
+}
+
+static guint8 *
+read_edid_data (MateRROutput *output, int *len)
+{
+    Atom edid_atom;
+    guint8 *result;
+
+    edid_atom = XInternAtom (DISPLAY (output), "EDID", FALSE);
+    result = get_property (DISPLAY (output),
+			   output->id, edid_atom, len);
+
+    if (!result)
+    {
+	edid_atom = XInternAtom (DISPLAY (output), "EDID_DATA", FALSE);
+	result = get_property (DISPLAY (output),
+			       output->id, edid_atom, len);
+    }
+
+    if (result)
+    {
+	if (*len % 128 == 0)
+	    return result;
+	else
+	    g_free (result);
+    }
+
+    return NULL;
+}
+
+static char *
+get_connector_type_string (MateRROutput *output)
+{
+#ifdef HAVE_RANDR
+    char *result;
+    unsigned char *prop;
+    int actual_format;
+    unsigned long nitems, bytes_after;
+    Atom actual_type;
+    Atom connector_type;
+    char *connector_type_str;
+
+    result = NULL;
+
+    if (XRRGetOutputProperty (DISPLAY (output), output->id, output->info->screen->priv->connector_type_atom,
+			      0, 100, False, False,
+			      AnyPropertyType,
+			      &actual_type, &actual_format,
+			      &nitems, &bytes_after, &prop) != Success)
+	return NULL;
+
+    if (!(actual_type == XA_ATOM && actual_format == 32 && nitems == 1))
+	goto out;
+
+    connector_type = *((Atom *) prop);
+
+    connector_type_str = XGetAtomName (DISPLAY (output), connector_type);
+    if (connector_type_str) {
+	result = g_strdup (connector_type_str); /* so the caller can g_free() it */
+	XFree (connector_type_str);
+    }
+
+out:
+
+    XFree (prop);
+
+    return result;
+#else
+    return NULL;
+#endif
+}
+
+#ifdef HAVE_RANDR
+static gboolean
+output_initialize (MateRROutput *output, XRRScreenResources *res, GError **error)
+{
+    XRROutputInfo *info = XRRGetOutputInfo (
+	DISPLAY (output), res, output->id);
+    GPtrArray *a;
+    int i;
+
+#if 0
+    g_print ("Output %lx Timestamp: %u\n", output->id, (guint32)info->timestamp);
+#endif
+
+    if (!info || !output->info)
+    {
+	/* FIXME: see the comment in crtc_initialize() */
+	/* Translators: here, an "output" is a video output */
+	g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_RANDR_ERROR,
+		     _("could not get information about output %d"),
+		     (int) output->id);
+	return FALSE;
+    }
+
+    output->name = g_strdup (info->name); /* FIXME: what is nameLen used for? */
+    output->current_crtc = crtc_by_id (output->info, info->crtc);
+    output->width_mm = info->mm_width;
+    output->height_mm = info->mm_height;
+    output->connected = (info->connection == RR_Connected);
+    output->connector_type = get_connector_type_string (output);
+
+    /* Possible crtcs */
+    a = g_ptr_array_new ();
+
+    for (i = 0; i < info->ncrtc; ++i)
+    {
+	MateRRCrtc *crtc = crtc_by_id (output->info, info->crtcs[i]);
+
+	if (crtc)
+	    g_ptr_array_add (a, crtc);
+    }
+    g_ptr_array_add (a, NULL);
+    output->possible_crtcs = (MateRRCrtc **)g_ptr_array_free (a, FALSE);
+
+    /* Clones */
+    a = g_ptr_array_new ();
+    for (i = 0; i < info->nclone; ++i)
+    {
+	MateRROutput *mate_rr_output = mate_rr_output_by_id (output->info, info->clones[i]);
+
+	if (mate_rr_output)
+	    g_ptr_array_add (a, mate_rr_output);
+    }
+    g_ptr_array_add (a, NULL);
+    output->clones = (MateRROutput **)g_ptr_array_free (a, FALSE);
+
+    /* Modes */
+    a = g_ptr_array_new ();
+    for (i = 0; i < info->nmode; ++i)
+    {
+	MateRRMode *mode = mode_by_id (output->info, info->modes[i]);
+
+	if (mode)
+	    g_ptr_array_add (a, mode);
+    }
+    g_ptr_array_add (a, NULL);
+    output->modes = (MateRRMode **)g_ptr_array_free (a, FALSE);
+
+    output->n_preferred = info->npreferred;
+
+    /* Edid data */
+    output->edid_data = read_edid_data (output, &output->edid_size);
+
+    XRRFreeOutputInfo (info);
+
+    return TRUE;
+}
+#endif /* HAVE_RANDR */
+
+static MateRROutput*
+output_copy (const MateRROutput *from)
+{
+    GPtrArray *array;
+    MateRRCrtc **p_crtc;
+    MateRROutput **p_output;
+    MateRRMode **p_mode;
+    MateRROutput *output = g_slice_new0 (MateRROutput);
+
+    output->id = from->id;
+    output->info = from->info;
+    output->name = g_strdup (from->name);
+    output->current_crtc = from->current_crtc;
+    output->width_mm = from->width_mm;
+    output->height_mm = from->height_mm;
+    output->connected = from->connected;
+    output->n_preferred = from->n_preferred;
+    output->connector_type = g_strdup (from->connector_type);
+
+    array = g_ptr_array_new ();
+    for (p_crtc = from->possible_crtcs; *p_crtc != NULL; p_crtc++)
+    {
+        g_ptr_array_add (array, *p_crtc);
+    }
+    output->possible_crtcs = (MateRRCrtc**) g_ptr_array_free (array, FALSE);
+
+    array = g_ptr_array_new ();
+    for (p_output = from->clones; *p_output != NULL; p_output++)
+    {
+        g_ptr_array_add (array, *p_output);
+    }
+    output->clones = (MateRROutput**) g_ptr_array_free (array, FALSE);
+
+    array = g_ptr_array_new ();
+    for (p_mode = from->modes; *p_mode != NULL; p_mode++)
+    {
+        g_ptr_array_add (array, *p_mode);
+    }
+    output->modes = (MateRRMode**) g_ptr_array_free (array, FALSE);
+
+    output->edid_size = from->edid_size;
+#ifdef GLIB_VERSION_2_68
+    output->edid_data = g_memdup2 (from->edid_data, from->edid_size);
+#else
+    output->edid_data = g_memdup (from->edid_data, from->edid_size);
+#endif
+    return output;
+}
+
+static void
+output_free (MateRROutput *output)
+{
+    g_free (output->clones);
+    g_free (output->modes);
+    g_free (output->possible_crtcs);
+    g_free (output->edid_data);
+    g_free (output->name);
+    g_free (output->connector_type);
+    g_slice_free (MateRROutput, output);
+}
+
+guint32
+mate_rr_output_get_id (MateRROutput *output)
+{
+    g_assert(output != NULL);
+
+    return output->id;
+}
+
+const guint8 *
+mate_rr_output_get_edid_data (MateRROutput *output)
+{
+    g_return_val_if_fail (output != NULL, NULL);
+
+    return output->edid_data;
+}
+
+/**
+ * mate_rr_screen_get_output_by_name:
+ *
+ * Returns: (transfer none): the output identified by @name
+ */
+MateRROutput *
+mate_rr_screen_get_output_by_name (MateRRScreen *screen,
+				    const char    *name)
+{
+    int i;
+
+    g_return_val_if_fail (MATE_IS_RR_SCREEN (screen), NULL);
+    g_return_val_if_fail (screen->priv->info != NULL, NULL);
+
+    for (i = 0; screen->priv->info->outputs[i] != NULL; ++i)
+    {
+	MateRROutput *output = screen->priv->info->outputs[i];
+
+	if (strcmp (output->name, name) == 0)
+	    return output;
+    }
+
+    return NULL;
+}
+
+/**
+ * mate_rr_output_get_crtc:
+ * @output: a #MateRROutput
+ * Returns: (transfer none):
+ */
+MateRRCrtc *
+mate_rr_output_get_crtc (MateRROutput *output)
+{
+    g_return_val_if_fail (output != NULL, NULL);
+
+    return output->current_crtc;
+}
+
+/**
+ * mate_rr_output_get_possible_crtcs:
+ * @output: a #MateRROutput
+ * Returns: (array zero-terminated=1) (transfer none):
+ */
+MateRRCrtc **
+mate_rr_output_get_possible_crtcs (MateRROutput *output)
+{
+    g_return_val_if_fail (output != NULL, NULL);
+
+    return output->possible_crtcs;
+}
+
+/* Returns NULL if the ConnectorType property is not available */
+const char *
+mate_rr_output_get_connector_type (MateRROutput *output)
+{
+    g_return_val_if_fail (output != NULL, NULL);
+
+    return output->connector_type;
+}
+
+gboolean
+_mate_rr_output_name_is_laptop (const char *name)
+{
+    if (!name)
+        return FALSE;
+
+    if (strstr (name, "lvds") || /* Most drivers use an "LVDS" prefix... */
+        strstr (name, "LVDS") ||
+        strstr (name, "Lvds") ||
+        strstr (name, "LCD")  || /* ... but fglrx uses "LCD" in some versions.  Shoot me now, kthxbye. */
+        strstr (name, "eDP"))    /* eDP is for internal laptop panel connections */
+        return TRUE;
+
+    return FALSE;
+}
+
+gboolean
+mate_rr_output_is_laptop (MateRROutput *output)
+{
+    g_return_val_if_fail (output != NULL, FALSE);
+
+    if (!output->connected)
+        return FALSE;
+
+    if (g_strcmp0 (output->connector_type, MATE_RR_CONNECTOR_TYPE_PANEL) == 0)
+        return TRUE;
+
+    /* Fallback (see https://bugs.freedesktop.org/show_bug.cgi?id=26736) */
+    return _mate_rr_output_name_is_laptop (output->name);
+}
+
+/**
+ * mate_rr_output_get_current_mode:
+ * @output: a #MateRROutput
+ * Returns: (transfer none): the current mode of this output
+ */
+MateRRMode *
+mate_rr_output_get_current_mode (MateRROutput *output)
+{
+    MateRRCrtc *crtc;
+
+    g_return_val_if_fail (output != NULL, NULL);
+
+    if ((crtc = mate_rr_output_get_crtc (output)))
+	return mate_rr_crtc_get_current_mode (crtc);
+
+    return NULL;
+}
+
+/**
+ * mate_rr_output_get_position:
+ * @output: a #MateRROutput
+ * @x: (out) (allow-none):
+ * @y: (out) (allow-none):
+ */
+void
+mate_rr_output_get_position (MateRROutput   *output,
+			      int             *x,
+			      int             *y)
+{
+    MateRRCrtc *crtc;
+
+    g_return_if_fail (output != NULL);
+
+    if ((crtc = mate_rr_output_get_crtc (output)))
+	mate_rr_crtc_get_position (crtc, x, y);
+}
+
+const char *
+mate_rr_output_get_name (MateRROutput *output)
+{
+    g_assert (output != NULL);
+    return output->name;
+}
+
+int
+mate_rr_output_get_width_mm (MateRROutput *output)
+{
+    g_assert (output != NULL);
+    return output->width_mm;
+}
+
+int
+mate_rr_output_get_height_mm (MateRROutput *output)
+{
+    g_assert (output != NULL);
+    return output->height_mm;
+}
+
+/**
+ * mate_rr_output_get_preferred_mode:
+ * @output: a #MateRROutput
+ * Returns: (transfer none):
+ */
+MateRRMode *
+mate_rr_output_get_preferred_mode (MateRROutput *output)
+{
+    g_return_val_if_fail (output != NULL, NULL);
+    if (output->n_preferred)
+	return output->modes[0];
+
+    return NULL;
+}
+
+/**
+ * mate_rr_output_list_modes:
+ * @output: a #MateRROutput
+ * Returns: (array zero-terminated=1) (transfer none):
+ */
+
+MateRRMode **
+mate_rr_output_list_modes (MateRROutput *output)
+{
+    g_return_val_if_fail (output != NULL, NULL);
+    return output->modes;
+}
+
+gboolean
+mate_rr_output_is_connected (MateRROutput *output)
+{
+    g_return_val_if_fail (output != NULL, FALSE);
+    return output->connected;
+}
+
+gboolean
+mate_rr_output_supports_mode (MateRROutput *output,
+			       MateRRMode   *mode)
+{
+    int i;
+
+    g_return_val_if_fail (output != NULL, FALSE);
+    g_return_val_if_fail (mode != NULL, FALSE);
+
+    for (i = 0; output->modes[i] != NULL; ++i)
+    {
+	if (output->modes[i] == mode)
+	    return TRUE;
+    }
+
+    return FALSE;
+}
+
+gboolean
+mate_rr_output_can_clone (MateRROutput *output,
+			   MateRROutput *clone)
+{
+    int i;
+
+    g_return_val_if_fail (output != NULL, FALSE);
+    g_return_val_if_fail (clone != NULL, FALSE);
+
+    for (i = 0; output->clones[i] != NULL; ++i)
+    {
+	if (output->clones[i] == clone)
+	    return TRUE;
+    }
+
+    return FALSE;
+}
+
+gboolean
+mate_rr_output_get_is_primary (MateRROutput *output)
+{
+#ifdef HAVE_RANDR
+    return output->info->primary == output->id;
+#else
+    return FALSE;
+#endif
+}
+
+void
+mate_rr_screen_set_primary_output (MateRRScreen *screen,
+                                    MateRROutput *output)
+{
+#ifdef HAVE_RANDR
+    MateRRScreenPrivate *priv;
+
+    g_return_if_fail (MATE_IS_RR_SCREEN (screen));
+
+    priv = screen->priv;
+
+    RROutput id;
+
+    if (output)
+        id = output->id;
+    else
+        id = None;
+
+    XRRSetOutputPrimary (priv->xdisplay, priv->xroot, id);
+#endif
+}
+
+/* MateRRCrtc */
+typedef struct
+{
+    Rotation xrot;
+    MateRRRotation rot;
+} RotationMap;
+
+static const RotationMap rotation_map[] =
+{
+    { RR_Rotate_0, MATE_RR_ROTATION_0 },
+    { RR_Rotate_90, MATE_RR_ROTATION_90 },
+    { RR_Rotate_180, MATE_RR_ROTATION_180 },
+    { RR_Rotate_270, MATE_RR_ROTATION_270 },
+    { RR_Reflect_X, MATE_RR_REFLECT_X },
+    { RR_Reflect_Y, MATE_RR_REFLECT_Y },
+};
+
+static MateRRRotation
+mate_rr_rotation_from_xrotation (Rotation r)
+{
+    gsize i;
+    MateRRRotation result = 0;
+
+    for (i = 0; i < G_N_ELEMENTS (rotation_map); ++i)
+    {
+	if (r & rotation_map[i].xrot)
+	    result |= rotation_map[i].rot;
+    }
+
+    return result;
+}
+
+static Rotation
+xrotation_from_rotation (MateRRRotation r)
+{
+    gsize i;
+    Rotation result = 0;
+
+    for (i = 0; i < G_N_ELEMENTS (rotation_map); ++i)
+    {
+	if (r & rotation_map[i].rot)
+	    result |= rotation_map[i].xrot;
+    }
+
+    return result;
+}
+
+#ifndef MATE_DISABLE_DEPRECATED_SOURCE
+gboolean
+mate_rr_crtc_set_config (MateRRCrtc      *crtc,
+			  int               x,
+			  int               y,
+			  MateRRMode      *mode,
+			  MateRRRotation   rotation,
+			  MateRROutput   **outputs,
+			  int               n_outputs,
+			  GError          **error)
+{
+    return mate_rr_crtc_set_config_with_time (crtc, GDK_CURRENT_TIME, x, y, mode, rotation, outputs, n_outputs, error);
+}
+#endif
+
+gboolean
+mate_rr_crtc_set_config_with_time (MateRRCrtc      *crtc,
+				    guint32           timestamp,
+				    int               x,
+				    int               y,
+				    MateRRMode      *mode,
+				    MateRRRotation   rotation,
+				    MateRROutput   **outputs,
+				    int               n_outputs,
+				    GError          **error)
+{
+#ifdef HAVE_RANDR
+    ScreenInfo *info;
+    GArray *output_ids;
+	GdkDisplay *display;
+    Status status;
+    gboolean result;
+    int i;
+
+    g_return_val_if_fail (crtc != NULL, FALSE);
+    g_return_val_if_fail (mode != NULL || outputs == NULL || n_outputs == 0, FALSE);
+    g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+    info = crtc->info;
+
+    if (mode)
+    {
+	if (x + mode->width > info->max_width
+	    || y + mode->height > info->max_height)
+	{
+	    g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_BOUNDS_ERROR,
+			 /* Translators: the "position", "size", and "maximum"
+			  * words here are not keywords; please translate them
+			  * as usual.  A CRTC is a CRT Controller (this is X terminology) */
+			 _("requested position/size for CRTC %d is outside the allowed limit: "
+			   "position=(%d, %d), size=(%d, %d), maximum=(%d, %d)"),
+			 (int) crtc->id,
+			 x, y,
+			 mode->width, mode->height,
+			 info->max_width, info->max_height);
+	    return FALSE;
+	}
+    }
+
+    output_ids = g_array_new (FALSE, FALSE, sizeof (RROutput));
+
+    if (outputs)
+    {
+	for (i = 0; i < n_outputs; ++i)
+	    g_array_append_val (output_ids, outputs[i]->id);
+    }
+
+	display = gdk_display_get_default ();
+    gdk_x11_display_error_trap_push (display);
+    status = XRRSetCrtcConfig (DISPLAY (crtc), info->resources, crtc->id,
+			       timestamp,
+			       x, y,
+			       mode ? mode->id : None,
+			       xrotation_from_rotation (rotation),
+			       (RROutput *)output_ids->data,
+			       output_ids->len);
+
+    g_array_free (output_ids, TRUE);
+
+    if (gdk_x11_display_error_trap_pop (display) || status != RRSetConfigSuccess) {
+        /* Translators: CRTC is a CRT Controller (this is X terminology).
+         * It is *very* unlikely that you'll ever get this error, so it is
+         * only listed for completeness. */
+        g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_RANDR_ERROR,
+                     _("could not set the configuration for CRTC %d"),
+                     (int) crtc->id);
+        return FALSE;
+    } else {
+        result = TRUE;
+    }
+
+    return result;
+#else
+    return FALSE;
+#endif /* HAVE_RANDR */
+}
+
+/**
+ * mate_rr_crtc_get_current_mode:
+ * @crtc: a #MateRRCrtc
+ * Returns: (transfer none): the current mode of this crtc
+ */
+MateRRMode *
+mate_rr_crtc_get_current_mode (MateRRCrtc *crtc)
+{
+    g_return_val_if_fail (crtc != NULL, NULL);
+
+    return crtc->current_mode;
+}
+
+guint32
+mate_rr_crtc_get_id (MateRRCrtc *crtc)
+{
+    g_return_val_if_fail (crtc != NULL, 0);
+
+    return crtc->id;
+}
+
+gboolean
+mate_rr_crtc_can_drive_output (MateRRCrtc   *crtc,
+				MateRROutput *output)
+{
+    int i;
+
+    g_return_val_if_fail (crtc != NULL, FALSE);
+    g_return_val_if_fail (output != NULL, FALSE);
+
+    for (i = 0; crtc->possible_outputs[i] != NULL; ++i)
+    {
+	if (crtc->possible_outputs[i] == output)
+	    return TRUE;
+    }
+
+    return FALSE;
+}
+
+/* FIXME: merge with get_mode()? */
+
+/**
+ * mate_rr_crtc_get_position:
+ * @crtc: a #MateRRCrtc
+ * @x: (out) (allow-none):
+ * @y: (out) (allow-none):
+ */
+void
+mate_rr_crtc_get_position (MateRRCrtc *crtc,
+			    int         *x,
+			    int         *y)
+{
+    g_return_if_fail (crtc != NULL);
+
+    if (x)
+	*x = crtc->x;
+
+    if (y)
+	*y = crtc->y;
+}
+
+/* FIXME: merge with get_mode()? */
+MateRRRotation
+mate_rr_crtc_get_current_rotation (MateRRCrtc *crtc)
+{
+    g_assert(crtc != NULL);
+    return crtc->current_rotation;
+}
+
+MateRRRotation
+mate_rr_crtc_get_rotations (MateRRCrtc *crtc)
+{
+    g_assert(crtc != NULL);
+    return crtc->rotations;
+}
+
+gboolean
+mate_rr_crtc_supports_rotation (MateRRCrtc *   crtc,
+				 MateRRRotation rotation)
+{
+    g_return_val_if_fail (crtc != NULL, FALSE);
+    return (crtc->rotations & rotation);
+}
+
+static MateRRCrtc *
+crtc_new (ScreenInfo *info, RROutput id)
+{
+    MateRRCrtc *crtc = g_slice_new0 (MateRRCrtc);
+
+    crtc->id = id;
+    crtc->info = info;
+
+    return crtc;
+}
+
+static MateRRCrtc *
+crtc_copy (const MateRRCrtc *from)
+{
+    MateRROutput **p_output;
+    GPtrArray *array;
+    MateRRCrtc *to = g_slice_new0 (MateRRCrtc);
+
+    to->info = from->info;
+    to->id = from->id;
+    to->current_mode = from->current_mode;
+    to->x = from->x;
+    to->y = from->y;
+    to->current_rotation = from->current_rotation;
+    to->rotations = from->rotations;
+    to->gamma_size = from->gamma_size;
+
+    array = g_ptr_array_new ();
+    for (p_output = from->current_outputs; *p_output != NULL; p_output++)
+    {
+        g_ptr_array_add (array, *p_output);
+    }
+    to->current_outputs = (MateRROutput**) g_ptr_array_free (array, FALSE);
+
+    array = g_ptr_array_new ();
+    for (p_output = from->possible_outputs; *p_output != NULL; p_output++)
+    {
+        g_ptr_array_add (array, *p_output);
+    }
+    to->possible_outputs = (MateRROutput**) g_ptr_array_free (array, FALSE);
+
+    return to;
+}
+
+#ifdef HAVE_RANDR
+static gboolean
+crtc_initialize (MateRRCrtc        *crtc,
+		 XRRScreenResources *res,
+		 GError            **error)
+{
+    XRRCrtcInfo *info = XRRGetCrtcInfo (DISPLAY (crtc), res, crtc->id);
+    GPtrArray *a;
+    int i;
+
+#if 0
+    g_print ("CRTC %lx Timestamp: %u\n", crtc->id, (guint32)info->timestamp);
+#endif
+
+    if (!info)
+    {
+	/* FIXME: We need to reaquire the screen resources */
+	/* FIXME: can we actually catch BadRRCrtc, and does it make sense to emit that? */
+
+	/* Translators: CRTC is a CRT Controller (this is X terminology).
+	 * It is *very* unlikely that you'll ever get this error, so it is
+	 * only listed for completeness. */
+	g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_RANDR_ERROR,
+		     _("could not get information about CRTC %d"),
+		     (int) crtc->id);
+	return FALSE;
+    }
+
+    /* MateRRMode */
+    crtc->current_mode = mode_by_id (crtc->info, info->mode);
+
+    crtc->x = info->x;
+    crtc->y = info->y;
+
+    /* Current outputs */
+    a = g_ptr_array_new ();
+    for (i = 0; i < info->noutput; ++i)
+    {
+	MateRROutput *output = mate_rr_output_by_id (crtc->info, info->outputs[i]);
+
+	if (output)
+	    g_ptr_array_add (a, output);
+    }
+    g_ptr_array_add (a, NULL);
+    crtc->current_outputs = (MateRROutput **)g_ptr_array_free (a, FALSE);
+
+    /* Possible outputs */
+    a = g_ptr_array_new ();
+    for (i = 0; i < info->npossible; ++i)
+    {
+	MateRROutput *output = mate_rr_output_by_id (crtc->info, info->possible[i]);
+
+	if (output)
+	    g_ptr_array_add (a, output);
+    }
+    g_ptr_array_add (a, NULL);
+    crtc->possible_outputs = (MateRROutput **)g_ptr_array_free (a, FALSE);
+
+    /* Rotations */
+    crtc->current_rotation = mate_rr_rotation_from_xrotation (info->rotation);
+    crtc->rotations = mate_rr_rotation_from_xrotation (info->rotations);
+
+    XRRFreeCrtcInfo (info);
+
+    /* get an store gamma size */
+    crtc->gamma_size = XRRGetCrtcGammaSize (DISPLAY (crtc), crtc->id);
+
+    return TRUE;
+}
+#endif
+
+static void
+crtc_free (MateRRCrtc *crtc)
+{
+    g_free (crtc->current_outputs);
+    g_free (crtc->possible_outputs);
+    g_slice_free (MateRRCrtc, crtc);
+}
+
+/* MateRRMode */
+static MateRRMode *
+mode_new (ScreenInfo *info, RRMode id)
+{
+    MateRRMode *mode = g_slice_new0 (MateRRMode);
+
+    mode->id = id;
+    mode->info = info;
+
+    return mode;
+}
+
+guint32
+mate_rr_mode_get_id (MateRRMode *mode)
+{
+    g_return_val_if_fail (mode != NULL, 0);
+    return mode->id;
+}
+
+guint
+mate_rr_mode_get_width (MateRRMode *mode)
+{
+    g_return_val_if_fail (mode != NULL, 0);
+    return mode->width;
+}
+
+int
+mate_rr_mode_get_freq (MateRRMode *mode)
+{
+    g_return_val_if_fail (mode != NULL, 0);
+    return (mode->freq) / 1000;
+}
+
+guint
+mate_rr_mode_get_height (MateRRMode *mode)
+{
+    g_return_val_if_fail (mode != NULL, 0);
+    return mode->height;
+}
+
+#ifdef HAVE_RANDR
+static void
+mode_initialize (MateRRMode *mode, XRRModeInfo *info)
+{
+    g_assert (mode != NULL);
+    g_assert (info != NULL);
+
+    mode->name = g_strdup (info->name);
+    mode->width = info->width;
+    mode->height = info->height;
+    mode->freq = ((info->dotClock / (double)info->hTotal) / info->vTotal + 0.5) * 1000;
+}
+#endif /* HAVE_RANDR */
+
+static MateRRMode *
+mode_copy (const MateRRMode *from)
+{
+    MateRRMode *to = g_slice_new0 (MateRRMode);
+
+    to->id = from->id;
+    to->info = from->info;
+    to->name = g_strdup (from->name);
+    to->width = from->width;
+    to->height = from->height;
+    to->freq = from->freq;
+
+    return to;
+}
+
+static void
+mode_free (MateRRMode *mode)
+{
+    g_free (mode->name);
+    g_slice_free (MateRRMode, mode);
+}
+
+void
+mate_rr_crtc_set_gamma (MateRRCrtc *crtc, int size,
+			 unsigned short *red,
+			 unsigned short *green,
+			 unsigned short *blue)
+{
+#ifdef HAVE_RANDR
+    int copy_size;
+    XRRCrtcGamma *gamma;
+
+    g_return_if_fail (crtc != NULL);
+    g_return_if_fail (red != NULL);
+    g_return_if_fail (green != NULL);
+    g_return_if_fail (blue != NULL);
+
+    if (size != crtc->gamma_size)
+	return;
+
+    gamma = XRRAllocGamma (crtc->gamma_size);
+
+    copy_size = crtc->gamma_size * sizeof (unsigned short);
+    memcpy (gamma->red, red, copy_size);
+    memcpy (gamma->green, green, copy_size);
+    memcpy (gamma->blue, blue, copy_size);
+
+    XRRSetCrtcGamma (DISPLAY (crtc), crtc->id, gamma);
+    XRRFreeGamma (gamma);
+#endif /* HAVE_RANDR */
+}
+
+/**
+ * mate_rr_crtc_get_gamma:
+ * @crtc: a #MateRRCrtc
+ * @size:
+ * @red: (out): the minimum width
+ * @green: (out): the maximum width
+ * @blue: (out): the minimum height
+ *
+ * Returns: %TRUE for success
+ */
+gboolean
+mate_rr_crtc_get_gamma (MateRRCrtc *crtc, int *size,
+			 unsigned short **red, unsigned short **green,
+			 unsigned short **blue)
+{
+#ifdef HAVE_RANDR
+    int copy_size;
+    unsigned short *r, *g, *b;
+    XRRCrtcGamma *gamma;
+
+    g_return_val_if_fail (crtc != NULL, FALSE);
+
+    gamma = XRRGetCrtcGamma (DISPLAY (crtc), crtc->id);
+    if (!gamma)
+	return FALSE;
+
+    copy_size = crtc->gamma_size * sizeof (unsigned short);
+
+    if (red) {
+	r = g_new0 (unsigned short, crtc->gamma_size);
+	memcpy (r, gamma->red, copy_size);
+	*red = r;
+    }
+
+    if (green) {
+	g = g_new0 (unsigned short, crtc->gamma_size);
+	memcpy (g, gamma->green, copy_size);
+	*green = g;
+    }
+
+    if (blue) {
+	b = g_new0 (unsigned short, crtc->gamma_size);
+	memcpy (b, gamma->blue, copy_size);
+	*blue = b;
+    }
+
+    XRRFreeGamma (gamma);
+
+    if (size)
+	*size = crtc->gamma_size;
+
+    return TRUE;
+#else
+    return FALSE;
+#endif /* HAVE_RANDR */
+}
+
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/95.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/95.html new file mode 100644 index 00000000..cfd5bbb1 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/95.html @@ -0,0 +1,365 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
/*
+ * Copyright (C) 2012,2017 Red Hat, Inc.
+ * Copyright (C) 2018-2021 MATE Developers
+ *
+ * This file is part of the Mate Library.
+ *
+ * The Gnome Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Gnome 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Gnome Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Bastien Nocera <hadess@hadess.net>
++ */
+
+#define MATE_DESKTOP_USE_UNSTABLE_API
+#include "mate-desktop-thumbnail.h"
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+int main (int argc, char **argv)
+{
+    GdkPixbuf *pixbuf;
+    MateDesktopThumbnailFactory *factory;
+    GtkWidget *window, *image;
+    char *content_type;
+
+    gtk_init (&argc, &argv);
+
+    if (argc < 2) {
+        g_print ("Usage: %s FILE...\n", argv[0]);
+        return 1;
+    }
+
+    content_type = g_content_type_guess (argv[1], NULL, 0, NULL);
+    factory = mate_desktop_thumbnail_factory_new (MATE_DESKTOP_THUMBNAIL_SIZE_LARGE);
+    pixbuf = mate_desktop_thumbnail_factory_generate_thumbnail (factory, argv[1], content_type);
+    g_free (content_type);
+    g_object_unref (factory);
+
+    if (pixbuf == NULL) {
+        g_warning ("mate_desktop_thumbnail_factory_generate_thumbnail() failed to generate a thumbnail for %s", argv[1]);
+        return 1;
+    }
+
+    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+    g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
+    image = gtk_image_new_from_pixbuf (pixbuf);
+    g_object_unref (pixbuf);
+    gtk_container_add (GTK_CONTAINER (window), image);
+    gtk_widget_show_all (window);
+
+    gtk_main ();
+
+    return 0;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/96.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/96.html new file mode 100644 index 00000000..b3e85e1d --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/96.html @@ -0,0 +1,553 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
/* -*- Mode: C; c-set-style: gnu indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <mate-desktop-item.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <locale.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+static void
+test_ditem (const char *file)
+{
+	MateDesktopItem *ditem;
+	MateDesktopItemType type;
+	const gchar *text;
+	char *uri;
+	char path[256];
+
+	ditem = mate_desktop_item_new_from_file (file,
+						  MATE_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS,
+						  NULL);
+	if (ditem == NULL) {
+		g_print ("File %s is not an existing ditem\n", file);
+		return;
+	}
+
+	text = mate_desktop_item_get_location (ditem);
+	g_print ("LOCATION: |%s|\n", text);
+
+	type = mate_desktop_item_get_entry_type (ditem);
+	g_print ("TYPE: |%u|\n", type);
+
+	text = mate_desktop_item_get_string
+		(ditem, MATE_DESKTOP_ITEM_TYPE);
+	g_print ("TYPE(string): |%s|\n", text);
+
+	text = mate_desktop_item_get_string
+		(ditem, MATE_DESKTOP_ITEM_EXEC);
+	g_print ("EXEC: |%s|\n", text);
+
+	text = mate_desktop_item_get_string
+		(ditem, MATE_DESKTOP_ITEM_ICON);
+	g_print ("ICON: |%s|\n", text);
+
+	text = mate_desktop_item_get_localestring
+		(ditem, MATE_DESKTOP_ITEM_NAME);
+	g_print ("NAME: |%s|\n", text);
+
+	text = mate_desktop_item_get_localestring_lang
+		(ditem, MATE_DESKTOP_ITEM_NAME,
+		 "cs_CZ");
+	g_print ("NAME(lang=cs_CZ): |%s|\n", text);
+
+	text = mate_desktop_item_get_localestring_lang
+		(ditem, MATE_DESKTOP_ITEM_NAME,
+		 "de");
+	g_print ("NAME(lang=de): |%s|\n", text);
+
+	text = mate_desktop_item_get_localestring_lang
+		(ditem, MATE_DESKTOP_ITEM_NAME,
+		 NULL);
+	g_print ("NAME(lang=null): |%s|\n", text);
+
+	text = mate_desktop_item_get_localestring
+		(ditem, MATE_DESKTOP_ITEM_COMMENT);
+	g_print ("COMMENT: |%s|\n", text);
+
+	g_print ("Setting Name[de]=Neu gestzt! (I have no idea what that means)\n");
+	mate_desktop_item_set_localestring
+		(ditem,
+		 MATE_DESKTOP_ITEM_NAME,
+		 "Neu gesetzt!");
+
+	getcwd (path, 255 - strlen ("/foo.desktop"));
+	g_strlcat (path, "/foo.desktop", sizeof (path));
+
+	g_print ("Saving to foo.desktop\n");
+	uri = g_filename_to_uri (path, NULL, NULL);
+	g_print ("URI: %s\n", uri);
+	mate_desktop_item_save (ditem, uri, FALSE, NULL);
+	g_free (uri);
+}
+
+static void
+launch_item (const char *file)
+{
+	MateDesktopItem *ditem;
+	GList *file_list = NULL;
+	int ret;
+
+	ditem = mate_desktop_item_new_from_file (file,
+						  MATE_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS,
+						  NULL);
+	if (ditem == NULL) {
+		g_print ("File %s is not an existing ditem\n", file);
+		return;
+
+	}
+
+#if 0
+	file_list = g_list_append (NULL, "file:///bin/sh");
+	file_list = g_list_append (file_list, "foo");
+	file_list = g_list_append (file_list, "bar");
+	file_list = g_list_append (file_list, "http://slashdot.org");
+#endif
+
+	ret = mate_desktop_item_launch (ditem, file_list, 0, NULL);
+	g_print ("launch returned: %d\n", ret);
+}
+
+int
+main (int argc, char **argv)
+{
+	char *file;<--- Variable 'file' can be declared as pointer to const
+	gboolean launch = FALSE;
+
+	if (argc < 2 || argc > 3) {
+		fprintf (stderr, "Usage: test-ditem path [LAUNCH]\n");
+		exit (1);
+	}
+
+	if (argc == 3 &&
+	    strcmp (argv[2], "LAUNCH") == 0)
+		launch = TRUE;
+
+	file = g_strdup (argv[1]);
+
+	gtk_init (&argc, &argv);
+
+	if (launch)
+		launch_item (file);
+	else
+		test_ditem (file);
+
+	/*
+	test_ditem_edit (file);
+	*/
+
+	return 0;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/97.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/97.html new file mode 100644 index 00000000..81139ed3 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/97.html @@ -0,0 +1,413 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
/* vi: set sw=4 ts=4 wrap ai: */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * */
+
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <locale.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#define MATE_DESKTOP_USE_UNSTABLE_API
+#include "mate-languages.h"
+
+void test_one_locale(const gchar *locale);
+void test_locales(void);
+
+void test_one_locale(const gchar *locale)
+{
+    char *lang, *country, *norm_locale;
+    char *language_code, *country_code, *codeset, *modifier;
+
+    lang = mate_get_language_from_locale (locale, locale);
+    country = mate_get_country_from_locale (locale, locale);
+    norm_locale = mate_normalize_locale (locale);
+
+    printf("Current locale: %s\n", locale);
+    printf("[locale]:\t\tlang=%s, country=%s, locale=%s\n", lang, country, norm_locale);
+    g_free(lang);
+    g_free(country);
+    g_free(norm_locale);
+
+    if (mate_parse_locale (locale, &language_code, &country_code, &codeset, &modifier)) {
+        lang = mate_get_language_from_code (language_code, locale);
+        country = mate_get_country_from_code (country_code, locale);
+        if (mate_language_has_translations(language_code)) {
+            printf("[mate_parse_locale]:\tlang_code=%s, country_code=%s, code=%s, modifier=%s\n"
+                    "[code]:\t\t\tlang=%s, country=%s, Has translation\n",
+                    language_code, country_code, codeset, modifier,
+                    lang, country);
+        } else {
+            printf("[mate_parse_locale]:\tlang_code=%s, country_code=%s, code=%s, modifier=%s\n"
+                    "[code]:\t\t\tlang=%s, country=%s\n",
+                    language_code, country_code, codeset, modifier,
+                    lang, country);
+        }
+        g_free(lang);
+        g_free(country);
+    }
+    putchar('\n');
+
+    g_free(language_code);
+    g_free(country_code);
+    g_free(codeset);
+    g_free(modifier);
+}
+
+void test_locales(void)
+{
+    char **all;
+    guint i, len;
+
+    all= mate_get_all_locales ();
+    len = g_strv_length (all);
+
+    for (i =0; i < len; i++) {
+        test_one_locale(all[i]);
+    }
+    g_strfreev(all);
+}
+
+int main(int argc, char **argv)
+{
+    if (argc == 2) {
+        test_one_locale(argv[1]);
+    } else {
+        test_locales();
+    }
+    return 0;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/98.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/98.html new file mode 100644 index 00000000..e9a22d51 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/98.html @@ -0,0 +1,353 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
/*
+ * test.c: general tests for libmate-desktop
+ *
+ * Copyright (C) 2013-2014 Stefano Karapetsas
+ * Copyright (C) 2013-2021 MATE Developers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors:
+ *  Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "mate-desktop.h"
+#include "mate-colorbutton.h"
+
+int
+main (int argc, char **argv)
+{
+    GtkWindow *window = NULL;
+    GtkWidget *widget = NULL;
+
+    /* initialize GTK+ */
+    gtk_init (&argc, &argv);
+
+    /* create window */
+    window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
+
+    gtk_window_set_title (window, "MATE Desktop Test");
+
+    /* create a MateColorButton */
+    widget = mate_color_button_new ();
+
+    /* add MateColorButton to window */
+    gtk_container_add (GTK_CONTAINER (window), widget);
+
+    /* quit signal */
+    g_signal_connect (GTK_WIDGET (window), "destroy", gtk_main_quit, NULL);
+
+    gtk_widget_show_all (GTK_WIDGET (window));
+
+    /* start application */
+    gtk_main ();
+    return 0;
+}
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/99.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/99.html new file mode 100644 index 00000000..f36ea725 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/99.html @@ -0,0 +1,327 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
/*
+ * mate-desktop.h: general functions for libmate-desktop
+ *
+ * Copyright (C) 2013 Stefano Karapetsas
+ * Copyright (C) 2013-2021 MATE Developers
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * Authors:
+ *  Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifndef __MATE_DESKTOP_H__
+#define __MATE_DESKTOP_H__
+
+#ifdef HAVE_CONFIG_H
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define MATE_DESKTOP_CHECK_VERSION(major,minor,micro) \
+        (MATE_MAJOR > (major) || \
+        (MATE_MAJOR == (major) && MATE_MINOR > (minor)) || \
+        (MATE_MAJOR == (major) && MATE_MINOR == (minor) && \
+        MATE_MICRO >= (micro)))
+
+G_END_DECLS
+
+#endif /* __MATE_DESKTOP_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/index.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/index.html new file mode 100644 index 00000000..3d9c82e7 --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/index.html @@ -0,0 +1,1323 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineIdCWESeverityMessage
checkersReportinformationActive checkers: There was critical errors (use --checkers-report=<filename> to see details)
accessx-status/src/accessx-status-resources.c
1missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
accessx-status/src/applet.c
20missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
22missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <gio/gdesktopappinfo.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <gdk/gdkkeysyms.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <X11/XKBlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <X11/keysymdef.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
60unusedStructMember563stylestruct member 'ModifierStruct::icon_name' is never used.
164variableScope398styleThe scope of the variable 'launch_context' can be reduced.
271nullPointerRedundantCheck476warningEither the condition 'sapplet' is redundant or there is possible null pointer dereference: sapplet.
525variableScope398styleThe scope of the variable 'window' can be reduced.
729constParameterPointer398styleParameter 'event' can be declared as pointer to const
731variableScope398styleThe scope of the variable 'button_pixbuf' can be reduced.
819variableScope398styleThe scope of the variable 'icon_theme' can be reduced.
1166variableScope398styleThe scope of the variable 'sapplet' can be reduced.
1530constParameterCallback398styleParameter 'event' can be declared as pointer to const. However it seems that 'button_press_cb' is a callback function, if 'event' is declared with const you might also need to cast function pointer(s).
1543constParameterCallback398styleParameter 'event' can be declared as pointer to const. However it seems that 'key_press_cb' is a callback function, if 'event' is declared with const you might also need to cast function pointer(s).
accessx-status/src/applet.h
23missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
battstat/acpi-freebsd.c
27missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <sys/sysctl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <sys/ioctl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <machine/apm_bios.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
37missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <errno.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
39missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
40missingIncludeSysteminformationInclude file: <fcntl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
41missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
47missingIncludeSysteminformationInclude file: <dev/acpica/acpiio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
162legacyUninitvar457errorUninitialized variable: remain
163legacyUninitvar457errorUninitialized variable: rate
battstat/acpi-linux.c
27missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <apm.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
37missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <sys/stat.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
39missingIncludeSysteminformationInclude file: <sys/socket.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
40missingIncludeSysteminformationInclude file: <sys/un.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
41missingIncludeSysteminformationInclude file: <fcntl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
42missingIncludeSysteminformationInclude file: <errno.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
43missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
44missingIncludeSysteminformationInclude file: <dirent.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
126constVariablePointer398styleVariable 's' can be declared as pointer to const
138constVariablePointer398styleVariable 's' can be declared as pointer to const
battstat/apmlib/apm.h
26missingIncludeSysteminformationInclude file: <linux/apm_bios.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
battstat/apmlib/apmlib.c
21missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
22missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <fcntl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <ctype.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <sys/stat.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <sys/time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <sys/ioctl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <sys/sysmacros.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
72invalidscanf119warningsscanf() without field width limits can crash with huge input data.
218variableScope398styleThe scope of the variable 'fd' can be reduced.
354syntaxErrorerrorUnmatched ')'. Configuration: 'APM_IOC_REJECT'.
battstat/battstat-preferences.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <sys/file.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <sys/ioctl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <sys/sysctl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <err.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
39missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
40missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
41missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
43missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
45missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
162variableScope398styleThe scope of the variable 'self' can be reduced.
battstat/battstat-preferences.h
25missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
battstat/battstat-resources.c
1missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
battstat/battstat-upower.c
24missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <upower.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <math.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
battstat/battstat.h
24missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <mate-panel-applet-gsettings.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
battstat/battstat_applet.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <sys/wait.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <err.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
40missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
41missingIncludeSysteminformationInclude file: <mate-panel-applet-gsettings.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
44missingIncludeSysteminformationInclude file: <libnotify/notify.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
490variableScope398styleThe scope of the variable 'powerstring' can be reduced.
491variableScope398styleThe scope of the variable 'remaining' can be reduced.
904constParameterCallback398styleParameter 'allocation' can be declared as pointer to const. However it seems that 'size_allocate' is a callback function, if 'allocation' is declared with const you might also need to cast function pointer(s).
battstat/power-management.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <sys/file.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <sys/ioctl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <sys/stat.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <sys/sysctl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <err.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
37missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
39missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
40missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
91missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
175missingIncludeSysteminformationInclude file: <machine/apm_bios.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
188variableScope398styleThe scope of the variable 'fd' can be reduced.
235missingIncludeSysteminformationInclude file: <sys/param.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
237missingIncludeSysteminformationInclude file: <dev/apm/apmio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
284missingIncludeSysteminformationInclude file: <apm.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
charpick/charpick-resources.c
1missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
charpick/charpick.c
5missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
6missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
7missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
8missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9missingIncludeSysteminformationInclude file: <mate-panel-applet-gsettings.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
11missingIncludeSysteminformationInclude file: <gucharmap/gucharmap.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
153variableScope398styleThe scope of the variable 'curr_data' can be reduced.
298variableScope398styleThe scope of the variable 'menuitem' can be reduced.
574constParameterCallback398styleParameter 'allocation' can be declared as pointer to const. However it seems that 'applet_size_allocate' is a callback function, if 'allocation' is declared with const you might also need to cast function pointer(s).
charpick/charpick.h
6missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
7missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
8missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
10missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
11missingIncludeSysteminformationInclude file: <mate-panel-applet-gsettings.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
charpick/properties.c
6missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
11missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
13missingIncludeSysteminformationInclude file: <atk/atkrelation.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
14missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
250variableScope398styleThe scope of the variable 'selection' can be reduced.
command/src/command-resources.c
1missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
command/src/command.c
25missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gmodule.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <mate-panel-applet-gsettings.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
261duplicateConditionalAssign398styleThe statement 'if (command_applet->width!=width) command_applet->width=width' is logically equivalent to 'command_applet->width=width'.
command/src/ma-command.c
18missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
56unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_CODE is a macro then please configure it.
command/src/ma-command.h
21missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
22missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-applet.c
23missingIncludeinformationInclude file: "config.h" not found.
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gdk/gdkkeysyms.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <mate-panel-applet-gsettings.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
127unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
cpufreq/src/cpufreq-applet.h
25missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-monitor-cpuinfo.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
37unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
cpufreq/src/cpufreq-monitor-cpuinfo.h
25missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-monitor-factory.c
23missingIncludeinformationInclude file: "config.h" not found.
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-monitor-libcpufreq.c
23missingIncludeinformationInclude file: "config.h" not found.
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <cpufreq.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
cpufreq/src/cpufreq-monitor-libcpufreq.h
25missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-monitor-sysfs.c
22missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
67unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
cpufreq/src/cpufreq-monitor-sysfs.h
25missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-monitor.c
68unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE is a macro then please configure it.
cpufreq/src/cpufreq-monitor.h
25missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-popup.c
22missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
53unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
cpufreq/src/cpufreq-popup.h
25missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-prefs.c
23missingIncludeinformationInclude file: "config.h" not found.
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
71unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
cpufreq/src/cpufreq-prefs.h
25missingIncludeSysteminformationInclude file: <gdk/gdk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-resources.c
1missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
cpufreq/src/cpufreq-selector.c
20missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
21missingIncludeSysteminformationInclude file: <sys/sysinfo.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
42unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
cpufreq/src/cpufreq-selector.h
23missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-selector/cpufreq-selector-factory.c
21missingIncludeinformationInclude file: "config.h" not found.
cpufreq/src/cpufreq-selector/cpufreq-selector-libcpufreq.c
23missingIncludeinformationInclude file: "config.h" not found.
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib/gstdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <cpufreq.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <linux/version.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
44unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
cpufreq/src/cpufreq-selector/cpufreq-selector-libcpufreq.h
25missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-selector/cpufreq-selector-service-glue.h
4missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
156missingIncludeSysteminformationInclude file: <dbus/dbus-glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-selector/cpufreq-selector-service.c
20missingIncludeSysteminformationInclude file: <polkit/polkit.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
21missingIncludeSysteminformationInclude file: <dbus/dbus-glib-lowlevel.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
47unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
cpufreq/src/cpufreq-selector/cpufreq-selector-service.h
23missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <dbus/dbus-glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-selector/cpufreq-selector-sysfs.c
22missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <glib/gstdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <errno.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
49unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
cpufreq/src/cpufreq-selector/cpufreq-selector-sysfs.h
25missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-selector/cpufreq-selector.c
22missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
46unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE is a macro then please configure it.
cpufreq/src/cpufreq-selector/cpufreq-selector.h
25missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-selector/main.c
23missingIncludeinformationInclude file: "config.h" not found.
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-utils.c
22missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <sys/stat.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <fcntl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <errno.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
cpufreq/src/cpufreq-utils.h
25missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
drivemount/src/drive-button.c
25missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <gdk/gdkkeysyms.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <gio/gdesktopappinfo.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <libmate-desktop/mate-image-menu-item.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
46unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
drivemount/src/drive-button.h
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
drivemount/src/drive-list.c
25missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
drivemount/src/drive-list.h
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
drivemount/src/drivemount-resources.c
1missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
drivemount/src/drivemount.c
24missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
60constParameterCallback398styleParameter 'allocation' can be declared as pointer to const. However it seems that 'size_allocate' is a callback function, if 'allocation' is declared with const you might also need to cast function pointer(s).
geyes/src/geyes-resources.c
1missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
geyes/src/geyes.c
20missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
21missingIncludeSysteminformationInclude file: <math.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
22missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <mate-panel-applet-gsettings.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
geyes/src/geyes.h
21missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
22missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <gdk-pixbuf/gdk-pixbuf.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
geyes/src/themes.c
19missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
20missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
21missingIncludeSysteminformationInclude file: <ctype.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
22missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
58variableScope398styleThe scope of the variable 'token' can be reduced.
81redundantAssignment563styleVariable 'token' is reassigned a value before the old one has been used.
88redundantAssignment563styleVariable 'token' is reassigned a value before the old one has been used.
103variableScope398styleThe scope of the variable 'dialog' can be reduced.
266variableScope398styleThe scope of the variable 'dfd' can be reduced.
mate-desktop-1.27.1/libmate-desktop/display-name.c
25missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <glib/gi18n-lib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <math.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
196variableScope398styleThe scope of the variable 'code' can be reduced.
196variableScope398styleThe scope of the variable 'name' can be reduced.
mate-desktop-1.27.1/libmate-desktop/edid-parse.c
26missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <math.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/mate-bg-crossfade.c
22missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <math.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <stdarg.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gdk/gdk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <X11/Xlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <X11/Xatom.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <cairo.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <cairo-xlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <mate-bg.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
69unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
mate-desktop-1.27.1/libmate-desktop/mate-bg-crossfade.h
32missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <gdk/gdk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/mate-bg.c
33missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <math.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <stdarg.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <glib/gstdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
39missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
41missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
42missingIncludeSysteminformationInclude file: <X11/Xlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
43missingIncludeSysteminformationInclude file: <X11/Xatom.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
45missingIncludeSysteminformationInclude file: <cairo.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
48missingIncludeSysteminformationInclude file: <mate-bg.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
49missingIncludeSysteminformationInclude file: <mate-bg-crossfade.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
51missingIncludeSysteminformationInclude file: <cairo-xlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
122unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
mate-desktop-1.27.1/libmate-desktop/mate-colorbutton.c
31missingIncludeinformationInclude file: "config.h" not found.
37missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <gdk/gdkkeysyms.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
39missingIncludeSysteminformationInclude file: <gdk-pixbuf/gdk-pixbuf.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
40missingIncludeSysteminformationInclude file: <glib/gi18n-lib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
120unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
mate-desktop-1.27.1/libmate-desktop/mate-colorbutton.h
35missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/mate-colorsel.c
28missingIncludeinformationInclude file: "config.h" not found.
30missingIncludeSysteminformationInclude file: <math.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <gdk/gdkkeysyms.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <glib/gi18n-lib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
243unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
mate-desktop-1.27.1/libmate-desktop/mate-colorsel.h
31missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/mate-colorseldialog.c
26missingIncludeinformationInclude file: "config.h" not found.
28missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <glib/gi18n-lib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
52unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_CODE is a macro then please configure it.
mate-desktop-1.27.1/libmate-desktop/mate-colorseldialog.h
30missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/mate-dconf.c
29missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <dconf.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/mate-dconf.h
31missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/mate-desktop-item.c
30missingIncludeinformationInclude file: "config.h" not found.
32missingIncludeSysteminformationInclude file: <limits.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <ctype.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
37missingIncludeSysteminformationInclude file: <dirent.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
39missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
40missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
41missingIncludeSysteminformationInclude file: <glib/gi18n-lib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
42missingIncludeSysteminformationInclude file: <locale.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
43missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
45missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
49missingIncludeSysteminformationInclude file: <libsn/sn.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
50missingIncludeSysteminformationInclude file: <gdk/gdk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
51missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
52missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
57missingIncludeSysteminformationInclude file: <mate-desktop-item.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
58missingIncludeSysteminformationInclude file: <mate-desktop-utils.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
916constVariablePointer398styleVariable 'li' can be declared as pointer to const
945constVariablePointer398styleVariable 'p' can be declared as pointer to const
2328variableScope398styleThe scope of the variable 'exec' can be reduced.
2834constVariablePointer398styleVariable 'l' can be declared as pointer to const
3146variableScope398styleThe scope of the variable 's' can be reduced.
3165varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3167varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3168varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3169varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3171varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3173varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3175varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3176varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3178varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3179varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3180varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3181varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3182varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3183varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3184varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3185varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3186varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3187varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3188varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3189varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3191varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3193varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3195varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
3412constVariablePointer398styleVariable 'brace' can be declared as pointer to const
3487constParameterPointer398styleParameter 'item' can be declared as pointer to const
mate-desktop-1.27.1/libmate-desktop/mate-desktop-thumbnail.c
27missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <glib/gstdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <gdk-pixbuf/gdk-pixbuf.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
62unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
mate-desktop-1.27.1/libmate-desktop/mate-desktop-thumbnail.h
33missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <gdk-pixbuf/gdk-pixbuf.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/mate-desktop-utils.c
27missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <glib/gi18n-lib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <gdk/gdk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <mate-desktop-utils.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
139multiCondition398styleExpression is always true because 'else if' condition is opposite to previous condition at line 133.
243constParameterPointer398styleParameter 'a' can be declared as pointer to const
mate-desktop-1.27.1/libmate-desktop/mate-desktop.h
30missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/mate-gsettings.h
29missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/mate-hsv.c
34missingIncludeinformationInclude file: "config.h" not found.
39missingIncludeSysteminformationInclude file: <math.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
40missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
42missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
128unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
mate-desktop-1.27.1/libmate-desktop/mate-hsv.h
36missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/mate-image-menu-item.c
18missingIncludeinformationInclude file: "config.h" not found.
19missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
20missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
21missingIncludeSysteminformationInclude file: <glib/gstdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
37unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
mate-desktop-1.27.1/libmate-desktop/mate-image-menu-item.h
21missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/mate-languages.c
23missingIncludeinformationInclude file: "config.h" not found.
25missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <errno.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <dirent.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <locale.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <langinfo.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <sys/stat.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
37missingIncludeSysteminformationInclude file: <glib/gstdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
42missingIncludeSysteminformationInclude file: <langinfo.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
401constVariablePointer398styleVariable 'old_locale' can be declared as pointer to const
534variableScope398styleThe scope of the variable 'linep' can be reduced.
587constVariablePointer398styleVariable 'locale' can be declared as pointer to const
mate-desktop-1.27.1/libmate-desktop/mate-languages.h
30missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/mate-rr-config.c
29missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <glib/gi18n-lib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <glib/gstdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <X11/Xlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
37missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
94unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
mate-desktop-1.27.1/libmate-desktop/mate-rr-config.h
34missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/mate-rr-labeler.c
30missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <glib/gi18n-lib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <X11/Xproto.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <X11/Xlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <X11/Xutil.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
37missingIncludeSysteminformationInclude file: <X11/Xatom.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
110constVariablePointer398styleVariable 'workareas' can be declared as pointer to const
170constVariablePointer398styleVariable 'xev' can be declared as pointer to const
mate-desktop-1.27.1/libmate-desktop/mate-rr-output-info.c
26missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
mate-desktop-1.27.1/libmate-desktop/mate-rr-private.h
4missingIncludeSysteminformationInclude file: <X11/Xlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
7missingIncludeSysteminformationInclude file: <X11/extensions/Xrandr.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/mate-rr.c
27missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <glib/gi18n-lib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <X11/Xlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <X11/extensions/Xrandr.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
37missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <X11/Xatom.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
168unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_CODE is a macro then please configure it.
mate-desktop-1.27.1/libmate-desktop/mate-rr.h
31missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <gdk/gdk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/private.h
28missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/test-desktop-thumbnail.c
27missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/test-ditem.c
19missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
20missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
21missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <mate-desktop-item.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <locale.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
132constVariablePointer398styleVariable 'file' can be declared as pointer to const
mate-desktop-1.27.1/libmate-desktop/test-languages.c
18missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
19missingIncludeSysteminformationInclude file: <locale.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/libmate-desktop/test.c
26missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/mate-about/mate-about.h
25missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mate-desktop-1.27.1/tools/mate-color-select.c
26missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <libmate-desktop/mate-colorseldialog.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <libmate-desktop/mate-colorsel.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mateweather/src/main.c
13missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
14missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
15missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
16missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
17missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
18missingIncludeSysteminformationInclude file: <mate-panel-applet-gsettings.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
22missingIncludeSysteminformationInclude file: <libmateweather/mateweather-prefs.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mateweather/src/mateweather-about.c
14missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
17missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
18missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
19missingIncludeSysteminformationInclude file: <assert.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mateweather/src/mateweather-applet.c
14missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
17missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
18missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
19missingIncludeSysteminformationInclude file: <assert.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
20missingIncludeSysteminformationInclude file: <netinet/in.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
21missingIncludeSysteminformationInclude file: <arpa/nameser.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
22missingIncludeSysteminformationInclude file: <resolv.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <mate-panel-applet-gsettings.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gdk/gdkkeysyms.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <libnotify/notify.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
232constParameterCallback398styleParameter 'ev' can be declared as pointer to const. However it seems that 'clicked_cb' is a callback function, if 'ev' is declared with const you might also need to cast function pointer(s).
234variableScope398styleThe scope of the variable 'gw_applet' can be reduced.
252constParameterCallback398styleParameter 'event' can be declared as pointer to const. However it seems that 'key_press_cb' is a callback function, if 'event' is declared with const you might also need to cast function pointer(s).
463variableScope398styleThe scope of the variable 'n' can be reduced.
mateweather/src/mateweather-dialog.c
14missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
17missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
18missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
19missingIncludeSysteminformationInclude file: <assert.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
21missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
186variableScope398styleThe scope of the variable 'buffer' can be reduced.
187variableScope398styleThe scope of the variable 'font_desc' can be reduced.
mateweather/src/mateweather-dialog.h
16missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mateweather/src/mateweather-pref.c
17missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
20missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
21missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
22missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <assert.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <ctype.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <locale.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <libmateweather/mateweather-xml.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
672variableScope398styleThe scope of the variable 'path' can be reduced.
728variableScope398styleThe scope of the variable 'path' can be reduced.
mateweather/src/mateweather-pref.h
16missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
mateweather/src/mateweather-resources.c
1missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
mateweather/src/mateweather.h
13missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
15missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
17missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
19missingIncludeSysteminformationInclude file: <libmateweather/mateweather-prefs.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
multiload/src/autoscaler.c
1missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
multiload/src/autoscaler.h
4missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
multiload/src/global.h
4missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
5missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
6missingIncludeSysteminformationInclude file: <gdk-pixbuf/gdk-pixbuf.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
7missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
8missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
multiload/src/linux-proc.c
2missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
3missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
4missingIncludeSysteminformationInclude file: <sys/statvfs.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
5missingIncludeSysteminformationInclude file: <fcntl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
6missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
8missingIncludeSysteminformationInclude file: <glibtop.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9missingIncludeSysteminformationInclude file: <glibtop/cpu.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
10missingIncludeSysteminformationInclude file: <glibtop/mem.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
11missingIncludeSysteminformationInclude file: <glibtop/swap.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
12missingIncludeSysteminformationInclude file: <glibtop/loadavg.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
13missingIncludeSysteminformationInclude file: <glibtop/netload.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
14missingIncludeSysteminformationInclude file: <glibtop/netlist.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
15missingIncludeSysteminformationInclude file: <glibtop/mountlist.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
16missingIncludeSysteminformationInclude file: <glibtop/fsusage.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
316constParameterPointer398styleParameter 'device' can be declared as pointer to const
multiload/src/linux-proc.h
4missingIncludeSysteminformationInclude file: <load-graph.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
multiload/src/load-graph.c
1missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
2missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
3missingIncludeSysteminformationInclude file: <sys/stat.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
4missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
5missingIncludeSysteminformationInclude file: <signal.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
6missingIncludeSysteminformationInclude file: <dirent.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
7missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
8missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
10missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
11missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
12missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
13missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
14missingIncludeSysteminformationInclude file: <mate-panel-applet-gsettings.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
15missingIncludeSysteminformationInclude file: <math.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
81variableScope398styleThe scope of the variable 'spacing' can be reduced.
197variableScope398styleThe scope of the variable 'spacing' can be reduced.
391variableScope398styleThe scope of the variable 'name' can be reduced.
391variableScope398styleThe scope of the variable 'temp' can be reduced.
multiload/src/main.c
12missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
13missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
14missingIncludeSysteminformationInclude file: <sys/stat.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
15missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
16missingIncludeSysteminformationInclude file: <signal.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
17missingIncludeSysteminformationInclude file: <dirent.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
18missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
19missingIncludeSysteminformationInclude file: <time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
21missingIncludeSysteminformationInclude file: <glibtop.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
22missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <gdk/gdkkeysyms.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <gdk-pixbuf/gdk-pixbuf.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <gio/gdesktopappinfo.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <mate-panel-applet-gsettings.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
100variableScope398styleThe scope of the variable 'launch_context' can be reduced.
102variableScope398styleThe scope of the variable 'app_info' can be reduced.
226constParameterCallback398styleParameter 'event' can be declared as pointer to const. However it seems that 'multiload_button_press_event_cb' is a callback function, if 'event' is declared with const you might also need to cast function pointer(s).
239constParameterCallback398styleParameter 'event' can be declared as pointer to const. However it seems that 'multiload_key_press_event_cb' is a callback function, if 'event' is declared with const you might also need to cast function pointer(s).
multiload/src/multiload-resources.c
1missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
multiload/src/netspeed.c
1missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
2missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
multiload/src/netspeed.h
4missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
multiload/src/properties.c
11missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
14missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
16missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
18missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
19missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
20missingIncludeSysteminformationInclude file: <mate-panel-applet-gsettings.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
netspeed/src/backend.c
23missingIncludeinformationInclude file: "config.h" not found.
27missingIncludeSysteminformationInclude file: <sys/sockio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <sys/socket.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <ifaddrs.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <netinet/in.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <arpa/inet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
37missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <glibtop/netlist.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
39missingIncludeSysteminformationInclude file: <glibtop/netload.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
44missingIncludeSysteminformationInclude file: <iwlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
49missingIncludeSysteminformationInclude file: <errno.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
50missingIncludeSysteminformationInclude file: <linux/netlink.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
51missingIncludeSysteminformationInclude file: <netlink/genl/genl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
52missingIncludeSysteminformationInclude file: <netlink/genl/family.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
53missingIncludeSysteminformationInclude file: <netlink/genl/ctrl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
54missingIncludeSysteminformationInclude file: <netlink/attr.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
55missingIncludeSysteminformationInclude file: <netlink/msg.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
139variableScope398styleThe scope of the variable 'ip6_netmask' can be reduced.
139unreadVariable563styleVariable 'ip6_netmask' is assigned a value that is never used.
259constVariablePointer398styleVariable 'rv' can be declared as pointer to const
337clarifyCalculation783styleClarify calculation precedence for '&' and '?'.
338clarifyCalculation783styleClarify calculation precedence for '&' and '?'.
452duplicateConditionalAssign398styleThe statement 'if (devinfo->qual!=newqual) devinfo->qual=newqual' is logically equivalent to 'devinfo->qual=newqual'.
662unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_GUINT32_FORMAT is a macro then please configure it.
netspeed/src/backend.h
23missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <ctype.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <sys/socket.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <netinet/in.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <arpa/inet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <net/if.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <sys/ioctl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <glibtop/netload.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
netspeed/src/netspeed-preferences.c
19missingIncludeinformationInclude file: "config.h" not found.
22missingIncludeSysteminformationInclude file: <glib/gi18n-lib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
netspeed/src/netspeed-preferences.h
21missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
netspeed/src/netspeed-resources.c
1missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
netspeed/src/netspeed.c
23missingIncludeinformationInclude file: "config.h" not found.
26missingIncludeSysteminformationInclude file: <math.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <mate-panel-applet-gsettings.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
netspeed/src/netspeed.h
22missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DECLARE_FINAL_TYPE is a macro then please configure it.
netspeed/src/nl80211.h
43missingIncludeSysteminformationInclude file: <linux/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
stickynotes/sticky-notes-resources.c
1missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
stickynotes/stickynotes.c
20missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
21missingIncludeSysteminformationInclude file: <libxml/parser.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
22missingIncludeSysteminformationInclude file: <X11/Xatom.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <libwnck/libwnck.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <sys/stat.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
stickynotes/stickynotes.h
24missingIncludeSysteminformationInclude file: <libwnck/libwnck.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <stickynotes_applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gtksourceview/gtksource.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
stickynotes/stickynotes_applet.c
20missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
21missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
87unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If PANEL_APPLET_FACTORY is a macro then please configure it.
stickynotes/stickynotes_applet.h
23missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <gdk/gdk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
stickynotes/stickynotes_applet_callbacks.c
20missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
21missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <gdk/gdkkeysyms.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <X11/Xatom.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38variableScope398styleThe scope of the variable 'note' can be reduced.
63constParameterPointer398styleParameter 'event' can be declared as pointer to const
81constParameterPointer398styleParameter 'event' can be declared as pointer to const
98constParameterPointer398styleParameter 'event' can be declared as pointer to const
245constParameterPointer398styleParameter 'allocation' can be declared as pointer to const
stickynotes/stickynotes_applet_callbacks.h
23missingIncludeSysteminformationInclude file: <stickynotes_applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
stickynotes/stickynotes_callbacks.c
20missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
21missingIncludeSysteminformationInclude file: <stickynotes_callbacks.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
44constParameterPointer398styleParameter 'widget' can be declared as pointer to const
91constParameterPointer398styleParameter 'event' can be declared as pointer to const
stickynotes/stickynotes_callbacks.h
23missingIncludeSysteminformationInclude file: <stickynotes.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
stickynotes/util.c
20missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <X11/Xlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <X11/Xatom.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <gdk/gdk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
86uninitvar457errorUninitialized variable: num
stickynotes/util.h
23missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
timerapplet/src/timerapplet-resources.c
1missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
timerapplet/src/timerapplet.c
25missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <libnotify/notify.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <mate-panel-applet-gsettings.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
357constParameterCallback398styleParameter 'event' can be declared as pointer to const. However it seems that 'timer_applet_click' is a callback function, if 'event' is declared with const you might also need to cast function pointer(s).
trashapplet/src/trash-empty.c
22missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeinformationInclude file: "config.h" not found.
151variableScope398styleThe scope of the variable 'info' can be reduced.
152variableScope398styleThe scope of the variable 'child' can be reduced.
trashapplet/src/trash-empty.h
25missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
trashapplet/src/trashapplet-resources.c
1missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
trashapplet/src/trashapplet.c
25missingIncludeinformationInclude file: "config.h" not found.
28missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <gdk/gdkkeysyms.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <mate-panel-applet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/stats.html b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/stats.html new file mode 100644 index 00000000..4f0d53df --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/stats.html @@ -0,0 +1,207 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+

Top 10 files for error severity, total findings: 32
+   2  battstat/acpi-freebsd.c
+   1  stickynotes/util.c
+   1  stickynotes/stickynotes_applet.c
+   1  netspeed/src/netspeed.h
+   1  netspeed/src/backend.c
+   1  mate-desktop-1.27.1/libmate-desktop/mate-rr.c
+   1  mate-desktop-1.27.1/libmate-desktop/mate-rr-output-info.c
+   1  mate-desktop-1.27.1/libmate-desktop/mate-rr-config.c
+   1  mate-desktop-1.27.1/libmate-desktop/mate-image-menu-item.c
+   1  mate-desktop-1.27.1/libmate-desktop/mate-hsv.c
+

+

Top 10 files for warning severity, total findings: 2
+   1  battstat/apmlib/apmlib.c
+   1  accessx-status/src/applet.c
+

+

Top 10 files for portability severity, total findings: 23
+   23  mate-desktop-1.27.1/libmate-desktop/mate-desktop-item.c
+

+

Top 10 files for style severity, total findings: 104
+   9  accessx-status/src/applet.c
+   7  mate-desktop-1.27.1/libmate-desktop/mate-desktop-item.c
+   6  netspeed/src/backend.c
+   5  stickynotes/stickynotes_applet_callbacks.c
+   5  geyes/src/themes.c
+   4  multiload/src/main.c
+   4  multiload/src/load-graph.c
+   4  mateweather/src/mateweather-applet.c
+   3  mate-desktop-1.27.1/libmate-desktop/mate-languages.c
+   3  charpick/charpick.c
+

+

Top 10 files for information severity, total findings: 656
+   20  mate-desktop-1.27.1/libmate-desktop/mate-desktop-item.c
+   19  netspeed/src/backend.c
+   16  multiload/src/main.c
+   16  battstat/power-management.c
+   15  multiload/src/load-graph.c
+   14  multiload/src/linux-proc.c
+   14  mate-desktop-1.27.1/libmate-desktop/mate-languages.c
+   14  battstat/acpi-linux.c
+   13  mate-desktop-1.27.1/libmate-desktop/mate-bg.c
+   13  battstat/battstat_applet.c
+

+ +
+ +
+ + diff --git a/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/style.css b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/style.css new file mode 100644 index 00000000..3897bfaf --- /dev/null +++ b/2024-02-21-232811-4629-cppcheck@c2aa3bc5ee2f_master/style.css @@ -0,0 +1,177 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + height: 100%; + margin: 0; +} + +#wrapper { + position: fixed; + height: 100vh; + width: 100vw; + display: grid; + grid-template-rows: fit-content(8rem) auto fit-content(8rem); + grid-template-columns: fit-content(25%) 1fr; + grid-template-areas: + "header header" + "menu content" + "footer footer"; +} + +h1 { + margin: 0 0 8px -2px; + font-size: 175%; +} + +.header { + padding: 0 0 5px 15px; + grid-area: header; + border-bottom: thin solid #aaa; +} + +.footer { + grid-area: footer; + border-top: thin solid #aaa; + font-size: 85%; + +} + +.footer > p { + margin: 4px; +} + +#menu, +#menu_index { + grid-area: menu; + text-align: left; + overflow: auto; + padding: 0 23px 15px 15px; + border-right: thin solid #aaa; + min-width: 200px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; +} + +#content, +#content_index { + grid-area: content; + padding: 0px 5px 15px 15px; + overflow: auto; +} + +label { + white-space: nowrap; +} + +label.checkBtn.disabled { + color: #606060; + background: #e0e0e0; + font-style: italic; +} + +label.checkBtn, input[type="text"] { + border: 1px solid grey; + border-radius: 4px; + box-shadow: 1px 1px inset; + padding: 1px 5px; +} + +label.checkBtn { + white-space: nowrap; + background: #ccddff; +} + +label.unchecked { + background: #eff8ff; + box-shadow: 1px 1px 1px; +} + +label.checkBtn:hover, label.unchecked:hover{ + box-shadow: 0 0 2px; +} + +label.disabled:hover { + box-shadow: 1px 1px inset; +} + +label.checkBtn > input { + display:none; +} + +.summaryTable { + width: 100%; +} + +table.summaryTable td { padding: 0 5px 0 5px; } + +.statHeader, .severityHeader { + font-weight: bold; +} + +.warning { + background-color: #ffffa7; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.id-filtered, .severity-filtered, .file-filtered, .tool-filtered, .text-filtered { + visibility: collapse; +} -- cgit v1.2.1