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 | 697 ++++ .../1.html | 3699 ++++++++++++++++++++ .../10.html | 1415 ++++++++ .../11.html | 825 +++++ .../12.html | 1271 +++++++ .../13.html | 1071 ++++++ .../14.html | 1989 +++++++++++ .../18.html | 1027 ++++++ .../19.html | 1249 +++++++ .../2.html | 707 ++++ .../21.html | 877 +++++ .../22.html | 887 +++++ .../24.html | 1209 +++++++ .../27.html | 2209 ++++++++++++ .../28.html | 693 ++++ .../29.html | 849 +++++ .../3.html | 1241 +++++++ .../30.html | 963 +++++ .../31.html | 1369 ++++++++ .../32.html | 1009 ++++++ .../33.html | 2797 +++++++++++++++ .../34.html | 935 +++++ .../35.html | 1311 +++++++ .../36.html | 1429 ++++++++ .../37.html | 1175 +++++++ .../38.html | 1997 +++++++++++ .../39.html | 307 ++ .../4.html | 925 +++++ .../40.html | 1127 ++++++ .../41.html | 1481 ++++++++ .../42.html | 1569 +++++++++ .../43.html | 1583 +++++++++ .../44.html | 779 +++++ .../45.html | 503 +++ .../46.html | 827 +++++ .../47.html | 991 ++++++ .../48.html | 817 +++++ .../49.html | 1561 +++++++++ .../5.html | 907 +++++ .../6.html | 2699 ++++++++++++++ .../7.html | 1317 +++++++ .../8.html | 695 ++++ .../9.html | 2013 +++++++++++ .../index.html | 429 +++ .../stats.html | 195 ++ .../style.css | 177 + 46 files changed, 55802 insertions(+) create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/0.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/1.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/10.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/11.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/12.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/13.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/14.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/18.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/19.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/2.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/21.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/22.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/24.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/27.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/28.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/29.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/3.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/30.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/31.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/32.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/33.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/34.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/35.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/36.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/37.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/38.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/39.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/4.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/40.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/41.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/42.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/43.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/44.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/45.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/46.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/47.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/48.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/49.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/5.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/6.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/7.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/8.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/9.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/index.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/stats.html create mode 100644 2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/style.css (limited to '2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master') diff --git a/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/0.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/0.html new file mode 100644 index 00000000..9b96b48b --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/0.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>
+
+#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) { _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) { 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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/1.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/1.html new file mode 100644 index 00000000..82d8fef3 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/1.html @@ -0,0 +1,3699 @@ + + + + + + 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 <stdlib.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include <gio/gio.h>
+#include <gio/gdesktopappinfo.h>
+#include <gdk/gdkkeysyms.h>
+#include <gdk/gdkx.h>
+#include <mate-panel-applet.h>
+#include <X11/XKBlib.h>
+
+#define XK_MISCELLANY
+#define XK_XKB_KEYS
+
+#include <X11/keysymdef.h>
+#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)
+{
+    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,
+                 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,
+              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),
+                      sapplet);
+
+    g_signal_connect (sapplet->applet, "key-press-event",
+                      G_CALLBACK (key_press_cb),
+                      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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/10.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/10.html new file mode 100644 index 00000000..dfdfeb24 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/10.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>
+#endif
+
+#include "charpick.h"
+
+#include <string.h>
+
+#include <atk/atkrelation.h>
+#include <gtk/gtk.h>
+
+#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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/11.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/11.html new file mode 100644 index 00000000..46af3f95 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/11.html @@ -0,0 +1,825 @@ + + + + + + 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
#include <gio/gio.h>
+
+#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) { _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) { 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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/12.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/12.html new file mode 100644 index 00000000..932b0d8c --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/12.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 <glib.h>
+#include <gmodule.h>
+#include <glib/gi18n.h>
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+
+#include <mate-panel-applet.h>
+#include <mate-panel-applet-gsettings.h>
+#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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/13.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/13.html new file mode 100644 index 00000000..46c8d6c1 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/13.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 "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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/14.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/14.html new file mode 100644 index 00000000..d7443819 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/14.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"
+#endif
+
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+#include <gio/gio.h>
+#include <mate-panel-applet.h>
+#include <mate-panel-applet-gsettings.h>
+#include <glib/gi18n.h>
+#include <stdlib.h>
+#include <string.h>
+
+#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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/18.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/18.html new file mode 100644 index 00000000..15a229ac --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/18.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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/19.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/19.html new file mode 100644 index 00000000..62514462 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/19.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 <gtk/gtk.h>
+#include <gdk/gdkx.h>
+#include <stdlib.h>
+#include <string.h>
+
+#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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/2.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/2.html new file mode 100644 index 00000000..6992bc0f --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/2.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>
+#endif
+
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <sys/ioctl.h>
+#include <machine/apm_bios.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <glib.h>
+
+#include "acpi-freebsd.h"
+
+#ifdef HAVE_ACPIIO
+
+#include <dev/acpica/acpiio.h>
+
+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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/21.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/21.html new file mode 100644 index 00000000..6f9cc824 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/21.html @@ -0,0 +1,877 @@ + + + + + + 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
#include <gio/gio.h>
+
+#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) { _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) { 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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/22.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/22.html new file mode 100644 index 00000000..a525174b --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/22.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 <sys/sysinfo.h>
+
+#ifdef HAVE_POLKIT
+#include <gio/gio.h>
+#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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/24.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/24.html new file mode 100644 index 00000000..9f677eaa --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/24.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 <dbus/dbus-glib-lowlevel.h>
+
+#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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/27.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/27.html new file mode 100644 index 00000000..1c171e51 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/27.html @@ -0,0 +1,2209 @@ + + + + + + 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
/* -*- 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>
+#endif
+
+#include <gio/gio.h>
+#include "drive-button.h"
+#include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
+#include <gio/gdesktopappinfo.h>
+
+#include <string.h>
+
+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 = gtk_image_menu_item_new_with_mnemonic (label);
+    if (icon_name) {
+        image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
+        gtk_image_menu_item_set_image (GTK_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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/28.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/28.html new file mode 100644 index 00000000..72c876f3 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/28.html @@ -0,0 +1,693 @@ + + + + + + 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
#include <gio/gio.h>
+
+#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) { _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) { 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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/29.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/29.html new file mode 100644 index 00000000..26572140 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/29.html @@ -0,0 +1,849 @@ + + + + + + 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
#include <gio/gio.h>
+
+#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) { _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) { 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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/3.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/3.html new file mode 100644 index 00000000..76b76b53 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/3.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 <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/sysmacros.h>
+#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)))<--- Skipping configuration 'APM_IOC_LAST_ERROR' since the value of 'APM_IOC_LAST_ERROR' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
+        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" },<--- Skipping configuration 'APM_BAD_FUNCTION' since the value of 'APM_BAD_FUNCTION' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
+#endif
+#ifdef APM_RESUME_DISABLED
+    { APM_RESUME_DISABLED, "Resume timer disabled" },<--- Skipping configuration 'APM_RESUME_DISABLED' since the value of 'APM_RESUME_DISABLED' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
+#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 )) <--- Skipping configuration 'APM_IOC_REJECT' since the value of 'APM_IOC_REJECT' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
+        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);<--- Skipping configuration 'APM_IOC_IGNORE' since the value of 'APM_IOC_IGNORE' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
+    }
+    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:<--- Skipping configuration 'APM_CAPABILITY_CHANGE' since the value of 'APM_CAPABILITY_CHANGE' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
+        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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/30.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/30.html new file mode 100644 index 00000000..1d125571 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/30.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 <string.h>
+#include <ctype.h>
+#include <gtk/gtk.h>
+#include <gio/gio.h>
+#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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/31.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/31.html new file mode 100644 index 00000000..659d5fe5 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/31.html @@ -0,0 +1,1369 @@ + + + + + + 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>
+#endif /* HAVE_CONFIG_H */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+
+#include <gio/gio.h>
+#include <mate-panel-applet.h>
+#include <mate-panel-applet-gsettings.h>
+
+#include <gdk/gdkkeysyms.h>
+
+#ifdef HAVE_LIBNOTIFY
+#include <libnotify/notify.h>
+#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)
+{
+    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)
+{
+	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),
+                      gw_applet);
+
+    g_signal_connect (gw_applet->applet, "key-press-event",
+                      G_CALLBACK (key_press_cb),
+                      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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/32.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/32.html new file mode 100644 index 00000000..37f8279d --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/32.html @@ -0,0 +1,1009 @@ + + + + + + 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>
+#endif /* HAVE_CONFIG_H */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include <gio/gio.h>
+
+#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;<--- struct member '_MateWeatherDialog::weather_notebook' is never used.
+    GtkWidget *cond_location;<--- struct member '_MateWeatherDialog::cond_location' is never used.
+    GtkWidget *cond_update;<--- struct member '_MateWeatherDialog::cond_update' is never used.
+    GtkWidget *cond_cond;<--- struct member '_MateWeatherDialog::cond_cond' is never used.
+    GtkWidget *cond_sky;<--- struct member '_MateWeatherDialog::cond_sky' is never used.
+    GtkWidget *cond_temp;<--- struct member '_MateWeatherDialog::cond_temp' is never used.
+    GtkWidget *cond_dew;<--- struct member '_MateWeatherDialog::cond_dew' is never used.
+    GtkWidget *cond_humidity;<--- struct member '_MateWeatherDialog::cond_humidity' is never used.
+    GtkWidget *cond_wind;<--- struct member '_MateWeatherDialog::cond_wind' is never used.
+    GtkWidget *cond_pressure;<--- struct member '_MateWeatherDialog::cond_pressure' is never used.
+    GtkWidget *cond_vis;<--- struct member '_MateWeatherDialog::cond_vis' is never used.
+    GtkWidget *cond_apparent;<--- struct member '_MateWeatherDialog::cond_apparent' is never used.
+    GtkWidget *cond_sunrise;<--- struct member '_MateWeatherDialog::cond_sunrise' is never used.
+    GtkWidget *cond_sunset;<--- struct member '_MateWeatherDialog::cond_sunset' is never used.
+    GtkWidget *cond_image;<--- struct member '_MateWeatherDialog::cond_image' is never used.
+    GtkWidget *forecast_text;<--- struct member '_MateWeatherDialog::forecast_text' is never used.
+    GtkWidget *radar_image;<--- struct member '_MateWeatherDialog::radar_image' is never used.
+
+    MateWeatherApplet *applet;<--- struct member '_MateWeatherDialog::applet' is never used.
+};
+
+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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/33.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/33.html new file mode 100644 index 00000000..cb7d6500 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/33.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>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <ctype.h>
+#include <locale.h>
+
+#include <mate-panel-applet.h>
+#include <gio/gio.h>
+
+#define MATEWEATHER_I_KNOW_THIS_IS_UNSTABLE
+
+#include <libmateweather/mateweather-xml.h>
+#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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/34.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/34.html new file mode 100644 index 00000000..bbd924d8 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/34.html @@ -0,0 +1,935 @@ + + + + + + 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
#include <gio/gio.h>
+
+#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) { _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) { 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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/35.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/35.html new file mode 100644 index 00000000..3efc4600 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/35.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 <stdio.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <signal.h>
+#include <dirent.h>
+#include <string.h>
+#include <time.h>
+#include <glib.h>
+#include <gdk/gdkx.h>
+#include <gtk/gtk.h>
+#include <gio/gio.h>
+#include <mate-panel-applet.h>
+#include <mate-panel-applet-gsettings.h>
+#include <math.h>
+
+#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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/36.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/36.html new file mode 100644 index 00000000..445619f0 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/36.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 <stdio.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <signal.h>
+#include <dirent.h>
+#include <string.h>
+#include <time.h>
+
+#include <glibtop.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gio/gio.h>
+#include <gio/gdesktopappinfo.h>
+#include <mate-panel-applet.h>
+#include <mate-panel-applet-gsettings.h>
+
+#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)
+{
+    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)
+{
+    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);
+    g_signal_connect (applet, "key-press-event",
+                      G_CALLBACK (multiload_key_press_event_cb), ma);
+
+    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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/37.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/37.html new file mode 100644 index 00000000..04ca44a3 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/37.html @@ -0,0 +1,1175 @@ + + + + + + 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
#include <gio/gio.h>
+
+#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) { _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) { 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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/38.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/38.html new file mode 100644 index 00000000..e5085d27 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/38.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"
+#endif
+
+#if defined(sun) && defined(__SVR4)
+#include <sys/sockio.h>
+#endif
+
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <ifaddrs.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glibtop/netlist.h>
+#include <glibtop/netload.h>
+
+#include "backend.h"
+
+#ifdef HAVE_IW
+#include <iwlib.h>
+#endif /* HAVE_IW */
+
+#ifdef HAVE_NL
+
+#include <errno.h>
+#include <linux/netlink.h>
+#include <netlink/genl/genl.h>
+#include <netlink/genl/family.h>
+#include <netlink/genl/ctrl.h>
+#include <netlink/attr.h>
+#include <netlink/msg.h>
+
+#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;
+
+        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)",
+                 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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/39.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/39.html new file mode 100644 index 00000000..5f5bcf79 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/39.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 "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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/4.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/4.html new file mode 100644 index 00000000..6b33772d --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/4.html @@ -0,0 +1,925 @@ + + + + + + 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>
+#endif
+
+#include <stdio.h>
+
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#ifdef HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+
+#ifdef HAVE_ERR_H
+#include <err.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#include <gtk/gtk.h>
+
+#include <gio/gio.h>
+
+#include "battstat-preferences.h"
+
+enum {
+  PROP_0,
+  PROP_PROGRESS_DATA
+};
+
+struct _BattstatPreferences
+{
+  GtkDialog parent;
+
+  GtkWidget *radio_text_1;<--- struct member '_BattstatPreferences::radio_text_1' is never used.
+  GtkWidget *radio_text_2;<--- struct member '_BattstatPreferences::radio_text_2' is never used.
+  GtkWidget *check_text;<--- struct member '_BattstatPreferences::check_text' is never used.
+  GtkWidget *check_text_ptr;<--- struct member '_BattstatPreferences::check_text_ptr' is never used.
+  GtkWidget *lowbatt_toggle;<--- struct member '_BattstatPreferences::lowbatt_toggle' is never used.
+  GtkWidget *full_toggle;<--- struct member '_BattstatPreferences::full_toggle' is never used.
+  GtkWidget *hbox_ptr;<--- struct member '_BattstatPreferences::hbox_ptr' is never used.
+  GtkWidget *combo_ptr;<--- struct member '_BattstatPreferences::combo_ptr' is never used.
+  GtkWidget *spin_ptr;<--- struct member '_BattstatPreferences::spin_ptr' is never used.
+
+  ProgressData *battstat;<--- struct member '_BattstatPreferences::battstat' is never used.
+};
+
+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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/40.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/40.html new file mode 100644 index 00000000..82776efd --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/40.html @@ -0,0 +1,1127 @@ + + + + + + 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
#include <gio/gio.h>
+
+#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) { _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) { 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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/41.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/41.html new file mode 100644 index 00000000..e47852f3 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/41.html @@ -0,0 +1,1481 @@ + + + + + + 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
#include <gio/gio.h>
+
+#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) { _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) { 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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/42.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/42.html new file mode 100644 index 00000000..e6920fa2 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/42.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 <string.h>
+#include "stickynotes_applet.h"
+#include "stickynotes_applet_callbacks.h"
+#include "stickynotes.h"
+
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+
+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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/43.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/43.html new file mode 100644 index 00000000..ec6a8c11 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/43.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 <string.h>
+#include "stickynotes_applet_callbacks.h"
+#include "stickynotes.h"
+#include <gdk/gdkkeysyms.h>
+#include <X11/Xatom.h>
+#include <gdk/gdkx.h>
+
+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,
+                  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,
+               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,
+                 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,
+                         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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/44.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/44.html new file mode 100644 index 00000000..e6497b08 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/44.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 <stickynotes_callbacks.h>
+
+/* 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,
+                         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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/45.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/45.html new file mode 100644 index 00000000..324c135c --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/45.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 "util.h"
+
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
+#include <gtk/gtk.h>
+
+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))<--- Assuming condition is false
+        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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/46.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/46.html new file mode 100644 index 00000000..698db46b --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/46.html @@ -0,0 +1,827 @@ + + + + + + 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
#include <gio/gio.h>
+
+#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) { _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) { 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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/47.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/47.html new file mode 100644 index 00000000..2887f002 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/47.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 <glib/gi18n.h>
+
+#include "trash-empty.h"
+#include "config.h"
+
+/* 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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/48.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/48.html new file mode 100644 index 00000000..174b0d17 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/48.html @@ -0,0 +1,817 @@ + + + + + + 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
#include <gio/gio.h>
+
+#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) { _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) { 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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/49.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/49.html new file mode 100644 index 00000000..21b33925 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/49.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"
+#endif
+
+#include <string.h>
+
+#include <glib/gi18n.h>
+#include <gdk/gdkx.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#include <gio/gio.h>
+#include <mate-panel-applet.h>
+
+#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;<--- struct member '_TrashApplet::trash_monitor' is never used.
+  GFile *trash;<--- struct member '_TrashApplet::trash' is never used.
+
+  GtkImage *image;<--- struct member '_TrashApplet::image' is never used.
+  GIcon *icon;<--- struct member '_TrashApplet::icon' is never used.
+  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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/5.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/5.html new file mode 100644 index 00000000..a9d9e0aa --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/5.html @@ -0,0 +1,907 @@ + + + + + + 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
#include <gio/gio.h>
+
+#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) { _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) { 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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/6.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/6.html new file mode 100644 index 00000000..138ebf5e --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/6.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>
+#endif
+
+#include <stdio.h>
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifdef HAVE_ERR_H
+#include <err.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#include <gtk/gtk.h>
+
+#include <mate-panel-applet.h>
+#include <mate-panel-applet-gsettings.h>
+
+#ifdef HAVE_LIBNOTIFY
+#include <libnotify/notify.h>
+#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,
+               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),
+                      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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/7.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/7.html new file mode 100644 index 00000000..c0859e41 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/7.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>
+#endif
+
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+
+#ifdef HAVE_ERR_H
+#include <err.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#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>
+
+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 "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>
+#if defined(__NetBSD__)
+#include <dev/apm/apmio.h>
+#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 "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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/8.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/8.html new file mode 100644 index 00000000..a734f772 --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/8.html @@ -0,0 +1,695 @@ + + + + + + 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
#include <gio/gio.h>
+
+#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) { _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) { 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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/9.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/9.html new file mode 100644 index 00000000..d6cd6c8d --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/9.html @@ -0,0 +1,2013 @@ + + + + + + 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 <config.h>
+#include <string.h>
+#include <mate-panel-applet.h>
+#include <mate-panel-applet-gsettings.h>
+#ifdef HAVE_GUCHARMAP
+#include <gucharmap/gucharmap.h>
+#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,
+                      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);
+
+    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/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/index.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/index.html new file mode 100644 index 00000000..c4c5905d --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/index.html @@ -0,0 +1,429 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeinformationCppcheck cannot find all the include files (use --check-config for details)
accessx-status/src/accessx-status-resources.c
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
accessx-status/src/applet.c
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.
731variableScope398styleThe scope of the variable 'button_pixbuf' can be reduced.
819variableScope398styleThe scope of the variable 'icon_theme' can be reduced.
battstat/acpi-freebsd.c
162legacyUninitvar457errorUninitialized variable: remain
163legacyUninitvar457errorUninitialized variable: rate
battstat/apmlib/apmlib.c
72invalidscanf119warningsscanf() without field width limits can crash with huge input data.
218variableScope398styleThe scope of the variable 'fd' can be reduced.
301ConfigurationNotCheckedinformationSkipping configuration 'APM_IOC_LAST_ERROR' since the value of 'APM_IOC_LAST_ERROR' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
327ConfigurationNotCheckedinformationSkipping configuration 'APM_BAD_FUNCTION' since the value of 'APM_BAD_FUNCTION' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
330ConfigurationNotCheckedinformationSkipping configuration 'APM_RESUME_DISABLED' since the value of 'APM_RESUME_DISABLED' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
354ConfigurationNotCheckedinformationSkipping configuration 'APM_IOC_REJECT' since the value of 'APM_IOC_REJECT' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
369ConfigurationNotCheckedinformationSkipping configuration 'APM_IOC_IGNORE' since the value of 'APM_IOC_IGNORE' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
415ConfigurationNotCheckedinformationSkipping configuration 'APM_CAPABILITY_CHANGE' since the value of 'APM_CAPABILITY_CHANGE' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
battstat/battstat-preferences.c
58unusedStructMember563stylestruct member '_BattstatPreferences::radio_text_1' is never used.
59unusedStructMember563stylestruct member '_BattstatPreferences::radio_text_2' is never used.
60unusedStructMember563stylestruct member '_BattstatPreferences::check_text' is never used.
61unusedStructMember563stylestruct member '_BattstatPreferences::check_text_ptr' is never used.
62unusedStructMember563stylestruct member '_BattstatPreferences::lowbatt_toggle' is never used.
63unusedStructMember563stylestruct member '_BattstatPreferences::full_toggle' is never used.
64unusedStructMember563stylestruct member '_BattstatPreferences::hbox_ptr' is never used.
65unusedStructMember563stylestruct member '_BattstatPreferences::combo_ptr' is never used.
66unusedStructMember563stylestruct member '_BattstatPreferences::spin_ptr' is never used.
68unusedStructMember563stylestruct member '_BattstatPreferences::battstat' is never used.
battstat/battstat-resources.c
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
battstat/battstat_applet.c
490variableScope398styleThe scope of the variable 'powerstring' can be reduced.
491variableScope398styleThe scope of the variable 'remaining' can be reduced.
battstat/power-management.c
188variableScope398styleThe scope of the variable 'fd' can be reduced.
charpick/charpick-resources.c
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
charpick/charpick.c
298variableScope398styleThe scope of the variable 'menuitem' can be reduced.
charpick/properties.c
250variableScope398styleThe scope of the variable 'selection' can be reduced.
command/src/command-resources.c
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
command/src/command.c
261duplicateConditionalAssign398styleThe statement 'if (command_applet->width!=width) command_applet->width=width' is logically equivalent to 'command_applet->width=width'.
command/src/ma-command.c
56unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_CODE is a macro then please configure it.
cpufreq/src/cpufreq-applet.c
127unknownMacroerrorThere 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.c
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-libcpufreq.c
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-sysfs.c
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.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-popup.c
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-prefs.c
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-resources.c
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
cpufreq/src/cpufreq-selector.c
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/cpufreq-selector-libcpufreq.c
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-service.c
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-sysfs.c
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.c
46unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE is a macro then please configure it.
drivemount/src/drive-button.c
44unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
drivemount/src/drivemount-resources.c
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
geyes/src/geyes-resources.c
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
geyes/src/themes.c
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.
mateweather/src/mateweather-applet.c
463variableScope398styleThe scope of the variable 'n' can be reduced.
mateweather/src/mateweather-dialog.c
33unusedStructMember563stylestruct member '_MateWeatherDialog::weather_notebook' is never used.
34unusedStructMember563stylestruct member '_MateWeatherDialog::cond_location' is never used.
35unusedStructMember563stylestruct member '_MateWeatherDialog::cond_update' is never used.
36unusedStructMember563stylestruct member '_MateWeatherDialog::cond_cond' is never used.
37unusedStructMember563stylestruct member '_MateWeatherDialog::cond_sky' is never used.
38unusedStructMember563stylestruct member '_MateWeatherDialog::cond_temp' is never used.
39unusedStructMember563stylestruct member '_MateWeatherDialog::cond_dew' is never used.
40unusedStructMember563stylestruct member '_MateWeatherDialog::cond_humidity' is never used.
41unusedStructMember563stylestruct member '_MateWeatherDialog::cond_wind' is never used.
42unusedStructMember563stylestruct member '_MateWeatherDialog::cond_pressure' is never used.
43unusedStructMember563stylestruct member '_MateWeatherDialog::cond_vis' is never used.
44unusedStructMember563stylestruct member '_MateWeatherDialog::cond_apparent' is never used.
45unusedStructMember563stylestruct member '_MateWeatherDialog::cond_sunrise' is never used.
46unusedStructMember563stylestruct member '_MateWeatherDialog::cond_sunset' is never used.
47unusedStructMember563stylestruct member '_MateWeatherDialog::cond_image' is never used.
48unusedStructMember563stylestruct member '_MateWeatherDialog::forecast_text' is never used.
49unusedStructMember563stylestruct member '_MateWeatherDialog::radar_image' is never used.
51unusedStructMember563stylestruct member '_MateWeatherDialog::applet' is never used.
185variableScope398styleThe scope of the variable 'forecast' can be reduced.
186variableScope398styleThe scope of the variable 'buffer' can be reduced.
187variableScope398styleThe scope of the variable 'font_desc' can be reduced.
mateweather/src/mateweather-pref.c
672variableScope398styleThe scope of the variable 'path' can be reduced.
728variableScope398styleThe scope of the variable 'path' can be reduced.
mateweather/src/mateweather-resources.c
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
multiload/src/load-graph.c
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
100variableScope398styleThe scope of the variable 'launch_context' can be reduced.
102variableScope398styleThe scope of the variable 'app_info' can be reduced.
multiload/src/multiload-resources.c
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
netspeed/src/backend.c
139variableScope398styleThe scope of the variable 'ip6_netmask' can be reduced.
139unreadVariable563styleVariable 'ip6_netmask' is assigned a value that is never used.
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'.
netspeed/src/netspeed-resources.c
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
netspeed/src/netspeed.h
28unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DECLARE_FINAL_TYPE is a macro then please configure it.
stickynotes/sticky-notes-resources.c
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
stickynotes/stickynotes_applet.c
87unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If PANEL_APPLET_FACTORY is a macro then please configure it.
stickynotes/stickynotes_applet_callbacks.c
38variableScope398styleThe scope of the variable 'note' can be reduced.
stickynotes/stickynotes_callbacks.c
44constParameter398styleParameter 'widget' can be declared as pointer to const
stickynotes/util.c
86uninitvar457errorUninitialized variable: num
timerapplet/src/timerapplet-resources.c
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
trashapplet/src/trash-empty.c
151variableScope398styleThe scope of the variable 'info' can be reduced.
152variableScope398styleThe scope of the variable 'child' can be reduced.
trashapplet/src/trashapplet-resources.c
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
trashapplet/src/trashapplet.c
48unusedStructMember563stylestruct member '_TrashApplet::trash_monitor' is never used.
49unusedStructMember563stylestruct member '_TrashApplet::trash' is never used.
51unusedStructMember563stylestruct member '_TrashApplet::image' is never used.
52unusedStructMember563stylestruct member '_TrashApplet::icon' is never used.
+
+ +
+ + diff --git a/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/stats.html b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/stats.html new file mode 100644 index 00000000..51b48a9b --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/stats.html @@ -0,0 +1,195 @@ + + + + + + Cppcheck - HTML report - mate-applets + + + + + +
+ + + + + +
+ + diff --git a/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/style.css b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_master/style.css new file mode 100644 index 00000000..3897bfaf --- /dev/null +++ b/2023-09-02-145457-6637-cppcheck@1c7a34f6af71_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