From ab447ca6de34e8b7fbd9a82db64571c71b08570d Mon Sep 17 00:00:00 2001 From: "raveit65 (via Travis CI)" Date: Fri, 23 Feb 2024 15:19:46 +0000 Subject: Deploy mate-desktop/mate-terminal to github.com/mate-desktop/mate-terminal.git:gh-pages --- .../0.html | 449 + .../1.html | 319 + .../10.html | 381 + .../11.html | 2091 +++++ .../12.html | 293 + .../13.html | 625 ++ .../14.html | 307 + .../15.html | 459 + .../16.html | 565 ++ .../17.html | 725 ++ .../18.html | 309 + .../19.html | 843 ++ .../2.html | 403 + .../20.html | 919 ++ .../21.html | 277 + .../22.html | 371 + .../23.html | 255 + .../24.html | 455 + .../25.html | 255 + .../26.html | 313 + .../27.html | 285 + .../28.html | 443 + .../29.html | 2461 +++++ .../3.html | 541 ++ .../30.html | 309 + .../31.html | 567 ++ .../32.html | 361 + .../33.html | 479 + .../34.html | 391 + .../35.html | 4557 ++++++++++ .../36.html | 377 + .../37.html | 461 + .../38.html | 387 + .../39.html | 357 + .../4.html | 3385 +++++++ .../40.html | 331 + .../41.html | 1515 ++++ .../42.html | 471 + .../43.html | 363 + .../44.html | 441 + .../45.html | 3119 +++++++ .../46.html | 3621 ++++++++ .../47.html | 289 + .../48.html | 2603 ++++++ .../49.html | 1065 +++ .../5.html | 3055 +++++++ .../50.html | 5303 +++++++++++ .../51.html | 279 + .../52.html | 1047 +++ .../53.html | 339 + .../54.html | 805 ++ .../55.html | 367 + .../56.html | 1233 +++ .../57.html | 425 + .../58.html | 2431 +++++ .../59.html | 9575 ++++++++++++++++++++ .../6.html | 453 + .../60.html | 1419 +++ .../7.html | 327 + .../8.html | 1523 ++++ .../9.html | 1071 +++ .../index.html | 573 ++ .../stats.html | 209 + .../style.css | 177 + 64 files changed, 70404 insertions(+) create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/0.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/1.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/10.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/11.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/12.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/13.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/14.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/15.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/16.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/17.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/18.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/19.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/2.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/20.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/21.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/22.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/23.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/24.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/25.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/26.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/27.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/28.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/29.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/3.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/30.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/31.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/32.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/33.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/34.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/35.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/36.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/37.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/38.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/39.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/4.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/40.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/41.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/42.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/43.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/44.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/45.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/46.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/47.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/48.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/49.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/5.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/50.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/51.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/52.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/53.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/54.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/55.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/56.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/57.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/58.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/59.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/6.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/60.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/7.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/8.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/9.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/index.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/stats.html create mode 100644 2024-02-18-150112-8118-cppcheck@705094ddc117_master/style.css (limited to '2024-02-18-150112-8118-cppcheck@705094ddc117_master') diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/0.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/0.html new file mode 100644 index 0000000..2838694 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/0.html @@ -0,0 +1,449 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+ * Copyright (C) 1999, 2000 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
+ * All rights reserved.
+ *
+ * This file is part of the Mate Library.
+ *
+ * The Mate Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * The Mate Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Mate Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+  @NOTATION@
+ */
+
+/*
+ *
+ * Mate utility routines.
+ * (C)  1997, 1998, 1999 the Free Software Foundation.
+ *
+ * Author: Miguel de Icaza,
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "eggshell.h"
+
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <pwd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+/**
+ * egg_shell:
+ * @shell: the value of the SHELL env variable
+ *
+ * Retrieves the user's preferred shell.
+ *
+ * Returns: A newly allocated string that is the path to the shell.
+ */
+char *
+egg_shell (const char *shell)
+{
+	struct passwd *pw;
+	int i;
+	static const char shells [][14] =
+	{
+		/* Note that on some systems shells can also
+		 * be installed in /usr/bin */
+		"/bin/bash", "/usr/bin/bash",
+		"/bin/zsh", "/usr/bin/zsh",
+		"/bin/tcsh", "/usr/bin/tcsh",
+		"/bin/ksh", "/usr/bin/ksh",
+		"/bin/csh", "/bin/sh"
+	};
+
+	if (geteuid () == getuid () &&
+	        getegid () == getgid ())
+	{
+		/* only in non-setuid */
+		if (shell != NULL)
+		{
+			if (access (shell, X_OK) == 0)
+			{
+				return g_strdup (shell);
+			}
+		}
+	}
+	pw = getpwuid(getuid());
+	if (pw && pw->pw_shell)
+	{
+		if (access (pw->pw_shell, X_OK) == 0)
+		{
+			return g_strdup (pw->pw_shell);
+		}
+	}
+
+	for (i = 0; i != G_N_ELEMENTS (shells); i++)
+	{
+		if (access (shells [i], X_OK) == 0)
+		{
+			return g_strdup (shells[i]);
+		}
+	}
+
+	/* If /bin/sh doesn't exist, your system is truly broken.  */
+	g_assert_not_reached ();
+
+	/* Placate compiler.  */
+	return NULL;
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/1.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/1.html new file mode 100644 index 0000000..e304b97 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/1.html @@ -0,0 +1,319 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
/*
+ * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+ * Copyright (C) 1999, 2000 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
+ * All rights reserved.
+ *
+ * This file is part of the Mate Library.
+ *
+ * The Mate Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * The Mate Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Mate Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+  @NOTATION@
+ */
+
+#ifndef __EGG_USER_SHELL_H__
+#define __EGG_USER_SHELL_H__
+
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+/* Find the name of the user's shell.  */
+char *egg_shell (const char *shell);
+
+G_END_DECLS
+
+#endif
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/10.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/10.html new file mode 100644 index 0000000..4be2aaf --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/10.html @@ -0,0 +1,381 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
/* eggtreednd.h
+ * Copyright (C) 2001  Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __EGG_TREE_MULTI_DND_H__
+#define __EGG_TREE_MULTI_DND_H__
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define EGG_TYPE_TREE_MULTI_DRAG_SOURCE            (egg_tree_multi_drag_source_get_type ())
+#define EGG_TREE_MULTI_DRAG_SOURCE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TREE_MULTI_DRAG_SOURCE, EggTreeMultiDragSource))
+#define EGG_IS_TREE_MULTI_DRAG_SOURCE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TREE_MULTI_DRAG_SOURCE))
+#define EGG_TREE_MULTI_DRAG_SOURCE_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), EGG_TYPE_TREE_MULTI_DRAG_SOURCE, EggTreeMultiDragSourceIface))
+
+typedef struct _EggTreeMultiDragSource      EggTreeMultiDragSource; /* Dummy typedef */
+typedef struct _EggTreeMultiDragSourceIface EggTreeMultiDragSourceIface;
+
+struct _EggTreeMultiDragSourceIface
+{
+    GTypeInterface g_iface;
+
+    /* VTable - not signals */
+    gboolean     (* row_draggable)        (EggTreeMultiDragSource   *drag_source,
+                                           GList                    *path_list);
+
+    gboolean     (* drag_data_get)        (EggTreeMultiDragSource   *drag_source,
+                                           GList                    *path_list,
+                                           GtkSelectionData         *selection_data);
+
+    gboolean     (* drag_data_delete)     (EggTreeMultiDragSource *drag_source,
+                                           GList                  *path_list);
+};
+
+GType    egg_tree_multi_drag_source_get_type         (void) G_GNUC_CONST;
+
+/* Returns whether the given row can be dragged */
+gboolean egg_tree_multi_drag_source_row_draggable    (EggTreeMultiDragSource *drag_source,
+        GList                  *path_list);
+
+/* Deletes the given row, or returns FALSE if it can't */
+gboolean egg_tree_multi_drag_source_drag_data_delete (EggTreeMultiDragSource *drag_source,
+        GList                  *path_list);
+
+
+/* Fills in selection_data with type selection_data->target based on the row
+ * denoted by path, returns TRUE if it does anything
+ */
+gboolean egg_tree_multi_drag_source_drag_data_get    (EggTreeMultiDragSource *drag_source,
+        GList                  *path_list,
+        GtkSelectionData       *selection_data);
+void     egg_tree_multi_drag_add_drag_support        (GtkTreeView            *tree_view);
+
+G_END_DECLS
+
+#endif /* __EGG_TREE_MULTI_DND_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/11.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/11.html new file mode 100644 index 0000000..feb9eb8 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/11.html @@ -0,0 +1,2091 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * Copyright © 2002 Havoc Pennington
+ * Copyright © 2002 Mathias Hasselmann
+ * Copyright © 2008 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * Mate-terminal 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <math.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-intl.h"
+#include "profile-editor.h"
+#include "terminal-util.h"
+
+typedef struct _TerminalColorScheme TerminalColorScheme;
+
+struct _TerminalColorScheme
+{
+	const char *name;
+	const GdkRGBA foreground;
+	const GdkRGBA background;
+};
+
+static const TerminalColorScheme color_schemes[] =
+{
+	{
+		N_("Black on light yellow"),
+		{ 0, 0, 0, 1 },
+		{ 1, 1, 0.866667, 1 }
+	},
+	{
+		N_("Black on white"),
+		{ 0, 0, 0, 1 },
+		{ 1, 1, 1, 1 }
+	},
+	{
+		N_("Gray on black"),
+		{ 0.666667, 0.666667, 0.666667, 1 },
+		{ 0, 0, 0, 1 }
+	},
+	{
+		N_("Green on black"),
+		{ 0, 1, 0, 1 },
+		{ 0, 0, 0, 1 }
+	},
+	{
+		N_("White on black"),
+		{ 1, 1, 1, 1 },
+		{ 0, 0, 0, 1 }
+	},
+	/* Translators: "Solarized" is the name of a colour scheme, "light" can be translated */
+	{ N_("Solarized light"),
+		{ 0.396078, 0.482352, 0.513725, 1 },
+		{ 0.992156, 0.964705, 0.890196, 1 }
+	},
+	/* Translators: "Solarized" is the name of a colour scheme, "dark" can be translated */
+	{ N_("Solarized dark"),
+		{ 0.513725, 0.580392, 0.588235, 1 },
+		{ 0,        0.168627, 0.211764, 1 }
+	},
+};
+
+static void profile_forgotten_cb (TerminalProfile           *profile,
+                                  GtkWidget                 *editor);
+
+static void profile_notify_sensitivity_cb (TerminalProfile *profile,
+        GParamSpec *pspec,
+        GtkWidget *editor);
+
+static void profile_colors_notify_scheme_combo_cb (TerminalProfile *profile,
+        GParamSpec *pspec,
+        GtkComboBox *combo);
+
+static void profile_palette_notify_scheme_combo_cb (TerminalProfile *profile,
+        GParamSpec *pspec,
+        GtkComboBox *combo);
+
+static void profile_palette_notify_colorpickers_cb (TerminalProfile *profile,
+        GParamSpec *pspec,
+        GtkWidget *editor);
+
+static GtkWidget*
+profile_editor_get_widget (GtkWidget  *editor,
+                           const char *widget_name)
+{
+	GtkBuilder *builder;
+
+	builder = g_object_get_data (G_OBJECT (editor), "builder");
+	g_assert (builder != NULL);
+
+	return (GtkWidget *) gtk_builder_get_object  (builder, widget_name);
+}
+
+static void
+widget_and_labels_set_sensitive (GtkWidget *widget, gboolean sensitive)
+{
+	GList *labels, *i;
+
+	labels = gtk_widget_list_mnemonic_labels (widget);
+	for (i = labels; i; i = i->next)
+	{
+		gtk_widget_set_sensitive (GTK_WIDGET (i->data), sensitive);
+	}
+	g_list_free (labels);
+
+	gtk_widget_set_sensitive (widget, sensitive);
+}
+
+static void
+profile_forgotten_cb (TerminalProfile *profile,
+                      GtkWidget *editor)
+{
+	gtk_widget_destroy (editor);
+}
+
+static void
+profile_notify_sensitivity_cb (TerminalProfile *profile,
+                               GParamSpec *pspec,<--- Parameter 'pspec' can be declared as pointer to const
+                               GtkWidget *editor)
+{
+	TerminalBackgroundType bg_type;
+	const char *prop_name;
+
+	if (pspec)
+		prop_name = pspec->name;
+	else
+		prop_name = NULL;
+
+#define SET_SENSITIVE(name, setting) widget_and_labels_set_sensitive (profile_editor_get_widget (editor, name), setting)
+
+	if (!prop_name ||
+	        prop_name == I_(TERMINAL_PROFILE_USE_CUSTOM_COMMAND) ||
+	        prop_name == I_(TERMINAL_PROFILE_CUSTOM_COMMAND))
+	{
+		gboolean use_custom_command_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_USE_CUSTOM_COMMAND);
+		SET_SENSITIVE ("use-custom-command-checkbutton", !use_custom_command_locked);
+		SET_SENSITIVE ("custom-command-box",
+		               terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_CUSTOM_COMMAND) &&
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_CUSTOM_COMMAND));
+	}
+
+	gtk_widget_hide (profile_editor_get_widget (editor, "darken-background-transparent-or-image-scale-label"));
+	gtk_widget_show (profile_editor_get_widget (editor, "darken-background-transparent-scale-label"));
+	gtk_widget_hide (profile_editor_get_widget (editor, "scroll-background-checkbutton"));
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_BACKGROUND_TYPE))
+	{
+		gboolean bg_type_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_BACKGROUND_TYPE);
+		SET_SENSITIVE ("solid-radiobutton", !bg_type_locked);
+		SET_SENSITIVE ("transparent-radiobutton", !bg_type_locked);
+
+		bg_type = terminal_profile_get_property_enum (profile, TERMINAL_PROFILE_BACKGROUND_TYPE);
+		if (bg_type == TERMINAL_BACKGROUND_TRANSPARENT)
+		{
+			SET_SENSITIVE ("darken-background-vbox", !terminal_profile_property_locked (profile, TERMINAL_PROFILE_BACKGROUND_DARKNESS));
+		}
+		else
+		{
+			SET_SENSITIVE ("darken-background-vbox", FALSE);
+		}
+	}
+
+	if (!prop_name ||
+	        prop_name == I_(TERMINAL_PROFILE_USE_SYSTEM_FONT) ||
+	        prop_name == I_(TERMINAL_PROFILE_FONT))
+	{
+		SET_SENSITIVE ("font-hbox",
+		               !terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_SYSTEM_FONT) &&
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_FONT));
+		SET_SENSITIVE ("system-font-checkbutton",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_USE_SYSTEM_FONT));
+	}
+
+	if (!prop_name ||
+	        prop_name == I_(TERMINAL_PROFILE_FOREGROUND_COLOR) ||
+	        prop_name == I_(TERMINAL_PROFILE_BACKGROUND_COLOR) ||
+	        prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR) ||
+	        prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG) ||
+	        prop_name == I_(TERMINAL_PROFILE_USE_THEME_COLORS))
+	{
+		gboolean bg_locked, use_theme_colors, fg_locked;
+
+		use_theme_colors = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_THEME_COLORS);
+		fg_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_FOREGROUND_COLOR);
+		bg_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_BACKGROUND_COLOR);
+
+		SET_SENSITIVE ("foreground-colorpicker", !use_theme_colors && !fg_locked);
+		SET_SENSITIVE ("foreground-colorpicker-label", !use_theme_colors && !fg_locked);
+		SET_SENSITIVE ("background-colorpicker", !use_theme_colors && !bg_locked);
+		SET_SENSITIVE ("background-colorpicker-label", !use_theme_colors && !bg_locked);
+		SET_SENSITIVE ("color-scheme-combobox", !use_theme_colors && !fg_locked && !bg_locked);
+		SET_SENSITIVE ("color-scheme-combobox-label", !use_theme_colors && !fg_locked && !bg_locked);
+	}
+
+	if (!prop_name ||
+	        prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR) ||
+	        prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG) ||
+	        prop_name == I_(TERMINAL_PROFILE_USE_THEME_COLORS))
+	{
+		gboolean bold_locked, bold_same_as_fg_locked, bold_same_as_fg, use_theme_colors;
+
+		use_theme_colors = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_THEME_COLORS);
+		bold_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_BOLD_COLOR);
+		bold_same_as_fg_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG);
+		bold_same_as_fg = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG);
+
+		SET_SENSITIVE ("bold-color-same-as-fg-checkbox", !use_theme_colors && !bold_same_as_fg_locked);
+		SET_SENSITIVE ("bold-colorpicker", !use_theme_colors && !bold_locked && !bold_same_as_fg);
+		SET_SENSITIVE ("bold-colorpicker-label", !use_theme_colors && ((!bold_same_as_fg && !bold_locked) || !bold_same_as_fg_locked));
+	}
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_VISIBLE_NAME))
+		SET_SENSITIVE ("profile-name-entry",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_VISIBLE_NAME));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_DEFAULT_SHOW_MENUBAR))
+		SET_SENSITIVE ("show-menubar-checkbutton",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_DEFAULT_SHOW_MENUBAR));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_TITLE))
+		SET_SENSITIVE ("title-entry",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_TITLE));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_TITLE_MODE))
+		SET_SENSITIVE ("title-mode-combobox",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_TITLE_MODE));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_ALLOW_BOLD))
+		SET_SENSITIVE ("allow-bold-checkbutton",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_ALLOW_BOLD));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SILENT_BELL))
+		SET_SENSITIVE ("bell-checkbutton",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_SILENT_BELL));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_COPY_SELECTION))
+		SET_SENSITIVE ("copy-checkbutton",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_COPY_SELECTION));
+
+#ifdef ENABLE_SKEY
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_USE_SKEY))
+		SET_SENSITIVE ("use-skey-checkbutton",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_USE_SKEY));
+#endif
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_USE_URLS))
+		SET_SENSITIVE ("use-urls-checkbutton",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_USE_URLS));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_WORD_CHARS))
+		SET_SENSITIVE ("word-chars-entry",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_WORD_CHARS));
+
+	if (!prop_name ||
+	        prop_name == I_(TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE) ||
+	        prop_name == I_(TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS) ||
+	        prop_name == I_(TERMINAL_PROFILE_DEFAULT_SIZE_ROWS))
+	{
+		gboolean use_custom_default_size_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE);
+		gboolean use_custom_default_size = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE);
+		gboolean columns_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS);
+		gboolean rows_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_DEFAULT_SIZE_ROWS);
+
+		SET_SENSITIVE ("use-custom-default-size-checkbutton", !use_custom_default_size_locked);
+		SET_SENSITIVE ("default-size-hbox", use_custom_default_size);
+		SET_SENSITIVE ("default-size-label", (!columns_locked || !rows_locked));
+		SET_SENSITIVE ("default-size-columns-label", !columns_locked);
+		SET_SENSITIVE ("default-size-columns-spinbutton", !columns_locked);
+		SET_SENSITIVE ("default-size-rows-label", !rows_locked);
+		SET_SENSITIVE ("default-size-rows-spinbutton", !rows_locked);
+	}
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLLBAR_POSITION))
+		SET_SENSITIVE ("scrollbar-position-combobox",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_SCROLLBAR_POSITION));
+
+	if (!prop_name ||
+	        prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_LINES) ||
+	        prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_UNLIMITED))
+	{
+		gboolean scrollback_lines_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_SCROLLBACK_LINES);
+		gboolean scrollback_unlimited_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_SCROLLBACK_UNLIMITED);
+		gboolean scrollback_unlimited = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SCROLLBACK_UNLIMITED);
+
+		SET_SENSITIVE ("scrollback-label", !scrollback_lines_locked);
+		SET_SENSITIVE ("scrollback-box", !scrollback_lines_locked && !scrollback_unlimited);
+		SET_SENSITIVE ("scrollback-unlimited-checkbutton", !scrollback_lines_locked && !scrollback_unlimited_locked);
+	}
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE))
+		SET_SENSITIVE ("scroll-on-keystroke-checkbutton",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLL_ON_OUTPUT))
+		SET_SENSITIVE ("scroll-on-output-checkbutton",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_SCROLL_ON_OUTPUT));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_EXIT_ACTION))
+		SET_SENSITIVE ("exit-action-combobox",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_EXIT_ACTION));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_LOGIN_SHELL))
+		SET_SENSITIVE ("login-shell-checkbutton",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_LOGIN_SHELL));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_PALETTE))
+	{
+		gboolean palette_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_PALETTE);
+		SET_SENSITIVE ("palette-combobox", !palette_locked);
+		SET_SENSITIVE ("palette-table", !palette_locked);
+	}
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_BACKSPACE_BINDING))
+		SET_SENSITIVE ("backspace-binding-combobox",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_BACKSPACE_BINDING));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_DELETE_BINDING))
+		SET_SENSITIVE ("delete-binding-combobox",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_DELETE_BINDING));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_USE_THEME_COLORS))
+		SET_SENSITIVE ("use-theme-colors-checkbutton",
+		               !terminal_profile_property_locked (profile, TERMINAL_PROFILE_USE_THEME_COLORS));
+
+#undef SET_INSENSITIVE
+}
+
+static void
+color_scheme_combo_changed_cb (GtkWidget *combo,
+                               GParamSpec *pspec,
+                               TerminalProfile *profile)
+{
+	guint i;
+
+	i = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
+
+	if (i < G_N_ELEMENTS (color_schemes))
+	{
+		g_signal_handlers_block_by_func (profile, G_CALLBACK (profile_colors_notify_scheme_combo_cb), combo);
+		g_object_set (profile,
+		              TERMINAL_PROFILE_FOREGROUND_COLOR, &color_schemes[i].foreground,
+		              TERMINAL_PROFILE_BACKGROUND_COLOR, &color_schemes[i].background,
+		              NULL);
+		g_signal_handlers_unblock_by_func (profile, G_CALLBACK (profile_colors_notify_scheme_combo_cb), combo);
+	}
+	else
+	{
+		/* "custom" selected, no change */
+	}
+}
+
+static void
+profile_colors_notify_scheme_combo_cb (TerminalProfile *profile,
+                                       GParamSpec *pspec,
+                                       GtkComboBox *combo)
+{
+	const GdkRGBA *fg, *bg;
+	guint i;
+
+	fg = terminal_profile_get_property_boxed (profile, TERMINAL_PROFILE_FOREGROUND_COLOR);
+	bg = terminal_profile_get_property_boxed (profile, TERMINAL_PROFILE_BACKGROUND_COLOR);
+
+	if (fg && bg)
+	{
+		for (i = 0; i < G_N_ELEMENTS (color_schemes); ++i)
+		{
+			if (gdk_rgba_equal (&fg, &color_schemes[i].foreground) &&
+			        gdk_rgba_equal (&bg, &color_schemes[i].background))
+				break;
+		}
+	}
+	else
+	{
+		i = G_N_ELEMENTS (color_schemes);
+	}
+	/* If we didn't find a match, then we get the last combo box item which is "custom" */
+
+	g_signal_handlers_block_by_func (combo, G_CALLBACK (color_scheme_combo_changed_cb), profile);
+	gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i);
+	g_signal_handlers_unblock_by_func (combo, G_CALLBACK (color_scheme_combo_changed_cb), profile);
+}
+
+static void
+palette_scheme_combo_changed_cb (GtkComboBox *combo,
+                                 GParamSpec *pspec,
+                                 TerminalProfile *profile)
+{
+	int i;
+
+	i = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
+
+	g_signal_handlers_block_by_func (profile, G_CALLBACK (profile_colors_notify_scheme_combo_cb), combo);
+	if (i < TERMINAL_PALETTE_N_BUILTINS)
+		terminal_profile_set_palette_builtin (profile, i);
+	else
+	{
+		/* "custom" selected, no change */
+	}
+	g_signal_handlers_unblock_by_func (profile, G_CALLBACK (profile_colors_notify_scheme_combo_cb), combo);
+}
+
+static void
+profile_palette_notify_scheme_combo_cb (TerminalProfile *profile,
+                                        GParamSpec *pspec,
+                                        GtkComboBox *combo)
+{
+	guint i;
+
+	if (!terminal_profile_get_palette_is_builtin (profile, &i))
+		/* If we didn't find a match, then we want the last combo
+		 * box item which is "custom"
+		 */
+		i = TERMINAL_PALETTE_N_BUILTINS;
+
+	g_signal_handlers_block_by_func (combo, G_CALLBACK (palette_scheme_combo_changed_cb), profile);
+	gtk_combo_box_set_active (combo, i);
+	g_signal_handlers_unblock_by_func (combo, G_CALLBACK (palette_scheme_combo_changed_cb), profile);
+}
+
+static void
+palette_color_notify_cb (GtkColorChooser *button,
+                         GParamSpec *pspec,
+                         TerminalProfile *profile)
+{
+	GtkWidget *editor;
+	GdkRGBA color;
+	guint i;
+
+	gtk_color_chooser_get_rgba (button, &color);
+	i = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (button), "palette-entry-index"));
+
+	editor = gtk_widget_get_toplevel (GTK_WIDGET (button));
+	g_signal_handlers_block_by_func (profile, G_CALLBACK (profile_palette_notify_colorpickers_cb), editor);
+	terminal_profile_modify_palette_entry (profile, i, &color);
+	g_signal_handlers_unblock_by_func (profile, G_CALLBACK (profile_palette_notify_colorpickers_cb), editor);
+}
+
+static void
+profile_palette_notify_colorpickers_cb (TerminalProfile *profile,
+                                        GParamSpec *pspec,
+                                        GtkWidget *editor)
+{
+	GtkWidget *w;
+	GdkRGBA colors[TERMINAL_PALETTE_SIZE];
+	guint n_colors, i;
+
+	n_colors = G_N_ELEMENTS (colors);
+	terminal_profile_get_palette (profile, colors, &n_colors);
+
+	n_colors = MIN (n_colors, TERMINAL_PALETTE_SIZE);
+	for (i = 0; i < n_colors; i++)
+	{
+		char name[32];
+
+		g_snprintf (name, sizeof (name), "palette-colorpicker-%d", i + 1);
+		w = profile_editor_get_widget (editor, name);
+
+		g_signal_handlers_block_by_func (w, G_CALLBACK (palette_color_notify_cb), profile);
+		gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (w), &colors[i]);
+		g_signal_handlers_unblock_by_func (w, G_CALLBACK (palette_color_notify_cb), profile);
+	}
+}
+
+static void
+custom_command_entry_changed_cb (GtkEntry *entry)
+{
+	const char *command;
+	GError *error = NULL;
+
+	command = gtk_entry_get_text (entry);
+
+	if (g_shell_parse_argv (command, NULL, NULL, &error))
+	{
+		gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
+	}
+	else
+	{
+		char *tooltip;
+
+		gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_SECONDARY, "dialog-warning");
+
+		tooltip = g_strdup_printf (_("Error parsing command: %s"), error->message);
+		gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_SECONDARY, tooltip);
+		g_free (tooltip);
+
+		g_error_free (error);
+	}
+}
+
+static void
+visible_name_entry_changed_cb (GtkEntry *entry,
+                               GtkWindow *window)
+{
+	const char *visible_name;
+	char *text;
+
+	visible_name = gtk_entry_get_text (entry);
+
+	text = g_strdup_printf (_("Editing Profile “%s”"), visible_name);
+	gtk_window_set_title (window, text);
+	g_free (text);
+}
+
+static void
+reset_compat_defaults_cb (GtkWidget       *button,
+                          TerminalProfile *profile)
+{
+	terminal_profile_reset_property (profile, TERMINAL_PROFILE_DELETE_BINDING);
+	terminal_profile_reset_property (profile, TERMINAL_PROFILE_BACKSPACE_BINDING);
+}
+
+/*
+ * initialize widgets
+ */
+
+static void
+init_color_scheme_menu (GtkWidget *widget)
+{
+	GtkCellRenderer *renderer;
+	GtkTreeIter iter;
+	GtkListStore *store;
+	gsize i;
+
+	store = gtk_list_store_new (1, G_TYPE_STRING);
+	for (i = 0; i < G_N_ELEMENTS (color_schemes); ++i)
+	gtk_list_store_insert_with_values (store, &iter, -1,
+	                                   0, _(color_schemes[i].name),
+	                                   -1);
+	gtk_list_store_insert_with_values (store, &iter, -1,
+	                                  0, _("Custom"),
+	                                  -1);
+
+	gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store));
+	g_object_unref (store);
+
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget), renderer, TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget), renderer, "text", 0, NULL);
+}
+
+static char*
+format_percent_value (GtkScale *scale,
+                      double    val,
+                      void     *data)
+{
+	return g_strdup_printf ("%d%%", (int) (val * 100.0 + 0.5));
+}
+
+static void
+init_background_darkness_scale (GtkWidget *scale)
+{
+	g_signal_connect (scale, "format-value",
+	                  G_CALLBACK (format_percent_value),
+	                  NULL);
+}
+
+static void
+editor_response_cb (GtkWidget *editor,
+                    int response,
+                    gpointer use_data)
+{
+	if (response == GTK_RESPONSE_HELP)
+	{
+		terminal_util_show_help ("mate-terminal-prefs", GTK_WINDOW (editor));
+		return;
+	}
+
+	gtk_widget_destroy (editor);
+}
+
+static void
+setup_background_filechooser (GtkWidget *filechooser,
+                              TerminalProfile *profile)
+{
+	GtkFileFilter *filter;
+	const char *home_dir;
+
+	filter = gtk_file_filter_new ();
+	gtk_file_filter_add_pixbuf_formats (filter);
+	gtk_file_filter_set_name (filter, _("Images"));
+	gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (filechooser), filter);
+
+	gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filechooser), TRUE);
+
+	/* Start filechooser in $HOME instead of the current dir of the factory which is "/" */
+	home_dir = g_get_home_dir ();
+	if (home_dir)
+		gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filechooser), home_dir);
+}
+
+static void
+profile_editor_destroyed (GtkWidget       *editor,
+                          TerminalProfile *profile)
+{
+	g_signal_handlers_disconnect_by_func (profile, G_CALLBACK (profile_forgotten_cb), editor);
+	g_signal_handlers_disconnect_by_func (profile, G_CALLBACK (profile_notify_sensitivity_cb), editor);
+	g_signal_handlers_disconnect_matched (profile, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
+	                                      G_CALLBACK (profile_colors_notify_scheme_combo_cb), NULL);
+	g_signal_handlers_disconnect_matched (profile, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
+	                                      G_CALLBACK (profile_palette_notify_scheme_combo_cb), NULL);
+	g_signal_handlers_disconnect_matched (profile, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
+	                                      G_CALLBACK (profile_palette_notify_colorpickers_cb), NULL);
+
+	g_object_set_data (G_OBJECT (profile), "editor-window", NULL);
+	g_object_set_data (G_OBJECT (editor), "builder", NULL);
+}
+
+static void
+terminal_profile_editor_focus_widget (GtkWidget *editor,
+                                      const char *widget_name)
+{
+	GtkBuilder *builder;
+	GtkWidget *widget, *page, *page_parent;
+
+	if (widget_name == NULL)
+		return;
+
+	builder = g_object_get_data (G_OBJECT (editor), "builder");
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, widget_name));
+	if (widget == NULL)
+		return;
+
+	page = widget;
+	while (page != NULL &&
+	        (page_parent = gtk_widget_get_parent (page)) != NULL &&
+	        !GTK_IS_NOTEBOOK (page_parent))
+		page = page_parent;
+
+	page_parent = gtk_widget_get_parent (page);
+	if (page != NULL && GTK_IS_NOTEBOOK (page_parent))
+	{
+		GtkNotebook *notebook;
+
+		notebook = GTK_NOTEBOOK (page_parent);
+		gtk_notebook_set_current_page (notebook, gtk_notebook_page_num (notebook, page));
+	}
+
+	if (gtk_widget_is_sensitive (widget))
+		gtk_widget_grab_focus (widget);
+}
+
+static gboolean
+on_profile_editor_notebook_scroll_event (GtkWidget        *widget,
+                                         GdkEventScroll   *event)
+{
+    GtkNotebook *notebook = GTK_NOTEBOOK (widget);
+    GtkWidget *child, *event_widget, *action_widget;
+
+    child = gtk_notebook_get_nth_page (notebook, gtk_notebook_get_current_page (notebook));
+    if (child == NULL)
+        return FALSE;
+
+    event_widget = gtk_get_event_widget ((GdkEvent*) event);
+
+    /* Ignore scroll events from the content of the page */
+    if (event_widget == NULL || event_widget == child || gtk_widget_is_ancestor (event_widget, child))
+        return FALSE;
+
+    /* And also from the action widgets */
+    action_widget = gtk_notebook_get_action_widget (notebook, GTK_PACK_START);
+    if (event_widget == action_widget || (action_widget != NULL && gtk_widget_is_ancestor (event_widget, action_widget)))
+        return FALSE;
+
+    action_widget = gtk_notebook_get_action_widget (notebook, GTK_PACK_END);
+    if (event_widget == action_widget || (action_widget != NULL && gtk_widget_is_ancestor (event_widget, action_widget)))
+        return FALSE;
+
+    switch (event->direction) {
+        case GDK_SCROLL_RIGHT:
+        case GDK_SCROLL_DOWN:
+            gtk_notebook_next_page (notebook);
+            break;
+        case GDK_SCROLL_LEFT:
+        case GDK_SCROLL_UP:
+            gtk_notebook_prev_page (notebook);
+            break;
+        case GDK_SCROLL_SMOOTH:
+            switch (gtk_notebook_get_tab_pos (notebook)) {
+                case GTK_POS_LEFT:
+                case GTK_POS_RIGHT:
+                    if (event->delta_y > 0)
+                        gtk_notebook_next_page (notebook);
+                    else if (event->delta_y < 0)
+                        gtk_notebook_prev_page (notebook);
+                    break;
+                case GTK_POS_TOP:
+                case GTK_POS_BOTTOM:
+                    if (event->delta_x > 0)
+                        gtk_notebook_next_page (notebook);
+                    else if (event->delta_x < 0)
+                        gtk_notebook_prev_page (notebook);
+                    break;
+            }
+            break;
+    }
+
+    return TRUE;
+}
+
+/**
+ * terminal_profile_edit:
+ * @profile: a #TerminalProfile
+ * @transient_parent: a #GtkWindow, or %NULL
+ * @widget_name: a widget name in the profile editor's UI, or %NULL
+ *
+ * Shows the profile editor with @profile, anchored to @transient_parent.
+ * If @widget_name is non-%NULL, focuses the corresponding widget and
+ * switches the notebook to its containing page.
+ */
+void
+terminal_profile_edit (TerminalProfile *profile,
+                       GtkWindow       *transient_parent,
+                       const char      *widget_name)
+{
+	GtkBuilder *builder;
+	GError *error = NULL;
+	GtkWidget *editor, *w;
+	guint i;
+
+	editor = g_object_get_data (G_OBJECT (profile), "editor-window");
+	if (editor)
+	{
+		terminal_profile_editor_focus_widget (editor, widget_name);
+
+		gtk_window_set_transient_for (GTK_WINDOW (editor),
+		                              GTK_WINDOW (transient_parent));
+		gtk_window_present (GTK_WINDOW (editor));
+		return;
+	}
+
+	builder = gtk_builder_new ();
+	gtk_builder_add_from_resource (builder, TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/profile-preferences.ui", &error);
+	g_assert_no_error (error);
+
+	editor = (GtkWidget *) gtk_builder_get_object  (builder, "profile-editor-dialog");
+	g_object_set_data_full (G_OBJECT (editor), "builder",
+	                        builder, (GDestroyNotify) g_object_unref);
+#ifndef ENABLE_SKEY
+	gtk_widget_hide (profile_editor_get_widget (editor, "use-skey-checkbutton"));
+#endif
+	/* Store the dialogue on the profile, so we can acccess it above to check if
+	 * there's already a profile editor for this profile.
+	 */
+	g_object_set_data (G_OBJECT (profile), "editor-window", editor);
+
+	g_signal_connect (editor, "destroy",
+	                  G_CALLBACK (profile_editor_destroyed),
+	                  profile);
+
+	g_signal_connect (editor, "response",
+	                  G_CALLBACK (editor_response_cb),
+	                  NULL);
+
+	w = (GtkWidget *) gtk_builder_get_object  (builder, "color-scheme-combobox");
+	init_color_scheme_menu (w);
+
+	w = (GtkWidget *) gtk_builder_get_object  (builder, "darken-background-scale");
+	init_background_darkness_scale (w);
+
+	w = (GtkWidget *) gtk_builder_get_object  (builder, "background-image-filechooser");
+	setup_background_filechooser (w, profile);
+
+	/* Hook up the palette colorpickers and combo box */
+
+	for (i = 0; i < TERMINAL_PALETTE_SIZE; ++i)
+	{
+		char name[32];
+		char *text;
+
+		g_snprintf (name, sizeof (name), "palette-colorpicker-%u", i + 1);
+		w = (GtkWidget *) gtk_builder_get_object  (builder, name);
+
+		g_object_set_data (G_OBJECT (w), "palette-entry-index", GUINT_TO_POINTER (i));
+
+		text = g_strdup_printf (_("Choose Palette Color %d"), i + 1);
+		gtk_color_button_set_title (GTK_COLOR_BUTTON (w), text);
+		g_free (text);
+
+		text = g_strdup_printf (_("Palette entry %d"), i + 1);
+		gtk_widget_set_tooltip_text (w, text);
+		g_free (text);
+
+		g_signal_connect (w, "notify::rgba",
+		                  G_CALLBACK (palette_color_notify_cb),
+		                  profile);
+	}
+
+	profile_palette_notify_colorpickers_cb (profile, NULL, editor);
+	g_signal_connect (profile, "notify::" TERMINAL_PROFILE_PALETTE,
+	                  G_CALLBACK (profile_palette_notify_colorpickers_cb),
+	                  editor);
+
+	w = (GtkWidget *) gtk_builder_get_object  (builder, "palette-combobox");
+	g_signal_connect (w, "notify::active",
+	                  G_CALLBACK (palette_scheme_combo_changed_cb),
+	                  profile);
+
+	profile_palette_notify_scheme_combo_cb (profile, NULL, GTK_COMBO_BOX (w));
+	g_signal_connect (profile, "notify::" TERMINAL_PROFILE_PALETTE,
+	                  G_CALLBACK (profile_palette_notify_scheme_combo_cb),
+	                  w);
+
+	/* Hook up the color scheme pickers and combo box */
+	w = (GtkWidget *) gtk_builder_get_object  (builder, "color-scheme-combobox");
+	g_signal_connect (w, "notify::active",
+	                  G_CALLBACK (color_scheme_combo_changed_cb),
+	                  profile);
+
+	profile_colors_notify_scheme_combo_cb (profile, NULL, GTK_COMBO_BOX (w));
+	g_signal_connect (profile, "notify::" TERMINAL_PROFILE_FOREGROUND_COLOR,
+	                  G_CALLBACK (profile_colors_notify_scheme_combo_cb),
+	                  w);
+	g_signal_connect (profile, "notify::" TERMINAL_PROFILE_BACKGROUND_COLOR,
+	                  G_CALLBACK (profile_colors_notify_scheme_combo_cb),
+	                  w);
+
+#define CONNECT_WITH_FLAGS(name, prop, flags) terminal_util_bind_object_property_to_widget (G_OBJECT (profile), prop, (GtkWidget *) gtk_builder_get_object (builder, name), flags)
+#define CONNECT(name, prop) CONNECT_WITH_FLAGS (name, prop, 0)
+#define SET_ENUM_VALUE(name, value) g_object_set_data (gtk_builder_get_object (builder, name), "enum-value", GINT_TO_POINTER (value))
+
+	w = GTK_WIDGET (gtk_builder_get_object (builder, "custom-command-entry"));
+	custom_command_entry_changed_cb (GTK_ENTRY (w));
+	g_signal_connect (w, "changed",
+	                  G_CALLBACK (custom_command_entry_changed_cb), NULL);
+	w = GTK_WIDGET (gtk_builder_get_object (builder, "profile-name-entry"));
+	g_signal_connect (w, "changed",
+	                  G_CALLBACK (visible_name_entry_changed_cb), editor);
+
+	g_signal_connect (gtk_builder_get_object  (builder, "reset-compat-defaults-button"),
+	                  "clicked",
+	                  G_CALLBACK (reset_compat_defaults_cb),
+	                  profile);
+
+	SET_ENUM_VALUE ("image-radiobutton", TERMINAL_BACKGROUND_IMAGE);
+	SET_ENUM_VALUE ("solid-radiobutton", TERMINAL_BACKGROUND_SOLID);
+	SET_ENUM_VALUE ("transparent-radiobutton", TERMINAL_BACKGROUND_TRANSPARENT);
+	CONNECT ("allow-bold-checkbutton", TERMINAL_PROFILE_ALLOW_BOLD);
+	CONNECT ("background-colorpicker", TERMINAL_PROFILE_BACKGROUND_COLOR);
+	CONNECT ("background-image-filechooser", TERMINAL_PROFILE_BACKGROUND_IMAGE_FILE);
+	CONNECT ("backspace-binding-combobox", TERMINAL_PROFILE_BACKSPACE_BINDING);
+	CONNECT ("bold-color-same-as-fg-checkbox", TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG);
+	CONNECT ("bold-colorpicker", TERMINAL_PROFILE_BOLD_COLOR);
+	CONNECT ("cursor-shape-combobox", TERMINAL_PROFILE_CURSOR_SHAPE);
+	CONNECT ("cursor-blink-combobox", TERMINAL_PROFILE_CURSOR_BLINK_MODE);
+	CONNECT ("custom-command-entry", TERMINAL_PROFILE_CUSTOM_COMMAND);
+	CONNECT ("darken-background-scale", TERMINAL_PROFILE_BACKGROUND_DARKNESS);
+	CONNECT ("default-size-columns-spinbutton", TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS);
+	CONNECT ("default-size-rows-spinbutton", TERMINAL_PROFILE_DEFAULT_SIZE_ROWS);
+	CONNECT ("delete-binding-combobox", TERMINAL_PROFILE_DELETE_BINDING);
+	CONNECT ("exit-action-combobox", TERMINAL_PROFILE_EXIT_ACTION);
+	CONNECT ("font-selector", TERMINAL_PROFILE_FONT);
+	CONNECT ("foreground-colorpicker", TERMINAL_PROFILE_FOREGROUND_COLOR);
+	CONNECT ("image-radiobutton", TERMINAL_PROFILE_BACKGROUND_TYPE);
+	CONNECT ("login-shell-checkbutton", TERMINAL_PROFILE_LOGIN_SHELL);
+	CONNECT ("profile-name-entry", TERMINAL_PROFILE_VISIBLE_NAME);
+	CONNECT ("scrollback-lines-spinbutton", TERMINAL_PROFILE_SCROLLBACK_LINES);
+	CONNECT ("scrollback-unlimited-checkbutton", TERMINAL_PROFILE_SCROLLBACK_UNLIMITED);
+	CONNECT ("scroll-background-checkbutton", TERMINAL_PROFILE_SCROLL_BACKGROUND);
+	CONNECT ("scrollbar-position-combobox", TERMINAL_PROFILE_SCROLLBAR_POSITION);
+	CONNECT ("scroll-on-keystroke-checkbutton", TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE);
+	CONNECT ("scroll-on-output-checkbutton", TERMINAL_PROFILE_SCROLL_ON_OUTPUT);
+	CONNECT ("show-menubar-checkbutton", TERMINAL_PROFILE_DEFAULT_SHOW_MENUBAR);
+	CONNECT ("solid-radiobutton", TERMINAL_PROFILE_BACKGROUND_TYPE);
+	CONNECT ("system-font-checkbutton", TERMINAL_PROFILE_USE_SYSTEM_FONT);
+	CONNECT ("title-entry", TERMINAL_PROFILE_TITLE);
+	CONNECT ("title-mode-combobox", TERMINAL_PROFILE_TITLE_MODE);
+	CONNECT ("transparent-radiobutton", TERMINAL_PROFILE_BACKGROUND_TYPE);
+	CONNECT ("use-custom-command-checkbutton", TERMINAL_PROFILE_USE_CUSTOM_COMMAND);
+	CONNECT ("use-custom-default-size-checkbutton", TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE);
+	CONNECT ("use-theme-colors-checkbutton", TERMINAL_PROFILE_USE_THEME_COLORS);
+	CONNECT ("word-chars-entry", TERMINAL_PROFILE_WORD_CHARS);
+	CONNECT_WITH_FLAGS ("bell-checkbutton", TERMINAL_PROFILE_SILENT_BELL, FLAG_INVERT_BOOL);
+	/* CONNECT_WITH_FLAGS ("copy-checkbutton", TERMINAL_PROFILE_COPY_SELECTION, FLAG_INVERT_BOOL); */
+	CONNECT ("copy-checkbutton", TERMINAL_PROFILE_COPY_SELECTION);
+#ifdef ENABLE_SKEY
+	CONNECT ("use-skey-checkbutton", TERMINAL_PROFILE_USE_SKEY);
+#endif
+	CONNECT ("use-urls-checkbutton", TERMINAL_PROFILE_USE_URLS);
+
+#undef CONNECT
+#undef CONNECT_WITH_FLAGS
+#undef SET_ENUM_VALUE
+
+	profile_notify_sensitivity_cb (profile, NULL, editor);
+	g_signal_connect (profile, "notify",
+	                  G_CALLBACK (profile_notify_sensitivity_cb),<--- You might need to cast the function pointer here
+	                  editor);
+	g_signal_connect (profile,
+	                  "forgotten",
+	                  G_CALLBACK (profile_forgotten_cb),
+	                  editor);
+
+	terminal_profile_editor_focus_widget (editor, widget_name);
+
+    w = GTK_WIDGET (gtk_builder_get_object (builder, "profile-editor-notebook"));
+    gtk_widget_add_events (w, GDK_SCROLL_MASK);
+    g_signal_connect (w,
+                      "scroll-event",
+                      G_CALLBACK (on_profile_editor_notebook_scroll_event),
+                      NULL);
+
+	gtk_window_set_transient_for (GTK_WINDOW (editor),
+	                              GTK_WINDOW (transient_parent));
+	gtk_window_present (GTK_WINDOW (editor));
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/12.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/12.html new file mode 100644 index 0000000..ed95028 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/12.html @@ -0,0 +1,293 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
/*
+ * Copyright © 2002 Havoc Pennington
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * 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 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TERMINAL_INTL_H
+#define TERMINAL_INTL_H
+
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define I_(string) g_intern_static_string (string)
+
+#endif /* TERMINAL_INTL_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/13.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/13.html new file mode 100644 index 0000000..0268721 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/13.html @@ -0,0 +1,625 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * Copyright © 2001 Havoc Pennington
+ * Copyright © 2002 Mathias Hasselmann
+ * Copyright © 2008 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * 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 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TERMINAL_PROFILE_H
+#define TERMINAL_PROFILE_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+typedef enum
+{
+    /* this has to be kept in sync with the option menu in the profile editor UI file */
+    TERMINAL_TITLE_REPLACE,
+    TERMINAL_TITLE_BEFORE,
+    TERMINAL_TITLE_AFTER,
+    TERMINAL_TITLE_IGNORE
+} TerminalTitleMode;
+
+typedef enum
+{
+    TERMINAL_SCROLLBAR_LEFT,
+    TERMINAL_SCROLLBAR_RIGHT,
+    TERMINAL_SCROLLBAR_HIDDEN
+} TerminalScrollbarPosition;
+
+typedef enum
+{
+    TERMINAL_EXIT_CLOSE,
+    TERMINAL_EXIT_RESTART,
+    TERMINAL_EXIT_HOLD
+} TerminalExitAction;
+
+typedef enum
+{
+    TERMINAL_BACKGROUND_SOLID,
+    TERMINAL_BACKGROUND_IMAGE,
+    TERMINAL_BACKGROUND_TRANSPARENT
+} TerminalBackgroundType;
+
+#define TERMINAL_PALETTE_SIZE 16
+
+#define TERMINAL_PALETTE_TANGO 0
+#define TERMINAL_PALETTE_LINUX 1
+#define TERMINAL_PALETTE_XTERM 2
+#define TERMINAL_PALETTE_RXVT 3
+#define TERMINAL_PALETTE_SOLARIZED 4
+#define TERMINAL_PALETTE_N_BUILTINS 5
+
+/* Property names */
+#define TERMINAL_PROFILE_ALLOW_BOLD             "allow-bold"
+#define TERMINAL_PROFILE_BACKGROUND_COLOR       "background-color"
+#define TERMINAL_PROFILE_BACKGROUND_DARKNESS    "background-darkness"
+#define TERMINAL_PROFILE_BACKGROUND_IMAGE       "background-image"
+#define TERMINAL_PROFILE_BACKGROUND_IMAGE_FILE  "background-image-file"
+#define TERMINAL_PROFILE_BACKGROUND_TYPE        "background-type"
+#define TERMINAL_PROFILE_BACKSPACE_BINDING      "backspace-binding"
+#define TERMINAL_PROFILE_BOLD_COLOR             "bold-color"
+#define TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG  "bold-color-same-as-fg"
+#define TERMINAL_PROFILE_CURSOR_BLINK_MODE      "cursor-blink-mode"
+#define TERMINAL_PROFILE_CURSOR_SHAPE           "cursor-shape"
+#define TERMINAL_PROFILE_CUSTOM_COMMAND         "custom-command"
+#define TERMINAL_PROFILE_DEFAULT_SHOW_MENUBAR   "default-show-menubar"
+#define TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS   "default-size-columns"
+#define TERMINAL_PROFILE_DEFAULT_SIZE_ROWS      "default-size-rows"
+#define TERMINAL_PROFILE_DELETE_BINDING         "delete-binding"
+#define TERMINAL_PROFILE_EXIT_ACTION            "exit-action"
+#define TERMINAL_PROFILE_FONT                   "font"
+#define TERMINAL_PROFILE_FOREGROUND_COLOR       "foreground-color"
+#define TERMINAL_PROFILE_LOGIN_SHELL            "login-shell"
+#define TERMINAL_PROFILE_NAME                   "name"
+#define TERMINAL_PROFILE_PALETTE                "palette"
+#define TERMINAL_PROFILE_SCROLL_BACKGROUND      "scroll-background"
+#define TERMINAL_PROFILE_SCROLLBACK_LINES       "scrollback-lines"
+#define TERMINAL_PROFILE_SCROLLBACK_UNLIMITED   "scrollback-unlimited"
+#define TERMINAL_PROFILE_SCROLLBAR_POSITION     "scrollbar-position"
+#define TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE    "scroll-on-keystroke"
+#define TERMINAL_PROFILE_SCROLL_ON_OUTPUT       "scroll-on-output"
+#define TERMINAL_PROFILE_SILENT_BELL            "silent-bell"
+#define TERMINAL_PROFILE_COPY_SELECTION         "copy-selection"
+#define TERMINAL_PROFILE_TITLE_MODE             "title-mode"
+#define TERMINAL_PROFILE_TITLE                  "title"
+#define TERMINAL_PROFILE_USE_CUSTOM_COMMAND     "use-custom-command"
+#define TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE "use-custom-default-size"
+#define TERMINAL_PROFILE_USE_SKEY               "use-skey"
+#define TERMINAL_PROFILE_USE_URLS               "use-urls"
+#define TERMINAL_PROFILE_USE_SYSTEM_FONT        "use-system-font"
+#define TERMINAL_PROFILE_USE_THEME_COLORS       "use-theme-colors"
+#define TERMINAL_PROFILE_VISIBLE_NAME           "visible-name"
+#define TERMINAL_PROFILE_WORD_CHARS             "word-chars"
+
+/* TerminalProfile object */
+
+#define TERMINAL_TYPE_PROFILE              (terminal_profile_get_type ())
+#define TERMINAL_PROFILE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), TERMINAL_TYPE_PROFILE, TerminalProfile))
+#define TERMINAL_PROFILE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_PROFILE, TerminalProfileClass))
+#define TERMINAL_IS_PROFILE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), TERMINAL_TYPE_PROFILE))
+#define TERMINAL_IS_PROFILE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_PROFILE))
+#define TERMINAL_PROFILE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_PROFILE, TerminalProfileClass))
+
+typedef struct _TerminalProfile        TerminalProfile;
+typedef struct _TerminalProfileClass   TerminalProfileClass;
+typedef struct _TerminalProfilePrivate TerminalProfilePrivate;
+
+struct _TerminalProfile
+{
+	GObject parent_instance;
+
+	TerminalProfilePrivate *priv;
+};
+
+struct _TerminalProfileClass
+{
+	GObjectClass parent_class;
+
+	void (* forgotten) (TerminalProfile           *profile);
+
+	GHashTable *gsettings_keys;
+};
+
+GType             terminal_profile_get_type               (void);
+
+TerminalProfile* _terminal_profile_new                    (const char *name);
+
+void             _terminal_profile_forget                 (TerminalProfile *profile);
+
+gboolean         _terminal_profile_get_forgotten          (TerminalProfile *profile);
+
+TerminalProfile* _terminal_profile_clone                  (TerminalProfile *base_profile,
+        const char *visible_name);
+
+gboolean          terminal_profile_property_locked        (TerminalProfile *profile,
+        const char *prop_name);
+
+void              terminal_profile_reset_property         (TerminalProfile *profile,
+        const char *prop_name);
+
+gboolean          terminal_profile_get_property_boolean   (TerminalProfile *profile,
+        const char *prop_name);
+
+gconstpointer     terminal_profile_get_property_boxed     (TerminalProfile *profile,
+        const char *prop_name);
+
+double            terminal_profile_get_property_double    (TerminalProfile *profile,
+        const char *prop_name);
+
+int               terminal_profile_get_property_enum      (TerminalProfile *profile,
+        const char *prop_name);
+
+int               terminal_profile_get_property_int       (TerminalProfile *profile,
+        const char *prop_name);
+
+gpointer          terminal_profile_get_property_object    (TerminalProfile *profile,
+        const char *prop_name);
+
+const char*       terminal_profile_get_property_string    (TerminalProfile *profile,
+        const char *prop_name);
+
+gboolean          terminal_profile_get_palette            (TerminalProfile *profile,
+        GdkRGBA *colors,
+        guint *n_colors);
+
+gboolean          terminal_profile_get_palette_is_builtin (TerminalProfile *profile,
+        guint *n);
+
+void              terminal_profile_set_palette_builtin    (TerminalProfile *profile,
+        guint n);
+
+gboolean          terminal_profile_modify_palette_entry   (TerminalProfile *profile,
+        guint            i,
+        const GdkRGBA  *color);
+
+G_END_DECLS
+
+#endif /* TERMINAL_PROFILE_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/14.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/14.html new file mode 100644 index 0000000..6405c1b --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/14.html @@ -0,0 +1,307 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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 © 2002 Havoc Pennington
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * 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 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TERMINAL_PROFILE_EDITOR_H
+#define TERMINAL_PROFILE_EDITOR_H
+
+#include "terminal-profile.h"
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+void terminal_profile_edit (TerminalProfile *profile,
+                            GtkWindow       *transient_parent,
+                            const char      *widget_name);
+
+G_END_DECLS
+
+#endif /* TERMINAL_PROFILE_EDITOR_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/15.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/15.html new file mode 100644 index 0000000..50b08b1 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/15.html @@ -0,0 +1,459 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * Copyright © 2001 Havoc Pennington
+ * Copyright © 2008 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * 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 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TERMINAL_UTIL_H
+#define TERMINAL_UTIL_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-screen.h"
+
+G_BEGIN_DECLS
+
+#define CONF_PROXY_SCHEMA      "org.gnome.system.proxy"
+#define CONF_HTTP_PROXY_SCHEMA "org.gnome.system.proxy.http"
+#define CONF_HTTPS_PROXY_SCHEMA "org.gnome.system.proxy.https"
+#define CONF_FTP_PROXY_SCHEMA "org.gnome.system.proxy.ftp"
+#define CONF_SOCKS_PROXY_SCHEMA "org.gnome.system.proxy.socks"
+
+void terminal_util_set_unique_role (GtkWindow *window, const char *prefix);
+
+void terminal_util_show_error_dialog (GtkWindow *transient_parent,
+                                      GtkWidget **weap_ptr,
+                                      GError *error,
+                                      const char *message_format, ...) G_GNUC_PRINTF(4, 5);
+
+void terminal_util_show_help (const char *topic, GtkWindow  *transient_parent);
+
+void terminal_util_set_labelled_by          (GtkWidget  *widget,
+        GtkLabel   *label);
+void terminal_util_set_atk_name_description (GtkWidget  *widget,
+        const char *name,
+        const char *desc);
+
+void terminal_util_open_url (GtkWidget *parent,
+                             const char *orig_url,
+                             TerminalURLFlavor flavor,
+                             guint32 user_time);
+
+char *terminal_util_resolve_relative_path (const char *path,
+        const char *relative_path);
+
+void terminal_util_transform_uris_to_quoted_fuse_paths (char **uris);
+
+char *terminal_util_concat_uris (char **uris,
+                                 gsize *length);
+
+char *terminal_util_get_licence_text (void);
+
+gboolean terminal_util_load_builder_resource (const char *path,
+        const char *object_name,
+        ...);
+
+gboolean terminal_util_dialog_response_on_delete (GtkWindow *widget);
+
+void terminal_util_key_file_set_string_escape    (GKeyFile *key_file,
+        const char *group,
+        const char *key,
+        const char *string);
+char *terminal_util_key_file_get_string_unescape (GKeyFile *key_file,
+        const char *group,
+        const char *key,
+        GError **error);
+
+void terminal_util_key_file_set_argv      (GKeyFile *key_file,
+        const char *group,
+        const char *key,
+        int argc,
+        char **argv);
+char **terminal_util_key_file_get_argv    (GKeyFile *key_file,
+        const char *group,
+        const char *key,
+        int *argc,
+        GError **error);
+
+void terminal_util_add_proxy_env (GHashTable *env_table);
+
+typedef enum
+{
+    FLAG_INVERT_BOOL  = 1 << 0,
+} PropertyChangeFlags;
+
+void terminal_util_bind_object_property_to_widget (GObject *object,
+        const char *object_prop,
+        GtkWidget *widget,
+        PropertyChangeFlags flags);
+
+void terminal_util_x11_clear_demands_attention (GdkWindow *window);
+
+char *terminal_util_hyperlink_uri_label (const char *str);
+
+G_END_DECLS
+
+#endif /* TERMINAL_UTIL_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/16.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/16.html new file mode 100644 index 0000000..c8e4ee1 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/16.html @@ -0,0 +1,565 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * Copyright © 2001 Havoc Pennington
+ * Copyright © 2008 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * 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 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TERMINAL_SCREEN_H
+#define TERMINAL_SCREEN_H
+
+#include <vte/vte.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-profile.h"
+
+G_BEGIN_DECLS
+
+typedef enum
+{
+    FLAVOR_AS_IS,
+    FLAVOR_DEFAULT_TO_HTTP,
+    FLAVOR_VOIP_CALL,
+    FLAVOR_EMAIL,
+    FLAVOR_SKEY
+} TerminalURLFlavor;
+
+/* Forward decls */
+typedef struct _TerminalScreenPopupInfo TerminalScreenPopupInfo;
+typedef struct _TerminalWindow        TerminalWindow;
+
+#define TERMINAL_TYPE_SCREEN              (terminal_screen_get_type ())
+#define TERMINAL_SCREEN(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), TERMINAL_TYPE_SCREEN, TerminalScreen))
+#define TERMINAL_SCREEN_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_SCREEN, TerminalScreenClass))
+#define TERMINAL_IS_SCREEN(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), TERMINAL_TYPE_SCREEN))
+#define TERMINAL_IS_SCREEN_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_SCREEN))
+#define TERMINAL_SCREEN_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_SCREEN, TerminalScreenClass))
+
+typedef struct _TerminalScreen        TerminalScreen;
+typedef struct _TerminalScreenClass   TerminalScreenClass;
+typedef struct _TerminalScreenPrivate TerminalScreenPrivate;
+
+struct _TerminalScreen
+{
+	VteTerminal parent_instance;
+
+	TerminalScreenPrivate *priv;
+};
+
+struct _TerminalScreenClass
+{
+	VteTerminalClass parent_class;
+
+	void (* profile_set)        (TerminalScreen *screen,
+	                             TerminalProfile *old_profile);
+	void (* show_popup_menu)    (TerminalScreen *screen,
+	                             TerminalScreenPopupInfo *info);
+	gboolean (* match_clicked)  (TerminalScreen *screen,
+	                             const char *url,
+	                             int url_flavor,
+	                             guint state);
+	void (* close_screen)       (TerminalScreen *screen);
+};
+
+GType terminal_screen_get_type (void) G_GNUC_CONST;
+
+TerminalScreen *terminal_screen_new (TerminalProfile *profile,
+                                     char           **override_command,
+                                     const char      *title,
+                                     const char      *working_dir,
+                                     char           **child_env,
+                                     double           zoom);
+
+void terminal_screen_set_profile (TerminalScreen *screen,
+                                  TerminalProfile *profile);
+TerminalProfile* terminal_screen_get_profile (TerminalScreen *screen);
+
+void         terminal_screen_set_override_command (TerminalScreen  *screen,
+        char           **argv);
+const char** terminal_screen_get_override_command (TerminalScreen  *screen);
+
+void         terminal_screen_set_initial_environment (TerminalScreen  *screen,
+        char           **argv);
+char **      terminal_screen_get_initial_environment (TerminalScreen  *screen);
+
+const char* terminal_screen_get_raw_title      (TerminalScreen *screen);
+const char* terminal_screen_get_title          (TerminalScreen *screen);
+const char* terminal_screen_get_icon_title     (TerminalScreen *screen);
+gboolean    terminal_screen_get_icon_title_set (TerminalScreen *screen);
+
+void terminal_screen_set_user_title (TerminalScreen *screen,
+                                     const char *text);
+
+void        terminal_screen_set_override_title     (TerminalScreen *screen,
+        const char     *title);
+
+const char *terminal_screen_get_dynamic_title      (TerminalScreen *screen);
+const char *terminal_screen_get_dynamic_icon_title (TerminalScreen *screen);
+
+char *terminal_screen_get_current_dir (TerminalScreen *screen);
+char *terminal_screen_get_current_dir_with_fallback (TerminalScreen *screen);
+
+void        terminal_screen_set_font (TerminalScreen *screen);
+void        terminal_screen_set_font_scale    (TerminalScreen *screen,
+        double          factor);
+double      terminal_screen_get_font_scale    (TerminalScreen *screen);
+
+void       terminal_screen_get_size (TerminalScreen *screen,
+                                     int *width_chars,
+                                     int *height_chars);
+void       terminal_screen_get_cell_size (TerminalScreen *screen,
+        int *width_chars,
+        int *height_chars);
+
+void _terminal_screen_update_scrollbar (TerminalScreen *screen);
+
+void terminal_screen_save_config (TerminalScreen *screen,
+                                  GKeyFile *key_file,
+                                  const char *group);
+
+gboolean terminal_screen_has_foreground_process (TerminalScreen *screen);
+
+/* Allow scales a bit smaller and a bit larger than the usual pango ranges */
+#define TERMINAL_SCALE_XXX_SMALL   (PANGO_SCALE_XX_SMALL/1.2)
+#define TERMINAL_SCALE_XXXX_SMALL  (TERMINAL_SCALE_XXX_SMALL/1.2)
+#define TERMINAL_SCALE_XXXXX_SMALL (TERMINAL_SCALE_XXXX_SMALL/1.2)
+#define TERMINAL_SCALE_XXX_LARGE   (PANGO_SCALE_XX_LARGE*1.2)
+#define TERMINAL_SCALE_XXXX_LARGE  (TERMINAL_SCALE_XXX_LARGE*1.2)
+#define TERMINAL_SCALE_XXXXX_LARGE (TERMINAL_SCALE_XXXX_LARGE*1.2)
+#define TERMINAL_SCALE_MINIMUM     (TERMINAL_SCALE_XXXXX_SMALL/1.2)
+#define TERMINAL_SCALE_MAXIMUM     (TERMINAL_SCALE_XXXXX_LARGE*1.2)
+
+struct _TerminalScreenPopupInfo
+{
+	int ref_count;
+	TerminalWindow *window;
+	TerminalScreen *screen;
+	char *url;
+	char *hyperlink;
+	TerminalURLFlavor flavor;
+	guint button;
+	guint state;
+	guint32 timestamp;
+};
+
+TerminalScreenPopupInfo *terminal_screen_popup_info_ref (TerminalScreenPopupInfo *info);
+
+void terminal_screen_popup_info_unref (TerminalScreenPopupInfo *info);
+
+G_END_DECLS
+
+#endif /* TERMINAL_SCREEN_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/17.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/17.html new file mode 100644 index 0000000..056b9e5 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/17.html @@ -0,0 +1,725 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * Copyright © 2002 Jonathan Blandford <jrb@gnome.org>
+ * Copyright © 2008 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * Mate-terminal 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-intl.h"
+
+#include "terminal-util.h"
+#include "terminal-screen.h"
+#include "skey-popup.h"
+#include "skey/skey.h"
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define SKEY_PREFIX "s/key "
+#define OTP_PREFIX  "otp-"
+
+typedef struct
+{
+	TerminalScreen *screen;
+	char *seed;
+	int seq;
+	int hash;
+} SkeyData;
+
+static void
+skey_data_free (SkeyData *data)
+{
+	g_free (data->seed);
+	g_free (data);
+}
+
+static gboolean
+extract_seq_and_seed (const gchar  *skey_match,
+                      gint         *seq,
+                      gchar       **seed)
+{
+	gchar *end_ptr = NULL;
+
+	/* FIXME: use g_ascii_strtoll */
+	*seq = strtol (skey_match + strlen (SKEY_PREFIX), &end_ptr, 0);
+
+	if (end_ptr == NULL || *end_ptr == '\000')
+		return FALSE;
+
+	*seed = g_strdup (end_ptr + 1);
+
+	return TRUE;
+}
+
+static gboolean
+extract_hash_seq_and_seed (const gchar  *otp_match,
+                           gint         *hash,
+                           gint         *seq,
+                           gchar       **seed)
+{
+	gchar *end_ptr = NULL;
+	const gchar *p = otp_match + strlen (OTP_PREFIX);
+	gint len = 3;
+
+	if (strncmp (p, "md4", 3) == 0)
+		*hash = MD4;
+	else if (strncmp (p, "md5", 3) == 0)
+		*hash = MD5;
+	else if (strncmp (p, "sha1", 4) == 0)
+	{
+		*hash = SHA1;
+		len++;
+	}
+	else
+		return FALSE;
+
+	p += len;
+
+	/* RFC mandates the following skipping */
+	while (*p == ' ' || *p == '\t')<--- outer condition: *p==' '||*p=='\t'
+	{
+		if (*p == '\0')<--- opposite inner condition: *p=='\0'
+			return FALSE;
+
+		p++;
+	}
+
+	/* FIXME: use g_ascii_strtoll */
+	*seq = strtol (p, &end_ptr, 0);
+
+	if (end_ptr == NULL || *end_ptr == '\000')
+		return FALSE;
+
+	p = end_ptr;
+
+	while (*p == ' ' || *p == '\t')<--- outer condition: *p==' '||*p=='\t'
+	{
+		if (*p == '\0')<--- opposite inner condition: *p=='\0'
+			return FALSE;
+		p++;
+	}
+
+	*seed = g_strdup (p);
+	return TRUE;
+}
+
+static void
+skey_challenge_response_cb (GtkWidget *dialog,
+                            int response_id,
+                            SkeyData *data)
+{
+	if (response_id == GTK_RESPONSE_OK)
+	{
+		GtkWidget *entry;
+		const char *password;
+		char *response;
+
+		entry = g_object_get_data (G_OBJECT (dialog), "skey-entry");
+		password = gtk_entry_get_text (GTK_ENTRY (entry));
+
+		/* FIXME: fix skey to use g_malloc */
+		response = skey (data->hash, data->seq, data->seed, password);
+		if (response)
+		{
+			VteTerminal *vte_terminal = VTE_TERMINAL (data->screen);
+			static const char newline[2] = "\n";
+
+			vte_terminal_feed_child (vte_terminal, response, strlen (response));
+			vte_terminal_feed_child (vte_terminal, newline, strlen (newline));
+			free (response);
+		}
+	}
+
+	gtk_widget_destroy (dialog);
+}
+
+void
+terminal_skey_do_popup (GtkWindow *window,
+                        TerminalScreen *screen,
+                        const gchar    *skey_match)
+{
+	GtkWidget *dialog, *label, *entry, *ok_button;
+	char *title_text;
+	char *seed;
+	int seq;
+	int hash = MD5;
+	SkeyData *data;
+
+	if (strncmp (SKEY_PREFIX, skey_match, strlen (SKEY_PREFIX)) == 0)
+	{
+		if (!extract_seq_and_seed (skey_match, &seq, &seed))
+		{
+			terminal_util_show_error_dialog (window, NULL, NULL,
+			                                 _("The text you clicked on doesn't "
+			                                   "seem to be a valid S/Key "
+			                                   "challenge."));
+			return;
+		}
+	}
+	else
+	{
+		if (!extract_hash_seq_and_seed (skey_match, &hash, &seq, &seed))
+		{
+			terminal_util_show_error_dialog (window, NULL, NULL,
+			                                 _("The text you clicked on doesn't "
+			                                   "seem to be a valid OTP "
+			                                   "challenge."));
+			return;
+		}
+	}
+
+	if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/skey-challenge.ui",
+	                                      "skey-dialog", &dialog,
+	                                      "skey-entry", &entry,
+	                                      "text-label", &label,
+	                                      "skey-ok-button", &ok_button,
+	                                      NULL))
+	{
+		g_free (seed);
+		return;
+	}
+
+	title_text = g_strdup_printf ("<big><b>%s</b></big>",
+	                              gtk_label_get_text (GTK_LABEL (label)));
+	gtk_label_set_label (GTK_LABEL (label), title_text);
+	g_free (title_text);
+
+	g_object_set_data (G_OBJECT (dialog), "skey-entry", entry);
+
+	gtk_widget_grab_focus (entry);
+	gtk_widget_grab_default (ok_button);
+	gtk_entry_set_text (GTK_ENTRY (entry), "");
+
+	gtk_window_set_transient_for (GTK_WINDOW (dialog), window);
+	gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+	gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
+
+	/* FIXME: make this dialogue close if the screen closes! */
+
+	data = g_new (SkeyData, 1);
+	data->hash = hash;
+	data->seq = seq;
+	data->seed = seed;
+	data->screen = screen;
+
+	g_signal_connect_data (dialog, "response",
+	                       G_CALLBACK (skey_challenge_response_cb),
+	                       data, (GClosureNotify) skey_data_free, 0);
+	g_signal_connect (dialog, "delete-event",
+	                  G_CALLBACK (terminal_util_dialog_response_on_delete), NULL);
+
+	gtk_window_present (GTK_WINDOW (dialog));
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/18.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/18.html new file mode 100644 index 0000000..f96ae38 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/18.html @@ -0,0 +1,309 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
/*
+ * Copyright © 2002 Jonathan Blandford <jrb@redhat.com>
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * 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 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SKEY_POPUP_H
+#define SKEY_POPUP_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-screen.h"
+
+G_BEGIN_DECLS
+
+void terminal_skey_do_popup (GtkWindow *window,
+                             TerminalScreen *screen,
+                             const gchar    *skey_match);
+
+G_END_DECLS
+
+#endif /* SKEY_POPUP_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/19.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/19.html new file mode 100644 index 0000000..8e7fce7 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/19.html @@ -0,0 +1,843 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * This code is imported from Bollcore's S/KEY + some simple glib adaptations
+ * (See rfc2289 and rfc1760)
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "skey.h"
+#include "btoe.h"
+
+static guint32 extract (char *s, int start, int length);
+
+/* Dictionary for integer-word translations */
+static const char Wp[2048][4] = { "A", "ABE", "ACE", "ACT", "AD", "ADA", "ADD",
+                                  "AGO", "AID", "AIM", "AIR", "ALL", "ALP", "AM", "AMY", "AN", "ANA",
+                                  "AND", "ANN", "ANT", "ANY", "APE", "APS", "APT", "ARC", "ARE", "ARK",
+                                  "ARM", "ART", "AS", "ASH", "ASK", "AT", "ATE", "AUG", "AUK", "AVE",
+                                  "AWE", "AWK", "AWL", "AWN", "AX", "AYE", "BAD", "BAG", "BAH", "BAM",
+                                  "BAN", "BAR", "BAT", "BAY", "BE", "BED", "BEE", "BEG", "BEN", "BET",
+                                  "BEY", "BIB", "BID", "BIG", "BIN", "BIT", "BOB", "BOG", "BON", "BOO",
+                                  "BOP", "BOW", "BOY", "BUB", "BUD", "BUG", "BUM", "BUN", "BUS", "BUT",
+                                  "BUY", "BY", "BYE", "CAB", "CAL", "CAM", "CAN", "CAP", "CAR", "CAT",
+                                  "CAW", "COD", "COG", "COL", "CON", "COO", "COP", "COT", "COW", "COY",
+                                  "CRY", "CUB", "CUE", "CUP", "CUR", "CUT", "DAB", "DAD", "DAM", "DAN",
+                                  "DAR", "DAY", "DEE", "DEL", "DEN", "DES", "DEW", "DID", "DIE", "DIG",
+                                  "DIN", "DIP", "DO", "DOE", "DOG", "DON", "DOT", "DOW", "DRY", "DUB",
+                                  "DUD", "DUE", "DUG", "DUN", "EAR", "EAT", "ED", "EEL", "EGG", "EGO",
+                                  "ELI", "ELK", "ELM", "ELY", "EM", "END", "EST", "ETC", "EVA", "EVE",
+                                  "EWE", "EYE", "FAD", "FAN", "FAR", "FAT", "FAY", "FED", "FEE", "FEW",
+                                  "FIB", "FIG", "FIN", "FIR", "FIT", "FLO", "FLY", "FOE", "FOG", "FOR",
+                                  "FRY", "FUM", "FUN", "FUR", "GAB", "GAD", "GAG", "GAL", "GAM", "GAP",
+                                  "GAS", "GAY", "GEE", "GEL", "GEM", "GET", "GIG", "GIL", "GIN", "GO",
+                                  "GOT", "GUM", "GUN", "GUS", "GUT", "GUY", "GYM", "GYP", "HA", "HAD",
+                                  "HAL", "HAM", "HAN", "HAP", "HAS", "HAT", "HAW", "HAY", "HE", "HEM",
+                                  "HEN", "HER", "HEW", "HEY", "HI", "HID", "HIM", "HIP", "HIS", "HIT",
+                                  "HO", "HOB", "HOC", "HOE", "HOG", "HOP", "HOT", "HOW", "HUB", "HUE",
+                                  "HUG", "HUH", "HUM", "HUT", "I", "ICY", "IDA", "IF", "IKE", "ILL",
+                                  "INK", "INN", "IO", "ION", "IQ", "IRA", "IRE", "IRK", "IS", "IT", "ITS",
+                                  "IVY", "JAB", "JAG", "JAM", "JAN", "JAR", "JAW", "JAY", "JET", "JIG",
+                                  "JIM", "JO", "JOB", "JOE", "JOG", "JOT", "JOY", "JUG", "JUT", "KAY",
+                                  "KEG", "KEN", "KEY", "KID", "KIM", "KIN", "KIT", "LA", "LAB", "LAC",
+                                  "LAD", "LAG", "LAM", "LAP", "LAW", "LAY", "LEA", "LED", "LEE", "LEG",
+                                  "LEN", "LEO", "LET", "LEW", "LID", "LIE", "LIN", "LIP", "LIT", "LO",
+                                  "LOB", "LOG", "LOP", "LOS", "LOT", "LOU", "LOW", "LOY", "LUG", "LYE",
+                                  "MA", "MAC", "MAD", "MAE", "MAN", "MAO", "MAP", "MAT", "MAW", "MAY",
+                                  "ME", "MEG", "MEL", "MEN", "MET", "MEW", "MID", "MIN", "MIT", "MOB",
+                                  "MOD", "MOE", "MOO", "MOP", "MOS", "MOT", "MOW", "MUD", "MUG", "MUM",
+                                  "MY", "NAB", "NAG", "NAN", "NAP", "NAT", "NAY", "NE", "NED", "NEE",
+                                  "NET", "NEW", "NIB", "NIL", "NIP", "NIT", "NO", "NOB", "NOD", "NON",
+                                  "NOR", "NOT", "NOV", "NOW", "NU", "NUN", "NUT", "O", "OAF", "OAK",
+                                  "OAR", "OAT", "ODD", "ODE", "OF", "OFF", "OFT", "OH", "OIL", "OK",
+                                  "OLD", "ON", "ONE", "OR", "ORB", "ORE", "ORR", "OS", "OTT", "OUR",
+                                  "OUT", "OVA", "OW", "OWE", "OWL", "OWN", "OX", "PA", "PAD", "PAL",
+                                  "PAM", "PAN", "PAP", "PAR", "PAT", "PAW", "PAY", "PEA", "PEG", "PEN",
+                                  "PEP", "PER", "PET", "PEW", "PHI", "PI", "PIE", "PIN", "PIT", "PLY",
+                                  "PO", "POD", "POE", "POP", "POT", "POW", "PRO", "PRY", "PUB", "PUG",
+                                  "PUN", "PUP", "PUT", "QUO", "RAG", "RAM", "RAN", "RAP", "RAT", "RAW",
+                                  "RAY", "REB", "RED", "REP", "RET", "RIB", "RID", "RIG", "RIM", "RIO",
+                                  "RIP", "ROB", "ROD", "ROE", "RON", "ROT", "ROW", "ROY", "RUB", "RUE",
+                                  "RUG", "RUM", "RUN", "RYE", "SAC", "SAD", "SAG", "SAL", "SAM", "SAN",
+                                  "SAP", "SAT", "SAW", "SAY", "SEA", "SEC", "SEE", "SEN", "SET", "SEW",
+                                  "SHE", "SHY", "SIN", "SIP", "SIR", "SIS", "SIT", "SKI", "SKY", "SLY",
+                                  "SO", "SOB", "SOD", "SON", "SOP", "SOW", "SOY", "SPA", "SPY", "SUB",
+                                  "SUD", "SUE", "SUM", "SUN", "SUP", "TAB", "TAD", "TAG", "TAN", "TAP",
+                                  "TAR", "TEA", "TED", "TEE", "TEN", "THE", "THY", "TIC", "TIE", "TIM",
+                                  "TIN", "TIP", "TO", "TOE", "TOG", "TOM", "TON", "TOO", "TOP", "TOW",
+                                  "TOY", "TRY", "TUB", "TUG", "TUM", "TUN", "TWO", "UN", "UP", "US",
+                                  "USE", "VAN", "VAT", "VET", "VIE", "WAD", "WAG", "WAR", "WAS", "WAY",
+                                  "WE", "WEB", "WED", "WEE", "WET", "WHO", "WHY", "WIN", "WIT", "WOK",
+                                  "WON", "WOO", "WOW", "WRY", "WU", "YAM", "YAP", "YAW", "YE", "YEA",
+                                  "YES", "YET", "YOU", "ABED", "ABEL", "ABET", "ABLE", "ABUT", "ACHE",
+                                  "ACID", "ACME", "ACRE", "ACTA", "ACTS", "ADAM", "ADDS", "ADEN", "AFAR",
+                                  "AFRO", "AGEE", "AHEM", "AHOY", "AIDA", "AIDE", "AIDS", "AIRY", "AJAR",
+                                  "AKIN", "ALAN", "ALEC", "ALGA", "ALIA", "ALLY", "ALMA", "ALOE", "ALSO",
+                                  "ALTO", "ALUM", "ALVA", "AMEN", "AMES", "AMID", "AMMO", "AMOK", "AMOS",
+                                  "AMRA", "ANDY", "ANEW", "ANNA", "ANNE", "ANTE", "ANTI", "AQUA", "ARAB",
+                                  "ARCH", "AREA", "ARGO", "ARID", "ARMY", "ARTS", "ARTY", "ASIA", "ASKS",
+                                  "ATOM", "AUNT", "AURA", "AUTO", "AVER", "AVID", "AVIS", "AVON", "AVOW",
+                                  "AWAY", "AWRY", "BABE", "BABY", "BACH", "BACK", "BADE", "BAIL", "BAIT",
+                                  "BAKE", "BALD", "BALE", "BALI", "BALK", "BALL", "BALM", "BAND", "BANE",
+                                  "BANG", "BANK", "BARB", "BARD", "BARE", "BARK", "BARN", "BARR", "BASE",
+                                  "BASH", "BASK", "BASS", "BATE", "BATH", "BAWD", "BAWL", "BEAD", "BEAK",
+                                  "BEAM", "BEAN", "BEAR", "BEAT", "BEAU", "BECK", "BEEF", "BEEN", "BEER",
+                                  "BEET", "BELA", "BELL", "BELT", "BEND", "BENT", "BERG", "BERN", "BERT",
+                                  "BESS", "BEST", "BETA", "BETH", "BHOY", "BIAS", "BIDE", "BIEN", "BILE",
+                                  "BILK", "BILL", "BIND", "BING", "BIRD", "BITE", "BITS", "BLAB", "BLAT",
+                                  "BLED", "BLEW", "BLOB", "BLOC", "BLOT", "BLOW", "BLUE", "BLUM", "BLUR",
+                                  "BOAR", "BOAT", "BOCA", "BOCK", "BODE", "BODY", "BOGY", "BOHR", "BOIL",
+                                  "BOLD", "BOLO", "BOLT", "BOMB", "BONA", "BOND", "BONE", "BONG", "BONN",
+                                  "BONY", "BOOK", "BOOM", "BOON", "BOOT", "BORE", "BORG", "BORN", "BOSE",
+                                  "BOSS", "BOTH", "BOUT", "BOWL", "BOYD", "BRAD", "BRAE", "BRAG", "BRAN",
+                                  "BRAY", "BRED", "BREW", "BRIG", "BRIM", "BROW", "BUCK", "BUDD", "BUFF",
+                                  "BULB", "BULK", "BULL", "BUNK", "BUNT", "BUOY", "BURG", "BURL", "BURN",
+                                  "BURR", "BURT", "BURY", "BUSH", "BUSS", "BUST", "BUSY", "BYTE", "CADY",
+                                  "CAFE", "CAGE", "CAIN", "CAKE", "CALF", "CALL", "CALM", "CAME", "CANE",
+                                  "CANT", "CARD", "CARE", "CARL", "CARR", "CART", "CASE", "CASH", "CASK",
+                                  "CAST", "CAVE", "CEIL", "CELL", "CENT", "CERN", "CHAD", "CHAR", "CHAT",
+                                  "CHAW", "CHEF", "CHEN", "CHEW", "CHIC", "CHIN", "CHOU", "CHOW", "CHUB",
+                                  "CHUG", "CHUM", "CITE", "CITY", "CLAD", "CLAM", "CLAN", "CLAW", "CLAY",
+                                  "CLOD", "CLOG", "CLOT", "CLUB", "CLUE", "COAL", "COAT", "COCA", "COCK",
+                                  "COCO", "CODA", "CODE", "CODY", "COED", "COIL", "COIN", "COKE", "COLA",
+                                  "COLD", "COLT", "COMA", "COMB", "COME", "COOK", "COOL", "COON", "COOT",
+                                  "CORD", "CORE", "CORK", "CORN", "COST", "COVE", "COWL", "CRAB", "CRAG",
+                                  "CRAM", "CRAY", "CREW", "CRIB", "CROW", "CRUD", "CUBA", "CUBE", "CUFF",
+                                  "CULL", "CULT", "CUNY", "CURB", "CURD", "CURE", "CURL", "CURT", "CUTS",
+                                  "DADE", "DALE", "DAME", "DANA", "DANE", "DANG", "DANK", "DARE", "DARK",
+                                  "DARN", "DART", "DASH", "DATA", "DATE", "DAVE", "DAVY", "DAWN", "DAYS",
+                                  "DEAD", "DEAF", "DEAL", "DEAN", "DEAR", "DEBT", "DECK", "DEED", "DEEM",
+                                  "DEER", "DEFT", "DEFY", "DELL", "DENT", "DENY", "DESK", "DIAL", "DICE",
+                                  "DIED", "DIET", "DIME", "DINE", "DING", "DINT", "DIRE", "DIRT", "DISC",
+                                  "DISH", "DISK", "DIVE", "DOCK", "DOES", "DOLE", "DOLL", "DOLT", "DOME",
+                                  "DONE", "DOOM", "DOOR", "DORA", "DOSE", "DOTE", "DOUG", "DOUR", "DOVE",
+                                  "DOWN", "DRAB", "DRAG", "DRAM", "DRAW", "DREW", "DRUB", "DRUG", "DRUM",
+                                  "DUAL", "DUCK", "DUCT", "DUEL", "DUET", "DUKE", "DULL", "DUMB", "DUNE",
+                                  "DUNK", "DUSK", "DUST", "DUTY", "EACH", "EARL", "EARN", "EASE", "EAST",
+                                  "EASY", "EBEN", "ECHO", "EDDY", "EDEN", "EDGE", "EDGY", "EDIT", "EDNA",
+                                  "EGAN", "ELAN", "ELBA", "ELLA", "ELSE", "EMIL", "EMIT", "EMMA", "ENDS",
+                                  "ERIC", "EROS", "EVEN", "EVER", "EVIL", "EYED", "FACE", "FACT", "FADE",
+                                  "FAIL", "FAIN", "FAIR", "FAKE", "FALL", "FAME", "FANG", "FARM", "FAST",
+                                  "FATE", "FAWN", "FEAR", "FEAT", "FEED", "FEEL", "FEET", "FELL", "FELT",
+                                  "FEND", "FERN", "FEST", "FEUD", "FIEF", "FIGS", "FILE", "FILL", "FILM",
+                                  "FIND", "FINE", "FINK", "FIRE", "FIRM", "FISH", "FISK", "FIST", "FITS",
+                                  "FIVE", "FLAG", "FLAK", "FLAM", "FLAT", "FLAW", "FLEA", "FLED", "FLEW",
+                                  "FLIT", "FLOC", "FLOG", "FLOW", "FLUB", "FLUE", "FOAL", "FOAM", "FOGY",
+                                  "FOIL", "FOLD", "FOLK", "FOND", "FONT", "FOOD", "FOOL", "FOOT", "FORD",
+                                  "FORE", "FORK", "FORM", "FORT", "FOSS", "FOUL", "FOUR", "FOWL", "FRAU",
+                                  "FRAY", "FRED", "FREE", "FRET", "FREY", "FROG", "FROM", "FUEL", "FULL",
+                                  "FUME", "FUND", "FUNK", "FURY", "FUSE", "FUSS", "GAFF", "GAGE", "GAIL",
+                                  "GAIN", "GAIT", "GALA", "GALE", "GALL", "GALT", "GAME", "GANG", "GARB",
+                                  "GARY", "GASH", "GATE", "GAUL", "GAUR", "GAVE", "GAWK", "GEAR", "GELD",
+                                  "GENE", "GENT", "GERM", "GETS", "GIBE", "GIFT", "GILD", "GILL", "GILT",
+                                  "GINA", "GIRD", "GIRL", "GIST", "GIVE", "GLAD", "GLEE", "GLEN", "GLIB",
+                                  "GLOB", "GLOM", "GLOW", "GLUE", "GLUM", "GLUT", "GOAD", "GOAL", "GOAT",
+                                  "GOER", "GOES", "GOLD", "GOLF", "GONE", "GONG", "GOOD", "GOOF", "GORE",
+                                  "GORY", "GOSH", "GOUT", "GOWN", "GRAB", "GRAD", "GRAY", "GREG", "GREW",
+                                  "GREY", "GRID", "GRIM", "GRIN", "GRIT", "GROW", "GRUB", "GULF", "GULL",
+                                  "GUNK", "GURU", "GUSH", "GUST", "GWEN", "GWYN", "HAAG", "HAAS", "HACK",
+                                  "HAIL", "HAIR", "HALE", "HALF", "HALL", "HALO", "HALT", "HAND", "HANG",
+                                  "HANK", "HANS", "HARD", "HARK", "HARM", "HART", "HASH", "HAST", "HATE",
+                                  "HATH", "HAUL", "HAVE", "HAWK", "HAYS", "HEAD", "HEAL", "HEAR", "HEAT",
+                                  "HEBE", "HECK", "HEED", "HEEL", "HEFT", "HELD", "HELL", "HELM", "HERB",
+                                  "HERD", "HERE", "HERO", "HERS", "HESS", "HEWN", "HICK", "HIDE", "HIGH",
+                                  "HIKE", "HILL", "HILT", "HIND", "HINT", "HIRE", "HISS", "HIVE", "HOBO",
+                                  "HOCK", "HOFF", "HOLD", "HOLE", "HOLM", "HOLT", "HOME", "HONE", "HONK",
+                                  "HOOD", "HOOF", "HOOK", "HOOT", "HORN", "HOSE", "HOST", "HOUR", "HOVE",
+                                  "HOWE", "HOWL", "HOYT", "HUCK", "HUED", "HUFF", "HUGE", "HUGH", "HUGO",
+                                  "HULK", "HULL", "HUNK", "HUNT", "HURD", "HURL", "HURT", "HUSH", "HYDE",
+                                  "HYMN", "IBIS", "ICON", "IDEA", "IDLE", "IFFY", "INCA", "INCH", "INTO",
+                                  "IONS", "IOTA", "IOWA", "IRIS", "IRMA", "IRON", "ISLE", "ITCH", "ITEM",
+                                  "IVAN", "JACK", "JADE", "JAIL", "JAKE", "JANE", "JAVA", "JEAN", "JEFF",
+                                  "JERK", "JESS", "JEST", "JIBE", "JILL", "JILT", "JIVE", "JOAN", "JOBS",
+                                  "JOCK", "JOEL", "JOEY", "JOHN", "JOIN", "JOKE", "JOLT", "JOVE", "JUDD",
+                                  "JUDE", "JUDO", "JUDY", "JUJU", "JUKE", "JULY", "JUNE", "JUNK", "JUNO",
+                                  "JURY", "JUST", "JUTE", "KAHN", "KALE", "KANE", "KANT", "KARL", "KATE",
+                                  "KEEL", "KEEN", "KENO", "KENT", "KERN", "KERR", "KEYS", "KICK", "KILL",
+                                  "KIND", "KING", "KIRK", "KISS", "KITE", "KLAN", "KNEE", "KNEW", "KNIT",
+                                  "KNOB", "KNOT", "KNOW", "KOCH", "KONG", "KUDO", "KURD", "KURT", "KYLE",
+                                  "LACE", "LACK", "LACY", "LADY", "LAID", "LAIN", "LAIR", "LAKE", "LAMB",
+                                  "LAME", "LAND", "LANE", "LANG", "LARD", "LARK", "LASS", "LAST", "LATE",
+                                  "LAUD", "LAVA", "LAWN", "LAWS", "LAYS", "LEAD", "LEAF", "LEAK", "LEAN",
+                                  "LEAR", "LEEK", "LEER", "LEFT", "LEND", "LENS", "LENT", "LEON", "LESK",
+                                  "LESS", "LEST", "LETS", "LIAR", "LICE", "LICK", "LIED", "LIEN", "LIES",
+                                  "LIEU", "LIFE", "LIFT", "LIKE", "LILA", "LILT", "LILY", "LIMA", "LIMB",
+                                  "LIME", "LIND", "LINE", "LINK", "LINT", "LION", "LISA", "LIST", "LIVE",
+                                  "LOAD", "LOAF", "LOAM", "LOAN", "LOCK", "LOFT", "LOGE", "LOIS", "LOLA",
+                                  "LONE", "LONG", "LOOK", "LOON", "LOOT", "LORD", "LORE", "LOSE", "LOSS",
+                                  "LOST", "LOUD", "LOVE", "LOWE", "LUCK", "LUCY", "LUGE", "LUKE", "LULU",
+                                  "LUND", "LUNG", "LURA", "LURE", "LURK", "LUSH", "LUST", "LYLE", "LYNN",
+                                  "LYON", "LYRA", "MACE", "MADE", "MAGI", "MAID", "MAIL", "MAIN", "MAKE",
+                                  "MALE", "MALI", "MALL", "MALT", "MANA", "MANN", "MANY", "MARC", "MARE",
+                                  "MARK", "MARS", "MART", "MARY", "MASH", "MASK", "MASS", "MAST", "MATE",
+                                  "MATH", "MAUL", "MAYO", "MEAD", "MEAL", "MEAN", "MEAT", "MEEK", "MEET",
+                                  "MELD", "MELT", "MEMO", "MEND", "MENU", "MERT", "MESH", "MESS", "MICE",
+                                  "MIKE", "MILD", "MILE", "MILK", "MILL", "MILT", "MIMI", "MIND", "MINE",
+                                  "MINI", "MINK", "MINT", "MIRE", "MISS", "MIST", "MITE", "MITT", "MOAN",
+                                  "MOAT", "MOCK", "MODE", "MOLD", "MOLE", "MOLL", "MOLT", "MONA", "MONK",
+                                  "MONT", "MOOD", "MOON", "MOOR", "MOOT", "MORE", "MORN", "MORT", "MOSS",
+                                  "MOST", "MOTH", "MOVE", "MUCH", "MUCK", "MUDD", "MUFF", "MULE", "MULL",
+                                  "MURK", "MUSH", "MUST", "MUTE", "MUTT", "MYRA", "MYTH", "NAGY", "NAIL",
+                                  "NAIR", "NAME", "NARY", "NASH", "NAVE", "NAVY", "NEAL", "NEAR", "NEAT",
+                                  "NECK", "NEED", "NEIL", "NELL", "NEON", "NERO", "NESS", "NEST", "NEWS",
+                                  "NEWT", "NIBS", "NICE", "NICK", "NILE", "NINA", "NINE", "NOAH", "NODE",
+                                  "NOEL", "NOLL", "NONE", "NOOK", "NOON", "NORM", "NOSE", "NOTE", "NOUN",
+                                  "NOVA", "NUDE", "NULL", "NUMB", "OATH", "OBEY", "OBOE", "ODIN", "OHIO",
+                                  "OILY", "OINT", "OKAY", "OLAF", "OLDY", "OLGA", "OLIN", "OMAN", "OMEN",
+                                  "OMIT", "ONCE", "ONES", "ONLY", "ONTO", "ONUS", "ORAL", "ORGY", "OSLO",
+                                  "OTIS", "OTTO", "OUCH", "OUST", "OUTS", "OVAL", "OVEN", "OVER", "OWLY",
+                                  "OWNS", "QUAD", "QUIT", "QUOD", "RACE", "RACK", "RACY", "RAFT", "RAGE",
+                                  "RAID", "RAIL", "RAIN", "RAKE", "RANK", "RANT", "RARE", "RASH", "RATE",
+                                  "RAVE", "RAYS", "READ", "REAL", "REAM", "REAR", "RECK", "REED", "REEF",
+                                  "REEK", "REEL", "REID", "REIN", "RENA", "REND", "RENT", "REST", "RICE",
+                                  "RICH", "RICK", "RIDE", "RIFT", "RILL", "RIME", "RING", "RINK", "RISE",
+                                  "RISK", "RITE", "ROAD", "ROAM", "ROAR", "ROBE", "ROCK", "RODE", "ROIL",
+                                  "ROLL", "ROME", "ROOD", "ROOF", "ROOK", "ROOM", "ROOT", "ROSA", "ROSE",
+                                  "ROSS", "ROSY", "ROTH", "ROUT", "ROVE", "ROWE", "ROWS", "RUBE", "RUBY",
+                                  "RUDE", "RUDY", "RUIN", "RULE", "RUNG", "RUNS", "RUNT", "RUSE", "RUSH",
+                                  "RUSK", "RUSS", "RUST", "RUTH", "SACK", "SAFE", "SAGE", "SAID", "SAIL",
+                                  "SALE", "SALK", "SALT", "SAME", "SAND", "SANE", "SANG", "SANK", "SARA",
+                                  "SAUL", "SAVE", "SAYS", "SCAN", "SCAR", "SCAT", "SCOT", "SEAL", "SEAM",
+                                  "SEAR", "SEAT", "SEED", "SEEK", "SEEM", "SEEN", "SEES", "SELF", "SELL",
+                                  "SEND", "SENT", "SETS", "SEWN", "SHAG", "SHAM", "SHAW", "SHAY", "SHED",
+                                  "SHIM", "SHIN", "SHOD", "SHOE", "SHOT", "SHOW", "SHUN", "SHUT", "SICK",
+                                  "SIDE", "SIFT", "SIGH", "SIGN", "SILK", "SILL", "SILO", "SILT", "SINE",
+                                  "SING", "SINK", "SIRE", "SITE", "SITS", "SITU", "SKAT", "SKEW", "SKID",
+                                  "SKIM", "SKIN", "SKIT", "SLAB", "SLAM", "SLAT", "SLAY", "SLED", "SLEW",
+                                  "SLID", "SLIM", "SLIT", "SLOB", "SLOG", "SLOT", "SLOW", "SLUG", "SLUM",
+                                  "SLUR", "SMOG", "SMUG", "SNAG", "SNOB", "SNOW", "SNUB", "SNUG", "SOAK",
+                                  "SOAR", "SOCK", "SODA", "SOFA", "SOFT", "SOIL", "SOLD", "SOME", "SONG",
+                                  "SOON", "SOOT", "SORE", "SORT", "SOUL", "SOUR", "SOWN", "STAB", "STAG",
+                                  "STAN", "STAR", "STAY", "STEM", "STEW", "STIR", "STOW", "STUB", "STUN",
+                                  "SUCH", "SUDS", "SUIT", "SULK", "SUMS", "SUNG", "SUNK", "SURE", "SURF",
+                                  "SWAB", "SWAG", "SWAM", "SWAN", "SWAT", "SWAY", "SWIM", "SWUM", "TACK",
+                                  "TACT", "TAIL", "TAKE", "TALE", "TALK", "TALL", "TANK", "TASK", "TATE",
+                                  "TAUT", "TEAL", "TEAM", "TEAR", "TECH", "TEEM", "TEEN", "TEET", "TELL",
+                                  "TEND", "TENT", "TERM", "TERN", "TESS", "TEST", "THAN", "THAT", "THEE",
+                                  "THEM", "THEN", "THEY", "THIN", "THIS", "THUD", "THUG", "TICK", "TIDE",
+                                  "TIDY", "TIED", "TIER", "TILE", "TILL", "TILT", "TIME", "TINA", "TINE",
+                                  "TINT", "TINY", "TIRE", "TOAD", "TOGO", "TOIL", "TOLD", "TOLL", "TONE",
+                                  "TONG", "TONY", "TOOK", "TOOL", "TOOT", "TORE", "TORN", "TOTE", "TOUR",
+                                  "TOUT", "TOWN", "TRAG", "TRAM", "TRAY", "TREE", "TREK", "TRIG", "TRIM",
+                                  "TRIO", "TROD", "TROT", "TROY", "TRUE", "TUBA", "TUBE", "TUCK", "TUFT",
+                                  "TUNA", "TUNE", "TUNG", "TURF", "TURN", "TUSK", "TWIG", "TWIN", "TWIT",
+                                  "ULAN", "UNIT", "URGE", "USED", "USER", "USES", "UTAH", "VAIL", "VAIN",
+                                  "VALE", "VARY", "VASE", "VAST", "VEAL", "VEDA", "VEIL", "VEIN", "VEND",
+                                  "VENT", "VERB", "VERY", "VETO", "VICE", "VIEW", "VINE", "VISE", "VOID",
+                                  "VOLT", "VOTE", "WACK", "WADE", "WAGE", "WAIL", "WAIT", "WAKE", "WALE",
+                                  "WALK", "WALL", "WALT", "WAND", "WANE", "WANG", "WANT", "WARD", "WARM",
+                                  "WARN", "WART", "WASH", "WAST", "WATS", "WATT", "WAVE", "WAVY", "WAYS",
+                                  "WEAK", "WEAL", "WEAN", "WEAR", "WEED", "WEEK", "WEIR", "WELD", "WELL",
+                                  "WELT", "WENT", "WERE", "WERT", "WEST", "WHAM", "WHAT", "WHEE", "WHEN",
+                                  "WHET", "WHOA", "WHOM", "WICK", "WIFE", "WILD", "WILL", "WIND", "WINE",
+                                  "WING", "WINK", "WINO", "WIRE", "WISE", "WISH", "WITH", "WOLF", "WONT",
+                                  "WOOD", "WOOL", "WORD", "WORE", "WORK", "WORM", "WORN", "WOVE", "WRIT",
+                                  "WYNN", "YALE", "YANG", "YANK", "YARD", "YARN", "YAWL", "YAWN", "YEAH",
+                                  "YEAR", "YELL", "YOGA", "YOKE"
+                                };
+
+/*
+ * Encode 8 bytes in 'c' as a string of English words.
+ * Returns a pointer to a static buffer
+ */
+
+char *btoe(unsigned char *md)<--- Parameter 'md' can be declared as pointer to const
+{
+	char cp[9];	/* 64 + 2 = 66 bits */
+	int p, i;
+	static int buf[BUFSIZ];
+	char *engout = (char *)buf;
+
+	memcpy(cp, md, SKEY_SIZE);
+	/* compute parity */
+	for(p = 0, i = 0; i < 64; i += 2)
+		p += extract(cp, i, 2);
+	cp[8] = (char)p << 6;
+	/* now 66 bits */
+
+	engout[0] = '\0';
+	strncat(engout, &Wp[extract(cp,  0, 11)][0], 4);
+	strcat (engout," ");
+	strncat(engout, &Wp[extract(cp, 11, 11)][0], 4);
+	strcat (engout," ");
+	strncat(engout, &Wp[extract(cp, 22, 11)][0], 4);
+	strcat (engout," ");
+	strncat(engout, &Wp[extract(cp, 33, 11)][0], 4);
+	strcat (engout," ");
+	strncat(engout, &Wp[extract(cp, 44, 11)][0], 4);
+	strcat (engout," ");
+	strncat(engout, &Wp[extract(cp, 55, 11)][0], 4);
+	return (engout);
+
+}
+
+/*
+ * Extract 'length' bits from the char array 's'
+ * starting with bit 'start'
+ */
+
+static guint32 extract(char *s, int start, int length)<--- Parameter 's' can be declared as pointer to const
+{
+	guint8 cl;
+	guint8 cc;
+	guint8 cr;
+	guint32 x;
+
+	/* 66 = 11 x 6 */
+
+	g_assert(length >= 0);
+	g_assert(length <= 11);
+	g_assert(start >= 0);
+	g_assert(start + length <= 66);
+
+	cl = s[start/8];
+	cc = s[start/8 + 1];
+	cr = s[start/8 + 2];
+	x = (guint32) ((((cl << 8) | cc) << 8) | cr);	/* 24 bits */
+	x = x >> (24 - (length + (start % 8)));	        /* cut tail */
+	x = (x & (0xffff >> (16 - length)));		/* cut head */
+	return(x);					/* length */
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/2.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/2.html new file mode 100644 index 0000000..7ba353d --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/2.html @@ -0,0 +1,403 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
/*
+ * Copyright © 2009 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * Mate-terminal 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal 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/>.
+ */
+
+/* This file contains extra strings that need to be translated, but
+ * can't be extracted by intltool since the ui files aren't in git, and
+ * the glade files don't contain them in the right form. See bug #553357.
+ */
+
+/* Translators: This refers to the Delete keybinding option */
+N_("Automatic")<--- There is an unknown macro here somewhere. Configuration is required. If N_ is a macro then please configure it.
+/* Translators: This refers to the Delete keybinding option */
+N_("Control-H")
+/* Translators: This refers to the Delete keybinding option */
+N_("ASCII DEL")
+/* Translators: This refers to the Delete keybinding option */
+N_("Escape sequence")
+/* Translators: This refers to the Delete keybinding option */
+N_("TTY Erase")
+
+/* Translators: Cursor shape: ... */
+N_("Block")
+/* Translators: Cursor shape: ... */
+N_("I-Beam")
+/* Translators: Cursor shape: ... */
+N_("Underline")
+
+/* Translators: Cursor blink: ... */
+N_("Use system settings")
+/* Translators: Cursor blink: ... */
+N_("Always blink")
+/* Translators: Cursor blink: ... */
+N_("Never blink")
+
+/* Translators: When command exits: ... */
+N_("Exit the terminal")
+/* Translators: When command exits: ... */
+N_("Restart the command")
+/* Translators: When command exits: ... */
+N_("Hold the terminal open")
+
+/* Translators: Scrollbar is: ... */
+N_("On the left side")
+/* Translators: Scrollbar is: ... */
+N_("On the right side")
+/* Translators: Scrollbar is: ... */
+N_("Disabled")
+
+/* Translators: When terminal commands set their own titles: ... */
+N_("Replace initial title")
+/* Translators: When terminal commands set their own titles: ... */
+N_("Append initial title")
+/* Translators: When terminal commands set their own titles: ... */
+N_("Prepend initial title")
+/* Translators: When terminal commands set their own titles: ... */
+N_("Keep initial title")
+
+/* Translators: This is the name of a colour scheme */
+N_("Tango")
+/* Translators: This is the name of a colour scheme */
+N_("Linux console")
+/* Translators: This is the name of a colour scheme */
+N_("XTerm")
+/* Translators: This is the name of a colour scheme */
+N_("Rxvt")
+/* Translators: This is the name of a colour scheme */
+N_("Solarized")
+/* Translators: This is the name of a colour scheme */
+N_("Custom")
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/20.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/20.html new file mode 100644 index 0000000..f13c72b --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/20.html @@ -0,0 +1,919 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ *    Copyright (C) 2001 Nikos Mavroyanopoulos
+ *    Copyright (C) 2012-2021 MATE Developers
+ *
+ *    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 3 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.
+ */
+
+/*
+ * The algorithm is due to Ron Rivest.  This code is based on code
+ * written by Colin Plumb in 1993.
+ */
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "config.h"<--- Include file: "config.h" not found.
+#include "skey.h"
+#include "skeyutil.h"
+#include "md4.h"
+
+#ifndef WORDS_BIGENDIAN
+#define byteReverse(buf, len)	/* Nothing */
+#else
+static void byteReverse(unsigned char *buf, unsigned longs);
+
+/*
+ * Note: this code is harmless on little-endian machines.
+ */
+static void byteReverse(unsigned char *buf, unsigned longs)
+{
+	guint32 t;
+	do
+	{
+		t = (guint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
+		    ((unsigned) buf[1] << 8 | buf[0]);
+		*(guint32 *) buf = t;
+		buf += 4;
+	}
+	while (--longs);
+}
+#endif
+
+#define rotl32(x,n)   (((x) << ((guint32)(n))) | ((x) >> (32 - (guint32)(n))))
+
+/*
+ * Start MD4 accumulation.  Set bit count to 0 and buffer to mysterious
+ * initialization constants.
+ */
+void MD4Init(MD4_CTX *ctx)
+{
+	ctx->buf[0] = 0x67452301;
+	ctx->buf[1] = 0xefcdab89;
+	ctx->buf[2] = 0x98badcfe;
+	ctx->buf[3] = 0x10325476;
+
+	ctx->bits[0] = 0;
+	ctx->bits[1] = 0;
+}
+
+/*
+ * Update context to reflect the concatenation of another buffer full
+ * of bytes.
+ */
+void MD4Update(MD4_CTX *ctx, unsigned char const *buf,
+               unsigned len)
+{
+	register guint32 t;
+
+	/* Update bitcount */
+
+	t = ctx->bits[0];
+	if ((ctx->bits[0] = t + ((guint32) len << 3)) < t)
+		ctx->bits[1]++;	/* Carry from low to high */
+	ctx->bits[1] += len >> 29;
+
+	t = (t >> 3) & 0x3f;	/* Bytes already in shsInfo->data */
+
+	/* Handle any leading odd-sized chunks */
+
+	if (t)
+	{
+		unsigned char *p = (unsigned char *) ctx->in + t;
+
+		t = 64 - t;
+		if (len < t)
+		{
+			memcpy(p, buf, len);
+			return;
+		}
+		memcpy(p, buf, t);
+		byteReverse(ctx->in, 16);
+		MD4Transform(ctx->buf, (guint32 *) ctx->in);
+		buf += t;
+		len -= t;
+	}
+	/* Process data in 64-byte chunks */
+
+	while (len >= 64)
+	{
+		memcpy(ctx->in, buf, 64);
+		byteReverse(ctx->in, 16);
+		MD4Transform(ctx->buf, (guint32 *) ctx->in);
+		buf += 64;
+		len -= 64;
+	}
+
+	/* Handle any remaining bytes of data. */
+
+	memcpy(ctx->in, buf, len);
+}
+
+/*
+ * Final wrapup - pad to 64-byte boundary with the bit pattern
+ * 1 0* (64-bit count of bits processed, MSB-first)
+ */
+void MD4Final(unsigned char* digest, MD4_CTX *ctx)
+{
+	unsigned int count;
+	unsigned char *p;
+
+	/* Compute number of bytes mod 64 */
+	count = (ctx->bits[0] >> 3) & 0x3F;
+
+	/* Set the first char of padding to 0x80.  This is safe since there is
+	   always at least one byte free */
+	p = ctx->in + count;
+	*p++ = 0x80;
+
+	/* Bytes of padding needed to make 64 bytes */
+	count = 64 - 1 - count;
+
+	/* Pad out to 56 mod 64 */
+	if (count < 8)
+	{
+		/* Two lots of padding:  Pad the first block to 64 bytes */
+		memset(p, 0, count);
+		byteReverse(ctx->in, 16);
+		MD4Transform(ctx->buf, (guint32 *) ctx->in);
+
+		/* Now fill the next block with 56 bytes */
+		memset(ctx->in, 0, 56);
+	}
+	else
+	{
+		/* Pad block to 56 bytes */
+		memset(p, 0, count - 8);
+	}
+	byteReverse(ctx->in, 14);
+
+	/* Append length in bits and transform */
+	((guint32 *) ctx->in)[14] = ctx->bits[0];
+	((guint32 *) ctx->in)[15] = ctx->bits[1];
+
+	MD4Transform(ctx->buf, (guint32 *) ctx->in);
+	byteReverse((unsigned char *) ctx->buf, 4);
+
+	if (digest!=NULL)
+		memcpy(digest, ctx->buf, 16);
+	memset(ctx, 0, sizeof(*ctx));	/* In case it's sensitive */
+}
+
+/* The three core functions */
+
+#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
+#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
+#define H(x, y, z) ((x) ^ (y) ^ (z))
+
+#define FF(a, b, c, d, x, s) { \
+    (a) += F ((b), (c), (d)) + (x); \
+    (a) = rotl32 ((a), (s)); \
+  }
+#define GG(a, b, c, d, x, s) { \
+    (a) += G ((b), (c), (d)) + (x) + (guint32)0x5a827999; \
+    (a) = rotl32 ((a), (s)); \
+  }
+#define HH(a, b, c, d, x, s) { \
+    (a) += H ((b), (c), (d)) + (x) + (guint32)0x6ed9eba1; \
+    (a) = rotl32 ((a), (s)); \
+  }
+
+/*
+ * The core of the MD4 algorithm
+ */
+void MD4Transform(guint32 buf[4], guint32 const in[16])
+{
+	register guint32 a, b, c, d;
+
+	a = buf[0];
+	b = buf[1];
+	c = buf[2];
+	d = buf[3];
+
+	FF(a, b, c, d, in[0], 3);	/* 1 */
+	FF(d, a, b, c, in[1], 7);	/* 2 */
+	FF(c, d, a, b, in[2], 11);	/* 3 */
+	FF(b, c, d, a, in[3], 19);	/* 4 */
+	FF(a, b, c, d, in[4], 3);	/* 5 */
+	FF(d, a, b, c, in[5], 7);	/* 6 */
+	FF(c, d, a, b, in[6], 11);	/* 7 */
+	FF(b, c, d, a, in[7], 19);	/* 8 */
+	FF(a, b, c, d, in[8], 3);	/* 9 */
+	FF(d, a, b, c, in[9], 7);	/* 10 */
+	FF(c, d, a, b, in[10], 11);	/* 11 */
+	FF(b, c, d, a, in[11], 19);	/* 12 */
+	FF(a, b, c, d, in[12], 3);	/* 13 */
+	FF(d, a, b, c, in[13], 7);	/* 14 */
+	FF(c, d, a, b, in[14], 11);	/* 15 */
+	FF(b, c, d, a, in[15], 19);	/* 16 */
+
+	GG(a, b, c, d, in[0], 3);	/* 17 */
+	GG(d, a, b, c, in[4], 5);	/* 18 */
+	GG(c, d, a, b, in[8], 9);	/* 19 */
+	GG(b, c, d, a, in[12], 13);	/* 20 */
+	GG(a, b, c, d, in[1], 3);	/* 21 */
+	GG(d, a, b, c, in[5], 5);	/* 22 */
+	GG(c, d, a, b, in[9], 9);	/* 23 */
+	GG(b, c, d, a, in[13], 13);	/* 24 */
+	GG(a, b, c, d, in[2], 3);	/* 25 */
+	GG(d, a, b, c, in[6], 5);	/* 26 */
+	GG(c, d, a, b, in[10], 9);	/* 27 */
+	GG(b, c, d, a, in[14], 13);	/* 28 */
+	GG(a, b, c, d, in[3], 3);	/* 29 */
+	GG(d, a, b, c, in[7], 5);	/* 30 */
+	GG(c, d, a, b, in[11], 9);	/* 31 */
+	GG(b, c, d, a, in[15], 13);	/* 32 */
+
+	HH(a, b, c, d, in[0], 3);	/* 33 */
+	HH(d, a, b, c, in[8], 9);	/* 34 */
+	HH(c, d, a, b, in[4], 11);	/* 35 */
+	HH(b, c, d, a, in[12], 15);	/* 36 */
+	HH(a, b, c, d, in[2], 3);	/* 37 */
+	HH(d, a, b, c, in[10], 9);	/* 38 */
+	HH(c, d, a, b, in[6], 11);	/* 39 */
+	HH(b, c, d, a, in[14], 15);	/* 40 */
+	HH(a, b, c, d, in[1], 3);	/* 41 */
+	HH(d, a, b, c, in[9], 9);	/* 42 */
+	HH(c, d, a, b, in[5], 11);	/* 43 */
+	HH(b, c, d, a, in[13], 15);	/* 44 */
+	HH(a, b, c, d, in[3], 3);	/* 45 */
+	HH(d, a, b, c, in[11], 9);	/* 46 */
+	HH(c, d, a, b, in[7], 11);	/* 47 */
+	HH(b, c, d, a, in[15], 15);	/* 48 */
+
+	buf[0] += a;
+	buf[1] += b;
+	buf[2] += c;
+	buf[3] += d;
+}
+
+int MD4Keycrunch( char *result, const char *seed, const char *passphrase)
+{
+	int len;
+	char *buf;
+	MD4_CTX md;
+	guint32 results[4];
+
+	len = strlen(seed) + strlen(passphrase);
+	buf = (char *)malloc(len+1);
+	if (buf == NULL)
+		return -1;
+
+	strcpy(buf, seed);
+	skey_lowcase(buf);
+	strcat(buf, passphrase);
+	skey_sevenbit(buf);
+
+	MD4Init(&md);
+	MD4Update(&md, (unsigned char *)buf, len);
+	MD4Final((unsigned char *)results, &md);
+	free(buf);
+
+	results[0] ^= results[2];
+	results[1] ^= results[3];
+	memcpy((void *)result, (void *)results, SKEY_SIZE);
+
+	return 0;
+}
+
+void MD4SKey(char *x)
+{
+	MD4_CTX md;
+	guint32 results[4];
+
+	MD4Init(&md);
+	MD4Update(&md, (unsigned char *)x, SKEY_SIZE);
+	MD4Final((unsigned char *)results, &md);
+
+	results[0] ^= results[2];
+	results[1] ^= results[3];
+
+	memcpy((void *)x, (void *)results, SKEY_SIZE);
+}
+
+#ifdef MD4_MAIN
+
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+int main(int argc, char *argv[])
+{
+	MD4_CTX *md4;
+	unsigned char digest[16];
+	unsigned char data[1024];
+	int i, r;
+
+	memset(digest, 0, 16);
+	printf("MD4 digest algorithm. End with Ctrl-D:\n");
+
+	md4 = (MD4_CTX *)malloc(sizeof(MD4_CTX));
+	MD4Init(md4);
+	do
+	{
+		r = read(0, data, sizeof data);
+		MD4Update(md4, data, r);
+	}
+	while (r);
+
+	MD4Final(digest, md4);
+	printf("MD4 Digest is: ");
+	for (i = 0; i < 16; i++)
+		printf("%02X", digest[i]);
+
+	printf("\n");
+	free(md4);
+	return 0;
+}
+
+#endif
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/21.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/21.html new file mode 100644 index 0000000..e10387a --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/21.html @@ -0,0 +1,277 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
#ifndef MD4_H
+#define MD4_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+typedef struct
+{
+	guint32 buf[4];
+	guint32 bits[2];
+	unsigned char in[64];
+} MD4_CTX;
+
+void MD4Transform(guint32 buf[4], guint32 const in[16]);
+void MD4Init(MD4_CTX *context);
+void MD4Update(MD4_CTX *context, unsigned char const *buf, unsigned len);
+void MD4Final(unsigned char *digest, MD4_CTX *context);
+int  MD4Keycrunch(char *result, const char *seed, const char *passphrase);
+void MD4SKey(char *x);
+
+#endif /* !MD4_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/22.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/22.html new file mode 100644 index 0000000..2e2f92c --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/22.html @@ -0,0 +1,371 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "skey.h"
+#include "skeyutil.h"
+#include "md5.h"
+
+int MD5Keycrunch(char *result, const char *seed, const char *passhrase)
+{
+	char *buf;
+	gsize len;
+	GChecksum *checksum;
+	guint8 digest[16];
+	gsize digest_len = sizeof (digest);
+	guint32 *results;
+
+	len = strlen(seed) + strlen(passhrase);
+	buf = (char *)g_try_malloc(len+1);
+	if (buf == NULL)
+		return -1;
+
+	strcpy(buf, seed);
+	skey_lowcase(buf);
+	strcat(buf, passhrase);
+	skey_sevenbit(buf);
+
+	checksum = g_checksum_new (G_CHECKSUM_MD5);
+	g_checksum_update (checksum, (const guchar *) buf, len);
+	g_free(buf);
+
+	g_checksum_get_digest (checksum, digest, &digest_len);
+	g_assert (digest_len == 16);
+
+	results = (guint32 *) digest;
+	results[0] ^= results[2];
+	results[1] ^= results[3];
+
+	memcpy((void *)result, (void *)results, SKEY_SIZE);
+
+	g_checksum_free (checksum);
+
+	return 0;
+}
+
+void MD5SKey(char *x)
+{
+	GChecksum *checksum;
+	guint8 digest[16];
+	gsize digest_len = sizeof (digest);
+	guint32 *results;
+
+	checksum = g_checksum_new (G_CHECKSUM_MD5);
+	g_checksum_update (checksum, (const guchar *) x, SKEY_SIZE);
+	g_checksum_get_digest (checksum, digest, &digest_len);
+	g_assert (digest_len == 16);
+
+	results = (guint32 *) digest;
+	results[0] ^= results[2];
+	results[1] ^= results[3];
+
+	memcpy((void *)x, (void *)results, SKEY_SIZE);
+
+	g_checksum_free (checksum);
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/23.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/23.html new file mode 100644 index 0000000..3efa122 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/23.html @@ -0,0 +1,255 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
1
+2
+3
+4
+5
+6
+7
+8
+9
#ifndef MD5_H
+#define MD5_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+int  MD5Keycrunch(char *result, const char *seed, const char *passhrase);
+void MD5SKey(char *x);
+
+#endif /* !MD5_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/24.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/24.html new file mode 100644 index 0000000..f68792f --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/24.html @@ -0,0 +1,455 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <arpa/inet.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "skey.h"
+#include "skeyutil.h"
+#include "sha1.h"
+
+#define HTONDIGEST(x) { \
+      x[0] = htonl(x[0]); \
+      x[1] = htonl(x[1]); \
+      x[2] = htonl(x[2]); \
+      x[3] = htonl(x[3]); \
+      x[4] = htonl(x[4]); }
+
+#ifdef WORDS_BIGENDIAN
+/*
+ * Note: this code is harmless on little-endian machines.
+ */
+static void byteReverse(unsigned char *buf, unsigned longs)
+{
+	guint32 t;
+	do
+	{
+		t = (guint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
+		    ((unsigned) buf[1] << 8 | buf[0]);
+		*(guint32 *) buf = t;
+		buf += 4;
+	}
+	while (--longs);
+}
+#endif
+
+int SHA1Keycrunch(char *result, const char *seed, const char *passphrase)
+{
+	char *buf;
+	gsize len;
+	GChecksum *checksum;
+	guint8 digest[20];
+	gsize digest_len = sizeof (digest);
+	guint32 *results;
+
+	len = strlen(seed) + strlen(passphrase);
+	if ((buf = (char *)g_try_malloc(len+1)) == NULL)
+		return -1;
+
+	strcpy(buf, seed);
+	skey_lowcase(buf);
+	strcat(buf, passphrase);
+	skey_sevenbit(buf);
+
+	checksum = g_checksum_new (G_CHECKSUM_SHA1);
+	g_checksum_update (checksum, (const guchar *) buf, len);
+	g_free(buf);
+
+	g_checksum_get_digest (checksum, digest, &digest_len);
+	g_assert (digest_len == 20);
+
+	results = (guint32 *) digest;<--- results is assigned
+
+#ifndef WORDS_BIGENDIAN
+	HTONDIGEST(results);
+#else
+	byteReverse((unsigned char *)digest, 5);
+#endif
+
+	results = (guint32 *) digest;<--- results is overwritten
+	results[0] ^= results[2];
+	results[1] ^= results[3];
+	results[0] ^= results[4];
+
+	memcpy((void *)result, (void *)results, SKEY_SIZE);
+
+	g_checksum_free (checksum);
+
+	return 0;
+}
+
+void SHA1SKey(char *x)
+{
+	GChecksum *checksum;
+	guint8 digest[20];
+	gsize digest_len = sizeof (digest);
+	guint32 *results;
+
+	checksum = g_checksum_new (G_CHECKSUM_SHA1);
+	g_checksum_update (checksum, (const guchar *) x, SKEY_SIZE);
+	g_checksum_get_digest (checksum, digest, &digest_len);
+	g_assert (digest_len == 20);
+
+	results = (guint32 *) digest;
+#ifndef WORDS_BIGENDIAN
+	HTONDIGEST(results);
+#else
+	byteReverse((unsigned char *)digest, 5);
+#endif
+
+	results[0] ^= results[2];
+	results[1] ^= results[3];
+	results[0] ^= results[4];
+
+	memcpy((void *)x, (void *)results, SKEY_SIZE);
+
+	g_checksum_free (checksum);
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/25.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/25.html new file mode 100644 index 0000000..c8a9426 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/25.html @@ -0,0 +1,255 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
1
+2
+3
+4
+5
+6
+7
+8
+9
#ifndef _SHA1_H
+#define _SHA1_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+int  SHA1Keycrunch(char *result, const char *seed, const char *passphrase);
+void SHA1SKey(char *x);
+
+#endif /* _SHA1_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/26.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/26.html new file mode 100644 index 0000000..84b8904 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/26.html @@ -0,0 +1,313 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <stdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "md4.h"
+#include "md5.h"
+#include "sha1.h"
+#include "skey.h"
+#include "btoe.h"
+
+struct skey_hash
+{
+	int (*Keycrunch) (char *, const char *, const char *);
+	void (*Skey) (char *);
+};
+static struct skey_hash hash_table[] =
+{
+	{ MD4Keycrunch,  MD4SKey },
+	{ MD5Keycrunch,  MD5SKey },
+	{ SHA1Keycrunch, SHA1SKey }
+};
+
+char *skey(SKeyAlgorithm algorithm, int seq, const char *seed, const char *passphrase)
+{
+	char key[SKEY_SIZE];
+	int i;
+	g_assert (algorithm < G_N_ELEMENTS (hash_table));
+	if (hash_table[algorithm].Keycrunch(key, seed, passphrase) == -1)
+		return NULL;
+
+	for (i = 0; i < seq; i++)
+		hash_table[algorithm].Skey(key);
+
+	return strdup(btoe((unsigned char *)key));
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/27.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/27.html new file mode 100644 index 0000000..ed53176 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/27.html @@ -0,0 +1,285 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <ctype.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "skeyutil.h"
+
+void skey_sevenbit(char *s)
+{
+	char *p;
+
+	for (p = s; *p; p++)
+		*p &= 0x7f;
+}
+
+void skey_lowcase(char *s)
+{
+	char *p;
+
+	for (p = s; *p; p++)
+		if (g_ascii_isupper(*p))
+			*p = g_ascii_tolower(*p);
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/28.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/28.html new file mode 100644 index 0000000..4814590 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/28.html @@ -0,0 +1,443 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <locale.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "skey.h"
+
+typedef struct
+{
+	SKeyAlgorithm algorithm;
+	const char *passphrase;
+	const char *seed;
+	int  count;
+	const char *hex;
+	const char *btoe;
+} TestEntry;
+
+static const TestEntry tests[] =
+{
+	{ MD4, "This is a test.", "TeSt",     0, "D185 4218 EBBB 0B51", "ROME MUG FRED SCAN LIVE LACE"   },
+	{ MD4, "This is a test.", "TeSt",     1, "6347 3EF0 1CD0 B444", "CARD SAD MINI RYE COL KIN"      },
+	{ MD4, "This is a test.", "TeSt",    99, "C5E6 1277 6E6C 237A", "NOTE OUT IBIS SINK NAVE MODE"   },
+	{ MD4, "AbCdEfGhIjK",     "alpha1",   0, "5007 6F47 EB1A DE4E", "AWAY SEN ROOK SALT LICE MAP"    },
+	{ MD4, "AbCdEfGhIjK",     "alpha1",   1, "65D2 0D19 49B5 F7AB", "CHEW GRIM WU HANG BUCK SAID"    },
+	{ MD4, "AbCdEfGhIjK",     "alpha1",  99, "D150 C82C CE6F 62D1", "ROIL FREE COG HUNK WAIT COCA"   },
+	{ MD4, "OTP's are good",  "correct",  0, "849C 79D4 F6F5 5388", "FOOL STEM DONE TOOL BECK NILE"  },
+	{ MD4, "OTP's are good",  "correct",  1, "8C09 92FB 2508 47B1", "GIST AMOS MOOT AIDS FOOD SEEM"  },
+	{ MD4, "OTP's are good",  "correct", 99, "3F3B F4B4 145F D74B", "TAG SLOW NOV MIN WOOL KENO"     },
+	{ MD5, "This is a test.", "TeSt",     0, "9E87 6134 D904 99DD", "INCH SEA ANNE LONG AHEM TOUR"   },
+	{ MD5, "This is a test.", "TeSt",     1, "7965 E054 36F5 029F", "EASE OIL FUM CURE AWRY AVIS"    },
+	{ MD5, "This is a test.", "TeSt",    99, "50FE 1962 C496 5880", "BAIL TUFT BITS GANG CHEF THY"   },
+	{ MD5, "AbCdEfGhIjK",     "alpha1",   0, "8706 6DD9 644B F206", "FULL PEW DOWN ONCE MORT ARC"    },
+	{ MD5, "AbCdEfGhIjK",     "alpha1",   1, "7CD3 4C10 40AD D14B", "FACT HOOF AT FIST SITE KENT"    },
+	{ MD5, "AbCdEfGhIjK",     "alpha1",  99, "5AA3 7A81 F212 146C", "BODE HOP JAKE STOW JUT RAP"     },
+	{ MD5, "OTP's are good",  "correct",  0, "F205 7539 43DE 4CF9", "ULAN NEW ARMY FUSE SUIT EYED"   },
+	{ MD5, "OTP's are good",  "correct",  1, "DDCD AC95 6F23 4937", "SKIM CULT LOB SLAM POE HOWL"    },
+	{ MD5, "OTP's are good",  "correct", 99, "B203 E28F A525 BE47", "LONG IVY JULY AJAR BOND LEE"    },
+	{ SHA1, "This is a test.", "TeSt",     0, "BB9E 6AE1 979D 8FF4", "MILT VARY MAST OK SEES WENT"   },
+	{ SHA1, "This is a test.", "TeSt",     1, "63D9 3663 9734 385B", "CART OTTO HIVE ODE VAT NUT"    },
+	{ SHA1, "This is a test.", "TeSt",    99, "87FE C776 8B73 CCF9", "GAFF WAIT SKID GIG SKY EYED"   },
+	{ SHA1, "AbCdEfGhIjK",     "alpha1",   0, "AD85 F658 EBE3 83C9", "LEST OR HEEL SCOT ROB SUIT"    },
+	{ SHA1, "AbCdEfGhIjK",     "alpha1",   1, "D07C E229 B5CF 119B", "RITE TAKE GELD COST TUNE RECK" },
+	{ SHA1, "AbCdEfGhIjK",     "alpha1",  99, "27BC 7103 5AAF 3DC6", "MAY STAR TIN LYON VEDA STAN"   },
+	{ SHA1, "OTP's are good",  "correct",  0, "D51F 3E99 BF8E 6F0B", "RUST WELT KICK FELL TAIL FRAU" },
+	{ SHA1, "OTP's are good",  "correct",  1, "82AE B52D 9437 74E4", "FLIT DOSE ALSO MEW DRUM DEFY"  },
+	{ SHA1, "OTP's are good",  "correct", 99, "4F29 6A74 FE15 67EC", "AURA ALOE HURL WING BERG WAIT" },
+
+	{ SHA1, "Passphrase",      "IiIi",   100, "27F4 01CC 0AC8 5112", "MEG JACK DIET GAD FORK GARY"   }
+};
+
+static const char *algos[] =
+{
+	"MD4",
+	"MD5",
+	"SHA1"
+};
+
+static void
+skey_test (gconstpointer data)
+{
+	const TestEntry *test = (const TestEntry *) data;
+	char *key;
+
+	key = skey (test->algorithm,
+	            test->count,
+	            test->seed,
+	            test->passphrase);
+	g_assert (key != NULL);
+	g_assert (strcmp (key, test->btoe) == 0);
+	free (key);
+}
+
+int main(int argc, char *argv[])
+{
+	guint i;
+
+	if (!setlocale (LC_ALL, ""))
+		g_error ("Locale not supported by C library!\n");
+
+	g_test_init (&argc, &argv, NULL);
+	g_test_bug_base ("http://bugzilla.mate.org/enter_bug.cgi?product=mate-terminal");
+
+	for (i = 0; i < G_N_ELEMENTS (tests); ++i)
+	{
+		const TestEntry *test = &tests[i];
+		char *name;
+
+		name = g_strdup_printf ("/%s/%s/%s/%d/%s/%s",
+		                        algos[test->algorithm],
+		                        test->passphrase,
+		                        test->seed,
+		                        test->count,
+		                        test->hex,
+		                        test->btoe);
+		g_test_add_data_func (name, test, skey_test);
+		g_free (name);
+	}
+
+	return g_test_run ();
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/29.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/29.html new file mode 100644 index 0000000..3109c61 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/29.html @@ -0,0 +1,2461 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
   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
/*
+ * Copyright © 2001, 2002 Havoc Pennington, Red Hat Inc.
+ * Copyright © 2008 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * Mate-terminal 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gdk/gdkkeysyms.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-accels.h"
+#include "terminal-app.h"
+#include "terminal-debug.h"
+#include "terminal-intl.h"
+#include "terminal-profile.h"
+#include "terminal-util.h"
+
+/* NOTES
+ *
+ * There are two sources of keybindings changes, from GSettings and from
+ * the accel map (happens with in-place menu editing).
+ *
+ * When a keybinding GSettins key changes, we propagate that into the
+ * accel map.
+ * When the accel map changes, we queue a sync to GSettings.
+ *
+ * To avoid infinite loops, we short-circuit in both directions
+ * if the value is unchanged from last known.
+ *
+ * In the keybinding editor, when editing or clearing an accel, we write
+ * the change directly to GSettings and rely on the GSettings callback to
+ * actually apply the change to the accel map.
+ */
+
+#define ACCEL_PATH_ROOT "<Actions>/Main/"
+#define ACCEL_PATH_NEW_TAB              ACCEL_PATH_ROOT "FileNewTab"
+#define ACCEL_PATH_NEW_WINDOW           ACCEL_PATH_ROOT "FileNewWindow"
+#define ACCEL_PATH_NEW_PROFILE          ACCEL_PATH_ROOT "FileNewProfile"
+#define ACCEL_PATH_SAVE_CONTENTS        ACCEL_PATH_ROOT "FileSaveContents"
+#define ACCEL_PATH_CLOSE_TAB            ACCEL_PATH_ROOT "FileCloseTab"
+#define ACCEL_PATH_CLOSE_WINDOW         ACCEL_PATH_ROOT "FileCloseWindow"
+#define ACCEL_PATH_COPY                 ACCEL_PATH_ROOT "EditCopy"
+#define ACCEL_PATH_PASTE                ACCEL_PATH_ROOT "EditPaste"
+#define ACCEL_PATH_SELECT_ALL           ACCEL_PATH_ROOT "EditSelectAll"
+#define ACCEL_PATH_SEARCH_FIND          ACCEL_PATH_ROOT "SearchFind"
+#define ACCEL_PATH_SEARCH_FIND_NEXT     ACCEL_PATH_ROOT "SearchFindNext"
+#define ACCEL_PATH_SEARCH_FIND_PREVIOUS ACCEL_PATH_ROOT "SearchFindPrevious"
+#define ACCEL_PATH_TOGGLE_MENUBAR       ACCEL_PATH_ROOT "ViewMenubar"
+#define ACCEL_PATH_FULL_SCREEN          ACCEL_PATH_ROOT "ViewFullscreen"
+#define ACCEL_PATH_RESET                ACCEL_PATH_ROOT "TerminalReset"
+#define ACCEL_PATH_RESET_AND_CLEAR      ACCEL_PATH_ROOT "TerminalResetClear"
+#define ACCEL_PATH_PREV_PROFILE         ACCEL_PATH_ROOT "ProfilePrevious"
+#define ACCEL_PATH_NEXT_PROFILE         ACCEL_PATH_ROOT "ProfileNext"
+#define ACCEL_PATH_PREV_TAB             ACCEL_PATH_ROOT "TabsPrevious"
+#define ACCEL_PATH_NEXT_TAB             ACCEL_PATH_ROOT "TabsNext"
+#define ACCEL_PATH_SET_TERMINAL_TITLE   ACCEL_PATH_ROOT "TerminalSetTitle"
+#define ACCEL_PATH_HELP                 ACCEL_PATH_ROOT "HelpContents"
+#define ACCEL_PATH_ZOOM_IN              ACCEL_PATH_ROOT "ViewZoomIn"
+#define ACCEL_PATH_ZOOM_OUT             ACCEL_PATH_ROOT "ViewZoomOut"
+#define ACCEL_PATH_ZOOM_NORMAL          ACCEL_PATH_ROOT "ViewZoom100"
+#define ACCEL_PATH_MOVE_TAB_LEFT        ACCEL_PATH_ROOT "TabsMoveLeft"
+#define ACCEL_PATH_MOVE_TAB_RIGHT       ACCEL_PATH_ROOT "TabsMoveRight"
+#define ACCEL_PATH_DETACH_TAB           ACCEL_PATH_ROOT "TabsDetach"
+#define ACCEL_PATH_SWITCH_TAB_PREFIX    ACCEL_PATH_ROOT "TabsSwitch"
+
+#define KEY_CLOSE_TAB            "close-tab"
+#define KEY_CLOSE_WINDOW         "close-window"
+#define KEY_COPY                 "copy"
+#define KEY_DETACH_TAB           "detach-tab"
+#define KEY_FULL_SCREEN          "full-screen"
+#define KEY_HELP                 "help"
+#define KEY_MOVE_TAB_LEFT        "move-tab-left"
+#define KEY_MOVE_TAB_RIGHT       "move-tab-right"
+#define KEY_NEW_PROFILE          "new-profile"
+#define KEY_NEW_TAB              "new-tab"
+#define KEY_NEW_WINDOW           "new-window"
+#define KEY_NEXT_PROFILE         "next-profile"
+#define KEY_NEXT_TAB             "next-tab"
+#define KEY_PASTE                "paste"
+#define KEY_PREV_PROFILE         "prev-profile"
+#define KEY_PREV_TAB             "prev-tab"
+#define KEY_RESET_AND_CLEAR      "reset-and-clear"
+#define KEY_RESET                "reset"
+#define KEY_SEARCH_FIND          "search-find"
+#define KEY_SEARCH_FIND_NEXT     "search-find-next"
+#define KEY_SEARCH_FIND_PREVIOUS "search-find-previous"
+#define KEY_SELECT_ALL           "select-all"
+#define KEY_SAVE_CONTENTS        "save-contents"
+#define KEY_SET_TERMINAL_TITLE   "set-terminal-title"
+#define KEY_TOGGLE_MENUBAR       "toggle-menubar"
+#define KEY_ZOOM_IN              "zoom-in"
+#define KEY_ZOOM_NORMAL          "zoom-normal"
+#define KEY_ZOOM_OUT             "zoom-out"
+#define KEY_SWITCH_TAB_PREFIX    "switch-to-tab-"
+
+#if 1
+/*
+* We don't want to enable content saving until vte supports it async.
+* So we disable this code for stable versions.
+*/
+#include "terminal-version.h"
+
+#if (TERMINAL_MINOR_VERSION & 1) != 0
+#define ENABLE_SAVE
+#else
+#undef ENABLE_SAVE
+#endif
+#endif
+
+typedef struct
+{
+	const char *user_visible_name;
+	const char *gsettings_key;
+	const char *accel_path;
+	/* last values received from GSettings */
+	GdkModifierType gsettings_mask;
+	guint gsettings_keyval;
+	GClosure *closure;
+	/* have gotten a notification from gtk */
+	gboolean needs_gsettings_sync;
+	gboolean accel_path_unlocked;
+} KeyEntry;
+
+typedef struct
+{
+	KeyEntry *key_entry;
+	guint n_elements;
+	const char *user_visible_name;
+} KeyEntryList;
+
+static KeyEntry file_entries[] =
+{
+	{
+		N_("New Tab"),
+		KEY_NEW_TAB, ACCEL_PATH_NEW_TAB, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_t, NULL, FALSE, TRUE
+	},
+	{
+		N_("New Window"),
+		KEY_NEW_WINDOW, ACCEL_PATH_NEW_WINDOW, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_n, NULL, FALSE, TRUE
+	},
+	{
+		N_("New Profile"),
+		KEY_NEW_PROFILE, ACCEL_PATH_NEW_PROFILE, 0, 0, NULL, FALSE, TRUE
+	},
+#ifdef ENABLE_SAVE
+	{
+		N_("Save Contents"),
+		KEY_SAVE_CONTENTS, ACCEL_PATH_SAVE_CONTENTS, 0, 0, NULL, FALSE, TRUE
+	},
+#endif
+	{
+		N_("Close Tab"),
+		KEY_CLOSE_TAB, ACCEL_PATH_CLOSE_TAB, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_w, NULL, FALSE, TRUE
+	},
+	{
+		N_("Close Window"),
+		KEY_CLOSE_WINDOW, ACCEL_PATH_CLOSE_WINDOW, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_q, NULL, FALSE, TRUE
+	},
+};
+
+static KeyEntry edit_entries[] =
+{
+	{
+		N_("Copy"),
+		KEY_COPY, ACCEL_PATH_COPY, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_c, NULL, FALSE, TRUE
+	},
+	{
+		N_("Paste"),
+		KEY_PASTE, ACCEL_PATH_PASTE, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_v, NULL, FALSE, TRUE
+	},
+	{
+		N_("Select All"),
+		KEY_SELECT_ALL, ACCEL_PATH_SELECT_ALL, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_a, NULL, FALSE, TRUE
+	}
+};
+
+static KeyEntry view_entries[] =
+{
+	{
+		N_("Hide and Show menubar"),
+		KEY_TOGGLE_MENUBAR, ACCEL_PATH_TOGGLE_MENUBAR, 0, 0, NULL, FALSE, TRUE
+	},
+	{
+		N_("Full Screen"),
+		KEY_FULL_SCREEN, ACCEL_PATH_FULL_SCREEN, 0, GDK_KEY_F11, NULL, FALSE, TRUE
+	},
+	{
+		N_("Zoom In"),
+		KEY_ZOOM_IN, ACCEL_PATH_ZOOM_IN, GDK_CONTROL_MASK, GDK_KEY_plus, NULL, FALSE, TRUE
+	},
+	{
+		N_("Zoom Out"),
+		KEY_ZOOM_OUT, ACCEL_PATH_ZOOM_OUT, GDK_CONTROL_MASK, GDK_KEY_minus, NULL, FALSE, TRUE
+	},
+	{
+		N_("Normal Size"),
+		KEY_ZOOM_NORMAL, ACCEL_PATH_ZOOM_NORMAL, GDK_CONTROL_MASK, GDK_KEY_0, NULL, FALSE, TRUE
+	}
+};
+
+static KeyEntry search_entries[] =
+{
+	{
+		N_("Find"),
+		KEY_SEARCH_FIND, ACCEL_PATH_SEARCH_FIND, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_f, NULL, FALSE, TRUE
+	},
+	{
+		N_("Find Next"),
+		KEY_SEARCH_FIND_NEXT, ACCEL_PATH_SEARCH_FIND_NEXT, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_h, NULL, FALSE, TRUE
+	},
+	{
+		N_("Find Previous"),
+		KEY_SEARCH_FIND_PREVIOUS, ACCEL_PATH_SEARCH_FIND_PREVIOUS, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_g, NULL, FALSE, TRUE
+	}
+};
+
+static KeyEntry terminal_entries[] =
+{
+	{
+		N_("Set Title"),
+		KEY_SET_TERMINAL_TITLE, ACCEL_PATH_SET_TERMINAL_TITLE, 0, 0, NULL, FALSE, TRUE
+	},
+	{
+		N_("Reset"),
+		KEY_RESET, ACCEL_PATH_RESET, 0, 0, NULL, FALSE, TRUE
+	},
+	{
+		N_("Reset and Clear"),
+		KEY_RESET_AND_CLEAR, ACCEL_PATH_RESET_AND_CLEAR, 0, 0, NULL, FALSE, TRUE
+	},
+	{
+		N_("Switch to Previous Profile"),
+		KEY_PREV_PROFILE, ACCEL_PATH_PREV_PROFILE, GDK_MOD1_MASK, GDK_KEY_Page_Up, NULL, FALSE, TRUE
+	},
+	{
+		N_("Switch to Next Profile"),
+		KEY_NEXT_PROFILE, ACCEL_PATH_NEXT_PROFILE, GDK_MOD1_MASK, GDK_KEY_Page_Down, NULL, FALSE, TRUE
+	},
+};
+
+static KeyEntry tabs_entries[] =
+{
+	{
+		N_("Switch to Previous Tab"),
+		KEY_PREV_TAB, ACCEL_PATH_PREV_TAB, GDK_CONTROL_MASK, GDK_KEY_Page_Up, NULL, FALSE, TRUE
+	},
+	{
+		N_("Switch to Next Tab"),
+		KEY_NEXT_TAB, ACCEL_PATH_NEXT_TAB, GDK_CONTROL_MASK, GDK_KEY_Page_Down, NULL, FALSE, TRUE
+	},
+	{
+		N_("Move Tab to the Left"),
+		KEY_MOVE_TAB_LEFT, ACCEL_PATH_MOVE_TAB_LEFT, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_Page_Up, NULL, FALSE, TRUE
+	},
+	{
+		N_("Move Tab to the Right"),
+		KEY_MOVE_TAB_RIGHT, ACCEL_PATH_MOVE_TAB_RIGHT, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_Page_Down, NULL, FALSE, TRUE
+	},
+	{
+		N_("Detach Tab"),
+		KEY_DETACH_TAB, ACCEL_PATH_DETACH_TAB, 0, 0, NULL, FALSE, TRUE
+	},
+	{
+		N_("Switch to Tab 1"),
+		KEY_SWITCH_TAB_PREFIX "1",
+		ACCEL_PATH_SWITCH_TAB_PREFIX "1", GDK_MOD1_MASK, GDK_KEY_1, NULL, FALSE, TRUE
+	},
+	{
+		N_("Switch to Tab 2"),
+		KEY_SWITCH_TAB_PREFIX "2",
+		ACCEL_PATH_SWITCH_TAB_PREFIX "2", GDK_MOD1_MASK, GDK_KEY_2, NULL, FALSE, TRUE
+	},
+	{
+		N_("Switch to Tab 3"),
+		KEY_SWITCH_TAB_PREFIX "3",
+		ACCEL_PATH_SWITCH_TAB_PREFIX "3", GDK_MOD1_MASK, GDK_KEY_3, NULL, FALSE, TRUE
+	},
+	{
+		N_("Switch to Tab 4"),
+		KEY_SWITCH_TAB_PREFIX "4",
+		ACCEL_PATH_SWITCH_TAB_PREFIX "4", GDK_MOD1_MASK, GDK_KEY_4, NULL, FALSE, TRUE
+	},
+	{
+		N_("Switch to Tab 5"),
+		KEY_SWITCH_TAB_PREFIX "5",
+		ACCEL_PATH_SWITCH_TAB_PREFIX "5", GDK_MOD1_MASK, GDK_KEY_5, NULL, FALSE, TRUE
+	},
+	{
+		N_("Switch to Tab 6"),
+		KEY_SWITCH_TAB_PREFIX "6",
+		ACCEL_PATH_SWITCH_TAB_PREFIX "6", GDK_MOD1_MASK, GDK_KEY_6, NULL, FALSE, TRUE
+	},
+	{
+		N_("Switch to Tab 7"),
+		KEY_SWITCH_TAB_PREFIX "7",
+		ACCEL_PATH_SWITCH_TAB_PREFIX "7", GDK_MOD1_MASK, GDK_KEY_7, NULL, FALSE, TRUE
+	},
+	{
+		N_("Switch to Tab 8"),
+		KEY_SWITCH_TAB_PREFIX "8",
+		ACCEL_PATH_SWITCH_TAB_PREFIX "8", GDK_MOD1_MASK, GDK_KEY_8, NULL, FALSE, TRUE
+	},
+	{
+		N_("Switch to Tab 9"),
+		KEY_SWITCH_TAB_PREFIX "9",
+		ACCEL_PATH_SWITCH_TAB_PREFIX "9", GDK_MOD1_MASK, GDK_KEY_9, NULL, FALSE, TRUE
+	},
+	{
+		N_("Switch to Tab 10"),
+		KEY_SWITCH_TAB_PREFIX "10",
+		ACCEL_PATH_SWITCH_TAB_PREFIX "10", GDK_MOD1_MASK, GDK_KEY_0, NULL, FALSE, TRUE
+	},
+	{
+		N_("Switch to Tab 11"),
+		KEY_SWITCH_TAB_PREFIX "11",
+		ACCEL_PATH_SWITCH_TAB_PREFIX "11", 0, 0, NULL, FALSE, TRUE
+	},
+	{
+		N_("Switch to Tab 12"),
+		KEY_SWITCH_TAB_PREFIX "12",
+		ACCEL_PATH_SWITCH_TAB_PREFIX "12", 0, 0, NULL, FALSE, TRUE
+	}
+};
+
+static KeyEntry help_entries[] =
+{
+	{ N_("Contents"), KEY_HELP, ACCEL_PATH_HELP, 0, GDK_KEY_F1, NULL, FALSE, TRUE }
+};
+
+static KeyEntryList all_entries[] =
+{
+	{ file_entries, G_N_ELEMENTS (file_entries), N_("File") },
+	{ edit_entries, G_N_ELEMENTS (edit_entries), N_("Edit") },
+	{ view_entries, G_N_ELEMENTS (view_entries), N_("View") },
+	{ search_entries, G_N_ELEMENTS (search_entries), N_("Search") },
+	{ terminal_entries, G_N_ELEMENTS (terminal_entries), N_("Terminal") },
+	{ tabs_entries, G_N_ELEMENTS (tabs_entries), N_("Tabs") },
+	{ help_entries, G_N_ELEMENTS (help_entries), N_("Help") }
+};
+
+enum
+{
+    ACTION_COLUMN,
+    KEYVAL_COLUMN,
+    N_COLUMNS
+};
+
+static void keys_change_notify (GSettings *settings,
+                                const gchar *key,
+                                gpointer user_data);
+
+static void accel_changed_callback (GtkAccelGroup  *accel_group,
+                                    guint           keyval,
+                                    GdkModifierType modifier,
+                                    GClosure       *accel_closure,
+                                    gpointer        data);
+
+static gboolean binding_from_string (const char      *str,
+                                     guint           *accelerator_key,
+                                     GdkModifierType *accelerator_mods);
+
+static gboolean binding_from_value  (GVariant        *value,
+                                     guint           *accelerator_key,
+                                     GdkModifierType *accelerator_mods);
+
+static gboolean sync_idle_cb (gpointer data);
+
+static guint sync_idle_id = 0;
+static GtkAccelGroup *notification_group = NULL;
+/* never set GSettings keys in response to receiving a GSettings notify. */
+static int inside_gsettings_notify = 0;
+static GtkWidget *edit_keys_dialog = NULL;
+static GtkTreeStore *edit_keys_store = NULL;
+static GHashTable *gsettings_key_to_entry;
+static GSettings *settings_keybindings;
+
+static char*
+binding_name (guint            keyval,
+              GdkModifierType  mask)
+{
+	if (keyval != 0)
+		return gtk_accelerator_name (keyval, mask);
+
+	return g_strdup ("disabled");
+}
+
+static char*
+binding_display_name (guint            keyval,
+                      GdkModifierType  mask)
+{
+	if (keyval != 0)
+		return gtk_accelerator_get_label (keyval, mask);
+
+	return g_strdup (_("Disabled"));
+}
+
+void
+terminal_accels_init (void)
+{
+	guint i, j;
+
+	settings_keybindings = g_settings_new (CONF_KEYS_SCHEMA);
+
+	g_signal_connect (settings_keybindings,
+			  "changed",
+			  G_CALLBACK(keys_change_notify),
+			  NULL);
+
+	gsettings_key_to_entry = g_hash_table_new (g_str_hash, g_str_equal);
+
+	notification_group = gtk_accel_group_new ();
+
+	for (i = 0; i < G_N_ELEMENTS (all_entries); ++i)
+	{
+		for (j = 0; j < all_entries[i].n_elements; ++j)
+		{
+			KeyEntry *key_entry;
+
+			key_entry = &(all_entries[i].key_entry[j]);
+
+			g_hash_table_insert (gsettings_key_to_entry,
+			                     (gpointer) key_entry->gsettings_key,
+			                     key_entry);
+
+			key_entry->closure = g_closure_new_simple (sizeof (GClosure), key_entry);
+
+			g_closure_ref (key_entry->closure);
+			g_closure_sink (key_entry->closure);
+
+			gtk_accel_group_connect_by_path (notification_group,
+			                                 I_(key_entry->accel_path),
+			                                 key_entry->closure);
+			keys_change_notify (settings_keybindings, key_entry->gsettings_key, NULL);
+		}
+	}
+
+	g_signal_connect (notification_group, "accel-changed",
+	                  G_CALLBACK (accel_changed_callback), NULL);
+}
+
+void
+terminal_accels_shutdown (void)
+{
+
+	g_signal_handlers_disconnect_by_func (settings_keybindings,
+					      G_CALLBACK(keys_change_notify),
+					      NULL);
+	g_object_unref (settings_keybindings);
+
+	if (sync_idle_id != 0)
+	{
+		g_source_remove (sync_idle_id);
+		sync_idle_id = 0;
+
+		sync_idle_cb (NULL);
+	}
+
+	g_hash_table_destroy (gsettings_key_to_entry);
+	gsettings_key_to_entry = NULL;
+
+	g_object_unref (notification_group);
+	notification_group = NULL;
+}
+
+static gboolean
+update_model_foreach (GtkTreeModel *model,
+                      GtkTreePath  *path,
+                      GtkTreeIter  *iter,
+                      gpointer      data)
+{
+	KeyEntry *key_entry = NULL;
+
+	gtk_tree_model_get (model, iter,
+	                    KEYVAL_COLUMN, &key_entry,
+	                    -1);
+
+	if (key_entry == (KeyEntry *) data)
+	{
+		gtk_tree_model_row_changed (model, path, iter);
+		return TRUE;
+	}
+	return FALSE;
+}
+
+static void
+keys_change_notify (GSettings *settings,
+                    const gchar *key,
+                    gpointer user_data)
+{
+	GVariant *val;
+	KeyEntry *key_entry;
+	GdkModifierType mask;
+	guint keyval;
+
+	_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+	                       "key %s changed\n",
+	                       key);
+
+	val = g_settings_get_value (settings, key);
+
+#ifdef MATE_ENABLE_DEBUG
+	_TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS)
+	{
+		if (val == NULL)
+			_terminal_debug_print (TERMINAL_DEBUG_ACCELS, " changed to be unset\n");
+		else if (!g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))
+			_terminal_debug_print (TERMINAL_DEBUG_ACCELS, " changed to non-string value\n");
+		else
+			_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+			                       " changed to \"%s\"\n",
+			                       g_variant_get_string (val, NULL));
+	}
+#endif
+
+	key_entry = g_hash_table_lookup (gsettings_key_to_entry, key);
+	if (!key_entry)
+	{
+		/* shouldn't really happen, but let's be safe */
+		_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+		                       "  WARNING: KeyEntry for changed key not found, bailing out\n");
+		return;
+	}
+
+	if (!binding_from_value (val, &keyval, &mask))
+	{
+		const char *str = g_variant_is_of_type (val, G_VARIANT_TYPE_STRING) ? g_variant_get_string (val, NULL) : NULL;
+		g_printerr ("The value \"%s\" of configuration key %s is not a valid accelerator\n",
+		            str ? str : "(null)",
+		            key_entry->gsettings_key);
+		return;
+	}
+	key_entry->gsettings_keyval = keyval;
+	key_entry->gsettings_mask = mask;
+
+	/* Unlock the path, so we can change its accel */
+	if (!key_entry->accel_path_unlocked)
+		gtk_accel_map_unlock_path (key_entry->accel_path);
+
+	/* sync over to GTK */
+	_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+	                       "changing path %s to %s\n",
+	                       key_entry->accel_path,
+	                       binding_name (keyval, mask)); /* memleak */
+	inside_gsettings_notify += 1;
+	/* Note that this may return FALSE, e.g. when the entry was already set correctly. */
+	gtk_accel_map_change_entry (key_entry->accel_path,
+	                            keyval, mask,
+	                            TRUE);
+	inside_gsettings_notify -= 1;
+
+	/* Lock the path if the GSettings key isn't writable */
+	key_entry->accel_path_unlocked = g_settings_is_writable (settings, key);
+	if (!key_entry->accel_path_unlocked)
+		gtk_accel_map_lock_path (key_entry->accel_path);
+
+	/* This seems necessary to update the tree model, since sometimes the
+	 * notification on the notification_group seems not to be emitted correctly.
+	 * Without this change, when trying to set an accel to e.g. Alt-T (while the main
+	 * menu in the terminal windows is _Terminal with Alt-T mnemonic) only displays
+	 * the accel change after a re-expose of the row.
+	 * FIXME: Find out *why* the accel-changed signal is wrong here!
+	 */
+	if (edit_keys_store)
+		gtk_tree_model_foreach (GTK_TREE_MODEL (edit_keys_store), update_model_foreach, key_entry);
+
+	g_variant_unref(val);
+}
+
+static void
+accel_changed_callback (GtkAccelGroup  *accel_group,
+                        guint           keyval,
+                        GdkModifierType modifier,
+                        GClosure       *accel_closure,
+                        gpointer        data)
+{
+	/* FIXME because GTK accel API is so nonsensical, we get
+	 * a notify for each closure, on both the added and the removed
+	 * accelerator. We just use the accel closure to find our
+	 * accel entry, then update the value of that entry.
+	 * We use an idle function to avoid setting the entry
+	 * in GSettings when the accelerator gets removed and then
+	 * setting it again when it gets added.
+	 */
+	KeyEntry *key_entry;
+
+	_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+	                       "Changed accel %s closure %p\n",
+	                       binding_name (keyval, modifier), /* memleak */
+	                       accel_closure);
+
+	if (inside_gsettings_notify)
+	{
+		_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+		                       "Ignoring change from gtk because we're inside a GSettings notify\n");
+		return;
+	}
+
+	key_entry = accel_closure->data;
+	g_assert (key_entry);
+
+	key_entry->needs_gsettings_sync = TRUE;
+
+	if (sync_idle_id == 0)
+		sync_idle_id = g_idle_add (sync_idle_cb, NULL);
+}
+
+static gboolean
+binding_from_string (const char      *str,
+                     guint           *accelerator_key,
+                     GdkModifierType *accelerator_mods)
+{
+	if (str == NULL ||
+	        strcmp (str, "disabled") == 0)
+	{
+		*accelerator_key = 0;
+		*accelerator_mods = 0;
+		return TRUE;
+	}
+
+	gtk_accelerator_parse (str, accelerator_key, accelerator_mods);
+	if (*accelerator_key == 0 &&
+	        *accelerator_mods == 0)
+		return FALSE;
+
+	return TRUE;
+}
+
+static gboolean
+binding_from_value (GVariant         *value,
+                    guint            *accelerator_key,
+                    GdkModifierType  *accelerator_mods)
+{
+	if (value == NULL)
+	{
+		/* unset */
+		*accelerator_key = 0;
+		*accelerator_mods = 0;
+		return TRUE;
+	}
+
+	if (!g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
+		return FALSE;
+
+	return binding_from_string (g_variant_get_string (value,NULL),
+	                            accelerator_key,
+	                            accelerator_mods);
+}
+
+static void
+add_key_entry_to_changeset (gpointer key,
+                            KeyEntry *key_entry,
+                            GSettings *changeset)
+{
+	GtkAccelKey gtk_key;
+
+	if (!key_entry->needs_gsettings_sync)
+		return;
+
+	key_entry->needs_gsettings_sync = FALSE;
+
+	if (gtk_accel_map_lookup_entry (key_entry->accel_path, &gtk_key) &&
+	        (gtk_key.accel_key != key_entry->gsettings_keyval ||
+	         gtk_key.accel_mods != key_entry->gsettings_mask))
+	{
+		char *accel_name;
+
+		accel_name = binding_name (gtk_key.accel_key, gtk_key.accel_mods);
+		g_settings_set_string (changeset, key_entry->gsettings_key, accel_name);
+		g_free (accel_name);
+	}
+}
+
+static gboolean
+sync_idle_cb (gpointer data)
+{
+	GSettings *changeset;
+
+	_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+	                       "GSettings sync handler\n");
+
+	sync_idle_id = 0;
+
+	changeset = g_settings_new (CONF_KEYS_SCHEMA);
+	g_settings_delay (changeset);
+
+	g_hash_table_foreach (gsettings_key_to_entry, (GHFunc) add_key_entry_to_changeset, changeset);
+	g_settings_apply(changeset);
+
+	g_object_unref (changeset);
+
+	return FALSE;
+}
+
+/* We have the same KeyEntry* in both columns;
+ * we only have two columns because we want to be able
+ * to sort by either one of them.
+ */
+
+static void
+accel_set_func (GtkTreeViewColumn *tree_column,
+                GtkCellRenderer   *cell,
+                GtkTreeModel      *model,
+                GtkTreeIter       *iter,
+                gpointer           data)
+{
+	KeyEntry *ke;
+
+	gtk_tree_model_get (model, iter,
+	                    KEYVAL_COLUMN, &ke,
+	                    -1);
+
+	if (ke == NULL)
+		/* This is a title row */
+		g_object_set (cell,
+		              "visible", FALSE,
+		              NULL);
+	else
+		g_object_set (cell,
+		              "visible", TRUE,
+		              "sensitive", ke->accel_path_unlocked,
+		              "editable", ke->accel_path_unlocked,
+		              "accel-key", ke->gsettings_keyval,
+		              "accel-mods", ke->gsettings_mask,
+		              NULL);
+}
+
+static int
+accel_compare_func (GtkTreeModel *model,
+                    GtkTreeIter  *a,
+                    GtkTreeIter  *b,
+                    gpointer      user_data)
+{
+	KeyEntry *ke_a;
+	KeyEntry *ke_b;
+	char *name_a;
+	char *name_b;
+	int result;
+
+	gtk_tree_model_get (model, a,
+	                    KEYVAL_COLUMN, &ke_a,
+	                    -1);
+	if (ke_a == NULL)
+	{
+		gtk_tree_model_get (model, a,
+		                    ACTION_COLUMN, &name_a,
+		                    -1);
+	}
+	else
+	{
+		name_a = binding_display_name (ke_a->gsettings_keyval,
+		                               ke_a->gsettings_mask);
+	}
+
+	gtk_tree_model_get (model, b,
+	                    KEYVAL_COLUMN, &ke_b,
+	                    -1);
+	if (ke_b == NULL)
+	{
+		gtk_tree_model_get (model, b,
+		                    ACTION_COLUMN, &name_b,
+		                    -1);
+	}
+	else
+	{
+		name_b = binding_display_name (ke_b->gsettings_keyval,
+		                               ke_b->gsettings_mask);
+	}
+
+	result = g_utf8_collate (name_a, name_b);
+
+	g_free (name_a);
+	g_free (name_b);
+
+	return result;
+}
+
+static void
+treeview_accel_changed_cb (GtkAccelGroup  *accel_group,
+                           guint keyval,
+                           GdkModifierType modifier,
+                           GClosure *accel_closure,
+                           GtkTreeModel *model)
+{
+	gtk_tree_model_foreach (model, update_model_foreach, accel_closure->data);
+}
+
+static void
+accel_edited_callback (GtkCellRendererAccel *cell,
+                       gchar                *path_string,
+                       guint                 keyval,
+                       GdkModifierType       mask,
+                       guint                 hardware_keycode,
+                       GtkTreeView          *view)
+{
+	GtkTreeModel *model;
+	GtkTreePath *path;
+	GtkTreeIter iter;
+	KeyEntry *ke;
+	GtkAccelGroupEntry *entries;
+	guint n_entries;
+	char *str;
+
+	model = gtk_tree_view_get_model (view);
+
+	path = gtk_tree_path_new_from_string (path_string);
+	if (!path)
+		return;
+
+	if (!gtk_tree_model_get_iter (model, &iter, path))
+	{
+		gtk_tree_path_free (path);
+		return;
+	}
+	gtk_tree_path_free (path);
+
+	gtk_tree_model_get (model, &iter, KEYVAL_COLUMN, &ke, -1);
+
+	/* sanity check */
+	if (ke == NULL)
+		return;
+
+	/* Check if we already have an entry using this accel */
+	entries = gtk_accel_group_query (notification_group, keyval, mask, &n_entries);
+	if (n_entries > 0)
+	{
+		if (entries[0].accel_path_quark != g_quark_from_string (ke->accel_path))
+		{
+			GtkWidget *dialog;
+			char *name;
+			KeyEntry *other_key;
+
+			name = gtk_accelerator_get_label (keyval, mask);
+			other_key = entries[0].closure->data;
+			g_assert (other_key);
+
+			dialog =
+			    gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))),
+			                            GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
+			                            GTK_MESSAGE_WARNING,
+			                            GTK_BUTTONS_OK,
+			                            _("The shortcut key “%s” is already bound to the “%s” action"),
+			                            name,
+
+other_key->user_visible_name ? _(other_key->user_visible_name) : other_key->gsettings_key);
+			g_free (name);
+
+			g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
+			gtk_window_present (GTK_WINDOW (dialog));
+		}
+
+		return;
+	}
+
+	str = binding_name (keyval, mask);
+
+	_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+	                       "Edited path %s keyval %s, setting GSettings to %s\n",
+	                       ke->accel_path,
+	                       gdk_keyval_name (keyval) ? gdk_keyval_name (keyval) : "null",
+	                       str);
+#ifdef MATE_ENABLE_DEBUG
+	_TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS)
+	{
+		GtkAccelKey old_key;
+
+		if (gtk_accel_map_lookup_entry (ke->accel_path, &old_key))
+		{
+			_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+			                       "  Old entry of path %s is keyval %s mask %x\n",
+			                       ke->accel_path, gdk_keyval_name (old_key.accel_key), old_key.accel_mods);
+		}
+		else
+		{
+			_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+			                       "  Failed to look up the old entry of path %s\n",
+			                       ke->accel_path);
+		}
+	}
+#endif
+
+	g_settings_set_string (settings_keybindings,
+	                       ke->gsettings_key,
+	                       str);
+	g_free (str);
+}
+
+static void
+accel_cleared_callback (GtkCellRendererAccel *cell,
+                        gchar                *path_string,
+                        GtkTreeView          *view)
+{
+	GtkTreeModel *model;
+	GtkTreePath *path;
+	GtkTreeIter iter;
+	KeyEntry *ke;
+	char *str;
+
+	model = gtk_tree_view_get_model (view);
+
+	path = gtk_tree_path_new_from_string (path_string);
+	if (!path)
+		return;
+
+	if (!gtk_tree_model_get_iter (model, &iter, path))
+	{
+		gtk_tree_path_free (path);
+		return;
+	}
+	gtk_tree_path_free (path);
+
+	gtk_tree_model_get (model, &iter, KEYVAL_COLUMN, &ke, -1);
+
+	/* sanity check */
+	if (ke == NULL)
+		return;
+
+	ke->gsettings_keyval = 0;
+	ke->gsettings_mask = 0;
+	ke->needs_gsettings_sync = TRUE;
+
+	str = binding_name (0, 0);
+
+	_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+	                       "Cleared keybinding for GSettings %s",
+	                       ke->gsettings_key);
+
+	g_settings_set_string (settings_keybindings,
+	                       ke->gsettings_key,
+	                       str);
+	g_free (str);
+}
+
+static void
+edit_keys_dialog_destroy_cb (GtkWidget *widget,
+                             gpointer user_data)
+{
+	g_signal_handlers_disconnect_by_func (notification_group, G_CALLBACK (treeview_accel_changed_cb), user_data);
+	edit_keys_dialog = NULL;
+	edit_keys_store = NULL;
+}
+
+static void
+edit_keys_dialog_response_cb (GtkWidget *editor,
+                              int response,
+                              gpointer use_data)
+{
+	if (response == GTK_RESPONSE_HELP)
+	{
+		terminal_util_show_help ("mate-terminal-shortcuts", GTK_WINDOW (editor));
+		return;
+	}
+
+	gtk_widget_destroy (editor);
+}
+
+#ifdef MATE_ENABLE_DEBUG
+static void
+row_changed (GtkTreeModel *tree_model,
+             GtkTreePath  *path,
+             GtkTreeIter  *iter,
+             gpointer      user_data)
+{
+	_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+	                       "ROW-CHANGED [%s]\n", gtk_tree_path_to_string (path) /* leak */);
+}
+#endif
+
+void
+terminal_edit_keys_dialog_show (GtkWindow *transient_parent)
+{
+	TerminalApp *app;
+	GtkWidget *dialog, *tree_view, *disable_mnemonics_button, *disable_menu_accel_button;
+	GtkTreeViewColumn *column;
+	GtkCellRenderer *cell_renderer;
+	GtkTreeStore *tree;
+	guint i;
+
+	if (edit_keys_dialog != NULL)
+		goto done;
+
+	if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/keybinding-editor.ui",
+	                                      "keybindings-dialog", &dialog,
+	                                      "disable-mnemonics-checkbutton", &disable_mnemonics_button,
+	                                      "disable-menu-accel-checkbutton", &disable_menu_accel_button,
+	                                      "accelerators-treeview", &tree_view,
+	                                      NULL))
+		return;
+
+	app = terminal_app_get ();
+	terminal_util_bind_object_property_to_widget (G_OBJECT (app), TERMINAL_APP_ENABLE_MNEMONICS,
+	        disable_mnemonics_button, 0);
+	terminal_util_bind_object_property_to_widget (G_OBJECT (app), TERMINAL_APP_ENABLE_MENU_BAR_ACCEL,
+	        disable_menu_accel_button, 0);
+
+	/* Column 1 */
+	cell_renderer = gtk_cell_renderer_text_new ();
+	column = gtk_tree_view_column_new_with_attributes (_("_Action"),
+	         cell_renderer,
+	         "text", ACTION_COLUMN,
+	         NULL);
+	gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
+	gtk_tree_view_column_set_sort_column_id (column, ACTION_COLUMN);
+
+	/* Column 2 */
+	cell_renderer = gtk_cell_renderer_accel_new ();
+	g_object_set (cell_renderer,
+	              "editable", TRUE,
+	              "accel-mode", GTK_CELL_RENDERER_ACCEL_MODE_GTK,
+	              NULL);
+	g_signal_connect (cell_renderer, "accel-edited",
+	                  G_CALLBACK (accel_edited_callback), tree_view);
+	g_signal_connect (cell_renderer, "accel-cleared",
+	                  G_CALLBACK (accel_cleared_callback), tree_view);
+
+	column = gtk_tree_view_column_new ();
+	gtk_tree_view_column_set_title (column, _("Shortcut _Key"));
+	gtk_tree_view_column_pack_start (column, cell_renderer, TRUE);
+	gtk_tree_view_column_set_cell_data_func (column, cell_renderer, accel_set_func, NULL, NULL);
+	gtk_tree_view_column_set_sort_column_id (column, KEYVAL_COLUMN);
+	gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
+
+	/* Add the data */
+
+	tree = edit_keys_store = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER);
+
+#ifdef MATE_ENABLE_DEBUG
+	_TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS)
+	g_signal_connect (tree, "row-changed", G_CALLBACK (row_changed), NULL);
+#endif
+
+	for (i = 0; i < G_N_ELEMENTS (all_entries); ++i)
+	{
+		GtkTreeIter parent_iter;
+		guint j;
+
+		gtk_tree_store_append (tree, &parent_iter, NULL);
+		gtk_tree_store_set (tree, &parent_iter,
+		                    ACTION_COLUMN, _(all_entries[i].user_visible_name),
+		                    -1);
+
+		for (j = 0; j < all_entries[i].n_elements; ++j)
+		{
+			KeyEntry *key_entry = &(all_entries[i].key_entry[j]);
+			GtkTreeIter iter;
+
+			gtk_tree_store_insert_with_values (tree, &iter, &parent_iter, -1,
+			                                   ACTION_COLUMN, _(key_entry->user_visible_name),
+			                                   KEYVAL_COLUMN, key_entry,
+			                                   -1);
+		}
+	}
+
+	gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (tree),
+	                                 KEYVAL_COLUMN, accel_compare_func,
+	                                 NULL, NULL);
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (tree), ACTION_COLUMN,
+	                                      GTK_SORT_ASCENDING);
+
+	gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL (tree));
+	g_object_unref (tree);
+
+	gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view));
+
+	g_signal_connect (notification_group, "accel-changed",
+	                  G_CALLBACK (treeview_accel_changed_cb), tree);
+
+	edit_keys_dialog = dialog;
+	g_signal_connect (dialog, "destroy",
+	                  G_CALLBACK (edit_keys_dialog_destroy_cb), tree);
+	g_signal_connect (dialog, "response",
+	                  G_CALLBACK (edit_keys_dialog_response_cb),
+	                  NULL);
+	gtk_window_set_default_size (GTK_WINDOW (dialog), -1, 350);
+
+done:
+	gtk_window_set_transient_for (GTK_WINDOW (edit_keys_dialog), transient_parent);
+	gtk_window_present (GTK_WINDOW (edit_keys_dialog));
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/3.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/3.html new file mode 100644 index 0000000..f721573 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/3.html @@ -0,0 +1,541 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/* eggdesktopfile.h - Freedesktop.Org Desktop Files
+ * Copyright (C) 2007 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING.LIB. If not,
+ * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __EGG_DESKTOP_FILE_H__
+#define __EGG_DESKTOP_FILE_H__
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+typedef struct EggDesktopFile EggDesktopFile;
+
+typedef enum {
+    EGG_DESKTOP_FILE_TYPE_UNRECOGNIZED,
+
+    EGG_DESKTOP_FILE_TYPE_APPLICATION,
+    EGG_DESKTOP_FILE_TYPE_LINK,
+    EGG_DESKTOP_FILE_TYPE_DIRECTORY
+} EggDesktopFileType;
+
+EggDesktopFile     *egg_desktop_file_new                   (const char   *desktop_file_path,
+                                                            GError      **error);
+EggDesktopFile     *egg_desktop_file_new_from_data_dirs    (const char   *desktop_file_path,
+                                                            GError      **error);
+EggDesktopFile     *egg_desktop_file_new_from_dirs         (const char   *desktop_file_path,
+                                                            const char  **search_dirs,
+                                                            GError      **error);
+EggDesktopFile     *egg_desktop_file_new_from_key_file     (GKeyFile     *key_file,
+                                                            const char   *source,
+                                                            GError      **error);
+void                egg_desktop_file_free                  (EggDesktopFile  *desktop_file);
+const char         *egg_desktop_file_get_source            (EggDesktopFile  *desktop_file);
+EggDesktopFileType  egg_desktop_file_get_desktop_file_type (EggDesktopFile  *desktop_file);
+const char         *egg_desktop_file_get_name              (EggDesktopFile  *desktop_file);
+const char         *egg_desktop_file_get_icon              (EggDesktopFile  *desktop_file);
+gboolean            egg_desktop_file_can_launch            (EggDesktopFile  *desktop_file,
+                                                            const char      *desktop_environment);
+gboolean            egg_desktop_file_accepts_documents     (EggDesktopFile  *desktop_file);
+gboolean            egg_desktop_file_accepts_multiple      (EggDesktopFile  *desktop_file);
+gboolean            egg_desktop_file_accepts_uris          (EggDesktopFile  *desktop_file);
+char               *egg_desktop_file_parse_exec            (EggDesktopFile  *desktop_file,
+                                                            GSList          *documents,
+                                                            GError         **error);
+gboolean            egg_desktop_file_launch                (EggDesktopFile  *desktop_file,
+                                                            GSList          *documents,
+                                                            GError         **error,
+                                                            ...) G_GNUC_NULL_TERMINATED;
+
+typedef enum {
+    EGG_DESKTOP_FILE_LAUNCH_CLEARENV = 1,
+    EGG_DESKTOP_FILE_LAUNCH_PUTENV,
+    EGG_DESKTOP_FILE_LAUNCH_SCREEN,
+    EGG_DESKTOP_FILE_LAUNCH_WORKSPACE,
+    EGG_DESKTOP_FILE_LAUNCH_DIRECTORY,
+    EGG_DESKTOP_FILE_LAUNCH_TIME,
+    EGG_DESKTOP_FILE_LAUNCH_FLAGS,
+    EGG_DESKTOP_FILE_LAUNCH_SETUP_FUNC,
+    EGG_DESKTOP_FILE_LAUNCH_RETURN_PID,
+    EGG_DESKTOP_FILE_LAUNCH_RETURN_STDIN_PIPE,
+    EGG_DESKTOP_FILE_LAUNCH_RETURN_STDOUT_PIPE,
+    EGG_DESKTOP_FILE_LAUNCH_RETURN_STDERR_PIPE,
+    EGG_DESKTOP_FILE_LAUNCH_RETURN_STARTUP_ID
+} EggDesktopFileLaunchOption;
+
+/* Standard Keys */
+#define EGG_DESKTOP_FILE_GROUP                  "Desktop Entry"
+
+#define EGG_DESKTOP_FILE_KEY_TYPE               "Type"
+#define EGG_DESKTOP_FILE_KEY_VERSION            "Version"
+#define EGG_DESKTOP_FILE_KEY_NAME               "Name"
+#define EGG_DESKTOP_FILE_KEY_GENERIC_NAME       "GenericName"
+#define EGG_DESKTOP_FILE_KEY_NO_DISPLAY         "NoDisplay"
+#define EGG_DESKTOP_FILE_KEY_COMMENT            "Comment"
+#define EGG_DESKTOP_FILE_KEY_ICON               "Icon"
+#define EGG_DESKTOP_FILE_KEY_HIDDEN             "Hidden"
+#define EGG_DESKTOP_FILE_KEY_ONLY_SHOW_IN       "OnlyShowIn"
+#define EGG_DESKTOP_FILE_KEY_NOT_SHOW_IN        "NotShowIn"
+#define EGG_DESKTOP_FILE_KEY_TRY_EXEC           "TryExec"
+#define EGG_DESKTOP_FILE_KEY_EXEC               "Exec"
+#define EGG_DESKTOP_FILE_KEY_PATH               "Path"
+#define EGG_DESKTOP_FILE_KEY_TERMINAL           "Terminal"
+#define EGG_DESKTOP_FILE_KEY_MIME_TYPE          "MimeType"
+#define EGG_DESKTOP_FILE_KEY_CATEGORIES         "Categories"
+#define EGG_DESKTOP_FILE_KEY_STARTUP_NOTIFY     "StartupNotify"
+#define EGG_DESKTOP_FILE_KEY_STARTUP_WM_CLASS   "StartupWMClass"
+#define EGG_DESKTOP_FILE_KEY_URL                "URL"
+
+/* Accessors */
+gboolean  egg_desktop_file_has_key                (EggDesktopFile  *desktop_file,
+                                                   const char      *key,
+                                                   GError         **error);
+char     *egg_desktop_file_get_string             (EggDesktopFile  *desktop_file,
+                                                   const char      *key,
+                                                   GError         **error) G_GNUC_MALLOC;
+char     *egg_desktop_file_get_locale_string      (EggDesktopFile  *desktop_file,
+                                                   const char      *key,
+                                                   const char      *locale,
+                                                   GError         **error) G_GNUC_MALLOC;
+gboolean  egg_desktop_file_get_boolean            (EggDesktopFile  *desktop_file,
+                                                   const char      *key,
+                                                   GError         **error);
+double    egg_desktop_file_get_numeric            (EggDesktopFile  *desktop_file,
+                                                   const char      *key,
+                                                   GError         **error);
+int	      egg_desktop_file_get_integer            (EggDesktopFile  *desktop_file,
+                                                   const char      *key,
+                                                   GError         **error);
+char    **egg_desktop_file_get_string_list        (EggDesktopFile  *desktop_file,
+                                                   const char      *key,
+                                                   gsize           *length,
+                                                   GError         **error) G_GNUC_MALLOC;
+char    **egg_desktop_file_get_locale_string_list (EggDesktopFile  *desktop_file,
+                                                   const char      *key,
+                                                   const char      *locale,
+                                                   gsize           *length,
+                                                   GError         **error) G_GNUC_MALLOC;
+
+/* Errors */
+#define EGG_DESKTOP_FILE_ERROR egg_desktop_file_error_quark()
+
+GQuark egg_desktop_file_error_quark (void);
+
+typedef enum {
+    EGG_DESKTOP_FILE_ERROR_INVALID,
+    EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE,
+    EGG_DESKTOP_FILE_ERROR_UNRECOGNIZED_OPTION
+} EggDesktopFileError;
+
+/* Global application desktop file */
+void            egg_set_desktop_file (const char *desktop_file_path);
+void            egg_set_desktop_file_without_defaults (const char *desktop_file_path);
+EggDesktopFile *egg_get_desktop_file (void);
+
+G_END_DECLS
+
+#endif /* __EGG_DESKTOP_FILE_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/30.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/30.html new file mode 100644 index 0000000..3600028 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/30.html @@ -0,0 +1,309 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
/*
+ * Copyright © 2001 Havoc Pennington
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * 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 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TERMINAL_ACCELS_H
+#define TERMINAL_ACCELS_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+void terminal_accels_init (void);
+
+void terminal_accels_shutdown (void);
+
+void terminal_edit_keys_dialog_show (GtkWindow *transient_parent);
+
+G_END_DECLS
+
+#endif /* TERMINAL_ACCELS_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/31.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/31.html new file mode 100644 index 0000000..f20cb54 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/31.html @@ -0,0 +1,567 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * Copyright © 2001 Havoc Pennington
+ * Copyright © 2008 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * 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 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TERMINAL_APP_H
+#define TERMINAL_APP_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-encoding.h"
+#include "terminal-screen.h"
+#include "terminal-options.h"
+
+G_BEGIN_DECLS
+
+/* Terminal conf files */
+
+#define TERMINAL_CONFIG_VERSION             (1) /* Bump this for any changes */
+#define TERMINAL_CONFIG_COMPAT_VERSION      (1) /* Bump this for incompatible changes */
+
+#define TERMINAL_CONFIG_GROUP               "MATE Terminal Configuration"
+#define TERMINAL_CONFIG_PROP_VERSION        "Version"
+#define TERMINAL_CONFIG_PROP_COMPAT_VERSION "CompatVersion"
+#define TERMINAL_CONFIG_PROP_WINDOWS        "Windows"
+
+#define TERMINAL_CONFIG_WINDOW_PROP_ACTIVE_TAB       "ActiveTerminal"
+#define TERMINAL_CONFIG_WINDOW_PROP_FULLSCREEN       "Fullscreen"
+#define TERMINAL_CONFIG_WINDOW_PROP_GEOMETRY         "Geometry"
+#define TERMINAL_CONFIG_WINDOW_PROP_MAXIMIZED        "Maximized"
+#define TERMINAL_CONFIG_WINDOW_PROP_MENUBAR_VISIBLE  "MenubarVisible"
+#define TERMINAL_CONFIG_WINDOW_PROP_ROLE             "Role"
+#define TERMINAL_CONFIG_WINDOW_PROP_TABS             "Terminals"
+
+#define TERMINAL_CONFIG_TERMINAL_PROP_HEIGHT             "Height"
+#define TERMINAL_CONFIG_TERMINAL_PROP_COMMAND            "Command"
+#define TERMINAL_CONFIG_TERMINAL_PROP_PROFILE_ID         "ProfileID"
+#define TERMINAL_CONFIG_TERMINAL_PROP_TITLE              "Title"
+#define TERMINAL_CONFIG_TERMINAL_PROP_WIDTH              "Width"
+#define TERMINAL_CONFIG_TERMINAL_PROP_WORKING_DIRECTORY  "WorkingDirectory"
+#define TERMINAL_CONFIG_TERMINAL_PROP_ZOOM               "Zoom"
+
+/* Configuration */
+
+#define CONF_PREFIX           "org.mate.terminal"
+#define CONF_GLOBAL_SCHEMA    CONF_PREFIX ".global"
+#define CONF_PROFILES_SCHEMA  CONF_PREFIX ".profiles"
+#define CONF_PROFILE_SCHEMA   CONF_PREFIX ".profile"
+#define CONF_KEYS_SCHEMA      CONF_PREFIX ".keybindings"
+#define CONF_PROFILE_PREFIX   "/org/mate/terminal/profiles/"
+
+#define MATE_TERMINAL_ICON_NAME "utilities-terminal"
+
+#define TERMINAL_APP_DEFAULT_PROFILE        "default-profile"
+#define TERMINAL_APP_ENABLE_MENU_BAR_ACCEL  "enable-menu-accels"
+#define TERMINAL_APP_ENABLE_MNEMONICS       "enable-mnemonics"
+#define TERMINAL_APP_SYSTEM_FONT            "system-font"
+
+/* TerminalApp */
+
+#define TERMINAL_TYPE_APP              (terminal_app_get_type ())
+#define TERMINAL_APP(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), TERMINAL_TYPE_APP, TerminalApp))
+#define TERMINAL_APP_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_APP, TerminalAppClass))
+#define TERMINAL_IS_APP(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), TERMINAL_TYPE_APP))
+#define TERMINAL_IS_APP_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_APP))
+#define TERMINAL_APP_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_APP, TerminalAppClass))
+
+typedef struct _TerminalAppClass TerminalAppClass;
+typedef struct _TerminalApp TerminalApp;
+
+extern GSettings *settings_global;
+
+GType terminal_app_get_type (void);
+
+TerminalApp* terminal_app_get (void);
+
+void terminal_app_shutdown (void);
+
+gboolean terminal_app_handle_options (TerminalApp *app,
+                                      TerminalOptions *options,
+                                      gboolean allow_resume,
+                                      GError **error);
+
+void terminal_app_edit_profile (TerminalApp     *app,
+                                TerminalProfile *profile,
+                                GtkWindow       *transient_parent,
+                                const char      *widget_name);
+
+void terminal_app_new_profile (TerminalApp     *app,
+                               TerminalProfile *default_base_profile,
+                               GtkWindow       *transient_parent);
+
+TerminalWindow * terminal_app_new_window   (TerminalApp *app,
+        GdkScreen *screen);
+
+TerminalScreen *terminal_app_new_terminal (TerminalApp     *app,
+        TerminalWindow  *window,
+        TerminalProfile *profile,
+        char           **override_command,
+        const char      *title,
+        const char      *working_dir,
+        char           **child_env,
+        double           zoom);
+
+TerminalWindow *terminal_app_get_current_window (TerminalApp *app,
+                                                 GdkScreen *screen,
+                                                 int curr_workspace);
+
+void terminal_app_manage_profiles (TerminalApp     *app,
+                                   GtkWindow       *transient_parent);
+
+void terminal_app_edit_keybindings (TerminalApp     *app,
+                                    GtkWindow       *transient_parent);
+void terminal_app_edit_encodings   (TerminalApp     *app,
+                                    GtkWindow       *transient_parent);
+
+GList* terminal_app_get_profile_list (TerminalApp *app);
+
+TerminalProfile* terminal_app_ensure_profile_fallback (TerminalApp *app);
+
+TerminalProfile* terminal_app_get_profile_by_name         (TerminalApp *app,
+        const char      *name);
+
+TerminalProfile* terminal_app_get_profile_by_visible_name (TerminalApp *app,
+        const char      *name);
+
+/* may return NULL */
+TerminalProfile* terminal_app_get_default_profile (TerminalApp *app);
+
+/* never returns NULL if any profiles exist, one is always supposed to */
+TerminalProfile* terminal_app_get_profile_for_new_term (TerminalApp *app);
+
+TerminalEncoding *terminal_app_ensure_encoding (TerminalApp *app,
+        const char *charset);
+
+GHashTable *terminal_app_get_encodings (TerminalApp *app);
+
+GSList* terminal_app_get_active_encodings (TerminalApp *app);
+
+void terminal_app_save_config (TerminalApp *app,
+                               GKeyFile *key_file);
+
+gboolean terminal_app_save_config_file (TerminalApp *app,
+                                        const char *file_name,
+                                        GError **error);
+
+G_END_DECLS
+
+#endif /* !TERMINAL_APP_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/32.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/32.html new file mode 100644 index 0000000..57fbcf1 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/32.html @@ -0,0 +1,361 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
/* Encoding stuff */
+
+/*
+ * Copyright © 2002 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * 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 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TERMINAL_ENCODING_H
+#define TERMINAL_ENCODING_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define TERMINAL_TYPE_ENCODING (terminal_encoding_get_type ())
+
+typedef struct
+{
+	int   refcount;
+	char *id;
+	char *name;
+	guint valid            : 1;
+	guint validity_checked : 1;
+	guint is_custom        : 1;
+	guint is_active        : 1;
+} TerminalEncoding;
+
+GType terminal_encoding_get_type (void);
+
+TerminalEncoding *terminal_encoding_new (const char *charset,
+        const char *display_name,
+        gboolean is_custom,
+        gboolean force_valid);
+
+TerminalEncoding *terminal_encoding_ref (TerminalEncoding *encoding);
+
+void terminal_encoding_unref (TerminalEncoding *encoding);
+
+gboolean terminal_encoding_is_valid (TerminalEncoding *encoding);
+
+const char *terminal_encoding_get_id (TerminalEncoding *encoding);
+
+const char *terminal_encoding_get_charset (TerminalEncoding *encoding);
+
+GHashTable *terminal_encodings_get_builtins (void);
+
+void terminal_encoding_dialog_show (GtkWindow *transient_parent);
+
+#endif /* TERMINAL_ENCODING_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/33.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/33.html new file mode 100644 index 0000000..4228db4 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/33.html @@ -0,0 +1,479 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * Copyright © 2001, 2002 Havoc Pennington
+ * Copyright © 2002 Red Hat, Inc.
+ * Copyright © 2002 Sun Microsystems
+ * Copyright © 2003 Mariano Suarez-Alvarez
+ * Copyright © 2008 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * Mate-terminal 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TERMINAL_OPTIONS_H
+#define TERMINAL_OPTIONS_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+typedef struct
+{
+	gboolean remote_arguments;
+	char   **env;
+	char    *startup_id;
+	char    *display_name;
+	GList   *initial_windows;
+	gboolean default_window_menubar_forced;
+	gboolean default_window_menubar_state;
+	gboolean default_fullscreen;
+	gboolean default_maximize;
+	char    *default_role;
+	char    *default_geometry;
+	char    *default_working_dir;
+	char    *default_title;
+	char   **exec_argv;
+	char    *default_profile;
+	gboolean default_profile_is_id;
+
+	gboolean  execute;
+	gboolean  use_factory;
+	double    zoom;
+
+	char    *config_file;
+	gboolean load_config;
+	gboolean save_config;
+	int      initial_workspace;
+} TerminalOptions;
+
+typedef struct
+{
+	char *profile;
+	gboolean profile_is_id;
+	char **exec_argv;
+	char *title;
+	char *working_dir;
+	double zoom;
+	guint zoom_set : 1;
+	guint active : 1;
+	guint attach_window : 1;
+} InitialTab;
+
+typedef struct
+{
+	guint source_tag;
+
+	GList *tabs; /* list of InitialTab */
+
+	gboolean force_menubar_state;
+	gboolean menubar_state;
+
+	gboolean start_fullscreen;
+	gboolean start_maximized;
+
+	char *geometry;
+	char *role;
+
+} InitialWindow;
+
+#define TERMINAL_OPTION_ERROR (g_quark_from_static_string ("terminal-option-error"))
+
+typedef enum
+{
+    TERMINAL_OPTION_ERROR_NOT_IN_FACTORY,
+    TERMINAL_OPTION_ERROR_EXCLUSIVE_OPTIONS,
+    TERMINAL_OPTION_ERROR_INVALID_CONFIG_FILE,
+    TERMINAL_OPTION_ERROR_INCOMPATIBLE_CONFIG_FILE
+} TerminalOptionError;
+
+TerminalOptions *terminal_options_parse (const char *working_directory,
+        const char *display_name,
+        const char *startup_id,
+        char **env,
+        gboolean remote_arguments,
+        gboolean ignore_unknown_options,
+        int *argcp,
+        char ***argvp,
+        GError **error,
+        ...) G_GNUC_NULL_TERMINATED;
+
+gboolean terminal_options_merge_config (TerminalOptions *options,
+                                        GKeyFile *key_file,
+                                        guint source_tag,
+                                        GError **error);
+
+void terminal_options_ensure_window (TerminalOptions *options);
+
+void terminal_options_free (TerminalOptions *options);
+
+G_END_DECLS
+
+#endif /* !TERMINAL_OPTIONS_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/34.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/34.html new file mode 100644 index 0000000..db393b4 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/34.html @@ -0,0 +1,391 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
/*
+ * Copyright (C) 2002 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This 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 3 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 Library General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/* The interfaces in this file are subject to change at any time. */
+
+#ifndef MATE_ENABLE_DEBUG_H
+#define MATE_ENABLE_DEBUG_H
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+typedef enum
+{
+    TERMINAL_DEBUG_ACCELS     = 1 << 0,
+    TERMINAL_DEBUG_ENCODINGS  = 1 << 1,
+    TERMINAL_DEBUG_FACTORY    = 1 << 2,
+    TERMINAL_DEBUG_GEOMETRY   = 1 << 3,
+    TERMINAL_DEBUG_MDI        = 1 << 4,
+    TERMINAL_DEBUG_PROCESSES  = 1 << 5,
+    TERMINAL_DEBUG_PROFILE    = 1 << 6
+} TerminalDebugFlags;
+
+void _terminal_debug_init(void);
+
+extern TerminalDebugFlags _terminal_debug_flags;
+static inline gboolean _terminal_debug_on (TerminalDebugFlags flags) G_GNUC_CONST G_GNUC_UNUSED;
+
+static inline gboolean
+_terminal_debug_on (TerminalDebugFlags flags)
+{
+	return (_terminal_debug_flags & flags) == flags;
+}
+
+#ifdef MATE_ENABLE_DEBUG
+#define _TERMINAL_DEBUG_IF(flags) if (G_UNLIKELY (_terminal_debug_on (flags)))
+#else
+#define _TERMINAL_DEBUG_IF(flags) if (0)
+#endif
+
+#if defined(__GNUC__) && G_HAVE_GNUC_VARARGS
+#define _terminal_debug_print(flags, fmt, ...) \
+  G_STMT_START { _TERMINAL_DEBUG_IF(flags) g_printerr(fmt, ##__VA_ARGS__); } G_STMT_END
+#else
+#include <stdarg.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gstdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+static void _terminal_debug_print (guint flags, const char *fmt, ...)
+{
+	if (_terminal_debug_on (flags))
+	{
+		va_list  ap;
+		va_start (ap, fmt);
+		g_vfprintf (stderr, fmt, ap);
+		va_end (ap);
+	}
+}
+#endif
+
+G_END_DECLS
+
+#endif /* !MATE_ENABLE_DEBUG_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/35.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/35.html new file mode 100644 index 0000000..e6294fc --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/35.html @@ -0,0 +1,4557 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+1545
+1546
+1547
+1548
+1549
+1550
+1551
+1552
+1553
+1554
+1555
+1556
+1557
+1558
+1559
+1560
+1561
+1562
+1563
+1564
+1565
+1566
+1567
+1568
+1569
+1570
+1571
+1572
+1573
+1574
+1575
+1576
+1577
+1578
+1579
+1580
+1581
+1582
+1583
+1584
+1585
+1586
+1587
+1588
+1589
+1590
+1591
+1592
+1593
+1594
+1595
+1596
+1597
+1598
+1599
+1600
+1601
+1602
+1603
+1604
+1605
+1606
+1607
+1608
+1609
+1610
+1611
+1612
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+1631
+1632
+1633
+1634
+1635
+1636
+1637
+1638
+1639
+1640
+1641
+1642
+1643
+1644
+1645
+1646
+1647
+1648
+1649
+1650
+1651
+1652
+1653
+1654
+1655
+1656
+1657
+1658
+1659
+1660
+1661
+1662
+1663
+1664
+1665
+1666
+1667
+1668
+1669
+1670
+1671
+1672
+1673
+1674
+1675
+1676
+1677
+1678
+1679
+1680
+1681
+1682
+1683
+1684
+1685
+1686
+1687
+1688
+1689
+1690
+1691
+1692
+1693
+1694
+1695
+1696
+1697
+1698
+1699
+1700
+1701
+1702
+1703
+1704
+1705
+1706
+1707
+1708
+1709
+1710
+1711
+1712
+1713
+1714
+1715
+1716
+1717
+1718
+1719
+1720
+1721
+1722
+1723
+1724
+1725
+1726
+1727
+1728
+1729
+1730
+1731
+1732
+1733
+1734
+1735
+1736
+1737
+1738
+1739
+1740
+1741
+1742
+1743
+1744
+1745
+1746
+1747
+1748
+1749
+1750
+1751
+1752
+1753
+1754
+1755
+1756
+1757
+1758
+1759
+1760
+1761
+1762
+1763
+1764
+1765
+1766
+1767
+1768
+1769
+1770
+1771
+1772
+1773
+1774
+1775
+1776
+1777
+1778
+1779
+1780
+1781
+1782
+1783
+1784
+1785
+1786
+1787
+1788
+1789
+1790
+1791
+1792
+1793
+1794
+1795
+1796
+1797
+1798
+1799
+1800
+1801
+1802
+1803
+1804
+1805
+1806
+1807
+1808
+1809
+1810
+1811
+1812
+1813
+1814
+1815
+1816
+1817
+1818
+1819
+1820
+1821
+1822
+1823
+1824
+1825
+1826
+1827
+1828
+1829
+1830
+1831
+1832
+1833
+1834
+1835
+1836
+1837
+1838
+1839
+1840
+1841
+1842
+1843
+1844
+1845
+1846
+1847
+1848
+1849
+1850
+1851
+1852
+1853
+1854
+1855
+1856
+1857
+1858
+1859
+1860
+1861
+1862
+1863
+1864
+1865
+1866
+1867
+1868
+1869
+1870
+1871
+1872
+1873
+1874
+1875
+1876
+1877
+1878
+1879
+1880
+1881
+1882
+1883
+1884
+1885
+1886
+1887
+1888
+1889
+1890
+1891
+1892
+1893
+1894
+1895
+1896
+1897
+1898
+1899
+1900
+1901
+1902
+1903
+1904
+1905
+1906
+1907
+1908
+1909
+1910
+1911
+1912
+1913
+1914
+1915
+1916
+1917
+1918
+1919
+1920
+1921
+1922
+1923
+1924
+1925
+1926
+1927
+1928
+1929
+1930
+1931
+1932
+1933
+1934
+1935
+1936
+1937
+1938
+1939
+1940
+1941
+1942
+1943
+1944
+1945
+1946
+1947
+1948
+1949
+1950
+1951
+1952
+1953
+1954
+1955
+1956
+1957
+1958
+1959
+1960
+1961
+1962
+1963
+1964
+1965
+1966
+1967
+1968
+1969
+1970
+1971
+1972
+1973
+1974
+1975
+1976
+1977
+1978
+1979
+1980
+1981
+1982
+1983
+1984
+1985
+1986
+1987
+1988
+1989
+1990
+1991
+1992
+1993
+1994
+1995
+1996
+1997
+1998
+1999
+2000
+2001
+2002
+2003
+2004
+2005
+2006
+2007
+2008
+2009
+2010
+2011
+2012
+2013
+2014
+2015
+2016
+2017
+2018
+2019
+2020
+2021
+2022
+2023
+2024
+2025
+2026
+2027
+2028
+2029
+2030
+2031
+2032
+2033
+2034
+2035
+2036
+2037
+2038
+2039
+2040
+2041
+2042
+2043
+2044
+2045
+2046
+2047
+2048
+2049
+2050
+2051
+2052
+2053
+2054
+2055
+2056
+2057
+2058
+2059
+2060
+2061
+2062
+2063
+2064
+2065
+2066
+2067
+2068
+2069
+2070
+2071
+2072
+2073
+2074
+2075
+2076
+2077
+2078
+2079
+2080
+2081
+2082
+2083
+2084
+2085
+2086
+2087
+2088
+2089
+2090
+2091
+2092
+2093
+2094
+2095
+2096
+2097
+2098
+2099
+2100
+2101
+2102
+2103
+2104
+2105
+2106
+2107
+2108
+2109
+2110
+2111
+2112
+2113
+2114
+2115
+2116
+2117
+2118
+2119
+2120
+2121
+2122
+2123
+2124
+2125
+2126
+2127
+2128
+2129
+2130
+2131
+2132
+2133
+2134
+2135
+2136
+2137
+2138
+2139
+2140
+2141
+2142
+2143
+2144
+2145
+2146
+2147
+2148
+2149
+2150
+2151
+2152
+2153
+2154
+2155
+2156
+2157
+2158
+2159
+2160
/*
+ * Copyright © 2001, 2002 Havoc Pennington
+ * Copyright © 2002 Red Hat, Inc.
+ * Copyright © 2002 Sun Microsystems
+ * Copyright © 2003 Mariano Suarez-Alvarez
+ * Copyright © 2008 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * Mate-terminal 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <errno.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <dconf.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-intl.h"
+
+#include "terminal-debug.h"
+#include "terminal-app.h"
+#include "terminal-accels.h"
+#include "terminal-screen.h"
+#include "terminal-screen-container.h"
+#include "terminal-window.h"
+#include "terminal-util.h"
+#include "profile-editor.h"
+#include "terminal-encoding.h"
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#ifdef HAVE_SMCLIENT
+#include "eggsmclient.h"<--- Include file: "eggsmclient.h" not found.
+#include "eggdesktopfile.h"<--- Include file: "eggdesktopfile.h" not found.
+#endif /* HAVE_SMCLIENT */
+
+#define FALLBACK_PROFILE_ID "default"
+
+/* Settings storage works as follows:
+ *   /apps/mate-terminal/global/
+ *   /apps/mate-terminal/profiles/Foo/
+ *
+ * It's somewhat tricky to manage the profiles/ dir since we need to track
+ * the list of profiles, but GSettings doesn't have a concept of notifying that
+ * a directory has appeared or disappeared.
+ *
+ * Session state is stored entirely in the RestartCommand command line.
+ *
+ * The number one rule: all stored information is EITHER per-session,
+ * per-profile, or set from a command line option. THERE CAN BE NO
+ * OVERLAP. The UI and implementation totally break if you overlap
+ * these categories. See mate-terminal 1.x for why.
+ *
+ * Don't use this code as an example of how to use GSettings - it's hugely
+ * overcomplicated due to the profiles stuff. Most apps should not
+ * have to do scary things of this nature, and should not have
+ * a profiles feature.
+ *
+ */
+
+GSettings *settings_global;
+
+struct _TerminalAppClass
+{
+	GObjectClass parent_class;
+
+	void (* quit) (TerminalApp *app);
+	void (* profile_list_changed) (TerminalApp *app);
+	void (* encoding_list_changed) (TerminalApp *app);
+};
+
+struct _TerminalApp
+{
+	GObject parent_instance;
+
+	GList *windows;
+	GtkWidget *new_profile_dialog;
+	GtkWidget *manage_profiles_dialog;
+	GtkWidget *manage_profiles_list;
+	GtkWidget *manage_profiles_new_button;
+	GtkWidget *manage_profiles_edit_button;
+	GtkWidget *manage_profiles_delete_button;
+	GtkWidget *manage_profiles_default_menu;
+
+	GSettings *settings_font;
+
+	GHashTable *profiles;
+	char* default_profile_id;
+	TerminalProfile *default_profile;
+	gboolean default_profile_locked;
+
+	GHashTable *encodings;
+	gboolean encodings_locked;
+
+	PangoFontDescription *system_font_desc;
+	gboolean enable_mnemonics;
+	gboolean enable_menu_accels;
+};
+
+enum
+{
+    PROP_0,
+    PROP_DEFAULT_PROFILE,
+    PROP_ENABLE_MENU_BAR_ACCEL,
+    PROP_ENABLE_MNEMONICS,
+    PROP_SYSTEM_FONT,
+};
+
+enum
+{
+    QUIT,
+    PROFILE_LIST_CHANGED,
+    ENCODING_LIST_CHANGED,
+    LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+enum
+{
+    COL_PROFILE,
+    NUM_COLUMNS
+};
+
+enum
+{
+    SOURCE_DEFAULT = 0,
+    SOURCE_SESSION = 1
+};
+
+static TerminalApp *global_app = NULL;
+
+#define MONOSPACE_FONT_SCHEMA "org.mate.interface"
+#define MONOSPACE_FONT_KEY "monospace-font-name"
+#define DEFAULT_MONOSPACE_FONT ("Monospace 10")
+
+#define ENABLE_MNEMONICS_KEY "use-mnemonics"
+#define DEFAULT_ENABLE_MNEMONICS (TRUE)
+
+#define ENABLE_MENU_BAR_ACCEL_KEY "use-menu-accelerators"
+#define DEFAULT_ENABLE_MENU_BAR_ACCEL (TRUE)
+
+#define PROFILE_LIST_KEY "profile-list"
+#define DEFAULT_PROFILE_KEY "default-profile"
+
+#define ENCODING_LIST_KEY "active-encodings"
+
+/* two following functions were copied from libmate-desktop to get rid
+ * of dependency on it
+ *
+ * FIXME: I suspect there's no need for excessive copies, we might use
+ * existing profile list to form GVariant's and write them to GSettings
+ */
+static gboolean
+gsettings_append_strv (GSettings   *settings,
+                            const gchar *key,
+                            const gchar *value)
+{
+    gchar    **old;
+    gchar    **new;
+    gint       size;
+    gboolean   retval;
+
+    old = g_settings_get_strv (settings, key);
+
+    for (size = 0; old[size] != NULL; size++);
+
+    size += 1; /* appended value */
+    size += 1; /* NULL */
+
+    new = g_realloc_n (old, size, sizeof (gchar *));
+
+    new[size - 2] = g_strdup (value);
+    new[size - 1] = NULL;
+
+    retval = g_settings_set_strv (settings, key,
+                                  (const gchar **) new);
+
+    g_strfreev (new);
+
+    return retval;
+}
+
+static gboolean
+gsettings_remove_all_from_strv (GSettings   *settings,
+                                     const gchar *key,
+                                     const gchar *value)
+{
+    GArray    *array;
+    gchar    **old;
+    gint       i;
+    gboolean   retval;
+
+    old = g_settings_get_strv (settings, key);
+    array = g_array_new (TRUE, TRUE, sizeof (gchar *));
+
+    for (i = 0; old[i] != NULL; i++) {
+        if (g_strcmp0 (old[i], value) != 0)
+            array = g_array_append_val (array, old[i]);
+    }
+
+    retval = g_settings_set_strv (settings, key,
+                                  (const gchar **) array->data);
+
+    g_strfreev (old);
+    g_array_free (array, TRUE);
+
+    return retval;
+}
+
+/* Helper functions */
+
+static GdkScreen*
+terminal_app_get_screen_by_display_name (const char *display_name)
+{
+	GdkDisplay *display = NULL;
+	GdkScreen *screen = NULL;
+
+	if (display_name == NULL)
+		display = gdk_display_get_default ();
+	else
+	{
+		GSList *displays, *l;
+		const char *period;
+
+		period = strrchr (display_name, '.');
+		displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
+		for (l = displays; l != NULL; l = l->next)
+		{
+			GdkDisplay *disp = l->data;
+
+			/* compare without the screen number part, if present */
+			if ((period && strncmp (gdk_display_get_name (disp), display_name, period - display_name) == 0) ||
+			        (period == NULL && strcmp (gdk_display_get_name (disp), display_name) == 0))
+			{
+				display = disp;
+				break;
+			}
+		}
+		g_slist_free (displays);
+
+		if (display == NULL)
+			display = gdk_display_open (display_name); /* FIXME we never close displays */
+	}
+
+	if (display == NULL)
+		return NULL;
+	else
+		screen = gdk_display_get_default_screen (display);
+
+	return screen;
+}
+
+static int
+terminal_app_get_workspace_for_window (TerminalWindow *window)
+{
+  int ret = -1;
+  guchar *data = NULL;
+  GdkAtom atom;
+  GdkAtom cardinal_atom;
+
+  atom = gdk_atom_intern_static_string ("_NET_WM_DESKTOP");
+  cardinal_atom = gdk_atom_intern_static_string ("CARDINAL");
+
+  gdk_property_get (gtk_widget_get_window(GTK_WIDGET(window)),
+                    atom, cardinal_atom, 0, 8, FALSE,
+		    NULL, NULL, NULL, &data);
+
+  if (data)
+    ret = *(int *)data;
+
+  g_free (data);
+  return ret;
+}
+
+/* Menubar mnemonics settings handling */
+
+static int
+profiles_alphabetic_cmp (gconstpointer pa,
+                         gconstpointer pb)
+{
+	TerminalProfile *a = (TerminalProfile *) pa;
+	TerminalProfile *b = (TerminalProfile *) pb;
+	int result;
+
+	result =  g_utf8_collate (terminal_profile_get_property_string (a, TERMINAL_PROFILE_VISIBLE_NAME),
+	                          terminal_profile_get_property_string (b, TERMINAL_PROFILE_VISIBLE_NAME));
+	if (result == 0)
+		result = strcmp (terminal_profile_get_property_string (a, TERMINAL_PROFILE_NAME),
+		                 terminal_profile_get_property_string (b, TERMINAL_PROFILE_NAME));
+
+	return result;
+}
+
+typedef struct
+{
+	TerminalProfile *result;
+	const char *target;
+} LookupInfo;
+
+static void
+profiles_lookup_by_visible_name_foreach (gpointer key,
+        gpointer value,
+        gpointer data)
+{
+	LookupInfo *info = data;
+	const char *name;
+
+	name = terminal_profile_get_property_string (value, TERMINAL_PROFILE_VISIBLE_NAME);
+	if (name && strcmp (info->target, name) == 0)
+		info->result = value;
+}
+
+static void
+terminal_window_destroyed (TerminalWindow *window,
+                           TerminalApp    *app)
+{
+	app->windows = g_list_remove (app->windows, window);
+
+	if (app->windows == NULL)
+		g_signal_emit (app, signals[QUIT], 0);
+}
+
+static TerminalProfile *
+terminal_app_create_profile (TerminalApp *app,
+                             const char *name)
+{
+	TerminalProfile *profile;
+
+	g_assert (terminal_app_get_profile_by_name (app, name) == NULL);
+
+	profile = _terminal_profile_new (name);
+
+	g_hash_table_insert (app->profiles,
+	                     g_strdup (terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME)),
+	                     profile /* adopts the refcount */);
+
+	if (app->default_profile == NULL &&
+	        app->default_profile_id != NULL &&
+	        strcmp (app->default_profile_id,
+	                terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME)) == 0)
+	{
+		/* We are the default profile */
+		app->default_profile = profile;
+		g_object_notify (G_OBJECT (app), TERMINAL_APP_DEFAULT_PROFILE);
+	}
+
+	return profile;
+}
+
+static void
+terminal_app_delete_profile (TerminalProfile *profile)
+{
+	const char *profile_name;
+	char *profile_dir;
+	GError *error = NULL;
+
+	profile_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME);
+	profile_dir = g_strconcat (CONF_PROFILE_PREFIX, profile_name, "/", NULL);
+
+	gsettings_remove_all_from_strv (settings_global, PROFILE_LIST_KEY, profile_name);
+
+	/* And remove the profile directory */
+	DConfClient *client = dconf_client_new ();
+	if (!dconf_client_write_sync (client, profile_dir, NULL, NULL, NULL, &error))
+	{
+		g_warning ("Failed to recursively unset %s: %s\n", profile_dir, error->message);
+		g_error_free (error);
+	}
+
+	g_object_unref (client);
+	g_free (profile_dir);
+}
+
+static void
+terminal_app_profile_cell_data_func (GtkTreeViewColumn *tree_column,
+                                     GtkCellRenderer *cell,
+                                     GtkTreeModel *tree_model,
+                                     GtkTreeIter *iter,
+                                     gpointer data)
+{
+	TerminalProfile *profile;
+	GValue value = { 0, };
+
+	gtk_tree_model_get (tree_model, iter, (int) COL_PROFILE, &profile, (int) -1);
+
+	g_value_init (&value, G_TYPE_STRING);
+	g_object_get_property (G_OBJECT (profile), "visible-name", &value);
+	g_object_set_property (G_OBJECT (cell), "text", &value);
+	g_value_unset (&value);
+}
+
+static int
+terminal_app_profile_sort_func (GtkTreeModel *model,
+                                GtkTreeIter *a,
+                                GtkTreeIter *b,
+                                gpointer user_data)
+{
+	TerminalProfile *profile_a, *profile_b;
+	int retval;
+
+	gtk_tree_model_get (model, a, (int) COL_PROFILE, &profile_a, (int) -1);
+	gtk_tree_model_get (model, b, (int) COL_PROFILE, &profile_b, (int) -1);
+
+	retval = profiles_alphabetic_cmp (profile_a, profile_b);
+
+	g_object_unref (profile_a);
+	g_object_unref (profile_b);
+
+	return retval;
+}
+
+static /* ref */ GtkTreeModel *
+terminal_app_get_profile_liststore (TerminalApp *app,
+                                    TerminalProfile *selected_profile,
+                                    GtkTreeIter *selected_profile_iter,
+                                    gboolean *selected_profile_iter_set)
+{
+	GtkListStore *store;
+	GtkTreeIter iter;
+	GList *profiles, *l;
+
+	store = gtk_list_store_new (NUM_COLUMNS, TERMINAL_TYPE_PROFILE);
+
+	*selected_profile_iter_set = FALSE;
+
+	if (selected_profile &&
+	        _terminal_profile_get_forgotten (selected_profile))
+		selected_profile = NULL;
+
+	profiles = terminal_app_get_profile_list (app);
+
+	for (l = profiles; l != NULL; l = l->next)
+	{
+		TerminalProfile *profile = TERMINAL_PROFILE (l->data);
+
+		gtk_list_store_insert_with_values (store, &iter, 0,
+		                                   (int) COL_PROFILE, profile,
+		                                   (int) -1);
+
+		if (selected_profile_iter && profile == selected_profile)
+		{
+			*selected_profile_iter = iter;
+			*selected_profile_iter_set = TRUE;
+		}
+	}
+	g_list_free (profiles);
+
+	/* Now turn on sorting */
+	gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (store),
+	                                 COL_PROFILE,
+	                                 terminal_app_profile_sort_func,
+	                                 NULL, NULL);
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
+	                                      COL_PROFILE, GTK_SORT_ASCENDING);
+
+	return GTK_TREE_MODEL (store);
+}
+
+static /* ref */ TerminalProfile*
+profile_combo_box_get_selected (GtkWidget *widget)
+{
+	GtkComboBox *combo = GTK_COMBO_BOX (widget);
+	TerminalProfile *profile = NULL;
+	GtkTreeIter iter;
+
+	if (gtk_combo_box_get_active_iter (combo, &iter))
+		gtk_tree_model_get (gtk_combo_box_get_model (combo), &iter,
+		                    (int) COL_PROFILE, &profile, (int) -1);
+
+	return profile;
+}
+
+static void
+profile_combo_box_refill (TerminalApp *app,
+                          GtkWidget *widget)
+{
+	GtkComboBox *combo = GTK_COMBO_BOX (widget);
+	GtkTreeIter iter;
+	gboolean iter_set;
+	TerminalProfile *selected_profile;
+	GtkTreeModel *model;
+
+	selected_profile = profile_combo_box_get_selected (widget);
+	if (!selected_profile)
+	{
+		selected_profile = terminal_app_get_default_profile (app);
+		if (selected_profile)
+			g_object_ref (selected_profile);
+	}
+
+	model = terminal_app_get_profile_liststore (app,
+	        selected_profile,
+	        &iter,
+	        &iter_set);
+	gtk_combo_box_set_model (combo, model);
+	g_object_unref (model);
+
+	if (iter_set)
+		gtk_combo_box_set_active_iter (combo, &iter);
+
+	if (selected_profile)
+		g_object_unref (selected_profile);
+}
+
+static GtkWidget*
+profile_combo_box_new (TerminalApp *app)
+{
+	GtkWidget *combo;
+	GtkCellRenderer *renderer;
+
+	combo = gtk_combo_box_new ();
+	terminal_util_set_atk_name_description (combo, NULL, _("Click button to choose profile"));
+
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo), renderer,
+	                                    (GtkCellLayoutDataFunc) terminal_app_profile_cell_data_func,
+	                                    NULL, NULL);
+
+	profile_combo_box_refill (app, combo);
+	g_signal_connect (app, "profile-list-changed",
+	                  G_CALLBACK (profile_combo_box_refill), combo);
+
+	gtk_widget_show (combo);
+	return combo;
+}
+
+static void
+profile_combo_box_changed_cb (GtkWidget *widget,
+                              TerminalApp *app)
+{
+	TerminalProfile *profile;
+
+	profile = profile_combo_box_get_selected (widget);
+	if (!profile)
+		return;
+
+	g_settings_set_string (settings_global, DEFAULT_PROFILE_KEY,
+			       terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME));
+
+	/* Even though the GSettings change notification does this, it happens too late.
+	 * In some cases, the default profile changes twice in quick succession,
+	 * and update_default_profile must be called in sync with those changes.
+	 */
+	app->default_profile = profile;
+
+	g_object_notify (G_OBJECT (app), TERMINAL_APP_DEFAULT_PROFILE);
+
+	g_object_unref (profile);
+}
+
+static void
+profile_list_treeview_refill (TerminalApp *app,
+                              GtkWidget *widget)
+{
+	GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
+	GtkTreeIter iter;
+	gboolean iter_set;
+	GtkTreeSelection *selection;
+	GtkTreeModel *model;
+	TerminalProfile *selected_profile = NULL;
+
+	model = gtk_tree_view_get_model (tree_view);
+
+	selection = gtk_tree_view_get_selection (tree_view);
+	if (gtk_tree_selection_get_selected (selection, NULL, &iter))
+		gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
+
+	model = terminal_app_get_profile_liststore (terminal_app_get (),
+	        selected_profile,
+	        &iter,
+	        &iter_set);
+	gtk_tree_view_set_model (tree_view, model);
+	g_object_unref (model);
+
+	if (!iter_set)
+		iter_set = gtk_tree_model_get_iter_first (model, &iter);
+
+	if (iter_set)
+		gtk_tree_selection_select_iter (selection, &iter);
+
+	if (selected_profile)
+		g_object_unref (selected_profile);
+}
+
+static GtkWidget*
+profile_list_treeview_create (TerminalApp *app)
+{
+	GtkWidget *tree_view;
+	GtkTreeSelection *selection;
+	GtkCellRenderer *renderer;
+	GtkTreeViewColumn *column;
+
+	tree_view = gtk_tree_view_new ();
+	terminal_util_set_atk_name_description (tree_view, _("Profile list"), NULL);
+	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE);
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
+	gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection),
+	                             GTK_SELECTION_BROWSE);
+
+	column = gtk_tree_view_column_new ();
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (column), renderer, TRUE);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (column), renderer,
+	                                    (GtkCellLayoutDataFunc) terminal_app_profile_cell_data_func,
+	                                    NULL, NULL);
+	gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
+	                             GTK_TREE_VIEW_COLUMN (column));
+
+	return tree_view;
+}
+
+static void
+profile_list_delete_confirm_response_cb (GtkWidget *dialog,
+                                         int        response)
+{
+	TerminalProfile *profile;
+
+	profile = TERMINAL_PROFILE (g_object_get_data (G_OBJECT (dialog), "profile"));
+	g_assert (profile != NULL);
+
+	if (response == GTK_RESPONSE_ACCEPT)
+		terminal_app_delete_profile (profile);
+
+	gtk_widget_destroy (dialog);
+}
+
+static void
+mate_dialog_add_button (GtkDialog   *dialog,
+                        const gchar *button_text,
+                        const gchar *icon_name,
+                        gint         response_id)
+{
+	GtkWidget *button;
+
+	button = gtk_button_new_with_mnemonic (button_text);
+	gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON));
+
+	gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
+	gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button");
+	gtk_widget_set_can_default (button, TRUE);
+	gtk_widget_show (button);
+	gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, response_id);
+}
+
+static void
+profile_list_delete_button_clicked_cb (GtkWidget *button,
+                                       GtkWidget *widget)
+{
+	GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
+	GtkTreeSelection *selection;
+	GtkWidget *dialog;
+	GtkTreeIter iter;
+	GtkTreeModel *model;
+	TerminalProfile *selected_profile;
+	GtkWidget *transient_parent;
+
+	model = gtk_tree_view_get_model (tree_view);
+	selection = gtk_tree_view_get_selection (tree_view);
+
+	if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
+		return;
+
+	gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
+
+	transient_parent = gtk_widget_get_toplevel (widget);
+	dialog = gtk_message_dialog_new (GTK_WINDOW (transient_parent),
+	                                 GTK_DIALOG_DESTROY_WITH_PARENT,
+	                                 GTK_MESSAGE_QUESTION,
+	                                 GTK_BUTTONS_NONE,
+	                                 _("Delete profile “%s”?"),
+	                                 terminal_profile_get_property_string (selected_profile, TERMINAL_PROFILE_VISIBLE_NAME));
+
+	mate_dialog_add_button (GTK_DIALOG (dialog),
+	                        _("_Cancel"),
+	                        "process-stop",
+	                        GTK_RESPONSE_REJECT);
+
+	mate_dialog_add_button (GTK_DIALOG (dialog),
+	                        _("_Delete"),
+	                        "edit-delete",
+	                        GTK_RESPONSE_ACCEPT);
+
+	gtk_dialog_set_default_response (GTK_DIALOG (dialog),
+	                                 GTK_RESPONSE_ACCEPT);
+
+	gtk_window_set_title (GTK_WINDOW (dialog), _("Delete Profile"));
+	gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+
+	/* Transfer refcount of |selected_profile|, so no unref below */
+	g_object_set_data_full (G_OBJECT (dialog), "profile", selected_profile, g_object_unref);
+
+	g_signal_connect (dialog, "response",
+	                  G_CALLBACK (profile_list_delete_confirm_response_cb),
+	                  NULL);
+
+	gtk_window_present (GTK_WINDOW (dialog));
+}
+
+static void
+profile_list_new_button_clicked_cb (GtkWidget   *button,
+                                    gpointer data)
+{
+	TerminalApp *app;
+
+	app = terminal_app_get ();
+	terminal_app_new_profile (app, NULL, GTK_WINDOW (app->manage_profiles_dialog));
+}
+
+static void
+profile_list_edit_button_clicked_cb (GtkWidget *button,
+                                     GtkWidget *widget)
+{
+	GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
+	GtkTreeSelection *selection;
+	GtkTreeIter iter;
+	GtkTreeModel *model;
+	TerminalProfile *selected_profile;
+	TerminalApp *app;
+
+	app = terminal_app_get ();
+
+	model = gtk_tree_view_get_model (tree_view);
+	selection = gtk_tree_view_get_selection (tree_view);
+
+	if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
+		return;
+
+	gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
+
+	terminal_app_edit_profile (app, selected_profile,
+	                           GTK_WINDOW (app->manage_profiles_dialog),
+	                           NULL);
+	g_object_unref (selected_profile);
+}
+
+static void
+profile_list_row_activated_cb (GtkTreeView       *tree_view,
+                               GtkTreePath       *path,
+                               GtkTreeViewColumn *column,
+                               gpointer data)
+{
+	GtkTreeIter iter;
+	GtkTreeModel *model;
+	TerminalProfile *selected_profile;
+	TerminalApp *app;
+
+	app = terminal_app_get ();
+
+	model = gtk_tree_view_get_model (tree_view);
+
+	if (!gtk_tree_model_get_iter (model, &iter, path))
+		return;
+
+	gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
+
+	terminal_app_edit_profile (app, selected_profile,
+	                           GTK_WINDOW (app->manage_profiles_dialog),
+	                           NULL);
+	g_object_unref (selected_profile);
+}
+
+static GList*
+find_profile_link (GList      *profiles,
+                   const char *name)
+{
+	GList *l;
+
+	for (l = profiles; l != NULL; l = l->next)
+	{
+		const char *profile_name;
+
+		profile_name = terminal_profile_get_property_string (TERMINAL_PROFILE (l->data), TERMINAL_PROFILE_NAME);
+		if (profile_name && strcmp (profile_name, name) == 0)
+			break;
+	}
+
+	return l;
+}
+
+static void
+terminal_app_profile_list_notify_cb (GSettings   *settings,
+                                     const gchar *key,
+                                     gpointer     user_data)
+{
+	TerminalApp *app = TERMINAL_APP (user_data);
+	GObject *object = G_OBJECT (app);
+	GVariant *val;
+	const gchar **value_list;
+	int i;
+	GList *profiles_to_delete, *l;
+	gboolean need_new_default;
+	TerminalProfile *fallback;
+	guint count;
+
+	g_object_freeze_notify (object);
+
+	profiles_to_delete = terminal_app_get_profile_list (app);
+
+	val = g_settings_get_value (settings, key);
+	if (val == NULL ||
+	        (!g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY) &&
+	        !g_variant_is_of_type (val, G_VARIANT_TYPE_STRING)))
+		goto ensure_one_profile;
+
+	value_list = g_variant_get_strv (val, NULL);
+	if (value_list == NULL)
+		goto ensure_one_profile;
+
+	/* Add any new ones */
+	for (i = 0; value_list[i] != NULL; ++i)
+	{
+		const char *profile_name = value_list[i];
+		GList *link;
+
+		if (!profile_name)
+			continue;
+
+		link = find_profile_link (profiles_to_delete, profile_name);
+		if (link)
+			/* make profiles_to_delete point to profiles we didn't find in the list */
+			profiles_to_delete = g_list_delete_link (profiles_to_delete, link);
+		else
+			terminal_app_create_profile (app, profile_name);
+	}
+
+	g_free (value_list);
+
+ensure_one_profile:
+
+	if (val != NULL)
+		g_variant_unref (val);
+
+	fallback = NULL;
+	count = g_hash_table_size (app->profiles);
+	if (count == 0 || count <= g_list_length (profiles_to_delete))
+	{
+		/* We are going to run out, so create the fallback
+		 * to be sure we always have one. Must be done
+		 * here before we emit "forgotten" signals so that
+		 * screens have a profile to fall back to.
+		 *
+		 * If the profile with the FALLBACK_ID already exists,
+		 * we aren't allowed to delete it, unless at least one
+		 * other profile will still exist. And if you delete
+		 * all profiles, the FALLBACK_ID profile returns as
+		 * the living dead.
+		 */
+		fallback = terminal_app_get_profile_by_name (app, FALLBACK_PROFILE_ID);
+		if (fallback == NULL)
+			fallback = terminal_app_create_profile (app, FALLBACK_PROFILE_ID);
+		g_assert (fallback != NULL);
+	}
+
+	/* Forget no-longer-existing profiles */
+	need_new_default = FALSE;
+	for (l = profiles_to_delete; l != NULL; l = l->next)
+	{
+		TerminalProfile *profile = TERMINAL_PROFILE (l->data);
+		const char *name;
+
+		name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME);
+		if (strcmp (name, FALLBACK_PROFILE_ID) == 0)
+			continue;
+
+		if (profile == app->default_profile)
+		{
+			app->default_profile = NULL;
+			need_new_default = TRUE;
+		}
+
+		_terminal_profile_forget (profile);
+		g_hash_table_remove (app->profiles, name);
+
+		/* |profile| possibly isn't dead yet since the profiles dialogue's tree model holds a ref too... */
+	}
+	g_list_free (profiles_to_delete);
+
+	if (need_new_default)
+	{
+		TerminalProfile *new_default;
+		TerminalProfile **new_default_ptr = &new_default;
+
+		new_default = terminal_app_get_profile_by_name (app, FALLBACK_PROFILE_ID);
+		if (new_default == NULL)
+		{
+			GHashTableIter iter;
+
+			g_hash_table_iter_init (&iter, app->profiles);
+			if (!g_hash_table_iter_next (&iter, NULL, (gpointer *) new_default_ptr))
+				/* shouldn't really happen ever, but just to be safe */
+				new_default = terminal_app_create_profile (app, FALLBACK_PROFILE_ID);
+		}
+		g_assert (new_default != NULL);
+
+		app->default_profile = new_default;
+
+		g_object_notify (object, TERMINAL_APP_DEFAULT_PROFILE);
+	}
+
+	g_assert (g_hash_table_size (app->profiles) > 0);
+
+	g_signal_emit (app, signals[PROFILE_LIST_CHANGED], 0);
+
+	g_object_thaw_notify (object);
+}
+
+static void
+terminal_app_default_profile_notify_cb (GSettings   *settings,
+                                        const gchar *key,
+                                        gpointer     user_data)
+{
+	TerminalApp *app = TERMINAL_APP (user_data);
+	GVariant *val;
+	const char *name = NULL;
+
+	app->default_profile_locked = !g_settings_is_writable (settings, key);
+
+	val = g_settings_get_value (settings, key);
+	if (val != NULL &&
+	        g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))
+		name = g_variant_get_string (val, NULL);
+	if (!name || !name[0])
+		name = FALLBACK_PROFILE_ID;
+	g_assert (name != NULL);
+
+	g_free (app->default_profile_id);
+	app->default_profile_id = g_strdup (name);
+
+	app->default_profile = terminal_app_get_profile_by_name (app, name);
+
+	g_object_notify (G_OBJECT (app), TERMINAL_APP_DEFAULT_PROFILE);
+	g_variant_unref (val);
+}
+
+static int
+compare_encodings (TerminalEncoding *a,
+                   TerminalEncoding *b)
+{
+	return g_utf8_collate (a->name, b->name);
+}
+
+static void
+encoding_mark_active (gpointer key,
+                      gpointer value,
+                      gpointer data)
+{
+	TerminalEncoding *encoding = (TerminalEncoding *) value;
+	guint active = GPOINTER_TO_UINT (data);
+
+	encoding->is_active = active;
+}
+
+static void
+terminal_app_encoding_list_notify_cb (GSettings   *settings,
+                                      const gchar *key,
+                                      gpointer     user_data)
+{
+	TerminalApp *app = TERMINAL_APP (user_data);
+	GVariant *val;
+	const gchar **strings;
+	int i;
+	TerminalEncoding *encoding;
+	const char *charset;
+
+	app->encodings_locked = !g_settings_is_writable (settings, key);
+
+	/* Mark all as non-active, then re-enable the active ones */
+	g_hash_table_foreach (app->encodings, (GHFunc) encoding_mark_active, GUINT_TO_POINTER (FALSE));
+
+	/* First add the locale's charset */
+	encoding = g_hash_table_lookup (app->encodings, "current");
+	g_assert (encoding);
+	if (terminal_encoding_is_valid (encoding))
+		encoding->is_active = TRUE;
+
+	/* Also always make UTF-8 available */
+	encoding = g_hash_table_lookup (app->encodings, "UTF-8");
+	g_assert (encoding);
+	if (terminal_encoding_is_valid (encoding))
+		encoding->is_active = TRUE;
+
+	val = g_settings_get_value (settings, key);
+	if (val != NULL &&
+	        g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY))
+		strings = g_variant_get_strv (val, NULL);
+	else
+		strings = NULL;
+
+	if (strings != NULL)
+	{
+		for (i = 0; strings[i] != NULL; ++i)
+		{
+			charset = strings[i];
+			if (!charset)
+				continue;
+
+			encoding = terminal_app_ensure_encoding (app, charset);
+			if (!terminal_encoding_is_valid (encoding))
+				continue;
+
+			encoding->is_active = TRUE;
+		}
+
+		g_free (strings);
+	}
+
+	g_signal_emit (app, signals[ENCODING_LIST_CHANGED], 0);
+
+	if (val != NULL)
+		g_variant_unref (val);
+}
+
+static void
+terminal_app_system_font_notify_cb (GSettings   *settings,
+                                    const gchar *key,
+                                    gpointer     user_data)
+{
+	TerminalApp *app = TERMINAL_APP (user_data);
+	GVariant *val;
+	const char *font = NULL;
+	PangoFontDescription *font_desc;
+
+	if (strcmp (key, MONOSPACE_FONT_KEY) != 0)
+		return;
+
+	val = g_settings_get_value (settings, key);
+	if (val &&
+	        g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))
+		font = g_variant_get_string (val, NULL);
+	if (!font)
+		font = DEFAULT_MONOSPACE_FONT;
+	g_assert (font != NULL);
+
+	if (font && (strlen (font) == 0))   /* empty string */
+		font = DEFAULT_MONOSPACE_FONT;
+
+	font_desc = pango_font_description_from_string (font);
+	if (app->system_font_desc &&
+	        pango_font_description_equal (app->system_font_desc, font_desc))
+	{
+		pango_font_description_free (font_desc);
+		return;
+	}
+
+	if (app->system_font_desc)
+		pango_font_description_free (app->system_font_desc);
+
+	app->system_font_desc = font_desc;
+
+	g_object_notify (G_OBJECT (app), TERMINAL_APP_SYSTEM_FONT);
+	g_variant_unref (val);
+}
+
+static void
+terminal_app_enable_mnemonics_notify_cb (GSettings   *settings,
+                                         const gchar *key,
+                                         gpointer     user_data)
+{
+	TerminalApp *app = TERMINAL_APP (user_data);
+	gboolean enable;
+
+	enable = g_settings_get_boolean (settings, key);
+	if (enable == app->enable_mnemonics)
+		return;
+
+	app->enable_mnemonics = enable;
+	g_object_notify (G_OBJECT (app), TERMINAL_APP_ENABLE_MNEMONICS);
+}
+
+static void
+terminal_app_enable_menu_accels_notify_cb (GSettings   *settings,
+                                           const gchar *key,
+                                           gpointer     user_data)
+{
+	TerminalApp *app = TERMINAL_APP (user_data);
+	gboolean enable;
+
+	enable = g_settings_get_boolean (settings, key);
+	if (enable == app->enable_menu_accels)
+		return;
+
+	app->enable_menu_accels = enable;
+	g_object_notify (G_OBJECT (app), TERMINAL_APP_ENABLE_MENU_BAR_ACCEL);
+}
+
+static void
+new_profile_response_cb (GtkWidget *new_profile_dialog,
+                         int        response_id,
+                         TerminalApp *app)
+{
+	if (response_id == GTK_RESPONSE_ACCEPT)
+	{
+		GtkWidget *name_entry;
+		char *name;
+		const char *new_profile_name;
+		GtkWidget *base_option_menu;
+		TerminalProfile *base_profile = NULL;
+		TerminalProfile *new_profile;
+		GList *profiles;
+		GList *tmp;
+		GtkWindow *transient_parent;
+		GtkWidget *confirm_dialog;
+		gint retval;
+
+		base_option_menu = g_object_get_data (G_OBJECT (new_profile_dialog), "base_option_menu");
+		base_profile = profile_combo_box_get_selected (base_option_menu);
+		if (!base_profile)
+			base_profile = terminal_app_get_default_profile (app);
+		if (!base_profile)
+			return; /* shouldn't happen ever though */
+
+		name_entry = g_object_get_data (G_OBJECT (new_profile_dialog), "name_entry");
+		name = gtk_editable_get_chars (GTK_EDITABLE (name_entry), 0, -1);
+		g_strstrip (name); /* name will be non empty after stripping */
+
+		profiles = terminal_app_get_profile_list (app);
+		for (tmp = profiles; tmp != NULL; tmp = tmp->next)
+		{
+			TerminalProfile *profile = tmp->data;
+			const char *visible_name;
+
+			visible_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_VISIBLE_NAME);
+
+			if (visible_name && strcmp (name, visible_name) == 0)
+				break;
+		}
+		if (tmp)
+		{
+			confirm_dialog = gtk_message_dialog_new (GTK_WINDOW (new_profile_dialog),
+			                 GTK_DIALOG_DESTROY_WITH_PARENT,
+			                 GTK_MESSAGE_QUESTION,
+			                 GTK_BUTTONS_YES_NO,
+			                 _("You already have a profile called “%s”. Do you want to create another profile with the same name?"), name);
+			/* Alternative button order was set automatically by GtkMessageDialog */
+			retval = gtk_dialog_run (GTK_DIALOG (confirm_dialog));
+			gtk_widget_destroy (confirm_dialog);
+			if (retval == GTK_RESPONSE_NO)
+				goto cleanup;
+		}
+		g_list_free (profiles);
+
+		transient_parent = gtk_window_get_transient_for (GTK_WINDOW (new_profile_dialog));
+
+		new_profile = _terminal_profile_clone (base_profile, name);
+		new_profile_name = terminal_profile_get_property_string (new_profile, TERMINAL_PROFILE_NAME);
+		g_hash_table_insert (app->profiles,
+		                     g_strdup (new_profile_name),
+		                     new_profile /* adopts the refcount */);
+
+		/* And now save the new profile name to GSettings */
+		gsettings_append_strv (settings_global,
+						PROFILE_LIST_KEY,
+						new_profile_name);
+
+		terminal_profile_edit (new_profile, transient_parent, NULL);
+
+cleanup:
+		g_free (name);
+	}
+
+	gtk_widget_destroy (new_profile_dialog);
+}
+
+static void
+new_profile_dialog_destroy_cb (GtkWidget *new_profile_dialog,
+                               TerminalApp *app)
+{
+	GtkWidget *combo;
+
+	combo = g_object_get_data (G_OBJECT (new_profile_dialog), "base_option_menu");
+	g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_combo_box_refill), combo);
+
+	app->new_profile_dialog = NULL;
+}
+
+static void
+new_profile_name_entry_changed_cb (GtkEntry *entry,
+                                   GtkDialog *dialog)
+{
+	const char *name;
+
+	name = gtk_entry_get_text (entry);
+
+	/* make the create button sensitive only if something other than space has been set */
+	while (*name != '\0' && g_ascii_isspace (*name))
+		++name;
+
+	gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_ACCEPT, name[0] != '\0');
+}
+
+void
+terminal_app_new_profile (TerminalApp     *app,
+                          TerminalProfile *default_base_profile,
+                          GtkWindow       *transient_parent)
+{
+	if (app->new_profile_dialog == NULL)
+	{
+		GtkWidget *create_button, *grid, *name_label, *name_entry, *base_label, *combo;
+
+		if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/profile-new-dialog.ui",
+		                                      "new-profile-dialog", &app->new_profile_dialog,
+		                                      "new-profile-create-button", &create_button,
+		                                      "new-profile-grid", &grid,
+		                                      "new-profile-name-label", &name_label,
+		                                      "new-profile-name-entry", &name_entry,
+		                                      "new-profile-base-label", &base_label,
+		                                      NULL))
+			return;
+
+		g_signal_connect (G_OBJECT (app->new_profile_dialog), "response", G_CALLBACK (new_profile_response_cb), app);
+		g_signal_connect (app->new_profile_dialog, "destroy", G_CALLBACK (new_profile_dialog_destroy_cb), app);
+
+		g_object_set_data (G_OBJECT (app->new_profile_dialog), "create_button", create_button);
+		gtk_widget_set_sensitive (create_button, FALSE);
+
+		/* the name entry */
+		g_object_set_data (G_OBJECT (app->new_profile_dialog), "name_entry", name_entry);
+		g_signal_connect (name_entry, "changed", G_CALLBACK (new_profile_name_entry_changed_cb), app->new_profile_dialog);
+		gtk_entry_set_activates_default (GTK_ENTRY (name_entry), TRUE);
+		gtk_widget_grab_focus (name_entry);
+
+		gtk_label_set_mnemonic_widget (GTK_LABEL (name_label), name_entry);
+
+		/* the base profile option menu */
+		combo = profile_combo_box_new (app);
+		gtk_grid_attach (GTK_GRID (grid), combo, 2, 1, 1, 1);
+		g_object_set_data (G_OBJECT (app->new_profile_dialog), "base_option_menu", combo);
+		terminal_util_set_atk_name_description (combo, NULL, _("Choose base profile"));
+
+		gtk_label_set_mnemonic_widget (GTK_LABEL (base_label), combo);
+
+		gtk_dialog_set_default_response (GTK_DIALOG (app->new_profile_dialog), GTK_RESPONSE_ACCEPT);
+		gtk_dialog_set_response_sensitive (GTK_DIALOG (app->new_profile_dialog), GTK_RESPONSE_ACCEPT, FALSE);
+	}
+
+	gtk_window_set_transient_for (GTK_WINDOW (app->new_profile_dialog),
+	                              transient_parent);
+
+	gtk_window_present (GTK_WINDOW (app->new_profile_dialog));
+}
+
+static void
+profile_list_selection_changed_cb (GtkTreeSelection *selection,
+                                   TerminalApp *app)
+{
+	gboolean selected;
+
+	selected = gtk_tree_selection_get_selected (selection, NULL, NULL);
+
+	gtk_widget_set_sensitive (app->manage_profiles_edit_button, selected);
+	gtk_widget_set_sensitive (app->manage_profiles_delete_button,
+	                          selected &&
+	                          g_hash_table_size (app->profiles) > 1);
+}
+
+static void
+profile_list_response_cb (GtkWidget *dialog,
+                          int        id,
+                          TerminalApp *app)
+{
+	g_assert (app->manage_profiles_dialog == dialog);
+
+	if (id == GTK_RESPONSE_HELP)
+	{
+		terminal_util_show_help ("mate-terminal-manage-profiles", GTK_WINDOW (dialog));
+		return;
+	}
+
+	gtk_widget_destroy (dialog);
+}
+
+static void
+profile_list_destroyed_cb (GtkWidget   *manage_profiles_dialog,
+                           TerminalApp *app)
+{
+	g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_list_treeview_refill), app->manage_profiles_list);
+	g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_combo_box_refill), app->manage_profiles_default_menu);
+
+	app->manage_profiles_dialog = NULL;
+	app->manage_profiles_list = NULL;
+	app->manage_profiles_new_button = NULL;
+	app->manage_profiles_edit_button = NULL;
+	app->manage_profiles_delete_button = NULL;
+	app->manage_profiles_default_menu = NULL;
+}
+
+void
+terminal_app_manage_profiles (TerminalApp     *app,
+                              GtkWindow       *transient_parent)
+{
+	GObject *dialog;
+	GObject *tree_view_container, *new_button, *edit_button, *remove_button;
+	GObject *default_hbox, *default_label;
+	GtkTreeSelection *selection;
+
+	if (app->manage_profiles_dialog)
+	{
+		gtk_window_set_transient_for (GTK_WINDOW (app->manage_profiles_dialog), transient_parent);
+		gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog));
+		return;
+	}
+
+	if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/profile-manager.ui",
+	                                      "profile-manager", &dialog,
+	                                      "profiles-treeview-container", &tree_view_container,
+	                                      "new-profile-button", &new_button,
+	                                      "edit-profile-button", &edit_button,
+	                                      "delete-profile-button", &remove_button,
+	                                      "default-profile-hbox", &default_hbox,
+	                                      "default-profile-label", &default_label,
+	                                      NULL))
+		return;
+
+	app->manage_profiles_dialog = GTK_WIDGET (dialog);
+	app->manage_profiles_new_button = GTK_WIDGET (new_button);
+	app->manage_profiles_edit_button = GTK_WIDGET (edit_button);
+	app->manage_profiles_delete_button  = GTK_WIDGET (remove_button);
+
+	g_signal_connect (dialog, "response", G_CALLBACK (profile_list_response_cb), app);
+	g_signal_connect (dialog, "destroy", G_CALLBACK (profile_list_destroyed_cb), app);
+
+	app->manage_profiles_list = profile_list_treeview_create (app);
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (app->manage_profiles_list));
+	g_signal_connect (selection, "changed", G_CALLBACK (profile_list_selection_changed_cb), app);
+
+	profile_list_treeview_refill (app, app->manage_profiles_list);
+	g_signal_connect (app, "profile-list-changed",
+	                  G_CALLBACK (profile_list_treeview_refill), app->manage_profiles_list);
+
+	g_signal_connect (app->manage_profiles_list, "row-activated",
+	                  G_CALLBACK (profile_list_row_activated_cb), app);
+
+	gtk_container_add (GTK_CONTAINER (tree_view_container), app->manage_profiles_list);
+	gtk_widget_show (app->manage_profiles_list);
+
+	g_signal_connect (new_button, "clicked",
+	                  G_CALLBACK (profile_list_new_button_clicked_cb),
+	                  app->manage_profiles_list);
+	g_signal_connect (edit_button, "clicked",
+	                  G_CALLBACK (profile_list_edit_button_clicked_cb),
+	                  app->manage_profiles_list);
+	g_signal_connect (remove_button, "clicked",
+	                  G_CALLBACK (profile_list_delete_button_clicked_cb),
+	                  app->manage_profiles_list);
+
+	app->manage_profiles_default_menu = profile_combo_box_new (app);
+	g_signal_connect (app->manage_profiles_default_menu, "changed",
+	                  G_CALLBACK (profile_combo_box_changed_cb), app);
+
+	gtk_box_pack_start (GTK_BOX (default_hbox), app->manage_profiles_default_menu, FALSE, FALSE, 0);
+	gtk_widget_show (app->manage_profiles_default_menu);
+
+	gtk_label_set_mnemonic_widget (GTK_LABEL (default_label), app->manage_profiles_default_menu);
+
+	gtk_widget_grab_focus (app->manage_profiles_list);
+
+	gtk_window_set_transient_for (GTK_WINDOW (app->manage_profiles_dialog),
+	                              transient_parent);
+
+	gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog));
+}
+
+#ifdef HAVE_SMCLIENT
+static void
+terminal_app_save_state_cb (EggSMClient *client,
+                            GKeyFile *key_file,
+                            TerminalApp *app)
+{
+	terminal_app_save_config (app, key_file);
+}
+
+static void
+terminal_app_client_quit_cb (EggSMClient *client,
+                             TerminalApp *app)
+{
+	g_signal_emit (app, signals[QUIT], 0);
+}
+#endif /* HAVE_SMCLIENT */
+
+/* Class implementation */
+
+G_DEFINE_TYPE (TerminalApp, terminal_app, 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
+terminal_app_init (TerminalApp *app)
+{
+	global_app = app;
+
+	gtk_window_set_default_icon_name (MATE_TERMINAL_ICON_NAME);
+
+	/* Initialise defaults */
+	app->enable_mnemonics = DEFAULT_ENABLE_MNEMONICS;
+	app->enable_menu_accels = DEFAULT_ENABLE_MENU_BAR_ACCEL;
+
+	app->profiles = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+
+	app->encodings = terminal_encodings_get_builtins ();
+
+	settings_global = g_settings_new (CONF_GLOBAL_SCHEMA);
+	app->settings_font = g_settings_new (MONOSPACE_FONT_SCHEMA);
+
+	g_signal_connect (settings_global,
+			  "changed::" PROFILE_LIST_KEY,
+			  G_CALLBACK(terminal_app_profile_list_notify_cb),
+			  app);
+
+	g_signal_connect (settings_global,
+			  "changed::" DEFAULT_PROFILE_KEY,
+			  G_CALLBACK(terminal_app_default_profile_notify_cb),
+			  app);
+
+	g_signal_connect (settings_global,
+			  "changed::" ENCODING_LIST_KEY,
+			  G_CALLBACK(terminal_app_encoding_list_notify_cb),
+			  app);
+
+	g_signal_connect (app->settings_font,
+			  "changed::" MONOSPACE_FONT_KEY,
+			  G_CALLBACK(terminal_app_system_font_notify_cb),
+			  app);
+
+	g_signal_connect (settings_global,
+	                  "changed::" ENABLE_MNEMONICS_KEY,
+	                  G_CALLBACK(terminal_app_enable_mnemonics_notify_cb),
+	                  app);
+
+	g_signal_connect (settings_global,
+	                  "changed::" ENABLE_MENU_BAR_ACCEL_KEY,
+	                  G_CALLBACK(terminal_app_enable_menu_accels_notify_cb),
+	                  app);
+
+	/* Load the settings */
+        terminal_app_profile_list_notify_cb (settings_global,
+					     PROFILE_LIST_KEY,
+					     app);
+	terminal_app_default_profile_notify_cb (settings_global,
+					        DEFAULT_PROFILE_KEY,
+						app);
+	terminal_app_encoding_list_notify_cb (settings_global,
+					      ENCODING_LIST_KEY,
+					      app);
+	terminal_app_system_font_notify_cb (app->settings_font,
+					    MONOSPACE_FONT_KEY,
+					    app);
+	terminal_app_enable_menu_accels_notify_cb (settings_global,
+	                                           ENABLE_MENU_BAR_ACCEL_KEY,
+	                                           app);
+	terminal_app_enable_mnemonics_notify_cb (settings_global,
+	                                         ENABLE_MNEMONICS_KEY,
+	                                         app);
+
+	/* Ensure we have valid settings */
+	g_assert (app->default_profile_id != NULL);
+	g_assert (app->system_font_desc != NULL);
+
+	terminal_accels_init ();
+
+#ifdef HAVE_SMCLIENT
+	EggSMClient *sm_client;
+	char *desktop_file;
+
+	desktop_file = g_build_filename (TERM_DATADIR,
+	                                 "applications",
+	                                 PACKAGE ".desktop",
+	                                 NULL);
+	egg_set_desktop_file_without_defaults (desktop_file);
+	g_free (desktop_file);
+
+	sm_client = egg_sm_client_get ();
+	g_signal_connect (sm_client, "save-state",
+	                  G_CALLBACK (terminal_app_save_state_cb), app);
+	g_signal_connect (sm_client, "quit",
+	                  G_CALLBACK (terminal_app_client_quit_cb), app);
+#endif /* HAVE_SMCLIENT */
+}
+
+static void
+terminal_app_finalize (GObject *object)
+{
+	TerminalApp *app = TERMINAL_APP (object);
+
+#ifdef HAVE_SMCLIENT
+	EggSMClient *sm_client;
+
+	sm_client = egg_sm_client_get ();
+	g_signal_handlers_disconnect_matched (sm_client, G_SIGNAL_MATCH_DATA,
+	                                      0, 0, NULL, NULL, app);
+#endif /* HAVE_SMCLIENT */
+
+	g_signal_handlers_disconnect_by_func (settings_global,
+					      G_CALLBACK(terminal_app_profile_list_notify_cb),
+					      app);
+	g_signal_handlers_disconnect_by_func (settings_global,
+					      G_CALLBACK(terminal_app_default_profile_notify_cb),
+					      app);
+	g_signal_handlers_disconnect_by_func (settings_global,
+					      G_CALLBACK(terminal_app_encoding_list_notify_cb),
+					      app);
+	g_signal_handlers_disconnect_by_func (app->settings_font,
+					      G_CALLBACK(terminal_app_system_font_notify_cb),
+					      app);
+	g_signal_handlers_disconnect_by_func (settings_global,
+	                                      G_CALLBACK(terminal_app_enable_menu_accels_notify_cb),
+	                                      app);
+	g_signal_handlers_disconnect_by_func (settings_global,
+	                                      G_CALLBACK(terminal_app_enable_mnemonics_notify_cb),
+	                                      app);
+
+	g_object_unref (settings_global);
+	g_object_unref (app->settings_font);
+
+	g_free (app->default_profile_id);
+
+	g_hash_table_destroy (app->profiles);
+
+	g_hash_table_destroy (app->encodings);
+
+	pango_font_description_free (app->system_font_desc);
+
+	terminal_accels_shutdown ();
+
+	G_OBJECT_CLASS (terminal_app_parent_class)->finalize (object);
+
+	global_app = NULL;
+}
+
+static void
+terminal_app_get_property (GObject *object,
+                           guint prop_id,
+                           GValue *value,
+                           GParamSpec *pspec)
+{
+	TerminalApp *app = TERMINAL_APP (object);
+
+	switch (prop_id)
+	{
+	case PROP_SYSTEM_FONT:
+		if (app->system_font_desc)
+			g_value_set_boxed (value, app->system_font_desc);
+		else
+			g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_MONOSPACE_FONT));
+		break;
+	case PROP_ENABLE_MENU_BAR_ACCEL:
+		g_value_set_boolean (value, app->enable_menu_accels);
+		break;
+	case PROP_ENABLE_MNEMONICS:
+		g_value_set_boolean (value, app->enable_mnemonics);
+		break;
+	case PROP_DEFAULT_PROFILE:
+		g_value_set_object (value, app->default_profile);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+terminal_app_set_property (GObject *object,
+                           guint prop_id,
+                           const GValue *value,
+                           GParamSpec *pspec)
+{
+	TerminalApp *app = TERMINAL_APP (object);
+
+	switch (prop_id)
+	{
+	case PROP_ENABLE_MENU_BAR_ACCEL:
+		app->enable_menu_accels = g_value_get_boolean (value);
+		g_settings_set_boolean (settings_global, ENABLE_MENU_BAR_ACCEL_KEY, app->enable_menu_accels);
+		break;
+	case PROP_ENABLE_MNEMONICS:
+		app->enable_mnemonics = g_value_get_boolean (value);
+		g_settings_set_boolean (settings_global, ENABLE_MNEMONICS_KEY, app->enable_mnemonics);
+		break;
+	case PROP_DEFAULT_PROFILE:
+	case PROP_SYSTEM_FONT:
+		/* not writable */
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+terminal_app_real_quit (TerminalApp *app)
+{
+	gtk_main_quit();
+}
+
+static void
+terminal_app_class_init (TerminalAppClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+	object_class->finalize = terminal_app_finalize;
+	object_class->get_property = terminal_app_get_property;
+	object_class->set_property = terminal_app_set_property;
+
+	klass->quit = terminal_app_real_quit;
+
+	signals[QUIT] =
+	    g_signal_new (I_("quit"),
+	                  G_OBJECT_CLASS_TYPE (object_class),
+	                  G_SIGNAL_RUN_LAST,
+	                  G_STRUCT_OFFSET (TerminalAppClass, quit),
+	                  NULL, NULL,
+	                  g_cclosure_marshal_VOID__VOID,
+	                  G_TYPE_NONE, 0);
+
+	signals[PROFILE_LIST_CHANGED] =
+	    g_signal_new (I_("profile-list-changed"),
+	                  G_OBJECT_CLASS_TYPE (object_class),
+	                  G_SIGNAL_RUN_LAST,
+	                  G_STRUCT_OFFSET (TerminalAppClass, profile_list_changed),
+	                  NULL, NULL,
+	                  g_cclosure_marshal_VOID__VOID,
+	                  G_TYPE_NONE, 0);
+
+	signals[ENCODING_LIST_CHANGED] =
+	    g_signal_new (I_("encoding-list-changed"),
+	                  G_OBJECT_CLASS_TYPE (object_class),
+	                  G_SIGNAL_RUN_LAST,
+	                  G_STRUCT_OFFSET (TerminalAppClass, profile_list_changed),
+	                  NULL, NULL,
+	                  g_cclosure_marshal_VOID__VOID,
+	                  G_TYPE_NONE, 0);
+
+	g_object_class_install_property
+	(object_class,
+	 PROP_ENABLE_MENU_BAR_ACCEL,
+	 g_param_spec_boolean (TERMINAL_APP_ENABLE_MENU_BAR_ACCEL, NULL, NULL,
+	                       DEFAULT_ENABLE_MENU_BAR_ACCEL,
+	                       G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+	g_object_class_install_property
+	(object_class,
+	 PROP_ENABLE_MNEMONICS,
+	 g_param_spec_boolean (TERMINAL_APP_ENABLE_MNEMONICS, NULL, NULL,
+	                       DEFAULT_ENABLE_MNEMONICS,
+	                       G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+	g_object_class_install_property
+	(object_class,
+	 PROP_SYSTEM_FONT,
+	 g_param_spec_boxed (TERMINAL_APP_SYSTEM_FONT, NULL, NULL,
+	                     PANGO_TYPE_FONT_DESCRIPTION,
+	                     G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+	g_object_class_install_property
+	(object_class,
+	 PROP_DEFAULT_PROFILE,
+	 g_param_spec_object (TERMINAL_APP_DEFAULT_PROFILE, NULL, NULL,
+	                      TERMINAL_TYPE_PROFILE,
+	                      G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+}
+
+/* Public API */
+
+TerminalApp*
+terminal_app_get (void)
+{
+	if (global_app == NULL)
+	{
+		g_object_new (TERMINAL_TYPE_APP, NULL);
+		g_assert (global_app != NULL);
+	}
+
+	return global_app;
+}
+
+void
+terminal_app_shutdown (void)
+{
+	if (global_app == NULL)
+		return;
+
+	g_object_unref (global_app);
+	g_assert (global_app == NULL);
+}
+
+/**
+ * terminal_app_handle_options:
+ * @app:
+ * @options: a #TerminalOptions
+ * @allow_resume: whether to merge the terminal configuration from the
+ *   saved session on resume
+ * @error: a #GError to fill in
+ *
+ * Processes @options. It loads or saves the terminal configuration, or
+ * opens the specified windows and tabs.
+ *
+ * Returns: %TRUE if @options could be successfully handled, or %FALSE on
+ *   error
+ */
+gboolean
+terminal_app_handle_options (TerminalApp *app,
+                             TerminalOptions *options,
+                             gboolean allow_resume,
+                             GError **error)
+{
+	GList *lw;
+	GdkScreen *gdk_screen;
+
+	gdk_screen = terminal_app_get_screen_by_display_name (options->display_name);
+
+	if (options->save_config)
+	{
+		if (options->remote_arguments)
+			return terminal_app_save_config_file (app, options->config_file, error);
+
+		g_set_error_literal (error, TERMINAL_OPTION_ERROR, TERMINAL_OPTION_ERROR_NOT_IN_FACTORY,
+		                     "Cannot use \"--save-config\" when starting the factory process");
+		return FALSE;
+	}
+
+	if (options->load_config)
+	{
+		GKeyFile *key_file;
+		gboolean result;
+
+		key_file = g_key_file_new ();
+		result = g_key_file_load_from_file (key_file, options->config_file, 0, error) &&
+		         terminal_options_merge_config (options, key_file, SOURCE_DEFAULT, error);
+		g_key_file_free (key_file);
+
+		if (!result)
+			return FALSE;
+
+		/* fall-through on success */
+	}
+
+#ifdef HAVE_SMCLIENT
+	EggSMClient *sm_client;
+
+	sm_client = egg_sm_client_get ();
+
+	if (allow_resume && egg_sm_client_is_resumed (sm_client))
+	{
+		GKeyFile *key_file;
+
+		key_file = egg_sm_client_get_state_file (sm_client);
+		if (key_file != NULL &&
+		        !terminal_options_merge_config (options, key_file, SOURCE_SESSION, error))
+			return FALSE;
+	}
+#endif /* HAVE_SMCLIENT */
+
+	/* Make sure we open at least one window */
+	terminal_options_ensure_window (options);
+
+	if (options->startup_id != NULL)
+		_terminal_debug_print (TERMINAL_DEBUG_FACTORY,
+		                       "Startup ID is '%s'\n",
+		                       options->startup_id);
+
+	for (lw = options->initial_windows;  lw != NULL; lw = lw->next)
+	{
+		InitialWindow *iw = lw->data;
+		TerminalWindow *window = NULL;
+		GList *lt;
+
+		g_assert (iw->tabs);
+
+        if ( lw == options->initial_windows && ((InitialTab *)iw->tabs->data)->attach_window )
+            window = terminal_app_get_current_window(app, gdk_screen, options->initial_workspace);
+
+        if (!window)
+        {
+            /* Create & setup new window */
+            window = terminal_app_new_window (app, gdk_screen);
+
+            /* Restored windows shouldn't demand attention; see bug #586308. */
+            if (iw->source_tag == SOURCE_SESSION)
+                terminal_window_set_is_restored (window);
+
+            if (options->startup_id != NULL)
+                gtk_window_set_startup_id (GTK_WINDOW (window), options->startup_id);
+
+            /* Overwrite the default, unique window role set in terminal_window_init */
+            if (iw->role)
+                gtk_window_set_role (GTK_WINDOW (window), iw->role);
+
+            if (iw->force_menubar_state)
+                terminal_window_set_menubar_visible (window, iw->menubar_state);
+
+            if (iw->start_fullscreen)
+                gtk_window_fullscreen (GTK_WINDOW (window));
+            if (iw->start_maximized)
+                gtk_window_maximize (GTK_WINDOW (window));
+        }
+
+		/* Now add the tabs */
+		for (lt = iw->tabs; lt != NULL; lt = lt->next)
+		{
+			InitialTab *it = lt->data;
+			TerminalProfile *profile = NULL;
+			TerminalScreen *screen;
+			const char *profile_name;
+			gboolean profile_is_id;
+
+			if (it->profile)
+			{
+				profile_name = it->profile;
+				profile_is_id = it->profile_is_id;
+			}
+			else
+			{
+				profile_name = options->default_profile;
+				profile_is_id = options->default_profile_is_id;
+			}
+
+			if (profile_name)
+			{
+				if (profile_is_id)
+					profile = terminal_app_get_profile_by_name (app, profile_name);
+				else
+					profile = terminal_app_get_profile_by_visible_name (app, profile_name);
+
+				if (profile == NULL)
+					g_printerr (_("No such profile \"%s\", using default profile\n"), it->profile);
+			}
+			if (profile == NULL)
+				profile = terminal_app_get_profile_for_new_term (app);
+			g_assert (profile);
+
+			screen = terminal_app_new_terminal (app, window, profile,
+			                                    it->exec_argv ? it->exec_argv : options->exec_argv,
+			                                    it->title ? it->title : options->default_title,
+			                                    it->working_dir ? it->working_dir : options->default_working_dir,
+			                                    options->env,
+			                                    it->zoom_set ? it->zoom : options->zoom);
+
+			if (it->active)
+				terminal_window_switch_screen (window, screen);
+		}
+
+		if (iw->geometry)
+		{
+			_terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+			                       "[window %p] applying geometry %s\n",
+			                       window, iw->geometry);
+
+			if (!terminal_window_update_size_set_geometry (window,
+			                                               terminal_window_get_active (window),
+			                                               FALSE,
+			                                               iw->geometry))
+				g_printerr (_("Invalid geometry string \"%s\"\n"), iw->geometry);
+		}
+
+		gtk_window_present (GTK_WINDOW (window));
+	}
+
+	return TRUE;
+}
+
+TerminalWindow *
+terminal_app_new_window (TerminalApp *app,
+                         GdkScreen *screen)
+{
+	TerminalWindow *window;
+
+	window = terminal_window_new ();
+
+	app->windows = g_list_append (app->windows, window);
+	g_signal_connect (window, "destroy",
+	                  G_CALLBACK (terminal_window_destroyed), app);
+
+	if (screen)
+		gtk_window_set_screen (GTK_WINDOW (window), screen);
+
+	return window;
+}
+
+TerminalScreen *
+terminal_app_new_terminal (TerminalApp     *app,
+                           TerminalWindow  *window,
+                           TerminalProfile *profile,
+                           char           **override_command,
+                           const char      *title,
+                           const char      *working_dir,
+                           char           **child_env,
+                           double           zoom)
+{
+	TerminalScreen *screen;
+
+	g_return_val_if_fail (TERMINAL_IS_APP (app), NULL);
+	g_return_val_if_fail (TERMINAL_IS_WINDOW (window), NULL);
+
+	screen = terminal_screen_new (profile, override_command, title,
+	                              working_dir, child_env, zoom);
+
+	terminal_window_add_screen (window, screen, -1);
+	terminal_window_switch_screen (window, screen);
+	gtk_widget_grab_focus (GTK_WIDGET (screen));
+
+	return screen;
+}
+
+void
+terminal_app_edit_profile (TerminalApp     *app,
+                           TerminalProfile *profile,
+                           GtkWindow       *transient_parent,
+                           const char      *widget_name)
+{
+	terminal_profile_edit (profile, transient_parent, widget_name);
+}
+
+void
+terminal_app_edit_keybindings (TerminalApp     *app,
+                               GtkWindow       *transient_parent)
+{
+	terminal_edit_keys_dialog_show (transient_parent);
+}
+
+void
+terminal_app_edit_encodings (TerminalApp     *app,
+                             GtkWindow       *transient_parent)
+{
+	terminal_encoding_dialog_show (transient_parent);
+}
+
+/*
+* Get the window in the given screen and workspace. If nothing is found,
+* a NULL is returned.
+*/
+TerminalWindow *
+terminal_app_get_current_window (TerminalApp *app,
+                                 GdkScreen *from_screen,
+                                 int workspace)
+{
+    GList *res = NULL;
+    TerminalWindow *ret = NULL;
+
+	if (app->windows == NULL)
+		return NULL;
+
+    res = g_list_last (app->windows);
+
+    g_assert (from_screen != NULL);
+
+    while (res)
+    {
+      int win_workspace;
+      if (gtk_window_get_screen(GTK_WINDOW(res->data)) != from_screen)
+        continue;
+
+      win_workspace = terminal_app_get_workspace_for_window(res->data);
+
+      /* Same workspace or if the window is set to show up on all workspaces */
+      if (win_workspace == workspace || win_workspace == -1)
+        ret = terminal_window_get_latest_focused (ret, TERMINAL_WINDOW(res->data));
+
+      res = g_list_previous (res);
+    }
+
+  return ret;
+}
+
+/**
+ * terminal_profile_get_list:
+ *
+ * Returns: a #GList containing all #TerminalProfile objects.
+ *   The content of the list is owned by the backend and
+ *   should not be modified or freed. Use g_list_free() when done
+ *   using the list.
+ */
+GList*
+terminal_app_get_profile_list (TerminalApp *app)
+{
+	g_return_val_if_fail (TERMINAL_IS_APP (app), NULL);
+
+	return g_list_sort (g_hash_table_get_values (app->profiles), profiles_alphabetic_cmp);
+}
+
+TerminalProfile*
+terminal_app_get_profile_by_name (TerminalApp *app,
+                                  const char *name)
+{
+	g_return_val_if_fail (TERMINAL_IS_APP (app), NULL);
+	g_return_val_if_fail (name != NULL, NULL);
+
+	return g_hash_table_lookup (app->profiles, name);
+}
+
+TerminalProfile*
+terminal_app_get_profile_by_visible_name (TerminalApp *app,
+        const char *name)
+{
+	LookupInfo info;
+
+	g_return_val_if_fail (TERMINAL_IS_APP (app), NULL);
+	g_return_val_if_fail (name != NULL, NULL);
+
+	info.result = NULL;
+	info.target = name;
+
+	g_hash_table_foreach (app->profiles,
+	                      profiles_lookup_by_visible_name_foreach,
+	                      &info);
+	return info.result;
+}
+
+TerminalProfile*
+terminal_app_get_default_profile (TerminalApp *app)
+{
+	g_return_val_if_fail (TERMINAL_IS_APP (app), NULL);
+
+	return app->default_profile;
+}
+
+TerminalProfile*
+terminal_app_get_profile_for_new_term (TerminalApp *app)
+{
+	GHashTableIter iter;
+	TerminalProfile *profile = NULL;
+	TerminalProfile **profileptr = &profile;
+
+	g_return_val_if_fail (TERMINAL_IS_APP (app), NULL);
+
+	if (app->default_profile)
+		return app->default_profile;
+
+	g_hash_table_iter_init (&iter, app->profiles);
+	if (g_hash_table_iter_next (&iter, NULL, (gpointer *) profileptr))
+		return profile;
+
+	return NULL;
+}
+
+GHashTable *
+terminal_app_get_encodings (TerminalApp *app)
+{
+	return app->encodings;
+}
+
+/**
+ * terminal_app_ensure_encoding:
+ * @app:
+ * @charset:
+ *
+ * Ensures there's a #TerminalEncoding for @charset available.
+ */
+TerminalEncoding *
+terminal_app_ensure_encoding (TerminalApp *app,
+                              const char *charset)
+{
+	TerminalEncoding *encoding;
+
+	encoding = g_hash_table_lookup (app->encodings, charset);
+	if (encoding == NULL)
+	{
+		encoding = terminal_encoding_new (charset,
+		                                  _("User Defined"),
+		                                  TRUE,
+		                                  TRUE /* scary! */);
+		g_hash_table_insert (app->encodings,
+		                     (gpointer) terminal_encoding_get_id (encoding),
+		                     encoding);
+	}
+
+	return encoding;
+}
+
+/**
+ * terminal_app_get_active_encodings:
+ *
+ * Returns: a newly allocated list of newly referenced #TerminalEncoding objects.
+ */
+GSList*
+terminal_app_get_active_encodings (TerminalApp *app)
+{
+	GSList *list = NULL;
+	GHashTableIter iter;
+	gpointer key, value;
+
+	g_hash_table_iter_init (&iter, app->encodings);
+	while (g_hash_table_iter_next (&iter, &key, &value))
+	{
+		TerminalEncoding *encoding = (TerminalEncoding *) value;
+
+		if (!encoding->is_active)
+			continue;
+
+		list = g_slist_prepend (list, terminal_encoding_ref (encoding));
+	}
+
+	return g_slist_sort (list, (GCompareFunc) compare_encodings);
+}
+
+void
+terminal_app_save_config (TerminalApp *app,
+                          GKeyFile *key_file)
+{
+	GList *lw;
+	guint n = 0;
+	GPtrArray *window_names_array;
+	char **window_names;
+	gsize len;
+
+	g_key_file_set_comment (key_file, NULL, NULL, "Written by " PACKAGE_STRING, NULL);
+
+	g_key_file_set_integer (key_file, TERMINAL_CONFIG_GROUP, TERMINAL_CONFIG_PROP_VERSION, TERMINAL_CONFIG_VERSION);
+	g_key_file_set_integer (key_file, TERMINAL_CONFIG_GROUP, TERMINAL_CONFIG_PROP_COMPAT_VERSION, TERMINAL_CONFIG_COMPAT_VERSION);
+
+	window_names_array = g_ptr_array_sized_new (g_list_length (app->windows) + 1);
+
+	for (lw = app->windows; lw != NULL; lw = lw->next)
+	{
+		TerminalWindow *window = TERMINAL_WINDOW (lw->data);
+		char *group;
+
+		group = g_strdup_printf ("Window%u", n++);
+		g_ptr_array_add (window_names_array, group);
+
+		terminal_window_save_state (window, key_file, group);
+	}
+
+	len = window_names_array->len;
+	g_ptr_array_add (window_names_array, NULL);
+	window_names = (char **) g_ptr_array_free (window_names_array, FALSE);
+	g_key_file_set_string_list (key_file, TERMINAL_CONFIG_GROUP, TERMINAL_CONFIG_PROP_WINDOWS, (const char * const *) window_names, len);
+	g_strfreev (window_names);
+}
+
+gboolean
+terminal_app_save_config_file (TerminalApp *app,
+                               const char *file_name,
+                               GError **error)
+{
+	GKeyFile *key_file;
+	char *data;
+	gsize len;
+	gboolean result;
+
+	key_file = g_key_file_new ();
+	terminal_app_save_config (app, key_file);
+
+	data = g_key_file_to_data (key_file, &len, NULL);
+	result = g_file_set_contents (file_name, data, len, error);
+	g_free (data);
+
+	return result;
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/36.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/36.html new file mode 100644 index 0000000..dfc95be --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/36.html @@ -0,0 +1,377 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
/*
+ * Copyright © 2008, 2010 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+*
+ * 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 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TERMINAL_SCREEN_CONTAINER_H
+#define TERMINAL_SCREEN_CONTAINER_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "terminal-screen.h"
+
+G_BEGIN_DECLS
+
+#define TERMINAL_TYPE_SCREEN_CONTAINER         (terminal_screen_container_get_type ())
+#define TERMINAL_SCREEN_CONTAINER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), TERMINAL_TYPE_SCREEN_CONTAINER, TerminalScreenContainer))
+#define TERMINAL_SCREEN_CONTAINER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), TERMINAL_TYPE_SCREEN_CONTAINER, TerminalScreenContainerClass))
+#define TERMINAL_IS_SCREEN_CONTAINER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), TERMINAL_TYPE_SCREEN_CONTAINER))
+#define TERMINAL_IS_SCREEN_CONTAINER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), TERMINAL_TYPE_SCREEN_CONTAINER))
+#define TERMINAL_SCREEN_CONTAINER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TERMINAL_TYPE_SCREEN_CONTAINER, TerminalScreenContainerClass))
+
+typedef struct _TerminalScreenContainer        TerminalScreenContainer;
+typedef struct _TerminalScreenContainerClass   TerminalScreenContainerClass;
+typedef struct _TerminalScreenContainerPrivate TerminalScreenContainerPrivate;
+
+struct _TerminalScreenContainer
+{
+	GtkBox parent_instance;
+
+	/*< private >*/
+	TerminalScreenContainerPrivate *priv;
+};
+
+struct _TerminalScreenContainerClass
+{
+	GtkBoxClass parent_class;
+};
+
+GType terminal_screen_container_get_type (void);
+
+GtkWidget *terminal_screen_container_new (TerminalScreen *screen);
+
+TerminalScreen *terminal_screen_container_get_screen (TerminalScreenContainer *container);
+
+TerminalScreenContainer *terminal_screen_container_get_from_screen (TerminalScreen *screen);
+
+void terminal_screen_container_set_policy (TerminalScreenContainer *container,
+        GtkPolicyType hpolicy,
+        GtkPolicyType vpolicy);
+
+void terminal_screen_container_set_placement (TerminalScreenContainer *container,
+        GtkCornerType corner);
+
+G_END_DECLS
+
+#endif /* TERMINAL_SCREEN_CONTAINER_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/37.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/37.html new file mode 100644 index 0000000..51c73e3 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/37.html @@ -0,0 +1,461 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * Copyright © 2001 Havoc Pennington
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * 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 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TERMINAL_WINDOW_H
+#define TERMINAL_WINDOW_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-screen.h"
+
+G_BEGIN_DECLS
+
+#define TERMINAL_TYPE_WINDOW              (terminal_window_get_type ())
+#define TERMINAL_WINDOW(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), TERMINAL_TYPE_WINDOW, TerminalWindow))
+#define TERMINAL_WINDOW_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_WINDOW, TerminalWindowClass))
+#define TERMINAL_IS_WINDOW(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), TERMINAL_TYPE_WINDOW))
+#define TERMINAL_IS_WINDOW_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_WINDOW))
+#define TERMINAL_WINDOW_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_WINDOW, TerminalWindowClass))
+
+typedef struct _TerminalWindowClass   TerminalWindowClass;
+typedef struct _TerminalWindowPrivate TerminalWindowPrivate;
+
+struct _TerminalWindow
+{
+	GtkWindow parent_instance;
+
+	TerminalWindowPrivate *priv;
+};
+
+struct _TerminalWindowClass
+{
+	GtkWindowClass parent_class;
+
+};
+
+GType terminal_window_get_type (void) G_GNUC_CONST;
+
+TerminalWindow* terminal_window_new (void);
+
+void terminal_window_set_is_restored (TerminalWindow *window);
+
+GtkUIManager *terminal_window_get_ui_manager (TerminalWindow *window);
+
+void terminal_window_add_screen (TerminalWindow *window,
+                                 TerminalScreen *screen,
+                                 int position);
+
+void terminal_window_remove_screen (TerminalWindow *window,
+                                    TerminalScreen *screen);
+
+void terminal_window_move_screen (TerminalWindow *source_window,
+                                  TerminalWindow *dest_window,
+                                  TerminalScreen *screen,
+                                  int dest_position);
+
+/* Menubar visibility is part of session state, except that
+ * if it isn't restored from session, the window gets the setting
+ * from the profile of the first screen added to the window
+ */
+void terminal_window_set_menubar_visible     (TerminalWindow *window,
+        gboolean        setting);
+gboolean terminal_window_get_menubar_visible (TerminalWindow *window);
+
+void            terminal_window_switch_screen (TerminalWindow *window,
+        TerminalScreen *screen);
+TerminalScreen* terminal_window_get_active (TerminalWindow *window);
+
+GList* terminal_window_list_screen_containers (TerminalWindow *window);
+
+void terminal_window_update_geometry  (TerminalWindow *window);
+void
+terminal_window_update_size (TerminalWindow *window,
+                             TerminalScreen *screen,
+                             gboolean        even_if_mapped);
+gboolean
+terminal_window_update_size_set_geometry (TerminalWindow *window,
+                                          TerminalScreen *screen,
+                                          gboolean        even_if_mapped,
+                                          gchar          *geometry_string);
+
+GtkWidget* terminal_window_get_notebook (TerminalWindow *window);
+
+void terminal_window_save_state (TerminalWindow *window,
+                                 GKeyFile *key_file,
+                                 const char *group);
+void
+terminal_window_update_copy_selection (TerminalScreen *screen,
+                                       TerminalWindow *window);
+
+TerminalWindow *terminal_window_get_latest_focused (TerminalWindow *window1,
+                                                    TerminalWindow *window2);
+
+G_END_DECLS
+
+#endif /* TERMINAL_WINDOW_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/38.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/38.html new file mode 100644 index 0000000..93b32a6 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/38.html @@ -0,0 +1,387 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
/*
+ * terminal-close-button.c
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * Copyright © 2010 - Paolo Borelli
+ * Copyright © 2011 - Ignacio Casal Quinteiro
+ * Copyright © 2016 - Wolfgang Ulbrich
+ *
+ * Mate-terminal 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-close-button.h"
+
+struct _TerminalCloseButtonClassPrivate {
+	GtkCssProvider *css;
+};
+
+G_DEFINE_TYPE_WITH_CODE (TerminalCloseButton, terminal_close_button, GTK_TYPE_BUTTON,<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_CODE is a macro then please configure it.
+                         g_type_add_class_private (g_define_type_id, sizeof (TerminalCloseButtonClassPrivate)))
+
+static void
+terminal_close_button_class_init (TerminalCloseButtonClass *klass)
+{
+	static const gchar button_style[] =
+		"* {\n"
+		  "padding: 0;\n"
+		"}";
+
+	klass->priv = G_TYPE_CLASS_GET_PRIVATE (klass, TERMINAL_TYPE_CLOSE_BUTTON, TerminalCloseButtonClassPrivate);
+
+	klass->priv->css = gtk_css_provider_new ();
+	gtk_css_provider_load_from_data (klass->priv->css, button_style, -1, NULL);
+}
+
+static void
+terminal_close_button_init (TerminalCloseButton *button)
+{
+	GtkWidget *image;
+	GtkStyleContext *context;
+
+	gtk_widget_set_name (GTK_WIDGET (button), "mate-terminal-tab-close-button");
+
+	image = gtk_image_new_from_icon_name ("window-close", GTK_ICON_SIZE_MENU);
+	gtk_widget_show (image);
+
+	gtk_container_add (GTK_CONTAINER (button), image);
+
+	context = gtk_widget_get_style_context (GTK_WIDGET (button));
+	gtk_style_context_add_provider (context,
+	                                GTK_STYLE_PROVIDER (TERMINAL_CLOSE_BUTTON_GET_CLASS (button)->priv->css),
+	                                GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+}
+
+GtkWidget *
+terminal_close_button_new ()
+{
+	return GTK_WIDGET (g_object_new (TERMINAL_TYPE_CLOSE_BUTTON,
+	                                 "relief", GTK_RELIEF_NONE,
+	                                 "focus-on-click", FALSE,
+	                                 NULL));
+}
+
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/39.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/39.html new file mode 100644 index 0000000..dcbb83f --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/39.html @@ -0,0 +1,357 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
/*
+ * terminal-close-button.h
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * Copyright © 2010 - Paolo Borelli
+ * Copyright © 2016 - Wolfgang Ulbrich
+ *
+ * Mate-terminal 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __TERMINAL_CLOSE_BUTTON_H__
+#define __TERMINAL_CLOSE_BUTTON_H__
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define TERMINAL_TYPE_CLOSE_BUTTON			(terminal_close_button_get_type ())
+#define TERMINAL_CLOSE_BUTTON(obj)			(G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_TYPE_CLOSE_BUTTON, TerminalCloseButton))
+#define TERMINAL_CLOSE_BUTTON_CONST(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_TYPE_CLOSE_BUTTON, TerminalCloseButton const))
+#define TERMINAL_CLOSE_BUTTON_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_CLOSE_BUTTON, TerminalCloseButtonClass))
+#define TERMINAL_IS_CLOSE_BUTTON(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), TERMINAL_TYPE_CLOSE_BUTTON))
+#define TERMINAL_IS_CLOSE_BUTTON_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_CLOSE_BUTTON))
+#define TERMINAL_CLOSE_BUTTON_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_CLOSE_BUTTON, TerminalCloseButtonClass))
+
+typedef struct _TerminalCloseButton		TerminalCloseButton;
+typedef struct _TerminalCloseButtonPrivate	TerminalCloseButtonPrivate;
+typedef struct _TerminalCloseButtonClass	TerminalCloseButtonClass;
+typedef struct _TerminalCloseButtonClassPrivate	TerminalCloseButtonClassPrivate;
+
+struct _TerminalCloseButton
+{
+	GtkButton parent;
+};
+
+struct _TerminalCloseButtonClass
+{
+	GtkButtonClass parent_class;
+
+	TerminalCloseButtonClassPrivate *priv;
+};
+
+GType		  terminal_close_button_get_type (void) G_GNUC_CONST;
+
+GtkWidget	 *terminal_close_button_new      (void);
+
+G_END_DECLS
+
+#endif /* __TERMINAL_CLOSE_BUTTON_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/4.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/4.html new file mode 100644 index 0000000..44798bc --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/4.html @@ -0,0 +1,3385 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
   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
/* eggdesktopfile.c - Freedesktop.Org Desktop Files
+ * Copyright (C) 2007 Novell, Inc.
+ *
+ * Based on mate-desktop-item.c
+ * Copyright (C) 1999, 2000 Red Hat Inc.
+ * Copyright (C) 2001 George Lebl
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING.LIB. If not,
+ * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"<--- Include file: "config.h" not found.
+#endif
+
+#include "eggdesktopfile.h"
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+struct EggDesktopFile {
+  GKeyFile           *key_file;
+  char               *source;
+
+  char               *name, *icon;
+  EggDesktopFileType  type;
+  char                document_code;
+};
+
+/**
+ * egg_desktop_file_new:
+ * @desktop_file_path: path to a Freedesktop-style Desktop file
+ * @error: error pointer
+ *
+ * Creates a new #EggDesktopFile for @desktop_file.
+ *
+ * Return value: the new #EggDesktopFile, or %NULL on error.
+ **/
+EggDesktopFile *
+egg_desktop_file_new (const char *desktop_file_path, GError **error)
+{
+  GKeyFile *key_file;
+
+  key_file = g_key_file_new ();
+  if (!g_key_file_load_from_file (key_file, desktop_file_path, 0, error))
+    {
+      g_key_file_free (key_file);
+      return NULL;
+    }
+
+  return egg_desktop_file_new_from_key_file (key_file, desktop_file_path,
+					     error);
+}
+
+/**
+ * egg_desktop_file_new_from_data_dirs:
+ * @desktop_file_path: relative path to a Freedesktop-style Desktop file
+ * @error: error pointer
+ *
+ * Looks for @desktop_file_path in the paths returned from
+ * g_get_user_data_dir() and g_get_system_data_dirs(), and creates
+ * a new #EggDesktopFile from it.
+ *
+ * Return value: the new #EggDesktopFile, or %NULL on error.
+ **/
+EggDesktopFile *
+egg_desktop_file_new_from_data_dirs (const char  *desktop_file_path,
+				     GError     **error)
+{
+  EggDesktopFile *desktop_file;
+  GKeyFile *key_file;
+  char *full_path;
+
+  key_file = g_key_file_new ();
+  if (!g_key_file_load_from_data_dirs (key_file, desktop_file_path,
+				       &full_path, 0, error))
+    {
+      g_key_file_free (key_file);
+      return NULL;
+    }
+
+  desktop_file = egg_desktop_file_new_from_key_file (key_file,
+						     full_path,
+						     error);
+  g_free (full_path);
+  return desktop_file;
+}
+
+/**
+ * egg_desktop_file_new_from_dirs:
+ * @desktop_file_path: relative path to a Freedesktop-style Desktop file
+ * @search_dirs: NULL-terminated array of directories to search
+ * @error: error pointer
+ *
+ * Looks for @desktop_file_path in the paths returned from
+ * g_get_user_data_dir() and g_get_system_data_dirs(), and creates
+ * a new #EggDesktopFile from it.
+ *
+ * Return value: the new #EggDesktopFile, or %NULL on error.
+ **/
+EggDesktopFile *
+egg_desktop_file_new_from_dirs (const char  *desktop_file_path,
+				const char **search_dirs,
+				GError     **error)
+{
+  EggDesktopFile *desktop_file;
+  GKeyFile *key_file;
+  char *full_path;
+
+  key_file = g_key_file_new ();
+  if (!g_key_file_load_from_dirs (key_file, desktop_file_path, search_dirs,
+				  &full_path, 0, error))
+    {
+      g_key_file_free (key_file);
+      return NULL;
+    }
+
+  desktop_file = egg_desktop_file_new_from_key_file (key_file,
+						     full_path,
+						     error);
+  g_free (full_path);
+  return desktop_file;
+}
+
+/**
+ * egg_desktop_file_new_from_key_file:
+ * @key_file: a #GKeyFile representing a desktop file
+ * @source: the path or URI that @key_file was loaded from, or %NULL
+ * @error: error pointer
+ *
+ * Creates a new #EggDesktopFile for @key_file. Assumes ownership of
+ * @key_file (on success or failure); you should consider @key_file to
+ * be freed after calling this function.
+ *
+ * Return value: the new #EggDesktopFile, or %NULL on error.
+ **/
+EggDesktopFile *
+egg_desktop_file_new_from_key_file (GKeyFile    *key_file,
+				    const char  *source,
+				    GError     **error)
+{
+  EggDesktopFile *desktop_file;
+  char *version, *type;
+
+  if (!g_key_file_has_group (key_file, EGG_DESKTOP_FILE_GROUP))
+    {
+      g_set_error (error, EGG_DESKTOP_FILE_ERROR,
+		   EGG_DESKTOP_FILE_ERROR_INVALID,
+		   _("File is not a valid .desktop file"));
+      g_key_file_free (key_file);
+      return NULL;
+    }
+
+  version = g_key_file_get_value (key_file, EGG_DESKTOP_FILE_GROUP,
+				  EGG_DESKTOP_FILE_KEY_VERSION,
+				  NULL);
+  if (version)
+    {
+      double version_num;
+      char *end;
+
+      version_num = g_ascii_strtod (version, &end);
+      if (*end)
+	{
+	  g_warning ("Invalid Version string '%s' in %s",
+		     version, source ? source : "(unknown)");
+	}
+      else if (version_num > 1.0)
+	{
+      /* Translators: Version here is capitalized because it refers to a
+       * field in the desktop file */
+	  g_set_error (error, EGG_DESKTOP_FILE_ERROR,
+		       EGG_DESKTOP_FILE_ERROR_INVALID,
+		       _("Unrecognized desktop file Version '%s'"), version);
+	  g_free (version);
+	  g_key_file_free (key_file);
+	  return NULL;
+	}
+      g_free (version);
+    }
+
+  desktop_file = g_new0 (EggDesktopFile, 1);
+  desktop_file->key_file = key_file;
+
+  if (g_path_is_absolute (source))
+    desktop_file->source = g_filename_to_uri (source, NULL, NULL);
+  else
+    desktop_file->source = g_strdup (source);
+
+  desktop_file->name = g_key_file_get_string (key_file, EGG_DESKTOP_FILE_GROUP,
+					      EGG_DESKTOP_FILE_KEY_NAME, error);
+  if (!desktop_file->name)
+    {
+      egg_desktop_file_free (desktop_file);
+      return NULL;
+    }
+
+  type = g_key_file_get_string (key_file, EGG_DESKTOP_FILE_GROUP,
+				EGG_DESKTOP_FILE_KEY_TYPE, error);
+  if (!type)
+    {
+      egg_desktop_file_free (desktop_file);
+      return NULL;
+    }
+
+  if (!strcmp (type, "Application"))
+    {
+      char *exec, *p;
+
+      desktop_file->type = EGG_DESKTOP_FILE_TYPE_APPLICATION;
+
+      exec = g_key_file_get_string (key_file,
+				    EGG_DESKTOP_FILE_GROUP,
+				    EGG_DESKTOP_FILE_KEY_EXEC,
+				    error);
+      if (!exec)
+	{
+	  egg_desktop_file_free (desktop_file);
+	  g_free (type);
+	  return NULL;
+	}
+
+      /* See if it takes paths or URIs or neither */
+      for (p = exec; *p; p++)
+	{
+	  if (*p == '%')
+	    {
+	      if (p[1] == '\0' || strchr ("FfUu", p[1]))
+		{
+		  desktop_file->document_code = p[1];
+		  break;
+		}
+	      p++;
+	    }
+	}
+
+      g_free (exec);
+    }
+  else if (!strcmp (type, "Link"))
+    {
+      char *url;
+
+      desktop_file->type = EGG_DESKTOP_FILE_TYPE_LINK;
+
+      url = g_key_file_get_string (key_file,
+				   EGG_DESKTOP_FILE_GROUP,
+				   EGG_DESKTOP_FILE_KEY_URL,
+				   error);
+      if (!url)
+	{
+	  egg_desktop_file_free (desktop_file);
+	  g_free (type);
+	  return NULL;
+	}
+      g_free (url);
+    }
+  else if (!strcmp (type, "Directory"))
+    desktop_file->type = EGG_DESKTOP_FILE_TYPE_DIRECTORY;
+  else
+    desktop_file->type = EGG_DESKTOP_FILE_TYPE_UNRECOGNIZED;
+
+  g_free (type);
+
+  /* Check the Icon key */
+  desktop_file->icon = g_key_file_get_string (key_file,
+					      EGG_DESKTOP_FILE_GROUP,
+					      EGG_DESKTOP_FILE_KEY_ICON,
+					      NULL);
+  if (desktop_file->icon && !g_path_is_absolute (desktop_file->icon))
+    {
+      char *ext;
+
+      /* Lots of .desktop files still get this wrong */
+      ext = strrchr (desktop_file->icon, '.');
+      if (ext && (!strcmp (ext, ".png") ||
+		  !strcmp (ext, ".xpm") ||
+		  !strcmp (ext, ".svg")))
+	{
+	  g_warning ("Desktop file '%s' has malformed Icon key '%s'"
+		     "(should not include extension)",
+		     source ? source : "(unknown)",
+		     desktop_file->icon);
+	  *ext = '\0';
+	}
+    }
+
+  return desktop_file;
+}
+
+/**
+ * egg_desktop_file_free:
+ * @desktop_file: an #EggDesktopFile
+ *
+ * Frees @desktop_file.
+ **/
+void
+egg_desktop_file_free (EggDesktopFile *desktop_file)
+{
+  g_key_file_free (desktop_file->key_file);
+  g_free (desktop_file->source);
+  g_free (desktop_file->name);
+  g_free (desktop_file->icon);
+  g_free (desktop_file);
+}
+
+/**
+ * egg_desktop_file_get_source:
+ * @desktop_file: an #EggDesktopFile
+ *
+ * Gets the URI that @desktop_file was loaded from.
+ *
+ * Return value: @desktop_file's source URI
+ **/
+const char *
+egg_desktop_file_get_source (EggDesktopFile *desktop_file)<--- Parameter 'desktop_file' can be declared as pointer to const
+{
+  return desktop_file->source;
+}
+
+/**
+ * egg_desktop_file_get_desktop_file_type:
+ * @desktop_file: an #EggDesktopFile
+ *
+ * Gets the desktop file type of @desktop_file.
+ *
+ * Return value: @desktop_file's type
+ **/
+EggDesktopFileType
+egg_desktop_file_get_desktop_file_type (EggDesktopFile *desktop_file)<--- Parameter 'desktop_file' can be declared as pointer to const
+{
+  return desktop_file->type;
+}
+
+/**
+ * egg_desktop_file_get_name:
+ * @desktop_file: an #EggDesktopFile
+ *
+ * Gets the (localized) value of @desktop_file's "Name" key.
+ *
+ * Return value: the application/link name
+ **/
+const char *
+egg_desktop_file_get_name (EggDesktopFile *desktop_file)<--- Parameter 'desktop_file' can be declared as pointer to const
+{
+  return desktop_file->name;
+}
+
+/**
+ * egg_desktop_file_get_icon:
+ * @desktop_file: an #EggDesktopFile
+ *
+ * Gets the value of @desktop_file's "Icon" key.
+ *
+ * If the icon string is a full path (that is, if g_path_is_absolute()
+ * returns %TRUE when called on it), it points to a file containing an
+ * unthemed icon. If the icon string is not a full path, it is the
+ * name of a themed icon, which can be looked up with %GtkIconTheme,
+ * or passed directly to a theme-aware widget like %GtkImage or
+ * %GtkCellRendererPixbuf.
+ *
+ * Return value: the icon path or name
+ **/
+const char *
+egg_desktop_file_get_icon (EggDesktopFile *desktop_file)<--- Parameter 'desktop_file' can be declared as pointer to const
+{
+  return desktop_file->icon;
+}
+
+gboolean
+egg_desktop_file_has_key (EggDesktopFile  *desktop_file,
+			  const char      *key,
+			  GError         **error)
+{
+  return g_key_file_has_key (desktop_file->key_file,
+			     EGG_DESKTOP_FILE_GROUP, key,
+			     error);
+}
+
+char *
+egg_desktop_file_get_string (EggDesktopFile  *desktop_file,
+			     const char      *key,
+			     GError         **error)
+{
+  return g_key_file_get_string (desktop_file->key_file,
+				EGG_DESKTOP_FILE_GROUP, key,
+				error);
+}
+
+char *
+egg_desktop_file_get_locale_string (EggDesktopFile  *desktop_file,
+				    const char      *key,
+				    const char      *locale,
+				    GError         **error)
+{
+  return g_key_file_get_locale_string (desktop_file->key_file,
+				       EGG_DESKTOP_FILE_GROUP, key, locale,
+				       error);
+}
+
+gboolean
+egg_desktop_file_get_boolean (EggDesktopFile  *desktop_file,
+			      const char      *key,
+			      GError         **error)
+{
+  return g_key_file_get_boolean (desktop_file->key_file,
+				 EGG_DESKTOP_FILE_GROUP, key,
+				 error);
+}
+
+double
+egg_desktop_file_get_numeric (EggDesktopFile  *desktop_file,
+			      const char      *key,
+			      GError         **error)
+{
+  return g_key_file_get_double (desktop_file->key_file,
+				EGG_DESKTOP_FILE_GROUP, key,
+				error);
+}
+
+int
+egg_desktop_file_get_integer (EggDesktopFile *desktop_file,
+                              const char		*key,
+                              GError		   **error)
+{
+  return g_key_file_get_integer (desktop_file->key_file,
+                                 EGG_DESKTOP_FILE_GROUP, key,
+                                 error);
+}
+
+char **
+egg_desktop_file_get_string_list (EggDesktopFile  *desktop_file,
+				  const char      *key,
+				  gsize           *length,
+				  GError         **error)
+{
+  return g_key_file_get_string_list (desktop_file->key_file,
+				     EGG_DESKTOP_FILE_GROUP, key, length,
+				     error);
+}
+
+char **
+egg_desktop_file_get_locale_string_list (EggDesktopFile  *desktop_file,
+					 const char      *key,
+					 const char      *locale,
+					 gsize           *length,
+					 GError         **error)
+{
+  return g_key_file_get_locale_string_list (desktop_file->key_file,
+					    EGG_DESKTOP_FILE_GROUP, key,
+					    locale, length,
+					    error);
+}
+
+/**
+ * egg_desktop_file_can_launch:
+ * @desktop_file: an #EggDesktopFile
+ * @desktop_environment: the name of the running desktop environment,
+ * or %NULL
+ *
+ * Tests if @desktop_file can/should be launched in the current
+ * environment. If @desktop_environment is non-%NULL, @desktop_file's
+ * "OnlyShowIn" and "NotShowIn" keys are checked to make sure that
+ * this desktop_file is appropriate for the named environment.
+ *
+ * Furthermore, if @desktop_file has type
+ * %EGG_DESKTOP_FILE_TYPE_APPLICATION, its "TryExec" key (if any) is
+ * also checked, to make sure the binary it points to exists.
+ *
+ * egg_desktop_file_can_launch() does NOT check the value of the
+ * "Hidden" key.
+ *
+ * Return value: %TRUE if @desktop_file can be launched
+ **/
+gboolean
+egg_desktop_file_can_launch (EggDesktopFile *desktop_file,
+			     const char     *desktop_environment)
+{
+  char *try_exec, *found_program;
+  char **only_show_in, **not_show_in;
+  gboolean found;
+  int i;
+
+  if (desktop_file->type != EGG_DESKTOP_FILE_TYPE_APPLICATION &&
+      desktop_file->type != EGG_DESKTOP_FILE_TYPE_LINK)
+    return FALSE;
+
+  if (desktop_environment)
+    {
+      only_show_in = g_key_file_get_string_list (desktop_file->key_file,
+						 EGG_DESKTOP_FILE_GROUP,
+						 EGG_DESKTOP_FILE_KEY_ONLY_SHOW_IN,
+						 NULL, NULL);
+      if (only_show_in)
+	{
+	  for (i = 0, found = FALSE; only_show_in[i] && !found; i++)
+	    {
+	      if (!strcmp (only_show_in[i], desktop_environment))
+		found = TRUE;
+	    }
+
+	  g_strfreev (only_show_in);
+
+	  if (!found)
+	    return FALSE;
+	}
+
+      not_show_in = g_key_file_get_string_list (desktop_file->key_file,
+						EGG_DESKTOP_FILE_GROUP,
+						EGG_DESKTOP_FILE_KEY_NOT_SHOW_IN,
+						NULL, NULL);
+      if (not_show_in)
+	{
+	  for (i = 0, found = FALSE; not_show_in[i] && !found; i++)
+	    {
+	      if (!strcmp (not_show_in[i], desktop_environment))
+		found = TRUE;
+	    }
+
+	  g_strfreev (not_show_in);
+
+	  if (found)
+	    return FALSE;
+	}
+    }
+
+  if (desktop_file->type == EGG_DESKTOP_FILE_TYPE_APPLICATION)
+    {
+      try_exec = g_key_file_get_string (desktop_file->key_file,
+					EGG_DESKTOP_FILE_GROUP,
+					EGG_DESKTOP_FILE_KEY_TRY_EXEC,
+					NULL);
+      if (try_exec)
+	{
+	  found_program = g_find_program_in_path (try_exec);
+	  g_free (try_exec);
+
+	  if (!found_program)
+	    return FALSE;
+	  g_free (found_program);
+	}
+    }
+
+  return TRUE;
+}
+
+/**
+ * egg_desktop_file_accepts_documents:
+ * @desktop_file: an #EggDesktopFile
+ *
+ * Tests if @desktop_file represents an application that can accept
+ * documents on the command line.
+ *
+ * Return value: %TRUE or %FALSE
+ **/
+gboolean
+egg_desktop_file_accepts_documents (EggDesktopFile *desktop_file)<--- Parameter 'desktop_file' can be declared as pointer to const
+{
+  return desktop_file->document_code != 0;
+}
+
+/**
+ * egg_desktop_file_accepts_multiple:
+ * @desktop_file: an #EggDesktopFile
+ *
+ * Tests if @desktop_file can accept multiple documents at once.
+ *
+ * If this returns %FALSE, you can still pass multiple documents to
+ * egg_desktop_file_launch(), but that will result in multiple copies
+ * of the application being launched. See egg_desktop_file_launch()
+ * for more details.
+ *
+ * Return value: %TRUE or %FALSE
+ **/
+gboolean
+egg_desktop_file_accepts_multiple (EggDesktopFile *desktop_file)<--- Parameter 'desktop_file' can be declared as pointer to const
+{
+  return (desktop_file->document_code == 'F' ||
+	  desktop_file->document_code == 'U');
+}
+
+/**
+ * egg_desktop_file_accepts_uris:
+ * @desktop_file: an #EggDesktopFile
+ *
+ * Tests if @desktop_file can accept (non-"file:") URIs as documents to
+ * open.
+ *
+ * Return value: %TRUE or %FALSE
+ **/
+gboolean
+egg_desktop_file_accepts_uris (EggDesktopFile *desktop_file)<--- Parameter 'desktop_file' can be declared as pointer to const
+{
+  return (desktop_file->document_code == 'U' ||
+	  desktop_file->document_code == 'u');
+}
+
+static void
+append_quoted_word (GString    *str,
+		    const char *s,
+		    gboolean    in_single_quotes,
+		    gboolean    in_double_quotes)
+{
+  const char *p;
+
+  if (!in_single_quotes && !in_double_quotes)
+    g_string_append_c (str, '\'');
+  else if (!in_single_quotes && in_double_quotes)
+    g_string_append (str, "\"'");
+
+  if (!strchr (s, '\''))
+    g_string_append (str, s);
+  else
+    {
+      for (p = s; *p != '\0'; p++)
+	{
+	  if (*p == '\'')
+	    g_string_append (str, "'\\''");
+	  else
+	    g_string_append_c (str, *p);
+	}
+    }
+
+  if (!in_single_quotes && !in_double_quotes)
+    g_string_append_c (str, '\'');
+  else if (!in_single_quotes && in_double_quotes)
+    g_string_append (str, "'\"");
+}
+
+static void
+do_percent_subst (EggDesktopFile *desktop_file,<--- Parameter 'desktop_file' can be declared as pointer to const
+		  char            code,
+		  GString        *str,
+		  GSList        **documents,
+		  gboolean        in_single_quotes,
+		  gboolean        in_double_quotes)
+{
+  GSList *d;
+  char *doc;<--- Variable 'doc' can be declared as pointer to const
+
+  switch (code)
+    {
+    case '%':
+      g_string_append_c (str, '%');
+      break;
+
+    case 'F':
+    case 'U':
+      for (d = *documents; d; d = d->next)
+	{
+	  doc = d->data;
+	  g_string_append (str, " ");
+	  append_quoted_word (str, doc, in_single_quotes, in_double_quotes);
+	}
+      *documents = NULL;
+      break;
+
+    case 'f':
+    case 'u':
+      if (*documents)
+	{
+	  doc = (*documents)->data;
+	  g_string_append (str, " ");
+	  append_quoted_word (str, doc, in_single_quotes, in_double_quotes);
+	  *documents = (*documents)->next;
+	}
+      break;
+
+    case 'i':
+      if (desktop_file->icon)
+	{
+	  g_string_append (str, "--icon ");
+	  append_quoted_word (str, desktop_file->icon,
+			      in_single_quotes, in_double_quotes);
+	}
+      break;
+
+    case 'c':
+      if (desktop_file->name)
+	{
+	  append_quoted_word (str, desktop_file->name,
+			      in_single_quotes, in_double_quotes);
+	}
+      break;
+
+    case 'k':
+      if (desktop_file->source)
+	{
+	  append_quoted_word (str, desktop_file->source,
+			      in_single_quotes, in_double_quotes);
+	}
+      break;
+
+    case 'D':
+    case 'N':
+    case 'd':
+    case 'n':
+    case 'v':
+    case 'm':
+      /* Deprecated; skip */
+      break;
+
+    default:
+      g_warning ("Unrecognized %%-code '%%%c' in Exec", code);
+      break;
+    }
+}
+
+static char *
+parse_exec (EggDesktopFile  *desktop_file,
+	    GSList         **documents,
+	    GError         **error)
+{
+  char *exec, *p, *command;
+  gboolean escape, single_quot, double_quot;
+  GString *gs;
+
+  exec = g_key_file_get_string (desktop_file->key_file,
+				EGG_DESKTOP_FILE_GROUP,
+				EGG_DESKTOP_FILE_KEY_EXEC,
+				error);
+  if (!exec)
+    return NULL;
+
+  /* Build the command */
+  gs = g_string_new (NULL);
+  escape = single_quot = double_quot = FALSE;
+
+  for (p = exec; *p != '\0'; p++)
+    {
+      if (escape)
+	{
+	  escape = FALSE;
+	  g_string_append_c (gs, *p);
+	}
+      else if (*p == '\\')
+	{
+	  if (!single_quot)
+	    escape = TRUE;
+	  g_string_append_c (gs, *p);
+	}
+      else if (*p == '\'')
+	{
+	  g_string_append_c (gs, *p);
+	  if (!single_quot && !double_quot)
+	    single_quot = TRUE;
+	  else if (single_quot)
+	    single_quot = FALSE;
+	}
+      else if (*p == '"')
+	{
+	  g_string_append_c (gs, *p);
+	  if (!single_quot && !double_quot)
+	    double_quot = TRUE;
+	  else if (double_quot)
+	    double_quot = FALSE;
+	}
+      else if (*p == '%' && p[1])
+	{
+	  do_percent_subst (desktop_file, p[1], gs, documents,
+			    single_quot, double_quot);
+	  p++;
+	}
+      else
+	g_string_append_c (gs, *p);
+    }
+
+  g_free (exec);
+  command = g_string_free (gs, FALSE);
+
+  /* Prepend "xdg-terminal " if needed (FIXME: use gvfs) */
+  if (g_key_file_has_key (desktop_file->key_file,
+			  EGG_DESKTOP_FILE_GROUP,
+			  EGG_DESKTOP_FILE_KEY_TERMINAL,
+			  NULL))
+    {
+      GError *terminal_error = NULL;
+      gboolean use_terminal =
+	g_key_file_get_boolean (desktop_file->key_file,
+				EGG_DESKTOP_FILE_GROUP,
+				EGG_DESKTOP_FILE_KEY_TERMINAL,
+				&terminal_error);
+      if (terminal_error)
+	{
+	  g_free (command);
+	  g_propagate_error (error, terminal_error);
+	  return NULL;
+	}
+
+      if (use_terminal)
+	{
+	  gs = g_string_new ("xdg-terminal ");
+	  append_quoted_word (gs, command, FALSE, FALSE);
+	  g_free (command);
+	  command = g_string_free (gs, FALSE);
+	}
+    }
+
+  return command;
+}
+
+static GSList *
+translate_document_list (EggDesktopFile *desktop_file, GSList *documents)
+{
+  gboolean accepts_uris = egg_desktop_file_accepts_uris (desktop_file);
+  GSList *ret, *d;
+
+  for (d = documents, ret = NULL; d; d = d->next)
+    {
+      const char *document = d->data;
+      gboolean is_uri = !g_path_is_absolute (document);
+      char *translated;
+
+      if (accepts_uris)
+	{
+	  if (is_uri)
+	    translated = g_strdup (document);
+	  else
+	    translated = g_filename_to_uri (document, NULL, NULL);
+	}
+      else
+	{
+	  if (is_uri)
+	    translated = g_filename_from_uri (document, NULL, NULL);
+	  else
+	    translated = g_strdup (document);
+	}
+
+      if (translated)
+	ret = g_slist_prepend (ret, translated);
+    }
+
+  return g_slist_reverse (ret);
+}
+
+static void
+free_document_list (GSList *documents)
+{
+  GSList *d;
+
+  for (d = documents; d; d = d->next)
+    g_free (d->data);
+  g_slist_free (documents);
+}
+
+/**
+ * egg_desktop_file_parse_exec:
+ * @desktop_file: a #EggDesktopFile
+ * @documents: a list of document paths or URIs
+ * @error: error pointer
+ *
+ * Parses @desktop_file's Exec key, inserting @documents into it, and
+ * returns the result.
+ *
+ * If @documents contains non-file: URIs and @desktop_file does not
+ * accept URIs, those URIs will be ignored. Likewise, if @documents
+ * contains more elements than @desktop_file accepts, the extra
+ * documents will be ignored.
+ *
+ * Return value: the parsed Exec string
+ **/
+char *
+egg_desktop_file_parse_exec (EggDesktopFile  *desktop_file,
+			     GSList          *documents,
+			     GError         **error)
+{
+  GSList *translated, *docs;
+  char *command;
+
+  docs = translated = translate_document_list (desktop_file, documents);
+  command = parse_exec (desktop_file, &docs, error);
+  free_document_list (translated);
+
+  return command;
+}
+
+static gboolean
+parse_link (EggDesktopFile  *desktop_file,
+	    EggDesktopFile **app_desktop_file,
+	    GSList         **documents,
+	    GError         **error)
+{
+  char *url;
+  GKeyFile *key_file;
+
+  url = g_key_file_get_string (desktop_file->key_file,
+			       EGG_DESKTOP_FILE_GROUP,
+			       EGG_DESKTOP_FILE_KEY_URL,
+			       error);
+  if (!url)
+    return FALSE;
+  *documents = g_slist_prepend (NULL, url);
+
+  /* FIXME: use gvfs */
+  key_file = g_key_file_new ();
+  g_key_file_set_string (key_file, EGG_DESKTOP_FILE_GROUP,
+			 EGG_DESKTOP_FILE_KEY_NAME,
+			 "xdg-open");
+  g_key_file_set_string (key_file, EGG_DESKTOP_FILE_GROUP,
+			 EGG_DESKTOP_FILE_KEY_TYPE,
+			 "Application");
+  g_key_file_set_string (key_file, EGG_DESKTOP_FILE_GROUP,
+			 EGG_DESKTOP_FILE_KEY_EXEC,
+			 "xdg-open %u");
+  *app_desktop_file = egg_desktop_file_new_from_key_file (key_file, NULL, NULL);
+  return TRUE;
+}
+
+#ifdef GDK_WINDOWING_X11
+static char *
+start_startup_notification (GdkDisplay     *display,
+			    EggDesktopFile *desktop_file,
+			    const char     *argv0,
+			    int             screen,
+			    int             workspace,
+			    guint32         launch_time)
+{
+  static int sequence = 0;
+  char *startup_id;
+  char *description, *wmclass;
+  char *screen_str, *workspace_str;
+
+  g_assert(GDK_IS_X11_DISPLAY (display));
+
+  if (g_key_file_has_key (desktop_file->key_file,
+			  EGG_DESKTOP_FILE_GROUP,
+			  EGG_DESKTOP_FILE_KEY_STARTUP_NOTIFY,
+			  NULL))
+    {
+      if (!g_key_file_get_boolean (desktop_file->key_file,
+				   EGG_DESKTOP_FILE_GROUP,
+				   EGG_DESKTOP_FILE_KEY_STARTUP_NOTIFY,
+				   NULL))
+	return NULL;
+      wmclass = NULL;
+    }
+  else
+    {
+      wmclass = g_key_file_get_string (desktop_file->key_file,
+				       EGG_DESKTOP_FILE_GROUP,
+				       EGG_DESKTOP_FILE_KEY_STARTUP_WM_CLASS,
+				       NULL);
+      if (!wmclass)
+	return NULL;
+    }
+
+  if (launch_time == (guint32)-1)
+    launch_time = gdk_x11_display_get_user_time (display);
+  startup_id = g_strdup_printf ("%s-%lu-%s-%s-%d_TIME%lu",
+				g_get_prgname (),
+				(unsigned long)getpid (),
+				g_get_host_name (),
+				argv0,
+				sequence++,
+				(unsigned long)launch_time);
+
+  description = g_strdup_printf (_("Starting %s"), desktop_file->name);
+  screen_str = g_strdup_printf ("%d", screen);
+  workspace_str = workspace == -1 ? NULL : g_strdup_printf ("%d", workspace);
+
+  gdk_x11_display_broadcast_startup_message (display, "new",
+					     "ID", startup_id,
+					     "NAME", desktop_file->name,
+					     "SCREEN", screen_str,
+					     "BIN", argv0,
+					     "ICON", desktop_file->icon,
+					     "DESKTOP", workspace_str,
+					     "DESCRIPTION", description,
+					     "WMCLASS", wmclass,
+					     NULL);
+
+  g_free (description);
+  g_free (wmclass);
+  g_free (screen_str);
+  g_free (workspace_str);
+
+  return startup_id;
+}
+
+static void
+end_startup_notification (GdkDisplay *display,
+			  const char *startup_id)
+{
+  gdk_x11_display_broadcast_startup_message (display, "remove",
+					     "ID", startup_id,
+					     NULL);
+}
+
+#define EGG_DESKTOP_FILE_SN_TIMEOUT_LENGTH (30 /* seconds */)
+
+typedef struct {
+  GdkDisplay *display;
+  char *startup_id;
+} StartupNotificationData;
+
+static gboolean
+startup_notification_timeout (gpointer data)
+{
+  StartupNotificationData *sn_data = data;
+
+  end_startup_notification (sn_data->display, sn_data->startup_id);
+  g_object_unref (sn_data->display);
+  g_free (sn_data->startup_id);
+  g_free (sn_data);
+
+  return FALSE;
+}
+
+static void
+set_startup_notification_timeout (GdkDisplay *display,
+				  const char *startup_id)
+{
+  StartupNotificationData *sn_data;
+
+  sn_data = g_new (StartupNotificationData, 1);
+  sn_data->display = g_object_ref (display);
+  sn_data->startup_id = g_strdup (startup_id);
+
+  g_timeout_add_seconds (EGG_DESKTOP_FILE_SN_TIMEOUT_LENGTH,
+			 startup_notification_timeout, sn_data);
+}
+#endif // GDK_WINDOWING_X11
+
+static GPtrArray *
+array_putenv (GPtrArray *env, char *variable)
+{
+  guint i, keylen;
+
+  if (!env)
+    {
+      char **envp;
+
+      env = g_ptr_array_new ();
+
+      envp = g_listenv ();
+      for (i = 0; envp[i]; i++)
+        {
+          const char *value;
+
+          value = g_getenv (envp[i]);
+          g_ptr_array_add (env, g_strdup_printf ("%s=%s", envp[i],
+                                                 value ? value : ""));
+        }
+      g_strfreev (envp);
+    }
+
+  keylen = strcspn (variable, "=");
+
+  /* Remove old value of key */
+  for (i = 0; i < env->len; i++)
+    {
+      char *envvar = env->pdata[i];
+
+      if (!strncmp (envvar, variable, keylen) && envvar[keylen] == '=')
+	{
+	  g_free (envvar);
+	  g_ptr_array_remove_index_fast (env, i);
+	  break;
+	}
+    }
+
+  /* Add new value */
+  g_ptr_array_add (env, g_strdup (variable));
+
+  return env;
+}
+
+static gboolean
+egg_desktop_file_launchv (EggDesktopFile *desktop_file,
+			  GSList *documents, va_list args,
+			  GError **error)
+{
+  EggDesktopFileLaunchOption option;
+  GSList *translated_documents = NULL, *docs = NULL;
+  char *command, **argv;
+  int argc, i;
+  gboolean success, current_success;
+  GdkDisplay *display;
+  char *startup_id;
+
+  GPtrArray   *env = NULL;
+  char       **variables = NULL;
+  GdkScreen   *screen = NULL;
+  int          workspace = -1;
+  const char  *directory = NULL;
+  guint32      launch_time = (guint32)-1;
+  GSpawnFlags  flags = G_SPAWN_SEARCH_PATH;
+  GSpawnChildSetupFunc setup_func = NULL;
+  gpointer     setup_data = NULL;
+
+  GPid        *ret_pid = NULL;
+  int         *ret_stdin = NULL, *ret_stdout = NULL, *ret_stderr = NULL;
+  char       **ret_startup_id = NULL;
+
+  if (documents && desktop_file->document_code == 0)
+    {
+      g_set_error (error, EGG_DESKTOP_FILE_ERROR,
+		   EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE,
+		   _("Application does not accept documents on command line"));
+      return FALSE;
+    }
+
+  /* Read the options: technically it's incorrect for the caller to
+   * NULL-terminate the list of options (rather than 0-terminating
+   * it), but NULL-terminating lets us use G_GNUC_NULL_TERMINATED,
+   * it's more consistent with other glib/gtk methods, and it will
+   * work as long as sizeof (int) <= sizeof (NULL), and NULL is
+   * represented as 0. (Which is true everywhere we care about.)
+   */
+  while ((option = va_arg (args, EggDesktopFileLaunchOption)))
+    {
+      switch (option)
+	{
+	case EGG_DESKTOP_FILE_LAUNCH_CLEARENV:
+	  if (env)
+	    g_ptr_array_free (env, TRUE);
+	  env = g_ptr_array_new ();
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_PUTENV:
+	  variables = va_arg (args, char **);
+	  for (i = 0; variables[i]; i++)
+	    env = array_putenv (env, variables[i]);
+	  break;
+
+	case EGG_DESKTOP_FILE_LAUNCH_SCREEN:
+	  screen = va_arg (args, GdkScreen *);
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_WORKSPACE:
+	  workspace = va_arg (args, int);
+	  break;
+
+	case EGG_DESKTOP_FILE_LAUNCH_DIRECTORY:
+	  directory = va_arg (args, const char *);
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_TIME:
+	  launch_time = va_arg (args, guint32);
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_FLAGS:
+	  flags |= va_arg (args, GSpawnFlags);
+	  /* Make sure they didn't set any flags that don't make sense. */
+	  flags &= ~G_SPAWN_FILE_AND_ARGV_ZERO;
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_SETUP_FUNC:
+	  setup_func = va_arg (args, GSpawnChildSetupFunc);
+	  setup_data = va_arg (args, gpointer);
+	  break;
+
+	case EGG_DESKTOP_FILE_LAUNCH_RETURN_PID:
+	  ret_pid = va_arg (args, GPid *);
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_RETURN_STDIN_PIPE:
+	  ret_stdin = va_arg (args, int *);
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_RETURN_STDOUT_PIPE:
+	  ret_stdout = va_arg (args, int *);
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_RETURN_STDERR_PIPE:
+	  ret_stderr = va_arg (args, int *);
+	  break;
+	case EGG_DESKTOP_FILE_LAUNCH_RETURN_STARTUP_ID:
+	  ret_startup_id = va_arg (args, char **);
+	  break;
+
+	default:
+	  g_set_error (error, EGG_DESKTOP_FILE_ERROR,
+		       EGG_DESKTOP_FILE_ERROR_UNRECOGNIZED_OPTION,
+		       _("Unrecognized launch option: %d"),
+		       GPOINTER_TO_INT (option));
+	  success = FALSE;
+	  goto out;
+	}
+    }
+
+  if (screen)
+    {
+      display = gdk_screen_get_display (screen);
+      char *display_name = g_strdup (gdk_display_get_name (display));
+      char *display_env = g_strdup_printf ("DISPLAY=%s", display_name);
+      env = array_putenv (env, display_env);
+      g_free (display_name);
+      g_free (display_env);
+    }
+  else
+    {
+      display = gdk_display_get_default ();
+      screen = gdk_display_get_default_screen (display);
+    }
+
+  translated_documents = translate_document_list (desktop_file, documents);
+  docs = translated_documents;
+
+  success = FALSE;
+
+  do
+    {
+      command = parse_exec (desktop_file, &docs, error);
+      if (!command)
+	goto out;
+
+      if (!g_shell_parse_argv (command, &argc, &argv, error))
+	{
+	  g_free (command);
+	  goto out;
+	}
+      g_free (command);
+
+      startup_id = NULL;
+
+#ifdef GDK_WINDOWING_X11
+      if (GDK_IS_X11_DISPLAY (display))
+        {
+	  int screen_num;
+
+	  screen_num = gdk_x11_screen_get_screen_number (screen);
+      startup_id = start_startup_notification (display, desktop_file,
+					       argv[0], screen_num,
+					       workspace, launch_time);
+      if (startup_id)
+	{
+	  char *startup_id_env = g_strdup_printf ("DESKTOP_STARTUP_ID=%s",
+						  startup_id);
+	  env = array_putenv (env, startup_id_env);
+	  g_free (startup_id_env);
+	}
+        }
+#else
+      // Suppress unused variable warnings when not compiling with X
+      (void)workspace;
+      (void)launch_time;
+#endif
+
+      if (env != NULL)
+	g_ptr_array_add (env, NULL);
+
+      current_success =
+	g_spawn_async_with_pipes (directory,
+				  argv,
+				  env ? (char **)(env->pdata) : NULL,
+				  flags,
+				  setup_func, setup_data,
+				  ret_pid,
+				  ret_stdin, ret_stdout, ret_stderr,
+				  error);
+      g_strfreev (argv);
+
+      if (startup_id)
+	{
+	  if (current_success)
+	    {
+#ifdef GDK_WINDOWING_X11
+	      if (GDK_IS_X11_DISPLAY (display))
+		{
+	      set_startup_notification_timeout (display, startup_id);
+		}
+#endif
+
+	      if (ret_startup_id)
+		*ret_startup_id = startup_id;
+	      else
+		g_free (startup_id);
+	    }
+	  else
+	    g_free (startup_id);
+	}
+      else if (ret_startup_id)
+	*ret_startup_id = NULL;
+
+      if (current_success)
+	{
+	  /* If we successfully launch any instances of the app, make
+	   * sure we return TRUE and don't set @error.
+	   */
+	  success = TRUE;
+	  error = NULL;
+
+	  /* Also, only set the output params on the first one */
+	  ret_pid = NULL;
+	  ret_stdin = ret_stdout = ret_stderr = NULL;
+	  ret_startup_id = NULL;
+	}
+    }
+  while (docs && current_success);
+
+ out:
+  if (env)
+    {
+      g_ptr_array_foreach (env, (GFunc)g_free, NULL);
+      g_ptr_array_free (env, TRUE);
+    }
+  free_document_list (translated_documents);
+
+  return success;
+}
+
+/**
+ * egg_desktop_file_launch:
+ * @desktop_file: an #EggDesktopFile
+ * @documents: a list of URIs or paths to documents to open
+ * @error: error pointer
+ * @...: additional options
+ *
+ * Launches @desktop_file with the given arguments. Additional options
+ * can be specified as follows:
+ *
+ *   %EGG_DESKTOP_FILE_LAUNCH_CLEARENV: (no arguments)
+ *       clears the environment in the child process
+ *   %EGG_DESKTOP_FILE_LAUNCH_PUTENV: (char **variables)
+ *       adds the NAME=VALUE strings in the given %NULL-terminated
+ *       array to the child process's environment
+ *   %EGG_DESKTOP_FILE_LAUNCH_SCREEN: (GdkScreen *screen)
+ *       causes the application to be launched on the given screen
+ *   %EGG_DESKTOP_FILE_LAUNCH_WORKSPACE: (int workspace)
+ *       causes the application to be launched on the given workspace
+ *   %EGG_DESKTOP_FILE_LAUNCH_DIRECTORY: (char *dir)
+ *       causes the application to be launched in the given directory
+ *   %EGG_DESKTOP_FILE_LAUNCH_TIME: (guint32 launch_time)
+ *       sets the "launch time" for the application. If the user
+ *       interacts with another window after @launch_time but before
+ *       the launched application creates its first window, the window
+ *       manager may choose to not give focus to the new application.
+ *       Passing 0 for @launch_time will explicitly request that the
+ *       application not receive focus.
+ *   %EGG_DESKTOP_FILE_LAUNCH_FLAGS (GSpawnFlags flags)
+ *       Sets additional #GSpawnFlags to use. See g_spawn_async() for
+ *       more details.
+ *   %EGG_DESKTOP_FILE_LAUNCH_SETUP_FUNC (GSpawnChildSetupFunc, gpointer)
+ *       Sets the child setup callback and the data to pass to it.
+ *       (See g_spawn_async() for more details.)
+ *
+ *   %EGG_DESKTOP_FILE_LAUNCH_RETURN_PID (GPid **pid)
+ *       On a successful launch, sets *@pid to the PID of the launched
+ *       application.
+ *   %EGG_DESKTOP_FILE_LAUNCH_RETURN_STARTUP_ID (char **startup_id)
+ *       On a successful launch, sets *@startup_id to the Startup
+ *       Notification "startup id" of the launched application.
+ *   %EGG_DESKTOP_FILE_LAUNCH_RETURN_STDIN_PIPE (int *fd)
+ *       On a successful launch, sets *@fd to the file descriptor of
+ *       a pipe connected to the application's stdin.
+ *   %EGG_DESKTOP_FILE_LAUNCH_RETURN_STDOUT_PIPE (int *fd)
+ *       On a successful launch, sets *@fd to the file descriptor of
+ *       a pipe connected to the application's stdout.
+ *   %EGG_DESKTOP_FILE_LAUNCH_RETURN_STDERR_PIPE (int *fd)
+ *       On a successful launch, sets *@fd to the file descriptor of
+ *       a pipe connected to the application's stderr.
+ *
+ * The options should be terminated with a single %NULL.
+ *
+ * If @documents contains multiple documents, but
+ * egg_desktop_file_accepts_multiple() returns %FALSE for
+ * @desktop_file, then egg_desktop_file_launch() will actually launch
+ * multiple instances of the application. In that case, the return
+ * value (as well as any values passed via
+ * %EGG_DESKTOP_FILE_LAUNCH_RETURN_PID, etc) will only reflect the
+ * first instance of the application that was launched (but the
+ * %EGG_DESKTOP_FILE_LAUNCH_SETUP_FUNC will be called for each
+ * instance).
+ *
+ * Return value: %TRUE if the application was successfully launched.
+ **/
+gboolean
+egg_desktop_file_launch (EggDesktopFile *desktop_file,
+			 GSList *documents, GError **error,
+			 ...)
+{
+  va_list args;
+  gboolean success;
+  EggDesktopFile *app_desktop_file;
+
+  switch (desktop_file->type)
+    {
+    case EGG_DESKTOP_FILE_TYPE_APPLICATION:
+      va_start (args, error);
+      success = egg_desktop_file_launchv (desktop_file, documents,
+					  args, error);
+      va_end (args);
+      break;
+
+    case EGG_DESKTOP_FILE_TYPE_LINK:
+      if (documents)
+	{
+	  g_set_error (error, EGG_DESKTOP_FILE_ERROR,
+		       EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE,
+		       _("Can't pass document URIs to a 'Type=Link' desktop entry"));
+	  return FALSE;
+	}
+
+      if (!parse_link (desktop_file, &app_desktop_file, &documents, error))
+	return FALSE;
+
+      va_start (args, error);
+      success = egg_desktop_file_launchv (app_desktop_file, documents,
+					  args, error);
+      va_end (args);
+
+      egg_desktop_file_free (app_desktop_file);
+      free_document_list (documents);
+      break;
+
+    case EGG_DESKTOP_FILE_TYPE_UNRECOGNIZED:
+    case EGG_DESKTOP_FILE_TYPE_DIRECTORY:
+    default:
+      g_set_error (error, EGG_DESKTOP_FILE_ERROR,
+		   EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE,
+		   _("Not a launchable item"));
+      success = FALSE;
+      break;
+    }
+
+  return success;
+}
+
+
+GQuark
+egg_desktop_file_error_quark (void)
+{
+  return g_quark_from_static_string ("egg-desktop_file-error-quark");
+}
+
+
+G_LOCK_DEFINE_STATIC (egg_desktop_file);
+static EggDesktopFile *egg_desktop_file;
+
+static void
+egg_set_desktop_file_internal (const char *desktop_file_path,
+                               gboolean set_defaults)
+{
+  GError *error = NULL;
+
+  G_LOCK (egg_desktop_file);
+  if (egg_desktop_file)
+    egg_desktop_file_free (egg_desktop_file);
+
+  egg_desktop_file = egg_desktop_file_new (desktop_file_path, &error);
+  if (error)
+    {
+      g_warning ("Could not load desktop file '%s': %s",
+		 desktop_file_path, error->message);
+      g_error_free (error);
+    }
+
+  if (set_defaults && egg_desktop_file != NULL) {
+    /* Set localized application name and default window icon */
+    if (egg_desktop_file->name)
+      g_set_application_name (egg_desktop_file->name);
+    if (egg_desktop_file->icon)
+      {
+        if (g_path_is_absolute (egg_desktop_file->icon))
+          gtk_window_set_default_icon_from_file (egg_desktop_file->icon, NULL);
+        else
+          gtk_window_set_default_icon_name (egg_desktop_file->icon);
+      }
+  }
+
+  G_UNLOCK (egg_desktop_file);
+}
+
+/**
+ * egg_set_desktop_file:
+ * @desktop_file_path: path to the application's desktop file
+ *
+ * Creates an #EggDesktopFile for the application from the data at
+ * @desktop_file_path. This will also call g_set_application_name()
+ * with the localized application name from the desktop file, and
+ * gtk_window_set_default_icon_name() or
+ * gtk_window_set_default_icon_from_file() with the application's
+ * icon. Other code may use additional information from the desktop
+ * file.
+ * See egg_set_desktop_file_without_defaults() for a variant of this
+ * function that does not set the application name and default window
+ * icon.
+ *
+ * Note that for thread safety reasons, this function can only
+ * be called once, and is mutually exclusive with calling
+ * egg_set_desktop_file_without_defaults().
+ **/
+void
+egg_set_desktop_file (const char *desktop_file_path)
+{
+  egg_set_desktop_file_internal (desktop_file_path, TRUE);
+}
+
+/**
+ * egg_set_desktop_file_without_defaults:
+ * @desktop_file_path: path to the application's desktop file
+ *
+ * Creates an #EggDesktopFile for the application from the data at
+ * @desktop_file_path.
+ * See egg_set_desktop_file() for a variant of this function that
+ * sets the application name and default window icon from the information
+ * in the desktop file.
+ *
+ * Note that for thread safety reasons, this function can only
+ * be called once, and is mutually exclusive with calling
+ * egg_set_desktop_file().
+ **/
+void
+egg_set_desktop_file_without_defaults (const char *desktop_file_path)
+{
+  egg_set_desktop_file_internal (desktop_file_path, FALSE);
+}
+
+/**
+ * egg_get_desktop_file:
+ *
+ * Gets the application's #EggDesktopFile, as set by
+ * egg_set_desktop_file().
+ *
+ * Return value: the #EggDesktopFile, or %NULL if it hasn't been set.
+ **/
+EggDesktopFile *
+egg_get_desktop_file (void)
+{
+  EggDesktopFile *retval;
+
+  G_LOCK (egg_desktop_file);
+  retval = egg_desktop_file;
+  G_UNLOCK (egg_desktop_file);
+
+  return retval;
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/40.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/40.html new file mode 100644 index 0000000..50c8190 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/40.html @@ -0,0 +1,331 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
/*
+ * Copyright (C) 2002,2003 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This 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 3 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 Library General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-debug.h"
+
+TerminalDebugFlags _terminal_debug_flags;
+
+void
+_terminal_debug_init(void)
+{
+#ifdef MATE_ENABLE_DEBUG
+	const GDebugKey keys[] =
+	{
+		{ "accels",    TERMINAL_DEBUG_ACCELS    },
+		{ "encodings", TERMINAL_DEBUG_ENCODINGS },
+		{ "factory",   TERMINAL_DEBUG_FACTORY   },
+		{ "geometry",  TERMINAL_DEBUG_GEOMETRY  },
+		{ "mdi",       TERMINAL_DEBUG_MDI       },
+		{ "processes", TERMINAL_DEBUG_PROCESSES },
+		{ "profile",   TERMINAL_DEBUG_PROFILE   }
+	};
+
+	_terminal_debug_flags = g_parse_debug_string (g_getenv ("MATE_TERMINAL_DEBUG"),
+	                        keys, G_N_ELEMENTS (keys));
+#endif /* MATE_ENABLE_DEBUG */
+}
+
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/41.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/41.html new file mode 100644 index 0000000..0f240d5 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/41.html @@ -0,0 +1,1515 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * Copyright © 2002 Red Hat, Inc.
+ * Copyright © 2008 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * Mate-terminal 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-app.h"
+#include "terminal-debug.h"
+#include "terminal-encoding.h"
+#include "terminal-intl.h"
+#include "terminal-profile.h"
+#include "terminal-util.h"
+
+/* Overview
+ *
+ * There's a list of character sets stored in GSettings, indicating
+ * which encodings to display in the encoding menu.
+ *
+ * We have a pre-canned list of available encodings
+ * (hardcoded in the table below) that can be added to
+ * the encoding menu, and to give a human-readable name
+ * to certain encodings.
+ *
+ * If the GSettings list contains an encoding not in the
+ * predetermined table, then that encoding is
+ * labeled "user defined" but still appears in the menu.
+ */
+
+static const struct
+{
+	const char *charset;
+	const char *name;
+} encodings[] =
+{
+	{ "ISO-8859-1",	N_("Western") },
+	{ "ISO-8859-2",	N_("Central European") },
+	{ "ISO-8859-3",	N_("South European") },
+	{ "ISO-8859-4",	N_("Baltic") },
+	{ "ISO-8859-5",	N_("Cyrillic") },
+	{ "ISO-8859-6",	N_("Arabic") },
+	{ "ISO-8859-7",	N_("Greek") },
+	{ "ISO-8859-8",	N_("Hebrew Visual") },
+	{ "ISO-8859-8-I",	N_("Hebrew") },
+	{ "ISO-8859-9",	N_("Turkish") },
+	{ "ISO-8859-10",	N_("Nordic") },
+	{ "ISO-8859-13",	N_("Baltic") },
+	{ "ISO-8859-14",	N_("Celtic") },
+	{ "ISO-8859-15",	N_("Western") },
+	{ "ISO-8859-16",	N_("Romanian") },
+	{ "UTF-8",	N_("Unicode") },
+	{ "ARMSCII-8",	N_("Armenian") },
+	{ "BIG5",	N_("Chinese Traditional") },
+	{ "BIG5-HKSCS",	N_("Chinese Traditional") },
+	{ "CP866",	N_("Cyrillic/Russian") },
+	{ "EUC-JP",	N_("Japanese") },
+	{ "EUC-KR",	N_("Korean") },
+	{ "EUC-TW",	N_("Chinese Traditional") },
+	{ "GB18030",	N_("Chinese Simplified") },
+	{ "GB2312",	N_("Chinese Simplified") },
+	{ "GBK",	N_("Chinese Simplified") },
+	{ "GEORGIAN-PS",	N_("Georgian") },
+	{ "IBM850",	N_("Western") },
+	{ "IBM852",	N_("Central European") },
+	{ "IBM855",	N_("Cyrillic") },
+	{ "IBM857",	N_("Turkish") },
+	{ "IBM862",	N_("Hebrew") },
+	{ "IBM864",	N_("Arabic") },
+	{ "ISO-2022-JP",	N_("Japanese") },
+	{ "ISO-2022-KR",	N_("Korean") },
+	{ "ISO-IR-111",	N_("Cyrillic") },
+	{ "KOI8-R",	N_("Cyrillic") },
+	{ "KOI8-U",	N_("Cyrillic/Ukrainian") },
+	{ "MAC_ARABIC",	N_("Arabic") },
+	{ "MAC_CE",	N_("Central European") },
+	{ "MAC_CROATIAN",	N_("Croatian") },
+	{ "MAC-CYRILLIC",	N_("Cyrillic") },
+	{ "MAC_DEVANAGARI",	N_("Hindi") },
+	{ "MAC_FARSI",	N_("Persian") },
+	{ "MAC_GREEK",	N_("Greek") },
+	{ "MAC_GUJARATI",	N_("Gujarati") },
+	{ "MAC_GURMUKHI",	N_("Gurmukhi") },
+	{ "MAC_HEBREW",	N_("Hebrew") },
+	{ "MAC_ICELANDIC",	N_("Icelandic") },
+	{ "MAC_ROMAN",	N_("Western") },
+	{ "MAC_ROMANIAN",	N_("Romanian") },
+	{ "MAC_TURKISH",	N_("Turkish") },
+	{ "MAC_UKRAINIAN",	N_("Cyrillic/Ukrainian") },
+	{ "SHIFT_JIS",	N_("Japanese") },
+	{ "TCVN",	N_("Vietnamese") },
+	{ "TIS-620",	N_("Thai") },
+	{ "UHC",	N_("Korean") },
+	{ "VISCII",	N_("Vietnamese") },
+	{ "WINDOWS-1250",	N_("Central European") },
+	{ "WINDOWS-1251",	N_("Cyrillic") },
+	{ "WINDOWS-1252",	N_("Western") },
+	{ "WINDOWS-1253",	N_("Greek") },
+	{ "WINDOWS-1254",	N_("Turkish") },
+	{ "WINDOWS-1255",	N_("Hebrew") },
+	{ "WINDOWS-1256",	N_("Arabic") },
+	{ "WINDOWS-1257",	N_("Baltic") },
+	{ "WINDOWS-1258",	N_("Vietnamese") },
+#if 0
+	/* These encodings do NOT pass-through ASCII, so are always rejected.
+	 * FIXME: why are they in this table; or rather why do we need
+	 * the ASCII pass-through requirement?
+	 */
+	{ "UTF-7",  N_("Unicode") },
+	{ "UTF-16", N_("Unicode") },
+	{ "UCS-2",  N_("Unicode") },
+	{ "UCS-4",  N_("Unicode") },
+	{ "JOHAB",  N_("Korean") },
+#endif
+};
+
+typedef struct
+{
+	GtkWidget *dialog;
+	GtkListStore *base_store;
+	GtkTreeView *available_tree_view;
+	GtkTreeSelection *available_selection;
+	GtkTreeModel *available_model;<--- struct member 'EncodingDialogData::available_model' is never used.
+	GtkTreeView *active_tree_view;
+	GtkTreeSelection *active_selection;
+	GtkTreeModel *active_model;<--- struct member 'EncodingDialogData::active_model' is never used.
+	GtkWidget *add_button;
+	GtkWidget *remove_button;
+} EncodingDialogData;
+
+static GtkWidget *encoding_dialog = NULL;
+
+TerminalEncoding *
+terminal_encoding_new (const char *charset,
+                       const char *display_name,
+                       gboolean is_custom,
+                       gboolean force_valid)
+{
+	TerminalEncoding *encoding;
+
+	encoding = g_slice_new (TerminalEncoding);
+	encoding->refcount = 1;
+	encoding->id = g_strdup (charset);
+	encoding->name = g_strdup (display_name);
+	encoding->valid = encoding->validity_checked = (force_valid != FALSE);
+	encoding->is_custom = (is_custom != FALSE);
+	encoding->is_active = FALSE;
+
+	return encoding;
+}
+
+TerminalEncoding*
+terminal_encoding_ref (TerminalEncoding *encoding)
+{
+	g_return_val_if_fail (encoding != NULL, NULL);
+
+	encoding->refcount++;
+	return encoding;
+}
+
+void
+terminal_encoding_unref (TerminalEncoding *encoding)
+{
+	if (--encoding->refcount > 0)
+		return;
+
+	g_free (encoding->name);
+	g_free (encoding->id);
+	g_slice_free (TerminalEncoding, encoding);
+}
+
+const char *
+terminal_encoding_get_id (TerminalEncoding *encoding)<--- Parameter 'encoding' can be declared as pointer to const
+{
+	g_return_val_if_fail (encoding != NULL, NULL);
+
+	return encoding->id;
+}
+
+const char *
+terminal_encoding_get_charset (TerminalEncoding *encoding)<--- Parameter 'encoding' can be declared as pointer to const
+{
+	g_return_val_if_fail (encoding != NULL, NULL);
+
+	if (strcmp (encoding->id, "current") == 0)
+	{
+		const char *charset;
+
+		g_get_charset (&charset);
+		return charset;
+	}
+
+	return encoding->id;
+}
+
+gboolean
+terminal_encoding_is_valid (TerminalEncoding *encoding)
+{
+	/* All of the printing ASCII characters from space (32) to the tilde (126) */
+	static const char ascii_sample[] =
+	    " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
+	char *converted;
+	gsize bytes_read = 0, bytes_written = 0;
+	GError *error = NULL;
+
+	if (encoding->validity_checked)
+		return encoding->valid;
+
+	/* Test that the encoding is a proper superset of ASCII (which naive
+	 * apps are going to use anyway) by attempting to validate the text
+	 * using the current encoding.  This also flushes out any encodings
+	 * which the underlying GIConv implementation can't support.
+	 */
+	converted = g_convert (ascii_sample, sizeof (ascii_sample) - 1,
+	                       terminal_encoding_get_charset (encoding), "UTF-8",
+	                       &bytes_read, &bytes_written, &error);
+
+	/* The encoding is only valid if ASCII passes through cleanly. */
+	encoding->valid = (bytes_read == (sizeof (ascii_sample) - 1)) &&
+	                  (converted != NULL) &&
+	                  (strcmp (converted, ascii_sample) == 0);
+
+#ifdef MATE_ENABLE_DEBUG
+	_TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ENCODINGS)
+	{
+		if (!encoding->valid)
+		{
+			_terminal_debug_print (TERMINAL_DEBUG_ENCODINGS,
+			                       "Rejecting encoding %s as invalid:\n",
+			                       terminal_encoding_get_charset (encoding));
+			_terminal_debug_print (TERMINAL_DEBUG_ENCODINGS,
+			                       " input  \"%s\"\n",
+			                       ascii_sample);
+			_terminal_debug_print (TERMINAL_DEBUG_ENCODINGS,
+			                       " output \"%s\" bytes read %" G_GSIZE_FORMAT " written %" G_GSIZE_FORMAT "\n",<--- There is an unknown macro here somewhere. Configuration is required. If G_GSIZE_FORMAT is a macro then please configure it.
+			                       converted ? converted : "(null)", bytes_read, bytes_written);
+			if (error)
+				_terminal_debug_print (TERMINAL_DEBUG_ENCODINGS,
+				                       " Error: %s\n",
+				                       error->message);
+		}
+		else
+			_terminal_debug_print (TERMINAL_DEBUG_ENCODINGS,
+			                       "Encoding %s is valid\n\n",
+			                       terminal_encoding_get_charset (encoding));
+	}
+#endif
+
+	g_clear_error (&error);
+	g_free (converted);
+
+	encoding->validity_checked = TRUE;
+	return encoding->valid;
+}
+
+GType
+terminal_encoding_get_type (void)
+{
+	static GType type = 0;
+
+	if (G_UNLIKELY (type == 0))
+	{
+		type = g_boxed_type_register_static (I_("TerminalEncoding"),
+		                                     (GBoxedCopyFunc) terminal_encoding_ref,
+		                                     (GBoxedFreeFunc) terminal_encoding_unref);
+	}
+
+	return type;
+}
+
+static void
+update_active_encodings_gsettings (void)
+{
+	GSList *list, *l;
+	GArray *strings;
+	const gchar *id_string;
+
+	list = terminal_app_get_active_encodings (terminal_app_get ());
+	strings = g_array_new (TRUE, TRUE, sizeof (gchar *));
+	for (l = list; l != NULL; l = l->next)
+	{
+		TerminalEncoding *encoding = (TerminalEncoding *) l->data;
+		id_string = terminal_encoding_get_id (encoding);
+
+		strings = g_array_append_val (strings, id_string);
+	}
+
+	g_settings_set_strv (settings_global, "active-encodings", (const gchar **) strings->data);
+
+	g_array_free (strings, TRUE);
+	g_slist_foreach (list, (GFunc) terminal_encoding_unref, NULL);
+	g_slist_free (list);
+}
+
+static void
+response_callback (GtkWidget *window,
+                   int        id,
+                   EncodingDialogData *data)
+{
+	if (id == GTK_RESPONSE_HELP)
+		terminal_util_show_help ("mate-terminal-encoding-add", GTK_WINDOW (window));
+	else
+		gtk_widget_destroy (GTK_WIDGET (window));
+}
+
+enum
+{
+    COLUMN_NAME,
+    COLUMN_CHARSET,
+    COLUMN_DATA,
+    N_COLUMNS
+};
+
+static void
+selection_changed_cb (GtkTreeSelection *selection,
+                      EncodingDialogData *data)
+{
+	GtkWidget *button;
+	gboolean have_selection;
+
+	if (selection == data->available_selection)
+		button = data->add_button;
+	else if (selection == data->active_selection)
+		button = data->remove_button;
+	else
+		g_assert_not_reached ();
+
+	have_selection = gtk_tree_selection_get_selected (selection, NULL, NULL);
+	gtk_widget_set_sensitive (button, have_selection);
+}
+
+static void
+button_clicked_cb (GtkWidget *button,<--- Parameter 'button' can be declared as pointer to const
+                   EncodingDialogData *data)
+{
+	GtkTreeSelection *selection;
+	GtkTreeModel *model;
+	GtkTreeIter filter_iter, iter;
+	TerminalEncoding *encoding;
+
+	if (button == data->add_button)
+		selection = data->available_selection;
+	else if (button == data->remove_button)
+		selection = data->active_selection;
+	else
+		g_assert_not_reached ();
+
+	if (!gtk_tree_selection_get_selected (selection, &model, &filter_iter))
+		return;
+
+	gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (model),
+	        &iter,
+	        &filter_iter);
+
+	model = GTK_TREE_MODEL (data->base_store);
+	gtk_tree_model_get (model, &iter, COLUMN_DATA, &encoding, -1);
+	g_assert (encoding != NULL);
+
+	if (button == data->add_button)
+		encoding->is_active = TRUE;
+	else if (button == data->remove_button)
+		encoding->is_active = FALSE;
+	else
+		g_assert_not_reached ();
+
+	terminal_encoding_unref (encoding);
+
+	/* We don't need to emit row-changed here, since updating the GSettings pref
+	 * will update the models.
+	 */
+	update_active_encodings_gsettings ();
+}
+
+static void
+liststore_insert_encoding (gpointer key,
+                           TerminalEncoding *encoding,
+                           GtkListStore *store)
+{
+	GtkTreeIter iter;
+
+	if (!terminal_encoding_is_valid (encoding))
+		return;
+
+	gtk_list_store_insert_with_values (store, &iter, -1,
+	                                   COLUMN_CHARSET, terminal_encoding_get_charset (encoding),
+	                                   COLUMN_NAME, encoding->name,
+	                                   COLUMN_DATA, encoding,
+	                                   -1);
+}
+
+static gboolean
+filter_active_encodings (GtkTreeModel *child_model,
+                         GtkTreeIter *child_iter,
+                         gpointer data)
+{
+	TerminalEncoding *encoding;
+	gboolean active = GPOINTER_TO_UINT (data);
+	gboolean visible;
+
+	gtk_tree_model_get (child_model, child_iter, COLUMN_DATA, &encoding, -1);
+	visible = active ? encoding->is_active : !encoding->is_active;
+	terminal_encoding_unref (encoding);
+
+	return visible;
+}
+
+static GtkTreeModel *
+encodings_create_treemodel (GtkListStore *base_store,
+                            gboolean active)
+{
+	GtkTreeModel *model;
+
+	model = gtk_tree_model_filter_new (GTK_TREE_MODEL (base_store), NULL);
+	gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (model),
+	                                        filter_active_encodings,
+	                                        GUINT_TO_POINTER (active), NULL);
+
+	return model;
+}
+
+static void
+encodings_list_changed_cb (TerminalApp *app,
+                           EncodingDialogData *data)
+{
+	gtk_list_store_clear (data->base_store);
+
+	g_hash_table_foreach (terminal_app_get_encodings (app), (GHFunc) liststore_insert_encoding, data->base_store);
+}
+
+static void
+encoding_dialog_data_free (EncodingDialogData *data)
+{
+	g_signal_handlers_disconnect_by_func (terminal_app_get (),
+	                                      G_CALLBACK (encodings_list_changed_cb),
+	                                      data);
+
+	g_free (data);
+}
+
+void
+terminal_encoding_dialog_show (GtkWindow *transient_parent)
+{
+	TerminalApp *app;
+	GtkCellRenderer *cell_renderer;
+	GtkTreeViewColumn *column;
+	GtkTreeModel *model;
+	EncodingDialogData *data;
+
+	if (encoding_dialog)
+	{
+		gtk_window_set_transient_for (GTK_WINDOW (encoding_dialog), transient_parent);
+		gtk_window_present (GTK_WINDOW (encoding_dialog));
+		return;
+	}
+
+	data = g_new (EncodingDialogData, 1);
+
+	if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/encodings-dialog.ui",
+	                                      "encodings-dialog", &data->dialog,
+	                                      "add-button", &data->add_button,
+	                                      "remove-button", &data->remove_button,
+	                                      "available-treeview", &data->available_tree_view,
+	                                      "displayed-treeview", &data->active_tree_view,
+	                                      NULL))
+	{
+		g_free (data);
+		return;
+	}
+
+	g_object_set_data_full (G_OBJECT (data->dialog), "GT::Data", data, (GDestroyNotify) encoding_dialog_data_free);
+
+	gtk_window_set_transient_for (GTK_WINDOW (data->dialog), transient_parent);
+	gtk_window_set_role (GTK_WINDOW (data->dialog), "mate-terminal-encodings");
+	g_signal_connect (data->dialog, "response",
+	                  G_CALLBACK (response_callback), data);
+
+	/* buttons */
+	g_signal_connect (data->add_button, "clicked",
+	                  G_CALLBACK (button_clicked_cb), data);
+
+	g_signal_connect (data->remove_button, "clicked",
+	                  G_CALLBACK (button_clicked_cb), data);<--- You might need to cast the function pointer here
+
+	/* Tree view of available encodings */
+	/* Column 1 */
+	cell_renderer = gtk_cell_renderer_text_new ();
+	column = gtk_tree_view_column_new_with_attributes (_("_Description"),
+	         cell_renderer,
+	         "text", COLUMN_NAME,
+	         NULL);
+	gtk_tree_view_append_column (data->available_tree_view, column);
+	gtk_tree_view_column_set_sort_column_id (column, COLUMN_NAME);
+
+	/* Column 2 */
+	cell_renderer = gtk_cell_renderer_text_new ();
+	column = gtk_tree_view_column_new_with_attributes (_("_Encoding"),
+	         cell_renderer,
+	         "text", COLUMN_CHARSET,
+	         NULL);
+	gtk_tree_view_append_column (data->available_tree_view, column);
+	gtk_tree_view_column_set_sort_column_id (column, COLUMN_CHARSET);
+
+	data->available_selection = gtk_tree_view_get_selection (data->available_tree_view);
+	gtk_tree_selection_set_mode (data->available_selection, GTK_SELECTION_BROWSE);
+
+	g_signal_connect (data->available_selection, "changed",
+	                  G_CALLBACK (selection_changed_cb), data);
+
+	/* Tree view of selected encodings */
+	/* Column 1 */
+	cell_renderer = gtk_cell_renderer_text_new ();
+	column = gtk_tree_view_column_new_with_attributes (_("_Description"),
+	         cell_renderer,
+	         "text", COLUMN_NAME,
+	         NULL);
+	gtk_tree_view_append_column (data->active_tree_view, column);
+	gtk_tree_view_column_set_sort_column_id (column, COLUMN_NAME);
+
+	/* Column 2 */
+	cell_renderer = gtk_cell_renderer_text_new ();
+	column = gtk_tree_view_column_new_with_attributes (_("_Encoding"),
+	         cell_renderer,
+	         "text", COLUMN_CHARSET,
+	         NULL);
+	gtk_tree_view_append_column (data->active_tree_view, column);
+	gtk_tree_view_column_set_sort_column_id (column, COLUMN_CHARSET);
+
+	/* Add the data */
+
+	data->active_selection = gtk_tree_view_get_selection (data->active_tree_view);
+	gtk_tree_selection_set_mode (data->active_selection, GTK_SELECTION_BROWSE);
+
+	g_signal_connect (data->active_selection, "changed",
+	                  G_CALLBACK (selection_changed_cb), data);
+
+	data->base_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, TERMINAL_TYPE_ENCODING);
+
+	app = terminal_app_get ();
+	encodings_list_changed_cb (app, data);
+	g_signal_connect (app, "encoding-list-changed",
+	                  G_CALLBACK (encodings_list_changed_cb), data);
+
+	/* Now turn on sorting */
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (data->base_store),
+	                                      COLUMN_NAME,
+	                                      GTK_SORT_ASCENDING);
+
+	model = encodings_create_treemodel (data->base_store, FALSE);
+	gtk_tree_view_set_model (data->available_tree_view, model);
+	g_object_unref (model);
+
+	model = encodings_create_treemodel (data->base_store, TRUE);
+	gtk_tree_view_set_model (data->active_tree_view, model);
+	g_object_unref (model);
+
+	g_object_unref (data->base_store);
+
+	gtk_window_present (GTK_WINDOW (data->dialog));
+
+	encoding_dialog = data->dialog;
+	g_signal_connect (data->dialog, "destroy",
+	                  G_CALLBACK (gtk_widget_destroyed), &encoding_dialog);
+}
+
+GHashTable *
+terminal_encodings_get_builtins (void)
+{
+	GHashTable *encodings_hashtable;
+	guint i;
+	TerminalEncoding *encoding;
+
+	encodings_hashtable = g_hash_table_new_full (g_str_hash, g_str_equal,
+	                      NULL,
+	                      (GDestroyNotify) terminal_encoding_unref);
+
+	/* Placeholder entry for the current locale's charset */
+	encoding = terminal_encoding_new ("current",
+	                                  _("Current Locale"),
+	                                  FALSE,
+	                                  TRUE);
+	g_hash_table_insert (encodings_hashtable,
+	                     (gpointer) terminal_encoding_get_id (encoding),
+	                     encoding);
+
+	for (i = 0; i < G_N_ELEMENTS (encodings); ++i)
+	{
+		encoding = terminal_encoding_new (encodings[i].charset,
+		                                  _(encodings[i].name),
+		                                  FALSE,
+		                                  FALSE);
+		g_hash_table_insert (encodings_hashtable,
+		                     (gpointer) terminal_encoding_get_id (encoding),
+		                     encoding);
+	}
+
+	return encodings_hashtable;
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/42.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/42.html new file mode 100644 index 0000000..bb86849 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/42.html @@ -0,0 +1,471 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * Copyright © 2010 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3, or (at your option)
+ *  any later version.
+ *
+ *  This program is distributed in the hope info_bar it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-info-bar.h"
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+struct _TerminalInfoBarPrivate
+{
+	GtkWidget *content_box;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (TerminalInfoBar, terminal_info_bar, GTK_TYPE_INFO_BAR)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
+
+/* helper functions */
+
+static void
+terminal_info_bar_init (TerminalInfoBar *bar)
+{
+	GtkInfoBar *info_bar = GTK_INFO_BAR (bar);
+	TerminalInfoBarPrivate *priv;
+
+	priv = bar->priv = terminal_info_bar_get_instance_private (bar);
+
+	priv->content_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+	gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (info_bar)),
+	                    priv->content_box, TRUE, TRUE, 0);
+}
+
+static void
+terminal_info_bar_class_init (TerminalInfoBarClass *klass)
+{
+}
+
+/* public API */
+
+/**
+ * terminal_info_bar_new:
+ * @type: a #GtkMessageType
+ *
+ * Returns: a new #TerminalInfoBar for @screen
+ */
+GtkWidget *
+terminal_info_bar_new (GtkMessageType type,
+                       const char *first_button_text,
+                       ...)
+{
+	GtkWidget *info_bar;
+	va_list args;
+
+	info_bar = g_object_new (TERMINAL_TYPE_INFO_BAR,
+	                         "message-type", type,
+	                         NULL);
+
+	va_start (args, first_button_text);
+	while (first_button_text != NULL)
+	{
+		int response_id;
+
+		response_id = va_arg (args, int);
+		gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),
+		                         first_button_text, response_id);
+
+		first_button_text = va_arg (args, const char *);
+	}
+	va_end (args);
+
+	return info_bar;
+}
+
+void
+terminal_info_bar_format_text (TerminalInfoBar *bar,
+                               const char *format,
+                               ...)
+{
+	TerminalInfoBarPrivate *priv;
+	char *text;
+	GtkWidget *label;
+	va_list args;
+
+	g_return_if_fail (TERMINAL_IS_INFO_BAR (bar));
+
+	priv = bar->priv;
+
+	va_start (args, format);
+	text = g_strdup_vprintf (format, args);
+	va_end (args);
+
+	label = gtk_label_new (text);
+	g_free (text);
+
+	gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+	gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+	gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+	gtk_label_set_yalign (GTK_LABEL (label), 0.0);
+
+	gtk_box_pack_start (GTK_BOX (priv->content_box), label, FALSE, FALSE, 0);
+	gtk_widget_show_all (priv->content_box);
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/43.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/43.html new file mode 100644 index 0000000..53d2520 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/43.html @@ -0,0 +1,363 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
/*
+ *  Copyright © 2010 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3, or (at your option)
+ *  any later version.
+ *
+ *  This program is distributed in the hope info_bar it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TERMINAL_INFO_BAR_H
+#define TERMINAL_INFO_BAR_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define TERMINAL_TYPE_INFO_BAR         (terminal_info_bar_get_type ())
+#define TERMINAL_INFO_BAR(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), TERMINAL_TYPE_INFO_BAR, TerminalInfoBar))
+#define TERMINAL_INFO_BAR_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), TERMINAL_TYPE_INFO_BAR, TerminalInfoBarClass))
+#define TERMINAL_IS_INFO_BAR(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), TERMINAL_TYPE_INFO_BAR))
+#define TERMINAL_IS_INFO_BAR_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), TERMINAL_TYPE_INFO_BAR))
+#define TERMINAL_INFO_BAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TERMINAL_TYPE_INFO_BAR, TerminalInfoBarClass))
+
+typedef struct _TerminalInfoBar        TerminalInfoBar;
+typedef struct _TerminalInfoBarClass   TerminalInfoBarClass;
+typedef struct _TerminalInfoBarPrivate TerminalInfoBarPrivate;
+
+struct _TerminalInfoBar
+{
+	GtkInfoBar parent_instance;
+
+	/*< private >*/
+	TerminalInfoBarPrivate *priv;
+};
+
+struct _TerminalInfoBarClass
+{
+	GtkInfoBarClass parent_class;
+};
+
+GType terminal_info_bar_get_type (void);
+
+GtkWidget *terminal_info_bar_new (GtkMessageType type,
+                                  const char *first_button_text,
+                                  ...) G_GNUC_NULL_TERMINATED;
+
+void terminal_info_bar_format_text (TerminalInfoBar *bar,
+                                    const char *format,
+                                    ...) G_GNUC_PRINTF (2, 3);
+
+G_END_DECLS
+
+#endif /* !TERMINAL_INFO_BAR_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/44.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/44.html new file mode 100644 index 0000000..579b36a --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/44.html @@ -0,0 +1,441 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/* This file is generated by glib-genmarshal, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#ifdef G_ENABLE_DEBUG
+#define g_marshal_value_peek_boolean(v)  g_value_get_boolean (v)
+#define g_marshal_value_peek_char(v)     g_value_get_schar (v)
+#define g_marshal_value_peek_uchar(v)    g_value_get_uchar (v)
+#define g_marshal_value_peek_int(v)      g_value_get_int (v)
+#define g_marshal_value_peek_uint(v)     g_value_get_uint (v)
+#define g_marshal_value_peek_long(v)     g_value_get_long (v)
+#define g_marshal_value_peek_ulong(v)    g_value_get_ulong (v)
+#define g_marshal_value_peek_int64(v)    g_value_get_int64 (v)
+#define g_marshal_value_peek_uint64(v)   g_value_get_uint64 (v)
+#define g_marshal_value_peek_enum(v)     g_value_get_enum (v)
+#define g_marshal_value_peek_flags(v)    g_value_get_flags (v)
+#define g_marshal_value_peek_float(v)    g_value_get_float (v)
+#define g_marshal_value_peek_double(v)   g_value_get_double (v)
+#define g_marshal_value_peek_string(v)   (char*) g_value_get_string (v)
+#define g_marshal_value_peek_param(v)    g_value_get_param (v)
+#define g_marshal_value_peek_boxed(v)    g_value_get_boxed (v)
+#define g_marshal_value_peek_pointer(v)  g_value_get_pointer (v)
+#define g_marshal_value_peek_object(v)   g_value_get_object (v)
+#define g_marshal_value_peek_variant(v)  g_value_get_variant (v)
+#else /* !G_ENABLE_DEBUG */
+/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
+ *          Do not access GValues directly in your code. Instead, use the
+ *          g_value_get_*() functions
+ */
+#define g_marshal_value_peek_boolean(v)  (v)->data[0].v_int
+#define g_marshal_value_peek_char(v)     (v)->data[0].v_int
+#define g_marshal_value_peek_uchar(v)    (v)->data[0].v_uint
+#define g_marshal_value_peek_int(v)      (v)->data[0].v_int
+#define g_marshal_value_peek_uint(v)     (v)->data[0].v_uint
+#define g_marshal_value_peek_long(v)     (v)->data[0].v_long
+#define g_marshal_value_peek_ulong(v)    (v)->data[0].v_ulong
+#define g_marshal_value_peek_int64(v)    (v)->data[0].v_int64
+#define g_marshal_value_peek_uint64(v)   (v)->data[0].v_uint64
+#define g_marshal_value_peek_enum(v)     (v)->data[0].v_long
+#define g_marshal_value_peek_flags(v)    (v)->data[0].v_ulong
+#define g_marshal_value_peek_float(v)    (v)->data[0].v_float
+#define g_marshal_value_peek_double(v)   (v)->data[0].v_double
+#define g_marshal_value_peek_string(v)   (v)->data[0].v_pointer
+#define g_marshal_value_peek_param(v)    (v)->data[0].v_pointer
+#define g_marshal_value_peek_boxed(v)    (v)->data[0].v_pointer
+#define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer
+#define g_marshal_value_peek_object(v)   (v)->data[0].v_pointer
+#define g_marshal_value_peek_variant(v)  (v)->data[0].v_pointer
+#endif /* !G_ENABLE_DEBUG */
+
+/* BOOLEAN:STRING,INT,UINT (./terminal-marshal.list:1) */
+/* Prototype for -Wmissing-prototypes */
+G_BEGIN_DECLS
+G_GNUC_INTERNAL
+void _terminal_marshal_BOOLEAN__STRING_INT_UINT (GClosure     *closure,
+                                                 GValue       *return_value,
+                                                 guint         n_param_values,
+                                                 const GValue *param_values,
+                                                 gpointer      invocation_hint,
+                                                 gpointer      marshal_data);
+G_END_DECLS
+void
+_terminal_marshal_BOOLEAN__STRING_INT_UINT (GClosure     *closure,
+                                            GValue       *return_value,
+                                            guint         n_param_values,
+                                            const GValue *param_values,
+                                            gpointer      invocation_hint G_GNUC_UNUSED,
+                                            gpointer      marshal_data)
+{
+  typedef gboolean (*GMarshalFunc_BOOLEAN__STRING_INT_UINT) (gpointer data1,
+                                                             gpointer arg1,
+                                                             gint arg2,
+                                                             guint arg3,
+                                                             gpointer data2);
+  GCClosure *cc = (GCClosure *) closure;
+  gpointer data1, data2;
+  GMarshalFunc_BOOLEAN__STRING_INT_UINT callback;
+  gboolean v_return;
+
+  g_return_if_fail (return_value != NULL);
+  g_return_if_fail (n_param_values == 4);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_BOOLEAN__STRING_INT_UINT) (marshal_data ? marshal_data : cc->callback);
+
+  v_return = callback (data1,
+                       g_marshal_value_peek_string (param_values + 1),
+                       g_marshal_value_peek_int (param_values + 2),
+                       g_marshal_value_peek_uint (param_values + 3),
+                       data2);
+
+  g_value_set_boolean (return_value, v_return);
+}
+
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/45.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/45.html new file mode 100644 index 0000000..9ed9b28 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/45.html @@ -0,0 +1,3119 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
   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
/*
+ * Copyright © 2001, 2002 Havoc Pennington
+ * Copyright © 2002 Red Hat, Inc.
+ * Copyright © 2002 Sun Microsystems
+ * Copyright © 2003 Mariano Suarez-Alvarez
+ * Copyright © 2008 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * Mate-terminal 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <errno.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-options.h"
+#include "terminal-screen.h"
+#include "terminal-app.h"
+#include "terminal-intl.h"
+#include "terminal-util.h"
+
+static GOptionContext *get_goption_context (TerminalOptions *options);
+
+static InitialTab*
+initial_tab_new (const char *profile,
+                 gboolean    is_id)
+{
+	InitialTab *it;
+
+	it = g_slice_new (InitialTab);
+
+	it->profile = g_strdup (profile);
+	it->profile_is_id = is_id;
+	it->exec_argv = NULL;
+	it->title = NULL;
+	it->working_dir = NULL;
+	it->zoom = 1.0;
+	it->zoom_set = FALSE;
+	it->active = FALSE;
+	it->attach_window = FALSE;
+
+	return it;
+}
+
+static void
+initial_tab_free (InitialTab *it)
+{
+	g_free (it->profile);
+	g_strfreev (it->exec_argv);
+	g_free (it->title);
+	g_free (it->working_dir);
+	g_slice_free (InitialTab, it);
+}
+
+static InitialWindow*
+initial_window_new (guint source_tag)
+{
+	InitialWindow *iw;
+
+	iw = g_slice_new0 (InitialWindow);
+	iw->source_tag = source_tag;
+
+	return iw;
+}
+
+static void
+initial_window_free (InitialWindow *iw)
+{
+	g_list_foreach (iw->tabs, (GFunc) initial_tab_free, NULL);
+	g_list_free (iw->tabs);
+	g_free (iw->geometry);
+	g_free (iw->role);
+	g_slice_free (InitialWindow, iw);
+}
+
+static void
+apply_defaults (TerminalOptions *options,
+                InitialWindow        *iw)
+{
+	if (options->default_role)
+	{
+		iw->role = options->default_role;
+		options->default_role = NULL;
+	}
+
+	if (iw->geometry == NULL)
+		iw->geometry = g_strdup (options->default_geometry);
+
+	if (options->default_window_menubar_forced)
+	{
+		iw->force_menubar_state = TRUE;
+		iw->menubar_state = options->default_window_menubar_state;
+
+		options->default_window_menubar_forced = FALSE;
+	}
+
+	iw->start_fullscreen |= options->default_fullscreen;
+	iw->start_maximized |= options->default_maximize;
+}
+
+static InitialWindow*
+ensure_top_window (TerminalOptions *options)
+{
+	InitialWindow *iw;
+
+	if (options->initial_windows == NULL)
+	{
+		iw = initial_window_new (0);
+		iw->tabs = g_list_append (NULL, initial_tab_new (NULL, FALSE));
+		apply_defaults (options, iw);
+
+		options->initial_windows = g_list_append (options->initial_windows, iw);
+	}
+	else
+	{
+		iw = g_list_last (options->initial_windows)->data;
+	}
+
+	g_assert (iw->tabs);
+
+	return iw;
+}
+
+static InitialTab*
+ensure_top_tab (TerminalOptions *options)
+{
+	InitialWindow *iw;
+	InitialTab *it;
+
+	iw = ensure_top_window (options);
+
+	g_assert (iw->tabs);
+
+	it = g_list_last (iw->tabs)->data;
+
+	return it;
+}
+
+static InitialWindow*
+add_new_window (TerminalOptions *options,
+                const char           *profile,
+                gboolean              is_id)
+{
+	InitialWindow *iw;
+
+	iw = initial_window_new (0);
+	iw->tabs = g_list_prepend (NULL, initial_tab_new (profile, is_id));
+	apply_defaults (options, iw);
+
+	options->initial_windows = g_list_append (options->initial_windows, iw);
+
+	return iw;
+}
+
+/* handle deprecated command line options */
+static gboolean
+unsupported_option_callback (const gchar *option_name,
+                             const gchar *value,
+                             gpointer     data,
+                             GError     **error)
+{
+	g_printerr (_("Option \"%s\" is no longer supported in this version of mate-terminal;"
+	              " you might want to create a profile with the desired setting, and use"
+	              " the new '--profile' option\n"), option_name);
+	return TRUE; /* we do not want to bail out here but continue */
+}
+
+static gboolean G_GNUC_NORETURN
+option_version_cb (const gchar *option_name,
+                   const gchar *value,
+                   gpointer     data,
+                   GError     **error)
+{
+	g_print ("%s %s\n", _("MATE Terminal"), VERSION);
+
+	exit (EXIT_SUCCESS);
+}
+
+static gboolean
+option_command_callback (const gchar *option_name,
+                         const gchar *value,
+                         gpointer     data,
+                         GError     **error)
+{
+	TerminalOptions *options = data;
+	GError *err = NULL;
+	char  **exec_argv;
+
+	if (!g_shell_parse_argv (value, NULL, &exec_argv, &err))
+	{
+		g_set_error(error,
+		            G_OPTION_ERROR,
+		            G_OPTION_ERROR_BAD_VALUE,
+		            _("Argument to \"%s\" is not a valid command: %s"),
+		            "--command/-e",
+		            err->message);
+		g_error_free (err);
+		return FALSE;
+	}
+
+	if (options->initial_windows)
+	{
+		InitialTab *it = ensure_top_tab (options);
+
+		g_strfreev (it->exec_argv);
+		it->exec_argv = exec_argv;
+	}
+	else
+	{
+		g_strfreev (options->exec_argv);
+		options->exec_argv = exec_argv;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+option_profile_cb (const gchar *option_name,
+                   const gchar *value,
+                   gpointer     data,
+                   GError     **error)
+{
+	TerminalOptions *options = data;
+
+	if (options->initial_windows)
+	{
+		InitialTab *it = ensure_top_tab (options);
+
+		g_free (it->profile);
+		it->profile = g_strdup (value);
+		it->profile_is_id = FALSE;
+	}
+	else
+	{
+		g_free (options->default_profile);
+		options->default_profile = g_strdup (value);
+		options->default_profile_is_id = FALSE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+option_profile_id_cb (const gchar *option_name,
+                      const gchar *value,
+                      gpointer     data,
+                      GError     **error)
+{
+	TerminalOptions *options = data;
+
+	if (options->initial_windows)
+	{
+		InitialTab *it = ensure_top_tab (options);
+
+		g_free (it->profile);
+		it->profile = g_strdup (value);
+		it->profile_is_id = TRUE;
+	}
+	else
+	{
+		g_free (options->default_profile);
+		options->default_profile = g_strdup (value);
+		options->default_profile_is_id = TRUE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+option_window_callback (const gchar *option_name,
+                        const gchar *value,
+                        gpointer     data,
+                        GError     **error)
+{
+	TerminalOptions *options = data;
+	gboolean is_profile_id;
+
+	is_profile_id = g_str_has_suffix (option_name, "-with-profile-internal-id");
+
+	add_new_window (options, value, is_profile_id);
+
+	return TRUE;
+}
+
+static gboolean
+option_tab_callback (const gchar *option_name,
+                     const gchar *value,
+                     gpointer     data,
+                     GError     **error)
+{
+	TerminalOptions *options = data;
+	gboolean is_profile_id;
+	InitialWindow *iw;
+	InitialTab *it;
+
+	is_profile_id = g_str_has_suffix (option_name, "-with-profile-internal-id");
+
+	if (options->initial_windows)
+	{
+		iw = g_list_last (options->initial_windows)->data;
+		iw->tabs = g_list_append (iw->tabs, initial_tab_new (value, is_profile_id));
+	}
+	else
+	{
+		iw = add_new_window (options, value, is_profile_id);
+		it = g_list_last(iw->tabs)->data;
+		it->attach_window = TRUE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+option_role_callback (const gchar *option_name,
+                      const gchar *value,
+                      gpointer     data,
+                      GError     **error)
+{
+	TerminalOptions *options = data;
+	InitialWindow *iw;
+
+	if (options->initial_windows)
+	{
+		iw = g_list_last (options->initial_windows)->data;
+		iw->role = g_strdup (value);
+	}
+	else if (!options->default_role)
+		options->default_role = g_strdup (value);
+	else
+	{
+		g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
+		             "%s", _("Two roles given for one window"));
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+option_show_menubar_callback (const gchar *option_name,
+                              const gchar *value,
+                              gpointer     data,
+                              GError     **error)
+{
+	TerminalOptions *options = data;
+	InitialWindow *iw;
+
+	if (options->initial_windows)
+	{
+		iw = g_list_last (options->initial_windows)->data;
+		if (iw->force_menubar_state && iw->menubar_state == TRUE)
+		{
+			g_printerr (_("\"%s\" option given twice for the same window\n"),
+			            "--show-menubar");
+
+			return TRUE;
+		}
+
+		iw->force_menubar_state = TRUE;
+		iw->menubar_state = TRUE;
+	}
+	else
+	{
+		options->default_window_menubar_forced = TRUE;
+		options->default_window_menubar_state = TRUE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+option_hide_menubar_callback (const gchar *option_name,
+                              const gchar *value,
+                              gpointer     data,
+                              GError     **error)
+{
+	TerminalOptions *options = data;
+	InitialWindow *iw;
+
+	if (options->initial_windows)
+	{
+		iw = g_list_last (options->initial_windows)->data;
+
+		if (iw->force_menubar_state && iw->menubar_state == FALSE)
+		{
+			g_printerr (_("\"%s\" option given twice for the same window\n"),
+			            "--hide-menubar");
+			return TRUE;
+		}
+
+		iw->force_menubar_state = TRUE;
+		iw->menubar_state = FALSE;
+	}
+	else
+	{
+		options->default_window_menubar_forced = TRUE;
+		options->default_window_menubar_state = FALSE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+option_maximize_callback (const gchar *option_name,
+                          const gchar *value,
+                          gpointer     data,
+                          GError     **error)
+{
+	TerminalOptions *options = data;
+	InitialWindow *iw;
+
+	if (options->initial_windows)
+	{
+		iw = g_list_last (options->initial_windows)->data;
+		iw->start_maximized = TRUE;
+	}
+	else
+		options->default_maximize = TRUE;
+
+	return TRUE;
+}
+
+static gboolean
+option_fullscreen_callback (const gchar *option_name,
+                            const gchar *value,
+                            gpointer     data,
+                            GError     **error)
+{
+	TerminalOptions *options = data;
+
+	if (options->initial_windows)
+	{
+		InitialWindow *iw;
+
+		iw = g_list_last (options->initial_windows)->data;
+		iw->start_fullscreen = TRUE;
+	}
+	else
+		options->default_fullscreen = TRUE;
+
+	return TRUE;
+}
+
+static gboolean
+option_geometry_callback (const gchar *option_name,
+                          const gchar *value,
+                          gpointer     data,
+                          GError     **error)
+{
+	TerminalOptions *options = data;
+
+	if (options->initial_windows)
+	{
+		InitialWindow *iw;
+
+		iw = g_list_last (options->initial_windows)->data;
+		iw->geometry = g_strdup (value);
+	}
+	else
+		options->default_geometry = g_strdup (value);
+
+	return TRUE;
+}
+
+static gboolean
+option_disable_factory_callback (const gchar *option_name,
+                                 const gchar *value,
+                                 gpointer     data,
+                                 GError     **error)
+{
+	TerminalOptions *options = data;
+
+	options->use_factory = FALSE;
+
+	return TRUE;
+}
+
+static gboolean
+option_load_save_config_cb (const gchar *option_name,
+                            const gchar *value,
+                            gpointer     data,
+                            GError     **error)
+{
+	TerminalOptions *options = data;
+
+	if (options->config_file)
+	{
+		g_set_error_literal (error, TERMINAL_OPTION_ERROR, TERMINAL_OPTION_ERROR_EXCLUSIVE_OPTIONS,
+		                     "Options \"--load-config\" and \"--save-config\" are mutually exclusive");
+		return FALSE;
+	}
+
+	options->config_file = terminal_util_resolve_relative_path (options->default_working_dir, value);
+	options->load_config = strcmp (option_name, "--load-config") == 0;
+	options->save_config = strcmp (option_name, "--save-config") == 0;
+
+	return TRUE;
+}
+
+static gboolean
+option_title_callback (const gchar *option_name,
+                       const gchar *value,
+                       gpointer     data,
+                       GError     **error)
+{
+	TerminalOptions *options = data;
+
+	if (options->initial_windows)
+	{
+		InitialTab *it = ensure_top_tab (options);
+
+		g_free (it->title);
+		it->title = g_strdup (value);
+	}
+	else
+	{
+		g_free (options->default_title);
+		options->default_title = g_strdup (value);
+	}
+
+	return TRUE;
+}
+
+static gboolean
+option_working_directory_callback (const gchar *option_name,
+                                   const gchar *value,
+                                   gpointer     data,
+                                   GError     **error)
+{
+	TerminalOptions *options = data;
+
+	if (options->initial_windows)
+	{
+		InitialTab *it = ensure_top_tab (options);
+
+		g_free (it->working_dir);
+		it->working_dir = g_strdup (value);
+	}
+	else
+	{
+		g_free (options->default_working_dir);
+		options->default_working_dir = g_strdup (value);
+	}
+
+	return TRUE;
+}
+
+static gboolean
+option_active_callback (const gchar *option_name,
+                        const gchar *value,
+                        gpointer     data,
+                        GError     **error)
+{
+	TerminalOptions *options = data;
+	InitialTab *it;
+
+	it = ensure_top_tab (options);
+	it->active = TRUE;
+
+	return TRUE;
+}
+
+static gboolean
+option_zoom_callback (const gchar *option_name,
+                      const gchar *value,
+                      gpointer     data,
+                      GError     **error)
+{
+	TerminalOptions *options = data;
+	double zoom;
+	char *end;
+
+	/* Try reading a locale-style double first, in case it was
+	  * typed by a person, then fall back to ascii_strtod (we
+	  * always save session in C locale format)
+	  */
+	end = NULL;
+	errno = 0;
+	zoom = g_strtod (value, &end);
+	if (end == NULL || *end != '\0')
+	{
+		g_set_error (error,
+		             G_OPTION_ERROR,
+		             G_OPTION_ERROR_BAD_VALUE,
+		             _("\"%s\" is not a valid zoom factor"),
+		             value);
+		return FALSE;
+	}
+
+	if (zoom < (TERMINAL_SCALE_MINIMUM + 1e-6))
+	{
+		g_printerr (_("Zoom factor \"%g\" is too small, using %g\n"),
+		            zoom,
+		            TERMINAL_SCALE_MINIMUM);
+		zoom = TERMINAL_SCALE_MINIMUM;
+	}
+
+	if (zoom > (TERMINAL_SCALE_MAXIMUM - 1e-6))
+	{
+		g_printerr (_("Zoom factor \"%g\" is too large, using %g\n"),
+		            zoom,
+		            TERMINAL_SCALE_MAXIMUM);
+		zoom = TERMINAL_SCALE_MAXIMUM;
+	}
+
+	if (options->initial_windows)
+	{
+		InitialTab *it = ensure_top_tab (options);
+		it->zoom = zoom;
+		it->zoom_set = TRUE;
+	}
+	else
+		options->zoom = zoom;
+
+	return TRUE;
+}
+
+/* Evaluation of the arguments given to the command line options */
+static gboolean
+digest_options_callback (GOptionContext *context,
+                         GOptionGroup *group,
+                         gpointer      data,
+                         GError      **error)
+{
+	TerminalOptions *options = data;
+	InitialTab    *it;
+
+	if (options->execute)
+	{
+		if (options->exec_argv == NULL)
+		{
+			g_set_error (error,
+			             G_OPTION_ERROR,
+			             G_OPTION_ERROR_BAD_VALUE,
+			             _("Option \"%s\" requires specifying the command to run"
+			               " on the rest of the command line"),
+			             "--execute/-x");
+			return FALSE;
+		}
+
+		/* Apply -x/--execute command only to the first tab */
+		it = ensure_top_tab (options);
+		it->exec_argv = options->exec_argv;
+		options->exec_argv = NULL;
+	}
+
+	return TRUE;
+}
+
+/**
+ * terminal_options_parse:
+ * @working_directory: the default working directory
+ * @display_name: the default X display name
+ * @startup_id: the startup notification ID
+ * @env: the environment as variable=value pairs
+ * @remote_arguments: whether the caller is the factory process or not
+ * @ignore_unknown_options: whether to ignore unknown options when parsing
+ *   the arguments
+ * @argcp: (inout) address of the argument count. Changed if any arguments were handled
+ * @argvp: (inout) address of the argument vector. Any parameters understood by
+ *   the terminal #GOptionContext are removed
+ * @error: a #GError to fill in
+ * @...: a %NULL terminated list of extra #GOptionGroup<!-- -->s
+ *
+ * Parses the argument vector *@argvp.
+ *
+ * Returns: a new #TerminalOptions containing the windows and tabs to open,
+ *   or %NULL on error.
+ */
+TerminalOptions *
+terminal_options_parse (const char *working_directory,
+                        const char *display_name,
+                        const char *startup_id,
+                        char **env,
+                        gboolean remote_arguments,
+                        gboolean ignore_unknown_options,
+                        int *argcp,
+                        char ***argvp,
+                        GError **error,
+                        ...)
+{
+	TerminalOptions *options;
+	GOptionContext *context;
+	GOptionGroup *extra_group;
+	va_list va_args;
+	gboolean retval;
+	int i;
+	char **argv = *argvp;
+
+	options = g_slice_new0 (TerminalOptions);
+
+	options->remote_arguments = remote_arguments;
+	options->default_window_menubar_forced = FALSE;
+	options->default_window_menubar_state = TRUE;
+	options->default_fullscreen = FALSE;
+	options->default_maximize = FALSE;
+	options->execute = FALSE;
+	options->use_factory = TRUE;
+	options->initial_workspace = -1;
+
+	options->env = g_strdupv (env);
+	options->startup_id = g_strdup (startup_id && startup_id[0] ? startup_id : NULL);
+	options->display_name = g_strdup (display_name);
+	options->initial_windows = NULL;
+	options->default_role = NULL;
+	options->default_geometry = NULL;
+	options->default_title = NULL;
+	options->zoom = 1.0;
+
+	options->default_working_dir = g_strdup (working_directory);
+
+	/* The old -x/--execute option is broken, so we need to pre-scan for it. */
+	/* We now also support passing the command after the -- switch. */
+	options->exec_argv = NULL;
+	for (i = 1 ; i < *argcp; ++i)
+	{
+		gboolean is_execute;
+		gboolean is_dashdash;
+		int j, last;
+
+		is_execute = strcmp (argv[i], "-x") == 0 || strcmp (argv[i], "--execute") == 0;
+		is_dashdash = strcmp (argv[i], "--") == 0;
+
+		if (!is_execute && !is_dashdash)
+			continue;
+
+		options->execute = is_execute;
+
+		/* Skip the switch */
+		last = i;
+		++i;
+		if (i == *argcp)
+			break; /* we'll complain about this later for -x/--execute; it's fine for -- */
+
+		/* Collect the args, and remove them from argv */
+		options->exec_argv = g_new0 (char*, *argcp - i + 1);
+		for (j = 0; i < *argcp; ++i, ++j)
+			options->exec_argv[j] = g_strdup (argv[i]);
+		options->exec_argv[j] = NULL;
+
+		*argcp = last;
+		break;
+	}
+
+	context = get_goption_context (options);
+
+	g_option_context_set_ignore_unknown_options (context, ignore_unknown_options);
+
+	va_start (va_args, error);
+	extra_group = va_arg (va_args, GOptionGroup*);
+	while (extra_group != NULL)
+	{
+		g_option_context_add_group (context, extra_group);
+		extra_group = va_arg (va_args, GOptionGroup*);
+	}
+	va_end (va_args);
+
+	retval = g_option_context_parse (context, argcp, argvp, error);
+	g_option_context_free (context);
+
+	if (retval)
+		return options;
+
+	terminal_options_free (options);
+	return NULL;
+}
+
+/**
+ * terminal_options_merge_config:
+ * @options:
+ * @key_file: a #GKeyFile containing to merge the options from
+ * @source_tag: a source_tag to use in new #InitialWindow<!-- -->s
+ * @error: a #GError to fill in
+ *
+ * Merges the saved options from @key_file into @options.
+ *
+ * Returns: %TRUE if @key_file was a valid key file containing a stored
+ *   terminal configuration, or %FALSE on error
+ */
+gboolean
+terminal_options_merge_config (TerminalOptions *options,
+                               GKeyFile *key_file,
+                               guint source_tag,
+                               GError **error)
+{
+	int version, compat_version;
+	char **groups;
+	guint i;
+	gboolean have_error = FALSE;
+	GList *initial_windows = NULL;
+
+	if (!g_key_file_has_group (key_file, TERMINAL_CONFIG_GROUP))
+	{
+		g_set_error_literal (error, TERMINAL_OPTION_ERROR,
+		                     TERMINAL_OPTION_ERROR_INVALID_CONFIG_FILE,
+		                     _("Not a valid terminal config file."));
+		return FALSE;
+	}
+
+	version = g_key_file_get_integer (key_file, TERMINAL_CONFIG_GROUP, TERMINAL_CONFIG_PROP_VERSION, NULL);
+	compat_version = g_key_file_get_integer (key_file, TERMINAL_CONFIG_GROUP, TERMINAL_CONFIG_PROP_COMPAT_VERSION, NULL);
+
+	if (version <= 0 ||
+	        compat_version <= 0 ||
+	        compat_version > TERMINAL_CONFIG_COMPAT_VERSION)
+	{
+		g_set_error_literal (error, TERMINAL_OPTION_ERROR,
+		                     TERMINAL_OPTION_ERROR_INCOMPATIBLE_CONFIG_FILE,
+		                     _("Incompatible terminal config file version."));
+		return FALSE;
+	}
+
+	groups = g_key_file_get_string_list (key_file, TERMINAL_CONFIG_GROUP, TERMINAL_CONFIG_PROP_WINDOWS, NULL, error);
+	if (!groups)
+		return FALSE;
+
+	for (i = 0; groups[i]; ++i)
+	{
+		const char *window_group = groups[i];
+		char **tab_groups;
+		InitialWindow *iw;
+		guint j;
+
+		tab_groups = g_key_file_get_string_list (key_file, window_group, TERMINAL_CONFIG_WINDOW_PROP_TABS, NULL, error);
+		if (!tab_groups)
+			continue; /* no tabs in this window, skip it */
+
+		iw = initial_window_new (source_tag);
+		initial_windows = g_list_append (initial_windows, iw);
+		apply_defaults (options, iw);
+
+		iw->role = g_key_file_get_string (key_file, window_group, TERMINAL_CONFIG_WINDOW_PROP_ROLE, NULL);
+		iw->geometry = g_key_file_get_string (key_file, window_group, TERMINAL_CONFIG_WINDOW_PROP_GEOMETRY, NULL);
+		iw->start_fullscreen = g_key_file_get_boolean (key_file, window_group, TERMINAL_CONFIG_WINDOW_PROP_FULLSCREEN, NULL);
+		iw->start_maximized = g_key_file_get_boolean (key_file, window_group, TERMINAL_CONFIG_WINDOW_PROP_MAXIMIZED, NULL);
+		if (g_key_file_has_key (key_file, window_group, TERMINAL_CONFIG_WINDOW_PROP_MENUBAR_VISIBLE, NULL))
+		{
+			iw->force_menubar_state = TRUE;
+			iw->menubar_state = g_key_file_get_boolean (key_file, window_group, TERMINAL_CONFIG_WINDOW_PROP_MENUBAR_VISIBLE, NULL);
+		}
+
+		for (j = 0; tab_groups[j]; ++j)
+		{
+			const char *tab_group = tab_groups[j];
+			InitialTab *it;
+			char *profile;
+
+			profile = g_key_file_get_string (key_file, tab_group, TERMINAL_CONFIG_TERMINAL_PROP_PROFILE_ID, NULL);
+			it = initial_tab_new (profile, TRUE);
+			g_free (profile);
+
+			iw->tabs = g_list_append (iw->tabs, it);
+
+			/*          it->width = g_key_file_get_integer (key_file, tab_group, TERMINAL_CONFIG_TERMINAL_PROP_WIDTH, NULL);
+			          it->height = g_key_file_get_integer (key_file, tab_group, TERMINAL_CONFIG_TERMINAL_PROP_HEIGHT, NULL);*/
+			it->working_dir = terminal_util_key_file_get_string_unescape (key_file, tab_group, TERMINAL_CONFIG_TERMINAL_PROP_WORKING_DIRECTORY, NULL);
+			it->title = g_key_file_get_string (key_file, tab_group, TERMINAL_CONFIG_TERMINAL_PROP_TITLE, NULL);
+
+			if (g_key_file_has_key (key_file, tab_group, TERMINAL_CONFIG_TERMINAL_PROP_COMMAND, NULL) &&
+			        !(it->exec_argv = terminal_util_key_file_get_argv (key_file, tab_group, TERMINAL_CONFIG_TERMINAL_PROP_COMMAND, NULL, error)))
+			{
+				have_error = TRUE;
+				break;
+			}
+		}
+
+		g_strfreev (tab_groups);
+
+		if (have_error)
+			break;
+	}
+
+	g_strfreev (groups);
+
+	if (have_error)
+	{
+		g_list_foreach (initial_windows, (GFunc) initial_window_free, NULL);
+		g_list_free (initial_windows);
+		return FALSE;
+	}
+
+	options->initial_windows = g_list_concat (options->initial_windows, initial_windows);
+
+	return TRUE;
+}
+
+/**
+ * terminal_options_ensure_window:
+ * @options:
+ *
+ * Ensure that @options will contain at least one window to open.
+ */
+void
+terminal_options_ensure_window (TerminalOptions *options)
+{
+	ensure_top_window (options);
+}
+
+/**
+ * terminal_options_free:
+ * @options:
+ *
+ * Frees @options.
+ */
+void
+terminal_options_free (TerminalOptions *options)
+{
+	g_list_foreach (options->initial_windows, (GFunc) initial_window_free, NULL);
+	g_list_free (options->initial_windows);
+
+	g_strfreev (options->env);
+	g_free (options->default_role);
+	g_free (options->default_geometry);
+	g_free (options->default_working_dir);
+	g_free (options->default_title);
+	g_free (options->default_profile);
+
+	g_strfreev (options->exec_argv);
+
+	g_free (options->display_name);
+	g_free (options->startup_id);
+
+	g_slice_free (TerminalOptions, options);
+}
+
+static GOptionContext *
+get_goption_context (TerminalOptions *options)
+{
+	const GOptionEntry global_unique_goptions[] =
+	{
+		{
+			"disable-factory",
+			0,
+			G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			option_disable_factory_callback,
+			N_("Do not register with the activation nameserver, do not re-use an active terminal"),
+			NULL
+		},
+		{
+			"load-config",
+			0,
+			G_OPTION_FLAG_FILENAME,
+			G_OPTION_ARG_CALLBACK,
+			option_load_save_config_cb,
+			N_("Load a terminal configuration file"),
+			N_("FILE")
+		},
+		{
+			"save-config",
+			0,
+			G_OPTION_FLAG_FILENAME,
+			G_OPTION_ARG_CALLBACK,
+			option_load_save_config_cb,
+			N_("Save the terminal configuration to a file"),
+			N_("FILE")
+		},
+		{ "version", 0, G_OPTION_FLAG_NO_ARG | G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_CALLBACK, option_version_cb, NULL, NULL },
+		{ NULL, 0, 0, 0, NULL, NULL, NULL }
+	};
+
+	const GOptionEntry global_multiple_goptions[] =
+	{
+		{
+			"window",
+			0,
+			G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			option_window_callback,
+			N_("Open a new window containing a tab with the default profile"),
+			NULL
+		},
+		{
+			"tab",
+			0,
+			G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			option_tab_callback,
+			N_("Open a new tab in the last-opened window with the default profile"),
+			NULL
+		},
+		{ NULL, 0, 0, 0, NULL, NULL, NULL }
+	};
+
+	const GOptionEntry window_goptions[] =
+	{
+		{
+			"show-menubar",
+			0,
+			G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			option_show_menubar_callback,
+			N_("Turn on the menubar"),
+			NULL
+		},
+		{
+			"hide-menubar",
+			0,
+			G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			option_hide_menubar_callback,
+			N_("Turn off the menubar"),
+			NULL
+		},
+		{
+			"maximize",
+			0,
+			G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			option_maximize_callback,
+			N_("Maximize the window"),
+			NULL
+		},
+		{
+			"full-screen",
+			0,
+			G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			option_fullscreen_callback,
+			N_("Full-screen the window"),
+			NULL
+		},
+		{
+			"geometry",
+			0,
+			0,
+			G_OPTION_ARG_CALLBACK,
+			option_geometry_callback,
+			N_("Set the window size; for example: 80x24, or 80x24+200+200 (COLSxROWS+X+Y)"),
+			N_("GEOMETRY")
+		},
+		{
+			"role",
+			0,
+			0,
+			G_OPTION_ARG_CALLBACK,
+			option_role_callback,
+			N_("Set the window role"),
+			N_("ROLE")
+		},
+		{
+			"active",
+			0,
+			G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			option_active_callback,
+			N_("Set the last specified tab as the active one in its window"),
+			NULL
+		},
+		{ NULL, 0, 0, 0, NULL, NULL, NULL }
+	};
+
+	const GOptionEntry terminal_goptions[] =
+	{
+		{
+			"command",
+			'e',
+			G_OPTION_FLAG_FILENAME,
+			G_OPTION_ARG_CALLBACK,
+			option_command_callback,
+			N_("Execute the argument to this option inside the terminal"),
+			NULL
+		},
+		{
+			"profile",
+			0,
+			0,
+			G_OPTION_ARG_CALLBACK,
+			option_profile_cb,
+			N_("Use the given profile instead of the default profile"),
+			N_("PROFILE-NAME")
+		},
+		{
+			"title",
+			't',
+			0,
+			G_OPTION_ARG_CALLBACK,
+			option_title_callback,
+			N_("Set the terminal title"),
+			N_("TITLE")
+		},
+		{
+			"working-directory",
+			0,
+			G_OPTION_FLAG_FILENAME,
+			G_OPTION_ARG_CALLBACK,
+			option_working_directory_callback,
+			N_("Set the working directory"),
+			N_("DIRNAME")
+		},
+		{
+			"zoom",
+			0,
+			0,
+			G_OPTION_ARG_CALLBACK,
+			option_zoom_callback,
+			N_("Set the terminal's zoom factor (1.0 = normal size)"),
+			N_("ZOOM")
+		},
+		{ NULL, 0, 0, 0, NULL, NULL, NULL }
+	};
+
+	const GOptionEntry internal_goptions[] =
+	{
+		{
+			"profile-id",
+			0,
+			G_OPTION_FLAG_HIDDEN,
+			G_OPTION_ARG_CALLBACK,
+			option_profile_id_cb,
+			NULL, NULL
+		},
+		{
+			"window-with-profile",
+			0,
+			G_OPTION_FLAG_HIDDEN,
+			G_OPTION_ARG_CALLBACK,
+			option_window_callback,
+			NULL, NULL
+		},
+		{
+			"tab-with-profile",
+			0,
+			G_OPTION_FLAG_HIDDEN,
+			G_OPTION_ARG_CALLBACK,
+			option_tab_callback,
+			NULL, NULL
+		},
+		{
+			"window-with-profile-internal-id",
+			0,
+			G_OPTION_FLAG_HIDDEN,
+			G_OPTION_ARG_CALLBACK,
+			option_window_callback,
+			NULL, NULL
+		},
+		{
+			"tab-with-profile-internal-id",
+			0,
+			G_OPTION_FLAG_HIDDEN,
+			G_OPTION_ARG_CALLBACK,
+			option_tab_callback,
+			NULL, NULL
+		},
+		{
+			"default-working-directory",
+			0,
+			G_OPTION_FLAG_HIDDEN,
+			G_OPTION_ARG_FILENAME,
+			&options->default_working_dir,
+			NULL, NULL,
+		},
+		{
+			"use-factory",
+			0,
+			G_OPTION_FLAG_HIDDEN,
+			G_OPTION_ARG_NONE,
+			&options->use_factory,
+			NULL, NULL
+		},
+		{
+			"startup-id",
+			0,
+			G_OPTION_FLAG_HIDDEN,
+			G_OPTION_ARG_STRING,
+			&options->startup_id,
+			NULL,
+			NULL
+		},
+		/*
+		 * Crappy old compat args
+		 */
+		{
+			"tclass",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"font",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"nologin",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"login",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"foreground",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"background",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"solid",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"bgscroll",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"bgnoscroll",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"shaded",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"noshaded",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"transparent",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"utmp",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"noutmp",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"wtmp",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"nowtmp",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"lastlog",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"nolastlog",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"icon",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"termname",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{
+			"start-factory-server",
+			0,
+			G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
+			G_OPTION_ARG_CALLBACK,
+			unsupported_option_callback,
+			NULL, NULL
+		},
+		{ NULL, 0, 0, 0, NULL, NULL, NULL }
+	};
+
+	GOptionContext *context;
+	GOptionGroup *group;
+
+	context = g_option_context_new (NULL);
+	g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+	g_option_context_set_description (context, N_("MATE Terminal Emulator"));
+
+	group = g_option_group_new ("mate-terminal",
+	                            N_("MATE Terminal Emulator"),
+	                            N_("Show MATE Terminal options"),
+	                            options,
+	                            NULL);
+	g_option_group_set_translation_domain (group, GETTEXT_PACKAGE);
+	g_option_group_add_entries (group, global_unique_goptions);
+	g_option_group_add_entries (group, internal_goptions);
+	g_option_group_set_parse_hooks (group, NULL, digest_options_callback);
+	g_option_context_set_main_group (context, group);
+
+	group = g_option_group_new ("terminal",
+	                            N_("Options to open new windows or terminal tabs; more than one of these may be specified:"),
+	                            N_("Show terminal options"),
+	                            options,
+	                            NULL);
+	g_option_group_set_translation_domain (group, GETTEXT_PACKAGE);
+	g_option_group_add_entries (group, global_multiple_goptions);
+	g_option_context_add_group (context, group);
+
+	group = g_option_group_new ("window-options",
+	                            N_("Window options; if used before the first --window or --tab argument, sets the default for all windows:"),
+	                            N_("Show per-window options"),
+	                            options,
+	                            NULL);
+	g_option_group_set_translation_domain (group, GETTEXT_PACKAGE);
+	g_option_group_add_entries (group, window_goptions);
+	g_option_context_add_group (context, group);
+
+	group = g_option_group_new ("terminal-options",
+	                            N_("Terminal options; if used before the first --window or --tab argument, sets the default for all terminals:"),
+	                            N_("Show per-terminal options"),
+	                            options,
+	                            NULL);
+	g_option_group_set_translation_domain (group, GETTEXT_PACKAGE);
+	g_option_group_add_entries (group, terminal_goptions);
+	g_option_context_add_group (context, group);
+
+	return context;
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/46.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/46.html new file mode 100644 index 0000000..1f188a1 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/46.html @@ -0,0 +1,3621 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
   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
/*
+ * Copyright © 2001 Havoc Pennington
+ * Copyright © 2002 Mathias Hasselmann
+ * Copyright © 2008 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * Mate-terminal 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-app.h"
+#include "terminal-debug.h"
+#include "terminal-intl.h"
+#include "terminal-profile.h"
+#include "terminal-screen.h"
+#include "terminal-type-builtins.h"
+
+/* To add a new key, you need to:
+ *
+ *  - add an entry to the enum below
+ *  - add a #define with its name in terminal-profile.h
+ *  - add a gobject property for it in terminal_profile_class_init
+ *  - if the property's type needs special casing, add that to
+ *    terminal_profile_gsettings_notify_cb and
+ *    terminal_profile_gsettings_changeset_add
+ *  - if necessary the default value cannot be handled via the paramspec,
+ *    handle that in terminal_profile_reset_property_internal
+ */
+enum
+{
+    PROP_0,
+    PROP_ALLOW_BOLD,
+    PROP_BACKGROUND_COLOR,
+    PROP_BACKGROUND_DARKNESS,
+    PROP_BACKGROUND_IMAGE,
+    PROP_BACKGROUND_IMAGE_FILE,
+    PROP_BACKGROUND_TYPE,
+    PROP_BACKSPACE_BINDING,
+    PROP_BOLD_COLOR,
+    PROP_BOLD_COLOR_SAME_AS_FG,
+    PROP_CURSOR_BLINK_MODE,
+    PROP_CURSOR_SHAPE,
+    PROP_CUSTOM_COMMAND,
+    PROP_DEFAULT_SIZE_COLUMNS,
+    PROP_DEFAULT_SIZE_ROWS,
+    PROP_DEFAULT_SHOW_MENUBAR,
+    PROP_DELETE_BINDING,
+    PROP_EXIT_ACTION,
+    PROP_FONT,
+    PROP_FOREGROUND_COLOR,
+    PROP_LOGIN_SHELL,
+    PROP_NAME,
+    PROP_PALETTE,
+    PROP_SCROLL_BACKGROUND,
+    PROP_SCROLLBACK_LINES,
+    PROP_SCROLLBACK_UNLIMITED,
+    PROP_SCROLLBAR_POSITION,
+    PROP_SCROLL_ON_KEYSTROKE,
+    PROP_SCROLL_ON_OUTPUT,
+    PROP_SILENT_BELL,
+    PROP_TITLE,
+    PROP_TITLE_MODE,
+    PROP_USE_CUSTOM_COMMAND,
+    PROP_USE_CUSTOM_DEFAULT_SIZE,
+    PROP_USE_SKEY,
+    PROP_USE_URLS,
+    PROP_USE_SYSTEM_FONT,
+    PROP_USE_THEME_COLORS,
+    PROP_VISIBLE_NAME,
+    PROP_WORD_CHARS,
+    PROP_COPY_SELECTION,
+    LAST_PROP
+};
+
+#define KEY_ALLOW_BOLD "allow-bold"
+#define KEY_BACKGROUND_COLOR "background-color"
+#define KEY_BACKGROUND_DARKNESS "background-darkness"
+#define KEY_BACKGROUND_IMAGE_FILE "background-image"
+#define KEY_BACKGROUND_TYPE "background-type"
+#define KEY_BACKSPACE_BINDING "backspace-binding"
+#define KEY_BOLD_COLOR "bold-color"
+#define KEY_BOLD_COLOR_SAME_AS_FG "bold-color-same-as-fg"
+#define KEY_CURSOR_BLINK_MODE "cursor-blink-mode"
+#define KEY_CURSOR_SHAPE "cursor-shape"
+#define KEY_CUSTOM_COMMAND "custom-command"
+#define KEY_DEFAULT_SHOW_MENUBAR "default-show-menubar"
+#define KEY_DEFAULT_SIZE_COLUMNS "default-size-columns"
+#define KEY_DEFAULT_SIZE_ROWS "default-size-rows"
+#define KEY_DELETE_BINDING "delete-binding"
+#define KEY_EXIT_ACTION "exit-action"
+#define KEY_FONT "font"
+#define KEY_FOREGROUND_COLOR "foreground-color"
+#define KEY_LOGIN_SHELL "login-shell"
+#define KEY_PALETTE "palette"
+#define KEY_SCROLL_BACKGROUND "scroll-background"
+#define KEY_SCROLLBACK_LINES "scrollback-lines"
+#define KEY_SCROLLBACK_UNLIMITED "scrollback-unlimited"
+#define KEY_SCROLLBAR_POSITION "scrollbar-position"
+#define KEY_SCROLL_ON_KEYSTROKE "scroll-on-keystroke"
+#define KEY_SCROLL_ON_OUTPUT "scroll-on-output"
+#define KEY_SILENT_BELL "silent-bell"
+#define KEY_COPY_SELECTION "copy-selection"
+#define KEY_TITLE_MODE "title-mode"
+#define KEY_TITLE "title"
+#define KEY_USE_CUSTOM_COMMAND "use-custom-command"
+#define KEY_USE_CUSTOM_DEFAULT_SIZE "use-custom-default-size"
+#define KEY_USE_SKEY "use-skey"
+#define KEY_USE_URLS "use-urls"
+#define KEY_USE_SYSTEM_FONT "use-system-font"
+#define KEY_USE_THEME_COLORS "use-theme-colors"
+#define KEY_VISIBLE_NAME "visible-name"
+#define KEY_WORD_CHARS "word-chars"
+
+/* Keep these in sync with the GSettings schema! */
+#define DEFAULT_ALLOW_BOLD            (TRUE)
+#define DEFAULT_BACKGROUND_COLOR      ("#FFFFDD")
+#define DEFAULT_BOLD_COLOR_SAME_AS_FG (TRUE)
+#define DEFAULT_BACKGROUND_DARKNESS   (0.5)
+#define DEFAULT_BACKGROUND_IMAGE_FILE ("")
+#define DEFAULT_BACKGROUND_TYPE       (TERMINAL_BACKGROUND_SOLID)
+#define DEFAULT_BACKSPACE_BINDING     (VTE_ERASE_ASCII_DELETE)
+#define DEFAULT_CURSOR_BLINK_MODE     (VTE_CURSOR_BLINK_SYSTEM)
+#define DEFAULT_CURSOR_SHAPE          (VTE_CURSOR_SHAPE_BLOCK)
+#define DEFAULT_CUSTOM_COMMAND        ("")
+#define DEFAULT_DEFAULT_SHOW_MENUBAR  (TRUE)
+#define DEFAULT_DEFAULT_SIZE_COLUMNS  (80)
+#define DEFAULT_DEFAULT_SIZE_ROWS     (24)
+#define DEFAULT_DELETE_BINDING        (VTE_ERASE_DELETE_SEQUENCE)
+#define DEFAULT_EXIT_ACTION           (TERMINAL_EXIT_CLOSE)
+#define DEFAULT_FONT                  ("Monospace 12")
+#define DEFAULT_FOREGROUND_COLOR      ("#000000")
+#define DEFAULT_LOGIN_SHELL           (FALSE)
+#define DEFAULT_NAME                  (NULL)
+#define DEFAULT_PALETTE               (terminal_palettes[TERMINAL_PALETTE_TANGO])
+#define DEFAULT_SCROLL_BACKGROUND     (TRUE)
+#define DEFAULT_SCROLLBACK_LINES      (512)
+#define DEFAULT_SCROLLBACK_UNLIMITED  (FALSE)
+#define DEFAULT_SCROLLBAR_POSITION    (TERMINAL_SCROLLBAR_RIGHT)
+#define DEFAULT_SCROLL_ON_KEYSTROKE   (TRUE)
+#define DEFAULT_SCROLL_ON_OUTPUT      (FALSE)
+#define DEFAULT_SILENT_BELL           (FALSE)
+#define DEFAULT_COPY_SELECTION        (FALSE)
+#define DEFAULT_TITLE_MODE            (TERMINAL_TITLE_REPLACE)
+#define DEFAULT_TITLE                 (N_("Terminal"))
+#define DEFAULT_USE_CUSTOM_COMMAND    (FALSE)
+#define DEFAULT_USE_CUSTOM_DEFAULT_SIZE (FALSE)
+#define DEFAULT_USE_SKEY              (TRUE)
+#define DEFAULT_USE_URLS              (TRUE)
+#define DEFAULT_USE_SYSTEM_FONT       (TRUE)
+#define DEFAULT_USE_THEME_COLORS      (TRUE)
+#define DEFAULT_VISIBLE_NAME          (N_("Unnamed"))
+#define DEFAULT_WORD_CHARS            ("-A-Za-z0-9,./?%&#:_=+@~")
+
+struct _TerminalProfilePrivate
+{
+	GValueArray *properties;
+	gboolean *locked;
+
+	GSettings *settings;
+	char *profile_dir;
+
+	GSList *dirty_pspecs;
+	guint save_idle_id;
+
+	GParamSpec *gsettings_notification_pspec;
+
+	gboolean background_load_failed;
+
+	guint forgotten : 1;
+};
+
+static const GdkRGBA terminal_palettes[TERMINAL_PALETTE_N_BUILTINS][TERMINAL_PALETTE_SIZE] =
+{
+	/* Tango palette */
+	{
+		{ 0,         0,        0,         1 },
+		{ 0.8,       0,        0,         1 },
+		{ 0.305882,  0.603922, 0.0235294, 1 },
+		{ 0.768627,  0.627451, 0,         1 },
+		{ 0.203922,  0.396078, 0.643137,  1 },
+		{ 0.458824,  0.313725, 0.482353,  1 },
+		{ 0.0235294, 0.596078, 0.603922,  1 },
+		{ 0.827451,  0.843137, 0.811765,  1 },
+		{ 0.333333,  0.341176, 0.32549,   1 },
+		{ 0.937255,  0.160784, 0.160784,  1 },
+		{ 0.541176,  0.886275, 0.203922,  1 },
+		{ 0.988235,  0.913725, 0.309804,  1 },
+		{ 0.447059,  0.623529, 0.811765,  1 },
+		{ 0.678431,  0.498039, 0.658824,  1 },
+		{ 0.203922,  0.886275, 0.886275,  1 },
+		{ 0.933333,  0.933333, 0.92549,   1 },
+	},
+
+	/* Linux palette */
+	{
+		{ 0,        0,        0,        1 },
+		{ 0.666667, 0,        0,        1 },
+		{ 0,        0.666667, 0,        1 },
+		{ 0.666667, 0.333333, 0,        1 },
+		{ 0,        0,        0.666667, 1 },
+		{ 0.666667, 0,        0.666667, 1 },
+		{ 0,        0.666667, 0.666667, 1 },
+		{ 0.666667, 0.666667, 0.666667, 1 },
+		{ 0.333333, 0.333333, 0.333333, 1 },
+		{ 1,        0.333333, 0.333333, 1 },
+		{ 0.333333, 1,        0.333333, 1 },
+		{ 1,        1,        0.333333, 1 },
+		{ 0.333333, 0.333333, 1,        1 },
+		{ 1,        0.333333, 1,        1 },
+		{ 0.333333, 1,        1,        1 },
+		{ 1,        1,        1,        1 },
+	},
+
+	/* XTerm palette */
+	{
+		{ 0,        0,        0,        1 },
+		{ 0.803922, 0,        0,        1 },
+		{ 0,        0.803922, 0,        1 },
+		{ 0.803922, 0.803922, 0,        1 },
+		{ 0.117647, 0.564706, 1,        1 },
+		{ 0.803922, 0,        0.803922, 1 },
+		{ 0,        0.803922, 0.803922, 1 },
+		{ 0.898039, 0.898039, 0.898039, 1 },
+		{ 0.298039, 0.298039, 0.298039, 1 },
+		{ 1,        0,        0,        1 },
+		{ 0,        1,        0,        1 },
+		{ 1,        1,        0,        1 },
+		{ 0.27451,  0.509804, 0.705882, 1 },
+		{ 1,        0,        1,        1 },
+		{ 0,        1,        1,        1 },
+		{ 1,        1,        1,        1 },
+	},
+
+	/* RXVT palette */
+	{
+		{ 0,        0,        0,        1 },
+		{ 0.803922, 0,        0,        1 },
+		{ 0,        0.803922, 0,        1 },
+		{ 0.803922, 0.803922, 0,        1 },
+		{ 0,        0,        0.803922, 1 },
+		{ 0.803922, 0,        0.803922, 1 },
+		{ 0,        0.803922, 0.803922, 1 },
+		{ 0.980392, 0.921569, 0.843137, 1 },
+		{ 0.25098,  0.25098,  0.25098,  1 },
+		{ 1, 0, 0, 1 },
+		{ 0, 1, 0, 1 },
+		{ 1, 1, 0, 1 },
+		{ 0, 0, 1, 1 },
+		{ 1, 0, 1, 1 },
+		{ 0, 1, 1, 1 },
+		{ 1, 1, 1, 1 },
+	},
+
+	/* Solarized palette (1.0.0beta2): http://ethanschoonover.com/solarized */
+	{
+		{ 0.02745,  0.211764, 0.258823, 1 },
+		{ 0.862745, 0.196078, 0.184313, 1 },
+		{ 0.521568, 0.6,      0,        1 },
+		{ 0.709803, 0.537254, 0,        1 },
+		{ 0.149019, 0.545098, 0.823529, 1 },
+		{ 0.82745,  0.211764, 0.509803, 1 },
+		{ 0.164705, 0.631372, 0.596078, 1 },
+		{ 0.933333, 0.909803, 0.835294, 1 },
+		{ 0,        0.168627, 0.211764, 1 },
+		{ 0.796078, 0.294117, 0.086274, 1 },
+		{ 0.345098, 0.431372, 0.458823, 1 },
+		{ 0.396078, 0.482352, 0.513725, 1 },
+		{ 0.513725, 0.580392, 0.588235, 1 },
+		{ 0.423529, 0.443137, 0.768627, 1 },
+		{ 0.57647,  0.631372, 0.631372, 1 },
+		{ 0.992156, 0.964705, 0.890196, 1 },
+	},
+};
+
+enum
+{
+    FORGOTTEN,
+    LAST_SIGNAL
+};
+
+static void terminal_profile_finalize    (GObject              *object);
+static void terminal_profile_set_property (GObject *object,
+        guint prop_id,
+        const GValue *value,
+        GParamSpec *pspec);
+static void ensure_pixbuf_property (TerminalProfile *profile,
+                                    guint path_prop_id,
+                                    guint pixbuf_prop_id,
+                                    gboolean *load_failed);
+
+static guint signals[LAST_SIGNAL] = { 0 };
+static GQuark gsettings_key_quark;
+
+G_DEFINE_TYPE_WITH_PRIVATE (TerminalProfile, terminal_profile, G_TYPE_OBJECT);
+
+/* gdk_rgba_equal is too strict! */
+static gboolean
+rgba_equal (const GdkRGBA *a,
+            const GdkRGBA *b)
+{
+    gdouble dr, dg, db, da;
+
+    dr = a->red - b->red;
+    dg = a->green - b->green;
+    db = a->blue - b->blue;
+    da = a->alpha - b->alpha;
+
+    return (dr * dr + dg * dg + db * db + da * da) < 1e-4;
+}
+
+static gboolean
+palette_cmp (const GdkRGBA *ca,
+             const GdkRGBA *cb)
+{
+    guint i;
+
+    for (i = 0; i < TERMINAL_PALETTE_SIZE; ++i)
+        if (!rgba_equal (&ca[i], &cb[i]))
+            return FALSE;
+
+    return TRUE;
+}
+
+static GParamSpec *
+get_pspec_from_name (TerminalProfile *profile,
+                     const char *prop_name)
+{
+	TerminalProfileClass *klass = TERMINAL_PROFILE_GET_CLASS (profile);
+	GParamSpec *pspec;
+
+	pspec = g_object_class_find_property (G_OBJECT_CLASS (klass), prop_name);
+	if (pspec &&
+	        pspec->owner_type != TERMINAL_TYPE_PROFILE)
+		pspec = NULL;
+
+	return pspec;
+}
+
+static const GValue *
+get_prop_value_from_prop_name (TerminalProfile *profile,
+                               const char *prop_name)
+{
+	TerminalProfilePrivate *priv = profile->priv;
+	GParamSpec *pspec;
+
+	pspec = get_pspec_from_name (profile, prop_name);
+	if (!pspec)
+		return NULL;
+
+	if (G_UNLIKELY (pspec->param_id == PROP_BACKGROUND_IMAGE))
+		ensure_pixbuf_property (profile, PROP_BACKGROUND_IMAGE_FILE, PROP_BACKGROUND_IMAGE, &priv->background_load_failed);
+
+	return g_value_array_get_nth (priv->properties, pspec->param_id);
+}
+
+static void
+set_value_from_palette (GValue *ret_value,
+                        const GdkRGBA *colors,
+                        guint n_colors)
+{
+	GValueArray *array;
+	guint i, max_n_colors;
+
+	max_n_colors = MAX (n_colors, TERMINAL_PALETTE_SIZE);
+	array = g_value_array_new (max_n_colors);
+	for (i = 0; i < max_n_colors; ++i)
+		g_value_array_append (array, NULL);
+
+	for (i = 0; i < n_colors; ++i)
+	{
+		GValue *value = g_value_array_get_nth (array, i);
+
+		g_value_init (value, GDK_TYPE_RGBA);
+		g_value_set_boxed (value, &colors[i]);
+	}
+
+	/* If we haven't enough colours yet, fill up with the default palette */
+	for (i = n_colors; i < TERMINAL_PALETTE_SIZE; ++i)
+	{
+		GValue *value = g_value_array_get_nth (array, i);
+
+		g_value_init (value, GDK_TYPE_RGBA);
+		g_value_set_boxed (value, &DEFAULT_PALETTE[i]);
+	}
+
+	g_value_take_boxed (ret_value, array);
+}
+
+static int
+values_equal (GParamSpec *pspec,
+              const GValue *va,
+              const GValue *vb)
+{
+	/* g_param_values_cmp isn't good enough for some types, since e.g.
+	 * it compares colours and font descriptions by pointer value, not
+	 * with the correct compare functions. Providing extra
+	 * PangoParamSpecFontDescription and GdkParamSpecColor wouldn't
+	 * have fixed this either, since it's unclear how to _order_ them.
+	 * Luckily we only need to check them for equality here.
+	 */
+
+	if (g_param_values_cmp (pspec, va, vb) == 0)
+		return TRUE;
+
+	if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GDK_TYPE_RGBA)
+		return rgba_equal (g_value_get_boxed (va), g_value_get_boxed (vb));
+
+	if (G_PARAM_SPEC_VALUE_TYPE (pspec) == PANGO_TYPE_FONT_DESCRIPTION)
+		return pango_font_description_equal (g_value_get_boxed (va), g_value_get_boxed (vb));
+
+	if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec) &&
+	        G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec) == GDK_TYPE_RGBA)
+	{
+		GValueArray *ara, *arb;
+		guint i;
+
+		ara = g_value_get_boxed (va);
+		arb = g_value_get_boxed (vb);
+
+		if (!ara || !arb || ara->n_values != arb->n_values)
+			return FALSE;
+
+		for (i = 0; i < ara->n_values; ++i)
+			if (!rgba_equal (g_value_get_boxed (g_value_array_get_nth (ara, i)),
+			                      g_value_get_boxed (g_value_array_get_nth (arb, i))))
+				return FALSE;
+
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+static void
+ensure_pixbuf_property (TerminalProfile *profile,
+                        guint path_prop_id,
+                        guint pixbuf_prop_id,
+                        gboolean *load_failed)
+{
+	TerminalProfilePrivate *priv = profile->priv;
+	GValue *path_value, *pixbuf_value;
+	GdkPixbuf *pixbuf;
+	const char *path_utf8;
+	char *path;
+	GError *error = NULL;
+
+	pixbuf_value = g_value_array_get_nth (priv->properties, pixbuf_prop_id);
+
+	pixbuf = g_value_get_object (pixbuf_value);
+	if (pixbuf)
+		return;
+
+	if (*load_failed)
+		return;
+
+	path_value = g_value_array_get_nth (priv->properties, path_prop_id);
+	path_utf8 = g_value_get_string (path_value);
+	if (!path_utf8 || !path_utf8[0])
+		goto failed;
+
+	path = g_filename_from_utf8 (path_utf8, -1, NULL, NULL, NULL);
+	if (!path)
+		goto failed;
+
+	pixbuf = gdk_pixbuf_new_from_file (path, &error);
+	if (!pixbuf)
+	{
+		_terminal_debug_print (TERMINAL_DEBUG_PROFILE,
+		                       "Failed to load image \"%s\": %s\n",
+		                       path, error->message);
+
+		g_error_free (error);
+		g_free (path);
+		goto failed;
+	}
+
+	g_value_take_object (pixbuf_value, pixbuf);
+	g_free (path);
+	return;
+
+failed:
+	*load_failed = TRUE;
+}
+
+static void
+terminal_profile_reset_property_internal (TerminalProfile *profile,
+        GParamSpec *pspec,
+        gboolean notify)
+{
+	TerminalProfilePrivate *priv = profile->priv;
+	GValue value_ = { 0, };
+	GValue *value;
+
+	if (notify)
+	{
+		value = &value_;
+		g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec));
+	}
+	else
+		value = g_value_array_get_nth (priv->properties, pspec->param_id);
+	g_assert (value != NULL);
+
+	/* A few properties don't have defaults via the param spec; set them explicitly */
+	switch (pspec->param_id)
+	{
+		case PROP_FOREGROUND_COLOR:
+		case PROP_BOLD_COLOR:
+		{
+			GdkRGBA color;
+
+			if (!gdk_rgba_parse (&color, DEFAULT_FOREGROUND_COLOR))
+				return;
+			color.alpha = 1.0;
+			g_value_set_boxed (value, &color);
+			break;
+		}
+		case PROP_BACKGROUND_COLOR:
+		{
+			GdkRGBA color;
+
+			if (!gdk_rgba_parse (&color, DEFAULT_BACKGROUND_COLOR))
+				return;
+			color.alpha = 1.0;
+			g_value_set_boxed (value, &color);
+			break;
+		}
+		case PROP_FONT:
+			g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_FONT));
+			break;
+
+		case PROP_PALETTE:
+			set_value_from_palette (value, DEFAULT_PALETTE, TERMINAL_PALETTE_SIZE);
+			break;
+
+		default:
+			g_param_value_set_default (pspec, value);
+			break;
+	}
+
+	if (notify)
+	{
+		g_object_set_property (G_OBJECT (profile), pspec->name, value);
+		g_value_unset (value);
+	}
+}
+
+static void
+terminal_profile_gsettings_notify_cb (GSettings *settings,
+                                      gchar *key,
+                                      gpointer     user_data)
+{
+	TerminalProfile *profile = TERMINAL_PROFILE (user_data);
+	TerminalProfilePrivate *priv = profile->priv;
+	TerminalProfileClass *klass;
+	GVariant *settings_value;
+	GParamSpec *pspec;
+	GValue value = { 0, };
+	gboolean equal;
+	gboolean force_set = FALSE;
+
+	if (!key) return;
+
+	_terminal_debug_print (TERMINAL_DEBUG_PROFILE,
+	                       "GSettings notification for key %s [%s]\n",
+	                       key,
+	                       g_settings_is_writable (settings, key) ? "writable" : "LOCKED");
+
+	klass = TERMINAL_PROFILE_GET_CLASS (profile);
+	pspec = g_hash_table_lookup (klass->gsettings_keys, key);
+	if (!pspec)
+		return; /* ignore unknown keys, for future extensibility */
+
+	priv->locked[pspec->param_id] = !g_settings_is_writable (settings, key);
+
+	settings_value = g_settings_get_value (settings, key);
+	if (!settings_value)
+		return;
+
+	g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
+
+	if (G_IS_PARAM_SPEC_BOOLEAN (pspec))
+	{
+		if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_BOOLEAN))
+			goto out;
+
+		g_value_set_boolean (&value, g_variant_get_boolean (settings_value));
+	}
+	else if (G_IS_PARAM_SPEC_STRING (pspec))
+	{
+		if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING))
+			goto out;
+
+		g_value_set_string (&value, g_variant_get_string (settings_value, NULL));
+	}
+	else if (G_IS_PARAM_SPEC_ENUM (pspec))
+	{
+
+		if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING))
+			goto out;
+
+		g_value_set_enum (&value, g_settings_get_enum (settings, key));
+	}
+	else if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GDK_TYPE_RGBA)
+	{
+		GdkRGBA color;
+
+		if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING))
+			goto out;
+
+		if (!gdk_rgba_parse (&color, g_variant_get_string (settings_value, NULL)))
+			goto out;
+
+		g_value_set_boxed (&value, &color);
+	}
+	else if (G_PARAM_SPEC_VALUE_TYPE (pspec) == PANGO_TYPE_FONT_DESCRIPTION)
+	{
+		if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING))
+			goto out;
+
+		g_value_take_boxed (&value, pango_font_description_from_string (g_variant_get_string (settings_value, NULL)));
+	}
+	else if (G_IS_PARAM_SPEC_DOUBLE (pspec))
+	{
+		if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_DOUBLE))
+			goto out;
+
+		g_value_set_double (&value, g_variant_get_double (settings_value));
+	}
+	else if (G_IS_PARAM_SPEC_INT (pspec))
+	{
+		if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT16) &&
+		    !g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT32) &&
+		    !g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT64))
+			goto out;
+
+		g_value_set_int (&value, g_settings_get_int(settings, key));
+	}
+	else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec) &&
+	         G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec) == GDK_TYPE_RGBA)
+	{
+		char **color_strings;
+		GdkRGBA *colors;
+		int n_colors, i;
+
+		if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING))
+			goto out;
+
+		color_strings = g_strsplit (g_variant_get_string (settings_value, NULL), ":", -1);
+		if (!color_strings)
+			goto out;
+
+		n_colors = g_strv_length (color_strings);
+		colors = g_new0 (GdkRGBA, n_colors);
+		for (i = 0; i < n_colors; ++i)
+		{
+			if (!gdk_rgba_parse (&colors[i], color_strings[i]))
+				continue; /* ignore errors */
+		}
+		g_strfreev (color_strings);
+
+		/* We continue even with a palette size != TERMINAL_PALETTE_SIZE,
+		 * so we can change the palette size in future versions without
+		 * causing too many issues.
+		 */
+		set_value_from_palette (&value, colors, n_colors);
+		g_free (colors);
+	}
+	else
+	{
+		g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)), pspec->name);
+		goto out;
+	}
+
+	if (g_param_value_validate (pspec, &value))
+	{
+		_terminal_debug_print (TERMINAL_DEBUG_PROFILE,
+		                       "Invalid value in GSettings for key %s was changed to comply with pspec %s\n",
+		                       key, pspec->name);
+
+		force_set = TRUE;
+	}
+
+	/* Only set the property if the value is different than our current value,
+	 * so we don't go into an infinite loop.
+	 */
+	equal = values_equal (pspec, &value, g_value_array_get_nth (priv->properties, pspec->param_id));
+#ifdef MATE_ENABLE_DEBUG
+	_TERMINAL_DEBUG_IF (TERMINAL_DEBUG_PROFILE)
+	{
+		if (!equal)
+			_terminal_debug_print (TERMINAL_DEBUG_PROFILE,
+			                       "Setting property %s to a different value\n"
+			                       "  now: %s\n"
+			                       "  new: %s\n",
+			                       pspec->name,
+			                       g_strdup_value_contents (g_value_array_get_nth (priv->properties, pspec->param_id)),
+			                       g_strdup_value_contents (&value));
+	}
+#endif
+
+	if (!equal || force_set)
+	{
+		priv->gsettings_notification_pspec = pspec;
+		g_object_set_property (G_OBJECT (profile), pspec->name, &value);
+		priv->gsettings_notification_pspec = NULL;
+	}
+
+out:
+	/* FIXME: if we arrive here through goto in the error cases,
+	 * should we maybe reset the property to its default value?
+	 */
+
+	g_value_unset (&value);
+	g_variant_unref (settings_value);
+}
+
+static void
+terminal_profile_gsettings_changeset_add (TerminalProfile *profile,
+        GSettings *changeset,
+        GParamSpec *pspec)
+{
+	TerminalProfilePrivate *priv = profile->priv;
+	char *key;
+	const GValue *value;
+
+	/* FIXME: do this? */
+#if 0
+	if (priv->locked[pspec->param_id])
+		return;
+
+	if (!g_settings_is_writable (priv->settings, gsettings_key, NULL))
+		return;
+#endif
+
+	key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
+	if (!key)
+		return;
+
+	value = g_value_array_get_nth (priv->properties, pspec->param_id);
+
+	_terminal_debug_print (TERMINAL_DEBUG_PROFILE,
+	                       "Adding pspec %s with value %s to the GSettings changeset\n",
+	                       pspec->name, g_strdup_value_contents (value));
+
+	if (G_IS_PARAM_SPEC_BOOLEAN (pspec))
+		g_settings_set_boolean (changeset, key, g_value_get_boolean (value));
+	else if (G_IS_PARAM_SPEC_STRING (pspec))
+	{
+		const char *str;
+
+		str = g_value_get_string (value);
+		g_settings_set_string (changeset, key, str ? str : "");
+	}
+	else if (G_IS_PARAM_SPEC_ENUM (pspec))
+	{
+		const GEnumValue *eval;
+
+		eval = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)->enum_class, g_value_get_enum (value));
+
+		g_settings_set_enum (changeset, key, eval->value);
+	}
+	else if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GDK_TYPE_RGBA)
+	{
+		GdkRGBA *color;
+		char str[16];
+
+		color = g_value_get_boxed (value);
+		if (!color)
+			goto cleanup;
+
+		g_snprintf (str, sizeof (str),
+		            "#%04X%04X%04X",
+		            (guint) (color->red * 65535),
+		            (guint) (color->green * 65535),
+		            (guint) (color->blue * 65535));
+
+		g_settings_set_string (changeset, key, str);
+	}
+	else if (G_PARAM_SPEC_VALUE_TYPE (pspec) == PANGO_TYPE_FONT_DESCRIPTION)
+	{
+		PangoFontDescription *font_desc;
+		char *font;
+
+		font_desc = g_value_get_boxed (value);
+		if (!font_desc)
+			goto cleanup;
+
+		font = pango_font_description_to_string (font_desc);
+		g_settings_set_string (changeset, key, font);
+		g_free (font);
+	}
+	else if (G_IS_PARAM_SPEC_DOUBLE (pspec))
+		g_settings_set_double (changeset, key, g_value_get_double (value));
+	else if (G_IS_PARAM_SPEC_INT (pspec))
+		g_settings_set_int (changeset, key, g_value_get_int (value));
+	else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec) &&
+	         G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec) == GDK_TYPE_RGBA)
+	{
+		GValueArray *array;
+		GString *string;
+		guint n_colors, i;
+
+		/* We need to do this ourselves, because the gtk_color_selection_palette_to_string
+		 * does not carry all the bytes, and xterm's palette is messed up...
+		 */
+
+		array = g_value_get_boxed (value);
+		if (!array)
+			goto cleanup;
+
+		n_colors = array->n_values;
+		string = g_string_sized_new (n_colors * (1 /* # */ + 3 * 4) + n_colors /* : separators and terminating \0 */);
+		for (i = 0; i < n_colors; ++i)
+		{
+			GdkRGBA *color;
+
+			if (i > 0)
+				g_string_append_c (string, ':');
+
+			color = g_value_get_boxed (g_value_array_get_nth (array, i));
+			if (!color)
+				continue;
+
+			g_string_append_printf (string,
+			                        "#%04X%04X%04X",
+			                        (guint) (color->red * 65535),
+			                        (guint) (color->green * 65535),
+			                        (guint) (color->blue * 65535));
+		}
+
+		g_settings_set_string (changeset, key, string->str);
+		g_string_free (string, TRUE);
+	}
+	else
+		g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)), pspec->name);
+
+cleanup:
+	return;
+}
+
+static void
+terminal_profile_save (TerminalProfile *profile)
+{
+	TerminalProfilePrivate *priv = profile->priv;
+	GSettings *changeset;
+	GSList *l;
+	gchar *concat;
+
+	priv->save_idle_id = 0;
+	concat = g_strconcat (CONF_PROFILE_PREFIX, priv->profile_dir,"/", NULL);
+	changeset = g_settings_new_with_path (CONF_PROFILE_SCHEMA, concat);
+	g_free (concat);
+	g_settings_delay (changeset);
+
+	for (l = priv->dirty_pspecs; l != NULL; l = l->next)
+	{
+		GParamSpec *pspec = (GParamSpec *) l->data;
+
+		if (pspec->owner_type != TERMINAL_TYPE_PROFILE)
+			continue;
+
+		if ((pspec->flags & G_PARAM_WRITABLE) == 0)
+			continue;
+
+		terminal_profile_gsettings_changeset_add (profile, changeset, pspec);
+	}
+
+	g_slist_free (priv->dirty_pspecs);
+	priv->dirty_pspecs = NULL;
+
+	g_settings_apply (changeset);
+	g_object_unref (changeset);
+}
+
+static gboolean
+terminal_profile_save_idle_cb (TerminalProfile *profile)
+{
+	terminal_profile_save (profile);
+
+	/* don't run again */
+	return FALSE;
+}
+
+static void
+terminal_profile_schedule_save (TerminalProfile *profile,
+                                GParamSpec *pspec)
+{
+	TerminalProfilePrivate *priv = profile->priv;
+
+	g_assert (pspec != NULL);
+
+	if (!g_slist_find (priv->dirty_pspecs, pspec))
+		priv->dirty_pspecs = g_slist_prepend (priv->dirty_pspecs, pspec);
+
+	if (priv->save_idle_id != 0)
+		return;
+
+	priv->save_idle_id = g_idle_add ((GSourceFunc) terminal_profile_save_idle_cb, profile);
+}
+
+static void
+terminal_profile_init (TerminalProfile *profile)
+{
+	TerminalProfilePrivate *priv;
+	GObjectClass *object_class;
+	GParamSpec **pspecs;
+	guint n_pspecs, i;
+
+	priv = profile->priv = terminal_profile_get_instance_private (profile);
+
+	priv->gsettings_notification_pspec = NULL;
+	priv->locked = g_new0 (gboolean, LAST_PROP);
+
+	priv->properties = g_value_array_new (LAST_PROP);
+	for (i = 0; i < LAST_PROP; ++i)
+		g_value_array_append (priv->properties, NULL);
+
+	pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile)), &n_pspecs);
+	for (i = 0; i < n_pspecs; ++i)
+	{
+		GParamSpec *pspec = pspecs[i];
+		GValue *value;
+
+		if (pspec->owner_type != TERMINAL_TYPE_PROFILE)
+			continue;
+
+		g_assert (pspec->param_id < LAST_PROP);
+		value = g_value_array_get_nth (priv->properties, pspec->param_id);
+		g_value_init (value, pspec->value_type);
+		g_param_value_set_default (pspec, value);
+	}
+
+	g_free (pspecs);
+
+	/* A few properties don't have defaults via the param spec; set them explicitly */
+	object_class = G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile));
+	terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_FOREGROUND_COLOR), FALSE);
+	terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_BOLD_COLOR), FALSE);
+	terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_BACKGROUND_COLOR), FALSE);
+	terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_FONT), FALSE);
+	terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_PALETTE), FALSE);
+}
+
+static GObject *
+terminal_profile_constructor (GType type,
+                              guint n_construct_properties,
+                              GObjectConstructParam *construct_params)
+{
+	GObject *object;
+	TerminalProfile *profile;
+	TerminalProfilePrivate *priv;
+	const char *name;
+	GParamSpec **pspecs;
+	guint n_pspecs, i;
+	gchar *concat;
+
+	object = G_OBJECT_CLASS (terminal_profile_parent_class)->constructor
+	         (type, n_construct_properties, construct_params);
+
+	profile = TERMINAL_PROFILE (object);
+	priv = profile->priv;
+
+	name = g_value_get_string (g_value_array_get_nth (priv->properties, PROP_NAME));
+	g_assert (name != NULL);
+
+	concat = g_strconcat (CONF_PROFILE_PREFIX, name, "/", NULL);
+	priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA, concat);
+	g_assert (priv->settings != NULL);
+	g_free (concat);
+	concat = g_strconcat("changed::", priv->profile_dir, "/", NULL);
+	g_signal_connect (priv->settings,
+			  concat,
+			  G_CALLBACK(terminal_profile_gsettings_notify_cb),
+			  profile);
+
+	g_free (concat);
+
+	/* Now load those properties from GSettings that were not set as construction params */
+	pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile)), &n_pspecs);
+	for (i = 0; i < n_pspecs; ++i)
+	{
+		GParamSpec *pspec = pspecs[i];
+		guint j;
+		gboolean is_construct = FALSE;
+		char *key;
+
+		if (pspec->owner_type != TERMINAL_TYPE_PROFILE)
+			continue;
+
+		if ((pspec->flags & G_PARAM_WRITABLE) == 0 ||
+		        (pspec->flags & G_PARAM_CONSTRUCT_ONLY) != 0)
+			continue;
+
+		for (j = 0; j < n_construct_properties; ++j)
+			if (pspec == construct_params[j].pspec)
+			{
+				is_construct = TRUE;
+				break;
+			}
+
+		if (is_construct)
+			continue;
+
+		key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
+		if (!key)
+			continue;
+
+		terminal_profile_gsettings_notify_cb (priv->settings, key,  profile);
+	}
+
+	g_free (pspecs);
+
+	return object;
+}
+
+static void
+terminal_profile_finalize (GObject *object)
+{
+	TerminalProfile *profile = TERMINAL_PROFILE (object);
+	TerminalProfilePrivate *priv = profile->priv;
+
+	g_signal_handlers_disconnect_by_func (priv->settings,
+		G_CALLBACK(terminal_profile_gsettings_notify_cb),
+		profile);
+
+	if (priv->save_idle_id)
+	{
+		g_source_remove (priv->save_idle_id);
+
+		/* Save now */
+		terminal_profile_save (profile);
+	}
+
+	_terminal_profile_forget (profile);
+
+	g_object_unref (priv->settings);
+
+	g_free (priv->profile_dir);
+	g_free (priv->locked);
+	g_value_array_free (priv->properties);
+
+	G_OBJECT_CLASS (terminal_profile_parent_class)->finalize (object);
+}
+
+static void
+terminal_profile_get_property (GObject *object,
+                               guint prop_id,
+                               GValue *value,
+                               GParamSpec *pspec)
+{
+	TerminalProfile *profile = TERMINAL_PROFILE (object);
+	TerminalProfilePrivate *priv = profile->priv;
+
+	if (prop_id == 0 || prop_id >= LAST_PROP)
+	{
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		return;
+	}
+
+	/* Note: When adding things here, do the same in get_prop_value_from_prop_name! */
+	switch (prop_id)
+	{
+	case PROP_BACKGROUND_IMAGE:
+		ensure_pixbuf_property (profile, PROP_BACKGROUND_IMAGE_FILE, PROP_BACKGROUND_IMAGE, &priv->background_load_failed);
+		break;
+	default:
+		break;
+	}
+
+	g_value_copy (g_value_array_get_nth (priv->properties, prop_id), value);
+}
+
+static void
+terminal_profile_set_property (GObject *object,
+                               guint prop_id,
+                               const GValue *value,
+                               GParamSpec *pspec)
+{
+	TerminalProfile *profile = TERMINAL_PROFILE (object);
+	TerminalProfilePrivate *priv = profile->priv;
+	GValue *prop_value;
+
+	if (prop_id == 0 || prop_id >= LAST_PROP)
+	{
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		return;
+	}
+
+	prop_value = g_value_array_get_nth (priv->properties, prop_id);
+
+	/* Preprocessing */
+	switch (prop_id)
+	{
+#if 0
+	case PROP_FONT:
+	{
+		PangoFontDescription *font_desc, *new_font_desc;
+
+		font_desc = g_value_get_boxed (prop_value);
+		new_font_desc = g_value_get_boxed (value);
+
+		if (font_desc && new_font_desc)
+		{
+			/* Merge in case the new string isn't complete enough to load a font */
+			pango_font_description_merge (font_desc, new_font_desc, TRUE);
+			pango_font_description_free (new_font_desc);
+			break;
+		}
+
+		/* fall-through */
+	}
+#endif
+	default:
+		g_value_copy (value, prop_value);
+		break;
+	}
+
+	/* Postprocessing */
+	switch (prop_id)
+	{
+	case PROP_NAME:
+	{
+		const char *name = g_value_get_string (value);
+
+		g_assert (name != NULL);
+		priv->profile_dir = g_strdup (name);
+		if (priv->settings != NULL) {
+			gchar *concat;
+			g_signal_handlers_disconnect_by_func (priv->settings,
+							      G_CALLBACK(terminal_profile_gsettings_notify_cb),
+							      profile);
+			g_object_unref (priv->settings);
+			concat=  g_strconcat (CONF_PROFILE_PREFIX, priv->profile_dir, "/", NULL);
+			priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA, concat);
+			g_free (concat);
+			concat = g_strconcat("changed::", priv->profile_dir, "/", NULL);
+			g_signal_connect (priv->settings,
+					  concat,
+					  G_CALLBACK(terminal_profile_gsettings_notify_cb),
+					  profile);
+			g_free (concat);
+		}
+		break;
+	}
+
+	case PROP_BACKGROUND_IMAGE_FILE:
+		/* Clear the cached image */
+		g_value_set_object (g_value_array_get_nth (priv->properties, PROP_BACKGROUND_IMAGE), NULL);
+		priv->background_load_failed = FALSE;
+		g_object_notify (object, TERMINAL_PROFILE_BACKGROUND_IMAGE);
+		break;
+
+	default:
+		break;
+	}
+}
+
+static void
+terminal_profile_notify (GObject *object,
+                         GParamSpec *pspec)
+{
+	TerminalProfilePrivate *priv = TERMINAL_PROFILE (object)->priv;<--- Variable 'priv' can be declared as pointer to const
+	void (* notify) (GObject *, GParamSpec *) = G_OBJECT_CLASS (terminal_profile_parent_class)->notify;
+
+	_terminal_debug_print (TERMINAL_DEBUG_PROFILE,
+	                       "Property notification for prop %s\n",
+	                       pspec->name);
+
+	if (notify)
+		notify (object, pspec);
+
+	if (pspec->owner_type == TERMINAL_TYPE_PROFILE &&
+	        (pspec->flags & G_PARAM_WRITABLE) &&
+	        g_param_spec_get_qdata (pspec, gsettings_key_quark) != NULL &&
+	        pspec != priv->gsettings_notification_pspec)
+		terminal_profile_schedule_save (TERMINAL_PROFILE (object), pspec);
+}
+
+static void
+terminal_profile_class_init (TerminalProfileClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+	gsettings_key_quark = g_quark_from_static_string ("GT::GSettingsKey");
+
+	object_class->constructor = terminal_profile_constructor;
+	object_class->finalize = terminal_profile_finalize;
+	object_class->get_property = terminal_profile_get_property;
+	object_class->set_property = terminal_profile_set_property;
+	object_class->notify = terminal_profile_notify;
+
+	signals[FORGOTTEN] =
+	    g_signal_new ("forgotten",
+	                  G_OBJECT_CLASS_TYPE (object_class),
+	                  G_SIGNAL_RUN_LAST,
+	                  G_STRUCT_OFFSET (TerminalProfileClass, forgotten),
+	                  NULL, NULL,
+	                  g_cclosure_marshal_VOID__VOID,
+	                  G_TYPE_NONE, 0);
+
+	/* gsettings_key -> pspec hash */
+	klass->gsettings_keys = g_hash_table_new (g_str_hash, g_str_equal);
+
+#define TERMINAL_PROFILE_PSPEC_STATIC (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
+
+#define TERMINAL_PROFILE_PROPERTY(propId, propSpec, propGSettings) \
+{\
+  GParamSpec *pspec = propSpec;\
+  g_object_class_install_property (object_class, propId, pspec);\
+  g_param_spec_set_qdata (pspec, gsettings_key_quark, (gpointer) propGSettings);\
+  g_hash_table_insert (klass->gsettings_keys, (gpointer) propGSettings, pspec);\
+}
+
+#define TERMINAL_PROFILE_PROPERTY_OUTER(propId, propSpec) \
+{\
+  GParamSpec *pspec = propSpec;\
+  g_object_class_install_property (object_class, propId, pspec);\
+}
+
+#define TERMINAL_PROFILE_PROPERTY_BOOLEAN(prop, propDefault, propGSettings) \
+  TERMINAL_PROFILE_PROPERTY (PROP_##prop,\
+    g_param_spec_boolean (TERMINAL_PROFILE_##prop, NULL, NULL,\
+                          propDefault,\
+                          G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\
+    propGSettings)
+
+#define TERMINAL_PROFILE_PROPERTY_BOXED(prop, propType, propGSettings)\
+  TERMINAL_PROFILE_PROPERTY (PROP_##prop,\
+    g_param_spec_boxed (TERMINAL_PROFILE_##prop, NULL, NULL,\
+                        propType,\
+                        G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\
+    propGSettings)
+
+#define TERMINAL_PROFILE_PROPERTY_DOUBLE(prop, propMin, propMax, propDefault, propGSettings)\
+  TERMINAL_PROFILE_PROPERTY (PROP_##prop,\
+    g_param_spec_double (TERMINAL_PROFILE_##prop, NULL, NULL,\
+                         propMin, propMax, propDefault,\
+                         G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\
+    propGSettings)
+
+#define TERMINAL_PROFILE_PROPERTY_ENUM(prop, propType, propDefault, propGSettings)\
+  TERMINAL_PROFILE_PROPERTY (PROP_##prop,\
+    g_param_spec_enum (TERMINAL_PROFILE_##prop, NULL, NULL,\
+                       propType, propDefault,\
+                       G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\
+    propGSettings)
+
+#define TERMINAL_PROFILE_PROPERTY_INT(prop, propMin, propMax, propDefault, propGSettings)\
+  TERMINAL_PROFILE_PROPERTY (PROP_##prop,\
+    g_param_spec_int (TERMINAL_PROFILE_##prop, NULL, NULL,\
+                      propMin, propMax, propDefault,\
+                      G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\
+    propGSettings)
+
+	/* these are all read-only */
+#define TERMINAL_PROFILE_PROPERTY_OBJECT(prop, propType)\
+  TERMINAL_PROFILE_PROPERTY_OUTER (PROP_##prop,\
+    g_param_spec_object (TERMINAL_PROFILE_##prop, NULL, NULL,\
+                         propType,\
+                         G_PARAM_READABLE | TERMINAL_PROFILE_PSPEC_STATIC))
+
+#define TERMINAL_PROFILE_PROPERTY_STRING(prop, propDefault, propGSettings)\
+  TERMINAL_PROFILE_PROPERTY (PROP_##prop,\
+    g_param_spec_string (TERMINAL_PROFILE_##prop, NULL, NULL,\
+                         propDefault,\
+                         G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\
+    propGSettings)
+
+#define TERMINAL_PROFILE_PROPERTY_STRING_CO(prop, propDefault)\
+  TERMINAL_PROFILE_PROPERTY_OUTER (PROP_##prop,\
+    g_param_spec_string (TERMINAL_PROFILE_##prop, NULL, NULL,\
+                         propDefault,\
+                         G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | TERMINAL_PROFILE_PSPEC_STATIC))
+
+#define TERMINAL_PROFILE_PROPERTY_VALUE_ARRAY_BOXED(prop, propElementName, propElementType, propGSettings)\
+  TERMINAL_PROFILE_PROPERTY (PROP_##prop,\
+    g_param_spec_value_array (TERMINAL_PROFILE_##prop, NULL, NULL,\
+                              g_param_spec_boxed (propElementName, NULL, NULL,\
+                                                  propElementType, \
+                                                  G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\
+                              G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\
+    propGSettings)
+
+	TERMINAL_PROFILE_PROPERTY_BOOLEAN (ALLOW_BOLD, DEFAULT_ALLOW_BOLD, KEY_ALLOW_BOLD);
+	TERMINAL_PROFILE_PROPERTY_BOOLEAN (BOLD_COLOR_SAME_AS_FG, DEFAULT_BOLD_COLOR_SAME_AS_FG, KEY_BOLD_COLOR_SAME_AS_FG);
+	TERMINAL_PROFILE_PROPERTY_BOOLEAN (DEFAULT_SHOW_MENUBAR, DEFAULT_DEFAULT_SHOW_MENUBAR, KEY_DEFAULT_SHOW_MENUBAR);
+	TERMINAL_PROFILE_PROPERTY_BOOLEAN (LOGIN_SHELL, DEFAULT_LOGIN_SHELL, KEY_LOGIN_SHELL);
+	TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_BACKGROUND, DEFAULT_SCROLL_BACKGROUND, KEY_SCROLL_BACKGROUND);
+	TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLLBACK_UNLIMITED, DEFAULT_SCROLLBACK_UNLIMITED, KEY_SCROLLBACK_UNLIMITED);
+	TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_KEYSTROKE, DEFAULT_SCROLL_ON_KEYSTROKE, KEY_SCROLL_ON_KEYSTROKE);
+	TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_OUTPUT, DEFAULT_SCROLL_ON_OUTPUT, KEY_SCROLL_ON_OUTPUT);
+	TERMINAL_PROFILE_PROPERTY_BOOLEAN (SILENT_BELL, DEFAULT_SILENT_BELL, KEY_SILENT_BELL);
+	TERMINAL_PROFILE_PROPERTY_BOOLEAN (COPY_SELECTION, DEFAULT_COPY_SELECTION, KEY_COPY_SELECTION);
+	TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_COMMAND, DEFAULT_USE_CUSTOM_COMMAND, KEY_USE_CUSTOM_COMMAND);
+	TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_DEFAULT_SIZE, DEFAULT_USE_CUSTOM_DEFAULT_SIZE, KEY_USE_CUSTOM_DEFAULT_SIZE);
+	TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SKEY, DEFAULT_USE_SKEY, KEY_USE_SKEY);
+	TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_URLS, DEFAULT_USE_URLS, KEY_USE_URLS);
+	TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SYSTEM_FONT, DEFAULT_USE_SYSTEM_FONT, KEY_USE_SYSTEM_FONT);
+	TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_THEME_COLORS, DEFAULT_USE_THEME_COLORS, KEY_USE_THEME_COLORS);
+
+	TERMINAL_PROFILE_PROPERTY_BOXED (BACKGROUND_COLOR, GDK_TYPE_RGBA, KEY_BACKGROUND_COLOR);
+	TERMINAL_PROFILE_PROPERTY_BOXED (BOLD_COLOR, GDK_TYPE_RGBA, KEY_BOLD_COLOR);
+	TERMINAL_PROFILE_PROPERTY_BOXED (FONT, PANGO_TYPE_FONT_DESCRIPTION, KEY_FONT);
+	TERMINAL_PROFILE_PROPERTY_BOXED (FOREGROUND_COLOR, GDK_TYPE_RGBA, KEY_FOREGROUND_COLOR);
+
+	/* 0.0 = normal bg, 1.0 = all black bg, 0.5 = half darkened */
+	TERMINAL_PROFILE_PROPERTY_DOUBLE (BACKGROUND_DARKNESS, 0.0, 1.0, DEFAULT_BACKGROUND_DARKNESS, KEY_BACKGROUND_DARKNESS);
+
+	TERMINAL_PROFILE_PROPERTY_ENUM (BACKGROUND_TYPE, TERMINAL_TYPE_BACKGROUND_TYPE, DEFAULT_BACKGROUND_TYPE, KEY_BACKGROUND_TYPE);
+	TERMINAL_PROFILE_PROPERTY_ENUM (BACKSPACE_BINDING,  VTE_TYPE_ERASE_BINDING, DEFAULT_BACKSPACE_BINDING, KEY_BACKSPACE_BINDING);
+	TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_BLINK_MODE, VTE_TYPE_CURSOR_BLINK_MODE, DEFAULT_CURSOR_BLINK_MODE, KEY_CURSOR_BLINK_MODE);
+	TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_SHAPE, VTE_TYPE_CURSOR_SHAPE, DEFAULT_CURSOR_SHAPE, KEY_CURSOR_SHAPE);
+	TERMINAL_PROFILE_PROPERTY_ENUM (DELETE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_DELETE_BINDING, KEY_DELETE_BINDING);
+	TERMINAL_PROFILE_PROPERTY_ENUM (EXIT_ACTION, TERMINAL_TYPE_EXIT_ACTION, DEFAULT_EXIT_ACTION, KEY_EXIT_ACTION);
+	TERMINAL_PROFILE_PROPERTY_ENUM (SCROLLBAR_POSITION, TERMINAL_TYPE_SCROLLBAR_POSITION, DEFAULT_SCROLLBAR_POSITION, KEY_SCROLLBAR_POSITION);
+	TERMINAL_PROFILE_PROPERTY_ENUM (TITLE_MODE, TERMINAL_TYPE_TITLE_MODE, DEFAULT_TITLE_MODE, KEY_TITLE_MODE);
+
+	TERMINAL_PROFILE_PROPERTY_INT (DEFAULT_SIZE_COLUMNS, 1, 1024, DEFAULT_DEFAULT_SIZE_COLUMNS, KEY_DEFAULT_SIZE_COLUMNS);
+	TERMINAL_PROFILE_PROPERTY_INT (DEFAULT_SIZE_ROWS, 1, 1024, DEFAULT_DEFAULT_SIZE_ROWS, KEY_DEFAULT_SIZE_ROWS);
+	TERMINAL_PROFILE_PROPERTY_INT (SCROLLBACK_LINES, 1, G_MAXINT, DEFAULT_SCROLLBACK_LINES, KEY_SCROLLBACK_LINES);
+
+	TERMINAL_PROFILE_PROPERTY_OBJECT (BACKGROUND_IMAGE, GDK_TYPE_PIXBUF);
+
+	TERMINAL_PROFILE_PROPERTY_STRING_CO (NAME, DEFAULT_NAME);
+
+	TERMINAL_PROFILE_PROPERTY_STRING (BACKGROUND_IMAGE_FILE, DEFAULT_BACKGROUND_IMAGE_FILE, KEY_BACKGROUND_IMAGE_FILE);
+	TERMINAL_PROFILE_PROPERTY_STRING (CUSTOM_COMMAND, DEFAULT_CUSTOM_COMMAND, KEY_CUSTOM_COMMAND);
+	TERMINAL_PROFILE_PROPERTY_STRING (TITLE, _(DEFAULT_TITLE), KEY_TITLE);
+	TERMINAL_PROFILE_PROPERTY_STRING (VISIBLE_NAME, _(DEFAULT_VISIBLE_NAME), KEY_VISIBLE_NAME);
+	TERMINAL_PROFILE_PROPERTY_STRING (WORD_CHARS, DEFAULT_WORD_CHARS, KEY_WORD_CHARS);
+
+	TERMINAL_PROFILE_PROPERTY_VALUE_ARRAY_BOXED (PALETTE, "palette-color", GDK_TYPE_RGBA, KEY_PALETTE);
+}
+
+/* Semi-Public API */
+
+TerminalProfile*
+_terminal_profile_new (const char *name)
+{
+	return g_object_new (TERMINAL_TYPE_PROFILE,
+	                     "name", name,
+	                     NULL);
+}
+
+void
+_terminal_profile_forget (TerminalProfile *profile)
+{
+	TerminalProfilePrivate *priv = profile->priv;
+
+	if (!priv->forgotten)
+	{
+		priv->forgotten = TRUE;
+
+		g_signal_emit (G_OBJECT (profile), signals[FORGOTTEN], 0);
+	}
+}
+
+gboolean
+_terminal_profile_get_forgotten (TerminalProfile *profile)
+{
+	return profile->priv->forgotten;
+}
+
+TerminalProfile *
+_terminal_profile_clone (TerminalProfile *base_profile,
+                         const char      *visible_name)
+{
+	TerminalApp *app = terminal_app_get ();
+	GObject *base_object = G_OBJECT (base_profile);
+	TerminalProfilePrivate *new_priv;
+	char profile_name[32];
+	GParameter *params;
+	GParamSpec **pspecs;
+	guint n_pspecs, i, n_params, profile_num;
+	TerminalProfile *new_profile;
+
+	g_object_ref (base_profile);
+
+	profile_num = 0;
+	do
+	{
+		g_snprintf (profile_name, sizeof (profile_name), "profile%u", profile_num++);
+	}
+	while (terminal_app_get_profile_by_name (app, profile_name) != NULL);
+
+	/* Now we have an unused profile name */
+	pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (base_profile)), &n_pspecs);
+
+	params = g_newa (GParameter, n_pspecs);
+	n_params = 0;
+
+	for (i = 0; i < n_pspecs; ++i)
+	{
+		GParamSpec *pspec = pspecs[i];
+		GValue *value;
+
+		if (pspec->owner_type != TERMINAL_TYPE_PROFILE ||
+		        (pspec->flags & G_PARAM_WRITABLE) == 0)
+			continue;
+
+		params[n_params].name = pspec->name;
+
+		value = &params[n_params].value;
+		G_VALUE_TYPE (value) = 0;
+		g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec));
+
+		if (pspec->name == I_(TERMINAL_PROFILE_NAME))
+			g_value_set_static_string (value, profile_name);
+		else if (pspec->name == I_(TERMINAL_PROFILE_VISIBLE_NAME))
+			g_value_set_static_string (value, visible_name);
+		else
+			g_object_get_property (base_object, pspec->name, value);
+
+		++n_params;
+	}
+
+	new_profile = g_object_newv (TERMINAL_TYPE_PROFILE, n_params, params);
+
+	g_object_unref (base_profile);
+
+	for (i = 0; i < n_params; ++i)
+		g_value_unset (&params[i].value);
+
+	/* Flush the new profile to GSettings */
+	new_priv = new_profile->priv;
+
+	g_slist_free (new_priv->dirty_pspecs);
+	new_priv->dirty_pspecs = NULL;
+	if (new_priv->save_idle_id != 0)
+	{
+		g_source_remove (new_priv->save_idle_id);
+		new_priv->save_idle_id = 0;
+	}
+
+	for (i = 0; i < n_pspecs; ++i)
+	{
+		GParamSpec *pspec = pspecs[i];
+
+		if (pspec->owner_type != TERMINAL_TYPE_PROFILE ||
+		        (pspec->flags & G_PARAM_WRITABLE) == 0)
+			continue;
+
+		new_priv->dirty_pspecs = g_slist_prepend (new_priv->dirty_pspecs, pspec);
+	}
+	g_free (pspecs);
+
+	terminal_profile_save (new_profile);
+
+	return new_profile;
+}
+
+/* Public API */
+
+gboolean
+terminal_profile_get_property_boolean (TerminalProfile *profile,
+                                       const char *prop_name)
+{
+	const GValue *value;
+
+	value = get_prop_value_from_prop_name (profile, prop_name);
+	g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_BOOLEAN (value), FALSE);
+	if (!value || !G_VALUE_HOLDS_BOOLEAN (value))
+		return FALSE;
+
+	return g_value_get_boolean (value);
+}
+
+gconstpointer
+terminal_profile_get_property_boxed (TerminalProfile *profile,
+                                     const char *prop_name)
+{
+	const GValue *value;
+
+	value = get_prop_value_from_prop_name (profile, prop_name);
+	g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_BOXED (value), NULL);
+	if (!value || !G_VALUE_HOLDS_BOXED (value))
+		return NULL;
+
+	return g_value_get_boxed (value);
+}
+
+double
+terminal_profile_get_property_double (TerminalProfile *profile,
+                                      const char *prop_name)
+{
+	const GValue *value;
+
+	value = get_prop_value_from_prop_name (profile, prop_name);
+	g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_DOUBLE (value), 0.0);
+	if (!value || !G_VALUE_HOLDS_DOUBLE (value))
+		return 0.0;
+
+	return g_value_get_double (value);
+}
+
+int
+terminal_profile_get_property_enum (TerminalProfile *profile,
+                                    const char *prop_name)
+{
+	const GValue *value;
+
+	value = get_prop_value_from_prop_name (profile, prop_name);
+	g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_ENUM (value), 0);
+	if (!value || !G_VALUE_HOLDS_ENUM (value))
+		return 0;
+
+	return g_value_get_enum (value);
+}
+
+int
+terminal_profile_get_property_int (TerminalProfile *profile,
+                                   const char *prop_name)
+{
+	const GValue *value;
+
+	value = get_prop_value_from_prop_name (profile, prop_name);
+	g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_INT (value), 0);
+	if (!value || !G_VALUE_HOLDS_INT (value))
+		return 0;
+
+	return g_value_get_int (value);
+}
+
+gpointer
+terminal_profile_get_property_object (TerminalProfile *profile,
+                                      const char *prop_name)
+{
+	const GValue *value;
+
+	value = get_prop_value_from_prop_name (profile, prop_name);
+	g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_OBJECT (value), NULL);
+	if (!value || !G_VALUE_HOLDS_OBJECT (value))
+		return NULL;
+
+	return g_value_get_object (value);
+}
+
+const char*
+terminal_profile_get_property_string (TerminalProfile *profile,
+                                      const char *prop_name)
+{
+	const GValue *value;
+
+	value = get_prop_value_from_prop_name (profile, prop_name);
+	g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_STRING (value), NULL);
+	if (!value || !G_VALUE_HOLDS_STRING (value))
+		return NULL;
+
+	return g_value_get_string (value);
+}
+
+gboolean
+terminal_profile_property_locked (TerminalProfile *profile,
+                                  const char *prop_name)
+{
+	TerminalProfilePrivate *priv = profile->priv;
+	GParamSpec *pspec;<--- Variable 'pspec' can be declared as pointer to const
+
+	pspec = get_pspec_from_name (profile, prop_name);
+	g_return_val_if_fail (pspec != NULL, FALSE);
+	if (!pspec)
+		return FALSE;
+
+	return priv->locked[pspec->param_id];
+}
+
+void
+terminal_profile_reset_property (TerminalProfile *profile,
+                                 const char *prop_name)
+{
+	GParamSpec *pspec;
+
+	pspec = get_pspec_from_name (profile, prop_name);
+	g_return_if_fail (pspec != NULL);
+	if (!pspec ||
+	        (pspec->flags & G_PARAM_WRITABLE) == 0)
+		return;
+
+	terminal_profile_reset_property_internal (profile, pspec, TRUE);
+}
+
+gboolean
+terminal_profile_get_palette (TerminalProfile *profile,
+                              GdkRGBA *colors,
+                              guint *n_colors)
+{
+	TerminalProfilePrivate *priv;
+	GValueArray *array;
+	guint i, n;
+
+	g_return_val_if_fail (TERMINAL_IS_PROFILE (profile), FALSE);
+	g_return_val_if_fail (colors != NULL && n_colors != NULL, FALSE);
+
+	priv = profile->priv;
+	array = g_value_get_boxed (g_value_array_get_nth (priv->properties, PROP_PALETTE));
+	if (!array)
+		return FALSE;
+
+	n = MIN (array->n_values, *n_colors);
+	for (i = 0; i < n; ++i)
+	{
+		GdkRGBA *color = g_value_get_boxed (g_value_array_get_nth (array, i));<--- Variable 'color' can be declared as pointer to const
+		if (!color)
+			continue; /* shouldn't happen!! */
+
+		colors[i] = *color;
+	}
+
+	*n_colors = n;
+	return TRUE;
+}
+
+gboolean
+terminal_profile_get_palette_is_builtin (TerminalProfile *profile,
+        guint *n)
+{
+	GdkRGBA colors[TERMINAL_PALETTE_SIZE];
+	guint n_colors;
+	guint i;
+
+	n_colors = G_N_ELEMENTS (colors);
+	if (!terminal_profile_get_palette (profile, colors, &n_colors) ||
+	        n_colors != TERMINAL_PALETTE_SIZE)
+		return FALSE;
+
+	for (i = 0; i < TERMINAL_PALETTE_N_BUILTINS; ++i)
+		if (palette_cmp (colors, terminal_palettes[i]))
+		{
+			*n = i;
+			return TRUE;
+		}
+
+	return FALSE;
+}
+
+void
+terminal_profile_set_palette_builtin (TerminalProfile *profile,
+                                      guint n)
+{
+	GValue value = { 0, };
+
+	g_return_if_fail (n < TERMINAL_PALETTE_N_BUILTINS);
+
+	g_value_init (&value, G_TYPE_VALUE_ARRAY);
+	set_value_from_palette (&value, terminal_palettes[n], TERMINAL_PALETTE_SIZE);
+	g_object_set_property (G_OBJECT (profile), TERMINAL_PROFILE_PALETTE, &value);
+	g_value_unset (&value);
+}
+
+gboolean
+terminal_profile_modify_palette_entry (TerminalProfile *profile,
+                                       guint            i,
+                                       const GdkRGBA   *color)
+{
+	TerminalProfilePrivate *priv = profile->priv;
+	GValueArray *array;
+	GValue *value;
+	GdkRGBA *old_color;<--- Variable 'old_color' can be declared as pointer to const
+
+	array = g_value_get_boxed (g_value_array_get_nth (priv->properties, PROP_PALETTE));
+	if (!array ||
+	        i >= array->n_values)
+		return FALSE;
+
+	value = g_value_array_get_nth (array, i);
+	old_color = g_value_get_boxed (value);
+	if (!old_color ||
+	        !rgba_equal (old_color, color))
+	{
+		g_value_set_boxed (value, color);
+		g_object_notify (G_OBJECT (profile), TERMINAL_PROFILE_PALETTE);
+	}
+
+	return TRUE;
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/47.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/47.html new file mode 100644 index 0000000..99c3087 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/47.html @@ -0,0 +1,289 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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

+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#ifndef TERMINAL_TYPE_BUILTINS_H
+#define TERMINAL_TYPE_BUILTINS_H
+
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+/* enumerations from "terminal-profile.h" */
+GType terminal_title_mode_get_type (void);
+#define TERMINAL_TYPE_TITLE_MODE (terminal_title_mode_get_type ())
+GType terminal_scrollbar_position_get_type (void);
+#define TERMINAL_TYPE_SCROLLBAR_POSITION (terminal_scrollbar_position_get_type ())
+GType terminal_exit_action_get_type (void);
+#define TERMINAL_TYPE_EXIT_ACTION (terminal_exit_action_get_type ())
+GType terminal_background_type_get_type (void);
+#define TERMINAL_TYPE_BACKGROUND_TYPE (terminal_background_type_get_type ())
+
+G_END_DECLS
+
+#endif /* !TERMINAL_TYPE_BUILTINS_H */
+
+/* Generated data ends here */
+
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/48.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/48.html new file mode 100644 index 0000000..ac7fe63 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/48.html @@ -0,0 +1,2603 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
   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
#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.terminal"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+static const SECTION union { const guint8 data[15602]; const double alignment; void * const ptr;}  terminal_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, 0340, 0001, 0000, 0000, 0000, 0000, 0000, 0050, 0020, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0007, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0010, 0000, 0000, 0000, 0011, 0000, 0000, 0000, 
+  0012, 0000, 0000, 0000, 0014, 0000, 0000, 0000, 0016, 0000, 0000, 0000, 0020, 0000, 0000, 0000, 
+  0201, 0321, 0040, 0031, 0011, 0000, 0000, 0000, 0340, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 
+  0350, 0001, 0000, 0000, 0354, 0001, 0000, 0000, 0221, 0044, 0211, 0210, 0007, 0000, 0000, 0000, 
+  0354, 0001, 0000, 0000, 0021, 0000, 0166, 0000, 0000, 0002, 0000, 0000, 0255, 0005, 0000, 0000, 
+  0263, 0014, 0250, 0030, 0007, 0000, 0000, 0000, 0255, 0005, 0000, 0000, 0027, 0000, 0166, 0000, 
+  0310, 0005, 0000, 0000, 0172, 0011, 0000, 0000, 0043, 0107, 0251, 0312, 0007, 0000, 0000, 0000, 
+  0172, 0011, 0000, 0000, 0016, 0000, 0166, 0000, 0210, 0011, 0000, 0000, 0260, 0015, 0000, 0000, 
+  0324, 0302, 0323, 0026, 0007, 0000, 0000, 0000, 0260, 0015, 0000, 0000, 0014, 0000, 0166, 0000, 
+  0300, 0015, 0000, 0000, 0156, 0020, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 
+  0156, 0020, 0000, 0000, 0001, 0000, 0114, 0000, 0160, 0020, 0000, 0000, 0164, 0020, 0000, 0000, 
+  0365, 0313, 0276, 0023, 0007, 0000, 0000, 0000, 0164, 0020, 0000, 0000, 0026, 0000, 0166, 0000, 
+  0220, 0020, 0000, 0000, 0065, 0044, 0000, 0000, 0231, 0227, 0331, 0164, 0013, 0000, 0000, 0000, 
+  0065, 0044, 0000, 0000, 0003, 0000, 0114, 0000, 0070, 0044, 0000, 0000, 0144, 0044, 0000, 0000, 
+  0212, 0030, 0227, 0066, 0007, 0000, 0000, 0000, 0144, 0044, 0000, 0000, 0025, 0000, 0166, 0000, 
+  0200, 0044, 0000, 0000, 0105, 0050, 0000, 0000, 0113, 0120, 0220, 0013, 0005, 0000, 0000, 0000, 
+  0105, 0050, 0000, 0000, 0004, 0000, 0114, 0000, 0114, 0050, 0000, 0000, 0120, 0050, 0000, 0000, 
+  0174, 0150, 0346, 0243, 0007, 0000, 0000, 0000, 0120, 0050, 0000, 0000, 0023, 0000, 0166, 0000, 
+  0150, 0050, 0000, 0000, 0033, 0055, 0000, 0000, 0254, 0247, 0246, 0122, 0000, 0000, 0000, 0000, 
+  0033, 0055, 0000, 0000, 0011, 0000, 0114, 0000, 0044, 0055, 0000, 0000, 0050, 0055, 0000, 0000, 
+  0235, 0340, 0260, 0352, 0007, 0000, 0000, 0000, 0050, 0055, 0000, 0000, 0024, 0000, 0166, 0000, 
+  0100, 0055, 0000, 0000, 0250, 0061, 0000, 0000, 0135, 0011, 0065, 0106, 0007, 0000, 0000, 0000, 
+  0250, 0061, 0000, 0000, 0023, 0000, 0166, 0000, 0300, 0061, 0000, 0000, 0262, 0064, 0000, 0000, 
+  0236, 0373, 0115, 0233, 0007, 0000, 0000, 0000, 0262, 0064, 0000, 0000, 0022, 0000, 0166, 0000, 
+  0310, 0064, 0000, 0000, 0013, 0071, 0000, 0000, 0136, 0250, 0051, 0031, 0007, 0000, 0000, 0000, 
+  0013, 0071, 0000, 0000, 0016, 0000, 0166, 0000, 0040, 0071, 0000, 0000, 0361, 0074, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0013, 0000, 0000, 0000, 0163, 0153, 0145, 0171, 
+  0055, 0143, 0150, 0141, 0154, 0154, 0145, 0156, 0147, 0145, 0056, 0165, 0151, 0000, 0000, 0000, 
+  0340, 0026, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0130, 0135, 0157, 0333, 0066, 
+  0024, 0175, 0357, 0257, 0340, 0370, 0270, 0202, 0161, 0343, 0064, 0101, 0121, 0330, 0052, 0326, 
+  0117, 0014, 0333, 0260, 0141, 0113, 0261, 0307, 0200, 0246, 0256, 0045, 0126, 0024, 0251, 0222, 
+  0224, 0035, 0355, 0327, 0357, 0122, 0122, 0034, 0307, 0166, 0045, 0055, 0165, 0325, 0154, 0353, 
+  0233, 0105, 0237, 0113, 0236, 0173, 0171, 0356, 0207, 0064, 0173, 0161, 0235, 0053, 0262, 0002, 
+  0353, 0244, 0321, 0163, 0172, 0172, 0362, 0204, 0022, 0320, 0302, 0304, 0122, 0047, 0163, 0372, 
+  0376, 0362, 0055, 0173, 0106, 0137, 0104, 0217, 0146, 0337, 0061, 0106, 0336, 0201, 0006, 0313, 
+  0075, 0304, 0144, 0055, 0175, 0112, 0022, 0305, 0143, 0040, 0147, 0047, 0147, 0317, 0116, 0246, 
+  0204, 0261, 0006, 0364, 0075, 0043, 0271, 0211, 0341, 0071, 0011, 0333, 0342, 0123, 0130, 0226, 
+  0332, 0203, 0135, 0162, 0001, 0321, 0314, 0302, 0307, 0122, 0132, 0160, 0104, 0311, 0305, 0234, 
+  0046, 0076, 0173, 0114, 0157, 0017, 0077, 0073, 0231, 0116, 0351, 0044, 0252, 0317, 0332, 0330, 
+  0060, 0045, 0005, 0150, 0007, 0314, 0127, 0005, 0220, 0244, 0120, 0253, 0263, 0160, 0330, 0016, 
+  0110, 0363, 0034, 0110, 0216, 0334, 0030, 0256, 0344, 0122, 0163, 0165, 0000, 0024, 0203, 0023, 
+  0126, 0026, 0036, 0017, 0043, 0056, 0203, 0212, 0211, 0224, 0053, 0005, 0072, 0201, 0003, 0140, 
+  0141, 0212, 0312, 0312, 0044, 0365, 0344, 0227, 0037, 0056, 0337, 0220, 0327, 0260, 0002, 0145, 
+  0012, 0260, 0007, 0240, 0274, 0364, 0251, 0261, 0216, 0374, 0151, 0324, 0062, 0341, 0072, 0041, 
+  0357, 0325, 0302, 0112, 0221, 0326, 0120, 0263, 0370, 0000, 0302, 0023, 0241, 0270, 0163, 0163, 
+  0372, 0316, 0147, 0077, 0346, 0074, 0001, 0112, 0144, 0074, 0247, 0062, 0374, 0074, 0245, 0321, 
+  0254, 0260, 0141, 0153, 0137, 0221, 0340, 0307, 0234, 0256, 0244, 0223, 0013, 0005, 0064, 0272, 
+  0264, 0045, 0314, 0046, 0067, 0377, 0356, 0341, 0004, 0327, 0154, 0151, 0104, 0351, 0150, 0364, 
+  0226, 0053, 0327, 0005, 0225, 0302, 0350, 0072, 0112, 0064, 0302, 0177, 0004, 0070, 0307, 0234, 
+  0067, 0305, 0266, 0305, 0244, 0241, 0072, 0200, 0362, 0164, 0024, 0312, 0310, 0117, 0144, 0064, 
+  0102, 0221, 0060, 0223, 0015, 0043, 0372, 0132, 0162, 0145, 0222, 0206, 0151, 0175, 0303, 0161, 
+  0263, 0360, 0071, 0064, 0026, 0306, 0306, 0140, 0331, 0132, 0306, 0076, 0245, 0321, 0171, 0007, 
+  0022, 0165, 0055, 0377, 0342, 0165, 0024, 0372, 0066, 0105, 0051, 0172, 0153, 0052, 0026, 0022, 
+  0211, 0025, 0334, 0202, 0366, 0275, 0241, 0013, 0011, 0300, 0122, 0031, 0220, 0215, 0133, 0333, 
+  0130, 0221, 0112, 0025, 0067, 0232, 0104, 0361, 0263, 0372, 0021, 0157, 0145, 0141, 0256, 0351, 
+  0201, 0070, 0275, 0304, 0345, 0072, 0110, 0315, 0106, 0054, 0340, 0236, 0216, 0162, 0251, 0306, 
+  0112, 0364, 0225, 0207, 0034, 0244, 0021, 0146, 0276, 0227, 0202, 0253, 0056, 0021, 0024, 0134, 
+  0140, 0051, 0242, 0321, 0264, 0337, 0133, 0056, 0302, 0266, 0127, 0030, 0115, 0176, 0320, 0351, 
+  0322, 0173, 0243, 0167, 0135, 0337, 0062, 0032, 0047, 0002, 0212, 0127, 0246, 0364, 0230, 0175, 
+  0125, 0330, 0027, 0164, 0274, 0347, 0330, 0047, 0271, 0067, 0304, 0361, 0054, 0001, 0152, 0121, 
+  0257, 0034, 0050, 0036, 0212, 0057, 0100, 0121, 0342, 0055, 0327, 0116, 0161, 0037, 0364, 0070, 
+  0247, 0025, 0040, 0263, 0253, 0127, 0265, 0145, 0007, 0267, 0173, 0270, 0073, 0000, 0031, 0303, 
+  0222, 0227, 0252, 0137, 0340, 0026, 0004, 0310, 0025, 0270, 0133, 0203, 0336, 0252, 0126, 0027, 
+  0246, 0250, 0251, 0243, 0035, 0270, 0022, 0373, 0107, 0251, 0061, 0215, 0225, 0324, 0375, 0336, 
+  0161, 0265, 0346, 0025, 0326, 0307, 0324, 0254, 0131, 0173, 0302, 0256, 0305, 0246, 0004, 0241, 
+  0074, 0063, 0324, 0347, 0336, 0036, 0160, 0135, 0160, 0035, 0367, 0036, 0265, 0224, 0112, 0365, 
+  0202, 0012, 0343, 0144, 0223, 0060, 0117, 0356, 0160, 0330, 0234, 0075, 0151, 0145, 0063, 0104, 
+  0075, 0165, 0131, 0064, 0031, 0153, 0364, 0363, 0217, 0344, 0363, 0153, 0366, 0140, 0245, 0223, 
+  0162, 0067, 0222, 0314, 0246, 0377, 0003, 0231, 0235, 0166, 0313, 0154, 0060, 0253, 0276, 0270, 
+  0016, 0243, 0205, 0207, 0324, 0303, 0337, 0136, 0261, 0074, 0172, 0232, 0334, 0264, 0206, 0164, 
+  0264, 0166, 0070, 0174, 0270, 0330, 0064, 0302, 0323, 0351, 0220, 0206, 0261, 0065, 0262, 0325, 
+  0031, 0337, 0012, 0154, 0004, 0227, 0160, 0246, 0226, 0011, 0136, 0002, 0116, 0355, 0330, 0236, 
+  0273, 0052, 0106, 0013, 0164, 0236, 0133, 0077, 0154, 0164, 0155, 0173, 0166, 0201, 0136, 0256, 
+  0061, 0162, 0075, 0106, 0127, 0070, 0216, 0241, 0321, 0305, 0275, 0062, 0352, 0070, 0332, 0075, 
+  0232, 0044, 0303, 0204, 0166, 0361, 0260, 0047, 0264, 0141, 0302, 0374, 0271, 0351, 0057, 0301, 
+  0047, 0017, 0327, 0236, 0065, 0375, 0146, 0114, 0141, 0366, 0351, 0155, 0065, 0124, 0300, 0237, 
+  0156, 0225, 0177, 0114, 0176, 0202, 0212, 0274, 0332, 0274, 0136, 0376, 0016, 0256, 0060, 0272, 
+  0223, 0135, 0350, 0035, 0071, 0267, 0131, 0131, 0174, 0106, 0033, 0030, 0046, 0332, 0076, 0324, 
+  0161, 0013, 0351, 0371, 0070, 0057, 0213, 0367, 0126, 0141, 0175, 0213, 0027, 0323, 0377, 0232, 
+  0004, 0257, 0176, 0153, 0213, 0344, 0363, 0243, 0015, 0054, 0271, 0206, 0334, 0150, 0051, 0102, 
+  0273, 0112, 0000, 0347, 0246, 0272, 0263, 0040, 0105, 0133, 0375, 0233, 0325, 0372, 0046, 0070, 
+  0260, 0325, 0052, 0153, 0207, 0350, 0010, 0003, 0156, 0275, 0243, 0124, 0322, 0127, 0375, 0136, 
+  0206, 0327, 0324, 0025, 0367, 0320, 0061, 0346, 0176, 0033, 0026, 0277, 0004, 0255, 0207, 0031, 
+  0254, 0257, 0303, 0352, 0146, 0241, 0371, 0146, 0322, 0226, 0001, 0267, 0363, 0114, 0154, 0333, 
+  0354, 0346, 0224, 0341, 0304, 0162, 0347, 0153, 0305, 0154, 0162, 0007, 0332, 0141, 0171, 0336, 
+  0126, 0227, 0315, 0233, 0352, 0236, 0351, 0144, 0227, 0305, 0055, 0315, 0333, 0017, 0316, 0217, 
+  0376, 0006, 0130, 0065, 0125, 0227, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0157, 0156, 
+  0146, 0151, 0162, 0155, 0055, 0143, 0154, 0157, 0163, 0145, 0055, 0144, 0151, 0141, 0154, 0157, 
+  0147, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 0142, 0025, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0335, 0130, 0113, 0157, 0343, 0066, 0020, 0276, 0347, 0127, 0260, 0274, 0026, 0262, 
+  0023, 0147, 0167, 0261, 0007, 0133, 0001, 0272, 0305, 0056, 0012, 0364, 0230, 0242, 0107, 0142, 
+  0114, 0215, 0045, 0326, 0064, 0251, 0045, 0251, 0330, 0356, 0257, 0357, 0120, 0214, 0343, 0107, 
+  0022, 0111, 0310, 0246, 0116, 0323, 0213, 0101, 0213, 0063, 0344, 0067, 0243, 0157, 0136, 0232, 
+  0336, 0154, 0126, 0232, 0335, 0241, 0363, 0312, 0232, 0031, 0277, 0032, 0135, 0162, 0206, 0106, 
+  0332, 0102, 0231, 0162, 0306, 0377, 0270, 0375, 0232, 0175, 0346, 0067, 0371, 0305, 0364, 0247, 
+  0054, 0143, 0337, 0320, 0240, 0203, 0200, 0005, 0133, 0253, 0120, 0261, 0122, 0103, 0201, 0354, 
+  0172, 0064, 0231, 0214, 0046, 0054, 0313, 0110, 0110, 0231, 0200, 0156, 0001, 0022, 0363, 0251, 
+  0303, 0357, 0215, 0162, 0350, 0231, 0126, 0363, 0031, 0057, 0303, 0362, 0147, 0276, 0277, 0045, 
+  0352, 0360, 0161, 0076, 0265, 0363, 0277, 0120, 0006, 0046, 0065, 0170, 0077, 0343, 0337, 0302, 
+  0362, 0267, 0025, 0224, 0310, 0231, 0052, 0146, 0134, 0305, 0245, 0220, 0140, 0044, 0152, 0236, 
+  0117, 0153, 0147, 0153, 0164, 0141, 0313, 0014, 0254, 0160, 0306, 0357, 0224, 0127, 0163, 0215, 
+  0074, 0277, 0165, 0015, 0116, 0307, 0273, 0335, 0107, 0162, 0244, 0057, 0026, 0126, 0066, 0236, 
+  0347, 0137, 0101, 0373, 0056, 0121, 0045, 0255, 0021, 0161, 0311, 0163, 0332, 0221, 0350, 0175, 
+  0346, 0203, 0255, 0017, 0065, 0306, 0011, 0360, 0040, 0340, 0332, 0172, 0074, 0067, 0356, 0265, 
+  0062, 0205, 0135, 0147, 0355, 0335, 0303, 0160, 0377, 0252, 0100, 0333, 0062, 0001, 0247, 0163, 
+  0026, 0312, 0255, 0022, 0164, 0121, 0244, 0235, 0037, 0101, 0066, 0267, 0256, 0100, 0047, 0326, 
+  0252, 0010, 0025, 0317, 0077, 0166, 0110, 0256, 0154, 0001, 0272, 0327, 0051, 0311, 0074, 0121, 
+  0133, 0257, 0002, 0361, 0210, 0347, 0022, 0043, 0341, 0062, 0153, 0262, 0032, 0034, 0255, 0073, 
+  0164, 0013, 0364, 0301, 0331, 0255, 0210, 0314, 0025, 0111, 0272, 0367, 0276, 0260, 0255, 0121, 
+  0124, 0052, 0112, 0046, 0157, 0034, 0312, 0312, 0112, 0351, 0202, 0105, 0021, 0022, 0124, 0101, 
+  0343, 0034, 0134, 0364, 0226, 0046, 0372, 0127, 0126, 0223, 0341, 0104, 0360, 0161, 0053, 0265, 
+  0023, 0156, 0303, 0303, 0200, 0316, 0332, 0277, 0104, 0206, 0271, 0335, 0360, 0047, 0136, 0312, 
+  0057, 0355, 0343, 0177, 0237, 0071, 0326, 0051, 0162, 0003, 0044, 0137, 0122, 0160, 0006, 0045, 
+  0101, 0167, 0310, 0373, 0032, 0044, 0245, 0005, 0236, 0137, 0175, 0170, 0354, 0211, 0123, 0343, 
+  0100, 0306, 0163, 0005, 0171, 0032, 0236, 0264, 0261, 0011, 0301, 0232, 0163, 0131, 0132, 0341, 
+  0246, 0006, 0123, 0364, 0036, 0131, 0331, 0225, 0055, 0051, 0313, 0331, 0170, 0150, 0217, 0254, 
+  0206, 0255, 0155, 0202, 0360, 0141, 0033, 0261, 0246, 0013, 0036, 0271, 0345, 0131, 0313, 0123, 
+  0310, 0315, 0333, 0365, 0263, 0131, 0116, 0303, 0234, 0036, 0263, 0340, 0300, 0170, 0015, 0001, 
+  0310, 0053, 0063, 0276, 0105, 0302, 0046, 0276, 0264, 0052, 0035, 0360, 0136, 0340, 0305, 0036, 
+  0111, 0207, 0022, 0325, 0035, 0172, 0121, 0340, 0002, 0032, 0335, 0037, 0077, 0155, 0046, 0344, 
+  0371, 0141, 0046, 0357, 0220, 0156, 0050, 0351, 0064, 0206, 0342, 0106, 0053, 0323, 0017, 0033, 
+  0364, 0032, 0266, 0136, 0370, 0212, 0022, 0302, 0375, 0075, 0247, 0032, 0017, 0131, 0217, 0150, 
+  0273, 0044, 0336, 0076, 0072, 0143, 0040, 0051, 0026, 0112, 0367, 0347, 0246, 0175, 0122, 0272, 
+  0072, 0302, 0360, 0160, 0367, 0121, 0052, 0030, 0110, 0213, 0247, 0153, 0310, 0363, 0254, 0370, 
+  0042, 0242, 0006, 0373, 0263, 0315, 0223, 0147, 0345, 0106, 0224, 0034, 0112, 0213, 0012, 0206, 
+  0123, 0350, 0007, 0071, 0167, 0132, 0010, 0377, 0247, 0224, 0233, 0164, 0123, 0256, 0115, 0121, 
+  0304, 0274, 0310, 0265, 0035, 0207, 0224, 0131, 0142, 0021, 0173, 0260, 0361, 0375, 0356, 0171, 
+  0241, 0323, 0035, 0042, 0326, 0116, 0112, 0234, 0307, 0131, 0363, 0131, 0033, 0057, 0137, 0030, 
+  0126, 0124, 0141, 0332, 0230, 0212, 0305, 0366, 0363, 0131, 0212, 0315, 0161, 0333, 0363, 0151, 
+  0120, 0115, 0330, 0241, 0254, 0010, 0345, 0365, 0033, 0240, 0374, 0070, 0250, 0354, 0117, 0206, 
+  0330, 0222, 0132, 0341, 0163, 0230, 0160, 0007, 0132, 0225, 0104, 0015, 0037, 0300, 0205, 0141, 
+  0035, 0162, 0352, 0343, 0262, 0065, 0070, 0103, 0046, 0365, 0351, 0170, 0365, 0067, 0236, 0274, 
+  0301, 0301, 0141, 0322, 0007, 0076, 0305, 0111, 0237, 0324, 0253, 0360, 0377, 0277, 0335, 0113, 
+  0016, 0042, 0325, 0357, 0251, 0346, 0305, 0020, 0371, 0336, 0120, 0053, 0037, 0133, 0313, 0200, 
+  0233, 0160, 0236, 0356, 0161, 0040, 0317, 0072, 0012, 0163, 0133, 0227, 0103, 0245, 0074, 0113, 
+  0103, 0314, 0115, 0227, 0153, 0120, 0223, 0361, 0060, 0304, 0010, 0117, 0056, 0324, 0050, 0142, 
+  0371, 0022, 0064, 0103, 0365, 0053, 0254, 0140, 0223, 0102, 0136, 0310, 0012, 0034, 0041, 0373, 
+  0160, 0304, 0053, 0010, 0301, 0051, 0352, 0076, 0320, 0037, 0254, 0167, 0323, 0027, 0252, 0262, 
+  0012, 0064, 0305, 0203, 0156, 0332, 0374, 0241, 0123, 0375, 0070, 0324, 0171, 0157, 0321, 0161, 
+  0100, 0053, 0032, 0020, 0245, 0123, 0365, 0173, 0143, 0326, 0155, 0205, 0016, 0031, 0361, 0212, 
+  0142, 0102, 0153, 0006, 0354, 0376, 0333, 0005, 0163, 0215, 0211, 0051, 0216, 0346, 0262, 0304, 
+  0073, 0232, 0316, 0126, 0212, 0346, 0263, 0321, 0105, 0044, 0143, 0334, 0011, 0025, 0076, 0074, 
+  0045, 0132, 0222, 0366, 0062, 0376, 0250, 0060, 0172, 0041, 0071, 0337, 0354, 0355, 0367, 0264, 
+  0334, 0257, 0214, 0353, 0265, 0046, 0201, 0067, 0152, 0026, 0057, 0337, 0267, 0263, 0166, 0017, 
+  0322, 0367, 0205, 0214, 0222, 0131, 0211, 0301, 0237, 0374, 0147, 0016, 0175, 0155, 0215, 0247, 
+  0033, 0262, 0117, 0074, 0077, 0032, 0263, 0051, 0143, 0035, 0212, 0166, 0150, 0136, 0357, 0065, 
+  0323, 0040, 0161, 0242, 0070, 0076, 0305, 0260, 0007, 0271, 0377, 0022, 0172, 0361, 0017, 0275, 
+  0113, 0336, 0202, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0146, 0151, 0156, 0144, 0055, 0144, 
+  0151, 0141, 0154, 0157, 0147, 0056, 0165, 0151, 0366, 0036, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0121, 0223, 0332, 0066, 0020, 0176, 0317, 0257, 0120, 0365, 0330, 0216, 
+  0216, 0000, 0115, 0233, 0311, 0200, 0063, 0155, 0232, 0144, 0072, 0323, 0074, 0365, 0062, 0171, 
+  0144, 0144, 0171, 0261, 0325, 0223, 0045, 0127, 0222, 0341, 0310, 0257, 0357, 0312, 0006, 0356, 
+  0060, 0004, 0373, 0300, 0045, 0163, 0311, 0275, 0141, 0173, 0265, 0372, 0166, 0365, 0355, 0267, 
+  0153, 0074, 0171, 0175, 0233, 0053, 0262, 0000, 0353, 0244, 0321, 0123, 0072, 0274, 0172, 0116, 
+  0011, 0150, 0141, 0022, 0251, 0323, 0051, 0375, 0170, 0375, 0216, 0275, 0244, 0257, 0243, 0147, 
+  0223, 0037, 0030, 0043, 0357, 0101, 0203, 0345, 0036, 0022, 0262, 0224, 0076, 0043, 0251, 0342, 
+  0011, 0220, 0361, 0325, 0370, 0345, 0325, 0210, 0060, 0126, 0033, 0375, 0310, 0110, 0156, 0022, 
+  0170, 0105, 0202, 0133, 0274, 0012, 0267, 0245, 0366, 0140, 0347, 0134, 0100, 0064, 0261, 0360, 
+  0157, 0051, 0055, 0070, 0242, 0144, 0074, 0245, 0251, 0277, 0371, 0211, 0336, 0155, 0076, 0276, 
+  0032, 0215, 0350, 0040, 0252, 0366, 0332, 0256, 0141, 0112, 0012, 0320, 0016, 0230, 0137, 0025, 
+  0100, 0322, 0102, 0055, 0306, 0141, 0263, 0206, 0221, 0346, 0071, 0220, 0034, 0261, 0061, 0274, 
+  0223, 0113, 0315, 0325, 0001, 0243, 0004, 0234, 0260, 0262, 0360, 0270, 0031, 0231, 0113, 0235, 
+  0220, 0104, 0162, 0145, 0122, 0142, 0346, 0255, 0113, 0205, 0051, 0126, 0126, 0246, 0231, 0047, 
+  0037, 0176, 0273, 0176, 0113, 0022, 0130, 0200, 0062, 0005, 0002, 0077, 0140, 0313, 0113, 0237, 
+  0031, 0174, 0362, 0311, 0250, 0171, 0312, 0165, 0112, 0076, 0252, 0330, 0112, 0221, 0125, 0246, 
+  0046, 0376, 0007, 0204, 0047, 0102, 0161, 0347, 0246, 0364, 0275, 0277, 0371, 0063, 0347, 0051, 
+  0120, 0042, 0223, 0051, 0225, 0341, 0347, 0220, 0106, 0223, 0302, 0006, 0337, 0176, 0105, 0102, 
+  0130, 0123, 0272, 0220, 0116, 0306, 0012, 0150, 0164, 0155, 0113, 0230, 0014, 0066, 0117, 0367, 
+  0354, 0004, 0327, 0154, 0156, 0104, 0351, 0150, 0364, 0216, 0053, 0167, 0314, 0124, 0012, 0243, 
+  0253, 0244, 0321, 0150, 0211, 0231, 0060, 0113, 0046, 0224, 0331, 0135, 0061, 0250, 0241, 0166, 
+  0200, 0074, 0272, 0064, 0144, 0110, 0244, 0147, 0341, 0004, 0273, 0341, 0375, 0243, 0072, 0346, 
+  0032, 0160, 0130, 0305, 0352, 0163, 0247, 0347, 0240, 0211, 0215, 0115, 0300, 0262, 0245, 0114, 
+  0174, 0106, 0243, 0027, 0107, 0054, 0275, 0364, 0230, 0010, 0342, 0055, 0327, 0116, 0161, 0317, 
+  0061, 0055, 0123, 0272, 0202, 0260, 0107, 0043, 0202, 0306, 0102, 0054, 0023, 0371, 0231, 0127, 
+  0131, 0154, 0103, 0203, 0314, 0366, 0326, 0254, 0130, 0250, 0113, 0126, 0160, 0013, 0332, 0267, 
+  0246, 0376, 0136, 0076, 0261, 0016, 0367, 0322, 0331, 0214, 0002, 0253, 0217, 0145, 0062, 0370, 
+  0255, 0263, 0167, 0337, 0126, 0144, 0122, 0045, 0165, 0005, 0140, 0371, 0260, 0352, 0022, 0071, 
+  0020, 0233, 0133, 0172, 0340, 0070, 0176, 0307, 0333, 0325, 0131, 0004, 0203, 0313, 0320, 0335, 
+  0130, 0211, 0051, 0341, 0241, 0362, 0151, 0204, 0172, 0343, 0245, 0340, 0352, 0210, 0275, 0053, 
+  0270, 0100, 0001, 0244, 0321, 0250, 0075, 0114, 0056, 0202, 0333, 0031, 0046, 0235, 0037, 0214, 
+  0266, 0364, 0336, 0350, 0155, 0314, 0131, 0134, 0135, 0143, 0344, 0227, 0251, 0032, 0305, 0127, 
+  0246, 0364, 0314, 0371, 0125, 0360, 0013, 0273, 0147, 0134, 0105, 0360, 0105, 0314, 0065, 0340, 
+  0032, 0157, 0055, 0017, 0364, 0200, 0373, 0030, 0324, 0101, 0162, 0317, 0336, 0064, 0005, 0345, 
+  0374, 0140, 0133, 0054, 0053, 0053, 0126, 0201, 0225, 0342, 0246, 0075, 0067, 0026, 0004, 0310, 
+  0005, 0070, 0154, 0014, 0163, 0136, 0052, 0337, 0101, 0203, 0052, 0345, 0213, 0152, 0241, 0076, 
+  0142, 0127, 0142, 0277, 0052, 0065, 0012, 0204, 0222, 0272, 0075, 0102, 0256, 0226, 0174, 0345, 
+  0230, 0313, 0120, 0206, 0327, 0073, 0064, 0127, 0154, 0305, 0015, 0211, 0171, 0203, 0314, 0334, 
+  0363, 0001, 0267, 0005, 0327, 0111, 0173, 0212, 0244, 0122, 0255, 0106, 0205, 0161, 0262, 0056, 
+  0225, 0347, 0073, 0030, 0266, 0173, 0017, 0326, 0304, 0171, 0000, 0177, 0202, 0274, 0074, 0210, 
+  0076, 0055, 0342, 0330, 0077, 0173, 0202, 0345, 0226, 0010, 0055, 0266, 0031, 0167, 0235, 0155, 
+  0317, 0143, 0331, 0350, 0073, 0140, 0331, 0360, 0070, 0313, 0072, 0243, 0152, 0313, 0153, 0067, 
+  0130, 0270, 0111, 0065, 0153, 0356, 0251, 0145, 0357, 0125, 0162, 0277, 0017, 0136, 0246, 0033, 
+  0164, 0237, 0132, 0116, 0356, 0230, 0277, 0164, 0152, 0060, 0167, 0355, 0360, 0122, 0043, 0300, 
+  0026, 0340, 0160, 0324, 0005, 0341, 0137, 0265, 0062, 0005, 0214, 0016, 0270, 0025, 0031, 0253, 
+  0265, 0352, 0022, 0120, 0063, 0256, 0144, 0212, 0151, 0307, 0367, 0036, 0034, 0065, 0216, 0211, 
+  0140, 0127, 0303, 0043, 0072, 0373, 0167, 0025, 0035, 0231, 0033, 0373, 0252, 0067, 0251, 0311, 
+  0065, 0344, 0106, 0113, 0021, 0210, 0226, 0002, 0052, 0336, 0072, 0205, 0010, 0323, 0256, 0116, 
+  0022, 0234, 0156, 0245, 0335, 0146, 0165, 0166, 0311, 0276, 0061, 0171, 0154, 0220, 0274, 0327, 
+  0160, 0353, 0167, 0310, 0121, 0105, 0166, 0041, 0162, 0270, 0315, 0156, 0115, 0247, 0207, 0347, 
+  0323, 0015, 0264, 0275, 0140, 0336, 0366, 0206, 0371, 0213, 0175, 0344, 0301, 0022, 0376, 0230, 
+  0033, 0313, 0377, 0317, 0276, 0014, 0304, 0316, 0154, 0225, 0163, 0217, 0334, 0023, 0034, 0213, 
+  0123, 0204, 0147, 0365, 0254, 0365, 0240, 0061, 0353, 0103, 0160, 0101, 0202, 0213, 0157, 0154, 
+  0124, 0337, 0210, 0250, 0363, 0334, 0372, 0336, 0224, 0055, 0261, 0034, 0247, 0047, 0235, 0140, 
+  0067, 0364, 0306, 0236, 0061, 0101, 0365, 0115, 0251, 0141, 0117, 0224, 0102, 0265, 0220, 0026, 
+  0330, 0022, 0007, 0205, 0123, 0071, 0125, 0123, 0152, 0126, 0173, 0042, 0301, 0023, 0061, 0132, 
+  0255, 0236, 0370, 0365, 0230, 0371, 0065, 0352, 0211, 0137, 0026, 0122, 0270, 0075, 0217, 0131, 
+  0334, 0221, 0031, 0272, 0051, 0025, 0267, 0004, 0303, 0265, 0340, 0302, 0337, 0307, 0117, 0364, 
+  0172, 0314, 0364, 0032, 0367, 0104, 0257, 0365, 0070, 0026, 0243, 0203, 0045, 0267, 0211, 0073, 
+  0225, 0151, 0353, 0251, 0170, 0266, 0165, 0364, 0104, 0257, 0056, 0177, 0061, 0010, 0217, 0060, 
+  0036, 0057, 0013, 0177, 0356, 0211, 0205, 0113, 0313, 0013, 0306, 0255, 0301, 0314, 0235, 0074, 
+  0230, 0175, 0102, 0037, 0244, 0366, 0361, 0304, 0275, 0357, 0200, 0173, 0057, 0172, 0172, 0127, 
+  0371, 0072, 0157, 0120, 0233, 0033, 0365, 0307, 0220, 0365, 0173, 0277, 0153, 0134, 0023, 0154, 
+  0325, 0205, 0321, 0016, 0167, 0140, 0277, 0322, 0350, 0376, 0227, 0205, 0311, 0140, 0307, 0362, 
+  0310, 0302, 0361, 0166, 0141, 0375, 0305, 0252, 0261, 0156, 0320, 0104, 0160, 0007, 0361, 0356, 
+  0063, 0364, 0263, 0377, 0000, 0204, 0023, 0126, 0142, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 
+  0164, 0145, 0162, 0155, 0151, 0156, 0141, 0154, 0056, 0170, 0155, 0154, 0000, 0000, 0000, 0000, 
+  0174, 0014, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0275, 0127, 0115, 0217, 0332, 0060, 
+  0020, 0275, 0363, 0053, 0150, 0356, 0024, 0366, 0116, 0131, 0041, 0012, 0005, 0025, 0130, 0004, 
+  0164, 0053, 0365, 0346, 0044, 0263, 0213, 0265, 0216, 0035, 0071, 0016, 0054, 0375, 0365, 0265, 
+  0235, 0357, 0254, 0035, 0203, 0132, 0025, 0011, 0221, 0314, 0173, 0176, 0236, 0031, 0217, 0355, 
+  0141, 0374, 0370, 0036, 0221, 0376, 0031, 0170, 0202, 0031, 0375, 0342, 0075, 0174, 0036, 0171, 
+  0217, 0223, 0336, 0070, 0305, 0223, 0161, 0004, 0064, 0365, 0021, 0317, 0036, 0372, 0050, 0020, 
+  0232, 0261, 0300, 0004, 0274, 0314, 0206, 0005, 0104, 0015, 0373, 0026, 0056, 0077, 0061, 0015, 
+  0331, 0305, 0033, 0032, 0106, 0225, 0350, 0216, 0263, 0027, 0371, 0236, 0024, 0054, 0223, 0316, 
+  0021, 0371, 0066, 0021, 0011, 0325, 0025, 0022, 0210, 0021, 0107, 0202, 0361, 0016, 0265, 0234, 
+  0157, 0235, 0360, 0200, 0316, 0060, 0143, 0124, 0000, 0025, 0267, 0151, 0316, 0010, 0113, 0240, 
+  0346, 0243, 0231, 0120, 0045, 0143, 0250, 0110, 0255, 0160, 0346, 0041, 0026, 0246, 0114, 0052, 
+  0373, 0214, 0305, 0127, 0243, 0266, 0002, 0167, 0050, 0021, 0320, 0215, 0376, 0330, 0257, 0166, 
+  0110, 0234, 0334, 0301, 0250, 0021, 0007, 0040, 0020, 0210, 0051, 0041, 0067, 0261, 0073, 0127, 
+  0117, 0021, 0276, 0303, 0325, 0227, 0201, 0143, 0372, 0152, 0347, 0314, 0122, 0316, 0145, 0262, 
+  0153, 0353, 0142, 0312, 0320, 0063, 0206, 0213, 0051, 0103, 0312, 0276, 0311, 0252, 0323, 0070, 
+  0203, 0302, 0027, 0051, 0041, 0111, 0300, 0001, 0250, 0063, 0052, 0105, 0377, 0305, 0130, 0264, 
+  0242, 0136, 0027, 0374, 0224, 0212, 0116, 0374, 0141, 0064, 0262, 0005, 0162, 0000, 0304, 0203, 
+  0223, 0051, 0224, 0014, 0131, 0310, 0174, 0031, 0265, 0053, 0170, 0013, 0357, 0302, 0101, 0331, 
+  0161, 0070, 0143, 0226, 0352, 0254, 0177, 0032, 0014, 0172, 0175, 0375, 0261, 0215, 0130, 0121, 
+  0231, 0035, 0211, 0011, 0104, 0162, 0367, 0206, 0223, 0174, 0310, 0140, 0320, 0020, 0250, 0045, 
+  0357, 0203, 0046, 0105, 0021, 0024, 0212, 0063, 0042, 0177, 0226, 0370, 0365, 0104, 0344, 0127, 
+  0170, 0255, 0371, 0132, 0350, 0337, 0116, 0366, 0215, 0035, 0331, 0032, 0123, 0120, 0165, 0320, 
+  0236, 0252, 0300, 0232, 0223, 0230, 0026, 0346, 0010, 0074, 0302, 0024, 0021, 0317, 0142, 0057, 
+  0213, 0175, 0062, 0216, 0011, 0012, 0340, 0304, 0110, 0010, 0074, 0167, 0244, 0000, 0167, 0113, 
+  0147, 0211, 0345, 0124, 0353, 0042, 0346, 0170, 0175, 0005, 0153, 0356, 0066, 0250, 0205, 0153, 
+  0007, 0020, 0107, 0054, 0252, 0103, 0315, 0104, 0230, 0323, 0200, 0251, 0215, 0150, 0164, 0277, 
+  0000, 0157, 0361, 0277, 0320, 0234, 0206, 0141, 0251, 0131, 0371, 0170, 0323, 0320, 0075, 0044, 
+  0140, 0016, 0276, 0301, 0320, 0145, 0322, 0366, 0347, 0243, 0363, 0145, 0220, 0370, 0067, 0034, 
+  0131, 0026, 0201, 0161, 0201, 0221, 0237, 0230, 0366, 0235, 0262, 0133, 0127, 0103, 0201, 0365, 
+  0245, 0350, 0216, 0117, 0222, 0067, 0354, 0014, 0153, 0170, 0261, 0253, 0051, 0302, 0076, 0257, 
+  0173, 0267, 0334, 0127, 0020, 0110, 0357, 0307, 0006, 0325, 0024, 0336, 0022, 0110, 0154, 0012, 
+  0117, 0331, 0353, 0027, 0232, 0221, 0060, 0365, 0131, 0166, 0244, 0345, 0312, 0303, 0362, 0306, 
+  0217, 0131, 0234, 0306, 0105, 0225, 0253, 0347, 0152, 0207, 0145, 0257, 0246, 0022, 0126, 0300, 
+  0123, 0014, 0164, 0171, 0215, 0201, 0023, 0114, 0337, 0314, 0225, 0256, 0150, 0352, 0172, 0053, 
+  0151, 0262, 0246, 0070, 0044, 0356, 0104, 0353, 0221, 0007, 0240, 0341, 0074, 0102, 0230, 0164, 
+  0213, 0153, 0112, 0115, 0330, 0302, 0104, 0304, 0241, 0243, 0030, 0116, 0031, 0025, 0364, 0332, 
+  0031, 0357, 0372, 0336, 0120, 0125, 0253, 0123, 0034, 0117, 0235, 0244, 0254, 0015, 0161, 0013, 
+  0166, 0066, 0055, 0025, 0243, 0352, 0132, 0156, 0220, 0264, 0365, 0051, 0032, 0265, 0067, 0052, 
+  0025, 0334, 0325, 0251, 0064, 0351, 0377, 0372, 0114, 0166, 0366, 0041, 0167, 0365, 0034, 0332, 
+  0305, 0065, 0310, 0106, 0362, 0216, 0316, 0103, 0017, 0132, 0321, 0070, 0025, 0033, 0020, 0047, 
+  0026, 0146, 0007, 0277, 0336, 0175, 0315, 0115, 0270, 0145, 0002, 0174, 0306, 0336, 0132, 0233, 
+  0261, 0151, 0376, 0017, 0207, 0223, 0341, 0356, 0271, 0253, 0127, 0056, 0142, 0033, 0312, 0077, 
+  0030, 0275, 0077, 0156, 0216, 0163, 0001, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0057, 0000, 
+  0011, 0000, 0000, 0000, 0160, 0162, 0157, 0146, 0151, 0154, 0145, 0055, 0160, 0162, 0145, 0146, 
+  0145, 0162, 0145, 0156, 0143, 0145, 0163, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0060, 0042, 0001, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0075, 0153, 0167, 0332, 0072, 
+  0266, 0337, 0363, 0053, 0164, 0371, 0060, 0153, 0146, 0156, 0235, 0360, 0012, 0041, 0075, 0055, 
+  0263, 0322, 0064, 0071, 0315, 0232, 0236, 0266, 0053, 0244, 0353, 0334, 0176, 0142, 0011, 0133, 
+  0200, 0046, 0302, 0362, 0130, 0042, 0204, 0363, 0353, 0357, 0226, 0014, 0204, 0207, 0001, 0143, 
+  0154, 0107, 0070, 0356, 0227, 0102, 0220, 0267, 0265, 0037, 0332, 0057, 0155, 0155, 0175, 0370, 
+  0327, 0363, 0220, 0241, 0047, 0342, 0013, 0312, 0335, 0217, 0245, 0312, 0151, 0271, 0204, 0210, 
+  0153, 0163, 0207, 0272, 0375, 0217, 0245, 0237, 0017, 0267, 0126, 0263, 0364, 0257, 0326, 0311, 
+  0207, 0377, 0261, 0054, 0364, 0073, 0161, 0211, 0217, 0045, 0161, 0320, 0230, 0312, 0001, 0352, 
+  0063, 0354, 0020, 0124, 0073, 0255, 0065, 0117, 0253, 0350, 0344, 0344, 0232, 0173, 0023, 0237, 
+  0366, 0007, 0022, 0375, 0375, 0372, 0037, 0350, 0217, 0253, 0207, 0033, 0344, 0220, 0047, 0302, 
+  0270, 0007, 0300, 0117, 0116, 0036, 0006, 0124, 0240, 0036, 0145, 0004, 0301, 0377, 0036, 0366, 
+  0045, 0342, 0075, 0064, 0004, 0150, 0226, 0044, 0376, 0220, 0272, 0230, 0235, 0236, 0234, 0054, 
+  0175, 0127, 0003, 0173, 0076, 0041, 0110, 0360, 0236, 0034, 0143, 0237, 0274, 0107, 0023, 0076, 
+  0102, 0066, 0166, 0221, 0117, 0034, 0052, 0244, 0117, 0273, 0043, 0011, 0360, 0044, 0302, 0256, 
+  0163, 0306, 0175, 0064, 0204, 0151, 0367, 0046, 0047, 0360, 0207, 0221, 0353, 0020, 0037, 0311, 
+  0001, 0101, 0012, 0232, 0120, 0357, 0122, 0137, 0176, 0377, 0366, 0163, 0212, 0005, 0103, 0077, 
+  0106, 0135, 0106, 0155, 0364, 0225, 0332, 0304, 0025, 0004, 0141, 0230, 0225, 0372, 0213, 0030, 
+  0000, 0176, 0335, 0311, 0211, 0032, 0176, 0253, 0336, 0336, 0236, 0276, 0035, 0335, 0162, 0200, 
+  0212, 0045, 0320, 0351, 0035, 0042, 0100, 0000, 0170, 0301, 0224, 0156, 0250, 0066, 0173, 0301, 
+  0024, 0332, 0073, 0304, 0375, 0223, 0277, 0143, 0251, 0046, 0354, 0043, 0356, 0251, 0207, 0376, 
+  0001, 0263, 0234, 0040, 0006, 0030, 0316, 0237, 0013, 0303, 0370, 0005, 0061, 0007, 0121, 0127, 
+  0003, 0035, 0000, 0011, 0341, 0003, 0200, 0003, 0314, 0306, 0224, 0061, 0324, 0045, 0150, 0044, 
+  0110, 0157, 0304, 0336, 0235, 0300, 0110, 0364, 0347, 0335, 0303, 0227, 0357, 0077, 0037, 0320, 
+  0325, 0267, 0137, 0350, 0317, 0253, 0373, 0373, 0253, 0157, 0017, 0277, 0176, 0323, 0114, 0342, 
+  0360, 0053, 0060, 0041, 0200, 0103, 0207, 0036, 0243, 0212, 0173, 0330, 0367, 0261, 0053, 0047, 
+  0060, 0351, 0223, 0077, 0156, 0356, 0257, 0277, 0300, 0370, 0253, 0117, 0167, 0137, 0357, 0036, 
+  0176, 0301, 0274, 0321, 0355, 0335, 0303, 0267, 0233, 0166, 0033, 0335, 0176, 0277, 0107, 0127, 
+  0350, 0307, 0325, 0375, 0303, 0335, 0365, 0317, 0257, 0127, 0367, 0350, 0307, 0317, 0373, 0037, 
+  0337, 0333, 0067, 0247, 0010, 0265, 0211, 0232, 0020, 0071, 0331, 0102, 0317, 0236, 0346, 0007, 
+  0220, 0315, 0041, 0022, 0123, 0046, 0000, 0327, 0137, 0300, 0075, 0001, 0123, 0142, 0016, 0032, 
+  0340, 0047, 0002, 0134, 0264, 0011, 0175, 0202, 0011, 0141, 0144, 0203, 0360, 0354, 0146, 0322, 
+  0011, 0146, 0334, 0355, 0007, 0322, 0267, 0054, 0072, 0010, 0335, 0365, 0220, 0313, 0345, 0073, 
+  0044, 0140, 0152, 0037, 0006, 0122, 0172, 0357, 0317, 0316, 0306, 0343, 0361, 0151, 0337, 0035, 
+  0235, 0162, 0277, 0177, 0306, 0002, 0020, 0342, 0254, 0005, 0063, 0271, 0032, 0001, 0151, 0374, 
+  0367, 0350, 0117, 0316, 0172, 0175, 0014, 0040, 0177, 0262, 0256, 0117, 0355, 0301, 0311, 0211, 
+  0145, 0005, 0302, 0376, 0117, 0113, 0111, 0023, 0210, 0234, 0132, 0036, 0360, 0115, 0375, 0231, 
+  0272, 0360, 0276, 0036, 0266, 0111, 0353, 0203, 0117, 0376, 0073, 0242, 0076, 0021, 0210, 0321, 
+  0356, 0307, 0122, 0137, 0076, 0376, 0157, 0351, 0145, 0021, 0325, 0116, 0253, 0325, 0322, 0131, 
+  0113, 0257, 0231, 0371, 0063, 0326, 0164, 0002, 0226, 0234, 0000, 0067, 0373, 0036, 0173, 0252, 
+  0041, 0200, 0272, 0062, 0310, 0305, 0103, 0262, 0214, 0132, 0310, 0040, 0207, 0010, 0333, 0247, 
+  0132, 0250, 0220, 0347, 0223, 0036, 0361, 0141, 0305, 0022, 0261, 0266, 0240, 0102, 0036, 0265, 
+  0347, 0213, 0164, 0145, 0201, 0206, 0214, 0305, 0232, 0110, 0142, 0215, 0110, 0172, 0050, 0357, 
+  0376, 0207, 0330, 0022, 0331, 0014, 0013, 0361, 0261, 0364, 0273, 0174, 0274, 0162, 0376, 0063, 
+  0022, 0162, 0110, 0134, 0131, 0102, 0324, 0371, 0130, 0302, 0363, 0357, 0225, 0122, 0353, 0203, 
+  0347, 0253, 0267, 0200, 0310, 0051, 0004, 0077, 0226, 0030, 0037, 0023, 0277, 0324, 0252, 0174, 
+  0070, 0233, 0375, 0260, 0066, 0144, 0344, 0171, 0172, 0110, 0271, 0132, 0337, 0062, 0352, 0011, 
+  0263, 0021, 0051, 0265, 0232, 0345, 0055, 0143, 0204, 0044, 0236, 0105, 0135, 0333, 0047, 0172, 
+  0166, 0133, 0337, 0352, 0341, 0076, 0131, 0032, 0273, 0004, 0370, 0054, 0300, 0172, 0057, 0354, 
+  0253, 0351, 0143, 0277, 0165, 0314, 0353, 0142, 0137, 0053, 0155, 0104, 0155, 0067, 0136, 0345, 
+  0323, 0112, 0071, 0370, 0127, 0251, 0137, 0356, 0201, 0142, 0371, 0264, 0134, 0276, 0014, 0376, 
+  0135, 0134, 0064, 0352, 0315, 0075, 0060, 0336, 0370, 0312, 0070, 0310, 0327, 0017, 0141, 0175, 
+  0265, 0122, 0277, 0250, 0067, 0153, 0215, 0372, 0305, 0156, 0102, 0125, 0122, 0343, 0177, 0104, 
+  0001, 0270, 0033, 0302, 0223, 0001, 0372, 0124, 0175, 0014, 0131, 0362, 0117, 0124, 0320, 0056, 
+  0203, 0311, 0076, 0370, 0043, 0262, 0145, 0016, 0140, 0336, 0255, 0036, 0267, 0107, 0242, 0324, 
+  0272, 0305, 0114, 0154, 0033, 0112, 0155, 0356, 0152, 0215, 0131, 0152, 0215, 0251, 0353, 0360, 
+  0261, 0145, 0063, 0276, 0374, 0104, 0364, 0051, 0127, 0263, 0236, 0362, 0200, 0060, 0317, 0352, 
+  0372, 0174, 0054, 0210, 0037, 0155, 0312, 0137, 0301, 0065, 0150, 0113, 0260, 0251, 0301, 0264, 
+  0225, 0175, 0142, 0212, 0322, 0066, 0147, 0243, 0241, 0053, 0002, 0375, 0035, 0174, 0011, 0014, 
+  0111, 0337, 0036, 0140, 0137, 0031, 0373, 0211, 0326, 0331, 0301, 0117, 0110, 0031, 0040, 0260, 
+  0131, 0363, 0337, 0224, 0251, 0072, 0233, 0303, 0000, 0017, 0007, 0203, 0175, 0343, 0143, 0075, 
+  0136, 0277, 0010, 0134, 0102, 0011, 0016, 0203, 0000, 0337, 0005, 0003, 0075, 0076, 0226, 0046, 
+  0004, 0120, 0375, 0304, 0270, 0375, 0250, 0037, 0204, 0307, 0365, 0370, 0010, 0017, 0335, 0131, 
+  0237, 0010, 0036, 0356, 0373, 0324, 0117, 0345, 0315, 0061, 0352, 0222, 0245, 0007, 0317, 0202, 
+  0251, 0356, 0107, 0257, 0352, 0253, 0321, 0353, 0236, 0170, 0014, 0314, 0052, 0030, 0130, 0052, 
+  0051, 0030, 0147, 0111, 0045, 0043, 0373, 0122, 0342, 0012, 0224, 0203, 0353, 0034, 0006, 0343, 
+  0207, 0117, 0016, 0007, 0362, 0157, 0102, 0274, 0055, 0020, 0142, 0361, 0246, 0366, 0152, 0274, 
+  0271, 0171, 0006, 0317, 0172, 0026, 0055, 0050, 0327, 0151, 0137, 0162, 0334, 0023, 0041, 0125, 
+  0114, 0243, 0140, 0330, 0174, 0070, 0204, 0200, 0144, 0137, 0020, 0137, 0070, 0370, 0305, 0213, 
+  0163, 0200, 0270, 0201, 0270, 0207, 0123, 0265, 0376, 0152, 0124, 0275, 0006, 0073, 0310, 0207, 
+  0207, 0143, 0160, 0376, 0152, 0030, 0074, 0200, 0333, 0313, 0367, 0145, 0344, 0127, 0352, 0216, 
+  0236, 0141, 0216, 0256, 0340, 0373, 0257, 0253, 0377, 0173, 0000, 0356, 0357, 0055, 0175, 0317, 
+  0117, 0162, 0337, 0147, 0332, 0234, 0141, 0237, 0376, 0105, 0366, 0226, 0323, 0244, 0270, 0332, 
+  0170, 0065, 0256, 0176, 0017, 0302, 0141, 0106, 0172, 0022, 0011, 0352, 0354, 0315, 0243, 0351, 
+  0363, 0101, 0034, 0025, 0007, 0300, 0147, 0052, 0324, 0067, 0347, 0160, 0042, 0136, 0274, 0032, 
+  0021, 0041, 0204, 0346, 0020, 0155, 0122, 0173, 0157, 0371, 0341, 0256, 0364, 0071, 0263, 0276, 
+  0354, 0155, 0373, 0332, 0327, 0167, 0167, 0350, 0363, 0315, 0327, 0175, 0037, 0274, 0021, 0066, 
+  0206, 0230, 0133, 0100, 0314, 0256, 0002, 0345, 0175, 0037, 0177, 0170, 0370, 0205, 0156, 0174, 
+  0054, 0022, 0260, 0160, 0315, 0202, 0135, 0307, 0304, 0256, 0313, 0127, 0143, 0327, 0117, 0001, 
+  0004, 0230, 0100, 0354, 0066, 0004, 0072, 0110, 0111, 0335, 0276, 0330, 0233, 0376, 0154, 0214, 
+  0047, 0002, 0165, 0301, 0157, 0336, 0333, 0115, 0377, 0106, 0236, 0210, 0037, 0362, 0350, 0116, 
+  0052, 0176, 0006, 0167, 0220, 0367, 0003, 0022, 0102, 0110, 0243, 0362, 0275, 0026, 0161, 0050, 
+  0320, 0325, 0162, 0202, 0237, 0016, 0211, 0236, 0272, 0334, 0207, 0100, 0300, 0032, 0123, 0107, 
+  0016, 0112, 0255, 0363, 0055, 0043, 0265, 0107, 0272, 0301, 0373, 0325, 0263, 0102, 0067, 0172, 
+  0126, 0133, 0100, 0200, 0320, 0103, 0224, 0266, 0224, 0120, 0263, 0226, 0121, 0332, 0362, 0260, 
+  0103, 0172, 0170, 0304, 0344, 0154, 0252, 0215, 0162, 0071, 0302, 0340, 0001, 0121, 0026, 0245, 
+  0324, 0252, 0357, 0030, 0055, 0140, 0101, 0116, 0054, 0225, 0005, 0265, 0074, 0354, 0353, 0110, 
+  0175, 0107, 0204, 0252, 0244, 0322, 0032, 0120, 0065, 0062, 0140, 0303, 0342, 0130, 0173, 0100, 
+  0231, 0023, 0344, 0375, 0024, 0216, 0372, 0053, 0004, 0277, 0135, 0376, 0134, 0012, 0341, 0360, 
+  0047, 0370, 0263, 0146, 0157, 0000, 0310, 0122, 0343, 0262, 0011, 0367, 0271, 0117, 0001, 0127, 
+  0235, 0200, 0057, 0265, 0100, 0076, 0101, 0231, 0051, 0107, 0175, 0163, 0346, 0303, 0303, 0066, 
+  0054, 0234, 0122, 0253, 0272, 0033, 0133, 0154, 0053, 0260, 0035, 0240, 0046, 0016, 0105, 0172, 
+  0044, 0045, 0167, 0127, 0121, 0137, 0170, 0050, 0033, 0012, 0060, 0074, 0341, 0043, 0151, 0011, 
+  0071, 0121, 0160, 0211, 0212, 0061, 0126, 0020, 0333, 0070, 0367, 0140, 0342, 0052, 0347, 0320, 
+  0325, 0337, 0303, 0322, 0222, 0270, 0113, 0130, 0350, 0232, 0351, 0174, 0201, 0347, 0266, 0245, 
+  0241, 0366, 0107, 0065, 0302, 0310, 0351, 0262, 0330, 0071, 0166, 0272, 0215, 0040, 0136, 0036, 
+  0330, 0231, 0205, 0321, 0271, 0237, 0126, 0220, 0367, 0331, 0226, 0212, 0023, 0304, 0032, 0315, 
+  0162, 0017, 0073, 0347, 0201, 0265, 0302, 0265, 0304, 0200, 0217, 0255, 0351, 0033, 0126, 0237, 
+  0230, 0053, 0116, 0020, 0315, 0107, 0220, 0315, 0065, 0030, 0344, 0331, 0203, 0320, 0161, 0347, 
+  0253, 0100, 0011, 0261, 0235, 0203, 0074, 0056, 0150, 0260, 0130, 0226, 0263, 0170, 0363, 0167, 
+  0237, 0115, 0105, 0046, 0212, 0344, 0350, 0314, 0132, 0034, 0321, 0271, 0136, 0115, 0311, 0345, 
+  0110, 0166, 0052, 0157, 0100, 0166, 0052, 0333, 0145, 0047, 0362, 0254, 0166, 0321, 0065, 0332, 
+  0264, 0340, 0045, 0172, 0003, 0155, 0115, 0373, 0045, 0055, 0373, 0337, 0270, 0044, 0135, 0316, 
+  0037, 0103, 0135, 0031, 0167, 0366, 0143, 0006, 0322, 0274, 0305, 0347, 0331, 0270, 0156, 0147, 
+  0166, 0112, 0331, 0346, 0132, 0046, 0226, 0151, 0171, 0226, 0225, 0152, 0032, 0146, 0274, 0261, 
+  0027, 0356, 0003, 0345, 0227, 0324, 0316, 0063, 0301, 0176, 0076, 0305, 0112, 0065, 0312, 0034, 
+  0277, 0006, 0332, 0162, 0121, 0260, 0024, 0034, 0053, 0320, 0242, 0131, 0114, 0170, 0200, 0031, 
+  0355, 0003, 0371, 0165, 0322, 0162, 0373, 0376, 0222, 0036, 0147, 0023, 0345, 0057, 0155, 0365, 
+  0114, 0066, 0032, 0200, 0231, 0303, 0255, 0006, 0276, 0117, 0114, 0141, 0252, 0075, 0066, 0332, 
+  0233, 0104, 0230, 0332, 0320, 0045, 0103, 0356, 0122, 0133, 0011, 0147, 0237, 0200, 0206, 0137, 
+  0242, 0071, 0074, 0355, 0117, 0142, 0251, 0331, 0150, 0012, 0155, 0327, 0250, 0203, 0025, 0325, 
+  0215, 0102, 0040, 0104, 0230, 0064, 0142, 0251, 0050, 0250, 0067, 0141, 0210, 0122, 0347, 0333, 
+  0365, 0200, 0330, 0113, 0036, 0126, 0020, 0356, 0003, 0321, 0135, 0011, 0121, 0011, 0374, 0030, 
+  0170, 0133, 0173, 0071, 0133, 0052, 0155, 0240, 0122, 0223, 0323, 0324, 0101, 0217, 0076, 0353, 
+  0142, 0055, 0120, 0312, 0110, 0301, 0315, 0324, 0015, 0333, 0337, 0265, 0212, 0252, 0225, 0366, 
+  0323, 0024, 0216, 0217, 0301, 0247, 0162, 0035, 0060, 0063, 0140, 0273, 0017, 0020, 0347, 0244, 
+  0005, 0247, 0022, 0117, 0160, 0256, 0024, 0221, 0026, 0312, 0015, 0146, 0137, 0053, 0345, 0112, 
+  0371, 0062, 0233, 0060, 0224, 0364, 0244, 0345, 0141, 0307, 0331, 0303, 0346, 0315, 0355, 0262, 
+  0226, 0357, 0101, 0220, 0134, 0060, 0331, 0062, 0353, 0171, 0012, 0302, 0140, 0000, 0170, 0174, 
+  0371, 0064, 0315, 0267, 0200, 0143, 0162, 0046, 0171, 0315, 0320, 0056, 0221, 0360, 0230, 0155, 
+  0254, 0242, 0323, 0242, 0252, 0136, 0102, 0054, 0213, 0040, 0100, 0217, 0262, 0270, 0153, 0331, 
+  0214, 0332, 0217, 0273, 0061, 0336, 0137, 0367, 0052, 0224, 0112, 0255, 0066, 0310, 0010, 0332, 
+  0352, 0275, 0157, 0116, 0254, 0136, 0017, 0070, 0104, 0372, 0350, 0012, 0075, 0314, 0366, 0257, 
+  0157, 0267, 0233, 0034, 0045, 0135, 0301, 0153, 0167, 0140, 0257, 0006, 0012, 0372, 0027, 0071, 
+  0036, 0335, 0075, 0237, 0327, 0253, 0173, 0047, 0325, 0204, 0274, 0023, 0314, 0030, 0037, 0133, 
+  0135, 0316, 0234, 0330, 0316, 0311, 0225, 0002, 0201, 0272, 0272, 0314, 0201, 0074, 0027, 0316, 
+  0210, 0121, 0316, 0110, 0055, 0051, 0057, 0126, 0145, 0260, 0300, 0035, 0031, 0165, 0261, 0037, 
+  0127, 0122, 0332, 0000, 0003, 0165, 0246, 0100, 0120, 0167, 0202, 0246, 0114, 0123, 0365, 0360, 
+  0056, 0031, 0317, 0013, 0144, 0104, 0041, 0102, 0046, 0211, 0120, 0075, 0041, 0021, 0002, 0261, 
+  0140, 0161, 0105, 0147, 0156, 0173, 0072, 0012, 0112, 0041, 0037, 0046, 0311, 0307, 0171, 0102, 
+  0362, 0241, 0316, 0060, 0304, 0225, 0017, 0165, 0110, 0011, 0005, 0236, 0033, 0011, 0314, 0220, 
+  0332, 0012, 0344, 0250, 0003, 0216, 0225, 0327, 0345, 0330, 0167, 0012, 0231, 0061, 0111, 0146, 
+  0032, 0011, 0311, 0214, 0166, 0041, 0037, 0111, 0154, 0271, 0371, 0102, 0373, 0003, 0246, 0353, 
+  0275, 0072, 0355, 0263, 0177, 0223, 0011, 0262, 0201, 0021, 0214, 0270, 0175, 0042, 0246, 0147, 
+  0315, 0206, 0034, 0336, 0201, 0074, 0116, 0167, 0204, 0143, 0205, 0020, 0145, 0056, 0104, 0027, 
+  0011, 0012, 0321, 0310, 0147, 0042, 0001, 0041, 0372, 0171, 0377, 0265, 0020, 0034, 0343, 0005, 
+  0247, 0031, 0163, 0337, 0174, 0151, 0017, 0252, 0176, 0141, 0170, 0246, 0113, 0013, 0154, 0275, 
+  0131, 0315, 0064, 0275, 0265, 0063, 0155, 0225, 0100, 0176, 0353, 0172, 0344, 0013, 0036, 0224, 
+  0261, 0165, 0036, 0123, 0314, 0163, 0331, 0372, 0075, 0226, 0056, 0227, 0263, 0154, 0076, 0354, 
+  0162, 0340, 0373, 0061, 0347, 0273, 0256, 0025, 0016, 0163, 0051, 0016, 0105, 0157, 0135, 0130, 
+  0364, 0066, 0203, 0245, 0016, 0306, 0022, 0241, 0316, 0216, 0125, 0313, 0311, 0052, 0263, 0135, 
+  0130, 0353, 0212, 0315, 0122, 0053, 0050, 0334, 0214, 0262, 0004, 0256, 0041, 0102, 0270, 0047, 
+  0212, 0355, 0304, 0177, 0000, 0117, 0060, 0300, 0326, 0237, 0376, 0345, 0122, 0125, 0156, 0142, 
+  0071, 0075, 0213, 0055, 0026, 0076, 0317, 0062, 0141, 0352, 0021, 0105, 0341, 0371, 0017, 0255, 
+  0205, 0317, 0342, 0325, 0112, 0044, 0014, 0255, 0334, 0230, 0117, 0353, 0062, 0021, 0245, 0132, 
+  0076, 0016, 0245, 0132, 0316, 0253, 0122, 0355, 0210, 0001, 0366, 0110, 0372, 0112, 0125, 0277, 
+  0046, 0277, 0112, 0165, 0031, 0075, 0263, 0225, 0152, 0345, 0160, 0245, 0132, 0051, 0224, 0152, 
+  0112, 0323, 0052, 0047, 0241, 0125, 0153, 0015, 0303, 0265, 0352, 0230, 0373, 0152, 0377, 0001, 
+  0373, 0042, 0250, 0157, 0311, 0347, 0276, 0154, 0133, 0347, 0247, 0254, 0356, 0304, 0352, 0050, 
+  0204, 0221, 0076, 0114, 0142, 0003, 0064, 0141, 0104, 0375, 0324, 0052, 0023, 0162, 0122, 0075, 
+  0265, 0212, 0126, 0121, 0073, 0225, 0276, 0326, 0252, 0044, 0230, 0231, 0261, 0365, 0271, 0324, 
+  0131, 0056, 0103, 0157, 0030, 0307, 0115, 0324, 0250, 0062, 0252, 0000, 0334, 0174, 0353, 0151, 
+  0176, 0050, 0133, 0320, 0316, 0137, 0244, 0110, 0323, 0030, 0125, 0110, 0125, 0115, 0274, 0222, 
+  0252, 0122, 0066, 0277, 0222, 0152, 0111, 0322, 0217, 0240, 0242, 0152, 0151, 0276, 0331, 0033, 
+  0356, 0054, 0202, 0243, 0317, 0123, 0155, 0241, 0120, 0174, 0177, 0314, 0166, 0161, 0045, 0332, 
+  0256, 0145, 0053, 0132, 0221, 0052, 0375, 0333, 0036, 0165, 0027, 0155, 0300, 0262, 0342, 0017, 
+  0116, 0334, 0132, 0002, 0006, 0155, 0322, 0377, 0311, 0153, 0352, 0227, 0326, 0117, 0245, 0326, 
+  0102, 0377, 0263, 0155, 0260, 0031, 0035, 0166, 0055, 0325, 0124, 0161, 0325, 0110, 0037, 0325, 
+  0111, 0261, 0115, 0253, 0174, 0306, 0206, 0174, 0256, 0366, 0051, 0166, 0107, 0125, 0220, 0146, 
+  0126, 0270, 0034, 0121, 0375, 0124, 0217, 0115, 0375, 0250, 0256, 0136, 0106, 0350, 0236, 0352, 
+  0333, 0325, 0075, 0232, 0007, 0371, 0124, 0074, 0012, 0265, 0102, 0353, 0304, 0056, 0172, 0115, 
+  0273, 0072, 0067, 0272, 0166, 0254, 0035, 0110, 0077, 0020, 0012, 0153, 0003, 0317, 0066, 0054, 
+  0240, 0151, 0203, 0022, 0170, 0260, 0024, 0141, 0003, 0243, 0226, 0277, 0115, 0341, 0151, 0147, 
+  0341, 0054, 0022, 0151, 0051, 0260, 0157, 0327, 0151, 0337, 0313, 0112, 0156, 0216, 0373, 0126, 
+  0232, 0173, 0237, 0165, 0276, 0270, 0064, 0273, 0021, 0111, 0043, 0316, 0046, 0142, 0255, 0226, 
+  0267, 0374, 0366, 0337, 0230, 0374, 0255, 0373, 0267, 0276, 0374, 0355, 0101, 0035, 0046, 0121, 
+  0337, 0316, 0364, 0327, 0035, 0153, 0162, 0210, 0375, 0307, 0221, 0147, 0120, 0336, 0251, 0234, 
+  0374, 0001, 0276, 0246, 0371, 0151, 0047, 0255, 0146, 0152, 0071, 0130, 0150, 0053, 0173, 0137, 
+  0246, 0227, 0151, 0351, 0223, 0127, 0171, 0336, 0366, 0272, 0233, 0166, 0223, 0355, 0150, 0114, 
+  0215, 0330, 0352, 0132, 0240, 0171, 0116, 0166, 0271, 0026, 0060, 0052, 0066, 0270, 0114, 0355, 
+  0273, 0264, 0254, 0230, 0232, 0107, 0241, 0230, 0124, 0211, 0310, 0274, 0220, 0045, 0237, 0012, 
+  0352, 0317, 0201, 0272, 0110, 0145, 0266, 0021, 0070, 0155, 0363, 0054, 0124, 0203, 0106, 0325, 
+  0164, 0201, 0372, 0210, 0167, 0306, 0156, 0320, 0014, 0133, 0030, 0244, 0276, 0226, 0070, 0223, 
+  0237, 0012, 0252, 0020, 0344, 0112, 0131, 0227, 0104, 0125, 0017, 0057, 0211, 0252, 0146, 0137, 
+  0022, 0365, 0026, 0124, 0157, 0345, 0130, 0122, 0100, 0146, 0146, 0320, 0312, 0011, 0344, 0042, 
+  0062, 0052, 0176, 0315, 0070, 0032, 0157, 0344, 0066, 0032, 0277, 0016, 0014, 0132, 0021, 0217, 
+  0057, 0304, 0343, 0027, 0307, 0021, 0217, 0067, 0015, 0351, 0300, 0033, 0055, 0171, 0120, 0315, 
+  0201, 0136, 0130, 0053, 0101, 0143, 0274, 0117, 0135, 0113, 0014, 0016, 0070, 0274, 0336, 0271, 
+  0037, 0271, 0063, 0267, 0122, 0335, 0107, 0210, 0221, 0006, 0212, 0064, 0320, 0242, 0344, 0314, 
+  0077, 0176, 0125, 0263, 0255, 0160, 0161, 0312, 0370, 0270, 0302, 0163, 0077, 0352, 0270, 0352, 
+  0042, 0305, 0240, 0154, 0161, 0046, 0105, 0324, 0025, 0222, 0140, 0107, 0137, 0015, 0070, 0051, 
+  0004, 0051, 0257, 0115, 0340, 0126, 0104, 0050, 0253, 0120, 0350, 0040, 0273, 0025, 0044, 0067, 
+  0352, 0206, 0047, 0067, 0126, 0050, 0233, 0343, 0364, 0353, 0365, 0114, 0163, 0164, 0064, 0252, 
+  0106, 0044, 0060, 0302, 0250, 0237, 0223, 0104, 0154, 0030, 0152, 0157, 0061, 0043, 0153, 0170, 
+  0255, 0110, 0044, 0065, 0126, 0065, 0175, 0357, 0210, 0074, 0123, 0071, 0275, 0256, 0342, 0055, 
+  0344, 0150, 0147, 0336, 0117, 0107, 0341, 0155, 0106, 0052, 0066, 0214, 0003, 0371, 0311, 0305, 
+  0206, 0141, 0227, 0171, 0062, 0266, 0166, 0170, 0062, 0266, 0126, 0044, 0143, 0323, 0230, 0125, 
+  0355, 0050, 0223, 0234, 0105, 0216, 0070, 0335, 0151, 0355, 0027, 0004, 0355, 0131, 0270, 0330, 
+  0314, 0135, 0341, 0242, 0056, 0226, 0102, 0312, 0254, 0135, 0317, 0056, 0230, 0065, 0240, 0204, 
+  0161, 0003, 0023, 0323, 0057, 0164, 0054, 0277, 0345, 0102, 0307, 0146, 0065, 0217, 0133, 0053, 
+  0227, 0271, 0335, 0132, 0271, 0345, 0076, 0351, 0373, 0034, 0226, 0344, 0073, 0364, 0011, 0344, 
+  0175, 0376, 0131, 0065, 0103, 0126, 0113, 0172, 0176, 0303, 0171, 0261, 0373, 0262, 0260, 0373, 
+  0162, 0176, 0044, 0325, 0220, 0365, 0074, 0156, 0150, 0050, 0041, 0223, 0003, 0062, 0324, 0247, 
+  0370, 0270, 0057, 0016, 0272, 0224, 0044, 0000, 0201, 0172, 0076, 0037, 0316, 0056, 0047, 0321, 
+  0260, 0015, 0117, 0106, 0277, 0355, 0335, 0212, 0225, 0123, 0170, 0246, 0337, 0245, 0245, 0145, 
+  0314, 0022, 0366, 0124, 0146, 0363, 0234, 0345, 0370, 0064, 0242, 0114, 0132, 0152, 0153, 0020, 
+  0260, 0355, 0014, 0015, 0051, 0067, 0013, 0145, 0100, 0216, 0132, 0166, 0205, 0241, 0147, 0136, 
+  0313, 0256, 0247, 0210, 0142, 0270, 0230, 0072, 0251, 0247, 0310, 0245, 0174, 0027, 0222, 0105, 
+  0324, 0235, 0131, 0067, 0326, 0012, 0013, 0051, 0324, 0005, 0346, 0356, 0354, 0110, 0376, 0307, 
+  0032, 0174, 0126, 0347, 0110, 0341, 0203, 0272, 0276, 0174, 0015, 0201, 0337, 0175, 0352, 0114, 
+  0013, 0055, 0225, 0342, 0251, 0145, 0123, 0141, 0002, 0063, 0262, 0302, 0375, 0226, 0125, 0230, 
+  0301, 0115, 0354, 0207, 0334, 0357, 0064, 0163, 0311, 0003, 0377, 0306, 0243, 0366, 0043, 0311, 
+  0353, 0105, 0117, 0052, 0323, 0031, 0370, 0140, 0106, 0030, 0212, 0160, 0332, 0357, 0245, 0203, 
+  0264, 0323, 0216, 0245, 0304, 0366, 0140, 0105, 0275, 0257, 0246, 0036, 0270, 0027, 0076, 0156, 
+  0037, 0063, 0000, 0163, 0134, 0272, 0241, 0142, 0036, 0302, 0055, 0316, 0277, 0144, 0244, 0013, 
+  0273, 0363, 0302, 0246, 0371, 0225, 0031, 0057, 0201, 0051, 0322, 0030, 0307, 0347, 0107, 0045, 
+  0042, 0077, 0052, 0011, 0361, 0043, 0134, 0236, 0216, 0235, 0037, 0172, 0321, 0146, 0304, 0211, 
+  0303, 0173, 0057, 0204, 0257, 0211, 0234, 0352, 0323, 0205, 0245, 0142, 0216, 0126, 0015, 0347, 
+  0100, 0372, 0132, 0065, 0332, 0052, 0366, 0030, 0266, 0311, 0200, 0063, 0040, 0304, 0331, 0353, 
+  0376, 0150, 0166, 0115, 0175, 0134, 0057, 0155, 0056, 0142, 0257, 0264, 0374, 0122, 0366, 0334, 
+  0326, 0155, 0260, 0276, 0212, 0316, 0070, 0155, 0157, 0224, 0172, 0136, 0043, 0132, 0250, 0220, 
+  0224, 0216, 0221, 0042, 0225, 0303, 0015, 0326, 0212, 0000, 0345, 0064, 0123, 0304, 0131, 0047, 
+  0161, 0043, 0265, 0156, 0172, 0126, 0150, 0151, 0254, 0053, 0277, 0336, 0241, 0277, 0122, 0072, 
+  0026, 0247, 0143, 0276, 0107, 0224, 0072, 0073, 0103, 0325, 0204, 0051, 0216, 0104, 0204, 0013, 
+  0004, 0347, 0322, 0150, 0011, 0170, 0211, 0205, 0205, 0325, 0353, 0117, 0267, 0057, 0302, 0062, 
+  0166, 0133, 0150, 0336, 0206, 0001, 0352, 0050, 0206, 0234, 0007, 0320, 0271, 0332, 0261, 0120, 
+  0045, 0133, 0117, 0031, 0154, 0154, 0054, 0211, 0103, 0065, 0145, 0243, 0267, 0266, 0221, 0265, 
+  0054, 0315, 0331, 0312, 0104, 0301, 0153, 0203, 0143, 0210, 0042, 0323, 0175, 0224, 0135, 0363, 
+  0162, 0174, 0144, 0272, 0226, 0303, 0272, 0236, 0172, 0065, 0267, 0165, 0075, 0077, 0060, 0043, 
+  0122, 0026, 0105, 0073, 0213, 0105, 0073, 0015, 0123, 0212, 0166, 0016, 0332, 0357, 0252, 0236, 
+  0347, 0154, 0277, 0313, 0013, 0104, 0325, 0342, 0236, 0342, 0274, 0272, 0134, 0075, 0347, 0245, 
+  0021, 0235, 0140, 0247, 0336, 0214, 0322, 0210, 0031, 0365, 0143, 0125, 0105, 0244, 0030, 0114, 
+  0055, 0257, 0221, 0146, 0344, 0065, 0062, 0303, 0107, 0123, 0336, 0354, 0225, 0322, 0210, 0225, 
+  0136, 0174, 0141, 0330, 0113, 0202, 0250, 0142, 0350, 0216, 0022, 0347, 0114, 0122, 0317, 0012, 
+  0316, 0246, 0070, 0243, 0341, 0160, 0262, 0103, 0344, 0061, 0363, 0006, 0370, 0120, 0327, 0076, 
+  0353, 0115, 0327, 0060, 0216, 0124, 0013, 0216, 0274, 0142, 0066, 0071, 0214, 0043, 0265, 0243, 
+  0344, 0210, 0131, 0011, 0214, 0050, 0164, 0256, 0027, 0222, 0277, 0300, 0221, 0232, 0001, 0034, 
+  0071, 0057, 0070, 0262, 0300, 0221, 0272, 0001, 0034, 0151, 0024, 0034, 0131, 0340, 0310, 0271, 
+  0001, 0034, 0271, 0050, 0070, 0262, 0300, 0221, 0206, 0001, 0034, 0151, 0026, 0034, 0131, 0340, 
+  0310, 0205, 0001, 0034, 0251, 0024, 0152, 0053, 0016, 0113, 0052, 0151, 0262, 0244, 0260, 0355, 
+  0161, 0364, 0126, 0252, 0054, 0051, 0034, 0340, 0070, 0306, 0075, 0125, 0226, 0324, 0012, 0226, 
+  0304, 0360, 0200, 0123, 0145, 0111, 0221, 0040, 0211, 0023, 0046, 0246, 0312, 0222, 0042, 0213, 
+  0230, 0136, 0201, 0100, 0114, 0226, 0224, 0013, 0226, 0274, 0342, 0351, 0215, 0060, 0226, 0134, 
+  0026, 0034, 0171, 0003, 0225, 0370, 0257, 0125, 0326, 0023, 0113, 0334, 0253, 0111, 0234, 0041, 
+  0136, 0335, 0007, 0314, 0274, 0111, 0332, 0371, 0341, 0115, 0322, 0316, 0263, 0153, 0222, 0366, 
+  0112, 0245, 0341, 0101, 0331, 0212, 0231, 0367, 0356, 0355, 0032, 0267, 0245, 0301, 0253, 0322, 
+  0257, 0310, 0353, 0004, 0042, 0150, 0330, 0266, 0370, 0202, 0065, 0116, 0137, 0117, 0126, 0023, 
+  0222, 0220, 0172, 0036, 0013, 0233, 0304, 0020, 0063, 0246, 0152, 0231, 0324, 0027, 0072, 0373, 
+  0240, 0253, 0233, 0276, 0161, 0220, 0233, 0227, 0142, 0247, 0227, 0243, 0212, 0330, 0363, 0230, 
+  0052, 0030, 0245, 0334, 0025, 0150, 0200, 0237, 0210, 0352, 0356, 0362, 0322, 0366, 0005, 0077, 
+  0141, 0312, 0324, 0153, 0220, 0344, 0272, 0357, 0313, 0251, 0006, 0062, 0007, 0176, 0066, 0177, 
+  0147, 0314, 0372, 0251, 0004, 0033, 0232, 0035, 0276, 0307, 0035, 0326, 0017, 0042, 0252, 0314, 
+  0245, 0146, 0012, 0213, 0242, 0315, 0224, 0173, 0030, 0126, 0023, 0357, 0141, 0230, 0121, 0303, 
+  0235, 0054, 0173, 0030, 0152, 0023, 0044, 0014, 0153, 0134, 0130, 0315, 0264, 0161, 0141, 0263, 
+  0221, 0233, 0306, 0205, 0221, 0052, 0253, 0356, 0261, 0103, 0371, 0142, 0270, 0047, 0070, 0243, 
+  0216, 0345, 0253, 0077, 0307, 0150, 0046, 0326, 0126, 0117, 0027, 0047, 0161, 0162, 0327, 0142, 
+  0154, 0341, 0360, 0072, 0035, 0342, 0076, 0311, 0101, 0035, 0374, 0232, 0344, 0153, 0304, 0142, 
+  0113, 0376, 0102, 0317, 0001, 0015, 0350, 0115, 0265, 0316, 0133, 0031, 0256, 0350, 0000, 0156, 
+  0340, 0232, 0052, 0311, 0153, 0115, 0175, 0355, 0110, 0256, 0041, 0273, 0314, 0333, 0265, 0340, 
+  0125, 0303, 0173, 0036, 0256, 0252, 0115, 0345, 0254, 0020, 0133, 0067, 0222, 0311, 0351, 0201, 
+  0366, 0073, 0205, 0046, 0352, 0050, 0074, 0115, 0353, 0272, 0262, 0306, 0201, 0143, 0126, 0107, 
+  0267, 0200, 0106, 0320, 0221, 0150, 0123, 0353, 0253, 0065, 0164, 0263, 0310, 0331, 0157, 0156, 
+  0237, 0324, 0046, 0114, 0141, 0260, 0140, 0046, 0357, 0126, 0315, 0144, 0161, 0051, 0103, 0012, 
+  0127, 0330, 0011, 0333, 0347, 0214, 0131, 0213, 0335, 0207, 0342, 0065, 0012, 0136, 0165, 0160, 
+  0324, 0011, 0036, 0005, 0132, 0024, 0115, 0202, 0015, 0270, 0211, 0256, 0310, 0044, 0245, 0322, 
+  0047, 0164, 0055, 0110, 0320, 0013, 0303, 0303, 0076, 0030, 0242, 0330, 0241, 0302, 0303, 0013, 
+  0014, 0364, 0262, 0056, 0213, 0200, 0301, 0320, 0200, 0341, 0320, 0053, 0310, 0034, 0354, 0077, 
+  0022, 0167, 0121, 0003, 0077, 0145, 0265, 0265, 0230, 0331, 0111, 0362, 0165, 0034, 0027, 0027, 
+  0012, 0367, 0247, 0336, 0210, 0200, 0327, 0223, 0174, 0072, 0276, 0355, 0316, 0000, 0073, 0004, 
+  0055, 0240, 0215, 0270, 0077, 0265, 0224, 0057, 0144, 0111, 0261, 0053, 0320, 0072, 0013, 0064, 
+  0265, 0137, 0163, 0011, 0315, 0143, 0325, 0064, 0075, 0236, 0310, 0122, 0270, 0125, 0370, 0216, 
+  0106, 0250, 0012, 0131, 0312, 0252, 0055, 0170, 0112, 0073, 0001, 0121, 0267, 0257, 0033, 0157, 
+  0144, 0373, 0372, 0033, 0237, 0136, 0253, 0223, 0334, 0176, 0363, 0261, 0005, 0363, 0155, 0265, 
+  0270, 0066, 0251, 0060, 0275, 0362, 0262, 0210, 0335, 0261, 0243, 0362, 0054, 0072, 0305, 0331, 
+  0172, 0371, 0274, 0255, 0050, 0327, 0241, 0175, 0052, 0305, 0366, 0055, 0072, 0355, 0011, 0202, 
+  0360, 0214, 0110, 0244, 0273, 0021, 0106, 0304, 0002, 0162, 0252, 0226, 0205, 0340, 0377, 0015, 
+  0315, 0317, 0016, 0104, 0136, 0315, 0331, 0226, 0053, 0221, 0355, 0361, 0304, 0301, 0305, 0112, 
+  0341, 0113, 0371, 0017, 0374, 0114, 0207, 0243, 0141, 0136, 0126, 0163, 0065, 0323, 0120, 0066, 
+  0141, 0013, 0130, 0065, 0063, 0016, 0257, 0045, 0126, 0321, 0121, 0113, 0276, 0242, 0343, 0042, 
+  0167, 0127, 0334, 0175, 0212, 0222, 0136, 0070, 0150, 0361, 0155, 0140, 0110, 0002, 0205, 0032, 
+  0033, 0032, 0104, 0235, 0107, 0153, 0020, 0165, 0141, 0132, 0035, 0107, 0166, 0275, 0244, 0202, 
+  0274, 0154, 0027, 0373, 0326, 0214, 0071, 0071, 0277, 0157, 0253, 0323, 0236, 0141, 0214, 0150, 
+  0066, 0015, 0245, 0314, 0352, 0305, 0263, 0041, 0347, 0017, 0174, 0347, 0043, 0351, 0215, 0144, 
+  0334, 0224, 0177, 0100, 0126, 0304, 0135, 0324, 0011, 0000, 0031, 0236, 0243, 0114, 0134, 0344, 
+  0062, 0336, 0073, 0210, 0045, 0064, 0265, 0335, 0305, 0255, 0265, 0304, 0345, 0352, 0221, 0114, 
+  0204, 0364, 0371, 0043, 0111, 0100, 0264, 0346, 0260, 0162, 0042, 0135, 0307, 0040, 0064, 0365, 
+  0324, 0204, 0146, 0236, 0102, 0231, 0131, 0041, 0373, 0321, 0312, 0052, 0335, 0275, 0137, 0372, 
+  0272, 0355, 0121, 0167, 0135, 0272, 0365, 0204, 0025, 0347, 0004, 0130, 0140, 0352, 0156, 0222, 
+  0354, 0344, 0005, 0062, 0262, 0122, 0012, 0217, 0323, 0267, 0161, 0324, 0146, 0164, 0330, 0265, 
+  0174, 0054, 0311, 0366, 0350, 0301, 0035, 0015, 0211, 0117, 0355, 0324, 0103, 0260, 0264, 0067, 
+  0301, 0103, 0174, 0241, 0020, 0246, 0346, 0323, 0027, 0322, 0130, 0246, 0344, 0324, 0030, 0272, 
+  0145, 0174, 0370, 0061, 0264, 0103, 0316, 0204, 0104, 0225, 0276, 0134, 0156, 0172, 0151, 0374, 
+  0072, 0012, 0301, 0043, 0166, 0273, 0053, 0211, 0272, 0107, 0232, 0333, 0043, 0027, 0124, 0056, 
+  0225, 0304, 0211, 0177, 0055, 0367, 0014, 0302, 0221, 0170, 0105, 0311, 0235, 0117, 0031, 0142, 
+  0277, 0117, 0041, 0376, 0125, 0342, 0273, 0043, 0246, 0076, 0006, 0127, 0253, 0232, 0276, 0253, 
+  0245, 0057, 0261, 0255, 0145, 0223, 0274, 0332, 0314, 0306, 0150, 0107, 0254, 0267, 0044, 0047, 
+  0062, 0077, 0155, 0335, 0070, 0374, 0264, 0165, 0043, 0273, 0323, 0326, 0257, 0122, 0147, 0230, 
+  0101, 0213, 0333, 0130, 0306, 0167, 0217, 0274, 0144, 0075, 0361, 0104, 0161, 0243, 0234, 0273, 
+  0243, 0177, 0201, 0045, 0007, 0302, 0304, 0327, 0266, 0161, 0131, 0222, 0372, 0231, 0276, 0172, 
+  0156, 0216, 0364, 0355, 0235, 0012, 0326, 0014, 0077, 0257, 0030, 0351, 0167, 0156, 0337, 0243, 
+  0114, 0356, 0024, 0274, 0076, 0352, 0036, 0334, 0253, 0040, 0320, 0020, 0117, 0220, 0215, 0101, 
+  0222, 0221, 0340, 0352, 0236, 0250, 0305, 0223, 0361, 0222, 0243, 0056, 0321, 0307, 0343, 0251, 
+  0153, 0163, 0037, 0174, 0041, 0311, 0046, 0247, 0110, 0101, 0230, 0040, 0354, 0003, 0020, 0227, 
+  0115, 0320, 0000, 0324, 0276, 0032, 0012, 0023, 0340, 0143, 0064, 0341, 0043, 0365, 0145, 0314, 
+  0375, 0107, 0030, 0022, 0134, 0071, 0013, 0130, 0140, 0352, 0056, 0303, 0006, 0315, 0215, 0024, 
+  0176, 0360, 0325, 0355, 0043, 0061, 0021, 0222, 0014, 0341, 0215, 0003, 0054, 0021, 0350, 0165, 
+  0305, 0077, 0207, 0366, 0172, 0104, 0227, 0370, 0310, 0331, 0271, 0175, 0075, 0033, 0312, 0375, 
+  0224, 0317, 0343, 0217, 0175, 0354, 0035, 0133, 0314, 0177, 0320, 0355, 0041, 0265, 0162, 0316, 
+  0156, 0017, 0001, 0137, 0206, 0110, 0142, 0165, 0225, 0163, 0353, 0366, 0363, 0276, 0333, 0363, 
+  0131, 0143, 0213, 0036, 0141, 0125, 0366, 0211, 0253, 0326, 0224, 0041, 0327, 0210, 0154, 0140, 
+  0203, 0271, 0021, 0354, 0222, 0147, 0256, 0002, 0127, 0045, 0202, 0353, 0010, 0224, 0302, 0235, 
+  0064, 0313, 0047, 0377, 0035, 0021, 0241, 0203, 0264, 0162, 0262, 0141, 0352, 0076, 0136, 0374, 
+  0305, 0341, 0136, 0374, 0205, 0341, 0075, 0223, 0312, 0111, 0360, 0167, 0203, 0164, 0232, 0315, 
+  0334, 0346, 0341, 0314, 0155, 0346, 0276, 0041, 0326, 0346, 0225, 0233, 0123, 0013, 0360, 0151, 
+  0206, 0260, 0201, 0106, 0140, 0063, 0063, 0114, 0051, 0040, 0070, 0242, 0126, 0200, 0146, 0235, 
+  0006, 0013, 0222, 0275, 0013, 0151, 0067, 0375, 0135, 0045, 0337, 0262, 0151, 0000, 0200, 0041, 
+  0332, 0220, 0226, 0220, 0023, 0005, 0167, 0155, 0235, 0155, 0237, 0365, 0114, 0047, 0012, 0042, 
+  0225, 0100, 0172, 0130, 0316, 0162, 0274, 0302, 0212, 0221, 0236, 0276, 0127, 0200, 0320, 0265, 
+  0006, 0104, 0273, 0224, 0121, 0170, 0350, 0273, 0067, 0217, 0243, 0076, 0117, 0101, 0037, 0367, 
+  0241, 0266, 0043, 0115, 0311, 0231, 0132, 0017, 0373, 0002, 0351, 0074, 0361, 0224, 0334, 0171, 
+  0075, 0207, 0335, 0270, 0026, 0026, 0227, 0141, 0115, 0271, 0316, 0223, 0112, 0340, 0031, 0176, 
+  0346, 0177, 0366, 0007, 0325, 0377, 0211, 0273, 0123, 0033, 0057, 0126, 0276, 0043, 0320, 0252, 
+  0036, 0050, 0076, 0170, 0203, 0356, 0037, 0076, 0040, 0314, 0013, 0124, 0052, 0254, 0230, 0245, 
+  0221, 0133, 0036, 0274, 0000, 0216, 0060, 0056, 0310, 0246, 0007, 0317, 0126, 0247, 0360, 0062, 
+  0107, 0252, 0030, 0331, 0003, 0373, 0332, 0072, 0371, 0177, 0155, 0367, 0377, 0176, 0000, 0050, 
+  0165, 0165, 0141, 0171, 0051, 0165, 0151, 0057, 0002, 0000, 0000, 0000, 0012, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0014, 0000, 0000, 0000, 0016, 0000, 0000, 0000, 0010, 0000, 0000, 0000, 
+  0006, 0000, 0000, 0000, 0015, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0017, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0160, 0162, 0157, 0146, 0151, 0154, 0145, 0055, 0156, 0145, 0167, 0055, 
+  0144, 0151, 0141, 0154, 0157, 0147, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0120, 0030, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0325, 0130, 0137, 0163, 0323, 0070, 
+  0020, 0177, 0347, 0123, 0030, 0275, 0336, 0250, 0251, 0023, 0050, 0014, 0223, 0230, 0071, 0070, 
+  0350, 0060, 0303, 0060, 0367, 0300, 0075, 0147, 0024, 0171, 0143, 0213, 0052, 0222, 0117, 0222, 
+  0223, 0372, 0076, 0375, 0255, 0354, 0046, 0151, 0143, 0307, 0166, 0113, 0160, 0312, 0233, 0154, 
+  0355, 0256, 0176, 0373, 0177, 0245, 0351, 0373, 0333, 0225, 0014, 0326, 0140, 0254, 0320, 0152, 
+  0106, 0302, 0213, 0113, 0022, 0200, 0342, 0072, 0026, 0052, 0231, 0221, 0177, 0276, 0177, 0246, 
+  0157, 0311, 0373, 0350, 0305, 0364, 0045, 0245, 0301, 0065, 0050, 0060, 0314, 0101, 0034, 0154, 
+  0204, 0113, 0203, 0104, 0262, 0030, 0202, 0311, 0305, 0344, 0355, 0305, 0070, 0240, 0024, 0211, 
+  0204, 0162, 0140, 0226, 0214, 0103, 0064, 0065, 0360, 0157, 0056, 0014, 0330, 0100, 0212, 0305, 
+  0214, 0044, 0356, 0346, 0017, 0262, 0077, 0145, 0162, 0061, 0036, 0223, 0121, 0064, 0325, 0213, 
+  0037, 0300, 0135, 0300, 0045, 0263, 0166, 0106, 0256, 0335, 0315, 0227, 0025, 0113, 0200, 0004, 
+  0042, 0236, 0021, 0341, 0227, 0041, 0211, 0246, 0231, 0321, 0031, 0030, 0127, 0004, 0212, 0255, 
+  0140, 0106, 0326, 0302, 0212, 0205, 0004, 0022, 0175, 0067, 0071, 0114, 0107, 0333, 0335, 0032, 
+  0035, 0147, 0212, 0056, 0065, 0317, 0055, 0211, 0076, 0063, 0151, 0333, 0110, 0005, 0327, 0212, 
+  0372, 0045, 0211, 0160, 0207, 0203, 0265, 0324, 0072, 0235, 0335, 0347, 0030, 0125, 0120, 0033, 
+  0040, 0377, 0045, 0230, 0324, 0111, 0205, 0131, 0301, 0206, 0042, 0317, 0122, 0110, 0240, 0161, 
+  0365, 0377, 0147, 0160, 0055, 0264, 0211, 0301, 0320, 0215, 0210, 0135, 0112, 0242, 0327, 0055, 
+  0224, 0116, 0070, 0064, 0111, 0340, 0014, 0123, 0126, 0062, 0307, 0320, 0100, 0063, 0122, 0000, 
+  0236, 0361, 0015, 0066, 0301, 0337, 0025, 0244, 0026, 0176, 0164, 0224, 0370, 0217, 0225, 0146, 
+  0355, 0002, 0345, 0212, 0014, 0150, 0212, 0236, 0046, 0121, 0245, 0342, 0175, 0132, 0236, 0012, 
+  0031, 0007, 0145, 0030, 0050, 0046, 0151, 0371, 0211, 0056, 0133, 0350, 0133, 0322, 0140, 0272, 
+  0017, 0370, 0273, 0264, 0133, 0045, 0210, 0172, 0272, 0327, 0203, 0170, 0134, 0033, 0001, 0312, 
+  0061, 0207, 0321, 0110, 0042, 0014, 0113, 0047, 0070, 0223, 0055, 0364, 0066, 0143, 0034, 0023, 
+  0202, 0104, 0343, 0156, 0155, 0031, 0367, 0142, 0347, 0314, 0000, 0153, 0124, 0072, 0167, 0116, 
+  0253, 0103, 0325, 0357, 0061, 0015, 0143, 0201, 0024, 0156, 0063, 0246, 0342, 0116, 0221, 0251, 
+  0136, 0351, 0004, 0363, 0136, 0173, 0241, 0035, 0264, 0222, 0025, 0072, 0167, 0230, 0073, 0205, 
+  0307, 0012, 0052, 0256, 0031, 0353, 0250, 0075, 0352, 0371, 0203, 0272, 0160, 0220, 0164, 0121, 
+  0155, 0067, 0234, 0265, 0000, 0331, 0030, 0361, 0363, 0217, 0045, 0147, 0013, 0316, 0047, 0230, 
+  0263, 0007, 0145, 0014, 0113, 0226, 0113, 0327, 0111, 0153, 0200, 0203, 0130, 0203, 0335, 0063, 
+  0164, 0326, 0247, 0262, 0052, 0106, 0125, 0105, 0154, 0241, 0313, 0055, 0320, 0134, 0141, 0311, 
+  0220, 0102, 0165, 0153, 0307, 0344, 0206, 0025, 0130, 0351, 0122, 0275, 0241, 0167, 0047, 0034, 
+  0162, 0354, 0252, 0036, 0206, 0377, 0015, 0306, 0177, 0115, 0306, 0066, 0210, 0272, 0064, 0100, 
+  0217, 0312, 0156, 0252, 0114, 0133, 0121, 0245, 0344, 0145, 0133, 0056, 0002, 0226, 0353, 0230, 
+  0231, 0242, 0001, 0357, 0016, 0347, 0350, 0056, 0334, 0036, 0035, 0165, 0230, 0200, 0016, 0216, 
+  0106, 0135, 0337, 0310, 0261, 0240, 0274, 0052, 0353, 0036, 0365, 0364, 0154, 0101, 0166, 0314, 
+  0064, 0177, 0112, 0221, 0250, 0025, 0226, 0307, 0312, 0072, 0154, 0373, 0071, 0171, 0065, 0110, 
+  0141, 0272, 0265, 0130, 0212, 0241, 0075, 0004, 0212, 0046, 0232, 0243, 0256, 0336, 0226, 0332, 
+  0024, 0333, 0113, 0170, 0071, 0210, 0022, 0055, 0375, 0242, 0143, 0352, 0361, 0243, 0110, 0070, 
+  0016, 0307, 0303, 0300, 0164, 0232, 0337, 0220, 0010, 0247, 0063, 0312, 0262, 0114, 0026, 0317, 
+  0057, 0367, 0373, 0147, 0364, 0327, 0252, 0041, 0170, 0043, 0236, 0050, 0211, 0037, 0141, 0310, 
+  0343, 0335, 0350, 0343, 0274, 0004, 0363, 0364, 0252, 0175, 0066, 0077, 0204, 0355, 0176, 0330, 
+  0341, 0352, 0376, 0361, 0134, 0221, 0237, 0006, 0127, 0107, 0024, 0371, 0103, 0250, 0037, 0232, 
+  0153, 0023, 0321, 0251, 0063, 0140, 0127, 0350, 0374, 0034, 0375, 0146, 0220, 0270, 0357, 0177, 
+  0103, 0351, 0234, 0270, 0357, 0264, 0362, 0367, 0114, 0105, 0271, 0226, 0371, 0112, 0331, 0331, 
+  0004, 0327, 0106, 0157, 0374, 0002, 0057, 0230, 0165, 0225, 0257, 0215, 0210, 0353, 0115, 0074, 
+  0361, 0177, 0207, 0120, 0037, 0241, 0321, 0135, 0251, 0277, 0152, 0223, 0131, 0352, 0263, 0247, 
+  0015, 0173, 0365, 0205, 0117, 0312, 0341, 0224, 0123, 0123, 0317, 0213, 0244, 0120, 0356, 0015, 
+  0060, 0332, 0226, 0276, 0305, 0273, 0015, 0063, 0110, 0033, 0276, 0152, 0013, 0140, 0203, 0143, 
+  0244, 0051, 0150, 0331, 0303, 0374, 0205, 0146, 0135, 0125, 0302, 0036, 0175, 0150, 0073, 0322, 
+  0365, 0341, 0355, 0114, 0137, 0011, 0113, 0107, 0231, 0163, 0214, 0247, 0007, 0015, 0370, 0360, 
+  0052, 0253, 0263, 0035, 0335, 0317, 0167, 0235, 0232, 0213, 0252, 0246, 0060, 0310, 0145, 0256, 
+  0034, 0322, 0110, 0144, 0035, 0063, 0356, 0111, 0155, 0352, 0356, 0211, 0040, 0230, 0173, 0302, 
+  0167, 0277, 0260, 0133, 0075, 0160, 0316, 0345, 0131, 0234, 0263, 0140, 0366, 0367, 0162, 0316, 
+  0374, 0003, 0042, 0016, 0264, 0172, 0166, 0176, 0011, 0117, 0321, 0250, 0336, 0074, 0357, 0027, 
+  0237, 0253, 0206, 0112, 0235, 0111, 0306, 0041, 0325, 0022, 0315, 0075, 0172, 0304, 0134, 0361, 
+  0300, 0306, 0341, 0111, 0143, 0277, 0031, 0321, 0071, 0066, 0173, 0117, 0127, 0035, 0276, 0355, 
+  0067, 0134, 0365, 0235, 0231, 0316, 0204, 0352, 0261, 0063, 0164, 0365, 0014, 0350, 0347, 0251, 
+  0004, 0234, 0075, 0370, 0016, 0014, 0330, 0114, 0053, 0213, 0047, 0320, 0053, 0022, 0035, 0175, 
+  0054, 0233, 0216, 0036, 0260, 0265, 0110, 0231, 0034, 0110, 0271, 0177, 0157, 0252, 0111, 0031, 
+  0035, 0202, 0333, 0243, 0337, 0277, 0373, 0277, 0370, 0037, 0125, 0170, 0333, 0362, 0000, 0050, 
+  0165, 0165, 0141, 0171, 0051, 0157, 0162, 0147, 0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0145, 0156, 0143, 0157, 0144, 0151, 0156, 0147, 0163, 0055, 0144, 0151, 0141, 0154, 0157, 0147, 
+  0056, 0165, 0151, 0000, 0000, 0000, 0000, 0000, 0376, 0036, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0113, 0163, 0333, 0066, 0020, 0276, 0347, 0127, 0240, 0070, 0266, 0003, 
+  0313, 0042, 0333, 0304, 0223, 0261, 0230, 0161, 0033, 0307, 0355, 0114, 0173, 0151, 0234, 0346, 
+  0350, 0001, 0301, 0225, 0210, 0032, 0002, 0130, 0000, 0224, 0254, 0177, 0337, 0005, 0251, 0127, 
+  0044, 0232, 0244, 0037, 0122, 0335, 0264, 0067, 0021, 0132, 0354, 0113, 0337, 0356, 0176, 0113, 
+  0235, 0277, 0273, 0233, 0052, 0062, 0003, 0353, 0244, 0321, 0043, 0072, 0074, 0071, 0245, 0004, 
+  0264, 0060, 0231, 0324, 0223, 0021, 0375, 0164, 0375, 0201, 0235, 0321, 0167, 0311, 0253, 0363, 
+  0157, 0030, 0043, 0127, 0240, 0301, 0162, 0017, 0031, 0231, 0113, 0237, 0223, 0211, 0342, 0031, 
+  0220, 0370, 0044, 0076, 0073, 0211, 0010, 0143, 0265, 0320, 0267, 0214, 0114, 0115, 0006, 0157, 
+  0111, 0120, 0213, 0117, 0341, 0130, 0152, 0017, 0166, 0314, 0005, 0044, 0347, 0026, 0376, 0052, 
+  0245, 0005, 0107, 0224, 0114, 0107, 0164, 0342, 0157, 0277, 0243, 0033, 0343, 0361, 0111, 0024, 
+  0321, 0101, 0122, 0331, 0132, 0337, 0141, 0112, 0012, 0320, 0016, 0230, 0137, 0024, 0100, 0046, 
+  0205, 0232, 0305, 0301, 0330, 0216, 0220, 0346, 0123, 0040, 0123, 0364, 0215, 0341, 0311, 0124, 
+  0152, 0256, 0032, 0204, 0062, 0160, 0302, 0312, 0302, 0243, 0261, 0165, 0214, 0044, 0223, 0134, 
+  0231, 0011, 0031, 0133, 0063, 0355, 0124, 0040, 0114, 0261, 0260, 0162, 0222, 0173, 0362, 0333, 
+  0305, 0365, 0045, 0171, 0017, 0063, 0120, 0246, 0000, 0333, 0040, 0312, 0113, 0237, 0033, 0353, 
+  0310, 0147, 0243, 0306, 0023, 0216, 0166, 0076, 0251, 0324, 0112, 0221, 0127, 0242, 0046, 0375, 
+  0023, 0204, 0047, 0102, 0161, 0347, 0106, 0364, 0312, 0337, 0376, 0062, 0345, 0023, 0240, 0104, 
+  0146, 0043, 0052, 0303, 0307, 0041, 0115, 0316, 0013, 0033, 0124, 0373, 0005, 0011, 0261, 0215, 
+  0350, 0114, 0072, 0231, 0052, 0240, 0311, 0265, 0055, 0341, 0174, 0260, 0372, 0166, 0117, 0116, 
+  0160, 0315, 0306, 0106, 0224, 0216, 0046, 0037, 0270, 0162, 0155, 0242, 0122, 0030, 0135, 0145, 
+  0216, 0046, 0163, 0251, 0063, 0063, 0147, 0102, 0231, 0057, 0157, 0014, 0152, 0127, 0173, 0270, 
+  0034, 0035, 0333, 0345, 0034, 0124, 0301, 0122, 0153, 0346, 0016, 0154, 0077, 0227, 0337, 0127, 
+  0077, 0165, 0355, 0363, 0352, 0367, 0167, 0254, 0006, 0000, 0175, 0212, 0127, 0251, 0261, 0031, 
+  0130, 0066, 0227, 0231, 0317, 0151, 0362, 0103, 0213, 0244, 0227, 0036, 0023, 0102, 0274, 0345, 
+  0332, 0051, 0356, 0071, 0246, 0147, 0104, 0027, 0200, 0066, 0056, 0262, 0214, 0030, 0113, 0176, 
+  0207, 0251, 0231, 0001, 0271, 0136, 0201, 0360, 0162, 0345, 0147, 0213, 0322, 0014, 0306, 0274, 
+  0124, 0236, 0345, 0020, 0260, 0111, 0223, 0070, 0152, 0165, 0001, 0353, 0210, 0345, 0210, 0124, 
+  0232, 0324, 0241, 0157, 0313, 0212, 0134, 0252, 0254, 0206, 0061, 0132, 0147, 0325, 0043, 0376, 
+  0220, 0251, 0271, 0243, 0015, 0011, 0375, 0021, 0217, 0253, 0154, 0326, 0212, 0130, 0220, 0213, 
+  0217, 0202, 0003, 0143, 0045, 0150, 0317, 0103, 0051, 0323, 0004, 0033, 0210, 0227, 0202, 0253, 
+  0026, 0171, 0127, 0160, 0201, 0131, 0244, 0111, 0324, 0035, 0055, 0027, 0101, 0355, 0015, 0267, 
+  0300, 0033, 0203, 0056, 0275, 0067, 0172, 0067, 0364, 0255, 0113, 0307, 0311, 0100, 0016, 0167, 
+  0005, 0327, 0131, 0247, 0112, 0305, 0027, 0246, 0364, 0314, 0371, 0105, 0260, 0017, 0072, 0333, 
+  0113, 0300, 0275, 0061, 0326, 0001, 0206, 0072, 0113, 0253, 0347, 0206, 0256, 0244, 0170, 0012, 
+  0252, 0021, 0317, 0067, 0077, 0343, 0275, 0026, 0277, 0036, 0221, 0222, 0036, 0222, 0313, 0122, 
+  0350, 0224, 0265, 0040, 0100, 0316, 0300, 0155, 0056, 0164, 0166, 0236, 0252, 0337, 0045, 0165, 
+  0257, 0153, 0221, 0053, 0161, 0124, 0225, 0032, 0333, 0201, 0222, 0272, 0073, 0072, 0256, 0346, 
+  0174, 0341, 0230, 0313, 0261, 0371, 0056, 0055, 0354, 0336, 0130, 0367, 0063, 0204, 0360, 0055, 
+  0142, 0170, 0117, 0107, 0117, 0040, 0214, 0245, 0122, 0235, 0102, 0205, 0161, 0262, 0056, 0252, 
+  0323, 0266, 0152, 0002, 0154, 0303, 0031, 0267, 0213, 0006, 0157, 0327, 0136, 0016, 0226, 0340, 
+  0352, 0203, 0261, 0152, 0356, 0074, 0006, 0144, 0077, 0355, 0016, 0254, 0257, 0010, 0145, 0303, 
+  0377, 0000, 0312, 0206, 0355, 0330, 0351, 0355, 0125, 0127, 0136, 0373, 0271, 0205, 0106, 0052, 
+  0232, 0271, 0327, 0047, 0373, 0125, 0311, 0275, 0330, 0017, 0324, 0120, 0043, 0173, 0124, 0345, 
+  0124, 0273, 0121, 0214, 0237, 0003, 0155, 0031, 0305, 0315, 0144, 0360, 0312, 0312, 0254, 0056, 
+  0213, 0012, 0352, 0361, 0161, 0346, 0111, 0177, 0016, 0203, 0276, 0263, 0365, 0074, 0175, 0335, 
+  0146, 0275, 0012, 0170, 0043, 0073, 0214, 0372, 0314, 0236, 0217, 0302, 0032, 0245, 0040, 0373, 
+  0134, 0121, 0322, 0072, 0021, 0156, 0171, 0126, 0323, 0324, 0006, 0252, 0131, 0123, 0037, 0026, 
+  0326, 0013, 0160, 0130, 0147, 0121, 0174, 0172, 0324, 0256, 0320, 0167, 0032, 0317, 0172, 0312, 
+  0345, 0165, 0304, 0051, 0267, 0254, 0060, 0270, 0001, 0141, 0247, 0325, 0270, 0155, 0330, 0266, 
+  0246, 0234, 0363, 0100, 0341, 0153, 0374, 0112, 0335, 0047, 0325, 0327, 0026, 0340, 0017, 0011, 
+  0313, 0044, 0363, 0031, 0227, 0052, 0040, 0216, 0171, 0074, 0237, 0205, 0363, 0103, 0144, 0256, 
+  0231, 0164, 0071, 0120, 0040, 0352, 0232, 0152, 0366, 0363, 0343, 0132, 0140, 0260, 0251, 0057, 
+  0056, 0004, 0070, 0364, 0110, 0052, 0031, 0124, 0133, 0120, 0025, 0045, 0044, 0041, 0011, 0313, 
+  0271, 0201, 0250, 0141, 0351, 0002, 0247, 0007, 0267, 0023, 0360, 0333, 0121, 0326, 0143, 0045, 
+  0150, 0333, 0121, 0263, 0356, 0072, 0275, 0333, 0220, 0202, 0261, 0147, 0334, 0173, 0056, 0362, 
+  0366, 0311, 0351, 0115, 0261, 0226, 0033, 0076, 0162, 0156, 0256, 0230, 0147, 0216, 0154, 0073, 
+  0172, 0163, 0230, 0346, 0320, 0151, 0074, 0120, 0375, 0263, 0067, 0057, 0233, 0353, 0277, 0176, 
+  0050, 0325, 0345, 0031, 0142, 0245, 0176, 0076, 0102, 0317, 0350, 0301, 0016, 0356, 0163, 0172, 
+  0167, 0371, 0216, 0217, 0275, 0174, 0117, 0014, 0323, 0160, 0347, 0033, 0031, 0304, 0201, 0206, 
+  0167, 0227, 0324, 0103, 0207, 0162, 0053, 0022, 0154, 0265, 0206, 0377, 0073, 0301, 0360, 0375, 
+  0077, 0000, 0206, 0302, 0342, 0300, 0060, 0245, 0173, 0231, 0200, 0170, 0131, 0054, 0263, 0057, 
+  0116, 0037, 0066, 0165, 0206, 0207, 0235, 0072, 0277, 0326, 0073, 0330, 0227, 0074, 0241, 0236, 
+  0240, 0107, 0171, 0333, 0301, 0225, 0234, 0140, 0312, 0034, 0216, 0161, 0337, 0306, 0257, 0172, 
+  0312, 0335, 0277, 0122, 0136, 0334, 0254, 0302, 0133, 0277, 0043, 0166, 0157, 0237, 0155, 0023, 
+  0233, 0152, 0154, 0054, 0132, 0212, 0300, 0263, 0221, 0216, 0320, 0144, 0237, 0164, 0155, 0337, 
+  0356, 0301, 0157, 0060, 0203, 0266, 0211, 0335, 0254, 0071, 0134, 0033, 0301, 0171, 0126, 0076, 
+  0163, 0372, 0144, 0144, 0145, 0322, 0025, 0212, 0057, 0220, 0261, 0175, 0215, 0310, 0272, 0274, 
+  0131, 0341, 0211, 0204, 0115, 0134, 0043, 0007, 0046, 0123, 0320, 0345, 0001, 0321, 0265, 0111, 
+  0150, 0023, 0272, 0036, 0006, 0203, 0350, 0260, 0060, 0350, 0136, 0373, 0342, 0377, 0327, 0276, 
+  0103, 0254, 0175, 0373, 0030, 0171, 0361, 0153, 0337, 0023, 0027, 0264, 0350, 0131, 0107, 0045, 
+  0046, 0117, 0100, 0156, 0024, 0026, 0351, 0340, 0340, 0137, 0276, 0360, 0327, 0164, 0233, 0275, 
+  0074, 0334, 0133, 0266, 0041, 0267, 0363, 0114, 0054, 0270, 0302, 0150, 0207, 0026, 0330, 0160, 
+  0130, 0377, 0221, 0267, 0174, 0367, 0033, 0046, 0325, 0226, 0144, 0313, 0105, 0134, 0075, 0267, 
+  0137, 0032, 0357, 0135, 0034, 0354, 0272, 0260, 0361, 0161, 0363, 0167, 0364, 0253, 0277, 0001, 
+  0241, 0214, 0111, 0316, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0164, 0145, 0162, 0155, 0151, 
+  0156, 0141, 0154, 0057, 0007, 0000, 0000, 0000, 0153, 0145, 0171, 0142, 0151, 0156, 0144, 0151, 
+  0156, 0147, 0055, 0145, 0144, 0151, 0164, 0157, 0162, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 
+  0374, 0027, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0130, 0115, 0163, 0333, 0066, 
+  0020, 0275, 0347, 0127, 0240, 0070, 0245, 0315, 0300, 0262, 0244, 0246, 0115, 0063, 0022, 0063, 
+  0151, 0022, 0271, 0235, 0266, 0047, 0073, 0315, 0321, 0003, 0202, 0053, 0022, 0065, 0004, 0260, 
+  0000, 0050, 0131, 0377, 0276, 0013, 0202, 0226, 0154, 0211, 0246, 0030, 0325, 0325, 0144, 0332, 
+  0336, 0110, 0160, 0201, 0375, 0300, 0333, 0267, 0273, 0234, 0274, 0271, 0135, 0050, 0262, 0004, 
+  0353, 0244, 0321, 0123, 0072, 0074, 0073, 0247, 0004, 0264, 0060, 0231, 0324, 0371, 0224, 0176, 
+  0274, 0232, 0261, 0127, 0364, 0115, 0362, 0154, 0362, 0025, 0143, 0344, 0002, 0064, 0130, 0356, 
+  0041, 0043, 0053, 0351, 0013, 0222, 0053, 0236, 0001, 0031, 0237, 0215, 0137, 0235, 0215, 0010, 
+  0143, 0121, 0350, 0033, 0106, 0026, 0046, 0203, 0327, 0044, 0034, 0213, 0157, 0141, 0131, 0152, 
+  0017, 0166, 0316, 0005, 0044, 0023, 0013, 0177, 0126, 0322, 0202, 0043, 0112, 0246, 0123, 0232, 
+  0373, 0233, 0027, 0164, 0253, 0174, 0174, 0066, 0032, 0321, 0101, 0122, 0353, 0332, 0354, 0141, 
+  0112, 0012, 0320, 0016, 0230, 0137, 0227, 0100, 0362, 0122, 0055, 0307, 0101, 0331, 0216, 0220, 
+  0346, 0013, 0040, 0013, 0264, 0215, 0341, 0312, 0102, 0152, 0256, 0132, 0204, 0062, 0160, 0302, 
+  0312, 0322, 0243, 0062, 0162, 0003, 0353, 0124, 0352, 0340, 0245, 0143, 0220, 0111, 0157, 0054, 
+  0061, 0363, 0203, 0047, 0010, 0123, 0256, 0255, 0314, 0013, 0117, 0176, 0173, 0173, 0365, 0201, 
+  0274, 0207, 0045, 0050, 0123, 0242, 0375, 0055, 0262, 0274, 0362, 0205, 0301, 0057, 0237, 0214, 
+  0232, 0347, 0134, 0347, 0344, 0243, 0112, 0255, 0024, 0105, 0055, 0152, 0322, 0077, 0100, 0170, 
+  0042, 0024, 0167, 0156, 0112, 0057, 0374, 0315, 0317, 0013, 0236, 0003, 0045, 0062, 0233, 0122, 
+  0031, 0036, 0207, 0064, 0231, 0224, 0066, 0234, 0355, 0327, 0044, 0170, 0067, 0245, 0113, 0351, 
+  0144, 0252, 0200, 0046, 0127, 0266, 0202, 0311, 0340, 0356, 0353, 0236, 0234, 0340, 0232, 0315, 
+  0215, 0250, 0034, 0115, 0146, 0134, 0271, 0056, 0121, 0051, 0214, 0256, 0143, 0107, 0223, 0025, 
+  0106, 0303, 0254, 0230, 0120, 0346, 0341, 0216, 0101, 0064, 0265, 0207, 0311, 0243, 0123, 0233, 
+  0134, 0200, 0052, 0131, 0152, 0315, 0312, 0201, 0355, 0147, 0362, 0173, 0311, 0225, 0311, 0243, 
+  0315, 0367, 0021, 0220, 0305, 0365, 0277, 0143, 0127, 0152, 0154, 0006, 0226, 0255, 0144, 0346, 
+  0013, 0232, 0274, 0354, 0220, 0364, 0322, 0143, 0110, 0210, 0267, 0134, 0073, 0305, 0075, 0307, 
+  0000, 0115, 0351, 0032, 0120, 0307, 0057, 0150, 0222, 0341, 0066, 0043, 0227, 0210, 0034, 0057, 
+  0052, 0357, 0072, 0216, 0261, 0046, 0004, 0366, 0001, 0142, 0031, 0027, 0002, 0124, 0327, 0246, 
+  0220, 0104, 0254, 0100, 0220, 0322, 0044, 0372, 0174, 0137, 0126, 0024, 0122, 0145, 0021, 0301, 
+  0341, 0260, 0372, 0025, 0357, 0060, 0065, 0267, 0264, 0045, 0226, 0077, 0342, 0162, 0035, 0310, 
+  0170, 0020, 0013, 0162, 0247, 0201, 0200, 0261, 0022, 0264, 0347, 0041, 0217, 0151, 0202, 0354, 
+  0341, 0245, 0340, 0252, 0103, 0336, 0225, 0134, 0340, 0065, 0323, 0144, 0164, 0330, 0133, 0056, 
+  0302, 0261, 0327, 0334, 0002, 0157, 0165, 0272, 0362, 0336, 0350, 0135, 0327, 0357, 0155, 0072, 
+  0115, 0004, 0012, 0270, 0055, 0271, 0316, 0016, 0036, 0251, 0370, 0332, 0124, 0236, 0071, 0277, 
+  0016, 0372, 0101, 0147, 0173, 0001, 0170, 0324, 0307, 0350, 0140, 0132, 0077, 0267, 0220, 0221, 
+  0342, 0051, 0250, 0126, 0020, 0137, 0377, 0204, 0151, 0331, 0141, 0323, 0021, 0341, 0350, 0041, 
+  0231, 0301, 0234, 0127, 0312, 0037, 0224, 0265, 0040, 0100, 0056, 0301, 0155, 0067, 0034, 0044, 
+  0234, 0232, 0346, 0222, 0110, 0161, 0035, 0162, 0025, 0326, 0250, 0112, 0043, 0007, 0050, 0251, 
+  0017, 0173, 0307, 0325, 0212, 0257, 0035, 0163, 0005, 0162, 0156, 0243, 0141, 0167, 0307, 0206, 
+  0306, 0020, 0276, 0067, 0210, 0337, 0275, 0063, 0172, 0202, 0140, 0056, 0225, 0072, 0050, 0124, 
+  0032, 0047, 0143, 0102, 0235, 0167, 0145, 0022, 0040, 0373, 0146, 0334, 0256, 0133, 0254, 0335, 
+  0130, 0071, 0150, 0200, 0325, 0007, 0137, 0165, 0271, 0271, 0076, 0006, 0145, 0357, 0166, 0013, 
+  0325, 0027, 0005, 0263, 0202, 0273, 0023, 0101, 0162, 0370, 0037, 0200, 0344, 0260, 0033, 0150, 
+  0275, 0255, 0072, 0024, 0327, 0176, 0146, 0241, 0222, 0272, 0031, 0335, 0043, 0324, 0176, 0051, 
+  0365, 0150, 0242, 0204, 0366, 0121, 0143, 0213, 0251, 0252, 0205, 0166, 0323, 0061, 0076, 0207, 
+  0326, 0146, 0372, 0155, 0173, 0303, 0170, 0141, 0145, 0026, 0163, 0250, 0116, 0213, 0361, 0151, 
+  0012, 0117, 0377, 0056, 0007, 0155, 0147, 0233, 0302, 0373, 0135, 0227, 0366, 0332, 0341, 0255, 
+  0354, 0160, 0324, 0247, 0110, 0275, 0053, 0100, 0074, 0140, 0222, 0114, 0272, 0020, 0007, 0266, 
+  0320, 0260, 0060, 0132, 0012, 0207, 0025, 0035, 0105, 0042, 0265, 0174, 0026, 0263, 0174, 0320, 
+  0341, 0215, 0054, 0100, 0127, 0044, 0064, 0124, 0316, 0205, 0151, 0301, 0221, 0347, 0256, 0302, 
+  0356, 0235, 0073, 0362, 0126, 0371, 0027, 0063, 0342, 0015, 0301, 0023, 0065, 0361, 0005, 0220, 
+  0231, 0154, 0066, 0174, 0175, 0122, 0106, 0372, 0174, 0346, 0050, 0270, 0222, 0071, 0206, 0303, 
+  0171, 0156, 0375, 0223, 0061, 0107, 0146, 0071, 0122, 0006, 0366, 0322, 0202, 0343, 0040, 0165, 
+  0004, 0155, 0050, 0230, 0173, 0306, 0275, 0347, 0242, 0350, 0056, 0100, 0336, 0224, 0355, 0162, 
+  0375, 0313, 0317, 0245, 0300, 0316, 0131, 0101, 0366, 0251, 0036, 0170, 0042, 0170, 0134, 0263, 
+  0026, 0207, 0240, 0247, 0231, 0275, 0016, 0125, 0210, 0236, 0124, 0271, 0354, 0051, 0127, 0104, 
+  0037, 0122, 0156, 0131, 0151, 0160, 0146, 0306, 0022, 0255, 0161, 0074, 0265, 0135, 0325, 0274, 
+  0340, 0141, 0344, 0213, 0134, 0046, 0165, 0237, 0264, 0273, 0262, 0000, 0277, 0113, 0150, 0302, 
+  0126, 0217, 0033, 0341, 0227, 0000, 0316, 0271, 0314, 0343, 0247, 0145, 0370, 0164, 0012, 0340, 
+  0127, 0012, 0121, 0037, 0347, 0230, 0135, 0321, 0366, 0276, 0336, 0241, 0241, 0042, 0262, 0161, 
+  0273, 0127, 0227, 0033, 0201, 0101, 0113, 0145, 0351, 0135, 0152, 0216, 0102, 0362, 0370, 0070, 
+  0044, 0077, 0316, 0201, 0310, 0104, 0161, 0026, 0074, 0226, 0004, 0033, 0016, 0014, 0334, 0166, 
+  0135, 0023, 0241, 0153, 0046, 0322, 0100, 0205, 0344, 0371, 0154, 0170, 0116, 0322, 0065, 0151, 
+  0150, 0347, 0177, 0322, 0073, 0035, 0351, 0015, 0217, 0203, 0312, 0257, 0361, 0246, 0003, 0110, 
+  0352, 0113, 0177, 0371, 0303, 0151, 0346, 0324, 0236, 0221, 0137, 0066, 0162, 0002, 0102, 0332, 
+  0166, 0016, 0264, 0217, 0226, 0355, 0313, 0173, 0010, 0165, 0257, 0237, 0354, 0232, 0357, 0372, 
+  0211, 0320, 0363, 0344, 0200, 0150, 0153, 0045, 0275, 0177, 0376, 0342, 0107, 0275, 0056, 0276, 
+  0124, 0134, 0100, 0141, 0024, 0172, 0067, 0370, 0127, 0176, 0374, 0302, 0047, 0220, 0273, 0205, 
+  0370, 0107, 0250, 0301, 0214, 0333, 0171, 0047, 0026, 0134, 0151, 0264, 0103, 0015, 0154, 0210, 
+  0315, 0106, 0063, 0376, 0116, 0006, 0017, 0244, 0072, 0066, 0175, 0217, 0231, 0162, 0177, 0160, 
+  0336, 0333, 0071, 0330, 0325, 0277, 0065, 0160, 0373, 0063, 0376, 0331, 0137, 0234, 0163, 0272, 
+  0303, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0163, 0145, 0164, 0055, 0164, 0151, 0164, 0154, 
+  0145, 0055, 0144, 0151, 0141, 0154, 0157, 0147, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 0000, 
+  0166, 0017, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0345, 0127, 0313, 0156, 0333, 0060, 
+  0020, 0274, 0347, 0053, 0130, 0136, 0013, 0332, 0261, 0214, 0024, 0101, 0141, 0053, 0100, 0037, 
+  0011, 0212, 0026, 0350, 0241, 0351, 0071, 0240, 0251, 0265, 0304, 0232, 0042, 0125, 0222, 0262, 
+  0243, 0277, 0357, 0122, 0262, 0363, 0260, 0035, 0111, 0215, 0033, 0267, 0100, 0157, 0224, 0070, 
+  0053, 0316, 0256, 0146, 0107, 0253, 0311, 0305, 0155, 0256, 0310, 0022, 0254, 0223, 0106, 0117, 
+  0351, 0150, 0160, 0112, 0011, 0150, 0141, 0022, 0251, 0323, 0051, 0375, 0176, 0175, 0311, 0316, 
+  0351, 0105, 0174, 0062, 0171, 0305, 0030, 0271, 0002, 0015, 0226, 0173, 0110, 0310, 0112, 0372, 
+  0214, 0244, 0212, 0047, 0100, 0306, 0203, 0361, 0371, 0040, 0042, 0214, 0041, 0110, 0152, 0017, 
+  0166, 0316, 0005, 0304, 0023, 0013, 0077, 0113, 0151, 0301, 0021, 0045, 0147, 0123, 0232, 0372, 
+  0305, 0153, 0172, 0177, 0312, 0170, 0020, 0105, 0164, 0030, 0117, 0314, 0354, 0007, 0010, 0117, 
+  0204, 0342, 0316, 0115, 0351, 0225, 0137, 0174, 0312, 0171, 0012, 0224, 0310, 0144, 0112, 0145, 
+  0130, 0216, 0150, 0074, 0051, 0254, 0051, 0300, 0372, 0212, 0150, 0236, 0303, 0224, 0056, 0245, 
+  0223, 0063, 0005, 0064, 0276, 0266, 0045, 0114, 0206, 0233, 0335, 0035, 0234, 0340, 0232, 0315, 
+  0215, 0050, 0035, 0215, 0057, 0271, 0162, 0155, 0120, 0051, 0214, 0146, 0141, 0111, 0143, 0334, 
+  0021, 0340, 0034, 0163, 0336, 0024, 0017, 0043, 0206, 0015, 0325, 0036, 0224, 0243, 0143, 0123, 
+  0306, 0332, 0062, 0263, 0350, 0107, 0366, 0203, 0344, 0312, 0244, 0015, 0333, 0244, 0131, 0037, 
+  0302, 0142, 0146, 0154, 0002, 0226, 0255, 0144, 0342, 0063, 0032, 0237, 0265, 0040, 0275, 0364, 
+  0130, 0000, 0342, 0055, 0327, 0116, 0161, 0317, 0261, 0034, 0123, 0132, 0001, 0236, 0361, 0015, 
+  0074, 0271, 0016, 0273, 0055, 0321, 0326, 0204, 0352, 0345, 0050, 0075, 0206, 0002, 0313, 0245, 
+  0346, 0212, 0211, 0214, 0353, 0024, 0257, 0073, 0102, 0163, 0223, 0160, 0325, 0131, 0371, 0004, 
+  0234, 0267, 0246, 0142, 0101, 0327, 0254, 0340, 0026, 0264, 0357, 0214, 0361, 0125, 0001, 0054, 
+  0223, 0001, 0331, 0224, 0362, 0041, 0126, 0144, 0122, 0045, 0244, 0356, 0207, 0206, 0054, 0136, 
+  0242, 0020, 0146, 0346, 0226, 0356, 0171, 0055, 0357, 0352, 0333, 0317, 0177, 0017, 0306, 0112, 
+  0144, 0314, 0075, 0066, 0027, 0215, 0261, 0313, 0274, 0024, 0134, 0165, 0323, 0341, 0042, 0104, 
+  0334, 0140, 0272, 0174, 0057, 0253, 0322, 0173, 0243, 0017, 0345, 0226, 0301, 0155, 0301, 0165, 
+  0322, 0131, 0316, 0314, 0344, 0046, 0105, 0203, 0061, 0341, 0241, 0035, 0130, 0305, 0053, 0123, 
+  0172, 0154, 0322, 0052, 0350, 0242, 0071, 0140, 0047, 0335, 0047, 0063, 0152, 0344, 0077, 0253, 
+  0327, 0173, 0014, 0106, 0361, 0031, 0250, 0275, 0122, 0275, 0171, 0317, 0265, 0000, 0325, 0102, 
+  0354, 0031, 0235, 0336, 0201, 0264, 0040, 0100, 0056, 0301, 0261, 0004, 0346, 0274, 0124, 0335, 
+  0262, 0254, 0115, 0210, 0306, 0215, 0175, 0266, 0340, 0112, 0007, 0254, 0324, 0330, 0276, 0112, 
+  0352, 0156, 0302, 0134, 0255, 0170, 0205, 0266, 0230, 0231, 0025, 0133, 0237, 0260, 0035, 0161, 
+  0347, 0072, 0005, 0027, 0013, 0374, 0172, 0354, 0074, 0243, 0247, 0020, 0346, 0122, 0165, 0067, 
+  0154, 0141, 0234, 0154, 0344, 0176, 0372, 0210, 0303, 0335, 0331, 0303, 0265, 0006, 0372, 0113, 
+  0041, 0372, 0055, 0051, 0174, 0375, 0174, 0124, 0031, 0004, 0144, 0137, 0005, 0144, 0274, 0277, 
+  0132, 0016, 0222, 0127, 0364, 0037, 0310, 0153, 0324, 0056, 0257, 0332, 0202, 0120, 0145, 0101, 
+  0127, 0033, 0321, 0110, 0275, 0200, 0044, 0214, 0067, 0303, 0365, 0156, 0157, 0352, 0135, 0136, 
+  0332, 0160, 0357, 0102, 0035, 0336, 0033, 0373, 0054, 0377, 0005, 0206, 0230, 0234, 0333, 0124, 
+  0152, 0264, 0161, 0156, 0121, 0170, 0243, 0250, 0033, 0012, 0241, 0112, 0255, 0100, 0207, 0131, 
+  0142, 0222, 0333, 0250, 0247, 0122, 0375, 0122, 0167, 0370, 0061, 0222, 0155, 0361, 0222, 0172, 
+  0374, 0171, 0373, 0307, 0232, 0051, 0327, 0220, 0033, 0055, 0105, 0230, 0313, 0122, 0300, 0312, 
+  0326, 0063, 0322, 0015, 0116, 0010, 0266, 0172, 0126, 0107, 0365, 0223, 0345, 0113, 0073, 0366, 
+  0307, 0300, 0277, 0061, 0354, 0007, 0011, 0321, 0043, 0230, 0157, 0337, 0021, 0246, 0236, 0203, 
+  0303, 0140, 0152, 0361, 0231, 0343, 0323, 0066, 0277, 0303, 0311, 0153, 0211, 0343, 0154, 0213, 
+  0357, 0376, 0255, 0267, 0323, 0141, 0170, 0377, 0072, 0255, 0315, 0215, 0146, 0266, 0135, 0267, 
+  0200, 0333, 0272, 0046, 0370, 0143, 0132, 0030, 0355, 0360, 0004, 0366, 0206, 0306, 0353, 0121, 
+  0160, 0062, 0174, 0004, 0152, 0211, 0071, 0333, 0304, 0104, 0073, 0061, 0303, 0355, 0203, 0357, 
+  0231, 0335, 0377, 0035, 0237, 0374, 0002, 0337, 0222, 0246, 0223, 0000, 0050, 0165, 0165, 0141, 
+  0171, 0051, 0160, 0162, 0157, 0146, 0151, 0154, 0145, 0055, 0155, 0141, 0156, 0141, 0147, 0145, 
+  0162, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 0324, 0036, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0155, 0157, 0333, 0066, 0020, 0376, 0336, 0137, 0301, 0361, 0343, 0006, 
+  0306, 0261, 0235, 0164, 0101, 0141, 0253, 0330, 0226, 0266, 0053, 0260, 0015, 0003, 0226, 0242, 
+  0037, 0013, 0212, 0072, 0113, 0134, 0150, 0122, 0043, 0051, 0073, 0376, 0367, 0073, 0112, 0266, 
+  0023, 0277, 0124, 0222, 0225, 0116, 0010, 0222, 0175, 0263, 0344, 0073, 0362, 0271, 0363, 0335, 
+  0163, 0057, 0236, 0274, 0275, 0233, 0053, 0262, 0000, 0353, 0244, 0321, 0123, 0072, 0074, 0073, 
+  0247, 0004, 0264, 0060, 0211, 0324, 0351, 0224, 0176, 0272, 0171, 0317, 0256, 0350, 0333, 0350, 
+  0325, 0344, 0073, 0306, 0310, 0007, 0320, 0140, 0271, 0207, 0204, 0054, 0245, 0317, 0110, 0252, 
+  0170, 0002, 0144, 0174, 0066, 0276, 0072, 0033, 0021, 0306, 0052, 0241, 0357, 0031, 0231, 0233, 
+  0004, 0336, 0220, 0160, 0054, 0076, 0205, 0327, 0122, 0173, 0260, 0063, 0056, 0040, 0232, 0130, 
+  0370, 0247, 0220, 0026, 0034, 0121, 0062, 0236, 0322, 0324, 0337, 0376, 0100, 0357, 0057, 0037, 
+  0237, 0215, 0106, 0164, 0020, 0225, 0167, 0155, 0165, 0230, 0222, 0002, 0264, 0003, 0346, 0127, 
+  0071, 0220, 0064, 0127, 0213, 0161, 0270, 0154, 0117, 0110, 0363, 0071, 0220, 0071, 0142, 0143, 
+  0370, 0146, 0056, 0065, 0127, 0107, 0204, 0022, 0160, 0302, 0312, 0334, 0343, 0145, 0044, 0267, 
+  0146, 0046, 0125, 0320, 0321, 0074, 0005, 0113, 0314, 0254, 0121, 0135, 0230, 0174, 0145, 0145, 
+  0232, 0171, 0362, 0373, 0117, 0067, 0357, 0310, 0065, 0054, 0100, 0231, 0034, 0165, 0017, 0105, 
+  0171, 0341, 0063, 0143, 0035, 0371, 0154, 0324, 0054, 0345, 0072, 0045, 0237, 0124, 0154, 0245, 
+  0310, 0112, 0121, 0023, 0377, 0015, 0302, 0023, 0241, 0270, 0163, 0123, 0372, 0301, 0337, 0176, 
+  0234, 0043, 0004, 0112, 0144, 0062, 0245, 0062, 0174, 0034, 0322, 0150, 0202, 0370, 0360, 0150, 
+  0277, 0042, 0301, 0262, 0051, 0135, 0110, 0047, 0143, 0005, 0064, 0272, 0261, 0005, 0114, 0006, 
+  0233, 0157, 0017, 0344, 0004, 0327, 0154, 0146, 0104, 0341, 0150, 0364, 0236, 0053, 0127, 0047, 
+  0052, 0205, 0321, 0245, 0337, 0150, 0264, 0224, 0072, 0061, 0113, 0046, 0224, 0331, 0325, 0030, 
+  0124, 0120, 0133, 0100, 0036, 0365, 0015, 0071, 0003, 0225, 0263, 0330, 0232, 0245, 0003, 0333, 
+  0015, 0362, 0270, 0157, 0310, 0011, 0152, 0314, 0101, 0173, 0246, 0141, 0331, 0015, 0362, 0105, 
+  0337, 0220, 0271, 0020, 0340, 0234, 0261, 0022, 0034, 0146, 0306, 0235, 0147, 0220, 0110, 0157, 
+  0072, 0072, 0374, 0262, 0157, 0364, 0001, 0054, 0046, 0275, 0002, 0337, 0062, 0252, 0257, 0045, 
+  0127, 0046, 0255, 0040, 0257, 0011, 0202, 0255, 0011, 0202, 0076, 0006, 0123, 0154, 0154, 0002, 
+  0226, 0055, 0145, 0342, 0063, 0032, 0135, 0326, 0110, 0172, 0351, 0321, 0035, 0304, 0133, 0256, 
+  0235, 0342, 0236, 0243, 0163, 0246, 0164, 0005, 0170, 0307, 0237, 0025, 0036, 0127, 0243, 0154, 
+  0115, 0160, 0345, 0016, 0215, 0261, 0075, 0063, 0152, 0264, 0023, 0230, 0361, 0102, 0371, 0015, 
+  0312, 0213, 0363, 0363, 0026, 0302, 0031, 0004, 0102, 0244, 0321, 0270, 0126, 0072, 0120, 0067, 
+  0313, 0220, 0036, 0061, 0011, 0112, 0027, 0077, 0224, 0025, 0231, 0124, 0111, 0305, 0235, 0001, 
+  0160, 0371, 0210, 0221, 0021, 0233, 0073, 0172, 0344, 0047, 0372, 0031, 0137, 0227, 0277, 0117, 
+  0165, 0020, 0013, 0162, 0375, 0004, 0126, 0310, 0002, 0355, 0171, 0250, 0036, 0064, 0302, 0232, 
+  0345, 0245, 0340, 0252, 0106, 0336, 0345, 0134, 0140, 0021, 0245, 0321, 0250, 0331, 0132, 0056, 
+  0302, 0261, 0137, 0270, 0005, 0176, 0324, 0350, 0302, 0173, 0243, 0367, 0115, 0177, 0240, 0324, 
+  0217, 0007, 0062, 0270, 0313, 0271, 0116, 0032, 0217, 0124, 0174, 0145, 0012, 0317, 0234, 0137, 
+  0205, 0373, 0101, 0047, 0007, 0016, 0370, 0252, 0215, 0225, 0201, 0201, 0334, 0343, 0362, 0371, 
+  0110, 0135, 0121, 0074, 0006, 0165, 0064, 0105, 0276, 0374, 0212, 0172, 0065, 0270, 0072, 0270, 
+  0244, 0205, 0344, 0072, 0025, 0032, 0145, 0055, 0010, 0220, 0013, 0044, 0322, 0255, 0102, 0043, 
+  0225, 0225, 0004, 0032, 0125, 0005, 0266, 0106, 0256, 0300, 0356, 0250, 0320, 0310, 0060, 0112, 
+  0352, 0146, 0353, 0270, 0132, 0362, 0225, 0143, 0056, 0303, 0212, 0277, 0276, 0141, 0137, 0143, 
+  0313, 0220, 0030, 0302, 0267, 0030, 0303, 0007, 0147, 0264, 0014, 0004, 0144, 0036, 0325, 0050, 
+  0224, 0033, 0047, 0253, 0244, 0252, 0243, 0020, 0007, 0310, 0353, 0011, 0267, 0253, 0043, 0150, 
+  0267, 0050, 0007, 0353, 0340, 0152, 0023, 0143, 0145, 0263, 0323, 0045, 0310, 0176, 0331, 0357, 
+  0222, 0236, 0121, 0224, 0015, 0137, 0100, 0224, 0015, 0353, 0143, 0247, 0065, 0252, 0046, 0277, 
+  0266, 0203, 0205, 0227, 0224, 0223, 0315, 0001, 0117, 0266, 0313, 0222, 0023, 0142, 0177, 0123, 
+  0075, 0102, 0305, 0274, 0352, 0247, 0223, 0154, 0337, 0367, 0164, 0056, 0256, 0257, 0133, 0325, 
+  0226, 0215, 0355, 0031, 0332, 0076, 0352, 0247, 0130, 0236, 0206, 0360, 0057, 0201, 0315, 0233, 
+  0202, 0344, 0163, 0071, 0211, 0355, 0164, 0240, 0330, 0171, 0133, 0200, 0205, 0004, 0034, 0320, 
+  0014, 0372, 0010, 0263, 0317, 0322, 0036, 0130, 0047, 0163, 0045, 0246, 0230, 0133, 0226, 0033, 
+  0034, 0302, 0221, 0171, 0065, 0216, 0274, 0165, 0055, 0244, 0313, 0170, 0230, 0043, 0253, 0170, 
+  0226, 0372, 0210, 0341, 0271, 0302, 0361, 0070, 0063, 0012, 0303, 0142, 0320, 0041, 0347, 0376, 
+  0303, 0172, 0163, 0152, 0025, 0171, 0220, 0117, 0345, 0063, 0106, 0326, 0360, 0151, 0367, 0241, 
+  0257, 0133, 0267, 0154, 0316, 0163, 0353, 0117, 0155, 0332, 0160, 0252, 0335, 0116, 0033, 0225, 
+  0113, 0116, 0052, 0253, 0177, 0354, 0016, 0305, 0317, 0250, 0250, 0216, 0137, 0132, 0353, 0326, 
+  0255, 0041, 0053, 0247, 0365, 0356, 0001, 0364, 0016, 0325, 0237, 0151, 0000, 0135, 0374, 0337, 
+  0225, 0265, 0011, 0240, 0152, 0323, 0363, 0030, 0016, 0272, 0076, 0330, 0025, 0075, 0243, 0050, 
+  0272, 0174, 0001, 0121, 0064, 0172, 0122, 0275, 0375, 0067, 0037, 0071, 0236, 0006, 0147, 0157, 
+  0327, 0120, 0353, 0035, 0340, 0046, 0341, 0262, 0152, 0145, 0327, 0143, 0153, 0075, 0034, 0265, 
+  0151, 0122, 0176, 0253, 0022, 0376, 0030, 0344, 0212, 0013, 0172, 0331, 0235, 0161, 0045, 0123, 
+  0175, 0244, 0265, 0332, 0277, 0172, 0055, 0047, 0040, 0254, 0010, 0153, 0073, 0266, 0257, 0322, 
+  0330, 0172, 0125, 0114, 0060, 0253, 0023, 0262, 0314, 0100, 0023, 0305, 0013, 0215, 0356, 0321, 
+  0051, 0341, 0004, 0373, 0064, 0262, 0131, 0017, 0277, 0351, 0316, 0011, 0337, 0070, 0227, 0232, 
+  0244, 0116, 0015, 0333, 0107, 0016, 0032, 0057, 0202, 0000, 0332, 0242, 0332, 0274, 0250, 0026, 
+  0316, 0141, 0234, 0117, 0301, 0273, 0275, 0147, 0142, 0301, 0345, 0106, 0073, 0274, 0201, 0015, 
+  0207, 0325, 0037, 0164, 0353, 0365, 0332, 0144, 0260, 0043, 0131, 0243, 0370, 0043, 0006, 0376, 
+  0203, 0275, 0334, 0201, 0342, 0140, 0037, 0302, 0075, 0306, 0373, 0077, 0231, 0137, 0375, 0013, 
+  0043, 0022, 0104, 0267, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0164, 0145, 0162, 0155, 0151, 
+  0156, 0141, 0154, 0056, 0141, 0142, 0157, 0165, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0362, 0006, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0155, 0125, 0311, 0162, 0334, 0066, 
+  0020, 0275, 0353, 0053, 0160, 0301, 0121, 0220, 0043, 0107, 0256, 0122, 0206, 0236, 0252, 0321, 
+  0142, 0045, 0261, 0106, 0126, 0145, 0024, 0051, 0225, 0124, 0016, 0115, 0262, 0111, 0102, 0304, 
+  0302, 0002, 0100, 0316, 0162, 0367, 0207, 0344, 0057, 0162, 0167, 0076, 0054, 0015, 0160, 0064, 
+  0105, 0045, 0272, 0220, 0350, 0306, 0143, 0057, 0257, 0027, 0376, 0261, 0310, 0155, 0037, 0376, 
+  0074, 0132, 0364, 0241, 0261, 0316, 0177, 0134, 0344, 0250, 0330, 0262, 0270, 0124, 0150, 0112, 
+  0153, 0130, 0326, 0024, 0132, 0103, 0301, 0033, 0353, 0175, 0141, 0265, 0026, 0364, 0230, 0317, 
+  0026, 0045, 0150, 0166, 0355, 0112, 0015, 0021, 0201, 0055, 0052, 0016, 0256, 0150, 0224, 0064, 
+  0375, 0106, 0110, 0123, 0131, 0202, 0050, 0334, 0200, 0051, 0321, 0261, 0201, 0314, 0334, 0250, 
+  0276, 0150, 0331, 0117, 0217, 0054, 0153, 0101, 0051, 0351, 0203, 0074, 0343, 0275, 0221, 0233, 
+  0035, 0232, 0275, 0105, 0202, 0243, 0144, 0053, 0353, 0154, 0053, 0311, 0250, 0267, 0116, 0100, 
+  0322, 0161, 0215, 0166, 0355, 0204, 0353, 0043, 0110, 0221, 0303, 0073, 0353, 0312, 0346, 0333, 
+  0337, 0133, 0226, 0141, 0147, 0175, 0340, 0140, 0154, 0150, 0320, 0101, 0215, 0246, 0330, 0012, 
+  0103, 0276, 0057, 0260, 0051, 0241, 0144, 0327, 0276, 0202, 0046, 0267, 0045, 0313, 0362, 0244, 
+  0340, 0265, 0261, 0032, 0205, 0165, 0365, 0174, 0166, 0331, 0270, 0030, 0005, 0231, 0273, 0107, 
+  0347, 0213, 0206, 0145, 0105, 0323, 0341, 0377, 0021, 0266, 0043, 0323, 0354, 0123, 0377, 0054, 
+  0215, 0215, 0230, 0203, 0256, 0112, 0052, 0136, 0153, 0220, 0152, 0114, 0201, 0050, 0323, 0150, 
+  0002, 0273, 0305, 0012, 0363, 0301, 0041, 0301, 0107, 0215, 0120, 0173, 0015, 0117, 0004, 0151, 
+  0111, 0252, 0364, 0305, 0047, 0047, 0261, 0044, 0272, 0237, 0254, 0252, 0052, 0226, 0125, 0243, 
+  0310, 0203, 0003, 0343, 0025, 0204, 0024, 0210, 0330, 0301, 0174, 0166, 0323, 0113, 0105, 0076, 
+  0065, 0262, 0022, 0331, 0112, 0260, 0173, 0240, 0050, 0242, 0207, 0272, 0033, 0117, 0323, 0300, 
+  0177, 0204, 0301, 0026, 0224, 0226, 0061, 0322, 0324, 0041, 0325, 0260, 0343, 0016, 0313, 0006, 
+  0366, 0156, 0177, 0276, 0147, 0227, 0122, 0003, 0161, 0131, 0122, 0116, 0317, 0335, 0161, 0211, 
+  0003, 0227, 0046, 0267, 0233, 0304, 0362, 0055, 0370, 0235, 0262, 0354, 0202, 0112, 0341, 0131, 
+  0046, 0101, 0173, 0324, 0272, 0237, 0146, 0172, 0013, 0275, 0213, 0231, 0336, 0101, 0047, 0201, 
+  0060, 0001, 0164, 0107, 0326, 0170, 0345, 0020, 0105, 0345, 0346, 0263, 0045, 0224, 0340, 0074, 
+  0173, 0224, 0301, 0122, 0312, 0204, 0320, 0111, 0041, 0206, 0275, 0142, 0152, 0154, 0111, 0235, 
+  0103, 0034, 0134, 0311, 0347, 0326, 0123, 0346, 0021, 0033, 0025, 0242, 0334, 0046, 0371, 0077, 
+  0120, 0252, 0230, 0145, 0253, 0376, 0333, 0137, 0016, 0167, 0307, 0013, 0065, 0000, 0275, 0323, 
+  0047, 0361, 0142, 0312, 0002, 0141, 0133, 0366, 0320, 0130, 0015, 0311, 0275, 0153, 0363, 0300, 
+  0261, 0042, 0170, 0045, 0014, 0206, 0164, 0037, 0250, 0321, 0236, 0244, 0356, 0034, 0372, 0021, 
+  0103, 0012, 0256, 0211, 0167, 0042, 0304, 0267, 0124, 0346, 0275, 0045, 0131, 0064, 0100, 0021, 
+  0076, 0240, 0163, 0324, 0164, 0172, 0024, 0105, 0210, 0042, 0057, 0310, 0255, 0221, 0005, 0274, 
+  0104, 0050, 0133, 0144, 0067, 0220, 0123, 0045, 0125, 0204, 0266, 0050, 0352, 0121, 0342, 0045, 
+  0370, 0143, 0362, 0274, 0133, 0243, 0153, 0003, 0202, 0026, 0045, 0316, 0147, 0167, 0262, 0265, 
+  0012, 0266, 0054, 0106, 0263, 0065, 0166, 0110, 0141, 0010, 0322, 0155, 0137, 0045, 0176, 0017, 
+  0171, 0254, 0010, 0021, 0103, 0226, 0210, 0042, 0032, 0305, 0065, 0247, 0126, 0304, 0276, 0033, 
+  0263, 0241, 0046, 0316, 0061, 0325, 0253, 0333, 0237, 0136, 0175, 0056, 0155, 0160, 0354, 0312, 
+  0375, 0363, 0265, 0046, 0100, 0024, 0112, 0032, 0227, 0051, 0342, 0027, 0113, 0037, 0005, 0166, 
+  0321, 0077, 0263, 0314, 0245, 0263, 0310, 0373, 0347, 0051, 0142, 0065, 0016, 0363, 0152, 0215, 
+  0064, 0057, 0324, 0026, 0246, 0222, 0116, 0206, 0127, 0210, 0302, 0006, 0062, 0001, 0312, 0040, 
+  0014, 0110, 0030, 0237, 0217, 0347, 0067, 0070, 0175, 0231, 0363, 0375, 0330, 0277, 0075, 0356, 
+  0253, 0100, 0005, 0063, 0354, 0001, 0172, 0103, 0236, 0063, 0237, 0104, 0021, 0222, 0110, 0216, 
+  0067, 0002, 0302, 0013, 0310, 0262, 0317, 0340, 0240, 0303, 0340, 0143, 0271, 0107, 0244, 0345, 
+  0355, 0101, 0267, 0217, 0060, 0040, 0215, 0256, 0141, 0237, 0035, 0320, 0266, 0043, 0134, 0373, 
+  0375, 0051, 0367, 0243, 0262, 0075, 0100, 0006, 0144, 0277, 0143, 0132, 0011, 0076, 0012, 0273, 
+  0170, 0076, 0235, 0046, 0372, 0050, 0013, 0232, 0271, 0350, 0021, 0011, 0064, 0264, 0361, 0315, 
+  0307, 0327, 0130, 0215, 0107, 0105, 0333, 0347, 0213, 0123, 0251, 0236, 0326, 0370, 0000, 0223, 
+  0361, 0212, 0303, 0136, 0203, 0251, 0331, 0257, 0212, 0032, 0043, 0272, 0211, 0364, 0160, 0107, 
+  0234, 0311, 0220, 0232, 0342, 0251, 0147, 0277, 0111, 0260, 0151, 0073, 0145, 0133, 0014, 0264, 
+  0162, 0246, 0356, 0241, 0240, 0161, 0243, 0055, 0115, 0015, 0166, 0070, 0162, 0152, 0100, 0352, 
+  0343, 0102, 0172, 0151, 0115, 0300, 0242, 0021, 0271, 0334, 0021, 0124, 0155, 0072, 0305, 0232, 
+  0020, 0072, 0377, 0303, 0311, 0111, 0055, 0103, 0323, 0347, 0321, 0310, 0111, 0272, 0230, 0051, 
+  0331, 0157, 0345, 0371, 0051, 0313, 0322, 0341, 0273, 0363, 0363, 0323, 0167, 0347, 0357, 0316, 
+  0246, 0276, 0142, 0263, 0043, 0250, 0017, 0147, 0147, 0357, 0077, 0274, 0145, 0147, 0172, 0077, 
+  0063, 0326, 0032, 0174, 0117, 0333, 0326, 0122, 0153, 0212, 0265, 0105, 0067, 0026, 0352, 0140, 
+  0315, 0046, 0126, 0151, 0003, 0014, 0244, 0247, 0077, 0002, 0226, 0051, 0137, 0032, 0141, 0117, 
+  0213, 0050, 0275, 0170, 0172, 0216, 0064, 0036, 0135, 0122, 0056, 0116, 0346, 0175, 0210, 0077, 
+  0246, 0243, 0331, 0302, 0105, 0052, 0350, 0164, 0145, 0213, 0076, 0056, 0126, 0352, 0304, 0217, 
+  0313, 0305, 0303, 0065, 0173, 0121, 0100, 0240, 0364, 0151, 0120, 0101, 0317, 0156, 0356, 0276, 
+  0054, 0337, 0274, 0070, 0372, 0027, 0222, 0331, 0207, 0112, 0000, 0050, 0165, 0165, 0141, 0171, 
+  0051
+} };
+
+static GStaticResource static_resource = { terminal_resource_data.data, sizeof (terminal_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *terminal_get_resource (void);
+GResource *terminal_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CONSTRUCTOR_H__
+#define __G_CONSTRUCTOR_H__
+
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+/*
+ * Only try to include gslist.h if not already included via glib.h,
+ * so that items using gconstructor.h outside of GLib (such as
+ * GResources) continue to build properly.
+ */
+#ifndef __G_LIB_H__
+#include "gslist.h"
+#endif
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+#endif /* __G_CONSTRUCTOR_H__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(terminalresource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(terminalresource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(terminalresource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(terminalresource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void terminalresource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void terminalresource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/49.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/49.html new file mode 100644 index 0000000..baeaf9a --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/49.html @@ -0,0 +1,1065 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * Copyright © 2008, 2010 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * 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 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-screen-container.h"
+#include "terminal-debug.h"
+#include "terminal-intl.h"
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+struct _TerminalScreenContainerPrivate
+{
+	TerminalScreen *screen;
+#ifdef USE_SCROLLED_WINDOW
+	GtkWidget *scrolled_window;
+#else
+	GtkWidget *hbox;
+	GtkWidget *vscrollbar;
+#endif
+	GtkPolicyType hscrollbar_policy;
+	GtkPolicyType vscrollbar_policy;
+	GtkCornerType window_placement;
+	guint window_placement_set : 1;
+};
+
+enum
+{
+    PROP_0,
+    PROP_SCREEN,
+    PROP_HSCROLLBAR_POLICY,
+    PROP_VSCROLLBAR_POLICY,
+    PROP_WINDOW_PLACEMENT,
+    PROP_WINDOW_PLACEMENT_SET
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (TerminalScreenContainer, terminal_screen_container, GTK_TYPE_BOX)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
+
+/* helper functions */
+
+static void
+terminal_screen_container_set_placement_internal (TerminalScreenContainer *container,
+        GtkCornerType corner)
+{
+	TerminalScreenContainerPrivate *priv = container->priv;
+
+#ifdef USE_SCROLLED_WINDOW
+	gtk_scrolled_window_set_placement (GTK_SCROLLED_WINDOW (priv->scrolled_window), corner);
+#else
+	switch (corner)
+	{
+	case GTK_CORNER_TOP_LEFT:
+	case GTK_CORNER_BOTTOM_LEFT:
+		gtk_box_reorder_child (GTK_BOX (priv->hbox), priv->vscrollbar, 1);
+		break;
+	case GTK_CORNER_TOP_RIGHT:
+	case GTK_CORNER_BOTTOM_RIGHT:
+		gtk_box_reorder_child (GTK_BOX (priv->hbox), priv->vscrollbar, 0);
+		break;
+	default:
+		g_assert_not_reached ();
+	}
+#endif
+
+	priv->window_placement = corner;
+	g_object_notify (G_OBJECT (container), "window-placement");
+}
+
+static void
+terminal_screen_container_set_placement_set (TerminalScreenContainer *container,
+        gboolean set)
+{
+	TerminalScreenContainerPrivate *priv = container->priv;
+
+#ifdef USE_SCROLLED_WINDOW
+	g_object_set (priv->scrolled_window, "window-placement-set", set, NULL);
+#endif
+
+	priv->window_placement_set = set != FALSE;
+	g_object_notify (G_OBJECT (container), "window-placement-set");
+}
+
+#if defined(USE_SCROLLED_WINDOW) && defined(MATE_ENABLE_DEBUG)
+static void
+size_allocate_cb (GtkWidget *widget,
+                  GdkRectangle *rect,
+                  TerminalScreenContainer *container)
+{
+	_terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+	                       "[screen %p] scrolled-window size alloc %d : %d\n",
+	                       container->priv->screen, rect->width, rect->height);
+}
+#endif
+
+/* Class implementation */
+
+static void
+terminal_screen_container_init (TerminalScreenContainer *container)
+{
+	TerminalScreenContainerPrivate *priv;
+
+	priv = container->priv = terminal_screen_container_get_instance_private (container);
+
+	priv->hscrollbar_policy = GTK_POLICY_AUTOMATIC;
+	priv->vscrollbar_policy = GTK_POLICY_AUTOMATIC;
+	priv->window_placement = GTK_CORNER_BOTTOM_RIGHT;
+	priv->window_placement_set = FALSE;
+
+	gtk_orientable_set_orientation (GTK_ORIENTABLE (container), GTK_ORIENTATION_VERTICAL);
+}
+
+static GObject *
+terminal_screen_container_constructor (GType type,
+                                       guint n_construct_properties,
+                                       GObjectConstructParam *construct_params)
+{
+	GObject *object;
+	TerminalScreenContainer *container;
+	TerminalScreenContainerPrivate *priv;
+
+	object = G_OBJECT_CLASS (terminal_screen_container_parent_class)->constructor
+	         (type, n_construct_properties, construct_params);
+
+	container = TERMINAL_SCREEN_CONTAINER (object);
+	priv = container->priv;
+
+	g_assert (priv->screen != NULL);
+
+#ifdef USE_SCROLLED_WINDOW
+	priv->scrolled_window = gtk_scrolled_window_new (NULL, gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (priv->screen)));
+
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
+	                                priv->hscrollbar_policy,
+	                                priv->vscrollbar_policy);
+	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->scrolled_window),
+	                                     GTK_SHADOW_NONE);
+	gtk_container_add (GTK_CONTAINER (priv->scrolled_window), GTK_WIDGET (priv->screen));
+	gtk_widget_show (GTK_WIDGET (priv->screen));
+	gtk_box_pack_end (GTK_BOX (container), priv->scrolled_window, TRUE, TRUE, 0);
+	gtk_widget_show (priv->scrolled_window);
+
+#ifdef MATE_ENABLE_DEBUG
+	g_signal_connect (priv->scrolled_window, "size-allocate", G_CALLBACK (size_allocate_cb), container);
+#endif
+
+#else
+
+	priv->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+
+	priv->vscrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (priv->screen)));
+
+	gtk_box_pack_start (GTK_BOX (priv->hbox), GTK_WIDGET (priv->screen), TRUE, TRUE, 0);
+	gtk_box_pack_start (GTK_BOX (priv->hbox), priv->vscrollbar, FALSE, FALSE, 0);
+
+	gtk_box_pack_end (GTK_BOX (container), priv->hbox, TRUE, TRUE, 0);
+	gtk_widget_show_all (priv->hbox);
+#endif /* USE_SCROLLED_WINDOW */
+
+	_terminal_screen_update_scrollbar (priv->screen);
+
+	return object;
+}
+
+static void
+terminal_screen_container_get_property (GObject *object,
+                                        guint prop_id,
+                                        GValue *value,
+                                        GParamSpec *pspec)
+{
+	TerminalScreenContainer *container = TERMINAL_SCREEN_CONTAINER (object);
+	TerminalScreenContainerPrivate *priv = container->priv;
+
+	switch (prop_id)
+	{
+	case PROP_SCREEN:
+		break;
+	case PROP_HSCROLLBAR_POLICY:
+		g_value_set_enum (value, priv->hscrollbar_policy);
+		break;
+	case PROP_VSCROLLBAR_POLICY:
+		g_value_set_enum (value, priv->vscrollbar_policy);
+		break;
+	case PROP_WINDOW_PLACEMENT:
+		g_value_set_enum (value, priv->window_placement);
+		break;
+	case PROP_WINDOW_PLACEMENT_SET:
+		g_value_set_boolean (value, priv->window_placement_set);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+terminal_screen_container_set_property (GObject *object,
+                                        guint prop_id,
+                                        const GValue *value,
+                                        GParamSpec *pspec)
+{
+	TerminalScreenContainer *container = TERMINAL_SCREEN_CONTAINER (object);
+	TerminalScreenContainerPrivate *priv = container->priv;
+
+	switch (prop_id)
+	{
+	case PROP_SCREEN:
+		priv->screen = g_value_get_object (value);
+		break;
+	case PROP_HSCROLLBAR_POLICY:
+		terminal_screen_container_set_policy (container,
+		                                      g_value_get_enum (value),
+		                                      priv->vscrollbar_policy);
+		break;
+	case PROP_VSCROLLBAR_POLICY:
+		terminal_screen_container_set_policy (container,
+		                                      priv->hscrollbar_policy,
+		                                      g_value_get_enum (value));
+		break;
+	case PROP_WINDOW_PLACEMENT:
+		terminal_screen_container_set_placement_internal (container, g_value_get_enum (value));
+		break;
+	case PROP_WINDOW_PLACEMENT_SET:
+		terminal_screen_container_set_placement_set (container, g_value_get_boolean (value));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+terminal_screen_container_class_init (TerminalScreenContainerClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+	gobject_class->constructor = terminal_screen_container_constructor;
+	gobject_class->get_property = terminal_screen_container_get_property;
+	gobject_class->set_property = terminal_screen_container_set_property;
+
+	g_object_class_install_property
+	(gobject_class,
+	 PROP_SCREEN,
+	 g_param_spec_object ("screen", NULL, NULL,
+	                      TERMINAL_TYPE_SCREEN,
+	                      G_PARAM_READWRITE |
+	                      G_PARAM_CONSTRUCT_ONLY |
+	                      G_PARAM_STATIC_STRINGS));
+
+	g_object_class_install_property
+	(gobject_class,
+	 PROP_HSCROLLBAR_POLICY,
+	 g_param_spec_enum ("hscrollbar-policy", NULL, NULL,
+	                    GTK_TYPE_POLICY_TYPE,
+	                    GTK_POLICY_AUTOMATIC,
+	                    G_PARAM_READWRITE |
+	                    G_PARAM_STATIC_STRINGS));
+	g_object_class_install_property
+	(gobject_class,
+	 PROP_VSCROLLBAR_POLICY,
+	 g_param_spec_enum ("vscrollbar-policy", NULL, NULL,
+	                    GTK_TYPE_POLICY_TYPE,
+	                    GTK_POLICY_AUTOMATIC,
+	                    G_PARAM_READWRITE |
+	                    G_PARAM_STATIC_STRINGS));
+
+	g_object_class_install_property
+	(gobject_class,
+	 PROP_WINDOW_PLACEMENT,
+	 g_param_spec_enum ("window-placement", NULL, NULL,
+	                    GTK_TYPE_CORNER_TYPE,
+	                    GTK_CORNER_TOP_LEFT,
+	                    G_PARAM_READWRITE |
+	                    G_PARAM_STATIC_STRINGS));
+
+	g_object_class_install_property
+	(gobject_class,
+	 PROP_WINDOW_PLACEMENT_SET,
+	 g_param_spec_boolean ("window-placement-set", NULL, NULL,
+	                       FALSE,
+	                       G_PARAM_READWRITE |
+	                       G_PARAM_STATIC_STRINGS));
+}
+
+/* public API */
+
+/**
+ * terminal_screen_container_new:
+ * @screen: a #TerminalScreen
+ *
+ * Returns: a new #TerminalScreenContainer for @screen
+ */
+GtkWidget *
+terminal_screen_container_new (TerminalScreen *screen)
+{
+	return g_object_new (TERMINAL_TYPE_SCREEN_CONTAINER,
+	                     "screen", screen,
+	                     NULL);
+}
+
+/**
+ * terminal_screen_container_get_screen:
+ * @container: a #TerminalScreenContainer
+ *
+ * Returns: @container's #TerminalScreen
+ */
+TerminalScreen *
+terminal_screen_container_get_screen (TerminalScreenContainer *container)
+{
+	g_return_val_if_fail (TERMINAL_IS_SCREEN_CONTAINER (container), NULL);
+
+	return container->priv->screen;
+}
+
+/**
+ * terminal_screen_container_get_from_screen:
+ * @screen: a #TerminalScreenContainerPrivate
+ *
+ * Returns the #TerminalScreenContainer containing @screen.
+ */
+TerminalScreenContainer *
+terminal_screen_container_get_from_screen (TerminalScreen *screen)
+{
+	g_return_val_if_fail (TERMINAL_IS_SCREEN (screen), NULL);
+
+	return TERMINAL_SCREEN_CONTAINER (gtk_widget_get_ancestor (GTK_WIDGET (screen), TERMINAL_TYPE_SCREEN_CONTAINER));
+}
+
+/**
+ * terminal_screen_container_set_policy:
+ * @container: a #TerminalScreenContainer
+ * @hpolicy: a #GtkPolicyType
+ * @vpolicy: a #GtkPolicyType
+ *
+ * Sets @container's scrollbar policy.
+ */
+void
+terminal_screen_container_set_policy (TerminalScreenContainer *container,
+                                      GtkPolicyType hpolicy G_GNUC_UNUSED,
+                                      GtkPolicyType vpolicy)
+{
+	TerminalScreenContainerPrivate *priv;
+	GObject *object;
+
+	g_return_if_fail (TERMINAL_IS_SCREEN_CONTAINER (container));
+
+	object = G_OBJECT (container);
+	priv = container->priv;
+
+	g_object_freeze_notify (object);
+
+	if (priv->hscrollbar_policy != hpolicy)
+	{
+		priv->hscrollbar_policy = hpolicy;
+		g_object_notify (object, "hscrollbar-policy");
+	}
+	if (priv->vscrollbar_policy != vpolicy)
+	{
+		priv->vscrollbar_policy = vpolicy;
+		g_object_notify (object, "vscrollbar-policy");
+	}
+
+#ifdef USE_SCROLLED_WINDOW
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window), hpolicy, vpolicy);
+#else
+	switch (vpolicy)
+	{
+	case GTK_POLICY_NEVER:
+		gtk_widget_hide (priv->vscrollbar);
+		break;
+	case GTK_POLICY_AUTOMATIC:
+	case GTK_POLICY_ALWAYS:
+		gtk_widget_show (priv->vscrollbar);
+		break;
+	default:
+		g_assert_not_reached ();
+	}
+#endif
+
+	g_object_thaw_notify (object);
+}
+
+/**
+ * terminal_screen_container_set_placement:
+ * @container: a #TerminalScreenContainer
+ * @corner: a #GtkCornerType
+ *
+ * Sets @container's window placement.
+ */
+void
+terminal_screen_container_set_placement (TerminalScreenContainer *container,
+        GtkCornerType corner)
+{
+	g_return_if_fail (TERMINAL_IS_SCREEN_CONTAINER (container));
+
+	terminal_screen_container_set_placement_internal (container, corner);
+	terminal_screen_container_set_placement_set (container, TRUE);
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/5.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/5.html new file mode 100644 index 0000000..0d18252 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/5.html @@ -0,0 +1,3055 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
   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
/*
+ * Copyright (C) 2007 Novell, Inc.
+ *
+ * Inspired by various other pieces of code including GsmClient (C)
+ * 2001 Havoc Pennington, MateClient (C) 1998 Carsten Schaar, and twm
+ * session code (C) 1998 The Open Group.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"<--- Include file: "config.h" not found.
+
+#include "eggsmclient.h"
+#include "eggsmclient-private.h"
+
+#include "eggdesktopfile.h"
+
+#include <errno.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <fcntl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <X11/SM/SMlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#define EGG_TYPE_SM_CLIENT_XSMP            (egg_sm_client_xsmp_get_type ())
+#define EGG_SM_CLIENT_XSMP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMP))
+#define EGG_SM_CLIENT_XSMP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMPClass))
+#define EGG_IS_SM_CLIENT_XSMP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_SM_CLIENT_XSMP))
+#define EGG_IS_SM_CLIENT_XSMP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_SM_CLIENT_XSMP))
+#define EGG_SM_CLIENT_XSMP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMPClass))
+
+typedef struct _EggSMClientXSMP        EggSMClientXSMP;
+typedef struct _EggSMClientXSMPClass   EggSMClientXSMPClass;
+
+/* These mostly correspond to the similarly-named states in section
+ * 9.1 of the XSMP spec. Some of the states there aren't represented
+ * here, because we don't need them. SHUTDOWN_CANCELLED is slightly
+ * different from the spec; we use it when the client is IDLE after a
+ * ShutdownCancelled message, but the application is still interacting
+ * and doesn't know the shutdown has been cancelled yet.
+ */
+typedef enum
+{
+    XSMP_STATE_IDLE,
+    XSMP_STATE_SAVE_YOURSELF,
+    XSMP_STATE_INTERACT_REQUEST,
+    XSMP_STATE_INTERACT,
+    XSMP_STATE_SAVE_YOURSELF_DONE,
+    XSMP_STATE_SHUTDOWN_CANCELLED,
+    XSMP_STATE_CONNECTION_CLOSED
+} EggSMClientXSMPState;
+
+static const char *state_names[] =
+{
+    "idle",
+    "save-yourself",
+    "interact-request",
+    "interact",
+    "save-yourself-done",
+    "shutdown-cancelled",
+    "connection-closed"
+};
+
+#define EGG_SM_CLIENT_XSMP_STATE(xsmp) (state_names[(xsmp)->state])
+
+struct _EggSMClientXSMP
+{
+    EggSMClient parent;
+
+    SmcConn connection;
+    char *client_id;
+
+    EggSMClientXSMPState state;
+    char **restart_command;
+    gboolean set_restart_command;
+    int restart_style;
+	char **discard_command;
+	gboolean set_discard_command;
+
+    guint idle;
+
+    /* Current SaveYourself state */
+    guint expecting_initial_save_yourself : 1;
+    guint need_save_state : 1;
+    guint need_quit_requested : 1;
+    guint interact_errors : 1;
+    guint shutting_down : 1;
+
+    /* Todo list */
+    guint waiting_to_set_initial_properties : 1;
+    guint waiting_to_emit_quit : 1;
+    guint waiting_to_emit_quit_cancelled : 1;
+    guint waiting_to_save_myself : 1;
+
+};
+
+struct _EggSMClientXSMPClass
+{
+    EggSMClientClass parent_class;
+
+};
+
+static void     sm_client_xsmp_startup (EggSMClient *client,
+                                        const char  *client_id);
+static void     sm_client_xsmp_set_restart_command (EggSMClient  *client,
+        int           argc,
+        const char  **argv);
+static void     sm_client_xsmp_set_discard_command (EggSMClient  *client,
+        int           argc,
+        const char  **argv);
+static void     sm_client_xsmp_will_quit (EggSMClient *client,
+        gboolean     will_quit);
+static gboolean sm_client_xsmp_end_session (EggSMClient         *client,
+        EggSMClientEndStyle  style,
+        gboolean  request_confirmation);
+
+static void xsmp_save_yourself      (SmcConn   smc_conn,
+                                     SmPointer client_data,
+                                     int       save_style,
+                                     Bool      shutdown,
+                                     int       interact_style,
+                                     Bool      fast);
+static void xsmp_die                (SmcConn   smc_conn,
+                                     SmPointer client_data);
+static void xsmp_save_complete      (SmcConn   smc_conn,
+                                     SmPointer client_data);
+static void xsmp_shutdown_cancelled (SmcConn   smc_conn,
+                                     SmPointer client_data);
+static void xsmp_interact           (SmcConn   smc_conn,
+                                     SmPointer client_data);
+
+static SmProp *array_prop        (const char    *name,
+                                  ...);
+static SmProp *ptrarray_prop     (const char    *name,
+                                  GPtrArray     *values);
+static SmProp *string_prop       (const char    *name,
+                                  const char    *value);
+static SmProp *card8_prop        (const char    *name,
+                                  unsigned char  value);
+
+static void set_properties         (EggSMClientXSMP *xsmp, ...);
+static void delete_properties      (EggSMClientXSMP *xsmp, ...);
+
+static GPtrArray *generate_command (char       **restart_command,
+                                    const char  *client_id,
+                                    const char  *state_file);
+
+static void save_state            (EggSMClientXSMP *xsmp);
+static void do_save_yourself      (EggSMClientXSMP *xsmp);
+static void update_pending_events (EggSMClientXSMP *xsmp);
+
+static void     ice_init             (void);
+static gboolean process_ice_messages (IceConn       ice_conn);
+static void     smc_error_handler    (SmcConn       smc_conn,
+                                      Bool          swap,
+                                      int           offending_minor_opcode,
+                                      unsigned long offending_sequence,
+                                      int           error_class,
+                                      int           severity,
+                                      SmPointer     values);
+
+G_DEFINE_TYPE (EggSMClientXSMP, egg_sm_client_xsmp, EGG_TYPE_SM_CLIENT)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
+
+static void
+egg_sm_client_xsmp_init (EggSMClientXSMP *xsmp)
+{
+    xsmp->state = XSMP_STATE_CONNECTION_CLOSED;
+    xsmp->connection = NULL;
+    xsmp->restart_style = SmRestartIfRunning;
+}
+
+static void
+egg_sm_client_xsmp_class_init (EggSMClientXSMPClass *klass)
+{
+    EggSMClientClass *sm_client_class = EGG_SM_CLIENT_CLASS (klass);
+
+    sm_client_class->startup             = sm_client_xsmp_startup;
+    sm_client_class->set_restart_command = sm_client_xsmp_set_restart_command;
+	sm_client_class->set_discard_command = sm_client_xsmp_set_discard_command;
+    sm_client_class->will_quit           = sm_client_xsmp_will_quit;
+    sm_client_class->end_session         = sm_client_xsmp_end_session;
+}
+
+EggSMClient *
+egg_sm_client_xsmp_new (void)
+{
+    if (!g_getenv ("SESSION_MANAGER"))
+        return NULL;
+
+    return g_object_new (EGG_TYPE_SM_CLIENT_XSMP, NULL);
+}
+
+static gboolean
+sm_client_xsmp_set_initial_properties (gpointer user_data)
+{
+    EggSMClientXSMP *xsmp = user_data;
+    EggDesktopFile *desktop_file;
+    GPtrArray *clone, *restart;
+    char pid_str[64];
+
+    if (xsmp->idle)
+    {
+        g_source_remove (xsmp->idle);
+        xsmp->idle = 0;
+    }
+    xsmp->waiting_to_set_initial_properties = FALSE;
+
+    if (egg_sm_client_get_mode () == EGG_SM_CLIENT_MODE_NO_RESTART)
+        xsmp->restart_style = SmRestartNever;
+
+    /* Parse info out of desktop file */
+    desktop_file = egg_get_desktop_file ();
+    if (desktop_file)
+    {
+        GError *err = NULL;
+        char **argv;
+        int argc;
+
+        if (xsmp->restart_style == SmRestartIfRunning)
+        {
+            if (egg_desktop_file_get_boolean (desktop_file,
+                                              "X-MATE-AutoRestart", NULL))
+                xsmp->restart_style = SmRestartImmediately;
+        }
+
+        if (!xsmp->set_restart_command)
+        {
+            char *cmdline;
+
+            cmdline = egg_desktop_file_parse_exec (desktop_file, NULL, &err);
+            if (cmdline && g_shell_parse_argv (cmdline, &argc, &argv, &err))
+            {
+                egg_sm_client_set_restart_command (EGG_SM_CLIENT (xsmp),
+                                                   argc, (const char **)argv);
+                g_strfreev (argv);
+            }
+            else
+            {
+                g_warning ("Could not parse Exec line in desktop file: %s",
+                           err->message);
+                g_error_free (err);
+            }
+            g_free (cmdline);
+        }
+    }
+
+    if (!xsmp->set_restart_command)
+        xsmp->restart_command = g_strsplit (g_get_prgname (), " ", -1);
+
+    clone = generate_command (xsmp->restart_command, NULL, NULL);
+    restart = generate_command (xsmp->restart_command, xsmp->client_id, NULL);
+
+    g_debug ("Setting initial properties");
+
+    /* Program, CloneCommand, RestartCommand, and UserID are required.
+     * ProcessID isn't required, but the SM may be able to do something
+     * useful with it.
+     */
+    g_snprintf (pid_str, sizeof (pid_str), "%lu", (gulong) getpid ());
+    set_properties (xsmp,
+                    string_prop   (SmProgram, g_get_prgname ()),
+                    ptrarray_prop (SmCloneCommand, clone),
+                    ptrarray_prop (SmRestartCommand, restart),
+                    string_prop   (SmUserID, g_get_user_name ()),
+                    string_prop   (SmProcessID, pid_str),
+                    card8_prop    (SmRestartStyleHint, xsmp->restart_style),
+                    NULL);
+    g_ptr_array_free (clone, TRUE);
+    g_ptr_array_free (restart, TRUE);
+
+    if (desktop_file)
+    {
+        set_properties (xsmp,
+                        string_prop ("_GSM_DesktopFile", egg_desktop_file_get_source (desktop_file)),
+                        NULL);
+    }
+
+    update_pending_events (xsmp);
+    return FALSE;
+}
+
+/* This gets called from two different places: xsmp_die() (when the
+ * server asks us to disconnect) and process_ice_messages() (when the
+ * server disconnects unexpectedly).
+ */
+static void
+sm_client_xsmp_disconnect (EggSMClientXSMP *xsmp)
+{
+    SmcConn connection;
+
+    if (!xsmp->connection)
+        return;
+
+    g_debug ("Disconnecting");
+
+    connection = xsmp->connection;
+    xsmp->connection = NULL;
+    SmcCloseConnection (connection, 0, NULL);
+    xsmp->state = XSMP_STATE_CONNECTION_CLOSED;
+
+    xsmp->waiting_to_save_myself = FALSE;
+    update_pending_events (xsmp);
+}
+
+static void
+sm_client_xsmp_startup (EggSMClient *client,
+                        const char  *client_id)
+{
+    EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
+    SmcCallbacks callbacks;
+    char *ret_client_id;
+    char error_string_ret[256];
+
+    xsmp->client_id = g_strdup (client_id);
+
+    ice_init ();
+    SmcSetErrorHandler (smc_error_handler);
+
+    callbacks.save_yourself.callback      = xsmp_save_yourself;
+    callbacks.die.callback                = xsmp_die;
+    callbacks.save_complete.callback      = xsmp_save_complete;
+    callbacks.shutdown_cancelled.callback = xsmp_shutdown_cancelled;
+
+    callbacks.save_yourself.client_data      = xsmp;
+    callbacks.die.client_data                = xsmp;
+    callbacks.save_complete.client_data      = xsmp;
+    callbacks.shutdown_cancelled.client_data = xsmp;
+
+    client_id = NULL;
+    error_string_ret[0] = '\0';
+    xsmp->connection =
+        SmcOpenConnection (NULL, xsmp, SmProtoMajor, SmProtoMinor,
+                           SmcSaveYourselfProcMask | SmcDieProcMask |
+                           SmcSaveCompleteProcMask |
+                           SmcShutdownCancelledProcMask,
+                           &callbacks,
+                           xsmp->client_id, &ret_client_id,
+                           sizeof (error_string_ret), error_string_ret);
+
+    if (!xsmp->connection)
+    {
+        g_warning ("Failed to connect to the session manager: %s\n",
+                   error_string_ret[0] ?
+                   error_string_ret : "no error message given");
+        xsmp->state = XSMP_STATE_CONNECTION_CLOSED;
+        return;
+    }
+
+    /* We expect a pointless initial SaveYourself if either (a) we
+     * didn't have an initial client ID, or (b) we DID have an initial
+     * client ID, but the server rejected it and gave us a new one.
+     */
+    if (!xsmp->client_id ||
+            (ret_client_id && strcmp (xsmp->client_id, ret_client_id) != 0))
+        xsmp->expecting_initial_save_yourself = TRUE;
+
+    if (ret_client_id)
+    {
+        g_free (xsmp->client_id);
+        xsmp->client_id = g_strdup (ret_client_id);
+        free (ret_client_id);
+
+#ifdef GDK_WINDOWING_X11
+      if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
+        gdk_x11_set_sm_client_id (xsmp->client_id);
+#endif
+
+        g_debug ("Got client ID \"%s\"", xsmp->client_id);
+    }
+
+    xsmp->state = XSMP_STATE_IDLE;
+
+    /* Do not set the initial properties until we reach the main loop,
+     * so that the application has a chance to call
+     * egg_set_desktop_file(). (This may also help the session manager
+     * have a better idea of when the application is fully up and
+     * running.)
+     */
+    xsmp->waiting_to_set_initial_properties = TRUE;
+    xsmp->idle = g_idle_add (sm_client_xsmp_set_initial_properties, client);
+}
+
+static void
+sm_client_xsmp_set_restart_command (EggSMClient  *client,
+                                    int           argc,
+                                    const char  **argv)
+{
+    EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
+    int i;
+
+    g_strfreev (xsmp->restart_command);
+
+    xsmp->restart_command = g_new (char *, argc + 1);
+    for (i = 0; i < argc; i++)
+        xsmp->restart_command[i] = g_strdup (argv[i]);
+    xsmp->restart_command[i] = NULL;
+
+    xsmp->set_restart_command = TRUE;
+}
+
+static void
+sm_client_xsmp_set_discard_command (EggSMClient  *client,
+                                    int           argc,
+                                    const char  **argv)
+{
+	EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
+	int i;
+
+	g_strfreev (xsmp->discard_command);
+
+	xsmp->discard_command = g_new (char *, argc + 1);
+	for (i = 0; i < argc; i++)
+		xsmp->discard_command[i] = g_strdup (argv[i]);
+	xsmp->discard_command[i] = NULL;
+
+	xsmp->set_discard_command = TRUE;
+}
+
+static void
+sm_client_xsmp_will_quit (EggSMClient *client,
+                          gboolean     will_quit)
+{
+    EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
+
+    if (xsmp->state == XSMP_STATE_CONNECTION_CLOSED)
+    {
+        /* The session manager has already exited! Schedule a quit
+         * signal.
+         */
+        xsmp->waiting_to_emit_quit = TRUE;
+        update_pending_events (xsmp);
+        return;
+    }
+    else if (xsmp->state == XSMP_STATE_SHUTDOWN_CANCELLED)
+    {
+        /* We received a ShutdownCancelled message while the application
+         * was interacting; Schedule a quit_cancelled signal.
+         */
+        xsmp->waiting_to_emit_quit_cancelled = TRUE;
+        update_pending_events (xsmp);
+        return;
+    }
+
+    g_return_if_fail (xsmp->state == XSMP_STATE_INTERACT);
+
+    g_debug ("Sending InteractDone(%s)", will_quit ? "False" : "True");
+    SmcInteractDone (xsmp->connection, !will_quit);
+
+    if (will_quit && xsmp->need_save_state)
+        save_state (xsmp);
+
+    g_debug ("Sending SaveYourselfDone(%s)", will_quit ? "True" : "False");
+    SmcSaveYourselfDone (xsmp->connection, will_quit);
+    xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE;
+}
+
+static gboolean
+sm_client_xsmp_end_session (EggSMClient         *client,
+                            EggSMClientEndStyle  style,
+                            gboolean             request_confirmation)
+{
+    EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
+    int save_type;
+
+    /* To end the session via XSMP, we have to send a
+     * SaveYourselfRequest. We aren't allowed to do that if anything
+     * else is going on, but we don't want to expose this fact to the
+     * application. So we do our best to patch things up here...
+     *
+     * In the worst case, this method might block for some length of
+     * time in process_ice_messages, but the only time that code path is
+     * honestly likely to get hit is if the application tries to end the
+     * session as the very first thing it does, in which case it
+     * probably won't actually block anyway. It's not worth gunking up
+     * the API to try to deal nicely with the other 0.01% of cases where
+     * this happens.
+     */
+
+    while (xsmp->state != XSMP_STATE_IDLE ||
+            xsmp->expecting_initial_save_yourself)
+    {
+        /* If we're already shutting down, we don't need to do anything. */
+        if (xsmp->shutting_down)
+            return TRUE;
+
+        switch (xsmp->state)
+        {
+        case XSMP_STATE_CONNECTION_CLOSED:
+            return FALSE;
+
+        case XSMP_STATE_SAVE_YOURSELF:
+            /* Trying to log out from the save_state callback? Whatever.
+             * Abort the save_state.
+             */
+            SmcSaveYourselfDone (xsmp->connection, FALSE);
+            xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE;
+            break;
+
+        case XSMP_STATE_INTERACT_REQUEST:
+        case XSMP_STATE_INTERACT:
+        case XSMP_STATE_SHUTDOWN_CANCELLED:
+            /* Already in a shutdown-related state, just ignore
+             * the new shutdown request...
+             */
+            return TRUE;
+
+        case XSMP_STATE_IDLE:
+            if (xsmp->waiting_to_set_initial_properties)
+                sm_client_xsmp_set_initial_properties (xsmp);
+
+            if (!xsmp->expecting_initial_save_yourself)
+                break;
+            /* else fall through */
+
+        case XSMP_STATE_SAVE_YOURSELF_DONE:
+            /* We need to wait for some response from the server.*/
+            process_ice_messages (SmcGetIceConnection (xsmp->connection));
+            break;
+
+        default:
+            /* Hm... shouldn't happen */
+            return FALSE;
+        }
+    }
+
+    /* xfce4-session will do the wrong thing if we pass SmSaveGlobal and
+     * the user chooses to save the session. But mate-session will do
+     * the wrong thing if we pass SmSaveBoth and the user chooses NOT to
+     * save the session... Sigh.
+     */
+    if (!strcmp (SmcVendor (xsmp->connection), "xfce4-session"))
+        save_type = SmSaveBoth;
+    else
+        save_type = SmSaveGlobal;
+
+    g_debug ("Sending SaveYourselfRequest(SmSaveGlobal, Shutdown, SmInteractStyleAny, %sFast)", request_confirmation ? "!" : "");
+    SmcRequestSaveYourself (xsmp->connection,
+                            save_type,
+                            True, /* shutdown */
+                            SmInteractStyleAny,
+                            !request_confirmation, /* fast */
+                            True /* global */);
+    return TRUE;
+}
+
+static gboolean
+idle_do_pending_events (gpointer data)
+{
+    EggSMClientXSMP *xsmp = data;
+    EggSMClient *client = data;
+
+    xsmp->idle = 0;
+
+    if (xsmp->waiting_to_emit_quit)
+    {
+        xsmp->waiting_to_emit_quit = FALSE;
+        egg_sm_client_quit (client);
+        goto out;
+    }
+
+    if (xsmp->waiting_to_emit_quit_cancelled)
+    {
+        xsmp->waiting_to_emit_quit_cancelled = FALSE;
+        egg_sm_client_quit_cancelled (client);
+        xsmp->state = XSMP_STATE_IDLE;
+    }
+
+    if (xsmp->waiting_to_save_myself)
+    {
+        xsmp->waiting_to_save_myself = FALSE;
+        do_save_yourself (xsmp);
+    }
+
+out:
+    return FALSE;
+}
+
+static void
+update_pending_events (EggSMClientXSMP *xsmp)
+{
+    gboolean want_idle =
+        xsmp->waiting_to_emit_quit ||
+        xsmp->waiting_to_emit_quit_cancelled ||
+        xsmp->waiting_to_save_myself;
+
+    if (want_idle)
+    {
+        if (xsmp->idle == 0)
+            xsmp->idle = g_idle_add (idle_do_pending_events, xsmp);
+    }
+    else
+    {
+        if (xsmp->idle != 0)
+            g_source_remove (xsmp->idle);
+        xsmp->idle = 0;
+    }
+}
+
+static void
+fix_broken_state (EggSMClientXSMP *xsmp, const char *message,
+                  gboolean send_interact_done,
+                  gboolean send_save_yourself_done)
+{
+    g_warning ("Received XSMP %s message in state %s: client or server error",
+               message, EGG_SM_CLIENT_XSMP_STATE (xsmp));
+
+    /* Forget any pending SaveYourself plans we had */
+    xsmp->waiting_to_save_myself = FALSE;
+    update_pending_events (xsmp);
+
+    if (send_interact_done)
+        SmcInteractDone (xsmp->connection, False);
+    if (send_save_yourself_done)
+        SmcSaveYourselfDone (xsmp->connection, True);
+
+    xsmp->state = send_save_yourself_done ? XSMP_STATE_SAVE_YOURSELF_DONE : XSMP_STATE_IDLE;
+}
+
+/* SM callbacks */
+
+static void
+xsmp_save_yourself (SmcConn   smc_conn,
+                    SmPointer client_data,
+                    int       save_type,
+                    Bool      shutdown,
+                    int       interact_style,
+                    Bool      fast)
+{
+    EggSMClientXSMP *xsmp = client_data;
+    gboolean wants_quit_requested;
+
+    g_debug ("Received SaveYourself(%s, %s, %s, %s) in state %s",
+             save_type == SmSaveLocal ? "SmSaveLocal" :
+             save_type == SmSaveGlobal ? "SmSaveGlobal" : "SmSaveBoth",
+             shutdown ? "Shutdown" : "!Shutdown",
+             interact_style == SmInteractStyleAny ? "SmInteractStyleAny" :
+             interact_style == SmInteractStyleErrors ? "SmInteractStyleErrors" :
+             "SmInteractStyleNone", fast ? "Fast" : "!Fast",
+             EGG_SM_CLIENT_XSMP_STATE (xsmp));
+
+    if (xsmp->state != XSMP_STATE_IDLE &&
+            xsmp->state != XSMP_STATE_SHUTDOWN_CANCELLED)
+    {
+        fix_broken_state (xsmp, "SaveYourself", FALSE, TRUE);
+        return;
+    }
+
+    if (xsmp->waiting_to_set_initial_properties)
+        sm_client_xsmp_set_initial_properties (xsmp);
+
+    /* If this is the initial SaveYourself, ignore it; we've already set
+     * properties and there's no reason to actually save state too.
+     */
+    if (xsmp->expecting_initial_save_yourself)
+    {
+        xsmp->expecting_initial_save_yourself = FALSE;
+
+        if (save_type == SmSaveLocal &&
+                interact_style == SmInteractStyleNone &&
+                !shutdown && !fast)
+        {
+            g_debug ("Sending SaveYourselfDone(True) for initial SaveYourself");
+            SmcSaveYourselfDone (xsmp->connection, True);
+            /* As explained in the comment at the end of
+             * do_save_yourself(), SAVE_YOURSELF_DONE is the correct
+             * state here, not IDLE.
+             */
+            xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE;
+            return;
+        }
+        else
+            g_warning ("First SaveYourself was not the expected one!");
+    }
+
+    /* Even ignoring the "fast" flag completely, there are still 18
+     * different combinations of save_type, shutdown and interact_style.
+     * We interpret them as follows:
+     *
+     *   Type  Shutdown  Interact	 Interpretation
+     *     G      F       A/E/N  	 do nothing (1)
+     *     G      T         N    	 do nothing (1)*
+     *     G      T        A/E   	 quit_requested (2)
+     *    L/B     F       A/E/N  	 save_state (3)
+     *    L/B     T         N    	 save_state (3)*
+     *    L/B     T        A/E   	 quit_requested, then save_state (4)
+     *
+     *   1. Do nothing, because the SM asked us to do something
+     *      uninteresting (save open files, but then don't quit
+     *      afterward) or rude (save open files without asking the user
+     *      for confirmation).
+     *
+     *   2. Request interaction and then emit ::quit_requested. This
+     *      perhaps isn't quite correct for the SmInteractStyleErrors
+     *      case, but we don't care.
+     *
+     *   3. Emit ::save_state. The SmSaveBoth SaveYourselfs in these
+     *      rows essentially get demoted to SmSaveLocal, because their
+     *      Global halves correspond to "do nothing".
+     *
+     *   4. Request interaction, emit ::quit_requested, and then emit
+     *      ::save_state after interacting. This is the SmSaveBoth
+     *      equivalent of #2, but we also promote SmSaveLocal shutdown
+     *      SaveYourselfs to SmSaveBoth here, because we want to give
+     *      the user a chance to save open files before quitting.
+     *
+     * (* It would be nice if we could do something useful when the
+     * session manager sends a SaveYourself with shutdown True and
+     * SmInteractStyleNone. But we can't, so we just pretend it didn't
+     * even tell us it was shutting down. The docs for ::quit mention
+     * that it might not always be preceded by ::quit_requested.)
+     */
+
+    /* As an optimization, we don't actually request interaction and
+     * emit ::quit_requested if the application isn't listening to the
+     * signal.
+     */
+    wants_quit_requested = g_signal_has_handler_pending (xsmp, g_signal_lookup ("quit_requested", EGG_TYPE_SM_CLIENT), 0, FALSE);
+
+    xsmp->need_save_state     = (save_type != SmSaveGlobal);
+    xsmp->need_quit_requested = (shutdown && wants_quit_requested &&
+                                 interact_style != SmInteractStyleNone);
+    xsmp->interact_errors     = (interact_style == SmInteractStyleErrors);
+
+    xsmp->shutting_down       = shutdown;
+
+    do_save_yourself (xsmp);
+}
+
+static void
+do_save_yourself (EggSMClientXSMP *xsmp)
+{
+    if (xsmp->state == XSMP_STATE_SHUTDOWN_CANCELLED)
+    {
+        /* The SM cancelled a previous SaveYourself, but we haven't yet
+         * had a chance to tell the application, so we can't start
+         * processing this SaveYourself yet.
+         */
+        xsmp->waiting_to_save_myself = TRUE;
+        update_pending_events (xsmp);
+        return;
+    }
+
+    if (xsmp->need_quit_requested)
+    {
+        xsmp->state = XSMP_STATE_INTERACT_REQUEST;
+
+        g_debug ("Sending InteractRequest(%s)",
+                 xsmp->interact_errors ? "Error" : "Normal");
+        SmcInteractRequest (xsmp->connection,
+                            xsmp->interact_errors ? SmDialogError : SmDialogNormal,
+                            xsmp_interact,
+                            xsmp);
+        return;
+    }
+
+    if (xsmp->need_save_state)
+    {
+        save_state (xsmp);
+
+        /* Though unlikely, the client could have been disconnected
+         * while the application was saving its state.
+         */
+        if (!xsmp->connection)
+            return;
+    }
+
+    g_debug ("Sending SaveYourselfDone(True)");
+    SmcSaveYourselfDone (xsmp->connection, True);
+
+    /* The client state diagram in the XSMP spec says that after a
+     * non-shutdown SaveYourself, we go directly back to "idle". But
+     * everything else in both the XSMP spec and the libSM docs
+     * disagrees.
+     */
+    xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE;
+}
+
+static void
+save_state (EggSMClientXSMP *xsmp)
+{
+    GKeyFile *state_file;
+    char *state_file_path, *data;
+    EggDesktopFile *desktop_file;
+	GPtrArray *restart, *discard;
+    int offset, fd;
+
+    /* We set xsmp->state before emitting save_state, but our caller is
+     * responsible for setting it back afterward.
+     */
+    xsmp->state = XSMP_STATE_SAVE_YOURSELF;
+
+    state_file = egg_sm_client_save_state ((EggSMClient *)xsmp);
+    if (!state_file)
+    {
+        restart = generate_command (xsmp->restart_command, xsmp->client_id, NULL);
+        set_properties (xsmp,
+                        ptrarray_prop (SmRestartCommand, restart),
+                        NULL);
+        g_ptr_array_free (restart, TRUE);
+
+		if (xsmp->set_discard_command)
+		{
+			discard = generate_command (xsmp->discard_command, NULL, NULL);
+			set_properties (xsmp,
+			                ptrarray_prop (SmDiscardCommand, discard),
+			                NULL);
+			g_ptr_array_free (discard, TRUE);
+		}
+		else
+        delete_properties (xsmp, SmDiscardCommand, NULL);
+
+        return;
+    }
+
+    desktop_file = egg_get_desktop_file ();
+    if (desktop_file)
+    {
+        GKeyFile *merged_file;
+        char *desktop_file_path;
+
+        merged_file = g_key_file_new ();
+        desktop_file_path =
+            g_filename_from_uri (egg_desktop_file_get_source (desktop_file),
+                                 NULL, NULL);
+        if (desktop_file_path &&
+                g_key_file_load_from_file (merged_file, desktop_file_path,
+                                           G_KEY_FILE_KEEP_COMMENTS |
+                                           G_KEY_FILE_KEEP_TRANSLATIONS, NULL))
+        {
+            guint g, k, i;
+            char **groups, **keys, *value, *exec;
+
+            groups = g_key_file_get_groups (state_file, NULL);
+            for (g = 0; groups[g]; g++)
+            {
+                keys = g_key_file_get_keys (state_file, groups[g], NULL, NULL);
+                for (k = 0; keys[k]; k++)
+                {
+                    value = g_key_file_get_value (state_file, groups[g],
+                                                  keys[k], NULL);
+                    if (value)
+                    {
+                        g_key_file_set_value (merged_file, groups[g],
+                                              keys[k], value);
+                        g_free (value);
+                    }
+                }
+                g_strfreev (keys);
+            }
+            g_strfreev (groups);
+
+            g_key_file_free (state_file);
+            state_file = merged_file;
+
+            /* Update Exec key using "--sm-client-state-file %k" */
+            restart = generate_command (xsmp->restart_command,
+                                        NULL, "%k");
+            for (i = 0; i < restart->len; i++)
+                restart->pdata[i] = g_shell_quote (restart->pdata[i]);
+            g_ptr_array_add (restart, NULL);
+            exec = g_strjoinv (" ", (char **)restart->pdata);
+            g_strfreev ((char **)restart->pdata);
+            g_ptr_array_free (restart, FALSE);
+
+            g_key_file_set_string (state_file, EGG_DESKTOP_FILE_GROUP,
+                                   EGG_DESKTOP_FILE_KEY_EXEC,
+                                   exec);
+            g_free (exec);
+        }
+        else
+            desktop_file = NULL;
+
+        g_free (desktop_file_path);
+    }
+
+    /* Now write state_file to disk. (We can't use mktemp(), because
+     * that requires the filename to end with "XXXXXX", and we want
+     * it to end with ".desktop".)
+     */
+
+    data = g_key_file_to_data (state_file, NULL, NULL);
+    g_key_file_free (state_file);
+
+    offset = 0;
+    while (1)
+    {
+        state_file_path = g_strdup_printf ("%s%csession-state%c%s-%ld.%s",
+                                           g_get_user_config_dir (),
+                                           G_DIR_SEPARATOR, G_DIR_SEPARATOR,
+                                           g_get_prgname (),
+                                           (long)time (NULL) + offset,
+                                           desktop_file ? "desktop" : "state");
+
+        fd = open (state_file_path, O_WRONLY | O_CREAT | O_EXCL, 0644);
+        if (fd == -1)
+        {
+            if (errno == EEXIST)
+            {
+                offset++;
+                g_free (state_file_path);
+                continue;
+            }
+            else if (errno == ENOTDIR || errno == ENOENT)
+            {
+                char *sep = strrchr (state_file_path, G_DIR_SEPARATOR);
+
+                *sep = '\0';
+                if (g_mkdir_with_parents (state_file_path, 0755) != 0)
+                {
+                    g_warning ("Could not create directory '%s'",
+                               state_file_path);
+                    g_free (state_file_path);
+                    state_file_path = NULL;
+                    break;
+                }
+
+                continue;
+            }
+
+            g_warning ("Could not create file '%s': %s",
+                       state_file_path, g_strerror (errno));
+            g_free (state_file_path);
+            state_file_path = NULL;
+            break;
+        }
+
+        close (fd);
+        g_file_set_contents (state_file_path, data, -1, NULL);
+        break;
+    }
+    g_free (data);
+
+    restart = generate_command (xsmp->restart_command, xsmp->client_id,
+                                state_file_path);
+    set_properties (xsmp,
+                    ptrarray_prop (SmRestartCommand, restart),
+                    NULL);
+    g_ptr_array_free (restart, TRUE);
+
+    if (state_file_path)
+    {
+        set_properties (xsmp,
+                        array_prop (SmDiscardCommand,
+                                    "/bin/rm", "-rf", state_file_path,
+                                    NULL),
+                        NULL);
+        g_free (state_file_path);
+    }
+}
+
+static void
+xsmp_interact (SmcConn   smc_conn,
+               SmPointer client_data)
+{
+    EggSMClientXSMP *xsmp = client_data;
+    EggSMClient *client = client_data;
+
+    g_debug ("Received Interact message in state %s",
+             EGG_SM_CLIENT_XSMP_STATE (xsmp));
+
+    if (xsmp->state != XSMP_STATE_INTERACT_REQUEST)
+    {
+        fix_broken_state (xsmp, "Interact", TRUE, TRUE);
+        return;
+    }
+
+    xsmp->state = XSMP_STATE_INTERACT;
+    egg_sm_client_quit_requested (client);
+}
+
+static void
+xsmp_die (SmcConn   smc_conn,
+          SmPointer client_data)
+{
+    EggSMClientXSMP *xsmp = client_data;
+    EggSMClient *client = client_data;
+
+    g_debug ("Received Die message in state %s",
+             EGG_SM_CLIENT_XSMP_STATE (xsmp));
+
+    sm_client_xsmp_disconnect (xsmp);
+    egg_sm_client_quit (client);
+}
+
+static void
+xsmp_save_complete (SmcConn   smc_conn,
+                    SmPointer client_data)
+{
+    EggSMClientXSMP *xsmp = client_data;
+
+    g_debug ("Received SaveComplete message in state %s",
+             EGG_SM_CLIENT_XSMP_STATE (xsmp));
+
+    if (xsmp->state == XSMP_STATE_SAVE_YOURSELF_DONE)
+        xsmp->state = XSMP_STATE_IDLE;
+    else
+        fix_broken_state (xsmp, "SaveComplete", FALSE, FALSE);
+}
+
+static void
+xsmp_shutdown_cancelled (SmcConn   smc_conn,
+                         SmPointer client_data)
+{
+    EggSMClientXSMP *xsmp = client_data;
+    EggSMClient *client = client_data;
+
+    g_debug ("Received ShutdownCancelled message in state %s",
+             EGG_SM_CLIENT_XSMP_STATE (xsmp));
+
+    xsmp->shutting_down = FALSE;
+
+    if (xsmp->state == XSMP_STATE_SAVE_YOURSELF_DONE)
+    {
+        /* We've finished interacting and now the SM has agreed to
+         * cancel the shutdown.
+         */
+        xsmp->state = XSMP_STATE_IDLE;
+        egg_sm_client_quit_cancelled (client);
+    }
+    else if (xsmp->state == XSMP_STATE_SHUTDOWN_CANCELLED)
+    {
+        /* Hm... ok, so we got a shutdown SaveYourself, which got
+         * cancelled, but the application was still interacting, so we
+         * didn't tell it yet, and then *another* SaveYourself arrived,
+         * which we must still be waiting to tell the app about, except
+         * that now that SaveYourself has been cancelled too! Dizzy yet?
+         */
+        xsmp->waiting_to_save_myself = FALSE;
+        update_pending_events (xsmp);
+    }
+    else
+    {
+        g_debug ("Sending SaveYourselfDone(False)");
+        SmcSaveYourselfDone (xsmp->connection, False);
+
+        if (xsmp->state == XSMP_STATE_INTERACT)
+        {
+            /* The application is currently interacting, so we can't
+             * tell it about the cancellation yet; we will wait until
+             * after it calls egg_sm_client_will_quit().
+             */
+            xsmp->state = XSMP_STATE_SHUTDOWN_CANCELLED;
+        }
+        else
+        {
+            /* The shutdown was cancelled before the application got a
+             * chance to interact.
+             */
+            xsmp->state = XSMP_STATE_IDLE;
+        }
+    }
+}
+
+/* Utilities */
+
+/* Create a restart/clone/Exec command based on @restart_command.
+ * If @client_id is non-%NULL, add "--sm-client-id @client_id".
+ * If @state_file is non-%NULL, add "--sm-client-state-file @state_file".
+ *
+ * None of the input strings are g_strdup()ed; the caller must keep
+ * them around until it is done with the returned GPtrArray, and must
+ * then free the array, but not its contents.
+ */
+static GPtrArray *
+generate_command (char **restart_command, const char *client_id,
+                  const char *state_file)
+{
+    GPtrArray *cmd;
+    int i;
+
+    cmd = g_ptr_array_new ();
+    g_ptr_array_add (cmd, restart_command[0]);
+
+    if (client_id)
+    {
+        g_ptr_array_add (cmd, (char *)"--sm-client-id");
+        g_ptr_array_add (cmd, (char *)client_id);
+    }
+
+    if (state_file)
+    {
+        g_ptr_array_add (cmd, (char *)"--sm-client-state-file");
+        g_ptr_array_add (cmd, (char *)state_file);
+    }
+
+    for (i = 1; restart_command[i]; i++)
+        g_ptr_array_add (cmd, restart_command[i]);
+
+    return cmd;
+}
+
+/* Takes a NULL-terminated list of SmProp * values, created by
+ * array_prop, ptrarray_prop, string_prop, card8_prop, sets them, and
+ * frees them.
+ */
+static void
+set_properties (EggSMClientXSMP *xsmp, ...)
+{
+    GPtrArray *props;
+    SmProp *prop;
+    va_list ap;
+    guint i;
+
+    props = g_ptr_array_new ();
+
+    va_start (ap, xsmp);
+    while ((prop = va_arg (ap, SmProp *)))
+        g_ptr_array_add (props, prop);
+    va_end (ap);
+
+    if (xsmp->connection)
+    {
+        SmcSetProperties (xsmp->connection, props->len,
+                          (SmProp **)props->pdata);
+    }
+
+    for (i = 0; i < props->len; i++)
+    {
+        prop = props->pdata[i];
+        g_free (prop->vals);
+        g_free (prop);
+    }
+    g_ptr_array_free (props, TRUE);
+}
+
+/* Takes a NULL-terminated list of property names and deletes them. */
+static void
+delete_properties (EggSMClientXSMP *xsmp, ...)
+{
+    GPtrArray *props;
+    char *prop;
+    va_list ap;
+
+    if (!xsmp->connection)
+        return;
+
+    props = g_ptr_array_new ();
+
+    va_start (ap, xsmp);
+    while ((prop = va_arg (ap, char *)))
+        g_ptr_array_add (props, prop);
+    va_end (ap);
+
+    SmcDeleteProperties (xsmp->connection, props->len,
+                         (char **)props->pdata);
+
+    g_ptr_array_free (props, TRUE);
+}
+
+/* Takes an array of strings and creates a LISTofARRAY8 property. The
+ * strings are neither dupped nor freed; they need to remain valid
+ * until you're done with the SmProp.
+ */
+static SmProp *
+array_prop (const char *name, ...)
+{
+    SmProp *prop;
+    SmPropValue pv;
+    GArray *vals;
+    char *value;
+    va_list ap;
+
+    prop = g_new (SmProp, 1);
+    prop->name = (char *)name;
+    prop->type = (char *)SmLISTofARRAY8;
+
+    vals = g_array_new (FALSE, FALSE, sizeof (SmPropValue));
+
+    va_start (ap, name);
+    while ((value = va_arg (ap, char *)))
+    {
+        pv.length = strlen (value);
+        pv.value = value;
+        g_array_append_val (vals, pv);
+    }
+    va_end (ap);
+
+    prop->num_vals = vals->len;
+    prop->vals = (SmPropValue *)vals->data;
+
+    g_array_free (vals, FALSE);
+
+    return prop;
+}
+
+/* Takes a GPtrArray of strings and creates a LISTofARRAY8 property.
+ * The array contents are neither dupped nor freed; they need to
+ * remain valid until you're done with the SmProp.
+ */
+static SmProp *
+ptrarray_prop (const char *name, GPtrArray *values)
+{
+    SmProp *prop;
+    SmPropValue pv;
+    GArray *vals;
+    guint i;
+
+    prop = g_new (SmProp, 1);
+    prop->name = (char *)name;
+    prop->type = (char *)SmLISTofARRAY8;
+
+    vals = g_array_new (FALSE, FALSE, sizeof (SmPropValue));
+
+    for (i = 0; i < values->len; i++)
+    {
+        pv.length = strlen (values->pdata[i]);
+        pv.value = values->pdata[i];
+        g_array_append_val (vals, pv);
+    }
+
+    prop->num_vals = vals->len;
+    prop->vals = (SmPropValue *)vals->data;
+
+    g_array_free (vals, FALSE);
+
+    return prop;
+}
+
+/* Takes a string and creates an ARRAY8 property. The string is
+ * neither dupped nor freed; it needs to remain valid until you're
+ * done with the SmProp.
+ */
+static SmProp *
+string_prop (const char *name, const char *value)
+{
+    SmProp *prop;
+
+    prop = g_new (SmProp, 1);
+    prop->name = (char *)name;
+    prop->type = (char *)SmARRAY8;
+
+    prop->num_vals = 1;
+    prop->vals = g_new (SmPropValue, 1);
+
+    prop->vals[0].length = strlen (value);
+    prop->vals[0].value = (char *)value;
+
+    return prop;
+}
+
+/* Takes a char and creates a CARD8 property. */
+static SmProp *
+card8_prop (const char *name, unsigned char value)
+{
+    SmProp *prop;
+    char *card8val;
+
+    /* To avoid having to allocate and free prop->vals[0], we cheat and
+     * make vals a 2-element-long array and then use the second element
+     * to store value.
+     */
+
+    prop = g_new (SmProp, 1);
+    prop->name = (char *)name;
+    prop->type = (char *)SmCARD8;
+
+    prop->num_vals = 1;
+    prop->vals = g_new (SmPropValue, 2);
+    card8val = (char *)(&prop->vals[1]);
+    card8val[0] = value;
+
+    prop->vals[0].length = 1;
+    prop->vals[0].value = card8val;
+
+    return prop;
+}
+
+/* ICE code. This makes no effort to play nice with anyone else trying
+ * to use libICE. Fortunately, no one uses libICE for anything other
+ * than SM. (DCOP uses ICE, but it has its own private copy of
+ * libICE.)
+ *
+ * When this moves to gtk, it will need to be cleverer, to avoid
+ * tripping over old apps that use MateClient or that use libSM
+ * directly.
+ */
+
+#include <X11/ICE/ICElib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <fcntl.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+static void        ice_error_handler    (IceConn        ice_conn,
+        Bool           swap,
+        int            offending_minor_opcode,
+        unsigned long  offending_sequence,
+        int            error_class,
+        int            severity,
+        IcePointer     values);
+static void        ice_io_error_handler (IceConn        ice_conn);
+static void        ice_connection_watch (IceConn        ice_conn,
+        IcePointer     client_data,
+        Bool           opening,
+        IcePointer    *watch_data);
+
+static void
+ice_init (void)
+{
+    IceSetIOErrorHandler (ice_io_error_handler);
+    IceSetErrorHandler (ice_error_handler);
+    IceAddConnectionWatch (ice_connection_watch, NULL);
+}
+
+static gboolean
+process_ice_messages (IceConn ice_conn)
+{
+    IceProcessMessagesStatus status;
+    status = IceProcessMessages (ice_conn, NULL, NULL);
+
+    switch (status)
+    {
+    case IceProcessMessagesSuccess:
+        return TRUE;
+
+    case IceProcessMessagesIOError:
+        sm_client_xsmp_disconnect (IceGetConnectionContext (ice_conn));
+        return FALSE;
+
+    case IceProcessMessagesConnectionClosed:
+        return FALSE;
+
+    default:
+        g_assert_not_reached ();
+    }
+}
+
+static gboolean
+ice_iochannel_watch (GIOChannel   *channel,
+                     GIOCondition  condition,
+                     gpointer      client_data)
+{
+    return process_ice_messages (client_data);
+}
+
+static void
+ice_connection_watch (IceConn     ice_conn,
+                      IcePointer  client_data,
+                      Bool        opening,
+                      IcePointer *watch_data)
+{
+    guint watch_id;
+
+    if (opening)
+    {
+        GIOChannel *channel;
+        int fd = IceConnectionNumber (ice_conn);
+
+        fcntl (fd, F_SETFD, fcntl (fd, F_GETFD, 0) | FD_CLOEXEC);
+        channel = g_io_channel_unix_new (fd);
+        watch_id = g_io_add_watch (channel, G_IO_IN | G_IO_ERR,
+                                   ice_iochannel_watch, ice_conn);
+        g_io_channel_unref (channel);
+
+        *watch_data = GUINT_TO_POINTER (watch_id);
+    }
+    else
+    {
+        watch_id = GPOINTER_TO_UINT (*watch_data);
+        g_source_remove (watch_id);
+    }
+}
+
+static void
+ice_error_handler (IceConn       ice_conn,
+                   Bool          swap,
+                   int           offending_minor_opcode,
+                   unsigned long offending_sequence,
+                   int           error_class,
+                   int           severity,
+                   IcePointer    values)
+{
+    /* Do nothing */
+}
+
+static void
+ice_io_error_handler (IceConn ice_conn)
+{
+    /* Do nothing */
+}
+
+static void
+smc_error_handler (SmcConn       smc_conn,
+                   Bool          swap,
+                   int           offending_minor_opcode,
+                   unsigned long offending_sequence,
+                   int           error_class,
+                   int           severity,
+                   SmPointer     values)
+{
+    /* Do nothing */
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/50.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/50.html new file mode 100644 index 0000000..0fdee23 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/50.html @@ -0,0 +1,5303 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+1545
+1546
+1547
+1548
+1549
+1550
+1551
+1552
+1553
+1554
+1555
+1556
+1557
+1558
+1559
+1560
+1561
+1562
+1563
+1564
+1565
+1566
+1567
+1568
+1569
+1570
+1571
+1572
+1573
+1574
+1575
+1576
+1577
+1578
+1579
+1580
+1581
+1582
+1583
+1584
+1585
+1586
+1587
+1588
+1589
+1590
+1591
+1592
+1593
+1594
+1595
+1596
+1597
+1598
+1599
+1600
+1601
+1602
+1603
+1604
+1605
+1606
+1607
+1608
+1609
+1610
+1611
+1612
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+1631
+1632
+1633
+1634
+1635
+1636
+1637
+1638
+1639
+1640
+1641
+1642
+1643
+1644
+1645
+1646
+1647
+1648
+1649
+1650
+1651
+1652
+1653
+1654
+1655
+1656
+1657
+1658
+1659
+1660
+1661
+1662
+1663
+1664
+1665
+1666
+1667
+1668
+1669
+1670
+1671
+1672
+1673
+1674
+1675
+1676
+1677
+1678
+1679
+1680
+1681
+1682
+1683
+1684
+1685
+1686
+1687
+1688
+1689
+1690
+1691
+1692
+1693
+1694
+1695
+1696
+1697
+1698
+1699
+1700
+1701
+1702
+1703
+1704
+1705
+1706
+1707
+1708
+1709
+1710
+1711
+1712
+1713
+1714
+1715
+1716
+1717
+1718
+1719
+1720
+1721
+1722
+1723
+1724
+1725
+1726
+1727
+1728
+1729
+1730
+1731
+1732
+1733
+1734
+1735
+1736
+1737
+1738
+1739
+1740
+1741
+1742
+1743
+1744
+1745
+1746
+1747
+1748
+1749
+1750
+1751
+1752
+1753
+1754
+1755
+1756
+1757
+1758
+1759
+1760
+1761
+1762
+1763
+1764
+1765
+1766
+1767
+1768
+1769
+1770
+1771
+1772
+1773
+1774
+1775
+1776
+1777
+1778
+1779
+1780
+1781
+1782
+1783
+1784
+1785
+1786
+1787
+1788
+1789
+1790
+1791
+1792
+1793
+1794
+1795
+1796
+1797
+1798
+1799
+1800
+1801
+1802
+1803
+1804
+1805
+1806
+1807
+1808
+1809
+1810
+1811
+1812
+1813
+1814
+1815
+1816
+1817
+1818
+1819
+1820
+1821
+1822
+1823
+1824
+1825
+1826
+1827
+1828
+1829
+1830
+1831
+1832
+1833
+1834
+1835
+1836
+1837
+1838
+1839
+1840
+1841
+1842
+1843
+1844
+1845
+1846
+1847
+1848
+1849
+1850
+1851
+1852
+1853
+1854
+1855
+1856
+1857
+1858
+1859
+1860
+1861
+1862
+1863
+1864
+1865
+1866
+1867
+1868
+1869
+1870
+1871
+1872
+1873
+1874
+1875
+1876
+1877
+1878
+1879
+1880
+1881
+1882
+1883
+1884
+1885
+1886
+1887
+1888
+1889
+1890
+1891
+1892
+1893
+1894
+1895
+1896
+1897
+1898
+1899
+1900
+1901
+1902
+1903
+1904
+1905
+1906
+1907
+1908
+1909
+1910
+1911
+1912
+1913
+1914
+1915
+1916
+1917
+1918
+1919
+1920
+1921
+1922
+1923
+1924
+1925
+1926
+1927
+1928
+1929
+1930
+1931
+1932
+1933
+1934
+1935
+1936
+1937
+1938
+1939
+1940
+1941
+1942
+1943
+1944
+1945
+1946
+1947
+1948
+1949
+1950
+1951
+1952
+1953
+1954
+1955
+1956
+1957
+1958
+1959
+1960
+1961
+1962
+1963
+1964
+1965
+1966
+1967
+1968
+1969
+1970
+1971
+1972
+1973
+1974
+1975
+1976
+1977
+1978
+1979
+1980
+1981
+1982
+1983
+1984
+1985
+1986
+1987
+1988
+1989
+1990
+1991
+1992
+1993
+1994
+1995
+1996
+1997
+1998
+1999
+2000
+2001
+2002
+2003
+2004
+2005
+2006
+2007
+2008
+2009
+2010
+2011
+2012
+2013
+2014
+2015
+2016
+2017
+2018
+2019
+2020
+2021
+2022
+2023
+2024
+2025
+2026
+2027
+2028
+2029
+2030
+2031
+2032
+2033
+2034
+2035
+2036
+2037
+2038
+2039
+2040
+2041
+2042
+2043
+2044
+2045
+2046
+2047
+2048
+2049
+2050
+2051
+2052
+2053
+2054
+2055
+2056
+2057
+2058
+2059
+2060
+2061
+2062
+2063
+2064
+2065
+2066
+2067
+2068
+2069
+2070
+2071
+2072
+2073
+2074
+2075
+2076
+2077
+2078
+2079
+2080
+2081
+2082
+2083
+2084
+2085
+2086
+2087
+2088
+2089
+2090
+2091
+2092
+2093
+2094
+2095
+2096
+2097
+2098
+2099
+2100
+2101
+2102
+2103
+2104
+2105
+2106
+2107
+2108
+2109
+2110
+2111
+2112
+2113
+2114
+2115
+2116
+2117
+2118
+2119
+2120
+2121
+2122
+2123
+2124
+2125
+2126
+2127
+2128
+2129
+2130
+2131
+2132
+2133
+2134
+2135
+2136
+2137
+2138
+2139
+2140
+2141
+2142
+2143
+2144
+2145
+2146
+2147
+2148
+2149
+2150
+2151
+2152
+2153
+2154
+2155
+2156
+2157
+2158
+2159
+2160
+2161
+2162
+2163
+2164
+2165
+2166
+2167
+2168
+2169
+2170
+2171
+2172
+2173
+2174
+2175
+2176
+2177
+2178
+2179
+2180
+2181
+2182
+2183
+2184
+2185
+2186
+2187
+2188
+2189
+2190
+2191
+2192
+2193
+2194
+2195
+2196
+2197
+2198
+2199
+2200
+2201
+2202
+2203
+2204
+2205
+2206
+2207
+2208
+2209
+2210
+2211
+2212
+2213
+2214
+2215
+2216
+2217
+2218
+2219
+2220
+2221
+2222
+2223
+2224
+2225
+2226
+2227
+2228
+2229
+2230
+2231
+2232
+2233
+2234
+2235
+2236
+2237
+2238
+2239
+2240
+2241
+2242
+2243
+2244
+2245
+2246
+2247
+2248
+2249
+2250
+2251
+2252
+2253
+2254
+2255
+2256
+2257
+2258
+2259
+2260
+2261
+2262
+2263
+2264
+2265
+2266
+2267
+2268
+2269
+2270
+2271
+2272
+2273
+2274
+2275
+2276
+2277
+2278
+2279
+2280
+2281
+2282
+2283
+2284
+2285
+2286
+2287
+2288
+2289
+2290
+2291
+2292
+2293
+2294
+2295
+2296
+2297
+2298
+2299
+2300
+2301
+2302
+2303
+2304
+2305
+2306
+2307
+2308
+2309
+2310
+2311
+2312
+2313
+2314
+2315
+2316
+2317
+2318
+2319
+2320
+2321
+2322
+2323
+2324
+2325
+2326
+2327
+2328
+2329
+2330
+2331
+2332
+2333
+2334
+2335
+2336
+2337
+2338
+2339
+2340
+2341
+2342
+2343
+2344
+2345
+2346
+2347
+2348
+2349
+2350
+2351
+2352
+2353
+2354
+2355
+2356
+2357
+2358
+2359
+2360
+2361
+2362
+2363
+2364
+2365
+2366
+2367
+2368
+2369
+2370
+2371
+2372
+2373
+2374
+2375
+2376
+2377
+2378
+2379
+2380
+2381
+2382
+2383
+2384
+2385
+2386
+2387
+2388
+2389
+2390
+2391
+2392
+2393
+2394
+2395
+2396
+2397
+2398
+2399
+2400
+2401
+2402
+2403
+2404
+2405
+2406
+2407
+2408
+2409
+2410
+2411
+2412
+2413
+2414
+2415
+2416
+2417
+2418
+2419
+2420
+2421
+2422
+2423
+2424
+2425
+2426
+2427
+2428
+2429
+2430
+2431
+2432
+2433
+2434
+2435
+2436
+2437
+2438
+2439
+2440
+2441
+2442
+2443
+2444
+2445
+2446
+2447
+2448
+2449
+2450
+2451
+2452
+2453
+2454
+2455
+2456
+2457
+2458
+2459
+2460
+2461
+2462
+2463
+2464
+2465
+2466
+2467
+2468
+2469
+2470
+2471
+2472
+2473
+2474
+2475
+2476
+2477
+2478
+2479
+2480
+2481
+2482
+2483
+2484
+2485
+2486
+2487
+2488
+2489
+2490
+2491
+2492
+2493
+2494
+2495
+2496
+2497
+2498
+2499
+2500
+2501
+2502
+2503
+2504
+2505
+2506
+2507
+2508
+2509
+2510
+2511
+2512
+2513
+2514
+2515
+2516
+2517
+2518
+2519
+2520
+2521
+2522
+2523
+2524
+2525
+2526
+2527
+2528
+2529
+2530
+2531
+2532
+2533
/*
+ * Copyright © 2001 Havoc Pennington
+ * Copyright © 2007, 2008, 2010 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * Mate-terminal 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/wait.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkkeysyms.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gdk/gdk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk-pixbuf/gdk-pixbuf.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <cairo.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-accels.h"
+#include "terminal-app.h"
+#include "terminal-debug.h"
+#include "terminal-intl.h"
+#include "terminal-marshal.h"
+#include "terminal-profile.h"
+#include "terminal-screen-container.h"
+#include "terminal-util.h"
+#include "terminal-window.h"
+#include "terminal-info-bar.h"
+
+#include "eggshell.h"
+
+#define PCRE2_CODE_UNIT_WIDTH 0
+#include <pcre2.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define URL_MATCH_CURSOR  (GDK_HAND2)
+#define SKEY_MATCH_CURSOR (GDK_HAND2)
+
+typedef struct
+{
+	int tag;
+	TerminalURLFlavor flavor;
+} TagData;
+
+struct _TerminalScreenPrivate
+{
+	TerminalProfile *profile; /* may be NULL at times */
+	guint profile_changed_id;
+	guint profile_forgotten_id;
+	char *raw_title, *raw_icon_title;
+	char *cooked_title, *cooked_icon_title;
+	char *override_title;
+	gboolean icon_title_set;
+	char *initial_working_directory;
+	char **initial_env;
+	char **override_command;
+	int child_pid;
+	double font_scale;
+	gboolean user_title; /* title was manually set */
+	GSList *match_tags;
+	guint launch_child_source_id;
+	gulong bg_image_callback_id;
+	GdkPixbuf *bg_image;
+};
+
+enum
+{
+    PROFILE_SET,
+    SHOW_POPUP_MENU,
+    MATCH_CLICKED,
+    CLOSE_SCREEN,
+    LAST_SIGNAL
+};
+
+enum
+{
+    PROP_0,
+    PROP_PROFILE,
+    PROP_ICON_TITLE,
+    PROP_ICON_TITLE_SET,
+    PROP_OVERRIDE_COMMAND,
+    PROP_TITLE,
+    PROP_INITIAL_ENVIRONMENT
+};
+
+enum
+{
+    TARGET_COLOR,
+    TARGET_BGIMAGE,
+    TARGET_RESET_BG,
+    TARGET_MOZ_URL,
+    TARGET_NETSCAPE_URL,
+    TARGET_TAB
+};
+
+static void terminal_screen_dispose     (GObject             *object);
+static void terminal_screen_finalize    (GObject             *object);
+static void terminal_screen_drag_data_received (GtkWidget        *widget,
+        GdkDragContext   *context,
+        gint              x,
+        gint              y,
+        GtkSelectionData *selection_data,
+        guint             info,
+        guint             time);
+static void terminal_screen_system_font_notify_cb (TerminalApp *app,
+        GParamSpec *pspec,
+        TerminalScreen *screen);
+static void terminal_screen_change_font (TerminalScreen *screen);
+static gboolean terminal_screen_popup_menu (GtkWidget *widget);
+static gboolean terminal_screen_button_press (GtkWidget *widget,
+        GdkEventButton *event);
+static void terminal_screen_hierarchy_changed (GtkWidget *widget,
+        GtkWidget *previous_toplevel);
+static void terminal_screen_launch_child_on_idle (TerminalScreen *screen);
+static void terminal_screen_child_exited (VteTerminal *terminal, int status);
+
+static void terminal_screen_window_title_changed      (VteTerminal *vte_terminal,
+        TerminalScreen *screen);
+static void terminal_screen_icon_title_changed        (VteTerminal *vte_terminal,
+        TerminalScreen *screen);
+
+static void update_color_scheme                      (TerminalScreen *screen);
+
+static char* terminal_screen_check_hyperlink (TerminalScreen *screen,
+        GdkEvent *event);
+
+static gboolean terminal_screen_format_title (TerminalScreen *screen, const char *raw_title, char **old_cooked_title);
+
+static void terminal_screen_cook_title      (TerminalScreen *screen);
+static void terminal_screen_cook_icon_title (TerminalScreen *screen);
+
+static char* terminal_screen_check_match       (TerminalScreen            *screen,
+        GdkEvent             *event,
+        int                  *flavor);
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+#define USERCHARS "-[:alnum:]"
+#define USERCHARS_CLASS "[" USERCHARS "]"
+#define PASSCHARS_CLASS "[-[:alnum:]\\Q,?;.:/!%$^*&~\"#'\\E]"
+#define HOSTCHARS_CLASS "[-[:alnum:]]"
+#define HOST HOSTCHARS_CLASS "+(\\." HOSTCHARS_CLASS "+)*"
+#define PORT "(?:\\:[[:digit:]]{1,5})?"
+#define PATHCHARS_CLASS "[-[:alnum:]\\Q_$.+!*,:;@&=?/~#%\\E]"
+#define PATHTERM_CLASS "[^\\Q]'.:}>) \t\r\n,\"\\E]"
+#define SCHEME "(?:news:|telnet:|nntp:|file:\\/|https?:|ftps?:|sftp:|webcal:)"
+#define USERPASS USERCHARS_CLASS "+(?:" PASSCHARS_CLASS "+)?"
+#define URLPATH   "(?:(/"PATHCHARS_CLASS"+(?:[(]"PATHCHARS_CLASS"*[)])*"PATHCHARS_CLASS"*)*"PATHTERM_CLASS")?"
+
+typedef struct
+{
+	const char *pattern;
+	TerminalURLFlavor flavor;
+	guint32 flags;
+} TerminalRegexPattern;
+
+static const TerminalRegexPattern url_regex_patterns[] =
+{
+	{ SCHEME "//(?:" USERPASS "\\@)?" HOST PORT URLPATH, FLAVOR_AS_IS, PCRE2_CASELESS },
+	{ "(?:www|ftp)" HOSTCHARS_CLASS "*\\." HOST PORT URLPATH , FLAVOR_DEFAULT_TO_HTTP, PCRE2_CASELESS  },
+	{ "(?:callto:|h323:|sip:)" USERCHARS_CLASS "[" USERCHARS ".]*(?:" PORT "/[a-z0-9]+)?\\@" HOST, FLAVOR_VOIP_CALL, PCRE2_CASELESS  },
+	{ "(?:mailto:)?" USERCHARS_CLASS "[" USERCHARS ".]*\\@" HOSTCHARS_CLASS "+\\." HOST, FLAVOR_EMAIL, PCRE2_CASELESS  },
+	{ "news:[[:alnum:]\\Q^_{|}~!\"#$%&'()*+,./;:=?`\\E]+", FLAVOR_AS_IS, PCRE2_CASELESS  },
+};
+
+static VteRegex **url_regexes;
+static TerminalURLFlavor *url_regex_flavors;
+static guint n_url_regexes;
+
+static void terminal_screen_url_match_remove (TerminalScreen *screen);
+
+#ifdef ENABLE_SKEY
+static const TerminalRegexPattern skey_regex_patterns[] =
+{
+	{ "s/key [[:digit:]]* [-[:alnum:]]*",         FLAVOR_AS_IS, 0 },
+	{ "otp-[a-z0-9]* [[:digit:]]* [-[:alnum:]]*", FLAVOR_AS_IS, 0 },
+};
+
+static VteRegex **skey_regexes;
+static guint n_skey_regexes;
+
+static void  terminal_screen_skey_match_remove (TerminalScreen            *screen);
+#endif /* ENABLE_SKEY */
+
+G_DEFINE_TYPE_WITH_PRIVATE (TerminalScreen, terminal_screen, VTE_TYPE_TERMINAL)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
+
+static char *
+cwd_of_pid (int pid)
+{
+	static const char patterns[][18] =
+	{
+		"/proc/%d/cwd",         /* Linux */
+		"/proc/%d/path/cwd",    /* Solaris >= 10 */
+	};
+	guint i;
+
+	if (pid == -1)
+		return NULL;
+
+	/* Try to get the working directory using various OS-specific mechanisms */
+	for (i = 0; i < G_N_ELEMENTS (patterns); ++i)
+	{
+		char cwd_file[64];
+		char buf[PATH_MAX + 1];
+		int len;
+
+		g_snprintf (cwd_file, sizeof (cwd_file), patterns[i], pid);
+		len = readlink (cwd_file, buf, sizeof (buf) - 1);
+
+		if (len > 0 && buf[0] == '/')
+			return g_strndup (buf, len);
+
+		/* If that didn't do it, try this hack */
+		if (len <= 0)
+		{
+			char *cwd, *working_dir = NULL;
+
+			cwd = g_get_current_dir ();
+			if (cwd != NULL)
+			{
+				/* On Solaris, readlink returns an empty string, but the
+				 * link can be used as a directory, including as a target
+				 * of chdir().
+				 */
+				if (chdir (cwd_file) == 0)
+				{
+					working_dir = g_get_current_dir ();
+					if (chdir (cwd) < 0)
+						g_warning ("Could not change working directory.");
+				}
+				g_free (cwd);
+			}
+
+			if (working_dir)
+				return working_dir;
+		}
+	}
+
+	return NULL;
+}
+
+static void
+free_tag_data (TagData *tagdata)
+{
+	g_slice_free (TagData, tagdata);
+}
+
+static void
+terminal_screen_class_enable_menu_bar_accel_notify_cb (TerminalApp *app,
+        GParamSpec *pspec,
+        TerminalScreenClass *klass)
+{
+	static gboolean is_enabled = TRUE; /* the binding is enabled by default since GtkWidgetClass installs it */
+	gboolean enable;
+	GtkBindingSet *binding_set;
+
+	g_object_get (app, TERMINAL_APP_ENABLE_MENU_BAR_ACCEL, &enable, NULL);
+
+	/* Only remove the 'skip' entry when we have added it previously! */
+	if (enable == is_enabled)
+		return;
+
+	is_enabled = enable;
+
+	binding_set = gtk_binding_set_by_class (klass);
+	if (enable)
+		gtk_binding_entry_remove (binding_set, GDK_KEY_F10, GDK_SHIFT_MASK);
+	else
+		gtk_binding_entry_skip (binding_set, GDK_KEY_F10, GDK_SHIFT_MASK);
+}
+
+static TerminalWindow *
+terminal_screen_get_window (TerminalScreen *screen)
+{
+	GtkWidget *widget = GTK_WIDGET (screen);
+	GtkWidget *toplevel;
+
+	toplevel = gtk_widget_get_toplevel (widget);
+	if (!gtk_widget_is_toplevel (toplevel))
+		return NULL;
+
+	return TERMINAL_WINDOW (toplevel);
+}
+
+static void
+terminal_screen_realize (GtkWidget *widget)
+{
+    TerminalScreen *screen = TERMINAL_SCREEN (widget);
+
+    GTK_WIDGET_CLASS (terminal_screen_parent_class)->realize (widget);
+
+    terminal_screen_set_font (screen);
+}
+
+static void
+terminal_screen_style_updated (GtkWidget *widget)
+{
+    TerminalScreen *screen = TERMINAL_SCREEN (widget);
+
+    GTK_WIDGET_CLASS (terminal_screen_parent_class)->style_updated (widget);
+
+    update_color_scheme (screen);
+
+    if (gtk_widget_get_realized (widget))
+      terminal_screen_change_font (screen);
+}
+
+#ifdef MATE_ENABLE_DEBUG
+static void
+size_allocate (GtkWidget *widget,
+               GtkAllocation *allocation)
+{
+	_terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+	                       "[screen %p] size-alloc   %d : %d at (%d, %d)\n",
+	                       widget, allocation->width, allocation->height, allocation->x, allocation->y);
+}
+#endif
+
+static void
+terminal_screen_init (TerminalScreen *screen)
+{
+	const GtkTargetEntry target_table[] =
+	{
+		{ "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP, TARGET_TAB },
+		{ "application/x-color", 0, TARGET_COLOR },
+		{ "property/bgimage",    0, TARGET_BGIMAGE },
+		{ "x-special/mate-reset-background", 0, TARGET_RESET_BG },
+		{ "text/x-moz-url",  0, TARGET_MOZ_URL },
+		{ "_NETSCAPE_URL", 0, TARGET_NETSCAPE_URL }
+	};
+	TerminalScreenPrivate *priv;
+	GtkTargetList *target_list;
+	GtkTargetEntry *targets;
+	int n_targets;
+
+	priv = screen->priv = terminal_screen_get_instance_private (screen);
+
+	vte_terminal_set_mouse_autohide (VTE_TERMINAL (screen), TRUE);
+#if VTE_CHECK_VERSION (0, 52, 0)
+	vte_terminal_set_bold_is_bright (VTE_TERMINAL (screen), TRUE);
+#endif
+
+	vte_terminal_set_allow_hyperlink (VTE_TERMINAL (screen), TRUE);
+
+	priv->child_pid = -1;
+
+	priv->font_scale = PANGO_SCALE_MEDIUM;
+
+	/* Setup DND */
+	target_list = gtk_target_list_new (NULL, 0);
+	gtk_target_list_add_uri_targets (target_list, 0);
+	gtk_target_list_add_text_targets (target_list, 0);
+	gtk_target_list_add_table (target_list, target_table, G_N_ELEMENTS (target_table));
+
+	targets = gtk_target_table_new_from_list (target_list, &n_targets);
+
+	gtk_drag_dest_set (GTK_WIDGET (screen),
+	                   GTK_DEST_DEFAULT_MOTION |
+	                   GTK_DEST_DEFAULT_HIGHLIGHT |
+	                   GTK_DEST_DEFAULT_DROP,
+	                   targets, n_targets,
+	                   GDK_ACTION_COPY | GDK_ACTION_MOVE);
+
+	gtk_target_table_free (targets, n_targets);
+	gtk_target_list_unref (target_list);
+
+	priv->override_title = NULL;
+	priv->user_title = FALSE;
+
+	g_signal_connect (screen, "window-title-changed",
+	                  G_CALLBACK (terminal_screen_window_title_changed),
+	                  screen);
+	g_signal_connect (screen, "icon-title-changed",
+	                  G_CALLBACK (terminal_screen_icon_title_changed),
+	                  screen);
+
+	g_signal_connect (terminal_app_get (), "notify::system-font",
+	                  G_CALLBACK (terminal_screen_system_font_notify_cb), screen);
+
+	priv->bg_image_callback_id = 0;
+	priv->bg_image = NULL;
+
+#ifdef MATE_ENABLE_DEBUG
+	_TERMINAL_DEBUG_IF (TERMINAL_DEBUG_GEOMETRY)
+	{
+		g_signal_connect_after (screen, "size-allocate", G_CALLBACK (size_allocate), NULL);
+	}
+#endif
+}
+
+static void
+terminal_screen_get_property (GObject *object,
+                              guint prop_id,
+                              GValue *value,
+                              GParamSpec *pspec)
+{
+	TerminalScreen *screen = TERMINAL_SCREEN (object);
+
+	switch (prop_id)
+	{
+	case PROP_PROFILE:
+		g_value_set_object (value, terminal_screen_get_profile (screen));
+		break;
+	case PROP_ICON_TITLE:
+		g_value_set_string (value, terminal_screen_get_icon_title (screen));
+		break;
+	case PROP_ICON_TITLE_SET:
+		g_value_set_boolean (value, terminal_screen_get_icon_title_set (screen));
+		break;
+	case PROP_OVERRIDE_COMMAND:
+		g_value_set_boxed (value, terminal_screen_get_override_command (screen));
+		break;
+	case PROP_INITIAL_ENVIRONMENT:
+		g_value_set_boxed (value, terminal_screen_get_initial_environment (screen));
+		break;
+	case PROP_TITLE:
+		g_value_set_string (value, terminal_screen_get_title (screen));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+terminal_screen_set_property (GObject *object,
+                              guint prop_id,
+                              const GValue *value,
+                              GParamSpec *pspec)
+{
+	TerminalScreen *screen = TERMINAL_SCREEN (object);
+
+	switch (prop_id)
+	{
+	case PROP_PROFILE:
+	{
+		TerminalProfile *profile;
+
+		profile = g_value_get_object (value);
+		g_assert (profile != NULL);
+		terminal_screen_set_profile (screen, profile);
+		break;
+	}
+	case PROP_OVERRIDE_COMMAND:
+		terminal_screen_set_override_command (screen, g_value_get_boxed (value));
+		break;
+	case PROP_INITIAL_ENVIRONMENT:
+		terminal_screen_set_initial_environment (screen, g_value_get_boxed (value));
+		break;
+	case PROP_ICON_TITLE:
+	case PROP_ICON_TITLE_SET:
+	case PROP_TITLE:
+		/* not writable */
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+terminal_screen_class_init (TerminalScreenClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
+	VteTerminalClass *terminal_class = VTE_TERMINAL_CLASS (klass);
+	TerminalApp *app;
+	guint i;
+
+	object_class->dispose = terminal_screen_dispose;
+	object_class->finalize = terminal_screen_finalize;
+	object_class->get_property = terminal_screen_get_property;
+	object_class->set_property = terminal_screen_set_property;
+
+	widget_class->realize = terminal_screen_realize;
+	widget_class->style_updated = terminal_screen_style_updated;
+	widget_class->drag_data_received = terminal_screen_drag_data_received;
+	widget_class->button_press_event = terminal_screen_button_press;
+	widget_class->hierarchy_changed = terminal_screen_hierarchy_changed;
+	widget_class->popup_menu = terminal_screen_popup_menu;
+
+	terminal_class->child_exited = terminal_screen_child_exited;
+
+	signals[PROFILE_SET] =
+	    g_signal_new (I_("profile-set"),
+	                  G_OBJECT_CLASS_TYPE (object_class),
+	                  G_SIGNAL_RUN_LAST,
+	                  G_STRUCT_OFFSET (TerminalScreenClass, profile_set),
+	                  NULL, NULL,
+	                  g_cclosure_marshal_VOID__OBJECT,
+	                  G_TYPE_NONE,
+	                  1, TERMINAL_TYPE_PROFILE);
+
+	signals[SHOW_POPUP_MENU] =
+	    g_signal_new (I_("show-popup-menu"),
+	                  G_OBJECT_CLASS_TYPE (object_class),
+	                  G_SIGNAL_RUN_LAST,
+	                  G_STRUCT_OFFSET (TerminalScreenClass, show_popup_menu),
+	                  NULL, NULL,
+	                  g_cclosure_marshal_VOID__POINTER,
+	                  G_TYPE_NONE,
+	                  1,
+	                  G_TYPE_POINTER);
+
+	signals[MATCH_CLICKED] =
+	    g_signal_new (I_("match-clicked"),
+	                  G_OBJECT_CLASS_TYPE (object_class),
+	                  G_SIGNAL_RUN_LAST,
+	                  G_STRUCT_OFFSET (TerminalScreenClass, match_clicked),
+	                  g_signal_accumulator_true_handled, NULL,
+	                  _terminal_marshal_BOOLEAN__STRING_INT_UINT,
+	                  G_TYPE_BOOLEAN,
+	                  3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_UINT);
+
+	signals[CLOSE_SCREEN] =
+	    g_signal_new (I_("close-screen"),
+	                  G_OBJECT_CLASS_TYPE (object_class),
+	                  G_SIGNAL_RUN_LAST,
+	                  G_STRUCT_OFFSET (TerminalScreenClass, close_screen),
+	                  NULL, NULL,
+	                  g_cclosure_marshal_VOID__VOID,
+	                  G_TYPE_NONE,
+	                  0);
+
+	g_object_class_install_property
+	(object_class,
+	 PROP_PROFILE,
+	 g_param_spec_string ("profile", NULL, NULL,
+	                      NULL,
+	                      G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+	g_object_class_install_property
+	(object_class,
+	 PROP_ICON_TITLE,
+	 g_param_spec_string ("icon-title", NULL, NULL,
+	                      NULL,
+	                      G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+	g_object_class_install_property
+	(object_class,
+	 PROP_ICON_TITLE_SET,
+	 g_param_spec_boolean ("icon-title-set", NULL, NULL,
+	                       FALSE,
+	                       G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+	g_object_class_install_property
+	(object_class,
+	 PROP_OVERRIDE_COMMAND,
+	 g_param_spec_boxed ("override-command", NULL, NULL,
+	                     G_TYPE_STRV,
+	                     G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+	g_object_class_install_property
+	(object_class,
+	 PROP_TITLE,
+	 g_param_spec_string ("title", NULL, NULL,
+	                      NULL,
+	                      G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+	g_object_class_install_property
+	(object_class,
+	 PROP_INITIAL_ENVIRONMENT,
+	 g_param_spec_boxed ("initial-environment", NULL, NULL,
+	                     G_TYPE_STRV,
+	                     G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+	/* Precompile the regexes */
+	n_url_regexes = G_N_ELEMENTS (url_regex_patterns);
+	url_regexes = g_new0 (VteRegex*, n_url_regexes);
+	url_regex_flavors = g_new0 (TerminalURLFlavor, n_url_regexes);
+
+	for (i = 0; i < n_url_regexes; ++i)
+	{
+		GError *error = NULL;
+
+		url_regexes[i] = vte_regex_new_for_match(url_regex_patterns[i].pattern, -1,
+				                         url_regex_patterns[i].flags | PCRE2_MULTILINE, &error);
+		if (error)
+		{
+			g_message ("%s", error->message);
+			g_error_free (error);
+		}
+
+		url_regex_flavors[i] = url_regex_patterns[i].flavor;
+	}
+
+#ifdef ENABLE_SKEY
+	n_skey_regexes = G_N_ELEMENTS (skey_regex_patterns);
+	skey_regexes = g_new0 (VteRegex*, n_skey_regexes);
+
+	for (i = 0; i < n_skey_regexes; ++i)
+	{
+		GError *error = NULL;
+
+		skey_regexes[i] = vte_regex_new_for_match(skey_regex_patterns[i].pattern, -1,
+							  PCRE2_MULTILINE | PCRE2_UTF | PCRE2_NO_UTF_CHECK, &error);
+		if (error)
+		{
+			g_message ("%s", error->message);
+			g_error_free (error);
+		}
+	}
+#endif /* ENABLE_SKEY */
+
+	/* This fixes bug #329827 */
+	app = terminal_app_get ();
+	terminal_screen_class_enable_menu_bar_accel_notify_cb (app, NULL, klass);
+	g_signal_connect (app, "notify::" TERMINAL_APP_ENABLE_MENU_BAR_ACCEL,
+	                  G_CALLBACK (terminal_screen_class_enable_menu_bar_accel_notify_cb), klass);
+}
+
+static void
+terminal_screen_dispose (GObject *object)
+{
+	TerminalScreen *screen = TERMINAL_SCREEN (object);
+	TerminalScreenPrivate *priv = screen->priv;
+	GtkSettings *settings;
+
+	settings = gtk_widget_get_settings (GTK_WIDGET (screen));
+	g_signal_handlers_disconnect_matched (settings, G_SIGNAL_MATCH_DATA,
+	                                      0, 0, NULL, NULL,
+	                                      screen);
+
+	if (priv->launch_child_source_id != 0)
+	{
+		g_source_remove (priv->launch_child_source_id);
+		priv->launch_child_source_id = 0;
+	}
+
+	G_OBJECT_CLASS (terminal_screen_parent_class)->dispose (object);
+}
+
+static void
+terminal_screen_finalize (GObject *object)
+{
+	TerminalScreen *screen = TERMINAL_SCREEN (object);
+	TerminalScreenPrivate *priv = screen->priv;
+
+	g_signal_handlers_disconnect_by_func (terminal_app_get (),
+	                                      G_CALLBACK (terminal_screen_system_font_notify_cb),
+	                                      screen);
+
+	terminal_screen_set_profile (screen, NULL);
+
+	g_free (priv->raw_title);
+	g_free (priv->cooked_title);
+	g_free (priv->override_title);
+	g_free (priv->raw_icon_title);
+	g_free (priv->cooked_icon_title);
+	g_free (priv->initial_working_directory);
+	g_strfreev (priv->override_command);
+	g_strfreev (priv->initial_env);
+
+	g_slist_foreach (priv->match_tags, (GFunc) free_tag_data, NULL);
+	g_slist_free (priv->match_tags);
+
+	if (priv->bg_image)
+		g_object_unref (priv->bg_image);
+
+	G_OBJECT_CLASS (terminal_screen_parent_class)->finalize (object);
+}
+
+static gboolean
+terminal_screen_image_draw_cb (GtkWidget *widget, cairo_t *cr, void *userdata)
+{
+	TerminalScreen *screen = TERMINAL_SCREEN (widget);
+	TerminalScreenPrivate *priv = screen->priv;
+	GdkPixbuf *bg_image = priv->bg_image;
+	GdkRectangle target_rect;
+	GtkAllocation alloc;
+	cairo_surface_t *child_surface;
+	cairo_t *child_cr;
+
+	if (!bg_image)
+		return FALSE;
+
+	gtk_widget_get_allocation (widget, &alloc);
+
+	target_rect.x = 0;
+	target_rect.y = 0;
+	target_rect.width = alloc.width;
+	target_rect.height = alloc.height;
+
+	child_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, alloc.width, alloc.height);
+	child_cr = cairo_create (child_surface);
+
+	g_signal_handler_block (screen, priv->bg_image_callback_id);
+	gtk_widget_draw (widget, child_cr);
+	g_signal_handler_unblock (screen, priv->bg_image_callback_id);
+
+	gdk_cairo_set_source_pixbuf (cr, bg_image, 0, 0);
+	cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
+
+	gdk_cairo_rectangle (cr, &target_rect);
+	cairo_fill (cr);
+
+	cairo_set_source_surface (cr, child_surface, 0, 0);
+	cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+	cairo_paint (cr);
+
+	cairo_destroy (child_cr);
+	cairo_surface_destroy (child_surface);
+
+	return TRUE;
+}
+
+TerminalScreen *
+terminal_screen_new (TerminalProfile *profile,
+                     char           **override_command,
+                     const char      *title,
+                     const char      *working_dir,
+                     char           **child_env,
+                     double           zoom)
+{
+	TerminalScreen *screen;
+	TerminalScreenPrivate *priv;
+
+	g_return_val_if_fail (TERMINAL_IS_PROFILE (profile), NULL);
+
+	screen = g_object_new (TERMINAL_TYPE_SCREEN, NULL);
+	priv = screen->priv;
+
+	terminal_screen_set_profile (screen, profile);
+
+	if (terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE))
+	{
+		vte_terminal_set_size (VTE_TERMINAL (screen),
+		                       terminal_profile_get_property_int (profile, TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS),
+		                       terminal_profile_get_property_int (profile, TERMINAL_PROFILE_DEFAULT_SIZE_ROWS));
+	}
+
+	if (title)
+		terminal_screen_set_override_title (screen, title);
+
+	priv->initial_working_directory = g_strdup (working_dir);
+
+	if (override_command)
+		terminal_screen_set_override_command (screen, override_command);
+
+	if (child_env)
+		terminal_screen_set_initial_environment (screen, child_env);
+
+	terminal_screen_set_font_scale (screen, zoom);
+	terminal_screen_set_font (screen);
+
+	/* Launch the child on idle */
+	terminal_screen_launch_child_on_idle (screen);
+
+	return screen;
+}
+
+const char*
+terminal_screen_get_raw_title (TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+
+	if (priv->raw_title)
+		return priv->raw_title;
+
+	return "";
+}
+
+const char*
+terminal_screen_get_title (TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+
+	if (priv->cooked_title == NULL)
+		terminal_screen_cook_title (screen);
+
+	/* cooked_title may still be NULL */
+	if (priv->cooked_title != NULL)
+		return priv->cooked_title;
+	else
+		return "";
+}
+
+const char*
+terminal_screen_get_icon_title (TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+
+	if (priv->cooked_icon_title == NULL)
+		terminal_screen_cook_icon_title (screen);
+
+	/* cooked_icon_title may still be NULL */
+	if (priv->cooked_icon_title != NULL)
+		return priv->cooked_icon_title;
+	else
+		return "";
+}
+
+gboolean
+terminal_screen_get_icon_title_set (TerminalScreen *screen)
+{
+	return screen->priv->icon_title_set;
+}
+
+/* Supported format specifiers:
+ * %S = static title
+ * %D = dynamic title
+ * %A = dynamic title, falling back to static title if empty
+ * %- = separator, if not at start or end of string (excluding whitespace)
+ */
+static const char *
+terminal_screen_get_title_format (TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	static const char *formats[] =
+	{
+		"%A"      /* TERMINAL_TITLE_REPLACE */,
+		"%D%-%S"  /* TERMINAL_TITLE_BEFORE  */,
+		"%S%-%D"  /* TERMINAL_TITLE_AFTER   */,
+		"%S"      /* TERMINAL_TITLE_IGNORE  */
+	};
+
+	return formats[terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_TITLE_MODE)];
+}
+
+/**
+ * terminal_screen_format_title::
+ * @screen:
+ * @raw_title: main ingredient
+ * @titleptr <inout>: pointer of the current title string
+ *
+ * Format title according @format, and stores it in <literal>*titleptr</literal>.
+ * Always ensures that *titleptr will be non-NULL.
+ *
+ * Returns: %TRUE iff the title changed
+ */
+static gboolean
+terminal_screen_format_title (TerminalScreen *screen,
+                              const char *raw_title,
+                              char **titleptr)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	const char *format, *arg;
+	const char *static_title = NULL;
+	GString *title;
+	gboolean add_sep = FALSE;
+
+	g_assert (titleptr);
+
+	/* use --title argument if one was supplied, otherwise ask the profile */
+	if (priv->override_title)
+		static_title = priv->override_title;
+	else
+		static_title = terminal_profile_get_property_string (priv->profile, TERMINAL_PROFILE_TITLE);
+
+	//title = g_string_sized_new (strlen (static_title) + strlen (raw_title) + 3 + 1);
+	title = g_string_sized_new (128);
+
+	format = terminal_screen_get_title_format (screen);
+	for (arg = format; *arg; arg += 2)
+	{
+		const char *text_to_append = NULL;
+
+		g_assert (arg[0] == '%');
+
+		switch (arg[1])
+		{
+		case 'A':
+			text_to_append = raw_title ? raw_title : static_title;
+			break;
+		case 'D':
+			text_to_append = raw_title;
+			break;
+		case 'S':
+			text_to_append = static_title;
+			break;
+		case '-':
+			text_to_append = NULL;
+			add_sep = TRUE;
+			break;
+		default:
+			g_assert_not_reached ();
+		}
+
+		if (!text_to_append || !text_to_append[0])
+			continue;
+
+		if (add_sep && title->len > 0)
+			g_string_append (title, " - ");
+
+		g_string_append (title, text_to_append);
+		add_sep = FALSE;
+	}
+
+	if (*titleptr == NULL || strcmp (title->str, *titleptr) != 0)
+	{
+		g_free (*titleptr);
+		*titleptr = g_string_free (title, FALSE);
+		return TRUE;
+	}
+
+	g_string_free (title, TRUE);
+	return FALSE;
+}
+
+static void
+terminal_screen_cook_title (TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+
+	if (terminal_screen_format_title (screen, priv->raw_title, &priv->cooked_title))
+		g_object_notify (G_OBJECT (screen), "title");
+}
+
+static void
+terminal_screen_cook_icon_title (TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+
+	if (terminal_screen_format_title (screen, priv->raw_icon_title, &priv->cooked_icon_title))
+		g_object_notify (G_OBJECT (screen), "icon-title");
+}
+
+static void
+terminal_screen_profile_notify_cb (TerminalProfile *profile,
+                                   GParamSpec *pspec,
+                                   TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	GObject *object = G_OBJECT (screen);
+	VteTerminal *vte_terminal = VTE_TERMINAL (screen);
+	const char *prop_name;
+	TerminalWindow *window;
+
+	if (pspec)
+		prop_name = pspec->name;
+	else
+		prop_name = NULL;
+
+	g_object_freeze_notify (object);
+
+	if ((window = terminal_screen_get_window (screen)))
+	{
+		/* We need these in line for the set_size in
+		 * update_on_realize
+		 */
+		terminal_window_update_geometry (window);
+
+		/* madars.vitolins@gmail.com 24/07/2014 -
+		 * update terminal window config
+		 * with the flag of copy selection to clipboard or not. */
+		terminal_window_update_copy_selection(screen, window);
+	}
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLLBAR_POSITION))
+		_terminal_screen_update_scrollbar (screen);
+
+	if (!prop_name ||
+	        prop_name == I_(TERMINAL_PROFILE_TITLE_MODE) ||
+	        prop_name == I_(TERMINAL_PROFILE_TITLE))
+	{
+		terminal_screen_cook_title (screen);
+		terminal_screen_cook_icon_title (screen);
+	}
+
+	if (gtk_widget_get_realized (GTK_WIDGET (screen)) &&
+	        (!prop_name ||
+	         prop_name == I_(TERMINAL_PROFILE_USE_SYSTEM_FONT) ||
+	         prop_name == I_(TERMINAL_PROFILE_FONT)))
+		terminal_screen_change_font (screen);
+
+	if (!prop_name ||
+	        prop_name == I_(TERMINAL_PROFILE_USE_THEME_COLORS) ||
+	        prop_name == I_(TERMINAL_PROFILE_FOREGROUND_COLOR) ||
+	        prop_name == I_(TERMINAL_PROFILE_BACKGROUND_COLOR) ||
+	        prop_name == I_(TERMINAL_PROFILE_BACKGROUND_TYPE) ||
+	        prop_name == I_(TERMINAL_PROFILE_BACKGROUND_DARKNESS) ||
+	        prop_name == I_(TERMINAL_PROFILE_BACKGROUND_IMAGE) ||
+	        prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG) ||
+	        prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR) ||
+	        prop_name == I_(TERMINAL_PROFILE_PALETTE))
+		update_color_scheme (screen);
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SILENT_BELL))
+		vte_terminal_set_audible_bell (vte_terminal, !terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SILENT_BELL));
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_WORD_CHARS))
+		vte_terminal_set_word_char_exceptions (vte_terminal,
+		                                       terminal_profile_get_property_string (profile, TERMINAL_PROFILE_WORD_CHARS));
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE))
+		vte_terminal_set_scroll_on_keystroke (vte_terminal,
+		                                      terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE));
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLL_ON_OUTPUT))
+		vte_terminal_set_scroll_on_output (vte_terminal,
+		                                   terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SCROLL_ON_OUTPUT));
+	if (!prop_name ||
+	        prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_LINES) ||
+	        prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_UNLIMITED))
+	{
+		glong lines = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SCROLLBACK_UNLIMITED) ?
+		              -1 : terminal_profile_get_property_int (profile, TERMINAL_PROFILE_SCROLLBACK_LINES);
+		vte_terminal_set_scrollback_lines (vte_terminal, lines);
+	}
+
+#ifdef ENABLE_SKEY
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_USE_SKEY))
+	{
+		if (terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_SKEY))
+		{
+			guint i;
+
+			for (i = 0; i < n_skey_regexes; ++i)
+			{
+				TagData *tag_data;
+
+				tag_data = g_slice_new (TagData);
+				tag_data->flavor = FLAVOR_SKEY;
+				tag_data->tag = vte_terminal_match_add_regex (vte_terminal, skey_regexes[i], 0);
+				vte_terminal_match_set_cursor_type (vte_terminal, tag_data->tag, SKEY_MATCH_CURSOR);
+
+				priv->match_tags = g_slist_prepend (priv->match_tags, tag_data);
+			}
+		}
+		else
+		{
+			terminal_screen_skey_match_remove (screen);
+		}
+	}
+#endif /* ENABLE_SKEY */
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_BACKSPACE_BINDING))
+		vte_terminal_set_backspace_binding (vte_terminal,
+		                                    terminal_profile_get_property_enum (profile, TERMINAL_PROFILE_BACKSPACE_BINDING));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_DELETE_BINDING))
+		vte_terminal_set_delete_binding (vte_terminal,
+		                                 terminal_profile_get_property_enum (profile, TERMINAL_PROFILE_DELETE_BINDING));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_ALLOW_BOLD))
+		vte_terminal_set_allow_bold (vte_terminal,
+		                             terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_ALLOW_BOLD));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_CURSOR_BLINK_MODE))
+		vte_terminal_set_cursor_blink_mode (vte_terminal,
+		                                    terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_CURSOR_BLINK_MODE));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_CURSOR_SHAPE))
+		vte_terminal_set_cursor_shape (vte_terminal,
+		                               terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_CURSOR_SHAPE));
+
+	if (!prop_name || prop_name == I_(TERMINAL_PROFILE_USE_URLS))
+	{
+		if (terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_URLS))
+		{
+			guint i;
+
+			for (i = 0; i < n_url_regexes; ++i)
+			{
+				TagData *tag_data;
+
+				tag_data = g_slice_new (TagData);
+				tag_data->flavor = url_regex_flavors[i];
+				tag_data->tag = vte_terminal_match_add_regex (vte_terminal, url_regexes[i], 0);
+				vte_terminal_match_set_cursor_type (vte_terminal, tag_data->tag, URL_MATCH_CURSOR);
+
+				priv->match_tags = g_slist_prepend (priv->match_tags, tag_data);
+			}
+		}
+		else
+		{
+			terminal_screen_url_match_remove (screen);
+		}
+	}
+	g_object_thaw_notify (object);
+}
+
+static void
+update_toplevel_transparency (TerminalScreen *screen)
+{
+	GtkWidget *widget = GTK_WIDGET (screen);
+	TerminalScreenPrivate *priv = screen->priv;
+	TerminalProfile *profile = priv->profile;
+	TerminalBackgroundType bg_type = terminal_profile_get_property_enum (profile, TERMINAL_PROFILE_BACKGROUND_TYPE);
+
+	if (bg_type == TERMINAL_BACKGROUND_TRANSPARENT)
+	{
+		GtkWidget *toplevel;
+		toplevel = gtk_widget_get_toplevel (widget);
+		if (toplevel != NULL && gtk_widget_is_toplevel (toplevel)
+			&& !gtk_widget_get_app_paintable (toplevel))
+		{
+			gtk_widget_set_app_paintable (toplevel, TRUE);
+		}
+	}
+}
+
+static void
+update_color_scheme (TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	TerminalProfile *profile = priv->profile;
+	GdkRGBA colors[TERMINAL_PALETTE_SIZE];
+	const GdkRGBA *fg_rgba, *bg_rgba, *bold_rgba;
+	TerminalBackgroundType bg_type;
+	const gchar *bg_image_file;
+	double bg_alpha = 1.0;
+	GdkRGBA fg, bg;
+	GdkRGBA *c;
+	guint n_colors;
+	GtkStyleContext *context;
+	GError *error = NULL;
+
+	context = gtk_widget_get_style_context (GTK_WIDGET (screen));
+	gtk_style_context_save (context);
+	gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
+	gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &fg);
+
+	gtk_style_context_get (context, GTK_STATE_FLAG_NORMAL,
+			       GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
+			       &c, NULL);
+	bg = *c;
+	gdk_rgba_free (c);
+
+	gtk_style_context_restore (context);
+
+	bold_rgba = NULL;
+
+	if (!terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_THEME_COLORS))
+	{
+		fg_rgba = terminal_profile_get_property_boxed (profile, TERMINAL_PROFILE_FOREGROUND_COLOR);
+		bg_rgba = terminal_profile_get_property_boxed (profile, TERMINAL_PROFILE_BACKGROUND_COLOR);
+
+		if (!terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG))
+			bold_rgba = terminal_profile_get_property_boxed (profile, TERMINAL_PROFILE_BOLD_COLOR);
+
+		if (fg_rgba)
+			fg = *fg_rgba;
+		if (bg_rgba)
+			bg = *bg_rgba;
+	}
+
+	n_colors = G_N_ELEMENTS (colors);
+	terminal_profile_get_palette (priv->profile, colors, &n_colors);
+
+	bg_type = terminal_profile_get_property_enum (profile, TERMINAL_PROFILE_BACKGROUND_TYPE);
+	bg_image_file = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_BACKGROUND_IMAGE_FILE);
+
+	if (bg_type == TERMINAL_BACKGROUND_TRANSPARENT)
+		bg_alpha = terminal_profile_get_property_double (profile, TERMINAL_PROFILE_BACKGROUND_DARKNESS);
+	else if (bg_type == TERMINAL_BACKGROUND_IMAGE)
+	  bg_alpha = 0.0;
+	bg.alpha = bg_alpha;
+
+	if (bg_type == TERMINAL_BACKGROUND_IMAGE)
+	{
+		if (!priv->bg_image_callback_id)
+			priv->bg_image_callback_id = g_signal_connect (screen, "draw", G_CALLBACK (terminal_screen_image_draw_cb), NULL);
+
+		g_clear_object (&priv->bg_image);
+		priv->bg_image = gdk_pixbuf_new_from_file (bg_image_file, &error);
+
+		if (error) {
+			g_printerr ("Failed to load background image: %s\n", error->message);
+			g_clear_error (&error);
+		}
+
+		gtk_widget_queue_draw (GTK_WIDGET (screen));
+	} else {
+		if (priv->bg_image_callback_id)
+		{
+			g_signal_handler_disconnect (screen, priv->bg_image_callback_id);
+			priv->bg_image_callback_id = 0;
+		}
+	}
+
+	vte_terminal_set_colors (VTE_TERMINAL (screen),
+	                         &fg, &bg,
+	                         colors, n_colors);
+	if (bold_rgba)
+		vte_terminal_set_color_bold (VTE_TERMINAL (screen),
+		                             bold_rgba);
+
+	update_toplevel_transparency (screen);
+}
+
+void
+terminal_screen_set_font (TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	TerminalProfile *profile;
+	PangoFontDescription *desc;
+	int size;
+
+	profile = priv->profile;
+
+	if (terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_SYSTEM_FONT))
+		g_object_get (terminal_app_get (), "system-font", &desc, NULL);
+	else
+		g_object_get (profile, TERMINAL_PROFILE_FONT, &desc, NULL);
+	g_assert (desc);
+
+	size = pango_font_description_get_size (desc);
+	if (pango_font_description_get_size_is_absolute (desc))
+		pango_font_description_set_absolute_size (desc, priv->font_scale * size);
+	else
+		pango_font_description_set_size (desc, (int)(priv->font_scale * size));
+
+	vte_terminal_set_font (VTE_TERMINAL (screen), desc);
+
+	pango_font_description_free (desc);
+}
+
+static void
+terminal_screen_system_font_notify_cb (TerminalApp *app,
+                                       GParamSpec *pspec,
+                                       TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+
+	if (!gtk_widget_get_realized (GTK_WIDGET (screen)))
+		return;
+
+	if (!terminal_profile_get_property_boolean (priv->profile, TERMINAL_PROFILE_USE_SYSTEM_FONT))
+		return;
+
+	terminal_screen_change_font (screen);
+}
+
+static void
+terminal_screen_change_font (TerminalScreen *screen)
+{
+	TerminalWindow *window;
+
+	terminal_screen_set_font (screen);
+
+	window = terminal_screen_get_window (screen);
+	terminal_window_update_size (window, screen, TRUE);
+}
+
+static void
+profile_forgotten_callback (TerminalProfile *profile,
+                            TerminalScreen  *screen)
+{
+	TerminalProfile *new_profile;
+
+	new_profile = terminal_app_get_profile_for_new_term (terminal_app_get ());
+	g_assert (new_profile != NULL);
+	terminal_screen_set_profile (screen, new_profile);
+}
+
+void
+terminal_screen_set_profile (TerminalScreen *screen,
+                             TerminalProfile *profile)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	TerminalProfile *old_profile;
+
+	old_profile = priv->profile;
+	if (profile == old_profile)
+		return;
+
+	if (priv->profile_changed_id)
+	{
+		g_signal_handler_disconnect (G_OBJECT (priv->profile),
+		                             priv->profile_changed_id);
+		priv->profile_changed_id = 0;
+	}
+
+	if (priv->profile_forgotten_id)
+	{
+		g_signal_handler_disconnect (G_OBJECT (priv->profile),
+		                             priv->profile_forgotten_id);
+		priv->profile_forgotten_id = 0;
+	}
+
+	priv->profile = profile;
+	if (profile)
+	{
+		g_object_ref (profile);
+		priv->profile_changed_id =
+		    g_signal_connect (profile, "notify",
+		                      G_CALLBACK (terminal_screen_profile_notify_cb),
+		                      screen);
+		priv->profile_forgotten_id =
+		    g_signal_connect (G_OBJECT (profile),
+		                      "forgotten",
+		                      G_CALLBACK (profile_forgotten_callback),
+		                      screen);
+
+		terminal_screen_profile_notify_cb (profile, NULL, screen);
+
+		g_signal_emit (G_OBJECT (screen), signals[PROFILE_SET], 0, old_profile);
+	}
+
+	if (old_profile)
+		g_object_unref (old_profile);
+
+	g_object_notify (G_OBJECT (screen), "profile");
+}
+
+TerminalProfile*
+terminal_screen_get_profile (TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+
+	g_assert (priv->profile != NULL);
+	return priv->profile;
+}
+
+void
+terminal_screen_set_override_command (TerminalScreen *screen,
+                                      char          **argv)
+{
+	TerminalScreenPrivate *priv;
+
+	g_return_if_fail (TERMINAL_IS_SCREEN (screen));
+
+	priv = screen->priv;
+	g_strfreev (priv->override_command);
+	priv->override_command = g_strdupv (argv);
+}
+
+const char**
+terminal_screen_get_override_command (TerminalScreen *screen)
+{
+	g_return_val_if_fail (TERMINAL_IS_SCREEN (screen), NULL);
+
+	return (const char**) screen->priv->override_command;
+}
+
+void
+terminal_screen_set_initial_environment (TerminalScreen *screen,
+        char          **argv)
+{
+	TerminalScreenPrivate *priv;
+
+	g_return_if_fail (TERMINAL_IS_SCREEN (screen));
+
+	priv = screen->priv;
+	g_assert (priv->initial_env == NULL);
+	priv->initial_env = g_strdupv (argv);
+}
+
+char**
+terminal_screen_get_initial_environment (TerminalScreen *screen)
+{
+	g_return_val_if_fail (TERMINAL_IS_SCREEN (screen), NULL);
+
+	return screen->priv->initial_env;
+}
+
+static gboolean
+get_child_command (TerminalScreen *screen,
+                   const char     *shell_env,
+                   GSpawnFlags    *spawn_flags_p,
+                   char         ***argv_p,
+                   GError        **err)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	TerminalProfile *profile;
+	char **argv;
+
+	g_assert (spawn_flags_p != NULL && argv_p != NULL);
+
+	profile = priv->profile;
+
+	*argv_p = argv = NULL;
+
+	if (priv->override_command)
+	{
+		argv = g_strdupv (priv->override_command);
+
+		*spawn_flags_p |= G_SPAWN_SEARCH_PATH;
+	}
+	else if (terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_CUSTOM_COMMAND))
+	{
+		if (!g_shell_parse_argv (terminal_profile_get_property_string (profile, TERMINAL_PROFILE_CUSTOM_COMMAND),
+		                         NULL, &argv,
+		                         err))
+			return FALSE;
+
+		*spawn_flags_p |= G_SPAWN_SEARCH_PATH;
+	}
+	else
+	{
+		const char *only_name;
+		char *shell;
+		int argc = 0;
+
+		shell = egg_shell (shell_env);
+
+		only_name = strrchr (shell, '/');
+		if (only_name != NULL)
+			only_name++;
+		else
+			only_name = shell;
+
+		argv = g_new (char*, 3);
+
+		argv[argc++] = shell;
+
+		if (terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_LOGIN_SHELL))
+			argv[argc++] = g_strconcat ("-", only_name, NULL);
+		else
+			argv[argc++] = g_strdup (only_name);
+
+		argv[argc++] = NULL;
+
+		*spawn_flags_p |= G_SPAWN_FILE_AND_ARGV_ZERO;
+	}
+
+	*argv_p = argv;
+
+	return TRUE;
+}
+
+static char**
+get_child_environment (TerminalScreen *screen,
+                       char **shell)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	GtkWidget *term = GTK_WIDGET (screen);
+	GtkWidget *window;
+	GdkDisplay *display;
+	char **env;
+	char *e, *v;
+	GHashTable *env_table;
+	GHashTableIter iter;
+	GPtrArray *retval;
+	guint i;
+	gchar **list_schemas = NULL;
+	gboolean schema_exists;
+
+	window = gtk_widget_get_toplevel (term);
+	g_assert (window != NULL);
+	g_assert (gtk_widget_is_toplevel (window));
+	display = gdk_window_get_display (gtk_widget_get_window (window));
+
+	env_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+	/* First take the factory's environment */
+	env = g_listenv ();
+	for (i = 0; env[i]; ++i)
+		g_hash_table_insert (env_table, env[i], g_strdup (g_getenv (env[i])));
+	g_free (env); /* the strings themselves are now owned by the hash table */
+
+	/* and then merge the child environment, if any */
+	env = priv->initial_env;
+	if (env)
+	{
+		for (i = 0; env[i]; ++i)
+		{
+			v = strchr (env[i], '=');
+			if (v)
+				g_hash_table_replace (env_table, g_strndup (env[i], v - env[i]), g_strdup (v + 1));
+			else
+				g_hash_table_replace (env_table, g_strdup (env[i]), NULL);
+		}
+	}
+
+	g_hash_table_remove (env_table, "COLUMNS");
+	g_hash_table_remove (env_table, "LINES");
+	g_hash_table_remove (env_table, "MATE_DESKTOP_ICON");
+
+	g_hash_table_replace (env_table, g_strdup ("TERM"), g_strdup ("xterm-256color")); /* FIXME configurable later? */
+
+	/* FIXME: moving the tab between windows, or the window between displays will make the next two invalid... */
+#ifdef GDK_WINDOWING_X11
+    if (GDK_IS_X11_DISPLAY (display)) {
+        g_hash_table_replace (env_table, g_strdup ("WINDOWID"), g_strdup_printf ("%ld", GDK_WINDOW_XID (gtk_widget_get_window (window))));
+    }
+#endif
+	g_settings_schema_source_list_schemas (g_settings_schema_source_get_default (), TRUE, &list_schemas, NULL);
+
+	schema_exists = FALSE;
+	for (i = 0; list_schemas[i] != NULL; i++) {
+		if (g_strcmp0 (list_schemas[i], CONF_PROXY_SCHEMA) == 0)
+		{
+			schema_exists = TRUE;
+			break;
+		}
+	}
+
+	g_strfreev (list_schemas);
+
+	if (schema_exists == TRUE) {
+		terminal_util_add_proxy_env (env_table);
+	}
+
+	retval = g_ptr_array_sized_new (g_hash_table_size (env_table));
+	g_hash_table_iter_init (&iter, env_table);
+	while (g_hash_table_iter_next (&iter, (gpointer *) &e, (gpointer *) &v))
+		g_ptr_array_add (retval, g_strdup_printf ("%s=%s", e, v ? v : ""));
+	g_ptr_array_add (retval, NULL);
+
+	*shell = g_strdup (g_hash_table_lookup (env_table, "SHELL"));
+
+	g_hash_table_destroy (env_table);
+	return (char **) g_ptr_array_free (retval, FALSE);
+}
+
+enum
+{
+    RESPONSE_RELAUNCH,
+    RESPONSE_EDIT_PROFILE
+};
+
+static void
+info_bar_response_cb (GtkWidget *info_bar,
+                      int response,
+                      TerminalScreen *screen)
+{
+	gtk_widget_grab_focus (GTK_WIDGET (screen));
+
+	switch (response)
+	{
+	case GTK_RESPONSE_CANCEL:
+		gtk_widget_destroy (info_bar);
+		g_signal_emit (screen, signals[CLOSE_SCREEN], 0);
+		break;
+	case RESPONSE_RELAUNCH:
+		gtk_widget_destroy (info_bar);
+		terminal_screen_launch_child_on_idle (screen);
+		break;
+	case RESPONSE_EDIT_PROFILE:
+		terminal_app_edit_profile (terminal_app_get (),
+		                           terminal_screen_get_profile (screen),
+		                           GTK_WINDOW (terminal_screen_get_window (screen)),
+		                           "custom-command-entry");
+		break;
+	default:
+		gtk_widget_destroy (info_bar);
+		break;
+	}
+}
+
+static void handle_error_child (TerminalScreen *screen,
+				GError         *err)
+{
+	GtkWidget *info_bar;
+
+	info_bar = terminal_info_bar_new (GTK_MESSAGE_ERROR,
+	                                  _("_Profile Preferences"), RESPONSE_EDIT_PROFILE,
+	                                  _("_Relaunch"), RESPONSE_RELAUNCH,
+	                                  NULL);
+	terminal_info_bar_format_text (TERMINAL_INFO_BAR (info_bar),
+	                               _("There was an error creating the child process for this terminal"));
+	terminal_info_bar_format_text (TERMINAL_INFO_BAR (info_bar),
+	                               "%s", err->message);
+	g_signal_connect (info_bar, "response",
+	                  G_CALLBACK (info_bar_response_cb), screen);
+
+	gtk_box_pack_start (GTK_BOX (terminal_screen_container_get_from_screen (screen)),
+	                    info_bar, FALSE, FALSE, 0);
+	gtk_info_bar_set_default_response (GTK_INFO_BAR (info_bar), GTK_RESPONSE_CANCEL);
+	gtk_widget_show (info_bar);
+}
+
+static void term_spawn_callback (GtkWidget *terminal,
+				 GPid       pid,
+				 GError    *error,
+				 gpointer   user_data)
+{
+	TerminalScreen *screen = TERMINAL_SCREEN (terminal);
+
+	if (error)
+	{
+		handle_error_child (screen, error);
+	}
+	else
+	{
+		TerminalScreenPrivate *priv = screen->priv;
+		priv->child_pid = pid;
+	}
+}
+
+static gboolean
+terminal_screen_launch_child_cb (TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	VteTerminal *terminal = VTE_TERMINAL (screen);
+	char **env, **argv;
+	char *shell = NULL;
+	GError *err = NULL;
+	const char *working_dir;
+	VtePtyFlags pty_flags = VTE_PTY_DEFAULT;
+	GSpawnFlags spawn_flags = 0;
+
+	priv->launch_child_source_id = 0;
+
+	_terminal_debug_print (TERMINAL_DEBUG_PROCESSES,
+	                       "[screen %p] now launching the child process\n",
+	                       screen);
+
+	env = get_child_environment (screen, &shell);
+
+	if (priv->initial_working_directory)
+		working_dir = priv->initial_working_directory;
+	else
+		working_dir = g_get_home_dir ();
+
+	if (!get_child_command (screen, shell, &spawn_flags, &argv, &err))
+	{
+		handle_error_child (screen, err);
+
+		g_error_free (err);
+		g_strfreev (env);
+		g_free (shell);
+
+		return FALSE;
+	}
+
+        vte_terminal_spawn_async (terminal,
+				  pty_flags,
+				  working_dir,
+				  argv,
+				  env,
+				  spawn_flags,
+				  NULL,
+				  NULL,
+				  NULL,
+				  -1,
+				  NULL,
+				  (VteTerminalSpawnAsyncCallback) term_spawn_callback,
+				  NULL);
+
+	g_free (shell);
+	g_strfreev (argv);
+	g_strfreev (env);
+
+	return FALSE; /* don't run again */
+}
+
+static void
+terminal_screen_launch_child_on_idle (TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+
+	if (priv->launch_child_source_id != 0)
+		return;
+
+	_terminal_debug_print (TERMINAL_DEBUG_PROCESSES,
+	                       "[screen %p] scheduling launching the child process on idle\n",
+	                       screen);
+
+	priv->launch_child_source_id = g_idle_add ((GSourceFunc) terminal_screen_launch_child_cb, screen);
+}
+
+static TerminalScreenPopupInfo *
+terminal_screen_popup_info_new (TerminalScreen *screen)
+{
+	TerminalScreenPopupInfo *info;
+
+	info = g_slice_new0 (TerminalScreenPopupInfo);
+	info->ref_count = 1;
+	info->screen = g_object_ref (screen);
+	info->window = terminal_screen_get_window (screen);
+
+	return info;
+}
+
+TerminalScreenPopupInfo *
+terminal_screen_popup_info_ref (TerminalScreenPopupInfo *info)
+{
+	g_return_val_if_fail (info != NULL, NULL);
+
+	info->ref_count++;
+	return info;
+}
+
+void
+terminal_screen_popup_info_unref (TerminalScreenPopupInfo *info)
+{
+	g_return_if_fail (info != NULL);
+
+	if (--info->ref_count > 0)
+		return;
+
+	g_object_unref (info->screen);
+	g_free (info->hyperlink);
+	g_free (info->url);
+	g_slice_free (TerminalScreenPopupInfo, info);
+}
+
+static gboolean
+terminal_screen_popup_menu (GtkWidget *widget)
+{
+	TerminalScreen *screen = TERMINAL_SCREEN (widget);
+	TerminalScreenPopupInfo *info;
+
+	info = terminal_screen_popup_info_new (screen);
+	info->button = 0;
+	info->timestamp = gtk_get_current_event_time ();
+
+	g_signal_emit (screen, signals[SHOW_POPUP_MENU], 0, info);
+	terminal_screen_popup_info_unref (info);
+
+	return TRUE;
+}
+
+static gboolean
+terminal_screen_button_press (GtkWidget      *widget,
+                              GdkEventButton *event)
+{
+	TerminalScreen *screen = TERMINAL_SCREEN (widget);
+	gboolean (* button_press_event) (GtkWidget*, GdkEventButton*) =
+	    GTK_WIDGET_CLASS (terminal_screen_parent_class)->button_press_event;
+	char *hyperlink;
+	char *url;
+	int url_flavor = FLAVOR_AS_IS;
+	guint state;
+
+	state = event->state & gtk_accelerator_get_default_mod_mask ();
+	hyperlink = terminal_screen_check_hyperlink (screen, (GdkEvent*)event);
+	url = terminal_screen_check_match (screen, (GdkEvent*)event, &url_flavor);
+
+	// left or middle button with Ctrl
+	if ((event->button == 1 || event->button == 2) &&
+		(state & GDK_CONTROL_MASK))
+	{
+		gboolean handled = FALSE;
+
+		if (hyperlink != NULL)
+			g_signal_emit (screen, signals[MATCH_CLICKED], 0,
+			               hyperlink,
+			               FLAVOR_AS_IS,
+			               state,
+			               &handled);
+
+		if (handled) {
+			g_free (url);
+			g_free (hyperlink);
+			return TRUE; /* don't do anything else such as select with the click */
+		}
+
+#ifdef ENABLE_SKEY
+		if (url_flavor != FLAVOR_SKEY ||
+		        terminal_profile_get_property_boolean (screen->priv->profile, TERMINAL_PROFILE_USE_SKEY))
+#endif
+		if (url != NULL)
+		{
+			g_signal_emit (screen, signals[MATCH_CLICKED], 0,
+			               url,
+			               url_flavor,
+			               state,
+			               &handled);
+		}
+
+		if (handled) {
+			g_free (url);
+			g_free (hyperlink);
+			return TRUE; /* don't do anything else such as select with the click */
+		}
+	}
+
+	// right button with no Ctrl, Alt or Shift
+	if (event->button == 3 &&
+	        (state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)) == 0)
+	{
+		TerminalScreenPopupInfo *info;
+
+		info = terminal_screen_popup_info_new (screen);
+		info->button = event->button;
+		info->state = state;
+		info->timestamp = event->time;
+		info->url = url; /* adopted */
+		info->hyperlink = hyperlink; /* adopted */
+		info->flavor = url_flavor;
+
+		g_signal_emit (screen, signals[SHOW_POPUP_MENU], 0, info);
+		terminal_screen_popup_info_unref (info);
+
+		return TRUE;
+	}
+
+	g_free (url);
+	g_free (hyperlink);
+
+	/* default behavior is to let the terminal widget deal with it */
+	if (button_press_event)
+		return button_press_event (widget, event);
+
+	return FALSE;
+}
+
+static void
+terminal_screen_hierarchy_changed (GtkWidget *widget,
+								   GtkWidget *previous_toplevel)
+{
+	update_toplevel_transparency (TERMINAL_SCREEN (widget));
+}
+
+static void
+terminal_screen_set_dynamic_title (TerminalScreen *screen,
+                                   const char     *title,
+                                   gboolean	  userset)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+
+	g_assert (TERMINAL_IS_SCREEN (screen));
+
+	if ((priv->user_title && !userset) ||
+	        (priv->raw_title && title &&
+	         strcmp (priv->raw_title, title) == 0))
+		return;
+
+	g_free (priv->raw_title);
+	priv->raw_title = g_strdup (title);
+	terminal_screen_cook_title (screen);
+}
+
+static void
+terminal_screen_set_dynamic_icon_title (TerminalScreen *screen,
+                                        const char     *icon_title,
+                                        gboolean       userset)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	GObject *object = G_OBJECT (screen);
+
+	g_assert (TERMINAL_IS_SCREEN (screen));
+
+	if ((priv->user_title && !userset) ||
+	        (priv->icon_title_set &&
+	         priv->raw_icon_title &&
+	         icon_title &&
+	         strcmp (priv->raw_icon_title, icon_title) == 0))
+		return;
+
+	g_object_freeze_notify (object);
+
+	g_free (priv->raw_icon_title);
+	priv->raw_icon_title = g_strdup (icon_title);
+	priv->icon_title_set = TRUE;
+
+	g_object_notify (object, "icon-title-set");
+	terminal_screen_cook_icon_title (screen);
+
+	g_object_thaw_notify (object);
+}
+
+void
+terminal_screen_set_override_title (TerminalScreen *screen,
+                                    const char     *title)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	char *old_title;
+
+	old_title = priv->override_title;
+	priv->override_title = g_strdup (title);
+	g_free (old_title);
+
+	terminal_screen_set_dynamic_title (screen, title, FALSE);
+	terminal_screen_set_dynamic_icon_title (screen, title, FALSE);
+}
+
+const char*
+terminal_screen_get_dynamic_title (TerminalScreen *screen)
+{
+	g_return_val_if_fail (TERMINAL_IS_SCREEN (screen), NULL);
+
+	return screen->priv->raw_title;
+}
+
+const char*
+terminal_screen_get_dynamic_icon_title (TerminalScreen *screen)
+{
+	g_return_val_if_fail (TERMINAL_IS_SCREEN (screen), NULL);
+
+	return screen->priv->raw_icon_title;
+}
+
+/**
+ * terminal_screen_get_current_dir:
+ * @screen:
+ *
+ * Tries to determine the current working directory of the foreground process
+ * in @screen's PTY, falling back to the current working directory of the
+ * primary child.
+ *
+ * Returns: a newly allocated string containing the current working directory,
+ *   or %NULL on failure
+ */
+char*
+terminal_screen_get_current_dir (TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	char *cwd;
+	VtePty *pty;
+
+	pty = vte_terminal_get_pty (VTE_TERMINAL (screen));
+	if (pty != NULL)
+	{
+#if 0
+		/* Get the foreground process ID */
+		cwd = cwd_of_pid (tcgetpgrp (priv->pty_fd));
+		if (cwd != NULL)
+			return cwd;
+#endif
+
+		/* If that didn't work, try falling back to the primary child. See bug #575184. */
+		cwd = cwd_of_pid (priv->child_pid);
+		if (cwd != NULL)
+			return cwd;
+	}
+
+	return NULL;
+}
+
+/**
+ * terminal_screen_get_current_dir_with_fallback:
+ * @screen:
+ *
+ * Like terminal_screen_get_current_dir(), but falls back to returning
+ * @screen's initial working directory, with a further fallback to the
+ * user's home directory.
+ *
+ * Returns: a newly allocated string containing the current working directory,
+ *   or %NULL on failure
+ */
+char*
+terminal_screen_get_current_dir_with_fallback (TerminalScreen *screen)
+{
+	VtePty *pty;
+	TerminalScreenPrivate *priv = screen->priv;
+
+	pty = vte_terminal_get_pty (VTE_TERMINAL (screen));
+	if (pty == NULL)
+		return g_strdup (priv->initial_working_directory);
+
+	return terminal_screen_get_current_dir (screen);
+}
+
+void
+terminal_screen_set_font_scale (TerminalScreen *screen,
+                                double          factor)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+
+	g_return_if_fail (TERMINAL_IS_SCREEN (screen));
+
+	if (factor < TERMINAL_SCALE_MINIMUM)
+		factor = TERMINAL_SCALE_MINIMUM;
+	if (factor > TERMINAL_SCALE_MAXIMUM)
+		factor = TERMINAL_SCALE_MAXIMUM;
+
+	priv->font_scale = factor;
+
+	if (gtk_widget_get_realized (GTK_WIDGET (screen)))
+	{
+		/* Update the font */
+		terminal_screen_change_font (screen);
+	}
+}
+
+double
+terminal_screen_get_font_scale (TerminalScreen *screen)
+{
+	g_return_val_if_fail (TERMINAL_IS_SCREEN (screen), 1.0);
+
+	return screen->priv->font_scale;
+}
+
+static void
+terminal_screen_window_title_changed (VteTerminal *vte_terminal,
+                                      TerminalScreen *screen)
+{
+	terminal_screen_set_dynamic_title (screen,
+	                                   vte_terminal_get_window_title (vte_terminal),
+	                                   FALSE);
+}
+
+static void
+terminal_screen_icon_title_changed (VteTerminal *vte_terminal,
+                                    TerminalScreen *screen)
+{
+	terminal_screen_set_dynamic_icon_title (screen,
+	                                        vte_terminal_get_icon_title (vte_terminal),
+	                                        FALSE);
+}
+
+static void
+terminal_screen_child_exited (VteTerminal *terminal, int status)
+{
+	TerminalScreen *screen = TERMINAL_SCREEN (terminal);
+	TerminalScreenPrivate *priv = screen->priv;
+	TerminalExitAction action;
+
+	/* No need to chain up to VteTerminalClass::child_exited since it's NULL */
+
+	_terminal_debug_print (TERMINAL_DEBUG_PROCESSES,
+	                       "[screen %p] child process exited\n",
+	                       screen);
+
+	priv->child_pid = -1;
+
+	action = terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_EXIT_ACTION);
+
+	switch (action)
+	{
+	case TERMINAL_EXIT_CLOSE:
+		if ((status != 9) || (priv->override_command != NULL))
+			g_signal_emit (screen, signals[CLOSE_SCREEN], 0);
+		break;
+	case TERMINAL_EXIT_RESTART:
+		terminal_screen_launch_child_on_idle (screen);
+		break;
+	case TERMINAL_EXIT_HOLD:
+	{
+		if ((status == 9) && (priv->override_command == NULL))
+			break;
+
+		GtkWidget *info_bar;
+
+		info_bar = terminal_info_bar_new (GTK_MESSAGE_INFO,
+		                                  _("_Relaunch"), RESPONSE_RELAUNCH,
+		                                  NULL);
+		if (WIFEXITED (status))
+		{
+			terminal_info_bar_format_text (TERMINAL_INFO_BAR (info_bar),
+			                               _("The child process exited normally with status %d."), WEXITSTATUS (status));
+		}
+		else if (WIFSIGNALED (status))
+		{
+			terminal_info_bar_format_text (TERMINAL_INFO_BAR (info_bar),
+			                               _("The child process was terminated by signal %d."), WTERMSIG (status));
+		}
+		else
+		{
+			terminal_info_bar_format_text (TERMINAL_INFO_BAR (info_bar),
+			                               _("The child process was terminated."));
+		}
+		g_signal_connect (info_bar, "response",
+		                  G_CALLBACK (info_bar_response_cb), screen);
+
+		gtk_box_pack_start (GTK_BOX (terminal_screen_container_get_from_screen (screen)),
+		                    info_bar, FALSE, FALSE, 0);
+		gtk_info_bar_set_default_response (GTK_INFO_BAR (info_bar), RESPONSE_RELAUNCH);
+		gtk_widget_show (info_bar);
+		break;
+	}
+
+	default:
+		break;
+	}
+}
+
+void
+terminal_screen_set_user_title (TerminalScreen *screen,
+                                const char *text)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+
+	/* The user set the title to nothing, let's understand that as a
+	   request to revert to dynamically setting the title again. */
+	if (!text || !text[0])
+		priv->user_title = FALSE;
+	else
+	{
+		priv->user_title = TRUE;
+		terminal_screen_set_dynamic_title (screen, text, TRUE);
+		terminal_screen_set_dynamic_icon_title (screen, text, TRUE);
+	}
+}
+
+static void
+terminal_screen_drag_data_received (GtkWidget        *widget,
+                                    GdkDragContext   *context,
+                                    gint              x,
+                                    gint              y,
+                                    GtkSelectionData *selection_data,
+                                    guint             info,
+                                    guint             timestamp)
+{
+	TerminalScreen *screen = TERMINAL_SCREEN (widget);
+	TerminalScreenPrivate *priv = screen->priv;
+	const guchar *selection_data_data;
+	GdkAtom selection_data_target;
+	gint selection_data_length, selection_data_format;
+
+	selection_data_data = gtk_selection_data_get_data (selection_data);
+	selection_data_target = gtk_selection_data_get_target (selection_data);
+	selection_data_length = gtk_selection_data_get_length (selection_data);
+	selection_data_format = gtk_selection_data_get_format (selection_data);
+
+#if 0
+	{
+		GList *tmp;
+
+		g_print ("info: %d\n", info);
+		tmp = context->targets;
+		while (tmp != NULL)
+		{
+			GdkAtom atom = GDK_POINTER_TO_ATOM (tmp->data);
+
+			g_print ("Target: %s\n", gdk_atom_name (atom));
+
+			tmp = tmp->next;
+		}
+
+		g_print ("Chosen target: %s\n", gdk_atom_name (selection_data->target));
+	}
+#endif
+
+	if (gtk_targets_include_uri (&selection_data_target, 1))
+	{
+		char **uris;
+		char *text;
+		gsize len;
+
+		uris = gtk_selection_data_get_uris (selection_data);
+		if (!uris)
+			return;
+
+		terminal_util_transform_uris_to_quoted_fuse_paths (uris);
+
+		text = terminal_util_concat_uris (uris, &len);
+		vte_terminal_feed_child (VTE_TERMINAL (screen), text, len);
+		g_free (text);
+
+		g_strfreev (uris);
+	}
+	else if (gtk_targets_include_text (&selection_data_target, 1))
+	{
+		char *text;
+
+		text = (char *) gtk_selection_data_get_text (selection_data);
+		if (text && text[0])
+			vte_terminal_feed_child (VTE_TERMINAL (screen), text, strlen (text));
+		g_free (text);
+	}
+	else switch (info)
+		{
+		case TARGET_COLOR:
+		{
+			guint16 *data = (guint16 *)selection_data_data;
+			GdkRGBA color;
+
+			/* We accept drops with the wrong format, since the KDE color
+			 * chooser incorrectly drops application/x-color with format 8.
+			 * So just check for the data length.
+			 */
+			if (selection_data_length != 8)
+				return;
+
+			color.red = (double) data[0] / 65535.;
+			color.green = (double) data[1] / 65535.;
+			color.blue = (double) data[2] / 65535.;
+			color.alpha = 1.;
+			/* FIXME: use opacity from data[3] */
+
+			g_object_set (priv->profile,
+			              TERMINAL_PROFILE_BACKGROUND_TYPE, TERMINAL_BACKGROUND_SOLID,
+			              TERMINAL_PROFILE_USE_THEME_COLORS, FALSE,
+			              TERMINAL_PROFILE_BACKGROUND_COLOR, &color,
+			              NULL);
+		}
+		break;
+
+		case TARGET_MOZ_URL:
+		{
+			char *utf8_data, *newline, *text;
+			char *uris[2];
+			gsize len;
+
+			/* MOZ_URL is in UCS-2 but in format 8. BROKEN!
+			 *
+			 * The data contains the URL, a \n, then the
+			 * title of the web page.
+			 */
+			if (selection_data_format != 8 ||
+			        selection_data_length == 0 ||
+			        (selection_data_length % 2) != 0)
+				return;
+
+			utf8_data = g_utf16_to_utf8 ((const gunichar2*) selection_data_data,
+			                             selection_data_length / 2,
+			                             NULL, NULL, NULL);
+			if (!utf8_data)
+				return;
+
+			newline = strchr (utf8_data, '\n');
+			if (newline)
+				*newline = '\0';
+
+			uris[0] = utf8_data;
+			uris[1] = NULL;
+			terminal_util_transform_uris_to_quoted_fuse_paths (uris); /* This may replace uris[0] */
+
+			text = terminal_util_concat_uris (uris, &len);
+			vte_terminal_feed_child (VTE_TERMINAL (screen), text, len);
+			g_free (text);
+			g_free (uris[0]);
+		}
+		break;
+
+		case TARGET_NETSCAPE_URL:
+		{
+			char *utf8_data, *newline, *text;
+			char *uris[2];
+			gsize len;
+
+			/* The data contains the URL, a \n, then the
+			 * title of the web page.
+			 */
+			if (selection_data_length < 0 || selection_data_format != 8)
+				return;
+
+			utf8_data = g_strndup ((char *) selection_data_data, selection_data_length);
+			newline = strchr (utf8_data, '\n');
+			if (newline)
+				*newline = '\0';
+
+			uris[0] = utf8_data;
+			uris[1] = NULL;
+			terminal_util_transform_uris_to_quoted_fuse_paths (uris); /* This may replace uris[0] */
+
+			text = terminal_util_concat_uris (uris, &len);
+			vte_terminal_feed_child (VTE_TERMINAL (screen), text, len);
+			g_free (text);
+			g_free (uris[0]);
+		}
+		break;
+
+		case TARGET_BGIMAGE:
+		{
+			char *utf8_data;
+			char **uris;
+
+			if (selection_data_length < 0 || selection_data_format != 8)
+				return;
+
+			utf8_data = g_strndup ((char *) selection_data_data, selection_data_length);
+			uris = g_uri_list_extract_uris (utf8_data);
+			g_free (utf8_data);
+
+			/* FIXME: use terminal_util_transform_uris_to_quoted_fuse_paths? */
+
+			if (uris && uris[0])
+			{
+				char *filename;
+
+				filename = g_filename_from_uri (uris[0], NULL, NULL);
+				if (filename)
+				{
+					g_object_set (priv->profile,
+					              TERMINAL_PROFILE_BACKGROUND_TYPE, TERMINAL_BACKGROUND_IMAGE,
+					              TERMINAL_PROFILE_BACKGROUND_IMAGE_FILE, filename,
+					              NULL);
+				}
+
+				g_free (filename);
+			}
+
+			g_strfreev (uris);
+		}
+		break;
+
+		case TARGET_RESET_BG:
+			g_object_set (priv->profile,
+			              TERMINAL_PROFILE_BACKGROUND_TYPE, TERMINAL_BACKGROUND_SOLID,
+			              NULL);
+			break;
+
+		case TARGET_TAB:
+		{
+			GtkWidget *container;
+			TerminalScreen *moving_screen;
+			TerminalWindow *source_window;
+			TerminalWindow *dest_window;
+			GtkWidget *dest_notebook;
+			int page_num;
+
+			container = *(GtkWidget**) selection_data_data;
+			if (!GTK_IS_WIDGET (container))
+				return;
+
+			moving_screen = terminal_screen_container_get_screen (TERMINAL_SCREEN_CONTAINER (container));
+			g_return_if_fail (TERMINAL_IS_SCREEN (moving_screen));
+			if (!TERMINAL_IS_SCREEN (moving_screen))
+				return;
+
+			source_window = terminal_screen_get_window (moving_screen);
+			dest_window = terminal_screen_get_window (screen);
+			dest_notebook = terminal_window_get_notebook (dest_window);
+			page_num = gtk_notebook_page_num (GTK_NOTEBOOK (dest_notebook),
+			                                  GTK_WIDGET (screen));
+			terminal_window_move_screen (source_window, dest_window, moving_screen, page_num + 1);
+
+			gtk_drag_finish (context, TRUE, TRUE, timestamp);
+		}
+		break;
+
+		default:
+			g_assert_not_reached ();
+		}
+}
+
+void
+_terminal_screen_update_scrollbar (TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	TerminalScreenContainer *container;
+	GtkPolicyType policy = GTK_POLICY_ALWAYS;
+	GtkCornerType corner = GTK_CORNER_TOP_LEFT;
+
+	container = terminal_screen_container_get_from_screen (screen);
+	if (container == NULL)
+		return;
+
+	switch (terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_SCROLLBAR_POSITION))
+	{
+	case TERMINAL_SCROLLBAR_HIDDEN:
+		policy = GTK_POLICY_NEVER;
+		break;
+	case TERMINAL_SCROLLBAR_RIGHT:
+		policy = GTK_POLICY_ALWAYS;
+		corner = GTK_CORNER_TOP_LEFT;
+		break;
+	case TERMINAL_SCROLLBAR_LEFT:
+		policy = GTK_POLICY_ALWAYS;
+		corner = GTK_CORNER_TOP_RIGHT;
+		break;
+	default:
+		g_assert_not_reached ();
+		break;
+	}
+
+	terminal_screen_container_set_placement (container, corner);
+	terminal_screen_container_set_policy (container, GTK_POLICY_NEVER, policy);
+}
+
+void
+terminal_screen_get_size (TerminalScreen *screen,
+                          int       *width_chars,
+                          int       *height_chars)
+{
+	VteTerminal *terminal = VTE_TERMINAL (screen);
+
+	*width_chars = vte_terminal_get_column_count (terminal);
+	*height_chars = vte_terminal_get_row_count (terminal);
+}
+
+void
+terminal_screen_get_cell_size (TerminalScreen *screen,
+                               int                  *cell_width_pixels,
+                               int                  *cell_height_pixels)
+{
+	VteTerminal *terminal = VTE_TERMINAL (screen);
+
+	*cell_width_pixels = vte_terminal_get_char_width (terminal);
+	*cell_height_pixels = vte_terminal_get_char_height (terminal);
+}
+
+#ifdef ENABLE_SKEY
+static void
+terminal_screen_skey_match_remove (TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	GSList *l, *next;
+
+	l = priv->match_tags;
+	while (l != NULL)
+	{
+		TagData *tag_data = (TagData *) l->data;
+
+		next = l->next;
+		if (tag_data->flavor == FLAVOR_SKEY)
+		{
+			vte_terminal_match_remove (VTE_TERMINAL (screen), tag_data->tag);
+			priv->match_tags = g_slist_delete_link (priv->match_tags, l);
+		}
+
+		l = next;
+	}
+}
+#endif /* ENABLE_SKEY */
+
+static void
+terminal_screen_url_match_remove (TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	GSList *l, *next;
+
+	l = priv->match_tags;
+	while (l != NULL)
+	{
+		TagData *tag_data = (TagData *) l->data;
+
+		next = l->next;
+#ifdef ENABLE_SKEY
+		if (tag_data->flavor != FLAVOR_SKEY)
+#endif
+		{
+			vte_terminal_match_remove (VTE_TERMINAL (screen), tag_data->tag);
+			priv->match_tags = g_slist_delete_link (priv->match_tags, l);
+		}
+
+		l = next;
+	}
+}
+
+static char*
+terminal_screen_check_hyperlink (TerminalScreen *screen,
+                                 GdkEvent       *event)
+{
+	return vte_terminal_hyperlink_check_event (VTE_TERMINAL (screen), event);
+}
+
+static char*
+terminal_screen_check_match (TerminalScreen *screen,
+                             GdkEvent  *event,
+                             int       *flavor)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	GSList *tags;
+	int tag;
+	char *match;
+
+	match = vte_terminal_match_check_event (VTE_TERMINAL (screen), event, &tag);
+	for (tags = priv->match_tags; tags != NULL; tags = tags->next)
+	{
+		TagData *tag_data = (TagData*) tags->data;
+		if (tag_data->tag == tag)
+		{
+			if (flavor)
+				*flavor = tag_data->flavor;
+			return match;
+		}
+	}
+
+	g_free (match);
+	return NULL;
+}
+
+void
+terminal_screen_save_config (TerminalScreen *screen,
+                             GKeyFile *key_file,
+                             const char *group)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	VteTerminal *terminal = VTE_TERMINAL (screen);
+	TerminalProfile *profile = priv->profile;
+	const char *profile_id;
+	char *working_directory;
+
+	profile_id = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME);
+	g_key_file_set_string (key_file, group, TERMINAL_CONFIG_TERMINAL_PROP_PROFILE_ID, profile_id);
+
+	if (priv->override_command)
+		terminal_util_key_file_set_argv (key_file, group, TERMINAL_CONFIG_TERMINAL_PROP_COMMAND,
+		                                 -1, priv->override_command);
+
+	if (priv->override_title)
+		g_key_file_set_string (key_file, group, TERMINAL_CONFIG_TERMINAL_PROP_TITLE, priv->override_title);
+
+	/* FIXMEchpe: use the initial_working_directory instead?? */
+	working_directory = terminal_screen_get_current_dir (screen);
+	if (working_directory)
+		terminal_util_key_file_set_string_escape (key_file, group, TERMINAL_CONFIG_TERMINAL_PROP_WORKING_DIRECTORY, working_directory);
+	g_free (working_directory);
+
+	g_key_file_set_double (key_file, group, TERMINAL_CONFIG_TERMINAL_PROP_ZOOM, priv->font_scale);
+
+	g_key_file_set_integer (key_file, group, TERMINAL_CONFIG_TERMINAL_PROP_WIDTH,
+	                        vte_terminal_get_column_count (terminal));
+	g_key_file_set_integer (key_file, group, TERMINAL_CONFIG_TERMINAL_PROP_HEIGHT,
+	                        vte_terminal_get_row_count (terminal));
+}
+
+/**
+ * terminal_screen_has_foreground_process:
+ * @screen:
+ *
+ * Checks whether there's a foreground process running in
+ * this terminal.
+ *
+ * Returns: %TRUE iff there's a foreground process running in @screen
+ */
+gboolean
+terminal_screen_has_foreground_process (TerminalScreen *screen)
+{
+	TerminalScreenPrivate *priv = screen->priv;
+	VtePty *pty;
+	int fd;
+	int fgpid;
+
+	pty = vte_terminal_get_pty (VTE_TERMINAL (screen));
+	if (pty == NULL)
+		return FALSE;
+
+	fd = vte_pty_get_fd (pty);
+	if (fd == -1)
+		return FALSE;
+
+	fgpid = tcgetpgrp (fd);
+	if (fgpid == -1 || fgpid == priv->child_pid)
+		return FALSE;
+
+	return TRUE;
+
+#if 0
+	char *cmdline, *basename, *name;
+	gsize len;
+	char filename[64];
+
+	g_snprintf (filename, sizeof (filename), "/proc/%d/cmdline", fgpid);
+	if (!g_file_get_contents (filename, &cmdline, &len, NULL))
+		return TRUE;
+
+	basename = g_path_get_basename (cmdline);
+	g_free (cmdline);
+	if (!basename)
+		return TRUE;
+
+	name = g_filename_to_utf8 (basename, -1, NULL, NULL, NULL);
+	g_free (basename);
+	if (!name)
+		return TRUE;
+
+	if (process_name)
+		*process_name = name;
+
+	return TRUE;
+#endif
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/51.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/51.html new file mode 100644 index 0000000..f0e1db1 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/51.html @@ -0,0 +1,279 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
/* This file is generated by glib-genmarshal, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+#ifndef ___TERMINAL_MARSHAL_MARSHAL_H__
+#define ___TERMINAL_MARSHAL_MARSHAL_H__
+
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+/* BOOLEAN:STRING,INT,UINT (./terminal-marshal.list:1) */
+G_GNUC_INTERNAL
+void _terminal_marshal_BOOLEAN__STRING_INT_UINT (GClosure     *closure,
+                                                 GValue       *return_value,
+                                                 guint         n_param_values,
+                                                 const GValue *param_values,
+                                                 gpointer      invocation_hint,
+                                                 gpointer      marshal_data);
+
+
+G_END_DECLS
+
+#endif /* ___TERMINAL_MARSHAL_MARSHAL_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/52.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/52.html new file mode 100644 index 0000000..4623dc1 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/52.html @@ -0,0 +1,1047 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * Copyright © 2005 Paolo Maggi
+ * Copyright © 2010 Red Hat (Red Hat author: Behdad Esfahbod)
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"<--- Include file: "config.h" not found.
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-search-dialog.h"
+#include "terminal-util.h"
+
+#define PCRE2_CODE_UNIT_WIDTH 0
+#include <pcre2.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define HISTORY_MIN_ITEM_LEN 3
+#define HISTORY_LENGTH 10
+
+static GQuark
+get_quark (void)
+{
+	static GQuark quark = 0;
+
+	if (G_UNLIKELY (!quark))
+		quark = g_quark_from_static_string ("GT:data");
+
+	return quark;
+}
+
+#define TERMINAL_SEARCH_DIALOG_GET_PRIVATE(object) \
+  ((TerminalSearchDialogPrivate *) g_object_get_qdata (G_OBJECT (object), get_quark ()))
+
+#define GET_FLAG(widget) gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->widget))
+
+typedef struct _TerminalSearchDialogPrivate
+{
+	GtkWidget *search_label;
+	GtkWidget *search_entry;
+	GtkWidget *search_text_entry;
+	GtkWidget *match_case_checkbutton;
+	GtkWidget *entire_word_checkbutton;
+	GtkWidget *regex_checkbutton;
+	GtkWidget *backwards_checkbutton;
+	GtkWidget *wrap_around_checkbutton;
+
+	GtkListStore *store;
+	GtkEntryCompletion *completion;
+
+	/* Cached regex */
+	VteRegex *regex;
+	guint32 regex_compile_flags;
+} TerminalSearchDialogPrivate;
+
+static void update_sensitivity (void *unused,
+                                GtkWidget *dialog);
+static void response_handler (GtkWidget *dialog,
+                              gint       response_id,
+                              gpointer   data);
+static void terminal_search_dialog_private_destroy (TerminalSearchDialogPrivate *priv);
+
+GtkWidget *
+terminal_search_dialog_new (GtkWindow   *parent)
+{
+	GtkWidget *dialog;
+	TerminalSearchDialogPrivate *priv;
+	GtkListStore *store;
+	GtkEntryCompletion *completion;
+
+	priv = g_new0 (TerminalSearchDialogPrivate, 1);
+
+	if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/find-dialog.ui",
+	                                      "find-dialog", &dialog,
+	                                      "search-label", &priv->search_label,
+	                                      "search-entry", &priv->search_entry,
+	                                      "match-case-checkbutton", &priv->match_case_checkbutton,
+	                                      "entire-word-checkbutton", &priv->entire_word_checkbutton,
+	                                      "regex-checkbutton", &priv->regex_checkbutton,
+	                                      "search-backwards-checkbutton", &priv->backwards_checkbutton,
+	                                      "wrap-around-checkbutton", &priv->wrap_around_checkbutton,
+	                                      NULL))
+	{
+		g_free (priv);
+		return NULL;
+	}
+
+	g_object_set_qdata_full (G_OBJECT (dialog), get_quark (), priv,
+	                         (GDestroyNotify) terminal_search_dialog_private_destroy);
+
+	priv->search_text_entry = gtk_bin_get_child (GTK_BIN (priv->search_entry));
+	gtk_widget_set_size_request (priv->search_entry, 300, -1);
+
+	priv->store = store = gtk_list_store_new (1, G_TYPE_STRING);
+	g_object_set (G_OBJECT (priv->search_entry),
+	              "model", store,
+	              "entry-text-column", 0,
+	              NULL);
+
+	priv->completion = completion = gtk_entry_completion_new ();
+	gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (store));
+	gtk_entry_completion_set_text_column (completion, 0);
+	gtk_entry_completion_set_minimum_key_length (completion, HISTORY_MIN_ITEM_LEN);
+	gtk_entry_completion_set_popup_completion (completion, FALSE);
+	gtk_entry_completion_set_inline_completion (completion, TRUE);
+	gtk_entry_set_completion (GTK_ENTRY (priv->search_text_entry), completion);
+
+	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT, FALSE);
+
+	gtk_entry_set_activates_default (GTK_ENTRY (priv->search_text_entry), TRUE);
+	g_signal_connect (priv->search_text_entry, "changed", G_CALLBACK (update_sensitivity), dialog);
+	g_signal_connect (priv->regex_checkbutton, "toggled", G_CALLBACK (update_sensitivity), dialog);
+
+	g_signal_connect (dialog, "response", G_CALLBACK (response_handler), NULL);
+
+	if (parent)
+		gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
+
+	return GTK_WIDGET (dialog);
+}
+
+void
+terminal_search_dialog_present (GtkWidget *dialog)
+{
+	TerminalSearchDialogPrivate *priv;
+
+	g_return_if_fail (GTK_IS_DIALOG (dialog));
+
+	priv = TERMINAL_SEARCH_DIALOG_GET_PRIVATE (dialog);
+	g_return_if_fail (priv);
+
+	gtk_window_present (GTK_WINDOW (dialog));
+	gtk_widget_grab_focus (priv->search_text_entry);
+}
+
+static void
+terminal_search_dialog_private_destroy (TerminalSearchDialogPrivate *priv)
+{
+
+	if (priv->regex)
+		vte_regex_unref (priv->regex);
+
+	g_object_unref (priv->store);
+	g_object_unref (priv->completion);
+
+	g_free (priv);
+}
+
+static void
+update_sensitivity (void *unused, GtkWidget *dialog)
+{
+	TerminalSearchDialogPrivate *priv = TERMINAL_SEARCH_DIALOG_GET_PRIVATE (dialog);
+	const gchar *search_string;
+	gboolean valid;
+
+	if (priv->regex)
+	{
+		vte_regex_unref (priv->regex);
+		priv->regex = NULL;
+	}
+
+	search_string = gtk_entry_get_text (GTK_ENTRY (priv->search_text_entry));
+	g_return_if_fail (search_string != NULL);
+
+	valid = *search_string != '\0';
+
+	if (valid && GET_FLAG (regex_checkbutton))
+	{
+		/* Check that the regex is valid */
+		valid = NULL != terminal_search_dialog_get_regex (dialog);
+		/* TODO show the error message somewhere */
+	}
+
+	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT, valid);
+}
+
+static gboolean
+remove_item (GtkListStore *store,
+             const gchar  *text)
+{
+	GtkTreeIter iter;
+
+	g_return_val_if_fail (text != NULL, FALSE);
+
+	if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter))
+		return FALSE;
+
+	do
+	{
+		gchar *item_text;
+
+		gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, 0, &item_text, -1);
+
+		if (item_text != NULL && strcmp (item_text, text) == 0)
+		{
+			gtk_list_store_remove (store, &iter);
+			g_free (item_text);
+			return TRUE;
+		}
+
+		g_free (item_text);
+	}
+	while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter));
+
+	return FALSE;
+}
+
+static void
+clamp_list_store (GtkListStore *store,
+                  guint         max)
+{
+	GtkTreePath *path;
+	GtkTreeIter iter;
+
+	/* -1 because TreePath counts from 0 */
+	path = gtk_tree_path_new_from_indices (max - 1, -1);
+
+	if (gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path))
+		while (1)
+			if (!gtk_list_store_remove (store, &iter))
+				break;
+
+	gtk_tree_path_free (path);
+}
+
+static void
+history_entry_insert (GtkListStore *store,
+                      const gchar  *text)
+{
+	GtkTreeIter iter;
+
+	g_return_if_fail (text != NULL);
+
+	if (g_utf8_strlen (text, -1) <= HISTORY_MIN_ITEM_LEN)
+		return;
+
+	/* remove the text from the store if it was already
+	 * present. If it wasn't, clamp to max history - 1
+	 * before inserting the new row, otherwise appending
+	 * would not work */
+
+	if (!remove_item (store, text))
+		clamp_list_store (store, HISTORY_LENGTH - 1);
+
+	gtk_list_store_insert (store, &iter, 0);
+	gtk_list_store_set (store, &iter, 0, text, -1);
+}
+
+static void
+response_handler (GtkWidget *dialog,
+                  gint       response_id,
+                  gpointer   data)
+{
+	TerminalSearchDialogPrivate *priv;
+	const gchar *str;
+
+	if (response_id != GTK_RESPONSE_ACCEPT)
+	{
+		gtk_widget_hide (dialog);
+		return;
+	}
+
+	priv = TERMINAL_SEARCH_DIALOG_GET_PRIVATE (dialog);
+
+	str = gtk_entry_get_text (GTK_ENTRY (priv->search_text_entry));
+	if (*str != '\0')
+		history_entry_insert (priv->store, str);
+}
+
+void
+terminal_search_dialog_set_search_text (GtkWidget   *dialog,
+                                        const gchar *text)
+{
+	TerminalSearchDialogPrivate *priv;
+
+	g_return_if_fail (GTK_IS_DIALOG (dialog));
+	g_return_if_fail (text != NULL);
+
+	priv = TERMINAL_SEARCH_DIALOG_GET_PRIVATE (dialog);
+	g_return_if_fail (priv);
+
+	gtk_entry_set_text (GTK_ENTRY (priv->search_text_entry), text);
+
+	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+	                                   GTK_RESPONSE_ACCEPT,
+	                                   (*text != '\0'));
+}
+
+const gchar *
+terminal_search_dialog_get_search_text (GtkWidget *dialog)
+{
+	TerminalSearchDialogPrivate *priv;
+
+	g_return_val_if_fail (GTK_IS_DIALOG (dialog), NULL);
+
+	priv = TERMINAL_SEARCH_DIALOG_GET_PRIVATE (dialog);
+	g_return_val_if_fail (priv, NULL);
+
+	return gtk_entry_get_text (GTK_ENTRY (priv->search_text_entry));
+}
+
+TerminalSearchFlags
+terminal_search_dialog_get_search_flags (GtkWidget *dialog)
+{
+	TerminalSearchDialogPrivate *priv;
+	TerminalSearchFlags flags = 0;
+
+	g_return_val_if_fail (GTK_IS_DIALOG (dialog), flags);
+
+	priv = TERMINAL_SEARCH_DIALOG_GET_PRIVATE (dialog);
+	g_return_val_if_fail (priv, flags);
+
+	if (GET_FLAG (backwards_checkbutton))
+		flags |= TERMINAL_SEARCH_FLAG_BACKWARDS;
+
+	if (GET_FLAG (wrap_around_checkbutton))
+		flags |= TERMINAL_SEARCH_FLAG_WRAP_AROUND;
+
+	return flags;
+}
+
+VteRegex *
+terminal_search_dialog_get_regex (GtkWidget *dialog)
+{
+	TerminalSearchDialogPrivate *priv;
+	guint32 compile_flags;
+	const char *text, *pattern;
+
+	g_return_val_if_fail (GTK_IS_DIALOG (dialog), NULL);
+
+	priv = TERMINAL_SEARCH_DIALOG_GET_PRIVATE (dialog);
+	g_return_val_if_fail (priv, NULL);
+
+	pattern = text = terminal_search_dialog_get_search_text (dialog);
+
+	compile_flags = PCRE2_MULTILINE | PCRE2_UTF | PCRE2_NO_UTF_CHECK;
+
+	if (!GET_FLAG (match_case_checkbutton))
+		compile_flags |= PCRE2_CASELESS;
+
+	if (GET_FLAG (regex_checkbutton))
+		compile_flags |= PCRE2_UCP;
+	else
+		pattern = g_regex_escape_string (text, -1);
+
+	if (GET_FLAG (entire_word_checkbutton))
+	{
+		const char *old_pattern = pattern;
+		pattern = g_strdup_printf ("\\b%s\\b", pattern);
+		if (old_pattern != text)
+			g_free ((char *) old_pattern);
+	}
+
+	if (!priv->regex || priv->regex_compile_flags != compile_flags)
+	{
+		priv->regex_compile_flags = compile_flags;
+		if (priv->regex)
+			vte_regex_unref (priv->regex);
+
+		/* TODO Error handling */
+		priv->regex = vte_regex_new_for_search(pattern, -1,
+						       compile_flags, NULL);
+
+	}
+
+	if (pattern != text)
+		g_free ((char *) pattern);
+
+	return priv->regex;
+}
+
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/53.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/53.html new file mode 100644 index 0000000..d631152 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/53.html @@ -0,0 +1,339 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
/*
+ * Copyright © 2005 Paolo Maggi
+ * Copyright © 2010 Red Hat (Red Hat author: Behdad Esfahbod)
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TERMINAL_SEARCH_DIALOG_H
+#define TERMINAL_SEARCH_DIALOG_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <vte/vte.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+typedef enum _TerminalSearchFlags
+{
+    TERMINAL_SEARCH_FLAG_BACKWARDS	= 1 << 0,
+    TERMINAL_SEARCH_FLAG_WRAP_AROUND	= 1 << 1
+} TerminalSearchFlags;
+
+GtkWidget	*terminal_search_dialog_new		(GtkWindow   *parent);
+
+void		 terminal_search_dialog_present		(GtkWidget   *dialog);
+
+void		 terminal_search_dialog_set_search_text (GtkWidget   *dialog,
+        const gchar *text);
+
+const gchar 	*terminal_search_dialog_get_search_text	(GtkWidget   *dialog);
+
+TerminalSearchFlags
+terminal_search_dialog_get_search_flags(GtkWidget   *dialog);
+VteRegex	*terminal_search_dialog_get_regex	(GtkWidget   *dialog);
+
+G_END_DECLS
+
+#endif /* TERMINAL_SEARCH_DIALOG_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/54.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/54.html new file mode 100644 index 0000000..32d8832 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/54.html @@ -0,0 +1,805 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * Copyright © 2001 Havoc Pennington
+ * Copyright © 2007, 2008 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3, or (at your option)
+ *  any later version.
+ *
+ *  This program is distributed in the hope tab_label it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-intl.h"
+#include "terminal-tab-label.h"
+#include "terminal-close-button.h"
+
+#define SPACING (4)
+
+struct _TerminalTabLabelPrivate
+{
+	TerminalScreen *screen;
+	GtkWidget *label;
+	GtkWidget *close_button;
+	gboolean bold;
+};
+
+enum
+{
+    PROP_0,
+    PROP_SCREEN
+};
+
+enum
+{
+    CLOSE_BUTTON_CLICKED,
+    LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+G_DEFINE_TYPE_WITH_PRIVATE (TerminalTabLabel, terminal_tab_label, GTK_TYPE_BOX);
+
+/* helper functions */
+
+static void
+close_button_clicked_cb (GtkWidget *widget,
+                         TerminalTabLabel *tab_label)
+{
+	g_signal_emit (tab_label, signals[CLOSE_BUTTON_CLICKED], 0);
+}
+
+static void
+sync_tab_label (TerminalScreen *screen,
+                GParamSpec *pspec,
+                GtkWidget *label)
+{
+	GtkWidget *hbox;
+	const char *title;
+
+	title = terminal_screen_get_title (screen);
+	hbox = gtk_widget_get_parent (label);
+
+	gtk_label_set_text (GTK_LABEL (label), title);
+
+	gtk_widget_set_tooltip_text (hbox, title);
+}
+
+/* public functions */
+
+/* Class implementation */
+
+static void
+terminal_tab_label_parent_set (GtkWidget *widget,
+                               GtkWidget *old_parent)
+{
+	void (* parent_set) (GtkWidget *, GtkWidget *) = GTK_WIDGET_CLASS (terminal_tab_label_parent_class)->parent_set;
+
+	if (parent_set)
+		parent_set (widget, old_parent);
+}
+
+static void
+terminal_tab_label_init (TerminalTabLabel *tab_label)
+{
+	tab_label->priv = terminal_tab_label_get_instance_private (tab_label);
+}
+
+static GObject *
+terminal_tab_label_constructor (GType type,
+                                guint n_construct_properties,
+                                GObjectConstructParam *construct_params)
+{
+	GObject *object;
+	TerminalTabLabel *tab_label;
+	TerminalTabLabelPrivate *priv;
+	GtkWidget *hbox, *label, *close_button;
+
+	object = G_OBJECT_CLASS (terminal_tab_label_parent_class)->constructor
+	         (type, n_construct_properties, construct_params);
+
+	tab_label = TERMINAL_TAB_LABEL (object);
+	hbox = GTK_WIDGET (tab_label);
+	priv = tab_label->priv;
+
+	g_assert (priv->screen != NULL);
+
+	gtk_box_set_spacing (GTK_BOX (hbox), SPACING);
+
+	priv->label = label = gtk_label_new (NULL);
+
+	gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+	gtk_label_set_yalign (GTK_LABEL (label), 0.5);
+	gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
+	gtk_label_set_single_line_mode (GTK_LABEL (label), TRUE);
+
+	gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+
+	priv->close_button = close_button = terminal_close_button_new ();
+	gtk_widget_set_tooltip_text (close_button, _("Close tab"));
+
+	gtk_box_pack_end (GTK_BOX (hbox), close_button, FALSE, FALSE, 0);
+
+	sync_tab_label (priv->screen, NULL, label);
+	g_signal_connect (priv->screen, "notify::title",
+	                  G_CALLBACK (sync_tab_label), label);
+
+	g_signal_connect (close_button, "clicked",
+	                  G_CALLBACK (close_button_clicked_cb), tab_label);
+
+	gtk_widget_show_all (hbox);
+
+	return object;
+}
+
+static void
+terminal_tab_label_dispose (GObject *object)
+{
+	TerminalTabLabel *tab_label = TERMINAL_TAB_LABEL (object);
+	TerminalTabLabelPrivate *priv = tab_label->priv;
+
+	if (priv->screen != NULL) {
+		g_signal_handlers_disconnect_by_func (priv->screen,
+		                                      G_CALLBACK (sync_tab_label),
+		                                      priv->label);
+		g_object_unref (priv->screen);
+		priv->screen = NULL;
+	}
+
+	G_OBJECT_CLASS (terminal_tab_label_parent_class)->dispose (object);
+}
+
+static void
+terminal_tab_label_finalize (GObject *object)
+{
+//   TerminalTabLabel *tab_label = TERMINAL_TAB_LABEL (object);
+
+	G_OBJECT_CLASS (terminal_tab_label_parent_class)->finalize (object);
+}
+
+static void
+terminal_tab_label_set_property (GObject *object,
+                                 guint prop_id,
+                                 const GValue *value,
+                                 GParamSpec *pspec)
+{
+	TerminalTabLabel *tab_label = TERMINAL_TAB_LABEL (object);
+	TerminalTabLabelPrivate *priv = tab_label->priv;
+
+	switch (prop_id)
+	{
+	case PROP_SCREEN:
+		priv->screen = g_value_dup_object (value);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+terminal_tab_label_class_init (TerminalTabLabelClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+	gobject_class->constructor = terminal_tab_label_constructor;
+	gobject_class->dispose = terminal_tab_label_dispose;
+	gobject_class->finalize = terminal_tab_label_finalize;
+	gobject_class->set_property = terminal_tab_label_set_property;
+
+	widget_class->parent_set = terminal_tab_label_parent_set;
+
+	signals[CLOSE_BUTTON_CLICKED] =
+	    g_signal_new (I_("close-button-clicked"),
+	                  G_OBJECT_CLASS_TYPE (gobject_class),
+	                  G_SIGNAL_RUN_LAST,
+	                  G_STRUCT_OFFSET (TerminalTabLabelClass, close_button_clicked),
+	                  NULL, NULL,
+	                  g_cclosure_marshal_VOID__VOID,
+	                  G_TYPE_NONE,
+	                  0);
+
+	g_object_class_install_property
+	(gobject_class,
+	 PROP_SCREEN,
+	 g_param_spec_object ("screen", NULL, NULL,
+	                      TERMINAL_TYPE_SCREEN,
+	                      G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB |
+	                      G_PARAM_CONSTRUCT_ONLY));
+}
+
+/* public API */
+
+/**
+ * terminal_tab_label_new:
+ * @screen: a #TerminalScreen
+ *
+ * Returns: a new #TerminalTabLabel for @screen
+ */
+GtkWidget *
+terminal_tab_label_new (TerminalScreen *screen)
+{
+	return g_object_new (TERMINAL_TYPE_TAB_LABEL,
+	                     "screen", screen,
+	                     NULL);
+}
+
+/**
+ * terminal_tab_label_set_bold:
+ * @tab_label: a #TerminalTabLabel
+ * @bold: whether to enable label bolding
+ *
+ * Sets the tab label text bold, or unbolds it.
+ */
+void
+terminal_tab_label_set_bold (TerminalTabLabel *tab_label,
+                             gboolean bold)
+{
+	TerminalTabLabelPrivate *priv = tab_label->priv;
+	PangoAttrList *attr_list;
+	PangoAttribute *weight_attr;
+	gboolean free_list = FALSE;
+
+	bold = bold != FALSE;
+	if (priv->bold == bold)
+		return;
+
+	priv->bold = bold;
+
+	attr_list = gtk_label_get_attributes (GTK_LABEL (priv->label));
+	if (!attr_list)
+	{
+		attr_list = pango_attr_list_new ();
+		free_list = TRUE;
+	}
+
+	if (bold)
+		weight_attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
+	else
+		weight_attr = pango_attr_weight_new (PANGO_WEIGHT_NORMAL);
+
+	/* gtk_label_get_attributes() returns the label's internal list,
+	 * which we're probably not supposed to modify directly.
+	 * It seems to work ok however.
+	 */
+	pango_attr_list_change (attr_list, weight_attr);
+
+	gtk_label_set_attributes (GTK_LABEL (priv->label), attr_list);
+
+	if (free_list)
+		pango_attr_list_unref (attr_list);
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/55.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/55.html new file mode 100644 index 0000000..d39b0ff --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/55.html @@ -0,0 +1,367 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
/*
+ *  Copyright © 2008 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3, or (at your option)
+ *  any later version.
+ *
+ *  This program is distributed in the hope tab_label it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TERMINAL_TAB_LABEL_H
+#define TERMINAL_TAB_LABEL_H
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-screen.h"
+
+G_BEGIN_DECLS
+
+#define TERMINAL_TYPE_TAB_LABEL         (terminal_tab_label_get_type ())
+#define TERMINAL_TAB_LABEL(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), TERMINAL_TYPE_TAB_LABEL, TerminalTabLabel))
+#define TERMINAL_TAB_LABEL_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), TERMINAL_TYPE_TAB_LABEL, TerminalTabLabelClass))
+#define TERMINAL_IS_TAB_LABEL(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), TERMINAL_TYPE_TAB_LABEL))
+#define TERMINAL_IS_TAB_LABEL_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), TERMINAL_TYPE_TAB_LABEL))
+#define TERMINAL_TAB_LABEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TERMINAL_TYPE_TAB_LABEL, TerminalTabLabelClass))
+
+typedef struct _TerminalTabLabel        TerminalTabLabel;
+typedef struct _TerminalTabLabelClass   TerminalTabLabelClass;
+typedef struct _TerminalTabLabelPrivate TerminalTabLabelPrivate;
+
+struct _TerminalTabLabel
+{
+	GtkBox parent_instance;
+
+	/*< private >*/
+	TerminalTabLabelPrivate *priv;
+};
+
+struct _TerminalTabLabelClass
+{
+	GtkBoxClass parent_class;
+
+	/* Signals */
+	void (* close_button_clicked) (TerminalTabLabel *tab_label);
+};
+
+GType       terminal_tab_label_get_type   (void);
+
+GtkWidget  *terminal_tab_label_new        (TerminalScreen *screen);
+
+void        terminal_tab_label_set_bold   (TerminalTabLabel *tab_label,
+        gboolean bold);
+
+G_END_DECLS
+
+#endif /* !TERMINAL_TAB_LABEL_H */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/56.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/56.html new file mode 100644 index 0000000..a93e40b --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/56.html @@ -0,0 +1,1233 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ *  Copyright © 2003  David Bordoley
+ *  Copyright © 2003-2004 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3, or (at your option)
+ *  any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-tabs-menu.h"
+#include "terminal-screen.h"
+#include "terminal-screen-container.h"
+#include "terminal-intl.h"
+
+#define TERMINAL_ACCELS_N_TABS_SWITCH (12)
+
+#define LABEL_WIDTH_CHARS 32
+#define ACTION_VERB_FORMAT_PREFIX       "JmpTab"
+#define ACTION_VERB_FORMAT_PREFIX_LEN   strlen (ACTION_VERB_FORMAT_PREFIX)
+#define ACTION_VERB_FORMAT		ACTION_VERB_FORMAT_PREFIX "%x"
+#define ACTION_VERB_FORMAT_LENGTH	strlen (ACTION_VERB_FORMAT) + 14 + 1
+#define ACTION_VERB_FORMAT_BASE         (16) /* %x is hex */
+#define ACCEL_PATH_FORMAT		"<Actions>/Main/TabsSwitch%u"
+#define ACCEL_PATH_FORMAT_LENGTH	strlen (ACCEL_PATH_FORMAT) + 14 + 1
+#define DATA_KEY			"TerminalTabsMenu::Action"
+
+#define UI_PATH                         "/menubar/Tabs"
+
+struct _TerminalTabsMenuPrivate
+{
+	TerminalWindow *window;
+	GtkActionGroup *action_group;
+	GtkAction *anchor_action;
+	guint ui_id;
+};
+
+enum
+{
+    PROP_0,
+    PROP_WINDOW
+};
+
+static void	terminal_tabs_menu_update		(TerminalTabsMenu *menu);
+
+/* FIXME: this can be severely optimised */
+static GByteArray *tabs_id_array = NULL;
+static guint n_tabs = 0;
+
+G_DEFINE_TYPE_WITH_PRIVATE (TerminalTabsMenu, terminal_tabs_menu, 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.
+
+/* We need to assign unique IDs to tabs, otherwise accels get confused in the
+ * tabs menu (bug #339548). We could use a serial #, but the ID is used in the
+ * action name which is stored in a GQuark and so we should allocate them
+ * efficiently.
+ */
+static guint
+allocate_tab_id (void)
+{
+	int bit;
+	guint b, len;
+	guint8 *data;
+	guint8 byte, mask;
+
+	if (n_tabs++ == 0)
+	{
+		g_assert (tabs_id_array == NULL);
+		tabs_id_array = g_byte_array_sized_new (16);
+	}
+
+	/* Find a free ID */
+	len = tabs_id_array->len;
+	data = tabs_id_array->data;
+	for (b = 0; b < len; ++b)
+	{
+		if (data[b] != 0xff)
+			break;
+	}
+
+	/* Need to append a new byte */
+	if (b == len)
+	{
+		guint8 bytes[] = { 0 };
+		g_byte_array_append (tabs_id_array, bytes, G_N_ELEMENTS (bytes));
+		g_assert (tabs_id_array->len > b);
+	}
+
+	data = tabs_id_array->data + b;
+	byte = 0xff ^ *data;
+	/* Now find the first free bit */
+	bit = g_bit_nth_lsf (byte, -1);
+	mask = 1 << bit;
+	g_assert (bit >= 0 && bit <= 7);
+	g_assert ((*data & mask) == 0);
+	/* And mark it as allocated */
+	*data |= mask;
+
+	return b * 8 + bit;
+}
+
+static void
+free_tab_id (GtkAction *action)
+{
+	const char *name;
+	guint id;
+	guint8 *data;
+	guint b, bit;
+
+	G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+	name = gtk_action_get_name (action);
+	G_GNUC_END_IGNORE_DEPRECATIONS;
+	id = g_ascii_strtoull (name + ACTION_VERB_FORMAT_PREFIX_LEN, NULL,
+	                       ACTION_VERB_FORMAT_BASE);
+	g_assert (id < tabs_id_array->len * 8);
+
+	b = id >> 3;
+	bit = id & 0x7;
+	data = tabs_id_array->data + b;
+	*data &= ~(1 << bit);
+
+	g_assert (n_tabs > 0);
+	if (--n_tabs == 0)
+	{
+		g_assert (tabs_id_array != NULL);
+		g_byte_array_free (tabs_id_array, TRUE);
+		tabs_id_array = NULL;
+	}
+}
+
+static void
+tab_action_activate_cb (GtkToggleAction *action,
+                        TerminalTabsMenu *menu)
+{
+	TerminalTabsMenuPrivate *priv = menu->priv;
+	TerminalScreen *screen;
+
+	G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+	if (gtk_toggle_action_get_active (action) == FALSE)
+	{
+		return;
+	}
+	G_GNUC_END_IGNORE_DEPRECATIONS;
+
+	screen = g_object_get_data (G_OBJECT (action), DATA_KEY);
+	g_return_if_fail (screen != NULL);
+
+	if (terminal_window_get_active (priv->window) != screen)
+	{
+		terminal_window_switch_screen (priv->window, screen);
+	}
+}
+
+static void
+sync_tab_title (TerminalScreen *screen,
+                GParamSpec *pspec,
+                GtkAction *action)
+{
+	const char *title;
+
+	title = terminal_screen_get_title (screen);
+
+	g_object_set (action, "label", title, NULL);
+}
+
+static void
+notebook_page_added_cb (GtkNotebook *notebook,
+                        TerminalScreenContainer *container,
+                        guint position,
+                        TerminalTabsMenu *menu)
+{
+	TerminalTabsMenuPrivate *priv = menu->priv;
+	GtkAction *action;
+	char verb[ACTION_VERB_FORMAT_LENGTH];
+	GSList *group;
+	TerminalScreen *screen;
+
+	screen = terminal_screen_container_get_screen (container);
+
+	g_snprintf (verb, sizeof (verb), ACTION_VERB_FORMAT, allocate_tab_id ());
+
+	G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+	action = g_object_new (GTK_TYPE_RADIO_ACTION,
+	                       "name", verb,
+	                       "tooltip", _("Switch to this tab"),
+	                       NULL);
+	G_GNUC_END_IGNORE_DEPRECATIONS;
+
+	sync_tab_title (screen, NULL, action);
+	/* make sure the action is alive when handling the signal, see bug #169833 */
+	g_signal_connect_object (screen, "notify::title",
+	                         G_CALLBACK (sync_tab_title), action, 0);
+
+	G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+	gtk_action_group_add_action_with_accel (priv->action_group, action, NULL);
+
+	group = gtk_radio_action_get_group (GTK_RADIO_ACTION (priv->anchor_action));
+	gtk_radio_action_set_group (GTK_RADIO_ACTION (action), group);
+	G_GNUC_END_IGNORE_DEPRECATIONS;
+
+	/* set this here too, since tab-added comes after notify::active-child */
+	if (terminal_window_get_active (priv->window) == screen)
+	{
+		G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+		gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+		G_GNUC_END_IGNORE_DEPRECATIONS;
+	}
+
+	g_object_set_data (G_OBJECT (screen), DATA_KEY, action);
+	g_object_set_data (G_OBJECT (action), DATA_KEY, screen);
+
+	g_signal_connect (action, "activate",
+	                  G_CALLBACK (tab_action_activate_cb), menu);
+
+	g_object_unref (action);
+
+	terminal_tabs_menu_update (menu);
+}
+
+static void
+notebook_page_removed_cb (GtkNotebook *notebook,
+                          TerminalScreenContainer *container,
+                          guint position,
+                          TerminalTabsMenu *menu)
+{
+	TerminalTabsMenuPrivate *priv = menu->priv;
+	GtkAction *action;
+	TerminalScreen *screen;
+
+	screen = terminal_screen_container_get_screen (container);
+
+	action = g_object_get_data (G_OBJECT (screen), DATA_KEY);
+	g_return_if_fail (action != NULL);
+
+	free_tab_id (action);
+
+	g_signal_handlers_disconnect_by_func
+	(screen, G_CALLBACK (sync_tab_title), action);
+
+	g_signal_handlers_disconnect_by_func
+	(action, G_CALLBACK (tab_action_activate_cb), menu);
+
+	g_object_set_data (G_OBJECT (screen), DATA_KEY, NULL);
+	G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+	gtk_action_group_remove_action (priv->action_group, action);
+	G_GNUC_END_IGNORE_DEPRECATIONS;
+
+	terminal_tabs_menu_update (menu);
+}
+
+static void
+notebook_page_reordered_cb (GtkNotebook *notebook,
+                            GtkBin *bin,
+                            guint position,
+                            TerminalTabsMenu *menu)
+{
+	terminal_tabs_menu_update (menu);
+}
+
+static void
+notebook_page_switch_cb (GtkNotebook *notebook,
+                         GtkWidget *page,
+                         guint position,
+                         TerminalTabsMenu *menu)
+{
+	TerminalScreenContainer *container;
+	TerminalScreen *screen;
+	GtkAction *action;
+
+	container = TERMINAL_SCREEN_CONTAINER (page);
+	screen = terminal_screen_container_get_screen (container);
+
+	action = g_object_get_data (G_OBJECT (screen), DATA_KEY);
+	g_signal_handlers_block_by_func (action, G_CALLBACK (tab_action_activate_cb), menu);
+	G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+	G_GNUC_END_IGNORE_DEPRECATIONS;
+	g_signal_handlers_unblock_by_func (action, G_CALLBACK (tab_action_activate_cb), menu);
+}
+
+static void
+connect_proxy_cb (GtkActionGroup *action_group,
+                  GtkAction *action,
+                  GtkWidget *proxy,
+                  gpointer dummy)
+{
+	if (GTK_IS_MENU_ITEM (proxy))
+	{
+		GtkLabel *label;
+
+		label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (proxy)));
+
+		gtk_label_set_use_underline (label, FALSE);
+		gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END);
+		gtk_label_set_max_width_chars (label, LABEL_WIDTH_CHARS);
+	}
+}
+
+static void
+terminal_tabs_menu_set_window (TerminalTabsMenu *menu,
+                               TerminalWindow *window)
+{
+	TerminalTabsMenuPrivate *priv = menu->priv;
+	GtkWidget *notebook;
+	GtkUIManager *manager;
+
+	priv->window = window;
+
+	manager = GTK_UI_MANAGER (terminal_window_get_ui_manager (window));
+	G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+	priv->action_group = gtk_action_group_new ("TabsActions");
+	G_GNUC_END_IGNORE_DEPRECATIONS;
+	gtk_ui_manager_insert_action_group (manager, priv->action_group, -1);
+	g_object_unref (priv->action_group);
+
+	G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+	priv->anchor_action = g_object_new (GTK_TYPE_RADIO_ACTION,
+	                                    "name", "TabsMenuAnchorAction",
+	                                    NULL);
+	gtk_action_group_add_action (priv->action_group, priv->anchor_action);
+	G_GNUC_END_IGNORE_DEPRECATIONS;
+	g_object_unref (priv->anchor_action);
+
+	g_signal_connect (priv->action_group, "connect-proxy",
+	                  G_CALLBACK (connect_proxy_cb), NULL);
+
+	notebook = terminal_window_get_notebook (window);
+	g_signal_connect_object (notebook, "page-added",
+	                         G_CALLBACK (notebook_page_added_cb), menu, 0);
+	g_signal_connect_object (notebook, "page-removed",
+	                         G_CALLBACK (notebook_page_removed_cb), menu, 0);
+	g_signal_connect_object (notebook, "page-reordered",
+	                         G_CALLBACK (notebook_page_reordered_cb), menu, 0);
+	g_signal_connect_object (notebook, "switch-page",
+	                         G_CALLBACK (notebook_page_switch_cb), menu, 0);
+}
+
+static void
+terminal_tabs_menu_set_property (GObject *object,
+                                 guint prop_id,
+                                 const GValue *value,
+                                 GParamSpec *pspec)
+{
+	TerminalTabsMenu *menu = TERMINAL_TABS_MENU (object);
+
+	switch (prop_id)
+	{
+	case PROP_WINDOW:
+		terminal_tabs_menu_set_window (menu, g_value_get_object (value));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+terminal_tabs_menu_get_property (GObject *object,
+                                 guint prop_id,
+                                 GValue *value,
+                                 GParamSpec *pspec)
+{
+	/* no readable properties */
+	g_return_if_reached ();
+}
+
+static void
+terminal_tabs_menu_class_init (TerminalTabsMenuClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+	object_class->set_property = terminal_tabs_menu_set_property;
+	object_class->get_property = terminal_tabs_menu_get_property;
+
+	g_object_class_install_property (object_class,
+	                                 PROP_WINDOW,
+	                                 g_param_spec_object ("window", NULL, NULL,
+	                                         TERMINAL_TYPE_WINDOW,
+	                                         G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB |
+	                                         G_PARAM_CONSTRUCT_ONLY));
+
+	/* We don't want to save accels, so skip them */
+	gtk_accel_map_add_filter ("<Actions>/Main/TabsSwitch*");
+}
+
+static void
+terminal_tabs_menu_init (TerminalTabsMenu *menu)
+{
+	menu->priv = terminal_tabs_menu_get_instance_private (menu);
+}
+
+static void
+terminal_tabs_menu_clean (TerminalTabsMenu *menu)
+{
+	TerminalTabsMenuPrivate *p = menu->priv;
+	GtkUIManager *manager = GTK_UI_MANAGER (terminal_window_get_ui_manager (p->window));
+
+	if (p->ui_id != 0)
+	{
+		gtk_ui_manager_remove_ui (manager, p->ui_id);
+		gtk_ui_manager_ensure_update (manager);
+		p->ui_id = 0;
+	}
+}
+
+TerminalTabsMenu *
+terminal_tabs_menu_new (TerminalWindow *window)
+{
+	return TERMINAL_TABS_MENU (g_object_new (TERMINAL_TYPE_TABS_MENU,
+	                           "window", window,
+	                           NULL));
+}
+
+static void
+tab_set_action_accelerator (GtkActionGroup *action_group,
+                            GtkAction *action,
+                            guint tab_number,
+                            gboolean is_single_tab)
+{
+	if (!is_single_tab &&
+	        tab_number < TERMINAL_ACCELS_N_TABS_SWITCH)
+	{
+		char accel_path[ACCEL_PATH_FORMAT_LENGTH];
+
+		g_snprintf (accel_path, sizeof (accel_path), ACCEL_PATH_FORMAT, tab_number + 1);
+		G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+		gtk_action_set_accel_path (action, accel_path);
+	}
+	else
+	{
+		gtk_action_set_accel_path (action, NULL);
+		return;
+		G_GNUC_END_IGNORE_DEPRECATIONS;
+	}
+}
+
+static void
+terminal_tabs_menu_update (TerminalTabsMenu *menu)
+{
+	TerminalTabsMenuPrivate *p = menu->priv;
+	GtkUIManager *manager;
+	GtkAction *action;
+	GList *tabs = NULL, *l;
+	guint i = 0, n;
+	gboolean is_single_tab;
+	const char *verb;
+
+	terminal_tabs_menu_clean (menu);
+
+	tabs = terminal_window_list_screen_containers (p->window);
+
+	n = g_list_length (tabs);
+	if (n == 0) return;
+
+	is_single_tab = (n == 1);
+
+	manager =  GTK_UI_MANAGER (terminal_window_get_ui_manager (p->window));
+	p->ui_id = gtk_ui_manager_new_merge_id (manager);
+
+	for (l = tabs; l != NULL; l = l->next)
+	{
+		TerminalScreenContainer *container = TERMINAL_SCREEN_CONTAINER (l->data);
+		GObject *screen = G_OBJECT (terminal_screen_container_get_screen (container));
+
+		action = g_object_get_data (screen, DATA_KEY);
+		g_return_if_fail (action != NULL);
+
+		G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+		verb = gtk_action_get_name (action);
+		G_GNUC_END_IGNORE_DEPRECATIONS;
+
+		tab_set_action_accelerator (p->action_group, action, i++, is_single_tab);
+
+		gtk_ui_manager_add_ui (manager, p->ui_id,
+		                       UI_PATH,
+		                       verb, verb,
+		                       GTK_UI_MANAGER_MENUITEM, FALSE);
+	}
+
+	g_list_free (tabs);
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/57.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/57.html new file mode 100644 index 0000000..c8266bc --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/57.html @@ -0,0 +1,425 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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

+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-type-builtins.h"
+/* enumerations from "terminal-profile.h" */
+
+#include "terminal-profile.h"
+GType
+terminal_title_mode_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+ 
+  if (g_once_init_enter (&g_define_type_id__volatile)) {
+    static const GEnumValue values[] = {
+      { TERMINAL_TITLE_REPLACE, "TERMINAL_TITLE_REPLACE", "replace" },
+      { TERMINAL_TITLE_BEFORE, "TERMINAL_TITLE_BEFORE", "before" },
+      { TERMINAL_TITLE_AFTER, "TERMINAL_TITLE_AFTER", "after" },
+      { TERMINAL_TITLE_IGNORE, "TERMINAL_TITLE_IGNORE", "ignore" },
+      { 0, NULL, NULL }
+    };
+    GType g_define_type_id = \
+       g_enum_register_static (/* g_intern_static_string */ ("TerminalTitleMode"), values);
+      
+    g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+  }
+    
+  return g_define_type_id__volatile;
+}
+GType
+terminal_scrollbar_position_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+ 
+  if (g_once_init_enter (&g_define_type_id__volatile)) {
+    static const GEnumValue values[] = {
+      { TERMINAL_SCROLLBAR_LEFT, "TERMINAL_SCROLLBAR_LEFT", "left" },
+      { TERMINAL_SCROLLBAR_RIGHT, "TERMINAL_SCROLLBAR_RIGHT", "right" },
+      { TERMINAL_SCROLLBAR_HIDDEN, "TERMINAL_SCROLLBAR_HIDDEN", "hidden" },
+      { 0, NULL, NULL }
+    };
+    GType g_define_type_id = \
+       g_enum_register_static (/* g_intern_static_string */ ("TerminalScrollbarPosition"), values);
+      
+    g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+  }
+    
+  return g_define_type_id__volatile;
+}
+GType
+terminal_exit_action_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+ 
+  if (g_once_init_enter (&g_define_type_id__volatile)) {
+    static const GEnumValue values[] = {
+      { TERMINAL_EXIT_CLOSE, "TERMINAL_EXIT_CLOSE", "close" },
+      { TERMINAL_EXIT_RESTART, "TERMINAL_EXIT_RESTART", "restart" },
+      { TERMINAL_EXIT_HOLD, "TERMINAL_EXIT_HOLD", "hold" },
+      { 0, NULL, NULL }
+    };
+    GType g_define_type_id = \
+       g_enum_register_static (/* g_intern_static_string */ ("TerminalExitAction"), values);
+      
+    g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+  }
+    
+  return g_define_type_id__volatile;
+}
+GType
+terminal_background_type_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+ 
+  if (g_once_init_enter (&g_define_type_id__volatile)) {
+    static const GEnumValue values[] = {
+      { TERMINAL_BACKGROUND_SOLID, "TERMINAL_BACKGROUND_SOLID", "solid" },
+      { TERMINAL_BACKGROUND_IMAGE, "TERMINAL_BACKGROUND_IMAGE", "image" },
+      { TERMINAL_BACKGROUND_TRANSPARENT, "TERMINAL_BACKGROUND_TRANSPARENT", "transparent" },
+      { 0, NULL, NULL }
+    };
+    GType g_define_type_id = \
+       g_enum_register_static (/* g_intern_static_string */ ("TerminalBackgroundType"), values);
+      
+    g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+  }
+    
+  return g_define_type_id__volatile;
+}
+
+
+/* Generated data ends here */
+
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/58.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/58.html new file mode 100644 index 0000000..3589388 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/58.html @@ -0,0 +1,2431 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
   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
/*
+ * Copyright © 2001, 2002 Havoc Pennington
+ * Copyright © 2002 Red Hat, Inc.
+ * Copyright © 2002 Sun Microsystems
+ * Copyright © 2003 Mariano Suarez-Alvarez
+ * Copyright © 2008 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * Mate-terminal 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#define _GNU_SOURCE /* for strchrnul */
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <sys/types.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <X11/Xatom.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include "terminal-accels.h"
+#include "terminal-app.h"
+#include "terminal-intl.h"
+#include "terminal-util.h"
+#include "terminal-window.h"
+
+void
+terminal_util_set_unique_role (GtkWindow *window, const char *prefix)
+{
+	char *role;
+
+	role = g_strdup_printf ("%s-%d-%d-%" G_GINT64_FORMAT, prefix, getpid (), g_random_int (),
+	                        g_get_real_time () / G_USEC_PER_SEC);
+	gtk_window_set_role (window, role);
+	g_free (role);
+}
+
+/**
+ * terminal_util_show_error_dialog:
+ * @transient_parent: parent of the future dialog window;
+ * @weap_ptr: pointer to a #Widget pointer, to control the population.
+ * @error: a #GError, or %NULL
+ * @message_format: printf() style format string
+ *
+ * Create a #GtkMessageDialog window with the message, and present it, handling its buttons.
+ * If @weap_ptr is not #NULL, only create the dialog if <literal>*weap_ptr</literal> is #NULL
+ * (and in that * case, set @weap_ptr to be a weak pointer to the new dialog), otherwise just
+ * present <literal>*weak_ptr</literal>. Note that in this last case, the message <emph>will</emph>
+ * be changed.
+ */
+void
+terminal_util_show_error_dialog (GtkWindow *transient_parent,
+                                 GtkWidget **weak_ptr,
+                                 GError *error,
+                                 const char *message_format,
+                                 ...)
+{
+	char *message;
+	va_list args;
+
+	if (message_format)
+	{
+		va_start (args, message_format);
+		message = g_strdup_vprintf (message_format, args);
+		va_end (args);
+	}
+	else message = NULL;
+
+	if (weak_ptr == NULL || *weak_ptr == NULL)
+	{
+		GtkWidget *dialog;
+		dialog = gtk_message_dialog_new (transient_parent,
+		                                 GTK_DIALOG_DESTROY_WITH_PARENT,
+		                                 GTK_MESSAGE_ERROR,
+		                                 GTK_BUTTONS_OK,
+		                                 message ? "%s" : NULL,
+		                                 message);
+
+		if (error != NULL)
+			gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+			        "%s", error->message);
+
+		g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (gtk_widget_destroy), NULL);
+
+		if (weak_ptr != NULL)
+		{
+			*weak_ptr = dialog;
+			g_object_add_weak_pointer (G_OBJECT (dialog), (void**)weak_ptr);
+		}
+
+		gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+
+		gtk_widget_show_all (dialog);
+	}
+	else
+	{
+		g_return_if_fail (GTK_IS_MESSAGE_DIALOG (*weak_ptr));
+
+		/* Sucks that there's no direct accessor for "text" property */
+		g_object_set (G_OBJECT (*weak_ptr), "text", message, NULL);
+
+		gtk_window_present (GTK_WINDOW (*weak_ptr));
+	}
+
+	g_free (message);
+}
+
+void
+terminal_util_show_help (const char *topic,
+                         GtkWindow  *parent)
+{
+	GError *error = NULL;
+	char *url;
+
+	if (topic)
+	{
+		url = g_strdup_printf ("help:mate-terminal/%s", topic);
+	}
+	else
+	{
+		url = g_strdup ("help:mate-terminal");
+	}
+
+	if (!gtk_show_uri_on_window (GTK_WINDOW (parent), url, gtk_get_current_event_time (), &error))
+	{
+		terminal_util_show_error_dialog (GTK_WINDOW (parent), NULL, error,
+		                                 _("There was an error displaying help"));
+		g_error_free (error);
+	}
+
+	g_free (url);
+}
+
+/* sets accessible name and description for the widget */
+
+void
+terminal_util_set_atk_name_description (GtkWidget  *widget,
+                                        const char *name,
+                                        const char *desc)
+{
+	AtkObject *obj;
+
+	obj = gtk_widget_get_accessible (widget);
+
+	if (obj == NULL)
+	{
+		g_warning ("%s: for some reason widget has no GtkAccessible",
+		           G_STRFUNC);
+		return;
+	}
+
+	if (!GTK_IS_ACCESSIBLE (obj))
+		return; /* This means GAIL is not loaded so we have the NoOp accessible */
+
+	g_return_if_fail (GTK_IS_ACCESSIBLE (obj));
+	if (desc)
+		atk_object_set_description (obj, desc);
+	if (name)
+		atk_object_set_name (obj, name);
+}
+
+void
+terminal_util_open_url (GtkWidget *parent,
+                        const char *orig_url,
+                        TerminalURLFlavor flavor,
+                        guint32 user_time)
+{
+	GError *error = NULL;
+	char *uri;
+
+	g_return_if_fail (orig_url != NULL);
+
+	switch (flavor)
+	{
+	case FLAVOR_DEFAULT_TO_HTTP:
+		uri = g_strdup_printf ("http:%s", orig_url);
+		break;
+	case FLAVOR_EMAIL:
+		if (g_ascii_strncasecmp ("mailto:", orig_url, 7) != 0)
+			uri = g_strdup_printf ("mailto:%s", orig_url);
+		else
+			uri = g_strdup (orig_url);
+		break;
+	case FLAVOR_VOIP_CALL:
+	case FLAVOR_AS_IS:
+		uri = g_strdup (orig_url);
+		break;
+	case FLAVOR_SKEY:
+		/* shouldn't get this */
+	default:
+		uri = NULL;
+		g_assert_not_reached ();
+	}
+
+	if (!gtk_show_uri_on_window (GTK_WINDOW (parent), uri, user_time, &error))
+	{
+		terminal_util_show_error_dialog (GTK_WINDOW (parent), NULL, error,
+		                                 _("Could not open the address “%s”"),
+		                                 uri);
+
+		g_error_free (error);
+	}
+
+	g_free (uri);
+}
+
+/**
+ * terminal_util_resolve_relative_path:
+ * @path:
+ * @relative_path:
+ *
+ * Returns: a newly allocate string
+ */
+char *
+terminal_util_resolve_relative_path (const char *path,
+                                     const char *relative_path)
+{
+	GFile *file, *resolved_file;
+	char *resolved_path = NULL;
+
+	g_return_val_if_fail (relative_path != NULL, NULL);
+
+	if (path == NULL)
+		return g_strdup (relative_path);
+
+	file = g_file_new_for_path (path);
+	resolved_file = g_file_resolve_relative_path (file, relative_path);
+	g_object_unref (file);
+
+	if (resolved_file == NULL)
+		return NULL;
+
+	resolved_path = g_file_get_path (resolved_file);
+	g_object_unref (resolved_file);
+
+	return resolved_path;
+}
+
+/**
+ * terminal_util_transform_uris_to_quoted_fuse_paths:
+ * @uris:
+ *
+ * Transforms those URIs in @uris to shell-quoted paths that point to
+ * GIO fuse paths.
+ */
+void
+terminal_util_transform_uris_to_quoted_fuse_paths (char **uris)
+{
+	guint i;
+
+	if (!uris)
+		return;
+
+	for (i = 0; uris[i]; ++i)
+	{
+		GFile *file;
+		char *path;
+
+		file = g_file_new_for_uri (uris[i]);
+
+		if ((path = g_file_get_path (file)))
+		{
+			char *quoted;
+
+			quoted = g_shell_quote (path);
+			g_free (uris[i]);
+			g_free (path);
+
+			uris[i] = quoted;
+		}
+
+		g_object_unref (file);
+	}
+}
+
+char *
+terminal_util_concat_uris (char **uris,
+                           gsize *length)
+{
+	GString *string;
+	gsize len;
+	guint i;
+
+	len = 0;
+	for (i = 0; uris[i]; ++i)
+		len += strlen (uris[i]) + 1;
+
+	if (length)
+		*length = len;
+
+	string = g_string_sized_new (len + 1);
+	for (i = 0; uris[i]; ++i)
+	{
+		g_string_append (string, uris[i]);
+		g_string_append_c (string, ' ');
+	}
+
+	return g_string_free (string, FALSE);
+}
+
+char *
+terminal_util_get_licence_text (void)
+{
+	const gchar *license[] =
+	{
+		N_("MATE Terminal 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 3 of the License, or "
+		"(at your option) any later version."),
+		N_("MATE Terminal 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."),
+		N_("You should have received a copy of the GNU General Public License "
+		"along with MATE Terminal; if not, write to the Free Software Foundation, "
+		"Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA")
+	};
+
+	return g_strjoin ("\n\n", _(license[0]), _(license[1]), _(license[2]), NULL);
+}
+
+gboolean
+terminal_util_load_builder_resource (const char *path,
+                                 const char *object_name,
+                                 ...)
+{
+	GtkBuilder *builder;
+	GError *error = NULL;
+	va_list args;
+
+	builder = gtk_builder_new ();
+	gtk_builder_add_from_resource (builder, path, &error);
+	g_assert_no_error (error);
+
+	va_start (args, object_name);
+
+	while (object_name)
+	{
+		GObject **objectptr;
+
+		objectptr = va_arg (args, GObject**);
+		*objectptr = gtk_builder_get_object (builder, object_name);
+		if (!*objectptr)
+		{
+			g_warning ("Failed to fetch object \"%s\"\n", object_name);
+			break;
+		}
+
+		object_name = va_arg (args, const char*);
+	}
+
+	va_end (args);
+
+	g_object_unref (builder);
+	return object_name == NULL;
+}
+
+gboolean
+terminal_util_dialog_response_on_delete (GtkWindow *widget)
+{
+	gtk_dialog_response (GTK_DIALOG (widget), GTK_RESPONSE_DELETE_EVENT);
+	return TRUE;
+}
+
+/* Like g_key_file_set_string, but escapes characters so that
+ * the stored string is ASCII. Use when the input string may not
+ * be UTF-8.
+ */
+void
+terminal_util_key_file_set_string_escape (GKeyFile *key_file,
+        const char *group,
+        const char *key,
+        const char *string)
+{
+	char *escaped;
+
+	/* FIXMEchpe: be more intelligent and only escape characters that aren't UTF-8 */
+	escaped = g_strescape (string, NULL);
+	g_key_file_set_string (key_file, group, key, escaped);
+	g_free (escaped);
+}
+
+char *
+terminal_util_key_file_get_string_unescape (GKeyFile *key_file,
+        const char *group,
+        const char *key,
+        GError **error)
+{
+	char *escaped, *unescaped;
+
+	escaped = g_key_file_get_string (key_file, group, key, error);
+	if (!escaped)
+		return NULL;
+
+	unescaped = g_strcompress (escaped);
+	g_free (escaped);
+
+	return unescaped;
+}
+
+void
+terminal_util_key_file_set_argv (GKeyFile *key_file,
+                                 const char *group,
+                                 const char *key,
+                                 int argc,
+                                 char **argv)
+{
+	char **quoted_argv;
+	char *flat;
+	int i;
+
+	if (argc < 0)
+		argc = g_strv_length (argv);
+
+	quoted_argv = g_new (char*, argc + 1);
+	for (i = 0; i < argc; ++i)
+		quoted_argv[i] = g_shell_quote (argv[i]);
+	quoted_argv[argc] = NULL;
+
+	flat = g_strjoinv (" ", quoted_argv);
+	terminal_util_key_file_set_string_escape (key_file, group, key, flat);
+
+	g_free (flat);
+	g_strfreev (quoted_argv);
+}
+
+char **
+terminal_util_key_file_get_argv (GKeyFile *key_file,
+                                 const char *group,
+                                 const char *key,
+                                 int *argc,
+                                 GError **error)
+{
+	char **argv;
+	char *flat;
+	gboolean retval;
+
+	flat = terminal_util_key_file_get_string_unescape (key_file, group, key, error);
+	if (!flat)
+		return NULL;
+
+	retval = g_shell_parse_argv (flat, argc, &argv, error);
+	g_free (flat);
+
+	if (retval)
+		return argv;
+
+	return NULL;
+}
+
+/* Proxy stuff */
+
+static char *
+gsettings_get_string (GSettings *settings,
+                 const char *key)
+{
+	char *value;
+	value = g_settings_get_string (settings, key);
+	if (G_UNLIKELY (value && *value == '\0'))
+	{
+		g_free (value);
+		value = NULL;
+	}
+	return value;
+}
+
+/*
+ * set_proxy_env:
+ * @env_table: a #GHashTable
+ * @key: the env var name
+ * @value: the env var value
+ *
+ * Adds @value for @key to @env_table, taking care to never overwrite an
+ * existing value for @key. @value is consumed.
+ */
+static void
+set_proxy_env (GHashTable *env_table,
+               const char *key,
+               char *value)
+{
+	char *key1 = NULL, *key2 = NULL;
+	char *value1 = NULL, *value2 = NULL;
+
+	if (!value)
+		return;
+
+	if (g_hash_table_lookup (env_table, key) == NULL)
+		key1 = g_strdup (key);
+
+	key2 = g_ascii_strup (key, -1);
+	if (g_hash_table_lookup (env_table, key) != NULL)
+	{
+		g_free (key2);
+		key2 = NULL;
+	}
+
+	if (key1 && key2)
+	{
+		value1 = value;
+		value2 = g_strdup (value);
+	}
+	else if (key1)
+		value1 = value;
+	else if (key2)
+		value2 = value;
+	else
+		g_free (value);
+
+	if (key1)
+		g_hash_table_replace (env_table, key1, value1);
+	if (key2)
+		g_hash_table_replace (env_table, key2, value2);
+}
+
+static void
+setup_http_proxy_env (GHashTable *env_table,
+                      GSettings *settings_http)
+{
+	gchar *host;
+	gint port;
+
+	host = gsettings_get_string (settings_http, "host");
+	port = g_settings_get_int (settings_http, "port");
+	if (host && port)
+	{
+
+		GString *buf = g_string_sized_new (64);
+		g_string_append (buf, "http://");
+
+		if (g_settings_get_boolean (settings_http, "use-authentication"))
+		{
+			char *user, *password;
+			user = gsettings_get_string (settings_http, "authentication-user");
+			if (user)
+			{
+				g_string_append_uri_escaped (buf, user, NULL, TRUE);
+				password = gsettings_get_string (settings_http, "authentication-password");
+				if (password)
+				{
+					g_string_append_c (buf, ':');
+					g_string_append_uri_escaped (buf, password, NULL, TRUE);
+					g_free (password);
+				}
+				g_free (user);
+				g_string_append_c (buf, '@');
+			}
+		}
+		g_string_append_printf (buf, "%s:%d/", host, port);
+		set_proxy_env (env_table, "http_proxy", g_string_free (buf, FALSE));
+	}
+	g_free (host);
+
+}
+
+static void
+setup_ignore_host_env (GHashTable *env_table,
+                      GSettings *settings)
+{
+	gchar **ignore = g_settings_get_strv (settings, "ignore-hosts");
+	if (ignore == NULL)
+		return;
+
+	GString *buf = g_string_sized_new (64);
+	int i;
+
+	for (i = 0; ignore[i] != NULL; ++i)
+	{
+		if (buf->len)
+			g_string_append_c (buf, ',');
+		g_string_append (buf, ignore[i]);
+	}
+
+	set_proxy_env (env_table, "no_proxy", g_string_free (buf, FALSE));
+
+	g_strfreev(ignore);
+}
+
+static void
+setup_https_proxy_env (GHashTable *env_table,
+                       GSettings *settings_https)
+{
+	gchar *host;
+	gint port;
+
+	host = gsettings_get_string (settings_https, "host");
+	port = g_settings_get_int (settings_https, "port");
+	if (host && port)
+	{
+		char *proxy;
+		/* Even though it's https, the proxy scheme is 'http'. See bug #624440. */
+		proxy = g_strdup_printf ("http://%s:%d/", host, port);
+		set_proxy_env (env_table, "https_proxy", proxy);
+	}
+	g_free (host);
+}
+
+static void
+setup_ftp_proxy_env (GHashTable *env_table,
+                     GSettings *settings_ftp)
+{
+	gchar *host;
+	gint port;
+
+	host = gsettings_get_string (settings_ftp, "host");
+	port = g_settings_get_int (settings_ftp, "port");
+	if (host && port)
+	{
+		char *proxy;
+		/* Even though it's ftp, the proxy scheme is 'http'. See bug #624440. */
+		proxy = g_strdup_printf ("http://%s:%d/", host, port);
+		set_proxy_env (env_table, "ftp_proxy", proxy);
+	}
+	g_free (host);
+}
+
+static void
+setup_socks_proxy_env (GHashTable *env_table,
+                       GSettings *settings_socks)
+{
+	gchar *host;
+	gint port;
+
+	host = gsettings_get_string (settings_socks, "host");
+	port = g_settings_get_int (settings_socks, "port");
+	if (host && port)
+	{
+		char *proxy;
+		proxy = g_strdup_printf ("socks://%s:%d/", host, port);
+		set_proxy_env (env_table, "all_proxy", proxy);
+	}
+	g_free (host);
+}
+
+static void
+setup_autoconfig_proxy_env (GHashTable *env_table,
+                            GSettings *settings)
+{
+	/* XXX  Not sure what to do with this.  See bug #596688.
+	gchar *url;
+
+	url = gsettings_get_string (settings, "autoconfig-url");
+	if (url)
+	  {
+	    char *proxy;
+	    proxy = g_strdup_printf ("pac+%s", url);
+	    set_proxy_env (env_table, "http_proxy", proxy);
+	  }
+	g_free (url);
+	*/
+}
+
+/**
+ * terminal_util_add_proxy_env:
+ * @env_table: a #GHashTable
+ *
+ * Adds the proxy env variables to @env_table.
+ */
+void
+terminal_util_add_proxy_env (GHashTable *env_table)
+{
+	char *proxymode;
+	GSettings *settings = g_settings_new (CONF_PROXY_SCHEMA);
+	GSettings *settings_http = g_settings_new (CONF_HTTP_PROXY_SCHEMA);
+	GSettings *settings_https = g_settings_new (CONF_HTTPS_PROXY_SCHEMA);
+	GSettings *settings_ftp = g_settings_new (CONF_FTP_PROXY_SCHEMA);
+	GSettings *settings_socks = g_settings_new (CONF_SOCKS_PROXY_SCHEMA);
+
+	/* If mode is not manual, nothing to set */
+	proxymode = gsettings_get_string (settings, "mode");
+	if (proxymode && 0 == strcmp (proxymode, "manual"))
+	{
+		setup_http_proxy_env (env_table, settings_http);
+		setup_ignore_host_env (env_table, settings);
+		setup_https_proxy_env (env_table, settings_https);
+		setup_ftp_proxy_env (env_table, settings_ftp);
+		setup_socks_proxy_env (env_table, settings_socks);
+	}
+	else if (proxymode && 0 == strcmp (proxymode, "auto"))
+	{
+		setup_autoconfig_proxy_env (env_table, settings);
+	}
+
+	g_free (proxymode);
+	g_object_unref (settings);
+	g_object_unref (settings_http);
+	g_object_unref (settings_https);
+	g_object_unref (settings_ftp);
+	g_object_unref (settings_socks);
+}
+
+/**
+ * terminal_util_hyperlink_uri_label:
+ * @uri: a URI
+ *
+ * Formats @uri to be displayed in a tooltip.
+ * Performs URI-decoding and converts IDN hostname to UTF-8.
+ *
+ * Returns: (transfer full): The human readable URI as plain text
+ */
+char *terminal_util_hyperlink_uri_label (const char *uri)
+{
+	char *unesc = NULL;
+	gboolean replace_hostname;
+
+	if (uri == NULL)
+		return NULL;
+
+	unesc = g_uri_unescape_string(uri, NULL);
+	if (unesc == NULL)
+		unesc = g_strdup(uri);
+
+	if (g_ascii_strncasecmp(unesc, "ftp://", 6) == 0 ||
+		g_ascii_strncasecmp(unesc, "http://", 7) == 0 ||
+		g_ascii_strncasecmp(unesc, "https://", 8) == 0)
+	{
+		char *unidn = NULL;
+
+		char *hostname = strchr(unesc, '/') + 2;
+		char *hostname_end = strchrnul(hostname, '/');
+		char save = *hostname_end;
+		*hostname_end = '\0';
+		unidn = g_hostname_to_unicode(hostname);
+		replace_hostname = unidn != NULL && g_ascii_strcasecmp(unidn, hostname) != 0;
+		*hostname_end = save;
+		if (replace_hostname)
+		{
+			char *new_unesc = g_strdup_printf("%.*s%s%s",
+			                                  (int) (hostname - unesc),
+			                                  unesc,
+			                                  unidn,
+			                                  hostname_end);
+			g_free(unesc);
+			unesc = new_unesc;
+		}
+		g_free(unidn);
+	}
+	if (g_ascii_strncasecmp(unesc, "mailto:", 7) == 0)
+	{
+		const char *hostname = strchr(unesc, '@');
+		if (hostname != NULL)
+		{
+			const char *unidn = g_hostname_to_unicode(++hostname);
+			replace_hostname = unidn != NULL && g_ascii_strcasecmp(unidn, hostname) != 0;
+			if (replace_hostname)
+			{
+				char *new_unesc = g_strdup_printf("%.*s%s",
+				                                  (int) (hostname - unesc),
+				                                  unesc,
+				                                  unidn);
+				g_free(unesc);
+				unesc = new_unesc;
+			}
+			g_free(unidn);
+		}
+	}
+	return unesc;
+}
+
+/* Bidirectional object/widget binding */
+
+typedef struct
+{
+	GObject *object;
+	const char *object_prop;
+	GtkWidget *widget;
+	gulong object_notify_id;
+	gulong widget_notify_id;
+	PropertyChangeFlags flags;
+} PropertyChange;
+
+static void
+property_change_free (PropertyChange *change)
+{
+	g_signal_handler_disconnect (change->object, change->object_notify_id);
+
+	g_slice_free (PropertyChange, change);
+}
+
+static gboolean
+transform_boolean (gboolean input,
+                   PropertyChangeFlags flags)
+{
+	if (flags & FLAG_INVERT_BOOL)
+		input = !input;
+
+	return input;
+}
+
+static void
+object_change_notify_cb (PropertyChange *change)
+{
+	GObject *object = change->object;
+	const char *object_prop = change->object_prop;
+	GtkWidget *widget = change->widget;
+
+	g_signal_handler_block (widget, change->widget_notify_id);
+
+	if (GTK_IS_RADIO_BUTTON (widget))
+	{
+		int ovalue, rvalue;
+
+		g_object_get (object, object_prop, &ovalue, NULL);
+		rvalue = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "enum-value"));
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), ovalue == rvalue);
+	}
+	else if (GTK_IS_TOGGLE_BUTTON (widget))
+	{
+		gboolean enabled;
+
+		g_object_get (object, object_prop, &enabled, NULL);
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
+		                              transform_boolean (enabled, change->flags));
+	}
+	else if (GTK_IS_SPIN_BUTTON (widget))
+	{
+		int value;
+
+		g_object_get (object, object_prop, &value, NULL);
+		gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
+	}
+	else if (GTK_IS_ENTRY (widget))
+	{
+		char *text;
+
+		g_object_get (object, object_prop, &text, NULL);
+		gtk_entry_set_text (GTK_ENTRY (widget), text ? text : "");
+		g_free (text);
+	}
+	else if (GTK_IS_COMBO_BOX (widget))
+	{
+		int value;
+
+		g_object_get (object, object_prop, &value, NULL);
+		gtk_combo_box_set_active (GTK_COMBO_BOX (widget), value);
+	}
+	else if (GTK_IS_RANGE (widget))
+	{
+		double value;
+
+		g_object_get (object, object_prop, &value, NULL);
+		gtk_range_set_value (GTK_RANGE (widget), value);
+	}
+	else if (GTK_IS_COLOR_CHOOSER (widget))
+	{
+		GdkRGBA *color;
+		GdkRGBA old_color;
+
+		g_object_get (object, object_prop, &color, NULL);
+		gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (widget), &old_color);
+
+		if (color && !gdk_rgba_equal (color, &old_color))
+			gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (widget), color);
+		if (color)
+			gdk_rgba_free (color);
+	}
+	else if (GTK_IS_FONT_BUTTON (widget))
+	{
+		PangoFontDescription *font_desc;
+		char *font;
+
+		g_object_get (object, object_prop, &font_desc, NULL);
+		if (!font_desc)
+			goto out;
+
+		font = pango_font_description_to_string (font_desc);
+		gtk_font_button_set_font_name (GTK_FONT_BUTTON (widget), font);
+		g_free (font);
+		pango_font_description_free (font_desc);
+	}
+	else if (GTK_IS_FILE_CHOOSER (widget))
+	{
+		char *name = NULL, *filename = NULL;
+
+		g_object_get (object, object_prop, &name, NULL);
+		if (name)
+			filename = g_filename_from_utf8 (name, -1, NULL, NULL, NULL);
+
+		if (filename)
+			gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), filename);
+		else
+			gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (widget));
+		g_free (filename);
+		g_free (name);
+	}
+
+out:
+	g_signal_handler_unblock (widget, change->widget_notify_id);
+}
+
+static void
+widget_change_notify_cb (PropertyChange *change)
+{
+	GObject *object = change->object;
+	const char *object_prop = change->object_prop;
+	GtkWidget *widget = change->widget;
+
+	g_signal_handler_block (change->object, change->object_notify_id);
+
+	if (GTK_IS_RADIO_BUTTON (widget))
+	{
+		gboolean active;
+		int value;
+
+		active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+		if (!active)
+			goto out;
+
+		value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "enum-value"));
+		g_object_set (object, object_prop, value, NULL);
+	}
+	else if (GTK_IS_TOGGLE_BUTTON (widget))
+	{
+		gboolean enabled;
+
+		enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+		g_object_set (object, object_prop, transform_boolean (enabled, change->flags), NULL);
+	}
+	else if (GTK_IS_SPIN_BUTTON (widget))
+	{
+		gint value;
+
+		value = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
+		g_object_set (object, object_prop, value, NULL);
+	}
+	else if (GTK_IS_ENTRY (widget))
+	{
+		const char *text;
+
+		text = gtk_entry_get_text (GTK_ENTRY (widget));
+		g_object_set (object, object_prop, text, NULL);
+	}
+	else if (GTK_IS_COMBO_BOX (widget))
+	{
+		int value;
+
+		value = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
+		g_object_set (object, object_prop, value, NULL);
+	}
+	else if (GTK_IS_COLOR_CHOOSER (widget))
+	{
+		GdkRGBA color;
+
+		gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (widget), &color);
+		g_object_set (object, object_prop, &color, NULL);
+	}
+	else if (GTK_IS_FONT_BUTTON (widget))
+	{
+		PangoFontDescription *font_desc;
+		const char *font;
+
+		font = gtk_font_button_get_font_name (GTK_FONT_BUTTON (widget));
+		font_desc = pango_font_description_from_string (font);
+		g_object_set (object, object_prop, font_desc, NULL);
+		pango_font_description_free (font_desc);
+	}
+	else if (GTK_IS_RANGE (widget))
+	{
+		double value;
+
+		value = gtk_range_get_value (GTK_RANGE (widget));
+		g_object_set (object, object_prop, value, NULL);
+	}
+	else if (GTK_IS_FILE_CHOOSER (widget))
+	{
+		char *filename, *name = NULL;
+
+		filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
+		if (filename)
+			name = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+
+		g_object_set (object, object_prop, name, NULL);
+		g_free (filename);
+		g_free (name);
+	}
+
+out:
+	g_signal_handler_unblock (change->object, change->object_notify_id);
+}
+
+void
+terminal_util_bind_object_property_to_widget (GObject *object,
+        const char *object_prop,
+        GtkWidget *widget,
+        PropertyChangeFlags flags)
+{
+	PropertyChange *change;
+	const char *signal_name;
+	char notify_signal_name[64];
+
+	change = g_slice_new0 (PropertyChange);
+
+	change->widget = widget;
+	g_assert (g_object_get_data (G_OBJECT (widget), "GT:PCD") == NULL);
+	g_object_set_data_full (G_OBJECT (widget), "GT:PCD", change, (GDestroyNotify) property_change_free);
+
+	if (GTK_IS_TOGGLE_BUTTON (widget))
+		signal_name = "notify::active";
+	else if (GTK_IS_SPIN_BUTTON (widget))
+		signal_name = "notify::value";
+	else if (GTK_IS_ENTRY (widget))
+		signal_name = "notify::text";
+	else if (GTK_IS_COMBO_BOX (widget))
+		signal_name = "notify::active";
+	else if (GTK_IS_COLOR_CHOOSER (widget))
+		signal_name = "notify::color";
+	else if (GTK_IS_FONT_BUTTON (widget))
+		signal_name = "notify::font-name";
+	else if (GTK_IS_RANGE (widget))
+		signal_name = "value-changed";
+	else if (GTK_IS_FILE_CHOOSER_BUTTON (widget))
+		signal_name = "file-set";
+	else if (GTK_IS_FILE_CHOOSER (widget))
+		signal_name = "selection-changed";
+	else
+		g_assert_not_reached ();
+
+	change->widget_notify_id = g_signal_connect_swapped (widget, signal_name, G_CALLBACK (widget_change_notify_cb), change);
+
+	change->object = object;
+	change->flags = flags;
+	change->object_prop = object_prop;
+
+	g_snprintf (notify_signal_name, sizeof (notify_signal_name), "notify::%s", object_prop);
+	object_change_notify_cb (change);
+	change->object_notify_id = g_signal_connect_swapped (object, notify_signal_name, G_CALLBACK (object_change_notify_cb), change);
+}
+
+#ifdef GDK_WINDOWING_X11
+
+/* Asks the window manager to turn off the "demands attention" state on the window.
+ *
+ * This only works for windows that are currently window managed; if the window
+ * is unmapped (in the withdrawn state) it would be necessary to change _NET_WM_STATE
+ * directly.
+ */
+void
+terminal_util_x11_clear_demands_attention (GdkWindow *window)
+{
+
+	GdkScreen *screen = gdk_window_get_screen (window);
+	GdkDisplay *display = gdk_screen_get_display (screen);
+	XClientMessageEvent xclient;
+
+	memset (&xclient, 0, sizeof (xclient));
+	xclient.type = ClientMessage;
+	xclient.serial = 0;
+	xclient.send_event = True;
+	xclient.window = GDK_WINDOW_XID (window);
+	xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE");
+	xclient.format = 32;
+
+	xclient.data.l[0] = 0; /* _NET_WM_STATE_REMOVE */
+	xclient.data.l[1] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_DEMANDS_ATTENTION");
+	xclient.data.l[2] = 0;
+	xclient.data.l[3] = 0;
+	xclient.data.l[4] = 0;
+
+	XSendEvent (GDK_DISPLAY_XDISPLAY (display),
+	            GDK_WINDOW_XID (gdk_screen_get_root_window (screen)),
+	            False,
+	            SubstructureRedirectMask | SubstructureNotifyMask,
+	            (XEvent *)&xclient);
+}
+
+#endif /* GDK_WINDOWING_X11 */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/59.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/59.html new file mode 100644 index 0000000..4a87ca3 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/59.html @@ -0,0 +1,9575 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+1545
+1546
+1547
+1548
+1549
+1550
+1551
+1552
+1553
+1554
+1555
+1556
+1557
+1558
+1559
+1560
+1561
+1562
+1563
+1564
+1565
+1566
+1567
+1568
+1569
+1570
+1571
+1572
+1573
+1574
+1575
+1576
+1577
+1578
+1579
+1580
+1581
+1582
+1583
+1584
+1585
+1586
+1587
+1588
+1589
+1590
+1591
+1592
+1593
+1594
+1595
+1596
+1597
+1598
+1599
+1600
+1601
+1602
+1603
+1604
+1605
+1606
+1607
+1608
+1609
+1610
+1611
+1612
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+1631
+1632
+1633
+1634
+1635
+1636
+1637
+1638
+1639
+1640
+1641
+1642
+1643
+1644
+1645
+1646
+1647
+1648
+1649
+1650
+1651
+1652
+1653
+1654
+1655
+1656
+1657
+1658
+1659
+1660
+1661
+1662
+1663
+1664
+1665
+1666
+1667
+1668
+1669
+1670
+1671
+1672
+1673
+1674
+1675
+1676
+1677
+1678
+1679
+1680
+1681
+1682
+1683
+1684
+1685
+1686
+1687
+1688
+1689
+1690
+1691
+1692
+1693
+1694
+1695
+1696
+1697
+1698
+1699
+1700
+1701
+1702
+1703
+1704
+1705
+1706
+1707
+1708
+1709
+1710
+1711
+1712
+1713
+1714
+1715
+1716
+1717
+1718
+1719
+1720
+1721
+1722
+1723
+1724
+1725
+1726
+1727
+1728
+1729
+1730
+1731
+1732
+1733
+1734
+1735
+1736
+1737
+1738
+1739
+1740
+1741
+1742
+1743
+1744
+1745
+1746
+1747
+1748
+1749
+1750
+1751
+1752
+1753
+1754
+1755
+1756
+1757
+1758
+1759
+1760
+1761
+1762
+1763
+1764
+1765
+1766
+1767
+1768
+1769
+1770
+1771
+1772
+1773
+1774
+1775
+1776
+1777
+1778
+1779
+1780
+1781
+1782
+1783
+1784
+1785
+1786
+1787
+1788
+1789
+1790
+1791
+1792
+1793
+1794
+1795
+1796
+1797
+1798
+1799
+1800
+1801
+1802
+1803
+1804
+1805
+1806
+1807
+1808
+1809
+1810
+1811
+1812
+1813
+1814
+1815
+1816
+1817
+1818
+1819
+1820
+1821
+1822
+1823
+1824
+1825
+1826
+1827
+1828
+1829
+1830
+1831
+1832
+1833
+1834
+1835
+1836
+1837
+1838
+1839
+1840
+1841
+1842
+1843
+1844
+1845
+1846
+1847
+1848
+1849
+1850
+1851
+1852
+1853
+1854
+1855
+1856
+1857
+1858
+1859
+1860
+1861
+1862
+1863
+1864
+1865
+1866
+1867
+1868
+1869
+1870
+1871
+1872
+1873
+1874
+1875
+1876
+1877
+1878
+1879
+1880
+1881
+1882
+1883
+1884
+1885
+1886
+1887
+1888
+1889
+1890
+1891
+1892
+1893
+1894
+1895
+1896
+1897
+1898
+1899
+1900
+1901
+1902
+1903
+1904
+1905
+1906
+1907
+1908
+1909
+1910
+1911
+1912
+1913
+1914
+1915
+1916
+1917
+1918
+1919
+1920
+1921
+1922
+1923
+1924
+1925
+1926
+1927
+1928
+1929
+1930
+1931
+1932
+1933
+1934
+1935
+1936
+1937
+1938
+1939
+1940
+1941
+1942
+1943
+1944
+1945
+1946
+1947
+1948
+1949
+1950
+1951
+1952
+1953
+1954
+1955
+1956
+1957
+1958
+1959
+1960
+1961
+1962
+1963
+1964
+1965
+1966
+1967
+1968
+1969
+1970
+1971
+1972
+1973
+1974
+1975
+1976
+1977
+1978
+1979
+1980
+1981
+1982
+1983
+1984
+1985
+1986
+1987
+1988
+1989
+1990
+1991
+1992
+1993
+1994
+1995
+1996
+1997
+1998
+1999
+2000
+2001
+2002
+2003
+2004
+2005
+2006
+2007
+2008
+2009
+2010
+2011
+2012
+2013
+2014
+2015
+2016
+2017
+2018
+2019
+2020
+2021
+2022
+2023
+2024
+2025
+2026
+2027
+2028
+2029
+2030
+2031
+2032
+2033
+2034
+2035
+2036
+2037
+2038
+2039
+2040
+2041
+2042
+2043
+2044
+2045
+2046
+2047
+2048
+2049
+2050
+2051
+2052
+2053
+2054
+2055
+2056
+2057
+2058
+2059
+2060
+2061
+2062
+2063
+2064
+2065
+2066
+2067
+2068
+2069
+2070
+2071
+2072
+2073
+2074
+2075
+2076
+2077
+2078
+2079
+2080
+2081
+2082
+2083
+2084
+2085
+2086
+2087
+2088
+2089
+2090
+2091
+2092
+2093
+2094
+2095
+2096
+2097
+2098
+2099
+2100
+2101
+2102
+2103
+2104
+2105
+2106
+2107
+2108
+2109
+2110
+2111
+2112
+2113
+2114
+2115
+2116
+2117
+2118
+2119
+2120
+2121
+2122
+2123
+2124
+2125
+2126
+2127
+2128
+2129
+2130
+2131
+2132
+2133
+2134
+2135
+2136
+2137
+2138
+2139
+2140
+2141
+2142
+2143
+2144
+2145
+2146
+2147
+2148
+2149
+2150
+2151
+2152
+2153
+2154
+2155
+2156
+2157
+2158
+2159
+2160
+2161
+2162
+2163
+2164
+2165
+2166
+2167
+2168
+2169
+2170
+2171
+2172
+2173
+2174
+2175
+2176
+2177
+2178
+2179
+2180
+2181
+2182
+2183
+2184
+2185
+2186
+2187
+2188
+2189
+2190
+2191
+2192
+2193
+2194
+2195
+2196
+2197
+2198
+2199
+2200
+2201
+2202
+2203
+2204
+2205
+2206
+2207
+2208
+2209
+2210
+2211
+2212
+2213
+2214
+2215
+2216
+2217
+2218
+2219
+2220
+2221
+2222
+2223
+2224
+2225
+2226
+2227
+2228
+2229
+2230
+2231
+2232
+2233
+2234
+2235
+2236
+2237
+2238
+2239
+2240
+2241
+2242
+2243
+2244
+2245
+2246
+2247
+2248
+2249
+2250
+2251
+2252
+2253
+2254
+2255
+2256
+2257
+2258
+2259
+2260
+2261
+2262
+2263
+2264
+2265
+2266
+2267
+2268
+2269
+2270
+2271
+2272
+2273
+2274
+2275
+2276
+2277
+2278
+2279
+2280
+2281
+2282
+2283
+2284
+2285
+2286
+2287
+2288
+2289
+2290
+2291
+2292
+2293
+2294
+2295
+2296
+2297
+2298
+2299
+2300
+2301
+2302
+2303
+2304
+2305
+2306
+2307
+2308
+2309
+2310
+2311
+2312
+2313
+2314
+2315
+2316
+2317
+2318
+2319
+2320
+2321
+2322
+2323
+2324
+2325
+2326
+2327
+2328
+2329
+2330
+2331
+2332
+2333
+2334
+2335
+2336
+2337
+2338
+2339
+2340
+2341
+2342
+2343
+2344
+2345
+2346
+2347
+2348
+2349
+2350
+2351
+2352
+2353
+2354
+2355
+2356
+2357
+2358
+2359
+2360
+2361
+2362
+2363
+2364
+2365
+2366
+2367
+2368
+2369
+2370
+2371
+2372
+2373
+2374
+2375
+2376
+2377
+2378
+2379
+2380
+2381
+2382
+2383
+2384
+2385
+2386
+2387
+2388
+2389
+2390
+2391
+2392
+2393
+2394
+2395
+2396
+2397
+2398
+2399
+2400
+2401
+2402
+2403
+2404
+2405
+2406
+2407
+2408
+2409
+2410
+2411
+2412
+2413
+2414
+2415
+2416
+2417
+2418
+2419
+2420
+2421
+2422
+2423
+2424
+2425
+2426
+2427
+2428
+2429
+2430
+2431
+2432
+2433
+2434
+2435
+2436
+2437
+2438
+2439
+2440
+2441
+2442
+2443
+2444
+2445
+2446
+2447
+2448
+2449
+2450
+2451
+2452
+2453
+2454
+2455
+2456
+2457
+2458
+2459
+2460
+2461
+2462
+2463
+2464
+2465
+2466
+2467
+2468
+2469
+2470
+2471
+2472
+2473
+2474
+2475
+2476
+2477
+2478
+2479
+2480
+2481
+2482
+2483
+2484
+2485
+2486
+2487
+2488
+2489
+2490
+2491
+2492
+2493
+2494
+2495
+2496
+2497
+2498
+2499
+2500
+2501
+2502
+2503
+2504
+2505
+2506
+2507
+2508
+2509
+2510
+2511
+2512
+2513
+2514
+2515
+2516
+2517
+2518
+2519
+2520
+2521
+2522
+2523
+2524
+2525
+2526
+2527
+2528
+2529
+2530
+2531
+2532
+2533
+2534
+2535
+2536
+2537
+2538
+2539
+2540
+2541
+2542
+2543
+2544
+2545
+2546
+2547
+2548
+2549
+2550
+2551
+2552
+2553
+2554
+2555
+2556
+2557
+2558
+2559
+2560
+2561
+2562
+2563
+2564
+2565
+2566
+2567
+2568
+2569
+2570
+2571
+2572
+2573
+2574
+2575
+2576
+2577
+2578
+2579
+2580
+2581
+2582
+2583
+2584
+2585
+2586
+2587
+2588
+2589
+2590
+2591
+2592
+2593
+2594
+2595
+2596
+2597
+2598
+2599
+2600
+2601
+2602
+2603
+2604
+2605
+2606
+2607
+2608
+2609
+2610
+2611
+2612
+2613
+2614
+2615
+2616
+2617
+2618
+2619
+2620
+2621
+2622
+2623
+2624
+2625
+2626
+2627
+2628
+2629
+2630
+2631
+2632
+2633
+2634
+2635
+2636
+2637
+2638
+2639
+2640
+2641
+2642
+2643
+2644
+2645
+2646
+2647
+2648
+2649
+2650
+2651
+2652
+2653
+2654
+2655
+2656
+2657
+2658
+2659
+2660
+2661
+2662
+2663
+2664
+2665
+2666
+2667
+2668
+2669
+2670
+2671
+2672
+2673
+2674
+2675
+2676
+2677
+2678
+2679
+2680
+2681
+2682
+2683
+2684
+2685
+2686
+2687
+2688
+2689
+2690
+2691
+2692
+2693
+2694
+2695
+2696
+2697
+2698
+2699
+2700
+2701
+2702
+2703
+2704
+2705
+2706
+2707
+2708
+2709
+2710
+2711
+2712
+2713
+2714
+2715
+2716
+2717
+2718
+2719
+2720
+2721
+2722
+2723
+2724
+2725
+2726
+2727
+2728
+2729
+2730
+2731
+2732
+2733
+2734
+2735
+2736
+2737
+2738
+2739
+2740
+2741
+2742
+2743
+2744
+2745
+2746
+2747
+2748
+2749
+2750
+2751
+2752
+2753
+2754
+2755
+2756
+2757
+2758
+2759
+2760
+2761
+2762
+2763
+2764
+2765
+2766
+2767
+2768
+2769
+2770
+2771
+2772
+2773
+2774
+2775
+2776
+2777
+2778
+2779
+2780
+2781
+2782
+2783
+2784
+2785
+2786
+2787
+2788
+2789
+2790
+2791
+2792
+2793
+2794
+2795
+2796
+2797
+2798
+2799
+2800
+2801
+2802
+2803
+2804
+2805
+2806
+2807
+2808
+2809
+2810
+2811
+2812
+2813
+2814
+2815
+2816
+2817
+2818
+2819
+2820
+2821
+2822
+2823
+2824
+2825
+2826
+2827
+2828
+2829
+2830
+2831
+2832
+2833
+2834
+2835
+2836
+2837
+2838
+2839
+2840
+2841
+2842
+2843
+2844
+2845
+2846
+2847
+2848
+2849
+2850
+2851
+2852
+2853
+2854
+2855
+2856
+2857
+2858
+2859
+2860
+2861
+2862
+2863
+2864
+2865
+2866
+2867
+2868
+2869
+2870
+2871
+2872
+2873
+2874
+2875
+2876
+2877
+2878
+2879
+2880
+2881
+2882
+2883
+2884
+2885
+2886
+2887
+2888
+2889
+2890
+2891
+2892
+2893
+2894
+2895
+2896
+2897
+2898
+2899
+2900
+2901
+2902
+2903
+2904
+2905
+2906
+2907
+2908
+2909
+2910
+2911
+2912
+2913
+2914
+2915
+2916
+2917
+2918
+2919
+2920
+2921
+2922
+2923
+2924
+2925
+2926
+2927
+2928
+2929
+2930
+2931
+2932
+2933
+2934
+2935
+2936
+2937
+2938
+2939
+2940
+2941
+2942
+2943
+2944
+2945
+2946
+2947
+2948
+2949
+2950
+2951
+2952
+2953
+2954
+2955
+2956
+2957
+2958
+2959
+2960
+2961
+2962
+2963
+2964
+2965
+2966
+2967
+2968
+2969
+2970
+2971
+2972
+2973
+2974
+2975
+2976
+2977
+2978
+2979
+2980
+2981
+2982
+2983
+2984
+2985
+2986
+2987
+2988
+2989
+2990
+2991
+2992
+2993
+2994
+2995
+2996
+2997
+2998
+2999
+3000
+3001
+3002
+3003
+3004
+3005
+3006
+3007
+3008
+3009
+3010
+3011
+3012
+3013
+3014
+3015
+3016
+3017
+3018
+3019
+3020
+3021
+3022
+3023
+3024
+3025
+3026
+3027
+3028
+3029
+3030
+3031
+3032
+3033
+3034
+3035
+3036
+3037
+3038
+3039
+3040
+3041
+3042
+3043
+3044
+3045
+3046
+3047
+3048
+3049
+3050
+3051
+3052
+3053
+3054
+3055
+3056
+3057
+3058
+3059
+3060
+3061
+3062
+3063
+3064
+3065
+3066
+3067
+3068
+3069
+3070
+3071
+3072
+3073
+3074
+3075
+3076
+3077
+3078
+3079
+3080
+3081
+3082
+3083
+3084
+3085
+3086
+3087
+3088
+3089
+3090
+3091
+3092
+3093
+3094
+3095
+3096
+3097
+3098
+3099
+3100
+3101
+3102
+3103
+3104
+3105
+3106
+3107
+3108
+3109
+3110
+3111
+3112
+3113
+3114
+3115
+3116
+3117
+3118
+3119
+3120
+3121
+3122
+3123
+3124
+3125
+3126
+3127
+3128
+3129
+3130
+3131
+3132
+3133
+3134
+3135
+3136
+3137
+3138
+3139
+3140
+3141
+3142
+3143
+3144
+3145
+3146
+3147
+3148
+3149
+3150
+3151
+3152
+3153
+3154
+3155
+3156
+3157
+3158
+3159
+3160
+3161
+3162
+3163
+3164
+3165
+3166
+3167
+3168
+3169
+3170
+3171
+3172
+3173
+3174
+3175
+3176
+3177
+3178
+3179
+3180
+3181
+3182
+3183
+3184
+3185
+3186
+3187
+3188
+3189
+3190
+3191
+3192
+3193
+3194
+3195
+3196
+3197
+3198
+3199
+3200
+3201
+3202
+3203
+3204
+3205
+3206
+3207
+3208
+3209
+3210
+3211
+3212
+3213
+3214
+3215
+3216
+3217
+3218
+3219
+3220
+3221
+3222
+3223
+3224
+3225
+3226
+3227
+3228
+3229
+3230
+3231
+3232
+3233
+3234
+3235
+3236
+3237
+3238
+3239
+3240
+3241
+3242
+3243
+3244
+3245
+3246
+3247
+3248
+3249
+3250
+3251
+3252
+3253
+3254
+3255
+3256
+3257
+3258
+3259
+3260
+3261
+3262
+3263
+3264
+3265
+3266
+3267
+3268
+3269
+3270
+3271
+3272
+3273
+3274
+3275
+3276
+3277
+3278
+3279
+3280
+3281
+3282
+3283
+3284
+3285
+3286
+3287
+3288
+3289
+3290
+3291
+3292
+3293
+3294
+3295
+3296
+3297
+3298
+3299
+3300
+3301
+3302
+3303
+3304
+3305
+3306
+3307
+3308
+3309
+3310
+3311
+3312
+3313
+3314
+3315
+3316
+3317
+3318
+3319
+3320
+3321
+3322
+3323
+3324
+3325
+3326
+3327
+3328
+3329
+3330
+3331
+3332
+3333
+3334
+3335
+3336
+3337
+3338
+3339
+3340
+3341
+3342
+3343
+3344
+3345
+3346
+3347
+3348
+3349
+3350
+3351
+3352
+3353
+3354
+3355
+3356
+3357
+3358
+3359
+3360
+3361
+3362
+3363
+3364
+3365
+3366
+3367
+3368
+3369
+3370
+3371
+3372
+3373
+3374
+3375
+3376
+3377
+3378
+3379
+3380
+3381
+3382
+3383
+3384
+3385
+3386
+3387
+3388
+3389
+3390
+3391
+3392
+3393
+3394
+3395
+3396
+3397
+3398
+3399
+3400
+3401
+3402
+3403
+3404
+3405
+3406
+3407
+3408
+3409
+3410
+3411
+3412
+3413
+3414
+3415
+3416
+3417
+3418
+3419
+3420
+3421
+3422
+3423
+3424
+3425
+3426
+3427
+3428
+3429
+3430
+3431
+3432
+3433
+3434
+3435
+3436
+3437
+3438
+3439
+3440
+3441
+3442
+3443
+3444
+3445
+3446
+3447
+3448
+3449
+3450
+3451
+3452
+3453
+3454
+3455
+3456
+3457
+3458
+3459
+3460
+3461
+3462
+3463
+3464
+3465
+3466
+3467
+3468
+3469
+3470
+3471
+3472
+3473
+3474
+3475
+3476
+3477
+3478
+3479
+3480
+3481
+3482
+3483
+3484
+3485
+3486
+3487
+3488
+3489
+3490
+3491
+3492
+3493
+3494
+3495
+3496
+3497
+3498
+3499
+3500
+3501
+3502
+3503
+3504
+3505
+3506
+3507
+3508
+3509
+3510
+3511
+3512
+3513
+3514
+3515
+3516
+3517
+3518
+3519
+3520
+3521
+3522
+3523
+3524
+3525
+3526
+3527
+3528
+3529
+3530
+3531
+3532
+3533
+3534
+3535
+3536
+3537
+3538
+3539
+3540
+3541
+3542
+3543
+3544
+3545
+3546
+3547
+3548
+3549
+3550
+3551
+3552
+3553
+3554
+3555
+3556
+3557
+3558
+3559
+3560
+3561
+3562
+3563
+3564
+3565
+3566
+3567
+3568
+3569
+3570
+3571
+3572
+3573
+3574
+3575
+3576
+3577
+3578
+3579
+3580
+3581
+3582
+3583
+3584
+3585
+3586
+3587
+3588
+3589
+3590
+3591
+3592
+3593
+3594
+3595
+3596
+3597
+3598
+3599
+3600
+3601
+3602
+3603
+3604
+3605
+3606
+3607
+3608
+3609
+3610
+3611
+3612
+3613
+3614
+3615
+3616
+3617
+3618
+3619
+3620
+3621
+3622
+3623
+3624
+3625
+3626
+3627
+3628
+3629
+3630
+3631
+3632
+3633
+3634
+3635
+3636
+3637
+3638
+3639
+3640
+3641
+3642
+3643
+3644
+3645
+3646
+3647
+3648
+3649
+3650
+3651
+3652
+3653
+3654
+3655
+3656
+3657
+3658
+3659
+3660
+3661
+3662
+3663
+3664
+3665
+3666
+3667
+3668
+3669
+3670
+3671
+3672
+3673
+3674
+3675
+3676
+3677
+3678
+3679
+3680
+3681
+3682
+3683
+3684
+3685
+3686
+3687
+3688
+3689
+3690
+3691
+3692
+3693
+3694
+3695
+3696
+3697
+3698
+3699
+3700
+3701
+3702
+3703
+3704
+3705
+3706
+3707
+3708
+3709
+3710
+3711
+3712
+3713
+3714
+3715
+3716
+3717
+3718
+3719
+3720
+3721
+3722
+3723
+3724
+3725
+3726
+3727
+3728
+3729
+3730
+3731
+3732
+3733
+3734
+3735
+3736
+3737
+3738
+3739
+3740
+3741
+3742
+3743
+3744
+3745
+3746
+3747
+3748
+3749
+3750
+3751
+3752
+3753
+3754
+3755
+3756
+3757
+3758
+3759
+3760
+3761
+3762
+3763
+3764
+3765
+3766
+3767
+3768
+3769
+3770
+3771
+3772
+3773
+3774
+3775
+3776
+3777
+3778
+3779
+3780
+3781
+3782
+3783
+3784
+3785
+3786
+3787
+3788
+3789
+3790
+3791
+3792
+3793
+3794
+3795
+3796
+3797
+3798
+3799
+3800
+3801
+3802
+3803
+3804
+3805
+3806
+3807
+3808
+3809
+3810
+3811
+3812
+3813
+3814
+3815
+3816
+3817
+3818
+3819
+3820
+3821
+3822
+3823
+3824
+3825
+3826
+3827
+3828
+3829
+3830
+3831
+3832
+3833
+3834
+3835
+3836
+3837
+3838
+3839
+3840
+3841
+3842
+3843
+3844
+3845
+3846
+3847
+3848
+3849
+3850
+3851
+3852
+3853
+3854
+3855
+3856
+3857
+3858
+3859
+3860
+3861
+3862
+3863
+3864
+3865
+3866
+3867
+3868
+3869
+3870
+3871
+3872
+3873
+3874
+3875
+3876
+3877
+3878
+3879
+3880
+3881
+3882
+3883
+3884
+3885
+3886
+3887
+3888
+3889
+3890
+3891
+3892
+3893
+3894
+3895
+3896
+3897
+3898
+3899
+3900
+3901
+3902
+3903
+3904
+3905
+3906
+3907
+3908
+3909
+3910
+3911
+3912
+3913
+3914
+3915
+3916
+3917
+3918
+3919
+3920
+3921
+3922
+3923
+3924
+3925
+3926
+3927
+3928
+3929
+3930
+3931
+3932
+3933
+3934
+3935
+3936
+3937
+3938
+3939
+3940
+3941
+3942
+3943
+3944
+3945
+3946
+3947
+3948
+3949
+3950
+3951
+3952
+3953
+3954
+3955
+3956
+3957
+3958
+3959
+3960
+3961
+3962
+3963
+3964
+3965
+3966
+3967
+3968
+3969
+3970
+3971
+3972
+3973
+3974
+3975
+3976
+3977
+3978
+3979
+3980
+3981
+3982
+3983
+3984
+3985
+3986
+3987
+3988
+3989
+3990
+3991
+3992
+3993
+3994
+3995
+3996
+3997
+3998
+3999
+4000
+4001
+4002
+4003
+4004
+4005
+4006
+4007
+4008
+4009
+4010
+4011
+4012
+4013
+4014
+4015
+4016
+4017
+4018
+4019
+4020
+4021
+4022
+4023
+4024
+4025
+4026
+4027
+4028
+4029
+4030
+4031
+4032
+4033
+4034
+4035
+4036
+4037
+4038
+4039
+4040
+4041
+4042
+4043
+4044
+4045
+4046
+4047
+4048
+4049
+4050
+4051
+4052
+4053
+4054
+4055
+4056
+4057
+4058
+4059
+4060
+4061
+4062
+4063
+4064
+4065
+4066
+4067
+4068
+4069
+4070
+4071
+4072
+4073
+4074
+4075
+4076
+4077
+4078
+4079
+4080
+4081
+4082
+4083
+4084
+4085
+4086
+4087
+4088
+4089
+4090
+4091
+4092
+4093
+4094
+4095
+4096
+4097
+4098
+4099
+4100
+4101
+4102
+4103
+4104
+4105
+4106
+4107
+4108
+4109
+4110
+4111
+4112
+4113
+4114
+4115
+4116
+4117
+4118
+4119
+4120
+4121
+4122
+4123
+4124
+4125
+4126
+4127
+4128
+4129
+4130
+4131
+4132
+4133
+4134
+4135
+4136
+4137
+4138
+4139
+4140
+4141
+4142
+4143
+4144
+4145
+4146
+4147
+4148
+4149
+4150
+4151
+4152
+4153
+4154
+4155
+4156
+4157
+4158
+4159
+4160
+4161
+4162
+4163
+4164
+4165
+4166
+4167
+4168
+4169
+4170
+4171
+4172
+4173
+4174
+4175
+4176
+4177
+4178
+4179
+4180
+4181
+4182
+4183
+4184
+4185
+4186
+4187
+4188
+4189
+4190
+4191
+4192
+4193
+4194
+4195
+4196
+4197
+4198
+4199
+4200
+4201
+4202
+4203
+4204
+4205
+4206
+4207
+4208
+4209
+4210
+4211
+4212
+4213
+4214
+4215
+4216
+4217
+4218
+4219
+4220
+4221
+4222
+4223
+4224
+4225
+4226
+4227
+4228
+4229
+4230
+4231
+4232
+4233
+4234
+4235
+4236
+4237
+4238
+4239
+4240
+4241
+4242
+4243
+4244
+4245
+4246
+4247
+4248
+4249
+4250
+4251
+4252
+4253
+4254
+4255
+4256
+4257
+4258
+4259
+4260
+4261
+4262
+4263
+4264
+4265
+4266
+4267
+4268
+4269
+4270
+4271
+4272
+4273
+4274
+4275
+4276
+4277
+4278
+4279
+4280
+4281
+4282
+4283
+4284
+4285
+4286
+4287
+4288
+4289
+4290
+4291
+4292
+4293
+4294
+4295
+4296
+4297
+4298
+4299
+4300
+4301
+4302
+4303
+4304
+4305
+4306
+4307
+4308
+4309
+4310
+4311
+4312
+4313
+4314
+4315
+4316
+4317
+4318
+4319
+4320
+4321
+4322
+4323
+4324
+4325
+4326
+4327
+4328
+4329
+4330
+4331
+4332
+4333
+4334
+4335
+4336
+4337
+4338
+4339
+4340
+4341
+4342
+4343
+4344
+4345
+4346
+4347
+4348
+4349
+4350
+4351
+4352
+4353
+4354
+4355
+4356
+4357
+4358
+4359
+4360
+4361
+4362
+4363
+4364
+4365
+4366
+4367
+4368
+4369
+4370
+4371
+4372
+4373
+4374
+4375
+4376
+4377
+4378
+4379
+4380
+4381
+4382
+4383
+4384
+4385
+4386
+4387
+4388
+4389
+4390
+4391
+4392
+4393
+4394
+4395
+4396
+4397
+4398
+4399
+4400
+4401
+4402
+4403
+4404
+4405
+4406
+4407
+4408
+4409
+4410
+4411
+4412
+4413
+4414
+4415
+4416
+4417
+4418
+4419
+4420
+4421
+4422
+4423
+4424
+4425
+4426
+4427
+4428
+4429
+4430
+4431
+4432
+4433
+4434
+4435
+4436
+4437
+4438
+4439
+4440
+4441
+4442
+4443
+4444
+4445
+4446
+4447
+4448
+4449
+4450
+4451
+4452
+4453
+4454
+4455
+4456
+4457
+4458
+4459
+4460
+4461
+4462
+4463
+4464
+4465
+4466
+4467
+4468
+4469
+4470
+4471
+4472
+4473
+4474
+4475
+4476
+4477
+4478
+4479
+4480
+4481
+4482
+4483
+4484
+4485
+4486
+4487
+4488
+4489
+4490
+4491
+4492
+4493
+4494
+4495
+4496
+4497
+4498
+4499
+4500
+4501
+4502
+4503
+4504
+4505
+4506
+4507
+4508
+4509
+4510
+4511
+4512
+4513
+4514
+4515
+4516
+4517
+4518
+4519
+4520
+4521
+4522
+4523
+4524
+4525
+4526
+4527
+4528
+4529
+4530
+4531
+4532
+4533
+4534
+4535
+4536
+4537
+4538
+4539
+4540
+4541
+4542
+4543
+4544
+4545
+4546
+4547
+4548
+4549
+4550
+4551
+4552
+4553
+4554
+4555
+4556
+4557
+4558
+4559
+4560
+4561
+4562
+4563
+4564
+4565
+4566
+4567
+4568
+4569
+4570
+4571
+4572
+4573
+4574
+4575
+4576
+4577
+4578
+4579
+4580
+4581
+4582
+4583
+4584
+4585
+4586
+4587
+4588
+4589
+4590
+4591
+4592
+4593
+4594
+4595
+4596
+4597
+4598
+4599
+4600
+4601
+4602
+4603
+4604
+4605
+4606
+4607
+4608
+4609
+4610
+4611
+4612
+4613
+4614
+4615
+4616
+4617
+4618
+4619
+4620
+4621
+4622
+4623
+4624
+4625
+4626
+4627
+4628
+4629
+4630
+4631
+4632
+4633
+4634
+4635
+4636
+4637
+4638
+4639
+4640
+4641
+4642
+4643
+4644
+4645
+4646
+4647
+4648
+4649
+4650
+4651
+4652
+4653
+4654
+4655
+4656
+4657
+4658
+4659
+4660
+4661
+4662
+4663
+4664
+4665
+4666
+4667
+4668
+4669
/*
+ * Copyright © 2001 Havoc Pennington
+ * Copyright © 2002 Red Hat, Inc.
+ * Copyright © 2007, 2008, 2009 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * Mate-terminal 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+#include <gdk/gdkkeysyms.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "terminal-accels.h"
+#include "terminal-app.h"
+#include "terminal-debug.h"
+#include "terminal-encoding.h"
+#include "terminal-intl.h"
+#include "terminal-screen-container.h"
+#include "terminal-search-dialog.h"
+#include "terminal-tab-label.h"
+#include "terminal-tabs-menu.h"
+#include "terminal-util.h"
+#include "terminal-window.h"
+
+#ifdef ENABLE_SKEY
+#include "skey-popup.h"
+#endif
+
+static gboolean detach_tab = FALSE;
+
+struct _TerminalWindowPrivate
+{
+    GtkActionGroup *action_group;
+    GtkUIManager *ui_manager;
+    guint ui_id;
+
+    GtkActionGroup *profiles_action_group;
+    guint profiles_ui_id;
+
+    GtkActionGroup *encodings_action_group;
+    guint encodings_ui_id;
+
+    TerminalTabsMenu *tabs_menu;
+
+    TerminalScreenPopupInfo *popup_info;
+    guint remove_popup_info_idle;
+
+    GtkActionGroup *new_terminal_action_group;
+    guint new_terminal_ui_id;
+
+    GtkWidget *menubar;
+    GtkWidget *notebook;
+    GtkWidget *main_vbox;
+    TerminalScreen *active_screen;
+
+    /* Size of a character cell in pixels */
+    int old_char_width;
+    int old_char_height;
+
+    /* Width and height added to the actual terminal grid by "chrome" inside
+     * what was traditionally the X11 window: menu bar, title bar,
+     * style-provided padding. This must be included when resizing the window
+     * and also included in geometry hints. */
+    int old_chrome_width;
+    int old_chrome_height;
+
+    /* Width and height of the padding around the geometry widget. */
+    int old_padding_width;
+    int old_padding_height;
+
+    void *old_geometry_widget; /* only used for pointer value as it may be freed */
+
+    GtkWidget *confirm_close_dialog;
+    GtkWidget *search_find_dialog;
+
+    guint menubar_visible : 1;
+    guint use_default_menubar_visibility : 1;
+
+    /* Compositing manager integration */
+    guint have_argb_visual : 1;
+
+    /* Used to clear stray "demands attention" flashing on our window when we
+     * unmap and map it to switch to an ARGB visual.
+     */
+    guint clear_demands_attention : 1;
+
+    guint disposed : 1;
+    guint present_on_insert : 1;
+
+    /* Workaround until gtk+ bug #535557 is fixed */
+    guint icon_title_set : 1;
+
+    gint64 focus_time;
+
+    /* should we copy selection to clibpoard */
+    int copy_selection;
+};
+
+#define PROFILE_DATA_KEY "GT::Profile"
+
+#define FILE_NEW_TERMINAL_TAB_UI_PATH     "/menubar/File/FileNewTabProfiles"
+#define FILE_NEW_TERMINAL_WINDOW_UI_PATH  "/menubar/File/FileNewWindowProfiles"
+#define SET_ENCODING_UI_PATH              "/menubar/Terminal/TerminalSetEncoding/EncodingsPH"
+#define SET_ENCODING_ACTION_NAME_PREFIX   "TerminalSetEncoding"
+
+#define PROFILES_UI_PATH        "/menubar/Terminal/TerminalProfiles/ProfilesPH"
+#define PROFILES_POPUP_UI_PATH  "/Popup/PopupTerminalProfiles/ProfilesPH"
+
+#define SIZE_TO_UI_PATH            "/menubar/Terminal/TerminalSizeToPH"
+#define SIZE_TO_ACTION_NAME_PREFIX "TerminalSizeTo"
+
+#define STOCK_NEW_TAB     "tab-new"
+
+#define ENCODING_DATA_KEY "encoding"
+
+#if 1
+/*
+ * We don't want to enable content saving until vte supports it async.
+ * So we disable this code for stable versions.
+ */
+#include "terminal-version.h"
+
+#if (TERMINAL_MINOR_VERSION & 1) != 0
+#define ENABLE_SAVE
+#else
+#undef ENABLE_SAVE
+#endif
+#endif
+
+static void terminal_window_dispose     (GObject             *object);
+static void terminal_window_finalize    (GObject             *object);
+static gboolean terminal_window_state_event (GtkWidget            *widget,
+        GdkEventWindowState  *event);
+
+static gboolean terminal_window_delete_event (GtkWidget *widget,
+        GdkEvent *event,
+        gpointer data);
+static gboolean terminal_window_focus_in_event (GtkWidget *widget,
+                                                GdkEventFocus *event,
+                                                gpointer data);
+
+static gboolean notebook_button_press_cb     (GtkWidget *notebook,
+        GdkEventButton *event,
+        GSettings *settings);
+static gboolean window_key_press_cb     (GtkWidget *notebook,
+        GdkEventKey *event,
+        GSettings *settings);
+static gboolean notebook_popup_menu_cb       (GtkWidget *notebook,
+        TerminalWindow *window);
+static void notebook_page_selected_callback  (GtkWidget       *notebook,
+        GtkWidget       *page,
+        guint            page_num,
+        TerminalWindow  *window);
+static void notebook_page_added_callback     (GtkWidget       *notebook,
+        GtkWidget       *container,
+        guint            page_num,
+        TerminalWindow  *window);
+static void notebook_page_removed_callback   (GtkWidget       *notebook,
+        GtkWidget       *container,
+        guint            page_num,
+        TerminalWindow  *window);
+static gboolean notebook_scroll_event_cb     (GtkWidget      *notebook,
+                                              GdkEventScroll *event,
+                                              TerminalWindow *window);
+
+/* Menu action callbacks */
+static void file_new_window_callback          (GtkAction *action,
+        TerminalWindow *window);
+static void file_new_tab_callback             (GtkAction *action,
+        TerminalWindow *window);
+static void file_new_profile_callback         (GtkAction *action,
+        TerminalWindow *window);
+static void file_close_window_callback        (GtkAction *action,
+        TerminalWindow *window);
+static void file_save_contents_callback       (GtkAction *action,
+        TerminalWindow *window);
+static void file_close_tab_callback           (GtkAction *action,
+        TerminalWindow *window);
+static void edit_copy_callback                (GtkAction *action,
+        TerminalWindow *window);
+static void edit_paste_callback               (GtkAction *action,
+        TerminalWindow *window);
+static void edit_select_all_callback          (GtkAction *action,
+        TerminalWindow *window);
+static void edit_keybindings_callback         (GtkAction *action,
+        TerminalWindow *window);
+static void edit_profiles_callback            (GtkAction *action,
+        TerminalWindow *window);
+static void edit_current_profile_callback     (GtkAction *action,
+        TerminalWindow *window);
+static void view_menubar_toggled_callback     (GtkToggleAction *action,
+        TerminalWindow *window);
+static void view_fullscreen_toggled_callback  (GtkToggleAction *action,
+        TerminalWindow *window);
+static void view_zoom_in_callback             (GtkAction *action,
+        TerminalWindow *window);
+static void view_zoom_out_callback            (GtkAction *action,
+        TerminalWindow *window);
+static void view_zoom_normal_callback         (GtkAction *action,
+        TerminalWindow *window);
+static void search_find_callback              (GtkAction *action,
+        TerminalWindow *window);
+static void search_find_next_callback         (GtkAction *action,
+        TerminalWindow *window);
+static void search_find_prev_callback         (GtkAction *action,
+        TerminalWindow *window);
+static void search_clear_highlight_callback   (GtkAction *action,
+        TerminalWindow *window);
+static void terminal_next_or_previous_profile_cb (GtkAction *action,
+        TerminalWindow *window);
+static void terminal_set_title_callback       (GtkAction *action,
+        TerminalWindow *window);
+static void terminal_add_encoding_callback    (GtkAction *action,
+        TerminalWindow *window);
+static void terminal_reset_callback           (GtkAction *action,
+        TerminalWindow *window);
+static void terminal_reset_clear_callback     (GtkAction *action,
+        TerminalWindow *window);
+static void tabs_next_or_previous_tab_cb      (GtkAction *action,
+        TerminalWindow *window);
+static void tabs_move_left_callback           (GtkAction *action,
+        TerminalWindow *window);
+static void tabs_move_right_callback          (GtkAction *action,
+        TerminalWindow *window);
+static void tabs_detach_tab_callback          (GtkAction *action,
+        TerminalWindow *window);
+static void help_contents_callback        (GtkAction *action,
+        TerminalWindow *window);
+static void help_about_callback           (GtkAction *action,
+        TerminalWindow *window);
+
+static gboolean find_larger_zoom_factor  (double  current,
+        double *found);
+static gboolean find_smaller_zoom_factor (double  current,
+        double *found);
+
+static void terminal_window_show (GtkWidget *widget);
+
+static gboolean confirm_close_window_or_tab (TerminalWindow *window,
+        TerminalScreen *screen);
+
+static void
+profile_set_callback (TerminalScreen *screen,
+                      TerminalProfile *old_profile,
+                      TerminalWindow *window);
+static void
+sync_screen_icon_title (TerminalScreen *screen,
+                        GParamSpec *psepc,
+                        TerminalWindow *window);
+
+G_DEFINE_TYPE_WITH_PRIVATE (TerminalWindow, terminal_window, GTK_TYPE_WINDOW)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
+
+/* Menubar mnemonics & accel settings handling */
+
+static void
+app_setting_notify_cb (TerminalApp *app,
+                       GParamSpec *pspec,
+                       GdkScreen *screen)
+{
+    GtkSettings *settings;
+    const char *prop_name;
+
+    if (pspec)
+        prop_name = pspec->name;
+    else
+        prop_name = NULL;
+
+    settings = gtk_settings_get_for_screen (screen);
+
+    if (!prop_name || prop_name == I_(TERMINAL_APP_ENABLE_MNEMONICS))
+    {
+        gboolean enable_mnemonics;
+
+        g_object_get (app, TERMINAL_APP_ENABLE_MNEMONICS, &enable_mnemonics, NULL);
+        g_object_set (settings, "gtk-enable-mnemonics", enable_mnemonics, NULL);
+    }
+
+    if (!prop_name || prop_name == I_(TERMINAL_APP_ENABLE_MENU_BAR_ACCEL))
+    {
+        /* const */ char *saved_menubar_accel;
+        gboolean enable_menubar_accel;
+
+        /* FIXME: Once gtk+ bug 507398 is fixed, use that to reset the property instead */
+        /* Now this is a bad hack on so many levels. */
+        saved_menubar_accel = g_object_get_data (G_OBJECT (settings), "GT::gtk-menu-bar-accel");
+        if (!saved_menubar_accel)
+        {
+            g_object_get (settings, "gtk-menu-bar-accel", &saved_menubar_accel, NULL);
+            g_object_set_data_full (G_OBJECT (settings), "GT::gtk-menu-bar-accel",
+                                    saved_menubar_accel, (GDestroyNotify) g_free);
+        }
+
+        g_object_get (app, TERMINAL_APP_ENABLE_MENU_BAR_ACCEL, &enable_menubar_accel, NULL);
+        if (enable_menubar_accel)
+            g_object_set (settings, "gtk-menu-bar-accel", saved_menubar_accel, NULL);
+        else
+            g_object_set (settings, "gtk-menu-bar-accel", NULL, NULL);
+    }
+}
+
+static void
+app_setting_notify_destroy_cb (GdkScreen *screen)
+{
+    g_signal_handlers_disconnect_by_func (terminal_app_get (),
+                                          G_CALLBACK (app_setting_notify_cb),
+                                          screen);
+}
+
+/* utility functions */
+
+/*
+  Derived from XParseGeometry() in X.org
+
+  Copyright 1985, 1986, 1987, 1998  The Open Group
+
+  All Rights Reserved.
+
+  The above copyright notice and this permission notice shall be included
+  in all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+  IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+  OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+  OTHER DEALINGS IN THE SOFTWARE.
+
+  Except as contained in this notice, the name of The Open Group shall
+  not be used in advertising or otherwise to promote the sale, use or
+  other dealings in this Software without prior written authorization
+  from The Open Group.
+*/
+
+/*
+ *    XParseGeometry parses strings of the form
+ *   "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
+ *   width, height, xoffset, and yoffset are unsigned integers.
+ *   Example: "=80x24+300-49"
+ *   The equal sign is optional.
+ *   It returns a bitmask that indicates which of the four values
+ *   were actually found in the string. For each value found,
+ *   the corresponding argument is updated; for each value
+ *   not found, the corresponding argument is left unchanged.
+ */
+
+/* The following code is from Xlib, and is minimally modified, so we
+ * can track any upstream changes if required. Don’t change this
+ * code. Or if you do, put in a huge comment marking which thing
+ * changed.
+ */
+
+static int
+terminal_window_ReadInteger (char  *string,
+                             char **NextString)
+{
+    register int Result = 0;
+    int Sign = 1;
+
+    if (*string == '+')
+	string++;
+    else if (*string == '-')
+    {
+	string++;
+	Sign = -1;
+    }
+    for (; (*string >= '0') && (*string <= '9'); string++)
+    {
+	Result = (Result * 10) + (*string - '0');
+    }
+    *NextString = string;
+    if (Sign >= 0)
+	return (Result);
+    else
+	return (-Result);
+}
+
+/*
+ * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
+ * value (x, y, width, height) was found in the parsed string.
+ */
+#define NoValue         0x0000
+#define XValue          0x0001
+#define YValue          0x0002
+#define WidthValue      0x0004
+#define HeightValue     0x0008
+#define XNegative       0x0010
+#define YNegative       0x0020
+
+static int
+terminal_window_XParseGeometry (const char *string,
+                                int *x, int *y,
+                                unsigned int *width,
+                                unsigned int *height)
+{
+	int mask = NoValue;
+	register char *strind;
+	unsigned int tempWidth = 0, tempHeight = 0;
+	int tempX = 0, tempY = 0;
+	char *nextCharacter;
+
+	if ( (string == NULL) || (*string == '\0')) return(mask);
+	if (*string == '=')
+		string++;  /* ignore possible '=' at beg of geometry spec */
+
+	strind = (char *)string;
+	if (*strind != '+' && *strind != '-' && *strind != 'x') {
+		tempWidth = terminal_window_ReadInteger(strind, &nextCharacter);
+		if (strind == nextCharacter)
+		    return (0);
+		strind = nextCharacter;
+		mask |= WidthValue;
+	}
+
+	if (*strind == 'x' || *strind == 'X') {
+		strind++;
+		tempHeight = terminal_window_ReadInteger(strind, &nextCharacter);
+		if (strind == nextCharacter)
+		    return (0);
+		strind = nextCharacter;
+		mask |= HeightValue;
+	}
+
+	if ((*strind == '+') || (*strind == '-')) {
+		if (*strind == '-') {
+			strind++;
+			tempX = -terminal_window_ReadInteger(strind, &nextCharacter);
+			if (strind == nextCharacter)
+			    return (0);
+			strind = nextCharacter;
+			mask |= XNegative;
+
+		}
+		else
+		{	strind++;
+			tempX = terminal_window_ReadInteger(strind, &nextCharacter);
+			if (strind == nextCharacter)
+			    return(0);
+			strind = nextCharacter;
+		}
+		mask |= XValue;
+		if ((*strind == '+') || (*strind == '-')) {
+			if (*strind == '-') {
+				strind++;
+				tempY = -terminal_window_ReadInteger(strind, &nextCharacter);
+				if (strind == nextCharacter)
+				    return(0);
+				strind = nextCharacter;
+				mask |= YNegative;
+
+			}
+			else
+			{
+				strind++;
+				tempY = terminal_window_ReadInteger(strind, &nextCharacter);
+				if (strind == nextCharacter)
+				    return(0);
+				strind = nextCharacter;
+			}
+			mask |= YValue;
+		}
+	}
+
+	/* If strind isn't at the end of the string the it's an invalid
+		geometry specification. */
+
+	if (*strind != '\0') return (0);
+
+	if (mask & XValue)
+	    *x = tempX;
+	if (mask & YValue)
+	    *y = tempY;
+	if (mask & WidthValue)
+            *width = tempWidth;
+	if (mask & HeightValue)
+            *height = tempHeight;
+	return (mask);
+}
+
+static char *
+escape_underscores (const char *name)
+{
+    GString *escaped_name;
+
+    g_assert (name != NULL);
+
+    /* Who'd use more that 4 underscores in a profile name... */
+    escaped_name = g_string_sized_new (strlen (name) + 4 + 1);
+
+    while (*name)
+    {
+        if (*name == '_')
+            g_string_append (escaped_name, "__");
+        else
+            g_string_append_c (escaped_name, *name);
+        name++;
+    }
+
+    return g_string_free (escaped_name, FALSE);
+}
+
+static int
+find_tab_num_at_pos (GtkNotebook *nb,
+                     int screen_x,
+                     int screen_y)
+{
+    int page_num = 0;
+    GtkWidget *page;
+    GtkAllocation tab_allocation;
+
+    while ((page = gtk_notebook_get_nth_page (nb, page_num)))
+    {
+        GtkWidget *tab;
+        int x_root, y_root;
+
+        tab = gtk_notebook_get_tab_label (nb, page);
+        g_return_val_if_fail (tab != NULL, -1);
+
+        if (!gtk_widget_get_mapped (tab))
+        {
+            page_num++;
+            continue;
+        }
+
+        gdk_window_get_origin (gtk_widget_get_window (tab), &x_root, &y_root);
+
+        gtk_widget_get_allocation (tab, &tab_allocation);
+        if (screen_x >= x_root + tab_allocation.x &&
+            screen_x <= x_root + tab_allocation.x + tab_allocation.width &&
+            screen_y >= y_root + tab_allocation.y &&
+            screen_y <= y_root + tab_allocation.y + tab_allocation.height)
+            return page_num;
+
+        page_num++;
+    }
+
+    return -1;
+}
+
+static void
+terminal_set_profile_toggled_callback (GtkToggleAction *action,
+                                       TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalProfile *profile;
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    if (!gtk_toggle_action_get_active (action))
+        return;
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+
+    if (priv->active_screen == NULL)
+        return;
+
+    profile = g_object_get_data (G_OBJECT (action), PROFILE_DATA_KEY);
+    g_assert (profile);
+
+    if (_terminal_profile_get_forgotten (profile))
+        return;
+
+    g_signal_handlers_block_by_func (priv->active_screen, G_CALLBACK (profile_set_callback), window);
+    terminal_screen_set_profile (priv->active_screen, profile);
+    g_signal_handlers_unblock_by_func (priv->active_screen, G_CALLBACK (profile_set_callback), window);
+}
+
+static void
+profile_visible_name_notify_cb (TerminalProfile *profile,
+                                GParamSpec *pspec,
+                                GtkAction *action)
+{
+    const char *visible_name;
+    char *dot, *display_name;
+    guint num;
+
+    visible_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_VISIBLE_NAME);
+    display_name = escape_underscores (visible_name);
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    dot = strchr (gtk_action_get_name (action), '.');
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+    if (dot != NULL)
+    {
+        char *free_me;
+
+        num = g_ascii_strtoll (dot + 1, NULL, 10);
+
+        free_me = display_name;
+        if (num < 10)
+            /* Translators: This is the label of a menu item to choose a profile.
+             * _%d is used as the accelerator (with d between 1 and 9), and
+             * the %s is the name of the terminal profile.
+             */
+            display_name = g_strdup_printf (_("_%d. %s"), num, display_name);
+        else if (num < 36)
+            /* Translators: This is the label of a menu item to choose a profile.
+             * _%c is used as the accelerator (it will be a character between A and Z),
+             * and the %s is the name of the terminal profile.
+             */
+            display_name = g_strdup_printf (_("_%c. %s"), ('A' + num - 10), display_name);
+        else
+            free_me = NULL;
+
+        g_free (free_me);
+    }
+
+    g_object_set (action, "label", display_name, NULL);
+    g_free (display_name);
+}
+
+static void
+disconnect_profiles_from_actions_in_group (GtkActionGroup *action_group)
+{
+    GList *actions, *l;
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    actions = gtk_action_group_list_actions (action_group);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+    for (l = actions; l != NULL; l = l->next)
+    {
+        GObject *action = G_OBJECT (l->data);
+        TerminalProfile *profile;
+
+        profile = g_object_get_data (action, PROFILE_DATA_KEY);
+        if (!profile)
+            continue;
+
+        g_signal_handlers_disconnect_by_func (profile, G_CALLBACK (profile_visible_name_notify_cb), action);
+    }
+    g_list_free (actions);
+}
+
+static void
+terminal_window_update_set_profile_menu_active_profile (TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalProfile *new_active_profile;
+    GList *actions, *l;
+
+    if (!priv->profiles_action_group)
+        return;
+
+    if (!priv->active_screen)
+        return;
+
+    new_active_profile = terminal_screen_get_profile (priv->active_screen);
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    actions = gtk_action_group_list_actions (priv->profiles_action_group);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+    for (l = actions; l != NULL; l = l->next)
+    {
+        GObject *action = G_OBJECT (l->data);
+        TerminalProfile *profile;
+
+        profile = g_object_get_data (action, PROFILE_DATA_KEY);
+        if (profile != new_active_profile)
+            continue;
+
+        g_signal_handlers_block_by_func (action, G_CALLBACK (terminal_set_profile_toggled_callback), window);
+        G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+        G_GNUC_END_IGNORE_DEPRECATIONS;
+        g_signal_handlers_unblock_by_func (action, G_CALLBACK (terminal_set_profile_toggled_callback), window);
+
+        break;
+    }
+    g_list_free (actions);
+}
+
+static void
+terminal_window_update_set_profile_menu (TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalProfile *active_profile;
+    GtkActionGroup *action_group;
+    GtkAction *action;
+    GList *profiles, *p;
+    GSList *group;
+    guint n;
+    gboolean single_profile;
+
+    /* Remove the old UI */
+    if (priv->profiles_ui_id != 0)
+    {
+        gtk_ui_manager_remove_ui (priv->ui_manager, priv->profiles_ui_id);
+        priv->profiles_ui_id = 0;
+    }
+
+    if (priv->profiles_action_group != NULL)
+    {
+        disconnect_profiles_from_actions_in_group (priv->profiles_action_group);
+        gtk_ui_manager_remove_action_group (priv->ui_manager,
+                                            priv->profiles_action_group);
+        priv->profiles_action_group = NULL;
+    }
+
+    profiles = terminal_app_get_profile_list (terminal_app_get ());
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_group_get_action (priv->action_group, "TerminalProfiles");
+    single_profile = !profiles || profiles->next == NULL; /* list length <= 1 */
+    gtk_action_set_sensitive (action, !single_profile);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+    if (profiles == NULL)
+        return;
+
+    if (priv->active_screen)
+        active_profile = terminal_screen_get_profile (priv->active_screen);
+    else
+        active_profile = NULL;
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action_group = priv->profiles_action_group = gtk_action_group_new ("Profiles");
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+    gtk_ui_manager_insert_action_group (priv->ui_manager, action_group, -1);
+    g_object_unref (action_group);
+
+    priv->profiles_ui_id = gtk_ui_manager_new_merge_id (priv->ui_manager);
+
+    group = NULL;
+    n = 0;
+    for (p = profiles; p != NULL; p = p->next)
+    {
+        TerminalProfile *profile = (TerminalProfile *) p->data;
+        GtkRadioAction *profile_action;
+        char name[32];
+
+        g_snprintf (name, sizeof (name), "TerminalSetProfile%u", n++);
+
+        G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+        profile_action = gtk_radio_action_new (name,
+                                               NULL,
+                                               NULL,
+                                               NULL,
+                                               n);
+
+        gtk_radio_action_set_group (profile_action, group);
+        group = gtk_radio_action_get_group (profile_action);
+
+        if (profile == active_profile)
+            gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (profile_action), TRUE);
+        G_GNUC_END_IGNORE_DEPRECATIONS;
+
+        g_object_set_data_full (G_OBJECT (profile_action),
+                                PROFILE_DATA_KEY,
+                                g_object_ref (profile),
+                                (GDestroyNotify) g_object_unref);
+        profile_visible_name_notify_cb (profile, NULL, GTK_ACTION (profile_action));
+        g_signal_connect (profile, "notify::" TERMINAL_PROFILE_VISIBLE_NAME,
+                          G_CALLBACK (profile_visible_name_notify_cb), profile_action);
+        g_signal_connect (profile_action, "toggled",
+                          G_CALLBACK (terminal_set_profile_toggled_callback), window);
+
+        G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+        gtk_action_group_add_action (action_group, GTK_ACTION (profile_action));
+        G_GNUC_END_IGNORE_DEPRECATIONS;
+        g_object_unref (profile_action);
+
+        gtk_ui_manager_add_ui (priv->ui_manager, priv->profiles_ui_id,
+                               PROFILES_UI_PATH,
+                               name, name,
+                               GTK_UI_MANAGER_MENUITEM, FALSE);
+        gtk_ui_manager_add_ui (priv->ui_manager, priv->profiles_ui_id,
+                               PROFILES_POPUP_UI_PATH,
+                               name, name,
+                               GTK_UI_MANAGER_MENUITEM, FALSE);
+    }
+
+    g_list_free (profiles);
+}
+
+static void
+terminal_window_create_new_terminal_action (TerminalWindow *window,
+        TerminalProfile *profile,
+        const char *name,
+        guint num,
+        GCallback callback)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkAction *action;
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_new (name, NULL, NULL, NULL);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+
+    g_object_set_data_full (G_OBJECT (action),
+                            PROFILE_DATA_KEY,
+                            g_object_ref (profile),
+                            (GDestroyNotify) g_object_unref);
+    profile_visible_name_notify_cb (profile, NULL, action);
+    g_signal_connect (profile, "notify::" TERMINAL_PROFILE_VISIBLE_NAME,
+                      G_CALLBACK (profile_visible_name_notify_cb), action);
+    g_signal_connect (action, "activate", callback, window);
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    gtk_action_group_add_action (priv->new_terminal_action_group, action);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+    g_object_unref (action);
+}
+
+static void
+terminal_window_update_new_terminal_menus (TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkActionGroup *action_group;
+    GtkAction *action;
+    GList *profiles, *p;
+    guint n;
+    gboolean have_single_profile;
+
+    /* Remove the old UI */
+    if (priv->new_terminal_ui_id != 0)
+    {
+        gtk_ui_manager_remove_ui (priv->ui_manager, priv->new_terminal_ui_id);
+        priv->new_terminal_ui_id = 0;
+    }
+
+    if (priv->new_terminal_action_group != NULL)
+    {
+        disconnect_profiles_from_actions_in_group (priv->new_terminal_action_group);
+        gtk_ui_manager_remove_action_group (priv->ui_manager,
+                                            priv->new_terminal_action_group);
+        priv->new_terminal_action_group = NULL;
+    }
+
+    profiles = terminal_app_get_profile_list (terminal_app_get ());
+    have_single_profile = !profiles || !profiles->next;
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_group_get_action (priv->action_group, "FileNewTab");
+    gtk_action_set_visible (action, have_single_profile);
+    action = gtk_action_group_get_action (priv->action_group, "FileNewWindow");
+    gtk_action_set_visible (action, have_single_profile);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+
+    if (have_single_profile)
+    {
+        g_list_free (profiles);
+        return;
+    }
+
+    /* Now build the submenus */
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action_group = priv->new_terminal_action_group = gtk_action_group_new ("NewTerminal");
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+    gtk_ui_manager_insert_action_group (priv->ui_manager, action_group, -1);
+    g_object_unref (action_group);
+
+    priv->new_terminal_ui_id = gtk_ui_manager_new_merge_id (priv->ui_manager);
+
+    n = 0;
+    for (p = profiles; p != NULL; p = p->next)
+    {
+        TerminalProfile *profile = (TerminalProfile *) p->data;
+        char name[32];
+
+        g_snprintf (name, sizeof (name), "FileNewTab.%u", n);
+        terminal_window_create_new_terminal_action (window,
+                profile,
+                name,
+                n,
+                G_CALLBACK (file_new_tab_callback));
+
+        gtk_ui_manager_add_ui (priv->ui_manager, priv->new_terminal_ui_id,
+                               FILE_NEW_TERMINAL_TAB_UI_PATH,
+                               name, name,
+                               GTK_UI_MANAGER_MENUITEM, FALSE);
+
+        g_snprintf (name, sizeof (name), "FileNewWindow.%u", n);
+        terminal_window_create_new_terminal_action (window,
+                profile,
+                name,
+                n,
+                G_CALLBACK (file_new_window_callback));
+
+        gtk_ui_manager_add_ui (priv->ui_manager, priv->new_terminal_ui_id,
+                               FILE_NEW_TERMINAL_WINDOW_UI_PATH,
+                               name, name,
+                               GTK_UI_MANAGER_MENUITEM, FALSE);
+
+        ++n;
+    }
+
+    g_list_free (profiles);
+}
+
+static void
+terminal_set_encoding_callback (GtkToggleAction *action,
+                                TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalEncoding *encoding;
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    if (!gtk_toggle_action_get_active (action))
+        return;
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+
+    if (priv->active_screen == NULL)
+        return;
+
+    encoding = g_object_get_data (G_OBJECT (action), ENCODING_DATA_KEY);
+    g_assert (encoding);
+
+    vte_terminal_set_encoding (VTE_TERMINAL (priv->active_screen),
+                               terminal_encoding_get_charset (encoding), NULL);
+}
+
+static void
+terminal_window_update_encoding_menu (TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalApp *app;
+    GtkActionGroup *action_group;
+    GSList *group;
+    guint n;
+    GSList *encodings, *l;
+    const char *charset;
+    TerminalEncoding *active_encoding;
+
+    /* Remove the old UI */
+    if (priv->encodings_ui_id != 0)
+    {
+        gtk_ui_manager_remove_ui (priv->ui_manager, priv->encodings_ui_id);
+        priv->encodings_ui_id = 0;
+    }
+
+    if (priv->encodings_action_group != NULL)
+    {
+        gtk_ui_manager_remove_action_group (priv->ui_manager,
+                                            priv->encodings_action_group);
+        priv->encodings_action_group = NULL;
+    }
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action_group = priv->encodings_action_group = gtk_action_group_new ("Encodings");
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+    gtk_ui_manager_insert_action_group (priv->ui_manager, action_group, -1);
+    g_object_unref (action_group);
+
+    priv->encodings_ui_id = gtk_ui_manager_new_merge_id (priv->ui_manager);
+
+    if (priv->active_screen)
+        charset = vte_terminal_get_encoding (VTE_TERMINAL (priv->active_screen));
+    else
+        charset = "current";
+
+    app = terminal_app_get ();
+    active_encoding = terminal_app_ensure_encoding (app, charset);
+
+    encodings = terminal_app_get_active_encodings (app);
+
+    if (g_slist_find (encodings, active_encoding) == NULL)
+        encodings = g_slist_append (encodings, terminal_encoding_ref (active_encoding));
+
+    group = NULL;
+    n = 0;
+    for (l = encodings; l != NULL; l = l->next)
+    {
+        TerminalEncoding *e = (TerminalEncoding *) l->data;
+        GtkRadioAction *encoding_action;
+        char name[128];
+        char *display_name;
+
+        g_snprintf (name, sizeof (name), SET_ENCODING_ACTION_NAME_PREFIX "%s", terminal_encoding_get_id (e));
+        display_name = g_strdup_printf ("%s (%s)", e->name, terminal_encoding_get_charset (e));
+
+        G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+        encoding_action = gtk_radio_action_new (name,
+                                                display_name,
+                                                NULL,
+                                                NULL,
+                                                n);
+        g_free (display_name);
+
+        gtk_radio_action_set_group (encoding_action, group);
+        group = gtk_radio_action_get_group (encoding_action);
+
+        if (charset && strcmp (terminal_encoding_get_id (e), charset) == 0)
+            gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (encoding_action), TRUE);
+        G_GNUC_END_IGNORE_DEPRECATIONS;
+
+        g_signal_connect (encoding_action, "toggled",
+                          G_CALLBACK (terminal_set_encoding_callback), window);
+
+        g_object_set_data_full (G_OBJECT (encoding_action), ENCODING_DATA_KEY,
+                                terminal_encoding_ref (e),
+                                (GDestroyNotify) terminal_encoding_unref);
+
+        G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+        gtk_action_group_add_action (action_group, GTK_ACTION (encoding_action));
+        G_GNUC_END_IGNORE_DEPRECATIONS;
+        g_object_unref (encoding_action);
+
+        gtk_ui_manager_add_ui (priv->ui_manager, priv->encodings_ui_id,
+                               SET_ENCODING_UI_PATH,
+                               name, name,
+                               GTK_UI_MANAGER_MENUITEM, FALSE);
+    }
+
+    g_slist_foreach (encodings, (GFunc) terminal_encoding_unref, NULL);
+    g_slist_free (encodings);
+}
+
+static void
+terminal_window_update_encoding_menu_active_encoding (TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkAction *action;
+    char name[128];
+
+    if (!priv->active_screen)
+        return;
+    if (!priv->encodings_action_group)
+        return;
+
+    g_snprintf (name, sizeof (name), SET_ENCODING_ACTION_NAME_PREFIX "%s",
+                vte_terminal_get_encoding (VTE_TERMINAL (priv->active_screen)));
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_group_get_action (priv->encodings_action_group, name);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+    if (!action)
+        return;
+
+    g_signal_handlers_block_by_func (action, G_CALLBACK (terminal_set_encoding_callback), window);
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+    g_signal_handlers_unblock_by_func (action, G_CALLBACK (terminal_set_encoding_callback), window);
+}
+
+static void
+terminal_size_to_cb (GtkAction *action,
+                     TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    const char *name;
+    char *end = NULL;
+    guint width, height;
+
+    if (priv->active_screen == NULL)
+        return;
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    name = gtk_action_get_name (action) + strlen (SIZE_TO_ACTION_NAME_PREFIX);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+    width = g_ascii_strtoull (name, &end, 10);
+    g_assert (end && *end == 'x');
+    height = g_ascii_strtoull (end + 1, &end, 10);
+    g_assert (end && *end == '\0');
+
+    vte_terminal_set_size (VTE_TERMINAL (priv->active_screen), width, height);
+
+    terminal_window_update_size (window, priv->active_screen, TRUE);
+}
+
+static void
+terminal_window_update_size_to_menu (TerminalWindow *window)
+{
+    static const struct
+    {
+        guint grid_width;
+        guint grid_height;
+    } predefined_sizes[] =
+    {
+        { 80, 24 },
+        { 80, 43 },
+        { 132, 24 },
+        { 132, 43 }
+    };
+    TerminalWindowPrivate *priv = window->priv;
+    guint i;
+
+    /* We only install this once, so there's no need for a separate action group
+     * and any cleanup + build-new-one action here.
+     */
+
+    for (i = 0; i < G_N_ELEMENTS (predefined_sizes); ++i)
+    {
+        guint grid_width = predefined_sizes[i].grid_width;
+        guint grid_height = predefined_sizes[i].grid_height;
+        GtkAction *action;
+        char name[40];
+        char *display_name;
+
+        g_snprintf (name, sizeof (name), SIZE_TO_ACTION_NAME_PREFIX "%ux%u",
+                    grid_width, grid_height);
+
+        /* If there are ever more than 9 of these, extend this to use A..Z as mnemonics,
+         * like we do for the profiles menu.
+         */
+        display_name = g_strdup_printf ("_%u. %ux%u", i + 1, grid_width, grid_height);
+
+        G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+        action = gtk_action_new (name, display_name, NULL, NULL);
+        G_GNUC_END_IGNORE_DEPRECATIONS;
+        g_free (display_name);
+
+        g_signal_connect (action, "activate",
+                          G_CALLBACK (terminal_size_to_cb), window);
+
+        G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+        gtk_action_group_add_action (priv->action_group, action);
+        G_GNUC_END_IGNORE_DEPRECATIONS;
+        g_object_unref (action);
+
+        gtk_ui_manager_add_ui (priv->ui_manager, priv->ui_id,
+                               SIZE_TO_UI_PATH,
+                               name, name,
+                               GTK_UI_MANAGER_MENUITEM, FALSE);
+    }
+}
+
+/* Actions stuff */
+
+static void
+terminal_window_update_copy_sensitivity (TerminalScreen *screen,
+                                         TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkAction *action;
+    gboolean can_copy;
+
+    if (screen != priv->active_screen)
+        return;
+
+    can_copy = vte_terminal_get_has_selection (VTE_TERMINAL (screen));
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_group_get_action (priv->action_group, "EditCopy");
+    gtk_action_set_sensitive (action, can_copy);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+
+    if (can_copy && priv->copy_selection)
+#if VTE_CHECK_VERSION (0, 50, 0)
+        vte_terminal_copy_clipboard_format (VTE_TERMINAL(screen), VTE_FORMAT_TEXT);
+#else
+        vte_terminal_copy_clipboard(VTE_TERMINAL(screen));
+#endif
+}
+
+static void
+terminal_window_update_zoom_sensitivity (TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalScreen *screen;
+    GtkAction *action;
+    double current, zoom;
+
+    screen = priv->active_screen;
+    if (screen == NULL)
+        return;
+
+    current = terminal_screen_get_font_scale (screen);
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_group_get_action (priv->action_group, "ViewZoomOut");
+    gtk_action_set_sensitive (action, find_smaller_zoom_factor (current, &zoom));
+    action = gtk_action_group_get_action (priv->action_group, "ViewZoomIn");
+    gtk_action_set_sensitive (action, find_larger_zoom_factor (current, &zoom));
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+}
+
+static void
+terminal_window_update_search_sensitivity (TerminalScreen *screen,
+        TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkAction *action;
+    gboolean can_search;
+
+    if (screen != priv->active_screen)
+        return;
+
+    can_search = vte_terminal_search_get_regex (VTE_TERMINAL (screen)) != NULL;
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_group_get_action (priv->action_group, "SearchFindNext");
+    gtk_action_set_sensitive (action, can_search);
+    action = gtk_action_group_get_action (priv->action_group, "SearchFindPrevious");
+    gtk_action_set_sensitive (action, can_search);
+    action = gtk_action_group_get_action (priv->action_group, "SearchClearHighlight");
+    gtk_action_set_sensitive (action, can_search);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+}
+
+static void
+update_edit_menu_cb (GtkClipboard *clipboard,
+                     GdkAtom *targets,
+                     int n_targets,
+                     TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkAction *action;
+    gboolean can_paste, can_paste_uris;
+
+    can_paste = targets != NULL && gtk_targets_include_text (targets, n_targets);
+    can_paste_uris = targets != NULL && gtk_targets_include_uri (targets, n_targets);
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_group_get_action (priv->action_group, "EditPaste");
+    gtk_action_set_sensitive (action, can_paste);
+    action = gtk_action_group_get_action (priv->action_group, "EditPasteURIPaths");
+    gtk_action_set_visible (action, can_paste_uris);
+    gtk_action_set_sensitive (action, can_paste_uris);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+
+    /* Ref was added in gtk_clipboard_request_targets below */
+    g_object_unref (window);
+}
+
+static void
+update_edit_menu(TerminalWindow *window)
+{
+    GtkClipboard *clipboard;
+
+    clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
+    gtk_clipboard_request_targets (clipboard,
+                                   (GtkClipboardTargetsReceivedFunc) update_edit_menu_cb,
+                                   g_object_ref (window));
+}
+
+static void
+screen_resize_window_cb (TerminalScreen *screen,
+                         guint width,
+                         guint height,
+                         TerminalWindow* window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    VteTerminal *terminal = VTE_TERMINAL (screen);
+    GtkWidget *widget = GTK_WIDGET (screen);
+
+    /* Don't do anything if we're maximised or fullscreened */
+    // FIXME: realized && ... instead?
+    if (!gtk_widget_get_realized (widget) ||
+            (gdk_window_get_state (gtk_widget_get_window (widget)) & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN)) != 0)
+        return;
+
+    vte_terminal_set_size (terminal, width, height);
+
+    if (screen != priv->active_screen)
+        return;
+
+    terminal_window_update_size (window, screen, TRUE);
+}
+
+static void
+terminal_window_update_tabs_menu_sensitivity (TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkNotebook *notebook = GTK_NOTEBOOK (priv->notebook);
+    GtkActionGroup *action_group = priv->action_group;
+    GtkAction *action;
+    int num_pages, page_num;
+    gboolean not_first, not_last;
+
+    if (priv->disposed)
+        return;
+
+    num_pages = gtk_notebook_get_n_pages (notebook);
+    page_num = gtk_notebook_get_current_page (notebook);
+    not_first = page_num > 0;
+    not_last = page_num + 1 < num_pages;
+
+    /* Hide the tabs menu in single-tab windows */
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_group_get_action (action_group, "Tabs");
+    gtk_action_set_visible (action, num_pages > 1);
+
+#if 1
+    /* NOTE: We always make next/prev actions sensitive except in
+     * single-tab windows, so the corresponding shortcut key escape code
+     * isn't sent to the terminal. See bug #453193 and bug #138609.
+     * This also makes tab cycling work, bug #92139.
+     * FIXME: Find a better way to do this.
+     */
+    action = gtk_action_group_get_action (action_group, "TabsPrevious");
+    gtk_action_set_sensitive (action, num_pages > 1);
+    action = gtk_action_group_get_action (action_group, "TabsNext");
+    gtk_action_set_sensitive (action, num_pages > 1);
+#else
+    /* This would be correct, but see the comment above. */
+    action = gtk_action_group_get_action (action_group, "TabsPrevious");
+    gtk_action_set_sensitive (action, not_first);
+    action = gtk_action_group_get_action (action_group, "TabsNext");
+    gtk_action_set_sensitive (action, not_last);
+#endif
+
+    action = gtk_action_group_get_action (action_group, "TabsMoveLeft");
+    gtk_action_set_sensitive (action, not_first);
+    action = gtk_action_group_get_action (action_group, "TabsMoveRight");
+    gtk_action_set_sensitive (action, not_last);
+    action = gtk_action_group_get_action (action_group, "TabsDetach");
+    gtk_action_set_sensitive (action, num_pages > 1);
+    action = gtk_action_group_get_action (action_group, "FileCloseTab");
+    gtk_action_set_sensitive (action, num_pages > 1);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+}
+
+static void
+update_tab_visibility (TerminalWindow *window,
+                       int             change)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    gboolean show_tabs;
+    guint num;
+
+    num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (priv->notebook));
+
+    show_tabs = (num + change) > 1;
+    gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), show_tabs);
+}
+
+static GtkNotebook *
+handle_tab_droped_on_desktop (GtkNotebook *source_notebook,
+                              GtkWidget   *container,
+                              gint         x,
+                              gint         y,
+                              gpointer     data)
+{
+    TerminalWindow *source_window;
+    TerminalWindow *new_window;
+    TerminalWindowPrivate *new_priv;
+
+    source_window = TERMINAL_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (source_notebook)));
+    g_return_val_if_fail (TERMINAL_IS_WINDOW (source_window), NULL);
+
+    new_window = terminal_app_new_window (terminal_app_get (),
+                                          gtk_widget_get_screen (GTK_WIDGET (source_window)));
+    new_priv = new_window->priv;
+    new_priv->present_on_insert = TRUE;
+
+    update_tab_visibility (source_window, -1);
+    update_tab_visibility (new_window, +1);
+
+    return GTK_NOTEBOOK (new_priv->notebook);
+}
+
+/* Terminal screen popup menu handling */
+
+static void
+popup_open_hyperlink_callback (GtkAction *action,
+                               TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalScreenPopupInfo *info = priv->popup_info;
+
+    if (info == NULL)
+        return;
+
+    terminal_util_open_url (GTK_WIDGET (window), info->hyperlink, FLAVOR_AS_IS,
+                            gtk_get_current_event_time ());
+}
+
+static void
+popup_copy_hyperlink_callback (GtkAction *action,
+                               TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalScreenPopupInfo *info = priv->popup_info;
+    GtkClipboard *clipboard;
+
+    if (info == NULL)
+        return;
+
+    if (info->hyperlink == NULL)
+        return;
+
+    clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
+    gtk_clipboard_set_text (clipboard, info->hyperlink, -1);
+}
+
+static void
+popup_open_url_callback (GtkAction *action,
+                         TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalScreenPopupInfo *info = priv->popup_info;
+
+    if (info == NULL)
+        return;
+
+    terminal_util_open_url (GTK_WIDGET (window), info->url, info->flavor,
+                            gtk_get_current_event_time ());
+}
+
+static void
+popup_copy_url_callback (GtkAction *action,
+                         TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalScreenPopupInfo *info = priv->popup_info;
+    GtkClipboard *clipboard;
+
+    if (info == NULL)
+        return;
+
+    if (info->url == NULL)
+        return;
+
+    clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
+    gtk_clipboard_set_text (clipboard, info->url, -1);
+}
+
+static void
+popup_leave_fullscreen_callback (GtkAction *action,
+                                 TerminalWindow *window)
+{
+    gtk_window_unfullscreen (GTK_WINDOW (window));
+}
+
+static void
+remove_popup_info (TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    if (priv->remove_popup_info_idle != 0)
+    {
+        g_source_remove (priv->remove_popup_info_idle);
+        priv->remove_popup_info_idle = 0;
+    }
+
+    if (priv->popup_info != NULL)
+    {
+        terminal_screen_popup_info_unref (priv->popup_info);
+        priv->popup_info = NULL;
+    }
+}
+
+static gboolean
+idle_remove_popup_info (TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    priv->remove_popup_info_idle = 0;
+    remove_popup_info (window);
+    return FALSE;
+}
+
+static void
+unset_popup_info (TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    /* Unref the event from idle since we still need it
+     * from the action callbacks which will run before idle.
+     */
+    if (priv->remove_popup_info_idle == 0 &&
+            priv->popup_info != NULL)
+    {
+        priv->remove_popup_info_idle =
+            g_idle_add ((GSourceFunc) idle_remove_popup_info, window);
+    }
+}
+
+static void
+popup_menu_deactivate_callback (GtkWidget *popup,
+                                TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkWidget *im_menu_item;
+
+    g_signal_handlers_disconnect_by_func
+    (popup, G_CALLBACK (popup_menu_deactivate_callback), window);
+
+    im_menu_item = gtk_ui_manager_get_widget (priv->ui_manager,
+                   "/Popup/PopupInputMethods");
+    gtk_menu_item_set_submenu (GTK_MENU_ITEM (im_menu_item), NULL);
+
+    unset_popup_info (window);
+}
+
+static void
+popup_clipboard_targets_received_cb (GtkClipboard *clipboard,
+                                     GdkAtom *targets,
+                                     int n_targets,
+                                     TerminalScreenPopupInfo *info)
+{
+    TerminalWindow *window = info->window;
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalScreen *screen = info->screen;
+    GtkWidget *popup_menu;
+    GtkAction *action;
+    gboolean can_paste, can_paste_uris, show_hyperlink, show_link, show_email_link, show_call_link, show_input_method_menu;
+    int n_pages;
+
+    if (!gtk_widget_get_realized (GTK_WIDGET (screen)))
+    {
+        terminal_screen_popup_info_unref (info);
+        return;
+    }
+
+    /* Now we know that the screen is realized, we know that the window is still alive */
+    remove_popup_info (window);
+
+    priv->popup_info = info; /* adopt the ref added when requesting the clipboard */
+
+    n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (priv->notebook));
+
+    can_paste = targets != NULL && gtk_targets_include_text (targets, n_targets);
+    can_paste_uris = targets != NULL && gtk_targets_include_uri (targets, n_targets);
+    show_hyperlink = info->hyperlink != NULL;
+    show_link = !show_hyperlink && info->url != NULL && (info->flavor == FLAVOR_AS_IS || info->flavor == FLAVOR_DEFAULT_TO_HTTP);
+    show_email_link = !show_hyperlink && info->url != NULL && info->flavor == FLAVOR_EMAIL;
+    show_call_link = !show_hyperlink && info->url != NULL && info->flavor == FLAVOR_VOIP_CALL;
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_group_get_action (priv->action_group, "PopupOpenHyperlink");
+    gtk_action_set_visible (action, show_hyperlink);
+    action = gtk_action_group_get_action (priv->action_group, "PopupCopyHyperlinkAddress");
+    gtk_action_set_visible (action, show_hyperlink);
+    action = gtk_action_group_get_action (priv->action_group, "PopupSendEmail");
+    gtk_action_set_visible (action, show_email_link);
+    action = gtk_action_group_get_action (priv->action_group, "PopupCopyEmailAddress");
+    gtk_action_set_visible (action, show_email_link);
+    action = gtk_action_group_get_action (priv->action_group, "PopupCall");
+    gtk_action_set_visible (action, show_call_link);
+    action = gtk_action_group_get_action (priv->action_group, "PopupCopyCallAddress");
+    gtk_action_set_visible (action, show_call_link);
+    action = gtk_action_group_get_action (priv->action_group, "PopupOpenLink");
+    gtk_action_set_visible (action, show_link);
+    action = gtk_action_group_get_action (priv->action_group, "PopupCopyLinkAddress");
+    gtk_action_set_visible (action, show_link);
+
+    action = gtk_action_group_get_action (priv->action_group, "PopupCloseWindow");
+    gtk_action_set_visible (action, n_pages <= 1);
+    action = gtk_action_group_get_action (priv->action_group, "PopupCloseTab");
+    gtk_action_set_visible (action, n_pages > 1);
+
+    action = gtk_action_group_get_action (priv->action_group, "PopupCopy");
+    gtk_action_set_sensitive (action, vte_terminal_get_has_selection (VTE_TERMINAL (screen)));
+    action = gtk_action_group_get_action (priv->action_group, "PopupPaste");
+    gtk_action_set_sensitive (action, can_paste);
+    action = gtk_action_group_get_action (priv->action_group, "PopupPasteURIPaths");
+    gtk_action_set_visible (action, can_paste_uris);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+
+    g_object_get (gtk_widget_get_settings (GTK_WIDGET (window)),
+                  "gtk-show-input-method-menu", &show_input_method_menu,
+                  NULL);
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_group_get_action (priv->action_group, "PopupInputMethods");
+    gtk_action_set_visible (action, show_input_method_menu);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+
+    popup_menu = gtk_ui_manager_get_widget (priv->ui_manager, "/Popup");
+    g_signal_connect (popup_menu, "deactivate",
+                      G_CALLBACK (popup_menu_deactivate_callback), window);
+
+    /* Pseudo activation of the popup menu's action */
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_group_get_action (priv->action_group, "Popup");
+    gtk_action_activate (action);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+
+    if (info->button == 0)
+        gtk_menu_shell_select_first (GTK_MENU_SHELL (popup_menu), FALSE);
+
+    if (!gtk_menu_get_attach_widget (GTK_MENU (popup_menu)))
+        gtk_menu_attach_to_widget (GTK_MENU (popup_menu),GTK_WIDGET (screen),NULL);
+
+    gtk_menu_popup (GTK_MENU (popup_menu),
+                    NULL, NULL,
+                    NULL, NULL,
+                    info->button,
+                    info->timestamp);
+    gtk_style_context_add_class(gtk_widget_get_style_context (popup_menu),
+                                GTK_STYLE_CLASS_CONTEXT_MENU);
+}
+
+static void
+screen_show_popup_menu_callback (TerminalScreen *screen,
+                                 TerminalScreenPopupInfo *info,
+                                 TerminalWindow *window)
+{
+    GtkClipboard *clipboard;
+
+    g_return_if_fail (info->window == window);
+
+    clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
+    gtk_clipboard_request_targets (clipboard,
+                                   (GtkClipboardTargetsReceivedFunc) popup_clipboard_targets_received_cb,
+                                   terminal_screen_popup_info_ref (info));
+}
+
+static gboolean
+screen_match_clicked_cb (TerminalScreen *screen,
+                         const char *url,
+                         int url_flavor,
+                         guint state,
+                         TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    if (screen != priv->active_screen)
+        return FALSE;
+
+    switch (url_flavor)
+    {
+#ifdef ENABLE_SKEY
+    case FLAVOR_SKEY:
+        terminal_skey_do_popup (GTK_WINDOW (window), screen, url);
+        break;
+#endif
+    default:
+        gtk_widget_grab_focus (GTK_WIDGET (screen));
+        terminal_util_open_url (GTK_WIDGET (window), url, url_flavor,
+                                gtk_get_current_event_time ());
+        break;
+    }
+
+    return TRUE;
+}
+
+static void
+screen_close_cb (TerminalScreen *screen,
+                 TerminalWindow *window)
+{
+    terminal_window_remove_screen (window, screen);
+}
+
+static gboolean
+terminal_window_accel_activate_cb (GtkAccelGroup  *accel_group,
+                                   GObject        *acceleratable,
+                                   guint           keyval,
+                                   GdkModifierType modifier,
+                                   TerminalWindow *window)
+{
+    GtkAccelGroupEntry *entries;
+    guint n_entries;
+    gboolean retval = FALSE;
+
+    entries = gtk_accel_group_query (accel_group, keyval, modifier, &n_entries);
+    if (n_entries > 0)
+    {
+        const char *accel_path;
+
+        accel_path = g_quark_to_string (entries[0].accel_path_quark);
+
+        if (g_str_has_prefix (accel_path, "<Actions>/Main/"))
+        {
+            const char *action_name;
+
+            /* We want to always consume these accelerators, even if the corresponding
+             * action is insensitive, so the corresponding shortcut key escape code
+             * isn't sent to the terminal. See bug #453193, bug #138609 and bug #559728.
+             * This also makes tab cycling work, bug #92139. (NOT!)
+             */
+
+            action_name = I_(accel_path + strlen ("<Actions>/Main/"));
+
+#if 0
+            if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (priv->notebook)) > 1 &&
+                    (action_name == I_("TabsPrevious") || action_name == I_("TabsNext")))
+                retval = TRUE;
+            else
+#endif
+                if (action_name == I_("EditCopy") ||
+                        action_name == I_("PopupCopy") ||
+                        action_name == I_("EditPaste") ||
+                        action_name == I_("PopupPaste"))
+                    retval = TRUE;
+        }
+    }
+
+    return retval;
+}
+
+/*****************************************/
+
+#ifdef MATE_ENABLE_DEBUG
+static void
+terminal_window_size_allocate_cb (GtkWidget *widget,
+                                  GtkAllocation *allocation)
+{
+    _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                           "[window %p] size-alloc result %d : %d at (%d, %d)\n",
+                           widget,
+                           allocation->width, allocation->height,
+                           allocation->x, allocation->y);
+}
+#endif /* MATE_ENABLE_DEBUG */
+
+static void
+terminal_window_realize (GtkWidget *widget)
+{
+    TerminalWindow *window = TERMINAL_WINDOW (widget);
+    TerminalWindowPrivate *priv = window->priv;
+#if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WAYLAND)
+    GdkScreen *screen;
+    GtkAllocation widget_allocation;
+    GdkVisual *visual;
+
+    gtk_widget_get_allocation (widget, &widget_allocation);
+    screen = gtk_widget_get_screen (GTK_WIDGET (window));
+
+    if (gdk_screen_is_composited (screen) &&
+        (visual = gdk_screen_get_rgba_visual (screen)) != NULL)
+    {
+          /* Set RGBA visual if possible so VTE can use real transparency */
+        gtk_widget_set_visual (GTK_WIDGET (widget), visual);
+        priv->have_argb_visual = TRUE;
+    }
+    else
+    {
+        gtk_widget_set_visual (GTK_WIDGET (window), gdk_screen_get_system_visual (screen));
+        priv->have_argb_visual = FALSE;
+    }
+#endif
+
+    _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                           "[window %p] realize, size %d : %d at (%d, %d)\n",
+                           widget,
+                           widget_allocation.width, widget_allocation.height,
+                           widget_allocation.x, widget_allocation.y);
+
+    GTK_WIDGET_CLASS (terminal_window_parent_class)->realize (widget);
+
+    /* Need to do this now since this requires the window to be realized */
+    if (priv->active_screen != NULL)
+        sync_screen_icon_title (priv->active_screen, NULL, window);
+}
+
+static gboolean
+terminal_window_draw (GtkWidget *widget,
+                      cairo_t   *cr)
+{
+	if (gtk_widget_get_app_paintable(widget))
+	{
+		GtkAllocation child_allocation;
+		GtkStyleContext *context;
+		int width;
+		int height;
+		GtkWidget *child;
+
+		/* Get the *child* allocation, so we don't overwrite window borders */
+		child = gtk_bin_get_child (GTK_BIN (widget));
+		gtk_widget_get_allocation (child, &child_allocation);
+
+		context = gtk_widget_get_style_context (widget);
+		width = gtk_widget_get_allocated_width (widget);
+		height = gtk_widget_get_allocated_height (widget);
+		gtk_render_background (context, cr, 0, 0, width, height);
+		gtk_render_frame (context, cr, 0, 0, width, height);
+
+		gtk_render_background (context, cr,
+							   child_allocation.x, child_allocation.y,
+							   child_allocation.width, child_allocation.height);
+		gtk_render_frame (context, cr,
+						  child_allocation.x, child_allocation.y,
+						  child_allocation.width, child_allocation.height);
+	}
+
+    return GTK_WIDGET_CLASS (terminal_window_parent_class)->draw (widget, cr);
+}
+
+static gboolean
+terminal_window_map_event (GtkWidget    *widget,
+                           GdkEventAny  *event)
+{
+    TerminalWindow *window = TERMINAL_WINDOW (widget);
+    TerminalWindowPrivate *priv = window->priv;
+    gboolean (* map_event) (GtkWidget *, GdkEventAny *) =
+        GTK_WIDGET_CLASS (terminal_window_parent_class)->map_event;
+    GtkAllocation widget_allocation;
+
+    gtk_widget_get_allocation (widget, &widget_allocation);
+    _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                           "[window %p] map-event, size %d : %d at (%d, %d)\n",
+                           widget,
+                           widget_allocation.width, widget_allocation.height,
+                           widget_allocation.x, widget_allocation.y);
+
+    if (priv->clear_demands_attention)
+    {
+#ifdef GDK_WINDOWING_X11
+        terminal_util_x11_clear_demands_attention (gtk_widget_get_window (widget));
+#endif
+
+        priv->clear_demands_attention = FALSE;
+    }
+
+    if (map_event)
+        return map_event (widget, event);
+
+    return FALSE;
+}
+
+static gboolean
+terminal_window_state_event (GtkWidget            *widget,
+                             GdkEventWindowState  *event)
+{
+    gboolean (* window_state_event) (GtkWidget *, GdkEventWindowState *event) =
+        GTK_WIDGET_CLASS (terminal_window_parent_class)->window_state_event;
+
+    if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
+    {
+        TerminalWindow *window = TERMINAL_WINDOW (widget);
+        TerminalWindowPrivate *priv = window->priv;
+        GtkAction *action;
+        gboolean is_fullscreen;
+
+        is_fullscreen = (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
+
+        G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+        action = gtk_action_group_get_action (priv->action_group, "ViewFullscreen");
+        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), is_fullscreen);
+
+        action = gtk_action_group_get_action (priv->action_group, "PopupLeaveFullscreen");
+        gtk_action_set_visible (action, is_fullscreen);
+        G_GNUC_END_IGNORE_DEPRECATIONS;
+    }
+
+    if (window_state_event)
+        return window_state_event (widget, event);
+
+    return FALSE;
+}
+
+#ifdef GDK_WINDOWING_X11
+static void
+terminal_window_window_manager_changed_cb (GdkScreen *screen,
+        TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkAction *action;
+    gboolean supports_fs;
+
+    supports_fs = gdk_x11_screen_supports_net_wm_hint (screen, gdk_atom_intern ("_NET_WM_STATE_FULLSCREEN", FALSE));
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_group_get_action (priv->action_group, "ViewFullscreen");
+    gtk_action_set_sensitive (action, supports_fs);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+}
+#endif
+
+static void
+terminal_window_screen_update (TerminalWindow *window,
+                               GdkScreen *screen)
+{
+    TerminalApp *app;
+
+#ifdef GDK_WINDOWING_X11
+    if (screen && GDK_IS_X11_SCREEN (screen))
+    {
+        terminal_window_window_manager_changed_cb (screen, window);
+        g_signal_connect (screen, "window-manager-changed",
+                          G_CALLBACK (terminal_window_window_manager_changed_cb), window);
+    }
+#endif
+
+    if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (screen), "GT::HasSettingsConnection")))
+        return;
+
+    g_object_set_data_full (G_OBJECT (screen), "GT::HasSettingsConnection",
+                            GINT_TO_POINTER (TRUE),
+                            (GDestroyNotify) app_setting_notify_destroy_cb);
+
+    app = terminal_app_get ();
+    app_setting_notify_cb (app, NULL, screen);
+    g_signal_connect (app, "notify::" TERMINAL_APP_ENABLE_MNEMONICS,
+                      G_CALLBACK (app_setting_notify_cb), screen);
+    g_signal_connect (app, "notify::" TERMINAL_APP_ENABLE_MENU_BAR_ACCEL,
+                      G_CALLBACK (app_setting_notify_cb), screen);
+}
+
+static void
+terminal_window_screen_changed (GtkWidget *widget,
+                                GdkScreen *previous_screen)
+{
+    TerminalWindow *window = TERMINAL_WINDOW (widget);
+    void (* screen_changed) (GtkWidget *, GdkScreen *) =
+        GTK_WIDGET_CLASS (terminal_window_parent_class)->screen_changed;
+    GdkScreen *screen;
+
+    if (screen_changed)
+        screen_changed (widget, previous_screen);
+
+    screen = gtk_widget_get_screen (widget);
+    if (previous_screen == screen)
+        return;
+
+#ifdef GDK_WINDOWING_X11
+    if (previous_screen && GDK_IS_X11_SCREEN (previous_screen))
+    {
+        g_signal_handlers_disconnect_by_func (previous_screen,
+                                              G_CALLBACK (terminal_window_window_manager_changed_cb),
+                                              window);
+    }
+#endif
+
+    if (!screen)
+        return;
+
+    terminal_window_screen_update (window, screen);
+}
+
+static void
+terminal_window_profile_list_changed_cb (TerminalApp *app,
+        TerminalWindow *window)
+{
+    terminal_window_update_set_profile_menu (window);
+    terminal_window_update_new_terminal_menus (window);
+}
+
+static void
+terminal_window_encoding_list_changed_cb (TerminalApp *app,
+        TerminalWindow *window)
+{
+    terminal_window_update_encoding_menu (window);
+}
+
+static void
+terminal_window_init (TerminalWindow *window)
+{
+    const GtkActionEntry menu_entries[] =
+    {
+        /* Toplevel */
+        { "File", NULL, N_("_File"), NULL, NULL, NULL },
+        { "FileNewWindowProfiles", "utilities-terminal", N_("Open _Terminal"), NULL, NULL, NULL },
+        { "FileNewTabProfiles", STOCK_NEW_TAB, N_("Open Ta_b"), NULL, NULL, NULL },
+        { "Edit", NULL, N_("_Edit"), NULL, NULL, NULL },
+        { "View", NULL, N_("_View"), NULL, NULL, NULL },
+        { "Search", NULL, N_("_Search"), NULL, NULL, NULL },
+        { "Terminal", NULL, N_("_Terminal"), NULL, NULL, NULL },
+        { "Tabs", NULL, N_("Ta_bs"), NULL, NULL, NULL },
+        { "Help", NULL, N_("_Help"), NULL, NULL, NULL },
+        { "Popup", NULL, NULL, NULL, NULL, NULL },
+        { "NotebookPopup", NULL, "", NULL, NULL, NULL },
+
+        /* File menu */
+        {
+            "FileNewWindow", "utilities-terminal", N_("Open _Terminal"), "<shift><control>N",
+            NULL,
+            G_CALLBACK (file_new_window_callback)
+        },
+        {
+            "FileNewTab", STOCK_NEW_TAB, N_("Open Ta_b"), "<shift><control>T",
+            NULL,
+            G_CALLBACK (file_new_tab_callback)
+        },
+        {
+            "FileNewProfile", "document-open", N_("New _Profile…"), "",
+            NULL,
+            G_CALLBACK (file_new_profile_callback)
+        },
+        {
+            "FileSaveContents", "document-save", N_("_Save Contents"), "",
+            NULL,
+            G_CALLBACK (file_save_contents_callback)
+        },
+        {
+            "FileCloseTab", "window-close", N_("C_lose Tab"), "<shift><control>W",
+            NULL,
+            G_CALLBACK (file_close_tab_callback)
+        },
+        {
+            "FileCloseWindow", "window-close", N_("_Close Window"), "<shift><control>Q",
+            NULL,
+            G_CALLBACK (file_close_window_callback)
+        },
+
+        /* Edit menu */
+        {
+            "EditCopy", "edit-copy", N_("_Copy"), "<shift><control>C",
+            NULL,
+            G_CALLBACK (edit_copy_callback)
+        },
+        {
+            "EditPaste", "edit-paste", N_("_Paste"), "<shift><control>V",
+            NULL,
+            G_CALLBACK (edit_paste_callback)
+        },
+        {
+            "EditPasteURIPaths", "edit-paste", N_("Paste _Filenames"), "",
+            NULL,
+            G_CALLBACK (edit_paste_callback)
+        },
+        {
+            "EditSelectAll", "edit-select-all", N_("Select _All"), "<shift><control>A",
+            NULL,
+            G_CALLBACK (edit_select_all_callback)
+        },
+        {
+            "EditProfiles", NULL, N_("P_rofiles…"), NULL,
+            NULL,
+            G_CALLBACK (edit_profiles_callback)
+        },
+        {
+            "EditKeybindings", NULL, N_("_Keyboard Shortcuts…"), NULL,
+            NULL,
+            G_CALLBACK (edit_keybindings_callback)
+        },
+        {
+            "EditCurrentProfile", NULL, N_("Pr_ofile Preferences"), NULL,
+            NULL,
+            G_CALLBACK (edit_current_profile_callback)
+        },
+
+        /* View menu */
+        {
+            "ViewZoomIn", "zoom-in", N_("Zoom _In"), "<control>plus",
+            NULL,
+            G_CALLBACK (view_zoom_in_callback)
+        },
+        {
+            "ViewZoomOut", "zoom-out", N_("Zoom _Out"), "<control>minus",
+            NULL,
+            G_CALLBACK (view_zoom_out_callback)
+        },
+        {
+            "ViewZoom100", "zoom-original", N_("_Normal Size"), "<control>0",
+            NULL,
+            G_CALLBACK (view_zoom_normal_callback)
+        },
+
+        /* Search menu */
+        {
+            "SearchFind", "edit-find", N_("_Find..."), "<shift><control>F",
+            NULL,
+            G_CALLBACK (search_find_callback)
+        },
+        {
+            "SearchFindNext", NULL, N_("Find Ne_xt"), "<shift><control>H",
+            NULL,
+            G_CALLBACK (search_find_next_callback)
+        },
+        {
+            "SearchFindPrevious", NULL, N_("Find Pre_vious"), "<shift><control>G",
+            NULL,
+            G_CALLBACK (search_find_prev_callback)
+        },
+        {
+            "SearchClearHighlight", NULL, N_("_Clear Highlight"), "<shift><control>J",
+            NULL,
+            G_CALLBACK (search_clear_highlight_callback)
+        },
+#if 0
+        {
+            "SearchGoToLine", "go-jump", N_("Go to _Line..."), "<shift><control>I",
+            NULL,
+            G_CALLBACK (search_goto_line_callback)
+        },
+        {
+            "SearchIncrementalSearch", "edit-find", N_("_Incremental Search..."), "<shift><control>K",
+            NULL,
+            G_CALLBACK (search_incremental_search_callback)
+        },
+#endif
+
+        /* Terminal menu */
+        { "TerminalProfiles", NULL, N_("Change _Profile"), NULL, NULL, NULL },
+        {
+            "ProfilePrevious", NULL, N_("_Previous Profile"), "<alt>Page_Up",
+            NULL,
+            G_CALLBACK (terminal_next_or_previous_profile_cb)
+        },
+        {
+            "ProfileNext", NULL, N_("_Next Profile"), "<alt>Page_Down",
+            NULL,
+            G_CALLBACK (terminal_next_or_previous_profile_cb)
+        },
+        {
+            "TerminalSetTitle", NULL, N_("_Set Title…"), NULL,
+            NULL,
+            G_CALLBACK (terminal_set_title_callback)
+        },
+        { "TerminalSetEncoding", NULL, N_("Set _Character Encoding"), NULL, NULL, NULL },
+        {
+            "TerminalReset", NULL, N_("_Reset"), NULL,
+            NULL,
+            G_CALLBACK (terminal_reset_callback)
+        },
+        {
+            "TerminalResetClear", NULL, N_("Reset and C_lear"), NULL,
+            NULL,
+            G_CALLBACK (terminal_reset_clear_callback)
+        },
+
+        /* Terminal/Encodings menu */
+        {
+            "TerminalAddEncoding", NULL, N_("_Add or Remove…"), NULL,
+            NULL,
+            G_CALLBACK (terminal_add_encoding_callback)
+        },
+
+        /* Tabs menu */
+        {
+            "TabsPrevious", NULL, N_("_Previous Tab"), "<control>Page_Up",
+            NULL,
+            G_CALLBACK (tabs_next_or_previous_tab_cb)
+        },
+        {
+            "TabsNext", NULL, N_("_Next Tab"), "<control>Page_Down",
+            NULL,
+            G_CALLBACK (tabs_next_or_previous_tab_cb)
+        },
+        {
+            "TabsMoveLeft", NULL, N_("Move Tab _Left"), "<shift><control>Page_Up",
+            NULL,
+            G_CALLBACK (tabs_move_left_callback)
+        },
+        {
+            "TabsMoveRight", NULL, N_("Move Tab _Right"), "<shift><control>Page_Down",
+            NULL,
+            G_CALLBACK (tabs_move_right_callback)
+        },
+        {
+            "TabsDetach", NULL, N_("_Detach tab"), NULL,
+            NULL,
+            G_CALLBACK (tabs_detach_tab_callback)
+        },
+
+        /* Help menu */
+        {
+            "HelpContents", "help-browser", N_("_Contents"), "F1",
+            NULL,
+            G_CALLBACK (help_contents_callback)
+        },
+        {
+            "HelpAbout", "help-about", N_("_About"), NULL,
+            NULL,
+            G_CALLBACK (help_about_callback)
+        },
+
+        /* Popup menu */
+        {
+            "PopupOpenHyperlink", NULL, N_("_Open Hyperlink"), NULL,
+            NULL,
+            G_CALLBACK (popup_open_hyperlink_callback)
+        },
+        {
+            "PopupCopyHyperlinkAddress", NULL, N_("_Copy Hyperlink Address"), NULL,
+            NULL,
+            G_CALLBACK (popup_copy_hyperlink_callback)
+        },
+        {
+            "PopupSendEmail", NULL, N_("_Send Mail To…"), NULL,
+            NULL,
+            G_CALLBACK (popup_open_url_callback)
+        },
+        {
+            "PopupCopyEmailAddress", NULL, N_("_Copy E-mail Address"), NULL,
+            NULL,
+            G_CALLBACK (popup_copy_url_callback)
+        },
+        {
+            "PopupCall", NULL, N_("C_all To…"), NULL,
+            NULL,
+            G_CALLBACK (popup_open_url_callback)
+        },
+        {
+            "PopupCopyCallAddress", NULL, N_("_Copy Call Address"), NULL,
+            NULL,
+            G_CALLBACK (popup_copy_url_callback)
+        },
+        {
+            "PopupOpenLink", NULL, N_("_Open Link"), NULL,
+            NULL,
+            G_CALLBACK (popup_open_url_callback)
+        },
+        {
+            "PopupCopyLinkAddress", NULL, N_("_Copy Link Address"), NULL,
+            NULL,
+            G_CALLBACK (popup_copy_url_callback)
+        },
+        { "PopupTerminalProfiles", NULL, N_("P_rofiles"), NULL, NULL, NULL },
+        {
+            "PopupCopy", "edit-copy", N_("_Copy"), "",
+            NULL,
+            G_CALLBACK (edit_copy_callback)
+        },
+        {
+            "PopupPaste", "edit-paste", N_("_Paste"), "",
+            NULL,
+            G_CALLBACK (edit_paste_callback)
+        },
+        {
+            "PopupPasteURIPaths", "edit-paste", N_("Paste _Filenames"), "",
+            NULL,
+            G_CALLBACK (edit_paste_callback)
+        },
+        {
+            "PopupNewTerminal", "utilities-terminal", N_("Open _Terminal"), NULL,
+            NULL,
+            G_CALLBACK (file_new_window_callback)
+        },
+        {
+            "PopupNewTab", "tab-new", N_("Open Ta_b"), NULL,
+            NULL,
+            G_CALLBACK (file_new_tab_callback)
+        },
+        {
+            "PopupCloseWindow", "window-close", N_("C_lose Window"), NULL,
+            NULL,
+            G_CALLBACK (file_close_window_callback)
+        },
+        {
+            "PopupCloseTab", "window-close", N_("C_lose Tab"), NULL,
+            NULL,
+            G_CALLBACK (file_close_tab_callback)
+        },
+        {
+            "PopupLeaveFullscreen", NULL, N_("L_eave Full Screen"), NULL,
+            NULL,
+            G_CALLBACK (popup_leave_fullscreen_callback)
+        },
+        { "PopupInputMethods", NULL, N_("_Input Methods"), NULL, NULL, NULL }
+    };
+
+    const GtkToggleActionEntry toggle_menu_entries[] =
+    {
+        /* View Menu */
+        {
+            "ViewMenubar", NULL, N_("Show _Menubar"), NULL,
+            NULL,
+            G_CALLBACK (view_menubar_toggled_callback),
+            FALSE
+        },
+        {
+            "ViewFullscreen", NULL, N_("_Full Screen"), NULL,
+            NULL,
+            G_CALLBACK (view_fullscreen_toggled_callback),
+            FALSE
+        }
+    };
+    TerminalWindowPrivate *priv;
+    TerminalApp *app;
+    GtkActionGroup *action_group;
+    GtkAction *action;
+    GtkUIManager *manager;
+    GError *error;
+    GtkWindowGroup *window_group;
+    GtkAccelGroup *accel_group;
+    GtkClipboard *clipboard;
+
+    priv = window->priv = terminal_window_get_instance_private (window);
+
+    g_signal_connect (G_OBJECT (window), "delete_event",
+                      G_CALLBACK(terminal_window_delete_event),
+                      NULL);
+    g_signal_connect (G_OBJECT (window), "focus_in_event",
+                      G_CALLBACK(terminal_window_focus_in_event),
+                      NULL);
+
+#ifdef MATE_ENABLE_DEBUG
+    _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_GEOMETRY)
+    {
+        g_signal_connect_after (window, "size-allocate", G_CALLBACK (terminal_window_size_allocate_cb), NULL);
+    }
+#endif
+
+    GtkStyleContext *context;
+
+    context = gtk_widget_get_style_context (GTK_WIDGET (window));
+    gtk_style_context_add_class (context, "mate-terminal");
+
+    gtk_window_set_title (GTK_WINDOW (window), _("Terminal"));
+
+    priv->active_screen = NULL;
+    priv->menubar_visible = FALSE;
+
+    priv->main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+    gtk_container_add (GTK_CONTAINER (window), priv->main_vbox);
+    gtk_widget_show (priv->main_vbox);
+
+    priv->notebook = gtk_notebook_new ();
+    gtk_notebook_set_scrollable (GTK_NOTEBOOK (priv->notebook), TRUE);
+    gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
+    gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
+    gtk_notebook_set_group_name (GTK_NOTEBOOK (priv->notebook), I_("mate-terminal-window"));
+    g_signal_connect (priv->notebook, "button-press-event",
+                      G_CALLBACK (notebook_button_press_cb), settings_global);
+    g_signal_connect (window, "key-press-event",
+                      G_CALLBACK (window_key_press_cb), settings_global);
+    g_signal_connect (priv->notebook, "popup-menu",
+                      G_CALLBACK (notebook_popup_menu_cb), window);
+    g_signal_connect_after (priv->notebook, "switch-page",
+                            G_CALLBACK (notebook_page_selected_callback), window);
+    g_signal_connect_after (priv->notebook, "page-added",
+                            G_CALLBACK (notebook_page_added_callback), window);
+    g_signal_connect_after (priv->notebook, "page-removed",
+                            G_CALLBACK (notebook_page_removed_callback), window);
+    g_signal_connect_data (priv->notebook, "page-reordered",
+                           G_CALLBACK (terminal_window_update_tabs_menu_sensitivity),
+                           window, NULL, G_CONNECT_SWAPPED | G_CONNECT_AFTER);
+
+    gtk_widget_add_events (priv->notebook, GDK_SCROLL_MASK);
+    g_signal_connect (priv->notebook, "scroll-event",
+                            G_CALLBACK (notebook_scroll_event_cb), window);
+
+    g_signal_connect (priv->notebook, "create-window",
+                    G_CALLBACK (handle_tab_droped_on_desktop), window);
+
+    gtk_box_pack_end (GTK_BOX (priv->main_vbox), priv->notebook, TRUE, TRUE, 0);
+    gtk_widget_show (priv->notebook);
+
+    priv->old_char_width = -1;
+    priv->old_char_height = -1;
+
+    priv->old_chrome_width = -1;
+    priv->old_chrome_height = -1;
+    priv->old_padding_width = -1;
+    priv->old_padding_height = -1;
+
+    priv->old_geometry_widget = NULL;
+
+    /* Create the UI manager */
+    manager = priv->ui_manager = gtk_ui_manager_new ();
+
+    accel_group = gtk_ui_manager_get_accel_group (manager);
+    gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
+    /* Workaround for bug #453193, bug #138609 and bug #559728 */
+    g_signal_connect_after (accel_group, "accel-activate",
+                            G_CALLBACK (terminal_window_accel_activate_cb), window);
+
+    /* Create the actions */
+    /* Note that this action group name is used in terminal-accels.c; do not change it */
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    priv->action_group = action_group = gtk_action_group_new ("Main");
+    gtk_action_group_set_translation_domain (action_group, NULL);
+    gtk_action_group_add_actions (action_group, menu_entries,
+                                  G_N_ELEMENTS (menu_entries), window);
+    gtk_action_group_add_toggle_actions (action_group,
+                                         toggle_menu_entries,
+                                         G_N_ELEMENTS (toggle_menu_entries),
+                                         window);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+    gtk_ui_manager_insert_action_group (manager, action_group, 0);
+    g_object_unref (action_group);
+
+   clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
+   g_signal_connect_swapped (clipboard, "owner-change",
+                             G_CALLBACK (update_edit_menu), window);
+   update_edit_menu (window);
+    /* Idem for this action, since the window is not fullscreen. */
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_group_get_action (priv->action_group, "PopupLeaveFullscreen");
+    gtk_action_set_visible (action, FALSE);
+
+#ifndef ENABLE_SAVE
+    action = gtk_action_group_get_action (priv->action_group, "FileSaveContents");
+    gtk_action_set_visible (action, FALSE);
+#endif
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+
+    /* Load the UI */
+    error = NULL;
+    priv->ui_id = gtk_ui_manager_add_ui_from_resource (manager,
+                  TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/terminal.xml",
+                  &error);
+    g_assert_no_error (error);
+
+    priv->menubar = gtk_ui_manager_get_widget (manager, "/menubar");
+    gtk_box_pack_start (GTK_BOX (priv->main_vbox),
+                        priv->menubar,
+                        FALSE, FALSE, 0);
+
+    /* Add tabs menu */
+    priv->tabs_menu = terminal_tabs_menu_new (window);
+
+    app = terminal_app_get ();
+    terminal_window_profile_list_changed_cb (app, window);
+    g_signal_connect (app, "profile-list-changed",
+                      G_CALLBACK (terminal_window_profile_list_changed_cb), window);
+
+    terminal_window_encoding_list_changed_cb (app, window);
+    g_signal_connect (app, "encoding-list-changed",
+                      G_CALLBACK (terminal_window_encoding_list_changed_cb), window);
+
+    terminal_window_set_menubar_visible (window, TRUE);
+    priv->use_default_menubar_visibility = TRUE;
+
+    terminal_window_update_size_to_menu (window);
+
+    /* We have to explicitly call this, since screen-changed is NOT
+     * emitted for the toplevel the first time!
+     */
+    terminal_window_screen_update (window, gtk_widget_get_screen (GTK_WIDGET (window)));
+
+    window_group = gtk_window_group_new ();
+    gtk_window_group_add_window (window_group, GTK_WINDOW (window));
+    g_object_unref (window_group);
+
+    terminal_util_set_unique_role (GTK_WINDOW (window), "mate-terminal-window");
+}
+
+static void
+terminal_window_class_init (TerminalWindowClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+    GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+    object_class->dispose = terminal_window_dispose;
+    object_class->finalize = terminal_window_finalize;
+
+    widget_class->show = terminal_window_show;
+    widget_class->realize = terminal_window_realize;
+    widget_class->draw = terminal_window_draw;
+    widget_class->map_event = terminal_window_map_event;
+    widget_class->window_state_event = terminal_window_state_event;
+    widget_class->screen_changed = terminal_window_screen_changed;
+}
+
+static void
+terminal_window_dispose (GObject *object)
+{
+    TerminalWindow *window = TERMINAL_WINDOW (object);
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalApp *app;
+    GdkScreen *screen;
+    GtkClipboard *clipboard;
+
+    remove_popup_info (window);
+
+    priv->disposed = TRUE;
+
+    if (priv->tabs_menu)
+    {
+        g_object_unref (priv->tabs_menu);
+        priv->tabs_menu = NULL;
+    }
+
+    if (priv->profiles_action_group != NULL)
+        disconnect_profiles_from_actions_in_group (priv->profiles_action_group);
+    if (priv->new_terminal_action_group != NULL)
+        disconnect_profiles_from_actions_in_group (priv->new_terminal_action_group);
+
+    app = terminal_app_get ();
+    g_signal_handlers_disconnect_by_func (app,
+                                          G_CALLBACK (terminal_window_profile_list_changed_cb),
+                                          window);
+    g_signal_handlers_disconnect_by_func (app,
+                                          G_CALLBACK (terminal_window_encoding_list_changed_cb),
+                                          window);
+    clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
+    g_signal_handlers_disconnect_by_func (clipboard,
+                                          G_CALLBACK (update_edit_menu),
+                                          window);
+
+#ifdef GDK_WINDOWING_X11
+    screen = gtk_widget_get_screen (GTK_WIDGET (object));
+    if (screen && GDK_IS_X11_SCREEN (screen))
+    {
+        g_signal_handlers_disconnect_by_func (screen,
+                                              G_CALLBACK (terminal_window_window_manager_changed_cb),
+                                              window);
+    }
+#endif
+
+    G_OBJECT_CLASS (terminal_window_parent_class)->dispose (object);
+}
+
+static void
+terminal_window_finalize (GObject *object)
+{
+    TerminalWindow *window = TERMINAL_WINDOW (object);
+    TerminalWindowPrivate *priv = window->priv;
+
+    g_object_unref (priv->ui_manager);
+
+    if (priv->confirm_close_dialog)
+        gtk_dialog_response (GTK_DIALOG (priv->confirm_close_dialog),
+                             GTK_RESPONSE_DELETE_EVENT);
+
+    if (priv->search_find_dialog)
+        gtk_dialog_response (GTK_DIALOG (priv->search_find_dialog),
+                             GTK_RESPONSE_DELETE_EVENT);
+
+    G_OBJECT_CLASS (terminal_window_parent_class)->finalize (object);
+}
+
+static gboolean
+terminal_window_delete_event (GtkWidget *widget,
+                              GdkEvent *event,
+                              gpointer data)
+{
+    return confirm_close_window_or_tab (TERMINAL_WINDOW (widget), NULL);
+}
+
+static gboolean
+terminal_window_focus_in_event (GtkWidget *widget,
+                                GdkEventFocus *event,
+                                gpointer data)
+{
+  TerminalWindow *window = TERMINAL_WINDOW (widget);
+  TerminalWindowPrivate *priv = window->priv;
+
+  if (event->in)
+    priv->focus_time = g_get_real_time () / G_USEC_PER_SEC;
+
+  return FALSE;
+}
+
+static void
+terminal_window_show (GtkWidget *widget)
+{
+    TerminalWindow *window = TERMINAL_WINDOW (widget);
+    GtkAllocation widget_allocation;
+
+    gtk_widget_get_allocation (widget, &widget_allocation);
+
+    TerminalWindowPrivate *priv = window->priv;
+
+    if (priv->active_screen != NULL)
+    {
+        terminal_window_update_copy_selection (priv->active_screen, window);
+#if 0
+        /* At this point, we have our GdkScreen, and hence the right
+         * font size, so we can go ahead and size the window. */
+        terminal_window_update_size (window, priv->active_screen, FALSE);
+#endif
+    }
+
+    terminal_window_update_geometry (window);
+
+    _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                           "[window %p] show, size %d : %d at (%d, %d)\n",
+                           widget,
+                           widget_allocation.width, widget_allocation.height,
+                           widget_allocation.x, widget_allocation.y);
+
+    GTK_WIDGET_CLASS (terminal_window_parent_class)->show (widget);
+}
+
+TerminalWindow*
+terminal_window_new (void)
+{
+    return g_object_new (TERMINAL_TYPE_WINDOW, NULL);
+}
+
+/**
+ * terminal_window_set_is_restored:
+ * @window:
+ *
+ * Marks the window as restored from session.
+ */
+void
+terminal_window_set_is_restored (TerminalWindow *window)
+{
+    g_return_if_fail (TERMINAL_IS_WINDOW (window));
+    g_return_if_fail (!gtk_widget_get_mapped (GTK_WIDGET (window)));
+
+    window->priv->clear_demands_attention = TRUE;
+}
+
+static void
+profile_set_callback (TerminalScreen *screen,
+                      TerminalProfile *old_profile,
+                      TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    if (!gtk_widget_get_realized (GTK_WIDGET (window)))
+        return;
+
+    if (screen != priv->active_screen)
+        return;
+
+    terminal_window_update_set_profile_menu_active_profile (window);
+}
+
+static void
+sync_screen_title (TerminalScreen *screen,
+                   GParamSpec *psepc,
+                   TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    if (screen != priv->active_screen)
+        return;
+
+    gtk_window_set_title (GTK_WINDOW (window), terminal_screen_get_title (screen));
+}
+
+static void
+sync_screen_icon_title (TerminalScreen *screen,
+                        GParamSpec *psepc,
+                        TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    if (!gtk_widget_get_realized (GTK_WIDGET (window)))
+        return;
+
+    if (screen != priv->active_screen)
+        return;
+
+    if (!terminal_screen_get_icon_title_set (screen))
+        return;
+
+    gdk_window_set_icon_name (gtk_widget_get_window (GTK_WIDGET (window)), terminal_screen_get_icon_title (screen));
+}
+
+static void
+sync_screen_icon_title_set (TerminalScreen *screen,
+                            GParamSpec *psepc,
+                            TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    if (!gtk_widget_get_realized (GTK_WIDGET (window)))
+        return;
+
+    if (screen != priv->active_screen)
+        return;
+
+    if (terminal_screen_get_icon_title_set (screen))
+        return;
+
+    /* Need to reset the icon name */
+    gdk_window_set_icon_name (gtk_widget_get_window (GTK_WIDGET (window)), NULL);
+
+    /* Re-setting the right title will be done by the notify::title handler which comes after this one */
+}
+
+static void
+screen_hyperlink_hover_uri_changed (TerminalScreen *screen,
+                                    const char *uri,
+                                    const GdkRectangle *bbox G_GNUC_UNUSED,
+                                    TerminalWindow *window G_GNUC_UNUSED)
+{
+    char *label = NULL;
+
+    if (!gtk_widget_get_realized (GTK_WIDGET (screen)))
+        return;
+
+    label = terminal_util_hyperlink_uri_label (uri);
+
+    gtk_widget_set_tooltip_text (GTK_WIDGET (screen), label);
+    g_free(label);
+}
+
+/* Notebook callbacks */
+
+static void
+close_button_clicked_cb (GtkWidget *tab_label,
+                         GtkWidget *screen_container)
+{
+    GtkWidget *toplevel;
+    TerminalWindow *window;
+    TerminalScreen *screen;
+
+    toplevel = gtk_widget_get_toplevel (screen_container);
+    if (!gtk_widget_is_toplevel (toplevel))
+        return;
+
+    if (!TERMINAL_IS_WINDOW (toplevel))
+        return;
+
+    window = TERMINAL_WINDOW (toplevel);
+
+    screen = terminal_screen_container_get_screen (TERMINAL_SCREEN_CONTAINER (screen_container));
+    if (confirm_close_window_or_tab (window, screen))
+        return;
+
+    terminal_window_remove_screen (window, screen);
+}
+
+void
+terminal_window_add_screen (TerminalWindow *window,
+                            TerminalScreen *screen,
+                            int            position)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkWidget *old_window;
+    GtkWidget *screen_container, *tab_label;
+
+    old_window = gtk_widget_get_toplevel (GTK_WIDGET (screen));
+    if (gtk_widget_is_toplevel (old_window) &&
+            TERMINAL_IS_WINDOW (old_window) &&
+            TERMINAL_WINDOW (old_window)== window)
+        return;
+
+    if (TERMINAL_IS_WINDOW (old_window))
+        terminal_window_remove_screen (TERMINAL_WINDOW (old_window), screen);
+
+    screen_container = terminal_screen_container_new (screen);
+    gtk_widget_show (screen_container);
+
+    update_tab_visibility (window, +1);
+
+    tab_label = terminal_tab_label_new (screen);
+    g_signal_connect (tab_label, "close-button-clicked",
+                      G_CALLBACK (close_button_clicked_cb), screen_container);
+
+    gtk_notebook_insert_page (GTK_NOTEBOOK (priv->notebook),
+                              screen_container,
+                              tab_label,
+                              position);
+    gtk_container_child_set (GTK_CONTAINER (priv->notebook),
+                             screen_container,
+                             "tab-expand", TRUE,
+                             "tab-fill", TRUE,
+                             NULL);
+    gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (priv->notebook),
+                                      screen_container,
+                                      TRUE);
+    gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (priv->notebook),
+                                     screen_container,
+                                     TRUE);
+}
+
+void
+terminal_window_remove_screen (TerminalWindow *window,
+                               TerminalScreen *screen)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalScreenContainer *screen_container;
+
+    g_return_if_fail (gtk_widget_get_toplevel (GTK_WIDGET (screen)) == GTK_WIDGET (window));
+
+    update_tab_visibility (window, -1);
+
+    screen_container = terminal_screen_container_get_from_screen (screen);
+    if (detach_tab)
+    {
+        gtk_notebook_detach_tab (GTK_NOTEBOOK (priv->notebook),
+                                 GTK_WIDGET (screen_container));
+        detach_tab = FALSE;
+    }
+    else
+        gtk_container_remove (GTK_CONTAINER (priv->notebook),
+                              GTK_WIDGET (screen_container));
+}
+
+void
+terminal_window_move_screen (TerminalWindow *source_window,
+                             TerminalWindow *dest_window,
+                             TerminalScreen *screen,
+                             int dest_position)
+{
+    TerminalScreenContainer *screen_container;
+
+    g_return_if_fail (TERMINAL_IS_WINDOW (source_window));
+    g_return_if_fail (TERMINAL_IS_WINDOW (dest_window));
+    g_return_if_fail (TERMINAL_IS_SCREEN (screen));
+    g_return_if_fail (gtk_widget_get_toplevel (GTK_WIDGET (screen)) == GTK_WIDGET (source_window));
+    g_return_if_fail (dest_position >= -1);
+
+    screen_container = terminal_screen_container_get_from_screen (screen);
+    g_assert (TERMINAL_IS_SCREEN_CONTAINER (screen_container));
+
+    /* We have to ref the screen container as well as the screen,
+     * because otherwise removing the screen container from the source
+     * window's notebook will cause the container and its containing
+     * screen to be gtk_widget_destroy()ed!
+     */
+    g_object_ref_sink (screen_container);
+    g_object_ref_sink (screen);
+
+    detach_tab = TRUE;
+
+    terminal_window_remove_screen (source_window, screen);
+
+    /* Now we can safely remove the screen from the container and let the container die */
+    gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (GTK_WIDGET (screen))), GTK_WIDGET (screen));
+    g_object_unref (screen_container);
+
+    terminal_window_add_screen (dest_window, screen, dest_position);
+    gtk_notebook_set_current_page (GTK_NOTEBOOK (dest_window->priv->notebook), dest_position);
+    g_object_unref (screen);
+}
+
+GList*
+terminal_window_list_screen_containers (TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    /* We are trusting that GtkNotebook will return pages in order */
+    return gtk_container_get_children (GTK_CONTAINER (priv->notebook));
+}
+
+void
+terminal_window_set_menubar_visible (TerminalWindow *window,
+                                     gboolean        setting)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkAction *action;
+
+    /* it's been set now, so don't override when adding a screen.
+     * this side effect must happen before we short-circuit below.
+     */
+    priv->use_default_menubar_visibility = FALSE;
+
+    if (setting == priv->menubar_visible)
+        return;
+
+    priv->menubar_visible = (setting != FALSE);
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_group_get_action (priv->action_group, "ViewMenubar");
+    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), setting);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+
+    g_object_set (priv->menubar, "visible", setting, NULL);
+
+    /* FIXMEchpe: use gtk_widget_get_realized instead? */
+    if (priv->active_screen)
+    {
+        _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                               "[window %p] setting size after toggling menubar visibility\n",
+                               window);
+
+        terminal_window_update_size (window, priv->active_screen, TRUE);
+    }
+}
+
+gboolean
+terminal_window_get_menubar_visible (TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    return priv->menubar_visible;
+}
+
+GtkWidget *
+terminal_window_get_notebook (TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    g_return_val_if_fail (TERMINAL_IS_WINDOW (window), NULL);
+
+    return GTK_WIDGET (priv->notebook);
+}
+
+void
+terminal_window_update_size (TerminalWindow *window,
+                          TerminalScreen *screen,
+                          gboolean        even_if_mapped)
+{
+    terminal_window_update_size_set_geometry (window, screen,
+                                              even_if_mapped, NULL);
+}
+
+gboolean
+terminal_window_update_size_set_geometry (TerminalWindow *window,
+                                          TerminalScreen *screen,
+                                          gboolean        even_if_mapped,
+                                          gchar          *geometry_string)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkWidget *widget;
+    GtkWidget *app;
+    gboolean result;
+    int geom_result;
+    gint force_pos_x = 0, force_pos_y = 0;
+    unsigned int force_grid_width = 0, force_grid_height = 0;
+    int grid_width, grid_height;
+    gint pixel_width, pixel_height;
+    GdkWindow *gdk_window;
+    GdkGravity pos_gravity;
+
+    gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
+    result = TRUE;
+
+    if (gdk_window != NULL &&
+        (gdk_window_get_state (gdk_window) &
+         (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_TILED)))
+    {
+        /* Don't adjust the size of maximized or tiled (snapped, half-maximized)
+         * windows: if we do, there will be ugly gaps of up to 1 character cell
+         * around otherwise tiled windows. */
+        return result;
+    }
+
+    /* be sure our geometry is up-to-date */
+    terminal_window_update_geometry (window);
+
+    if (GTK_IS_WIDGET (screen))
+        widget = GTK_WIDGET (screen);
+    else
+        widget = GTK_WIDGET (window);
+
+    app = gtk_widget_get_toplevel (widget);
+    g_assert (app != NULL);
+
+    terminal_screen_get_size (screen, &grid_width, &grid_height);
+    if (geometry_string != NULL)
+    {
+        geom_result = terminal_window_XParseGeometry (geometry_string,
+                                                      &force_pos_x,
+                                                      &force_pos_y,
+                                                      &force_grid_width,
+                                                      &force_grid_height);
+        if (geom_result == NoValue)
+            result = FALSE;
+    }
+    else
+        geom_result = NoValue;
+
+    if ((geom_result & WidthValue) != 0)
+        grid_width = force_grid_width;
+    if ((geom_result & HeightValue) != 0)
+        grid_height = force_grid_height;
+
+    /* the "old" struct members were updated by update_geometry */
+    pixel_width = priv->old_chrome_width + grid_width * priv->old_char_width;
+    pixel_height = priv->old_chrome_height + grid_height * priv->old_char_height;
+
+    _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                           "[window %p] size is %dx%d cells of %dx%d px\n",
+                           window, grid_width, grid_height,
+                           priv->old_char_width, priv->old_char_height);
+
+    _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                           "[window %p] %dx%d + %dx%d = %dx%d\n",
+                           window, grid_width * priv->old_char_width,
+                           grid_height * priv->old_char_height,
+                           priv->old_chrome_width, priv->old_chrome_height,
+                           pixel_width, pixel_height);
+
+    pos_gravity = GDK_GRAVITY_NORTH_WEST;
+    if ((geom_result & XNegative) != 0 && (geom_result & YNegative) != 0)
+        pos_gravity = GDK_GRAVITY_SOUTH_EAST;
+    else if ((geom_result & XNegative) != 0)
+        pos_gravity = GDK_GRAVITY_NORTH_EAST;
+    else if ((geom_result & YNegative) != 0)
+        pos_gravity = GDK_GRAVITY_SOUTH_WEST;
+
+    if ((geom_result & XValue) == 0)
+        force_pos_x = 0;
+    if ((geom_result & YValue) == 0)
+        force_pos_y = 0;
+
+    if (pos_gravity == GDK_GRAVITY_SOUTH_EAST ||
+        pos_gravity == GDK_GRAVITY_NORTH_EAST)
+        force_pos_x = WidthOfScreen (gdk_x11_screen_get_xscreen (gtk_widget_get_screen (app))) -
+                      pixel_width + force_pos_x;
+    if (pos_gravity == GDK_GRAVITY_SOUTH_WEST ||
+        pos_gravity == GDK_GRAVITY_SOUTH_EAST)
+        force_pos_y = HeightOfScreen (gdk_x11_screen_get_xscreen (gtk_widget_get_screen (app))) -
+                      pixel_height + force_pos_y;
+
+    /* we don't let you put a window offscreen; maybe some people would
+     * prefer to be able to, but it's kind of a bogus thing to do.
+     */
+    if (force_pos_x < 0)
+        force_pos_x = 0;
+    if (force_pos_y < 0)
+        force_pos_y = 0;
+
+    if (even_if_mapped && gtk_widget_get_mapped (app))
+        gtk_window_resize (GTK_WINDOW (app), pixel_width, pixel_height);
+    else
+        gtk_window_set_default_size (GTK_WINDOW (app), pixel_width, pixel_height);
+
+    if ((geom_result & XValue) != 0 || (geom_result & YValue) != 0)
+    {
+        gtk_window_set_gravity (GTK_WINDOW (app), pos_gravity);
+        gtk_window_move (GTK_WINDOW (app), force_pos_x, force_pos_y);
+    }
+
+    return result;
+}
+
+void
+terminal_window_switch_screen (TerminalWindow *window,
+                               TerminalScreen *screen)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalScreenContainer *screen_container;
+    int page_num;
+
+    screen_container = terminal_screen_container_get_from_screen (screen);
+    g_assert (TERMINAL_IS_SCREEN_CONTAINER (screen_container));
+    page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook),
+                                      GTK_WIDGET (screen_container));
+    gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), page_num);
+}
+
+TerminalScreen*
+terminal_window_get_active (TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    return priv->active_screen;
+}
+
+static gboolean
+notebook_button_press_cb (GtkWidget *widget,
+                          GdkEventButton *event,
+                          GSettings *settings)
+{
+    TerminalWindow *window = TERMINAL_WINDOW (gtk_widget_get_toplevel (widget));
+    TerminalWindowPrivate *priv = window->priv;
+    GtkNotebook *notebook = GTK_NOTEBOOK (widget);
+    GtkWidget *tab;
+    GtkWidget *menu;
+    GtkAction *action;
+    int tab_clicked;
+    int page_num;
+    int before_pages;
+    int later_pages;
+
+    if ((event->type == GDK_BUTTON_PRESS && event->button == 2) &&
+            (g_settings_get_boolean (settings, "middle-click-closes-tabs")))
+    {
+        tab_clicked = find_tab_num_at_pos (notebook,
+                                           (int)event->x_root,
+                                           (int)event->y_root);
+        if (tab_clicked >= 0)
+        {
+            before_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook));
+            page_num = gtk_notebook_get_current_page (notebook);
+            gtk_notebook_set_current_page (notebook, tab_clicked);
+            TerminalScreen *active_screen = priv->active_screen;
+
+                if (!(confirm_close_window_or_tab (window, active_screen)))
+                {
+                    update_tab_visibility (window, -1);
+                    gtk_notebook_remove_page(notebook, tab_clicked);
+                }
+
+                later_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook));
+
+                if (before_pages > later_pages) {
+                    if (tab_clicked > page_num)
+                        gtk_notebook_set_current_page (notebook, page_num);
+                    else if (tab_clicked < page_num)
+                        gtk_notebook_set_current_page (notebook, page_num - 1);
+                }
+                else
+                    gtk_notebook_set_current_page (notebook, page_num);
+
+        }
+    }
+
+    /* If the event is a double click, display the set title dialog */
+    if (event->type == GDK_DOUBLE_BUTTON_PRESS &&
+        find_tab_num_at_pos (notebook, (int) event->x_root, (int) event->y_root) >= 0)
+    {
+        terminal_set_title_callback (NULL, window);
+
+        /* handle ONLY the double-click event */
+        return TRUE;
+    }
+
+    if (event->type != GDK_BUTTON_PRESS ||
+            event->button != 3 ||
+            (event->state & gtk_accelerator_get_default_mod_mask ()) != 0)
+        return FALSE;
+
+    tab_clicked = find_tab_num_at_pos (notebook,
+                                       (int)event->x_root,
+                                       (int)event->y_root);
+    if (tab_clicked < 0)
+        return FALSE;
+
+    /* switch to the page the mouse is over */
+    gtk_notebook_set_current_page (notebook, tab_clicked);
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_group_get_action (priv->action_group, "NotebookPopup");
+    gtk_action_activate (action);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+
+    menu = gtk_ui_manager_get_widget (priv->ui_manager, "/NotebookPopup");
+    if (gtk_menu_get_attach_widget (GTK_MENU (menu)))
+      gtk_menu_detach (GTK_MENU (menu));
+    tab = gtk_notebook_get_nth_page (notebook, tab_clicked);
+    gtk_menu_attach_to_widget (GTK_MENU (menu), tab, NULL);
+    gtk_menu_popup_at_pointer (GTK_MENU (menu), NULL);
+
+    return TRUE;
+}
+
+static gboolean
+window_key_press_cb (GtkWidget *widget,
+                     GdkEventKey *event,
+                     GSettings *settings)
+{
+    if (g_settings_get_boolean (settings, "ctrl-tab-switch-tabs") &&
+        event->state & GDK_CONTROL_MASK)
+    {
+        TerminalWindow *window = TERMINAL_WINDOW (widget);
+        TerminalWindowPrivate *priv = window->priv;
+        GtkNotebook *notebook = GTK_NOTEBOOK (priv->notebook);
+
+        int pages = gtk_notebook_get_n_pages (notebook);
+        int page_num = gtk_notebook_get_current_page (notebook);
+
+        if (event->keyval == GDK_KEY_ISO_Left_Tab)
+        {
+            if (page_num != 0)
+                gtk_notebook_prev_page (notebook);
+            else
+                gtk_notebook_set_current_page (notebook, (pages - 1));
+            return TRUE;
+        }
+
+        if (event->keyval == GDK_KEY_Tab)
+        {
+            if (page_num != (pages -1))
+                gtk_notebook_next_page (notebook);
+            else
+                gtk_notebook_set_current_page (notebook, 0);
+            return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+static gboolean
+notebook_popup_menu_cb (GtkWidget *widget,
+                        TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkNotebook *notebook = GTK_NOTEBOOK (priv->notebook);
+    GtkWidget *focus_widget, *tab, *tab_label, *menu;
+    GtkAction *action;
+    int page_num;
+
+    focus_widget = gtk_window_get_focus (GTK_WINDOW (window));
+    /* Only respond if the notebook is the actual focus */
+    if (focus_widget != priv->notebook)
+        return FALSE;
+
+    page_num = gtk_notebook_get_current_page (notebook);
+    tab = gtk_notebook_get_nth_page (notebook, page_num);
+    tab_label = gtk_notebook_get_tab_label (notebook, tab);
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    action = gtk_action_group_get_action (priv->action_group, "NotebookPopup");
+    gtk_action_activate (action);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+
+    menu = gtk_ui_manager_get_widget (priv->ui_manager, "/NotebookPopup");
+    if (gtk_menu_get_attach_widget (GTK_MENU (menu)))
+      gtk_menu_detach (GTK_MENU (menu));
+    gtk_menu_attach_to_widget (GTK_MENU (menu), tab_label, NULL);
+    gtk_menu_popup_at_widget (GTK_MENU (menu),
+                              tab_label,
+                              GDK_GRAVITY_SOUTH_WEST,
+                              GDK_GRAVITY_NORTH_WEST,
+                              NULL);
+    gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
+
+    return TRUE;
+}
+
+static void
+notebook_page_selected_callback (GtkWidget       *notebook,
+                                 GtkWidget       *page_widget,
+                                 guint            page_num,
+                                 TerminalWindow  *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkWidget *widget;
+    TerminalScreen *screen;
+    int old_grid_width, old_grid_height;
+
+    _terminal_debug_print (TERMINAL_DEBUG_MDI,
+                           "[window %p] MDI: page-selected %d\n",
+                           window, page_num);
+
+    if (priv->disposed)
+        return;
+
+    screen = terminal_screen_container_get_screen (TERMINAL_SCREEN_CONTAINER (page_widget));
+    widget = GTK_WIDGET (screen);
+    g_assert (screen != NULL);
+
+    _terminal_debug_print (TERMINAL_DEBUG_MDI,
+                           "[window %p] MDI: setting active tab to screen %p (old active screen %p)\n",
+                           window, screen, priv->active_screen);
+
+    if (priv->active_screen == screen)
+        return;
+
+    if (priv->active_screen != NULL)
+    {
+        terminal_screen_get_size (priv->active_screen, &old_grid_width, &old_grid_height);
+
+        /* This is so that we maintain the same grid */
+        vte_terminal_set_size (VTE_TERMINAL (screen), old_grid_width, old_grid_height);
+    }
+
+    /* Workaround to remove gtknotebook's feature of computing its size based on
+     * all pages. When the widget is hidden, its size will not be taken into
+     * account.
+     */
+    if (priv->active_screen)
+        gtk_widget_hide (GTK_WIDGET (priv->active_screen)); /* FIXME */
+
+    /* Make sure that the widget is no longer hidden due to the workaround */
+    gtk_widget_show (widget);
+
+    priv->active_screen = screen;
+
+    /* Override menubar setting if it wasn't restored from session */
+    if (priv->use_default_menubar_visibility)
+    {
+        gboolean setting =
+            terminal_profile_get_property_boolean (terminal_screen_get_profile (screen), TERMINAL_PROFILE_DEFAULT_SHOW_MENUBAR);
+
+        terminal_window_set_menubar_visible (window, setting);
+    }
+
+    sync_screen_icon_title_set (screen, NULL, window);
+    sync_screen_icon_title (screen, NULL, window);
+    sync_screen_title (screen, NULL, window);
+
+    /* set size of window to current grid size */
+    _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                           "[window %p] setting size after flipping notebook pages\n",
+                           window);
+    terminal_window_update_size (window, screen, TRUE);
+
+    terminal_window_update_tabs_menu_sensitivity (window);
+    terminal_window_update_encoding_menu_active_encoding (window);
+    terminal_window_update_set_profile_menu_active_profile (window);
+    terminal_window_update_copy_sensitivity (screen, window);
+    terminal_window_update_zoom_sensitivity (window);
+    terminal_window_update_search_sensitivity (screen, window);
+}
+
+static void
+notebook_page_added_callback (GtkWidget       *notebook,
+                              GtkWidget       *container,
+                              guint            page_num,
+                              TerminalWindow  *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalScreen *screen;
+    int pages;
+
+    screen = terminal_screen_container_get_screen (TERMINAL_SCREEN_CONTAINER (container));
+
+    _terminal_debug_print (TERMINAL_DEBUG_MDI,
+                           "[window %p] MDI: screen %p inserted\n",
+                           window, screen);
+
+    g_signal_connect (G_OBJECT (screen),
+                      "profile-set",
+                      G_CALLBACK (profile_set_callback),
+                      window);
+
+    /* FIXME: only connect on the active screen, not all screens! */
+    g_signal_connect (screen, "notify::title",
+                      G_CALLBACK (sync_screen_title), window);
+    g_signal_connect (screen, "notify::icon-title",
+                      G_CALLBACK (sync_screen_icon_title), window);
+    g_signal_connect (screen, "notify::icon-title-set",
+                      G_CALLBACK (sync_screen_icon_title_set), window);
+    g_signal_connect (screen, "selection-changed",
+                      G_CALLBACK (terminal_window_update_copy_sensitivity), window);
+    g_signal_connect (screen, "hyperlink-hover-uri-changed",
+                      G_CALLBACK (screen_hyperlink_hover_uri_changed), window);
+
+    g_signal_connect (screen, "show-popup-menu",
+                      G_CALLBACK (screen_show_popup_menu_callback), window);
+    g_signal_connect (screen, "match-clicked",
+                      G_CALLBACK (screen_match_clicked_cb), window);
+    g_signal_connect (screen, "resize-window",
+                      G_CALLBACK (screen_resize_window_cb), window);
+
+    g_signal_connect (screen, "close-screen",
+                      G_CALLBACK (screen_close_cb), window);
+
+    update_tab_visibility (window, 0);
+    terminal_window_update_tabs_menu_sensitivity (window);
+    terminal_window_update_search_sensitivity (screen, window);
+
+#if 0
+    /* FIXMEchpe: wtf is this doing? */
+
+    /* If we have an active screen, match its size and zoom */
+    if (priv->active_screen)
+    {
+        int current_width, current_height;
+        double scale;
+
+        terminal_screen_get_size (priv->active_screen, &current_width, &current_height);
+        vte_terminal_set_size (VTE_TERMINAL (screen), current_width, current_height);
+
+        scale = terminal_screen_get_font_scale (priv->active_screen);
+        terminal_screen_set_font_scale (screen, scale);
+    }
+#endif
+
+    if (priv->present_on_insert)
+    {
+        gtk_window_present_with_time (GTK_WINDOW (window), gtk_get_current_event_time ());
+        priv->present_on_insert = FALSE;
+    }
+    pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook));
+    if (pages == 2) terminal_window_update_size (window, priv->active_screen, TRUE);
+}
+
+static void
+notebook_page_removed_callback (GtkWidget       *notebook,
+                                GtkWidget       *container,
+                                guint            page_num,
+                                TerminalWindow  *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalScreen *screen;
+    int pages;
+
+    if (priv->disposed)
+        return;
+
+    screen = terminal_screen_container_get_screen (TERMINAL_SCREEN_CONTAINER (container));
+
+    _terminal_debug_print (TERMINAL_DEBUG_MDI,
+                           "[window %p] MDI: screen %p removed\n",
+                           window, screen);
+
+    g_signal_handlers_disconnect_by_func (G_OBJECT (screen),
+                                          G_CALLBACK (profile_set_callback),
+                                          window);
+
+    g_signal_handlers_disconnect_by_func (G_OBJECT (screen),
+                                          G_CALLBACK (sync_screen_title),
+                                          window);
+
+    g_signal_handlers_disconnect_by_func (G_OBJECT (screen),
+                                          G_CALLBACK (sync_screen_icon_title),
+                                          window);
+
+    g_signal_handlers_disconnect_by_func (G_OBJECT (screen),
+                                          G_CALLBACK (sync_screen_icon_title_set),
+                                          window);
+
+    g_signal_handlers_disconnect_by_func (G_OBJECT (screen),
+                                          G_CALLBACK (terminal_window_update_copy_sensitivity),
+                                          window);
+
+    g_signal_handlers_disconnect_by_func (G_OBJECT (screen),
+                                          G_CALLBACK (screen_hyperlink_hover_uri_changed),
+                                          window);
+
+    g_signal_handlers_disconnect_by_func (screen,
+                                          G_CALLBACK (screen_show_popup_menu_callback),
+                                          window);
+
+    g_signal_handlers_disconnect_by_func (screen,
+                                          G_CALLBACK (screen_match_clicked_cb),
+                                          window);
+    g_signal_handlers_disconnect_by_func (screen,
+                                          G_CALLBACK (screen_resize_window_cb),
+                                          window);
+
+    g_signal_handlers_disconnect_by_func (screen,
+                                          G_CALLBACK (screen_close_cb),
+                                          window);
+
+    terminal_window_update_tabs_menu_sensitivity (window);
+    update_tab_visibility (window, 0);
+    terminal_window_update_search_sensitivity (screen, window);
+
+    pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook));
+    if (pages == 1)
+    {
+        terminal_window_update_size (window, priv->active_screen, TRUE);
+    }
+    else if (pages == 0)
+    {
+        gtk_widget_destroy (GTK_WIDGET (window));
+    }
+}
+
+void
+terminal_window_update_copy_selection (TerminalScreen *screen,
+        TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    priv->copy_selection =
+        terminal_profile_get_property_boolean (terminal_screen_get_profile (screen),
+            TERMINAL_PROFILE_COPY_SELECTION);
+}
+
+static gboolean
+notebook_scroll_event_cb (GtkWidget      *widget,
+                          GdkEventScroll *event,
+                          TerminalWindow *window)
+{
+  GtkNotebook *notebook = GTK_NOTEBOOK (widget);
+  GtkWidget *child, *event_widget, *action_widget;
+
+  child = gtk_notebook_get_nth_page (notebook, gtk_notebook_get_current_page (notebook));
+  if (child == NULL)
+    return FALSE;
+
+  event_widget = gtk_get_event_widget ((GdkEvent *) event);
+
+  /* Ignore scroll events from the content of the page */
+  if (event_widget == NULL ||
+      event_widget == child ||
+      gtk_widget_is_ancestor (event_widget, child))
+    return FALSE;
+
+  /* And also from the action widgets */
+  action_widget = gtk_notebook_get_action_widget (notebook, GTK_PACK_START);
+  if (event_widget == action_widget ||
+      (action_widget != NULL && gtk_widget_is_ancestor (event_widget, action_widget)))
+    return FALSE;
+  action_widget = gtk_notebook_get_action_widget (notebook, GTK_PACK_END);
+  if (event_widget == action_widget ||
+      (action_widget != NULL && gtk_widget_is_ancestor (event_widget, action_widget)))
+    return FALSE;
+
+  switch (event->direction) {
+    case GDK_SCROLL_RIGHT:
+    case GDK_SCROLL_DOWN:
+      gtk_notebook_next_page (notebook);
+      break;
+    case GDK_SCROLL_LEFT:
+    case GDK_SCROLL_UP:
+      gtk_notebook_prev_page (notebook);
+      break;
+    case GDK_SCROLL_SMOOTH:
+      switch (gtk_notebook_get_tab_pos (notebook)) {
+        case GTK_POS_LEFT:
+        case GTK_POS_RIGHT:
+          if (event->delta_y > 0)
+            gtk_notebook_next_page (notebook);
+          else if (event->delta_y < 0)
+            gtk_notebook_prev_page (notebook);
+          break;
+        case GTK_POS_TOP:
+        case GTK_POS_BOTTOM:
+          if (event->delta_x > 0)
+            gtk_notebook_next_page (notebook);
+          else if (event->delta_x < 0)
+            gtk_notebook_prev_page (notebook);
+          break;
+      }
+      break;
+    }
+
+  return TRUE;
+}
+
+void
+terminal_window_update_geometry (TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkWidget *widget;
+    GdkGeometry hints;
+    GtkBorder padding;
+    GtkRequisition vbox_request;
+    int grid_width, grid_height;
+    int char_width, char_height;
+    int chrome_width, chrome_height;
+    int csd_width = 0, csd_height = 0;
+
+    if (priv->active_screen == NULL)
+        return;
+
+    widget = GTK_WIDGET (priv->active_screen);
+
+    /* We set geometry hints from the active term; best thing
+     * I can think of to do. Other option would be to try to
+     * get some kind of union of all hints from all terms in the
+     * window, but that doesn't make too much sense.
+     */
+    terminal_screen_get_cell_size (priv->active_screen, &char_width, &char_height);
+
+    terminal_screen_get_size (priv->active_screen, &grid_width, &grid_height);
+    _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, "%dx%d cells of %dx%d px = %dx%d px\n",
+                           grid_width, grid_height, char_width, char_height,
+                           char_width * grid_width, char_height * grid_height);
+
+    gtk_style_context_get_padding(gtk_widget_get_style_context (widget),
+                                  gtk_widget_get_state_flags (widget),
+                                  &padding);
+
+    _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, "padding = %dx%d px\n",
+                           padding.left + padding.right,
+                           padding.top + padding.bottom);
+
+    gtk_widget_get_preferred_size (priv->main_vbox, NULL, &vbox_request);
+    _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, "content area requests %dx%d px\n",
+                           vbox_request.width, vbox_request.height);
+
+    chrome_width = vbox_request.width - (char_width * grid_width);
+    chrome_height = vbox_request.height - (char_height * grid_height);
+    _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, "chrome: %dx%d px\n",
+                           chrome_width, chrome_height);
+
+    if (gtk_widget_get_realized (GTK_WIDGET (window))) {
+        GtkAllocation toplevel_allocation, vbox_allocation;
+
+        gtk_widget_get_allocation (priv->main_vbox, &vbox_allocation);
+        _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                               "terminal widget allocation %dx%d px\n",
+                               vbox_allocation.width, vbox_allocation.height);
+
+        gtk_widget_get_allocation (GTK_WIDGET (window), &toplevel_allocation);
+        _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, "window allocation %dx%d px\n",
+                               toplevel_allocation.width, toplevel_allocation.height);
+
+        csd_width = toplevel_allocation.width - vbox_allocation.width;
+        csd_height = toplevel_allocation.height - vbox_allocation.height;
+        _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, "CSDs: %dx%d px\n",
+                               csd_width, csd_height);
+    }
+
+    if (!gtk_widget_get_realized (GTK_WIDGET (window)))
+    {
+        /* Don't actually set the geometry hints until we have been realized,
+         * because we don't know how large the client-side decorations are going
+         * to be.
+         *
+         * Similarly, the size request doesn't seem to include the padding
+         * until we've been redrawn at least once. Don't resize the window
+         * until we've done that. */
+        _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, "not realized yet\n");
+    }
+    else if (char_width != priv->old_char_width ||
+             char_height != priv->old_char_height ||
+             padding.left + padding.right != priv->old_padding_width ||
+             padding.top + padding.bottom != priv->old_padding_height ||
+             chrome_width != priv->old_chrome_width ||
+             chrome_height != priv->old_chrome_height ||
+             widget != GTK_WIDGET (priv->old_geometry_widget))
+    {
+        hints.base_width = chrome_width + csd_width;
+        hints.base_height = chrome_height + csd_height;
+
+#define MIN_WIDTH_CHARS 4
+#define MIN_HEIGHT_CHARS 1
+
+        hints.width_inc = char_width;
+        hints.height_inc = char_height;
+
+        /* min size is min size of the whole window, remember. */
+        hints.min_width = hints.base_width + hints.width_inc * MIN_WIDTH_CHARS;
+        hints.min_height = hints.base_height + hints.height_inc * MIN_HEIGHT_CHARS;
+
+        gtk_window_set_geometry_hints (GTK_WINDOW (window),
+                                       NULL,
+                                       &hints,
+                                       GDK_HINT_RESIZE_INC |
+                                       GDK_HINT_MIN_SIZE |
+                                       GDK_HINT_BASE_SIZE);
+
+        _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                               "[window %p] hints: base %dx%d min %dx%d inc %d %d\n",
+                               window,
+                               hints.base_width,
+                               hints.base_height,
+                               hints.min_width,
+                               hints.min_height,
+                               hints.width_inc,
+                               hints.height_inc);
+
+        priv->old_geometry_widget = widget;
+    }
+    else
+    {
+        _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+                               "[window %p] hints: increment unchanged, not setting\n",
+                               window);
+    }
+
+    /* We need these for the size calculation in terminal_window_update_size(),
+     * so we set them unconditionally. */
+    priv->old_char_width = char_width;
+    priv->old_char_height = char_height;
+    priv->old_chrome_width = chrome_width;
+    priv->old_chrome_height = chrome_height;
+    priv->old_padding_width = padding.left + padding.right;
+    priv->old_padding_height = padding.top + padding.bottom;
+}
+
+static void
+file_new_window_callback (GtkAction *action,
+                          TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalApp *app;
+    TerminalWindow *new_window;
+    TerminalProfile *profile;
+    char *new_working_directory;
+
+    app = terminal_app_get ();
+
+    profile = g_object_get_data (G_OBJECT (action), PROFILE_DATA_KEY);
+    if (!profile)
+        profile = terminal_screen_get_profile (priv->active_screen);
+    if (!profile)
+        profile = terminal_app_get_profile_for_new_term (app);
+    if (!profile)
+        return;
+
+    if (_terminal_profile_get_forgotten (profile))
+        return;
+
+    new_window = terminal_app_new_window (app, gtk_widget_get_screen (GTK_WIDGET (window)));
+
+    new_working_directory = terminal_screen_get_current_dir_with_fallback (priv->active_screen);
+    terminal_app_new_terminal (app, new_window, profile,
+                               NULL, NULL,
+                               new_working_directory,
+                               terminal_screen_get_initial_environment (priv->active_screen),
+                               1.0);
+    g_free (new_working_directory);
+
+    gtk_window_present (GTK_WINDOW (new_window));
+}
+
+static void
+file_new_tab_callback (GtkAction *action,
+                       TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalApp *app;
+    TerminalProfile *profile;
+    char *new_working_directory;
+
+    app = terminal_app_get ();
+    profile = g_object_get_data (G_OBJECT (action), PROFILE_DATA_KEY);
+    if (!profile)
+        profile = terminal_screen_get_profile (priv->active_screen);
+    if (!profile)
+        profile = terminal_app_get_profile_for_new_term (app);
+    if (!profile)
+        return;
+
+    if (_terminal_profile_get_forgotten (profile))
+        return;
+
+    new_working_directory = terminal_screen_get_current_dir_with_fallback (priv->active_screen);
+    terminal_app_new_terminal (app, window, profile,
+                               NULL, NULL,
+                               new_working_directory,
+                               terminal_screen_get_initial_environment (priv->active_screen),
+                               1.0);
+    g_free (new_working_directory);
+}
+
+static void
+confirm_close_response_cb (GtkWidget *dialog,
+                           int response,
+                           TerminalWindow *window)
+{
+    TerminalScreen *screen;
+
+    screen = g_object_get_data (G_OBJECT (dialog), "close-screen");
+
+    gtk_widget_destroy (dialog);
+
+    if (response != GTK_RESPONSE_ACCEPT)
+        return;
+
+    if (screen)
+        terminal_window_remove_screen (window, screen);
+    else
+        gtk_widget_destroy (GTK_WIDGET (window));
+}
+
+/* Returns: TRUE if closing needs to wait until user confirmation;
+ * FALSE if the terminal or window can close immediately.
+ */
+static gboolean
+confirm_close_window_or_tab (TerminalWindow *window,
+                             TerminalScreen *screen)
+{
+    GtkBuilder *builder;
+    TerminalWindowPrivate *priv = window->priv;
+    GtkWidget *dialog;
+    gboolean has_processes;
+    int n_tabs;
+    char *confirm_msg;
+
+    if (!g_settings_get_boolean (settings_global, "confirm-window-close"))
+        return FALSE;
+
+    if (screen)
+    {
+        has_processes = terminal_screen_has_foreground_process (screen);
+        n_tabs = 1;
+    }
+    else
+    {
+        GList *tabs, *t;
+
+        tabs = terminal_window_list_screen_containers (window);
+        n_tabs = g_list_length (tabs);
+
+        for (t = tabs; t != NULL; t = t->next)
+        {
+            TerminalScreen *terminal_screen;
+
+            terminal_screen = terminal_screen_container_get_screen (TERMINAL_SCREEN_CONTAINER (t->data));
+            has_processes = terminal_screen_has_foreground_process (terminal_screen);
+            if (has_processes)
+                break;
+        }
+        g_list_free (tabs);
+    }
+
+    if (has_processes)
+    {
+        if (n_tabs > 1)
+            confirm_msg = _("There are still processes running in some terminals in this window.\n"
+                            "Closing the window will kill all of them.");
+        else
+            confirm_msg = _("There is still a process running in this terminal.\n"
+                            "Closing the terminal will kill it.");
+    } else if (n_tabs > 1)
+            confirm_msg = _("There are multiple tabs open in this window.");
+    else
+        return FALSE;
+
+    builder = gtk_builder_new_from_resource (TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/confirm-close-dialog.ui");
+    priv->confirm_close_dialog = dialog = GTK_WIDGET (gtk_builder_get_object (builder, "confirm_close_dialog"));
+    if (n_tabs > 1) {
+        gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (builder, "question_text")), _("Close this window?"));
+        gtk_button_set_label (GTK_BUTTON (gtk_builder_get_object (builder, "button_close")), _("C_lose Window"));
+    } else {
+        gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (builder, "question_text")), _("Close this terminal?"));
+        gtk_button_set_label (GTK_BUTTON (gtk_builder_get_object (builder, "button_close")), _("C_lose Terminal"));
+    }
+    gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (builder, "description_text")), confirm_msg);
+    g_object_unref (builder);
+
+    g_object_set_data (G_OBJECT (dialog), "close-screen", screen);
+
+    g_signal_connect (dialog, "destroy",
+                      G_CALLBACK (gtk_widget_destroyed), &priv->confirm_close_dialog);
+    g_signal_connect (dialog, "response",
+                      G_CALLBACK (confirm_close_response_cb), window);
+
+    gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
+    gtk_window_set_title (GTK_WINDOW (dialog), "");
+    gtk_window_present (GTK_WINDOW (dialog));
+
+    return TRUE;
+}
+
+static void
+file_close_window_callback (GtkAction *action,
+                            TerminalWindow *window)
+{
+    if (confirm_close_window_or_tab (window, NULL))
+        return;
+
+    gtk_widget_destroy (GTK_WIDGET (window));
+}
+
+#ifdef ENABLE_SAVE
+static void
+save_contents_dialog_on_response (GtkDialog *dialog, gint response_id, gpointer terminal)
+{
+    GtkWindow *parent;
+    gchar *filename_uri = NULL;
+    GFile *file;
+    GOutputStream *stream;
+    GError *error = NULL;
+
+    if (response_id != GTK_RESPONSE_ACCEPT)
+    {
+        gtk_widget_destroy (GTK_WIDGET (dialog));
+        return;
+    }
+
+    parent = (GtkWindow*) gtk_widget_get_ancestor (GTK_WIDGET (terminal), GTK_TYPE_WINDOW);
+    filename_uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
+
+    gtk_widget_destroy (GTK_WIDGET (dialog));
+
+    if (filename_uri == NULL)
+        return;
+
+    file = g_file_new_for_uri (filename_uri);
+    stream = G_OUTPUT_STREAM (g_file_replace (file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &error));
+
+    if (stream)
+    {
+        /* FIXME
+         * Should be replaced with the async version when vte implements that.
+         */
+        vte_terminal_write_contents_sync (terminal, stream,
+                                          VTE_WRITE_DEFAULT,
+                                          NULL, &error);
+        g_object_unref (stream);
+    }
+
+    if (error)
+    {
+        terminal_util_show_error_dialog (parent, NULL, error,
+                                         "%s", _("Could not save contents"));
+        g_error_free (error);
+    }
+
+    g_object_unref(file);
+    g_free(filename_uri);
+}
+#endif /* ENABLE_SAVE */
+
+static void
+file_save_contents_callback (GtkAction *action,
+                             TerminalWindow *window)
+{
+#ifdef ENABLE_SAVE
+    GtkWidget *dialog = NULL;
+    TerminalWindowPrivate *priv = window->priv;
+    VteTerminal *terminal;
+
+    if (!priv->active_screen)
+        return;
+
+    terminal = VTE_TERMINAL (priv->active_screen);
+    g_return_if_fail (VTE_IS_TERMINAL (terminal));
+
+    dialog = gtk_file_chooser_dialog_new (_("Save as..."),
+                                          GTK_WINDOW(window),
+                                          GTK_FILE_CHOOSER_ACTION_SAVE,
+                                          "gtk-cancel", GTK_RESPONSE_CANCEL,
+                                          "gtk-save", GTK_RESPONSE_ACCEPT,
+                                          NULL);
+
+    gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
+    /* XXX where should we save to? */
+    gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+
+    gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW(window));
+    gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+    gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
+
+    g_signal_connect (dialog, "response", G_CALLBACK (save_contents_dialog_on_response), terminal);
+    g_signal_connect (dialog, "delete_event", G_CALLBACK (terminal_util_dialog_response_on_delete), NULL);
+
+    gtk_window_present (GTK_WINDOW (dialog));
+#endif /* ENABLE_SAVE */
+}
+
+static void
+file_close_tab_callback (GtkAction *action,
+                         TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalScreen *active_screen = priv->active_screen;
+
+    if (!active_screen)
+        return;
+
+    if (confirm_close_window_or_tab (window, active_screen))
+        return;
+
+    terminal_window_remove_screen (window, active_screen);
+}
+
+static void
+edit_copy_callback (GtkAction *action,
+                    TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    if (!priv->active_screen)
+        return;
+
+#if VTE_CHECK_VERSION (0, 50, 0)
+    vte_terminal_copy_clipboard_format (VTE_TERMINAL (priv->active_screen), VTE_FORMAT_TEXT);
+#else
+    vte_terminal_copy_clipboard (VTE_TERMINAL (priv->active_screen));
+#endif
+}
+
+typedef struct
+{
+    TerminalScreen *screen;
+    gboolean uris_as_paths;
+} PasteData;
+
+static void
+clipboard_uris_received_cb (GtkClipboard *clipboard,
+                            /* const */ char **uris,
+                            PasteData *data)
+{
+    char *text;
+    gsize len;
+
+    if (!uris)
+    {
+        g_object_unref (data->screen);
+        g_slice_free (PasteData, data);
+        return;
+    }
+
+    /* This potentially modifies the strings in |uris| but that's ok */
+    terminal_util_transform_uris_to_quoted_fuse_paths (uris);
+
+    text = terminal_util_concat_uris (uris, &len);
+    vte_terminal_feed_child (VTE_TERMINAL (data->screen), text, len);
+    g_free (text);
+
+    g_object_unref (data->screen);
+    g_slice_free (PasteData, data);
+}
+
+static void
+clipboard_targets_received_cb (GtkClipboard *clipboard,
+                               GdkAtom *targets,
+                               int n_targets,
+                               PasteData *data)
+{
+    if (!targets)
+    {
+        g_object_unref (data->screen);
+        g_slice_free (PasteData, data);
+        return;
+    }
+
+    if (data->uris_as_paths && gtk_targets_include_uri (targets, n_targets))
+    {
+        gtk_clipboard_request_uris (clipboard,
+                                    (GtkClipboardURIReceivedFunc) clipboard_uris_received_cb,
+                                    data);
+        return;
+    }
+    else /* if (gtk_targets_include_text (targets, n_targets)) */
+    {
+        vte_terminal_paste_clipboard (VTE_TERMINAL (data->screen));
+    }
+
+    g_object_unref (data->screen);
+    g_slice_free (PasteData, data);
+}
+
+static void
+edit_paste_callback (GtkAction *action,
+                     TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkClipboard *clipboard;
+    PasteData *data;
+    const char *name;
+
+    if (!priv->active_screen)
+        return;
+
+    clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    name = gtk_action_get_name (action);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+
+    data = g_slice_new (PasteData);
+    data->screen = g_object_ref (priv->active_screen);
+    data->uris_as_paths = (name == I_("EditPasteURIPaths") || name == I_("PopupPasteURIPaths"));
+
+    gtk_clipboard_request_targets (clipboard,
+                                   (GtkClipboardTargetsReceivedFunc) clipboard_targets_received_cb,
+                                   data);
+}
+
+static void
+edit_select_all_callback (GtkAction *action,
+                          TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    if (!priv->active_screen)
+        return;
+
+    vte_terminal_select_all (VTE_TERMINAL (priv->active_screen));
+}
+
+static void
+edit_keybindings_callback (GtkAction *action,
+                           TerminalWindow *window)
+{
+    terminal_app_edit_keybindings (terminal_app_get (),
+                                   GTK_WINDOW (window));
+}
+
+static void
+edit_current_profile_callback (GtkAction *action,
+                               TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    terminal_app_edit_profile (terminal_app_get (),
+                               terminal_screen_get_profile (priv->active_screen),
+                               GTK_WINDOW (window),
+                               NULL);
+}
+
+static void
+file_new_profile_callback (GtkAction *action,
+                           TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    terminal_app_new_profile (terminal_app_get (),
+                              terminal_screen_get_profile (priv->active_screen),
+                              GTK_WINDOW (window));
+}
+
+static void
+edit_profiles_callback (GtkAction *action,
+                        TerminalWindow *window)
+{
+    terminal_app_manage_profiles (terminal_app_get (),
+                                  GTK_WINDOW (window));
+}
+
+static void
+view_menubar_toggled_callback (GtkToggleAction *action,
+                               TerminalWindow *window)
+{
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    terminal_window_set_menubar_visible (window, gtk_toggle_action_get_active (action));
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+}
+
+static void
+view_fullscreen_toggled_callback (GtkToggleAction *action,
+                                  TerminalWindow *window)
+{
+    gboolean toggle_action_check;
+
+    g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (window)));
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    toggle_action_check = gtk_toggle_action_get_active (action);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+    if (toggle_action_check)
+        gtk_window_fullscreen (GTK_WINDOW (window));
+    else
+        gtk_window_unfullscreen (GTK_WINDOW (window));
+}
+
+static const double zoom_factors[] =
+{
+    TERMINAL_SCALE_MINIMUM,
+    TERMINAL_SCALE_XXXXX_SMALL,
+    TERMINAL_SCALE_XXXX_SMALL,
+    TERMINAL_SCALE_XXX_SMALL,
+    PANGO_SCALE_XX_SMALL,
+    PANGO_SCALE_X_SMALL,
+    PANGO_SCALE_SMALL,
+    PANGO_SCALE_MEDIUM,
+    PANGO_SCALE_LARGE,
+    PANGO_SCALE_X_LARGE,
+    PANGO_SCALE_XX_LARGE,
+    TERMINAL_SCALE_XXX_LARGE,
+    TERMINAL_SCALE_XXXX_LARGE,
+    TERMINAL_SCALE_XXXXX_LARGE,
+    TERMINAL_SCALE_MAXIMUM
+};
+
+static gboolean
+find_larger_zoom_factor (double  current,
+                         double *found)
+{
+    guint i;
+
+    for (i = 0; i < G_N_ELEMENTS (zoom_factors); ++i)
+    {
+        /* Find a font that's larger than this one */
+        if ((zoom_factors[i] - current) > 1e-6)
+        {
+            *found = zoom_factors[i];
+            return TRUE;
+        }
+    }
+
+    return FALSE;
+}
+
+static gboolean
+find_smaller_zoom_factor (double  current,
+                          double *found)
+{
+    int i;
+
+    i = (int) G_N_ELEMENTS (zoom_factors) - 1;
+    while (i >= 0)
+    {
+        /* Find a font that's smaller than this one */
+        if ((current - zoom_factors[i]) > 1e-6)
+        {
+            *found = zoom_factors[i];
+            return TRUE;
+        }
+
+        --i;
+    }
+
+    return FALSE;
+}
+
+static void
+view_zoom_in_callback (GtkAction *action,
+                       TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    double current;
+
+    if (priv->active_screen == NULL)
+        return;
+
+    current = terminal_screen_get_font_scale (priv->active_screen);
+    if (!find_larger_zoom_factor (current, &current))
+        return;
+
+    terminal_screen_set_font_scale (priv->active_screen, current);
+    terminal_window_update_zoom_sensitivity (window);
+}
+
+static void
+view_zoom_out_callback (GtkAction *action,
+                        TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    double current;
+
+    if (priv->active_screen == NULL)
+        return;
+
+    current = terminal_screen_get_font_scale (priv->active_screen);
+    if (!find_smaller_zoom_factor (current, &current))
+        return;
+
+    terminal_screen_set_font_scale (priv->active_screen, current);
+    terminal_window_update_zoom_sensitivity (window);
+}
+
+static void
+view_zoom_normal_callback (GtkAction *action,
+                           TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    if (priv->active_screen == NULL)
+        return;
+
+    terminal_screen_set_font_scale (priv->active_screen, PANGO_SCALE_MEDIUM);
+    terminal_window_update_zoom_sensitivity (window);
+}
+
+static void
+search_find_response_callback (GtkWidget *dialog,
+                               int        response,
+                               gpointer   user_data)
+{
+    TerminalWindow *window = TERMINAL_WINDOW (user_data);
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalSearchFlags flags;
+    VteRegex *regex;
+
+    if (response != GTK_RESPONSE_ACCEPT)
+        return;
+
+    if (G_UNLIKELY (!priv->active_screen))
+        return;
+
+    regex = terminal_search_dialog_get_regex (dialog);
+    g_return_if_fail (regex != NULL);
+
+    flags = terminal_search_dialog_get_search_flags (dialog);
+
+    vte_terminal_search_set_regex (VTE_TERMINAL (priv->active_screen), regex, 0);
+    vte_terminal_search_set_wrap_around (VTE_TERMINAL (priv->active_screen),
+                                         (flags & TERMINAL_SEARCH_FLAG_WRAP_AROUND));
+
+    if (flags & TERMINAL_SEARCH_FLAG_BACKWARDS)
+        vte_terminal_search_find_previous (VTE_TERMINAL (priv->active_screen));
+    else
+        vte_terminal_search_find_next (VTE_TERMINAL (priv->active_screen));
+
+    terminal_window_update_search_sensitivity (priv->active_screen, window);
+}
+
+static gboolean
+search_dialog_delete_event_cb (GtkWidget   *widget,
+                               GdkEventAny *event,
+                               gpointer     user_data)
+{
+    /* prevent destruction */
+    return TRUE;
+}
+
+static void
+search_find_callback (GtkAction *action,
+                      TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    if (!priv->search_find_dialog)
+    {
+        GtkWidget *dialog;
+
+        dialog = priv->search_find_dialog = terminal_search_dialog_new (GTK_WINDOW (window));
+
+        g_signal_connect (dialog, "destroy",
+                          G_CALLBACK (gtk_widget_destroyed), &priv->search_find_dialog);
+        g_signal_connect (dialog, "response",
+                          G_CALLBACK (search_find_response_callback), window);
+        g_signal_connect (dialog, "delete-event",
+                          G_CALLBACK (search_dialog_delete_event_cb), NULL);
+    }
+
+    terminal_search_dialog_present (priv->search_find_dialog);
+}
+
+static void
+search_find_next_callback (GtkAction *action,
+                           TerminalWindow *window)
+{
+    if (G_UNLIKELY (!window->priv->active_screen))
+        return;
+
+    vte_terminal_search_find_next (VTE_TERMINAL (window->priv->active_screen));
+}
+
+static void
+search_find_prev_callback (GtkAction *action,
+                           TerminalWindow *window)
+{
+    if (G_UNLIKELY (!window->priv->active_screen))
+        return;
+
+    vte_terminal_search_find_previous (VTE_TERMINAL (window->priv->active_screen));
+}
+
+static void
+search_clear_highlight_callback (GtkAction *action,
+                                 TerminalWindow *window)
+{
+    if (G_UNLIKELY (!window->priv->active_screen))
+        return;
+
+    vte_terminal_search_set_regex (VTE_TERMINAL (window->priv->active_screen), NULL, 0);
+}
+
+static void
+terminal_next_or_previous_profile_cb (GtkAction *action,
+                              TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalProfile *active_profile, *new_profile = NULL;
+    GList *profiles, *p;
+
+    const char *name;
+    guint backwards = 0;
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    name = gtk_action_get_name (action);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+    if (strcmp (name, "ProfilePrevious") == 0)
+    {
+        backwards = 1;
+    }
+
+    profiles = terminal_app_get_profile_list (terminal_app_get ());
+    if (profiles == NULL)
+        return;
+
+    if (priv->active_screen)
+        active_profile = terminal_screen_get_profile (priv->active_screen);
+    else
+        return;
+
+    for (p = profiles; p != NULL; p = p->next)
+    {
+        TerminalProfile *profile = (TerminalProfile *) p->data;
+        if (profile == active_profile)
+        {
+            if (backwards) {
+                p = p->prev;
+                if (p == NULL)
+                    p = g_list_last (profiles);
+                new_profile = p->data;
+                break;
+            }
+            else
+            {
+                p = p->next;
+                if (p == NULL)
+                    p = g_list_first (profiles);
+                new_profile = p->data;
+                break;
+            }
+        }
+    }
+
+    if (new_profile)
+        terminal_screen_set_profile (priv->active_screen, new_profile);
+
+    g_list_free (profiles);
+}
+
+static void
+terminal_set_title_dialog_response_cb (GtkWidget *dialog,
+                                       int response,
+                                       TerminalScreen *screen)
+{
+    if (response == GTK_RESPONSE_OK)
+    {
+        GtkEntry *entry;
+        const char *text;
+
+        entry = GTK_ENTRY (g_object_get_data (G_OBJECT (dialog), "title-entry"));
+        text = gtk_entry_get_text (entry);
+        terminal_screen_set_user_title (screen, text);
+    }
+
+    gtk_widget_destroy (dialog);
+    gtk_widget_grab_focus (GTK_WIDGET (screen));
+}
+
+static void
+terminal_set_title_callback (GtkAction *action,
+                             TerminalWindow *window)
+{
+    GtkBuilder *builder;
+    TerminalWindowPrivate *priv = window->priv;
+    GtkWidget *dialog, *entry;
+
+    if (priv->active_screen == NULL)
+        return;
+
+    builder = gtk_builder_new_from_resource (TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/set-title-dialog.ui");
+    dialog = GTK_WIDGET (gtk_builder_get_object (builder, "dialog"));
+    entry = GTK_WIDGET (gtk_builder_get_object (builder, "title_entry"));
+    g_object_unref (builder);
+
+    gtk_widget_grab_focus (entry);
+    gtk_entry_set_text (GTK_ENTRY (entry), terminal_screen_get_raw_title (priv->active_screen));
+    gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
+    g_object_set_data (G_OBJECT (dialog), "title-entry", entry);
+
+    g_signal_connect (dialog, "response",
+                      G_CALLBACK (terminal_set_title_dialog_response_cb), priv->active_screen);
+    g_signal_connect (dialog, "delete-event",
+                      G_CALLBACK (terminal_util_dialog_response_on_delete), NULL);
+
+    gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
+
+    gtk_window_present (GTK_WINDOW (dialog));
+}
+
+static void
+terminal_add_encoding_callback (GtkAction *action,
+                                TerminalWindow *window)
+{
+    terminal_app_edit_encodings (terminal_app_get (),
+                                 GTK_WINDOW (window));
+}
+
+static void
+terminal_reset_callback (GtkAction *action,
+                         TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    if (priv->active_screen == NULL)
+        return;
+
+    vte_terminal_reset (VTE_TERMINAL (priv->active_screen), TRUE, FALSE);
+}
+
+static void
+terminal_reset_clear_callback (GtkAction *action,
+                               TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    if (priv->active_screen == NULL)
+        return;
+
+    vte_terminal_reset (VTE_TERMINAL (priv->active_screen), TRUE, TRUE);
+}
+
+static void
+tabs_next_or_previous_tab_cb (GtkAction *action,
+                              TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkNotebookClass *klass;
+    const char *name;
+    guint keyval = 0;
+
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+    name = gtk_action_get_name (action);
+    G_GNUC_END_IGNORE_DEPRECATIONS;
+    if (strcmp (name, "TabsNext") == 0)
+    {
+        keyval = GDK_KEY_Page_Down;
+    }
+    else if (strcmp (name, "TabsPrevious") == 0)
+    {
+        keyval = GDK_KEY_Page_Up;
+    }
+
+    klass = GTK_NOTEBOOK_GET_CLASS (GTK_NOTEBOOK (priv->notebook));
+    gtk_binding_set_activate (gtk_binding_set_by_class (klass),
+                              keyval,
+                              GDK_CONTROL_MASK,
+                              G_OBJECT (priv->notebook));
+}
+
+static void
+tabs_move_left_callback (GtkAction *action,
+                         TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkNotebook *notebook = GTK_NOTEBOOK (priv->notebook);
+    gint page_num,last_page;
+    GtkWidget *page;
+
+    page_num = gtk_notebook_get_current_page (notebook);
+    last_page = gtk_notebook_get_n_pages (notebook) - 1;
+    page = gtk_notebook_get_nth_page (notebook, page_num);
+
+    gtk_notebook_reorder_child (notebook, page, page_num == 0 ? last_page : page_num - 1);
+}
+
+static void
+tabs_move_right_callback (GtkAction *action,
+                          TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GtkNotebook *notebook = GTK_NOTEBOOK (priv->notebook);
+    gint page_num,last_page;
+    GtkWidget *page;
+
+    page_num = gtk_notebook_get_current_page (notebook);
+    last_page = gtk_notebook_get_n_pages (notebook) - 1;
+    page = gtk_notebook_get_nth_page (notebook, page_num);
+
+    gtk_notebook_reorder_child (notebook, page, page_num == last_page ? 0 : page_num + 1);
+}
+
+static void
+tabs_detach_tab_callback (GtkAction *action,
+                          TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    TerminalApp *app;
+    TerminalWindow *new_window;
+    TerminalScreen *screen;
+
+    app = terminal_app_get ();
+
+    screen = priv->active_screen;
+
+    new_window = terminal_app_new_window (app, gtk_widget_get_screen (GTK_WIDGET (window)));
+
+    terminal_window_move_screen (window, new_window, screen, -1);
+
+    /* FIXME: this seems wrong if tabs are shown in the window */
+    terminal_window_update_size (new_window, screen, FALSE);
+
+    gtk_window_present_with_time (GTK_WINDOW (new_window), gtk_get_current_event_time ());
+}
+
+static void
+help_contents_callback (GtkAction *action,
+                        TerminalWindow *window)
+{
+    terminal_util_show_help (NULL, GTK_WINDOW (window));
+}
+
+#define ABOUT_GROUP "About"
+#define EMAILIFY(string) (g_strdelimit ((string), "%", '@'))
+
+static void
+help_about_callback (GtkAction *action,
+                     TerminalWindow *window)
+{
+    char *licence_text;
+    GBytes *bytes;
+    const guint8 *data;
+    GKeyFile *key_file;
+    GError *error = NULL;
+    char **authors, **contributors, **artists, **documenters, **array_strv;
+    gchar *comments = NULL;
+    gsize data_len, n_authors = 0, n_contributors = 0, n_artists = 0, n_documenters = 0 , i;
+    GPtrArray *array;
+
+    bytes = g_resources_lookup_data (TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/terminal.about",
+                                     G_RESOURCE_LOOKUP_FLAGS_NONE,
+                                     &error);
+    g_assert_no_error (error);
+
+    data = g_bytes_get_data (bytes, &data_len);
+    key_file = g_key_file_new ();
+    g_key_file_load_from_data (key_file, (const char *) data, data_len, 0, &error);
+    g_assert_no_error (error);
+
+    authors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Authors", &n_authors, NULL);
+    contributors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Contributors", &n_contributors, NULL);
+    artists = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Artists", &n_artists, NULL);
+    documenters = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Documenters", &n_documenters, NULL);
+    g_key_file_free (key_file);
+    g_bytes_unref (bytes);
+
+    array = g_ptr_array_new ();
+
+    for (i = 0; i < n_authors; ++i)
+        g_ptr_array_add (array, EMAILIFY (authors[i]));
+    g_free (authors); /* strings are now owned by the array */
+
+    if (n_contributors > 0)
+    {
+        g_ptr_array_add (array, g_strdup (""));
+        g_ptr_array_add (array, g_strdup (_("Contributors:")));
+        for (i = 0; i < n_contributors; ++i)
+            g_ptr_array_add (array, EMAILIFY (contributors[i]));
+    }
+    g_free (contributors); /* strings are now owned by the array */
+
+    g_ptr_array_add (array, NULL);
+    array_strv = (char **) g_ptr_array_free (array, FALSE);
+
+    for (i = 0; i < n_artists; ++i)
+        artists[i] = EMAILIFY (artists[i]);
+    for (i = 0; i < n_documenters; ++i)
+        documenters[i] = EMAILIFY (documenters[i]);
+
+    licence_text = terminal_util_get_licence_text ();
+
+    comments = g_strdup_printf (_("MATE Terminal is a terminal emulator for the MATE Desktop Environment.\nPowered by Virtual TErminal %d.%d.%d"),
+                                vte_get_major_version (), vte_get_minor_version (), vte_get_micro_version ());
+
+    gtk_show_about_dialog (GTK_WINDOW (window),
+                           "program-name", _("MATE Terminal"),
+                           "version", VERSION,
+                           "title", _("About MATE Terminal"),
+                           "copyright", _("Copyright \xc2\xa9 2002–2004 Havoc Pennington\n"
+                                          "Copyright \xc2\xa9 2003–2004, 2007 Mariano Suárez-Alvarez\n"
+                                          "Copyright \xc2\xa9 2006 Guilherme de S. Pastore\n"
+                                          "Copyright \xc2\xa9 2007–2010 Christian Persch\n"
+                                          "Copyright \xc2\xa9 2011 Perberos\n"
+                                          "Copyright \xc2\xa9 2012-2021 MATE developers"),
+                           "comments", comments,
+                           "authors", array_strv,
+                           "artists", artists,
+                           "documenters", documenters,
+                           "license", licence_text,
+                           "wrap-license", TRUE,
+                           "translator-credits", _("translator-credits"),
+                           "logo-icon-name", MATE_TERMINAL_ICON_NAME,
+                           "website", PACKAGE_URL,
+                           NULL);
+
+    g_free (comments);
+    g_strfreev (array_strv);
+    g_strfreev (artists);
+    g_strfreev (documenters);
+    g_free (licence_text);
+}
+
+GtkUIManager *
+terminal_window_get_ui_manager (TerminalWindow *window)
+{
+    TerminalWindowPrivate *priv = window->priv;
+
+    return priv->ui_manager;
+}
+
+void
+terminal_window_save_state (TerminalWindow *window,
+                            GKeyFile *key_file,
+                            const char *group)
+{
+    TerminalWindowPrivate *priv = window->priv;
+    GList *tabs, *lt;
+    TerminalScreen *active_screen;
+    GdkWindowState state;
+    GPtrArray *tab_names_array;
+    char **tab_names;
+    gsize len;
+
+    //XXXif (priv->menub)//XXX
+    g_key_file_set_boolean (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_MENUBAR_VISIBLE,
+                            priv->menubar_visible);
+
+    g_key_file_set_string (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_ROLE,
+                           gtk_window_get_role (GTK_WINDOW (window)));
+
+    state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (window)));
+    if (state & GDK_WINDOW_STATE_MAXIMIZED)
+        g_key_file_set_boolean (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_MAXIMIZED, TRUE);
+    if (state & GDK_WINDOW_STATE_FULLSCREEN)
+        g_key_file_set_boolean (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_FULLSCREEN, TRUE);
+
+    active_screen = terminal_window_get_active (window);
+    tabs = terminal_window_list_screen_containers (window);
+
+    tab_names_array = g_ptr_array_sized_new (g_list_length (tabs) + 1);
+
+    for (lt = tabs; lt != NULL; lt = lt->next)
+    {
+        TerminalScreen *screen;
+        char *tab_group;
+
+        screen = terminal_screen_container_get_screen (TERMINAL_SCREEN_CONTAINER (lt->data));
+
+        tab_group = g_strdup_printf ("Terminal%p", screen);
+        g_ptr_array_add (tab_names_array, tab_group);
+
+        terminal_screen_save_config (screen, key_file, tab_group);
+
+        if (screen == active_screen)
+        {
+            int w, h, x, y;
+            char *geometry;
+
+            g_key_file_set_string (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_ACTIVE_TAB, tab_group);
+
+            /* FIXME saving the geometry is not great :-/ */
+            terminal_screen_get_size (screen, &w, &h);
+            gtk_window_get_position (GTK_WINDOW (window), &x, &y);
+            geometry = g_strdup_printf ("%dx%d+%d+%d", w, h, x, y);
+            g_key_file_set_string (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_GEOMETRY, geometry);
+            g_free (geometry);
+        }
+    }
+
+    g_list_free (tabs);
+
+    len = tab_names_array->len;
+    g_ptr_array_add (tab_names_array, NULL);
+    tab_names = (char **) g_ptr_array_free (tab_names_array, FALSE);
+    g_key_file_set_string_list (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_TABS, (const char * const *) tab_names, len);
+    g_strfreev (tab_names);
+}
+
+TerminalWindow *
+terminal_window_get_latest_focused (TerminalWindow *window1,
+                                    TerminalWindow *window2)
+{
+  TerminalWindowPrivate *priv1 = NULL;
+  TerminalWindowPrivate *priv2 = NULL;
+
+  if (!window1)
+    return window2;
+
+  if (!window2)
+    return window1;
+
+  priv1 = window1->priv;
+  priv2 = window2->priv;
+
+  if (priv2->focus_time > priv1->focus_time)
+    return window2;
+
+  return window1;
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/6.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/6.html new file mode 100644 index 0000000..27cbbb8 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/6.html @@ -0,0 +1,453 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/* eggsmclient.h
+ * Copyright (C) 2007 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __EGG_SM_CLIENT_H__
+#define __EGG_SM_CLIENT_H__
+
+#include <glib-object.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+G_BEGIN_DECLS
+
+#define EGG_TYPE_SM_CLIENT            (egg_sm_client_get_type ())
+G_DECLARE_DERIVABLE_TYPE (EggSMClient, egg_sm_client, EGG, SM_CLIENT, GObject)
+
+typedef enum
+{
+    EGG_SM_CLIENT_END_SESSION_DEFAULT,
+    EGG_SM_CLIENT_LOGOUT,
+    EGG_SM_CLIENT_REBOOT,
+    EGG_SM_CLIENT_SHUTDOWN
+} EggSMClientEndStyle;
+
+typedef enum
+{
+    EGG_SM_CLIENT_MODE_DISABLED,
+    EGG_SM_CLIENT_MODE_NO_RESTART,
+    EGG_SM_CLIENT_MODE_NORMAL
+} EggSMClientMode;
+
+struct _EggSMClientClass
+{
+    GObjectClass parent_class;
+
+    /* signals */
+    void (*save_state)       (EggSMClient *client,
+                              GKeyFile    *state_file);
+
+    void (*quit_requested)   (EggSMClient *client);
+    void (*quit_cancelled)   (EggSMClient *client);
+    void (*quit)             (EggSMClient *client);
+
+    /* virtual methods */
+    void (*startup)             (EggSMClient          *client,
+                                 const char           *client_id);
+    void (*set_restart_command) (EggSMClient          *client,
+                                 int                   argc,
+                                 const char          **argv);
+	void (*set_discard_command) (EggSMClient          *client,
+                                 int                   argc,
+                                 const char          **argv);
+    void (*will_quit)           (EggSMClient          *client,
+                                 gboolean              will_quit);
+    gboolean (*end_session)     (EggSMClient          *client,
+                                 EggSMClientEndStyle   style,
+                                 gboolean              request_confirmation);
+
+    /* Padding for future expansion */
+    void (*_egg_reserved1) (void);
+    void (*_egg_reserved2) (void);
+    void (*_egg_reserved3) (void);
+    void (*_egg_reserved4) (void);
+};
+
+GOptionGroup    *egg_sm_client_get_option_group    (void);
+
+/* Initialization */
+void             egg_sm_client_set_mode            (EggSMClientMode mode);
+EggSMClientMode  egg_sm_client_get_mode            (void);
+EggSMClient     *egg_sm_client_get                 (void);
+
+/* Resuming a saved session */
+gboolean         egg_sm_client_is_resumed          (EggSMClient *client);
+GKeyFile        *egg_sm_client_get_state_file      (EggSMClient *client);
+
+/* Alternate means of saving state */
+void             egg_sm_client_set_restart_command (EggSMClient  *client,
+                                                    int           argc,
+                                                    const char  **argv);
+void             egg_sm_client_set_discard_command (EggSMClient  *client,
+                                                    int           argc,
+                                                    const char  **argv);
+
+/* Handling "quit_requested" signal */
+void             egg_sm_client_will_quit           (EggSMClient *client,
+                                                    gboolean     will_quit);
+
+/* Initiate a logout/reboot/shutdown */
+gboolean         egg_sm_client_end_session         (EggSMClientEndStyle  style,
+                                                    gboolean             request_confirmation);
+
+G_END_DECLS
+
+#endif /* __EGG_SM_CLIENT_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/60.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/60.html new file mode 100644 index 0000000..0f97337 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/60.html @@ -0,0 +1,1419 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * Copyright © 2001, 2002 Havoc Pennington
+ * Copyright © 2002 Red Hat, Inc.
+ * Copyright © 2002 Sun Microsystems
+ * Copyright © 2003 Mariano Suarez-Alvarez
+ * Copyright © 2008, 2010 Christian Persch
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * Mate-terminal 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <errno.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <locale.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <unistd.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <glib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gstdio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gio/gio.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include <gdk/gdk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gdk/gdkx.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#ifdef HAVE_SMCLIENT
+#include "eggsmclient.h"<--- Include file: "eggsmclient.h" not found.
+#endif /* HAVE_SMCLIENT */
+
+#include "terminal-accels.h"
+#include "terminal-app.h"
+#include "terminal-debug.h"
+#include "terminal-intl.h"
+#include "terminal-options.h"
+#include "terminal-util.h"
+
+#define TERMINAL_FACTORY_SERVICE_NAME_PREFIX  "org.mate.Terminal.Display"
+#define TERMINAL_FACTORY_SERVICE_PATH         "/org/mate/Terminal/Factory"
+#define TERMINAL_FACTORY_INTERFACE_NAME       "org.mate.Terminal.Factory"
+
+static char *
+ay_to_string (GVariant *variant,
+              GError **error)
+{
+	gsize len;
+	const char *data;
+
+	data = g_variant_get_fixed_array (variant, &len, sizeof (char));
+	if (len == 0)
+		return NULL;
+
+	/* Make sure there are no embedded NULs */
+	if (memchr (data, '\0', len) != NULL)
+	{
+		g_set_error_literal (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+		                     "String is shorter than claimed");
+		return NULL;
+	}
+
+	return g_strndup (data, len);
+}
+
+static char **
+ay_to_strv (GVariant *variant,
+            int *argc)
+{
+	GPtrArray *argv;
+	const char *data, *nullbyte;
+	gsize data_len;
+	gssize len;
+
+	data = g_variant_get_fixed_array (variant, &data_len, sizeof (char));
+	if (data_len == 0 || data_len > G_MAXSSIZE)
+	{
+		if (argc != NULL)
+			*argc = 0;
+		return NULL;
+	}
+
+	argv = g_ptr_array_new ();
+
+	len = data_len;
+	do
+	{
+		gssize string_len;
+
+		nullbyte = memchr (data, '\0', len);
+
+		string_len = nullbyte ? (gssize) (nullbyte - data) : len;
+		g_ptr_array_add (argv, g_strndup (data, string_len));
+
+		len -= string_len + 1;
+		data += string_len + 1;
+	}
+	while (len > 0);
+
+	if (argc)
+		*argc = argv->len;
+
+	/* NULL terminate */
+	g_ptr_array_add (argv, NULL);
+	return (char **) g_ptr_array_free (argv, FALSE);
+}
+
+static GVariant *
+string_to_ay (const char *string)
+{
+	gsize len;
+	char *data;
+
+	len = strlen (string);
+	data = g_strndup (string, len);
+
+	return g_variant_new_from_data (G_VARIANT_TYPE ("ay"), data, len, TRUE, g_free, data);
+}
+
+typedef struct
+{
+	char *factory_name;
+	TerminalOptions *options;
+	int exit_code;
+	char **argv;
+	int argc;
+} OwnData;
+
+static void
+method_call_cb (GDBusConnection *connection,
+                const char *sender,
+                const char *object_path,
+                const char *interface_name,
+                const char *method_name,
+                GVariant *parameters,
+                GDBusMethodInvocation *invocation,
+                gpointer user_data)
+{
+	if (g_strcmp0 (method_name, "HandleArguments") == 0)
+	{
+		TerminalOptions *options = NULL;
+		GVariant *v_wd, *v_display, *v_sid, *v_envv, *v_argv;
+		char *working_directory = NULL, *display_name = NULL, *startup_id = NULL;
+		int initial_workspace = -1;
+		char **envv = NULL, **argv = NULL;
+		int argc;
+		GError *error = NULL;
+
+		g_variant_get (parameters, "(@ay@ay@ay@ayi@ay)",
+		               &v_wd, &v_display, &v_sid, &v_envv, &initial_workspace, &v_argv);
+
+		working_directory = ay_to_string (v_wd, &error);
+		if (error)
+			goto out;
+		display_name = ay_to_string (v_display, &error);
+		if (error)
+			goto out;
+		startup_id = ay_to_string (v_sid, &error);
+		if (error)
+			goto out;
+		envv = ay_to_strv (v_envv, NULL);
+		argv = ay_to_strv (v_argv, &argc);
+
+		_terminal_debug_print (TERMINAL_DEBUG_FACTORY,
+		                       "Factory invoked with working-dir='%s' display='%s' startup-id='%s'"
+		                       "workspace='%d'\n",
+		                       working_directory ? working_directory : "(null)",
+		                       display_name ? display_name : "(null)",
+		                       startup_id ? startup_id : "(null)",
+		                       initial_workspace);
+
+		options = terminal_options_parse (working_directory,
+		                                  display_name,
+		                                  startup_id,
+		                                  envv,
+		                                  TRUE,
+		                                  TRUE,
+		                                  &argc, &argv,
+		                                  &error,
+		                                  NULL);
+
+		if (options != NULL)
+		{
+			options->initial_workspace = initial_workspace;
+
+			terminal_app_handle_options (terminal_app_get (), options, FALSE /* no resume */, &error);
+			terminal_options_free (options);
+		}
+
+out:
+		g_variant_unref (v_wd);
+		g_free (working_directory);
+		g_variant_unref (v_display);
+		g_free (display_name);
+		g_variant_unref (v_sid);
+		g_free (startup_id);
+		g_variant_unref (v_envv);
+		g_strfreev (envv);
+		g_variant_unref (v_argv);
+		g_strfreev (argv);
+
+		if (error == NULL)
+		{
+			g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
+		}
+		else
+		{
+			g_dbus_method_invocation_return_gerror (invocation, error);
+			g_error_free (error);
+		}
+	}
+}
+
+static void
+bus_acquired_cb (GDBusConnection *connection,
+                 const char *name,
+                 gpointer user_data)
+{
+	static const char dbus_introspection_xml[] =
+	    "<node name='/org/mate/Terminal'>"
+	    "<interface name='org.mate.Terminal.Factory'>"
+	    "<method name='HandleArguments'>"
+	    "<arg type='ay' name='working_directory' direction='in' />"
+	    "<arg type='ay' name='display_name' direction='in' />"
+	    "<arg type='ay' name='startup_id' direction='in' />"
+	    "<arg type='ay' name='environment' direction='in' />"
+	    "<arg type='i' name='workspace' direction='in' />"
+	    "<arg type='ay' name='arguments' direction='in' />"
+	    "</method>"
+	    "</interface>"
+	    "</node>";
+
+	static const GDBusInterfaceVTable interface_vtable =
+	{
+		method_call_cb,
+		NULL,
+		NULL,
+		{ 0 }
+	};
+
+	OwnData *data = (OwnData *) user_data;
+	GDBusNodeInfo *introspection_data;
+	guint registration_id;
+	GError *error = NULL;
+
+	_terminal_debug_print (TERMINAL_DEBUG_FACTORY,
+	                       "Bus %s acquired\n", name);
+
+	introspection_data = g_dbus_node_info_new_for_xml (dbus_introspection_xml, NULL);
+	g_assert (introspection_data != NULL);
+
+	registration_id = g_dbus_connection_register_object (connection,
+	                  TERMINAL_FACTORY_SERVICE_PATH,
+	                  introspection_data->interfaces[0],
+	                  &interface_vtable,
+	                  NULL, NULL,
+	                  &error);
+	g_dbus_node_info_unref (introspection_data);
+
+	if (registration_id == 0)
+	{
+		g_printerr ("Failed to register object: %s\n", error->message);
+		g_error_free (error);
+		data->exit_code = EXIT_FAILURE;
+		gtk_main_quit ();
+	}
+}
+
+static void
+name_acquired_cb (GDBusConnection *connection,
+                  const char *name,
+                  gpointer user_data)
+{
+	OwnData *data = (OwnData *) user_data;
+	GError *error = NULL;
+
+	_terminal_debug_print (TERMINAL_DEBUG_FACTORY,
+	                       "Acquired the name %s on the session bus\n", name);
+
+	if (data->options == NULL)
+	{
+		/* Name re-acquired!? */
+		g_assert_not_reached ();
+	}
+
+	if (!terminal_app_handle_options (terminal_app_get (), data->options, TRUE /* do resume */, &error))
+	{
+		g_printerr ("Failed to handle options: %s\n", error->message);
+		g_error_free (error);
+		data->exit_code = EXIT_FAILURE;
+		gtk_main_quit ();
+	}
+
+	terminal_options_free (data->options);
+	data->options = NULL;
+}
+
+static void
+name_lost_cb (GDBusConnection *connection,
+              const char *name,
+              gpointer user_data)
+{
+	OwnData *data = (OwnData *) user_data;
+	GError *error = NULL;
+	char **envv;
+	int i;
+	GVariantBuilder builder;
+	GVariant *value;
+	GString *string;
+	char *s;
+	gsize len;
+
+	_terminal_debug_print (TERMINAL_DEBUG_FACTORY,
+	                       "Lost the name %s on the session bus\n", name);
+
+	/* Couldn't get the connection? No way to continue! */
+	if (connection == NULL)
+	{
+		data->exit_code = EXIT_FAILURE;
+		gtk_main_quit ();
+		return;
+	}
+
+	if (data->options == NULL)
+	{
+		/* Already handled */
+		data->exit_code = EXIT_SUCCESS;
+		gtk_main_quit ();
+		return;
+	}
+
+	_terminal_debug_print (TERMINAL_DEBUG_FACTORY,
+	                       "Forwarding arguments to existing instance\n");
+
+	g_variant_builder_init (&builder, G_VARIANT_TYPE ("(ayayayayiay)"));
+
+	g_variant_builder_add (&builder, "@ay", string_to_ay (data->options->default_working_dir));
+	g_variant_builder_add (&builder, "@ay", string_to_ay (data->options->display_name));
+	g_variant_builder_add (&builder, "@ay", string_to_ay (data->options->startup_id));
+
+	string = g_string_new (NULL);
+	envv = g_get_environ ();
+	for (i = 0; envv[i]; ++i)
+	{
+		if (i > 0)
+			g_string_append_c (string, '\0');
+
+		g_string_append (string, envv[i]);
+	}
+	g_strfreev (envv);
+
+	len = string->len;
+	s = g_string_free (string, FALSE);
+	g_variant_builder_add (&builder, "@ay",
+	                       g_variant_new_from_data (G_VARIANT_TYPE ("ay"), s, len, TRUE, g_free, s));
+
+	g_variant_builder_add (&builder, "@i", g_variant_new_int32 (data->options->initial_workspace));
+
+	string = g_string_new (NULL);
+
+	for (i = 0; i < data->argc; ++i)
+	{
+		if (i > 0)
+			g_string_append_c (string, '\0');
+		g_string_append (string, data->argv[i]);
+	}
+
+	len = string->len;
+	s = g_string_free (string, FALSE);
+	g_variant_builder_add (&builder, "@ay",
+	                       g_variant_new_from_data (G_VARIANT_TYPE ("ay"), s, len, TRUE, g_free, s));
+
+	value = g_dbus_connection_call_sync (connection,
+	                                     data->factory_name,
+	                                     TERMINAL_FACTORY_SERVICE_PATH,
+	                                     TERMINAL_FACTORY_INTERFACE_NAME,
+	                                     "HandleArguments",
+	                                     g_variant_builder_end (&builder),
+	                                     G_VARIANT_TYPE ("()"),
+	                                     G_DBUS_CALL_FLAGS_NONE,
+	                                     -1,
+	                                     NULL,
+	                                     &error);
+	if (value == NULL)
+	{
+		g_printerr ("Failed to forward arguments: %s\n", error->message);
+		g_error_free (error);
+		data->exit_code = EXIT_FAILURE;
+		gtk_main_quit ();
+	}
+	else
+	{
+		g_variant_unref (value);
+		data->exit_code = EXIT_SUCCESS;
+	}
+
+	terminal_options_free (data->options);
+	data->options = NULL;
+
+	gtk_main_quit ();
+}
+
+static char *
+get_factory_name_for_display (const char *display_name)
+{
+	GString *name;
+	const char *p;
+
+	name = g_string_sized_new (strlen (TERMINAL_FACTORY_SERVICE_NAME_PREFIX) + strlen (display_name) + 1 /* NUL */);
+	g_string_append (name, TERMINAL_FACTORY_SERVICE_NAME_PREFIX);
+
+	for (p = display_name; *p; ++p)
+	{
+		if (g_ascii_isalnum (*p))
+			g_string_append_c (name, *p);
+		else
+			g_string_append_c (name, '_');
+	}
+
+	_terminal_debug_print (TERMINAL_DEBUG_FACTORY,
+	                       "Factory name is \"%s\"\n", name->str);
+
+	return g_string_free (name, FALSE);
+}
+
+static int
+get_initial_workspace (void)
+{
+  int ret = -1;
+  GdkWindow *window;
+  guchar *data = NULL;
+  GdkAtom atom;
+  GdkAtom cardinal_atom;
+
+  window = gdk_get_default_root_window();
+
+  atom = gdk_atom_intern_static_string ("_NET_CURRENT_DESKTOP");
+  cardinal_atom = gdk_atom_intern_static_string ("CARDINAL");
+
+  if (gdk_property_get (window, atom, cardinal_atom, 0, 8, FALSE, NULL, NULL, NULL, &data)) {
+	  ret = *(int *)data;
+	  g_free (data);
+  }
+  return ret;
+}
+
+int
+main (int argc, char **argv)
+{
+	int i;
+	char **argv_copy;
+	int argc_copy;
+	const char *startup_id, *home_dir;
+	TerminalOptions *options;
+	GError *error = NULL;
+	char *working_directory;
+	int ret = EXIT_SUCCESS;
+
+	setlocale (LC_ALL, "");
+
+	bindtextdomain (GETTEXT_PACKAGE, TERM_LOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
+	_terminal_debug_init ();
+
+	/* Make a NULL-terminated copy since we may need it later */
+	argv_copy = g_new (char *, argc + 1);
+	for (i = 0; i < argc; ++i)
+		argv_copy [i] = argv [i];
+	argv_copy [i] = NULL;
+	argc_copy = argc;
+
+	startup_id = g_getenv ("DESKTOP_STARTUP_ID");
+
+	working_directory = g_get_current_dir ();
+
+	/* Now change directory to $HOME so we don't prevent unmounting, e.g. if the
+	 * factory is started by caja-open-terminal. See bug #565328.
+	 * On failure back to /.
+	 */
+	home_dir = g_get_home_dir ();
+	if (home_dir == NULL || chdir (home_dir) < 0)
+		if (chdir ("/") < 0)
+			g_warning ("Could not change working directory.");
+
+	options = terminal_options_parse (working_directory,
+	                                  NULL,
+	                                  startup_id,
+	                                  NULL,
+	                                  FALSE,
+	                                  FALSE,
+	                                  &argc, &argv,
+	                                  &error,
+#ifdef HAVE_SMCLIENT
+	                                  gtk_get_option_group (TRUE),
+	                                  egg_sm_client_get_option_group (),
+#endif /* HAVE_SMCLIENT */
+	                                  NULL);
+	g_free (working_directory);
+
+	if (options == NULL)
+	{
+		g_printerr (_("Failed to parse arguments: %s\n"), error->message);
+		g_error_free (error);
+		exit (EXIT_FAILURE);
+	}
+
+	g_set_application_name (_("Terminal"));
+
+	/* Unset the these env variables, so they doesn't end up
+	 * in the factory's env and thus in the terminals' envs.
+	 */
+	g_unsetenv ("DESKTOP_STARTUP_ID");
+	g_unsetenv ("GIO_LAUNCHED_DESKTOP_FILE_PID");
+	g_unsetenv ("GIO_LAUNCHED_DESKTOP_FILE");
+
+	if (options->startup_id == NULL)
+	{
+		options->startup_id = g_strdup_printf ("_TIME%" G_GINT64_FORMAT,
+		                                       g_get_monotonic_time () / 1000);
+	}
+
+	gdk_init (&argc, &argv);
+	const char *display_name = gdk_display_get_name (gdk_display_get_default ());
+	options->display_name = g_strdup (display_name);
+
+	if (options->use_factory)
+	{
+		OwnData *data;
+		guint owner_id;
+
+		data = g_new (OwnData, 1);
+		data->factory_name = get_factory_name_for_display (display_name);
+		data->options = options;
+		data->exit_code = -1;
+		data->argv = argv_copy;
+		data->argc = argc_copy;
+
+		gtk_init(&argc, &argv);
+		options->initial_workspace = get_initial_workspace ();
+
+		owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
+		                           data->factory_name,
+		                           G_BUS_NAME_OWNER_FLAGS_NONE,
+		                           bus_acquired_cb,
+		                           name_acquired_cb,
+		                           name_lost_cb,
+		                           data, NULL);
+
+		gtk_main ();
+
+		ret = data->exit_code;
+		g_bus_unown_name (owner_id);
+
+		g_free (data->factory_name);
+		g_free (data);
+
+	}
+	else
+	{
+		gtk_init(&argc, &argv);
+		terminal_app_handle_options (terminal_app_get (), options, TRUE /* allow resume */, &error);
+		terminal_options_free (options);
+
+		if (error == NULL)
+		{
+			gtk_main ();
+		}
+		else
+		{
+			g_printerr ("Error handling options: %s\n", error->message);
+			g_error_free (error);
+			ret = EXIT_FAILURE;
+		}
+	}
+
+	terminal_app_shutdown ();
+
+	g_free (argv_copy);
+
+	return ret;
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/7.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/7.html new file mode 100644 index 0000000..8df4c77 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/7.html @@ -0,0 +1,327 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
 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
/* eggsmclient-private.h
+ * Copyright (C) 2007 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __EGG_SM_CLIENT_PRIVATE_H__
+#define __EGG_SM_CLIENT_PRIVATE_H__
+
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "eggsmclient.h"
+
+G_BEGIN_DECLS
+
+GKeyFile *egg_sm_client_save_state     (EggSMClient *client);
+void      egg_sm_client_quit_requested (EggSMClient *client);
+void      egg_sm_client_quit_cancelled (EggSMClient *client);
+void      egg_sm_client_quit           (EggSMClient *client);
+
+#ifdef EGG_SM_CLIENT_BACKEND_XSMP
+    GType        egg_sm_client_xsmp_get_type (void);
+    EggSMClient *egg_sm_client_xsmp_new      (void);
+#endif
+#ifdef EGG_SM_CLIENT_BACKEND_DBUS
+    GType        egg_sm_client_dbus_get_type (void);
+    EggSMClient *egg_sm_client_dbus_new      (void);
+#endif
+
+G_END_DECLS
+
+#endif /* __EGG_SM_CLIENT_PRIVATE_H__ */
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/8.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/8.html new file mode 100644 index 0000000..1089639 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/8.html @@ -0,0 +1,1523 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/*
+ * Copyright (C) 2007 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"<--- Include file: "config.h" not found.
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <glib/gi18n.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+
+#include "eggsmclient.h"
+#include "eggsmclient-private.h"
+
+static void egg_sm_client_debug_handler (const char *log_domain,
+        GLogLevelFlags log_level,
+        const char *message,
+        gpointer user_data);
+
+enum
+{
+    SAVE_STATE,
+    QUIT_REQUESTED,
+    QUIT_CANCELLED,
+    QUIT,
+    LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+typedef struct {
+    GKeyFile *state_file;
+}EggSMClientPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EggSMClient, egg_sm_client, 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 EggSMClient *global_client;
+static EggSMClientMode global_client_mode = EGG_SM_CLIENT_MODE_NORMAL;
+
+static gboolean
+running_in_mate (void)
+{
+    return (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "MATE") == 0)
+        || (g_strcmp0 (g_getenv ("XDG_SESSION_DESKTOP"), "mate") == 0)
+        || (g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "mate") == 0);
+}
+
+static void
+egg_sm_client_init (EggSMClient *client)
+{
+    ;
+}
+
+static void
+egg_sm_client_class_init (EggSMClientClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+    /**
+     * EggSMClient::save_state:
+     * @client: the client
+     * @state_file: a #GKeyFile to save state information into
+     *
+     * Emitted when the session manager has requested that the
+     * application save information about its current state. The
+     * application should save its state into @state_file, and then the
+     * session manager may then restart the application in a future
+     * session and tell it to initialize itself from that state.
+     *
+     * You should not save any data into @state_file's "start group"
+     * (ie, the %NULL group). Instead, applications should save their
+     * data into groups with names that start with the application name,
+     * and libraries that connect to this signal should save their data
+     * into groups with names that start with the library name.
+     *
+     * Alternatively, rather than (or in addition to) using @state_file,
+     * the application can save its state by calling
+     * egg_sm_client_set_restart_command() during the processing of this
+     * signal (eg, to include a list of files to open).
+     **/
+    signals[SAVE_STATE] =
+        g_signal_new ("save_state",
+                      G_OBJECT_CLASS_TYPE (object_class),
+                      G_SIGNAL_RUN_LAST,
+                      G_STRUCT_OFFSET (EggSMClientClass, save_state),
+                      NULL, NULL,
+                      g_cclosure_marshal_VOID__POINTER,
+                      G_TYPE_NONE,
+                      1, G_TYPE_POINTER);
+
+    /**
+     * EggSMClient::quit_requested:
+     * @client: the client
+     *
+     * Emitted when the session manager requests that the application
+     * exit (generally because the user is logging out). The application
+     * should decide whether or not it is willing to quit (perhaps after
+     * asking the user what to do with documents that have unsaved
+     * changes) and then call egg_sm_client_will_quit(), passing %TRUE
+     * or %FALSE to give its answer to the session manager. (It does not
+     * need to give an answer before returning from the signal handler;
+     * it can interact with the user asynchronously and then give its
+     * answer later on.) If the application does not connect to this
+     * signal, then #EggSMClient will automatically return %TRUE on its
+     * behalf.
+     *
+     * The application should not save its session state as part of
+     * handling this signal; if the user has requested that the session
+     * be saved when logging out, then ::save_state will be emitted
+     * separately.
+     *
+     * If the application agrees to quit, it should then wait for either
+     * the ::quit_cancelled or ::quit signals to be emitted.
+     **/
+    signals[QUIT_REQUESTED] =
+        g_signal_new ("quit_requested",
+                      G_OBJECT_CLASS_TYPE (object_class),
+                      G_SIGNAL_RUN_LAST,
+                      G_STRUCT_OFFSET (EggSMClientClass, quit_requested),
+                      NULL, NULL,
+                      g_cclosure_marshal_VOID__VOID,
+                      G_TYPE_NONE,
+                      0);
+
+    /**
+     * EggSMClient::quit_cancelled:
+     * @client: the client
+     *
+     * Emitted when the session manager decides to cancel a logout after
+     * the application has already agreed to quit. After receiving this
+     * signal, the application can go back to what it was doing before
+     * receiving the ::quit_requested signal.
+     **/
+    signals[QUIT_CANCELLED] =
+        g_signal_new ("quit_cancelled",
+                      G_OBJECT_CLASS_TYPE (object_class),
+                      G_SIGNAL_RUN_LAST,
+                      G_STRUCT_OFFSET (EggSMClientClass, quit_cancelled),
+                      NULL, NULL,
+                      g_cclosure_marshal_VOID__VOID,
+                      G_TYPE_NONE,
+                      0);
+
+    /**
+     * EggSMClient::quit:
+     * @client: the client
+     *
+     * Emitted when the session manager wants the application to quit
+     * (generally because the user is logging out). The application
+     * should exit as soon as possible after receiving this signal; if
+     * it does not, the session manager may choose to forcibly kill it.
+     *
+     * Normally a GUI application would only be sent a ::quit if it
+     * agreed to quit in response to a ::quit_requested signal. However,
+     * this is not guaranteed; in some situations the session manager
+     * may decide to end the session without giving applications a
+     * chance to object.
+     **/
+    signals[QUIT] =
+        g_signal_new ("quit",
+                      G_OBJECT_CLASS_TYPE (object_class),
+                      G_SIGNAL_RUN_LAST,
+                      G_STRUCT_OFFSET (EggSMClientClass, quit),
+                      NULL, NULL,
+                      g_cclosure_marshal_VOID__VOID,
+                      G_TYPE_NONE,
+                      0);
+}
+
+static gboolean sm_client_disable = FALSE;
+static char *sm_client_state_file = NULL;
+static char *sm_client_id = NULL;
+static char *sm_config_prefix = NULL;
+
+static gboolean
+sm_client_post_parse_func (GOptionContext  *context,
+                           GOptionGroup    *group,
+                           gpointer         data,
+                           GError         **error)
+{
+    EggSMClient *client = egg_sm_client_get ();
+
+    if (sm_client_id == NULL)
+    {
+        const gchar *desktop_autostart_id;
+
+        desktop_autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID");
+
+        if (desktop_autostart_id != NULL)
+            sm_client_id = g_strdup (desktop_autostart_id);
+    }
+
+    /* Unset DESKTOP_AUTOSTART_ID in order to avoid child processes to
+     * use the same client id. */
+    g_unsetenv ("DESKTOP_AUTOSTART_ID");
+
+    if (global_client_mode != EGG_SM_CLIENT_MODE_DISABLED &&
+        EGG_SM_CLIENT_GET_CLASS (client)->startup)
+        EGG_SM_CLIENT_GET_CLASS (client)->startup (client, sm_client_id);
+    return TRUE;
+}
+
+/**
+ * egg_sm_client_get_option_group:
+ *
+ * Creates a %GOptionGroup containing the session-management-related
+ * options. You should add this group to the application's
+ * %GOptionContext if you want to use #EggSMClient.
+ *
+ * Return value: the %GOptionGroup
+ **/
+GOptionGroup *
+egg_sm_client_get_option_group (void)
+{
+    const GOptionEntry entries[] =
+    {
+        {
+            "sm-client-disable", 0, 0,
+            G_OPTION_ARG_NONE, &sm_client_disable,
+            N_("Disable connection to session manager"), NULL
+        },
+        {
+            "sm-client-state-file", 0, 0,
+            G_OPTION_ARG_FILENAME, &sm_client_state_file,
+            N_("Specify file containing saved configuration"), N_("FILE")
+        },
+        {
+            "sm-client-id", 0, 0,
+            G_OPTION_ARG_STRING, &sm_client_id,
+            N_("Specify session management ID"), N_("ID")
+        },
+        /* MateClient compatibility option */
+        {
+            "sm-disable", 0, G_OPTION_FLAG_HIDDEN,
+            G_OPTION_ARG_NONE, &sm_client_disable,
+            NULL, NULL
+        },
+        /* MateClient compatibility option. This is a dummy option that only
+         * exists so that sessions saved by apps with MateClient can be restored
+         * later when they've switched to EggSMClient. See bug #575308.
+         */
+        {
+            "sm-config-prefix", 0, G_OPTION_FLAG_HIDDEN,
+            G_OPTION_ARG_STRING, &sm_config_prefix,
+            NULL, NULL
+        },
+        { NULL }
+    };
+    GOptionGroup *group;
+
+    /* Use our own debug handler for the "EggSMClient" domain. */
+    g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
+                       egg_sm_client_debug_handler, NULL);
+
+    group = g_option_group_new ("sm-client",
+                                _("Session management options:"),
+                                _("Show session management options"),
+                                NULL, NULL);
+    g_option_group_add_entries (group, entries);
+    g_option_group_set_parse_hooks (group, NULL, sm_client_post_parse_func);
+
+    return group;
+}
+
+/**
+ * egg_sm_client_set_mode:
+ * @mode: an #EggSMClient mode
+ *
+ * Sets the "mode" of #EggSMClient as follows:
+ *
+ *    %EGG_SM_CLIENT_MODE_DISABLED: Session management is completely
+ *    disabled, until the mode is changed again. The application will
+ *    not even connect to the session manager. (egg_sm_client_get()
+ *    will still return an #EggSMClient object.)
+ *
+ *    %EGG_SM_CLIENT_MODE_NO_RESTART: The application will connect to
+ *    the session manager (and thus will receive notification when the
+ *    user is logging out, etc), but will request to not be
+ *    automatically restarted with saved state in future sessions.
+ *
+ *    %EGG_SM_CLIENT_MODE_NORMAL: The default. #EggSMCLient will
+ *    function normally.
+ *
+ * This must be called before the application's main loop begins and
+ * before any call to egg_sm_client_get(), unless the mode was set
+ * earlier to %EGG_SM_CLIENT_MODE_DISABLED and this call enables
+ * session management. Note that option parsing will call
+ * egg_sm_client_get().
+ **/
+void
+egg_sm_client_set_mode (EggSMClientMode mode)
+{
+    EggSMClientMode old_mode = global_client_mode;
+
+    g_return_if_fail (global_client == NULL || global_client_mode == EGG_SM_CLIENT_MODE_DISABLED);
+    g_return_if_fail (!(global_client != NULL && mode == EGG_SM_CLIENT_MODE_DISABLED));
+
+    global_client_mode = mode;
+
+    if (global_client != NULL && old_mode == EGG_SM_CLIENT_MODE_DISABLED)
+    {
+        if (EGG_SM_CLIENT_GET_CLASS (global_client)->startup)
+            EGG_SM_CLIENT_GET_CLASS (global_client)->startup (global_client, sm_client_id);
+    }
+}
+
+/**
+ * egg_sm_client_get_mode:
+ *
+ * Gets the global #EggSMClientMode. See egg_sm_client_set_mode()
+ * for details.
+ *
+ * Return value: the global #EggSMClientMode
+ **/
+EggSMClientMode
+egg_sm_client_get_mode (void)
+{
+    return global_client_mode;
+}
+
+/**
+ * egg_sm_client_get:
+ *
+ * Returns the master #EggSMClient for the application.
+ *
+ * On platforms that support saved sessions (ie, POSIX/X11), the
+ * application will only request to be restarted by the session
+ * manager if you call egg_set_desktop_file() to set an application
+ * desktop file. In particular, if the desktop file contains the key
+ * "X
+ *
+ * Return value: the master #EggSMClient.
+ **/
+EggSMClient *
+egg_sm_client_get (void)
+{
+    if (!global_client)
+    {
+        if (!sm_client_disable)
+        {
+            /* If both D-Bus and XSMP are compiled in, try XSMP first
+             * (since it supports state saving) and fall back to D-Bus
+             * if XSMP isn't available.
+             */
+#ifdef EGG_SM_CLIENT_BACKEND_XSMP
+            global_client = egg_sm_client_xsmp_new ();
+#endif
+#ifdef EGG_SM_CLIENT_BACKEND_DBUS
+            if (!global_client)
+                global_client = egg_sm_client_dbus_new ();
+#endif
+        }
+
+        /* Fallback: create a dummy client, so that callers don't have
+         * to worry about a %NULL return value.
+         */
+        if (!global_client)
+            global_client = g_object_new (EGG_TYPE_SM_CLIENT, NULL);
+        /*FIXME
+          Disabling when root/not in MATE in GtkApplication builds
+          as egg_sm_client_set_mode must be called prior to start of main loop
+          to stop caja restart but this is diffcult in GtkApplication */
+
+		if (geteuid () == 0 || !running_in_mate ()){
+            global_client = g_object_new (EGG_TYPE_SM_CLIENT, NULL);
+        }
+    }
+
+    return global_client;
+}
+
+/**
+ * egg_sm_client_is_resumed:
+ * @client: the client
+ *
+ * Checks whether or not the current session has been resumed from
+ * a previous saved session. If so, the application should call
+ * egg_sm_client_get_state_file() and restore its state from the
+ * returned #GKeyFile.
+ *
+ * Return value: %TRUE if the session has been resumed
+ **/
+gboolean
+egg_sm_client_is_resumed (EggSMClient *client)
+{
+    g_return_val_if_fail (client == global_client, FALSE);
+
+    return sm_client_state_file != NULL;
+}
+
+/**
+ * egg_sm_client_get_state_file:
+ * @client: the client
+ *
+ * If the application was resumed by the session manager, this will
+ * return the #GKeyFile containing its state from the previous
+ * session.
+ *
+ * Note that other libraries and #EggSMClient itself may also store
+ * state in the key file, so if you call egg_sm_client_get_groups(),
+ * on it, the return value will likely include groups that you did not
+ * put there yourself. (It is also not guaranteed that the first
+ * group created by the application will still be the "start group"
+ * when it is resumed.)
+ *
+ * Return value: the #GKeyFile containing the application's earlier
+ * state, or %NULL on error. You should not free this key file; it
+ * is owned by @client.
+ **/
+GKeyFile *
+egg_sm_client_get_state_file (EggSMClient *client)
+{
+    EggSMClientPrivate *priv = egg_sm_client_get_instance_private (client);
+    char *state_file_path;
+    GError *err = NULL;
+
+    g_return_val_if_fail (client == global_client, NULL);
+
+    if (!sm_client_state_file)
+        return NULL;
+    if (priv->state_file)
+        return priv->state_file;
+
+    if (!strncmp (sm_client_state_file, "file://", 7))
+        state_file_path = g_filename_from_uri (sm_client_state_file, NULL, NULL);
+    else
+        state_file_path = g_strdup (sm_client_state_file);
+
+    priv->state_file = g_key_file_new ();
+    if (!g_key_file_load_from_file (priv->state_file, state_file_path, 0, &err))
+    {
+        g_warning ("Could not load SM state file '%s': %s",
+                   sm_client_state_file, err->message);
+        g_clear_error (&err);
+        g_key_file_free (priv->state_file);
+        priv->state_file = NULL;
+    }
+
+    g_free (state_file_path);
+    return priv->state_file;
+}
+
+/**
+ * egg_sm_client_set_restart_command:
+ * @client: the client
+ * @argc: the length of @argv
+ * @argv: argument vector
+ *
+ * Sets the command used to restart @client if it does not have a
+ * .desktop file that can be used to find its restart command.
+ *
+ * This can also be used when handling the ::save_state signal, to
+ * save the current state via an updated command line. (Eg, providing
+ * a list of filenames to open when the application is resumed.)
+ **/
+void
+egg_sm_client_set_restart_command (EggSMClient  *client,
+                                   int           argc,
+                                   const char  **argv)
+{
+    g_return_if_fail (EGG_IS_SM_CLIENT (client));
+
+    if (EGG_SM_CLIENT_GET_CLASS (client)->set_restart_command)
+        EGG_SM_CLIENT_GET_CLASS (client)->set_restart_command (client, argc, argv);
+}
+
+/**
+ * egg_sm_client_set_discard_command:
+ * @client: the client
+ * @argc: the length of @argv
+ * @argv: argument vector
+ *
+ * Sets the command used to discard a custom state file if using
+ * egg_sm_client_set_restart_command(), which must be called before
+ * using this function.
+ **/
+void
+egg_sm_client_set_discard_command (EggSMClient  *client,
+                                   int           argc,
+                                   const char  **argv)
+{
+	g_return_if_fail (EGG_IS_SM_CLIENT (client));
+
+	if (EGG_SM_CLIENT_GET_CLASS (client)->set_discard_command)
+		EGG_SM_CLIENT_GET_CLASS (client)->set_discard_command (client, argc, argv);
+}
+
+/**
+ * egg_sm_client_will_quit:
+ * @client: the client
+ * @will_quit: whether or not the application is willing to quit
+ *
+ * This MUST be called in response to the ::quit_requested signal, to
+ * indicate whether or not the application is willing to quit. The
+ * application may call it either directly from the signal handler, or
+ * at some later point (eg, after asynchronously interacting with the
+ * user).
+ *
+ * If the application does not connect to ::quit_requested,
+ * #EggSMClient will call this method on its behalf (passing %TRUE
+ * for @will_quit).
+ *
+ * After calling this method, the application should wait to receive
+ * either ::quit_cancelled or ::quit.
+ **/
+void
+egg_sm_client_will_quit (EggSMClient *client,
+                         gboolean     will_quit)
+{
+    g_return_if_fail (EGG_IS_SM_CLIENT (client));
+
+    if (EGG_SM_CLIENT_GET_CLASS (client)->will_quit)
+        EGG_SM_CLIENT_GET_CLASS (client)->will_quit (client, will_quit);
+}
+
+/**
+ * egg_sm_client_end_session:
+ * @style: a hint at how to end the session
+ * @request_confirmation: whether or not the user should get a chance
+ * to confirm the action
+ *
+ * Requests that the session manager end the current session. @style
+ * indicates how the session should be ended, and
+ * @request_confirmation indicates whether or not the user should be
+ * given a chance to confirm the logout/reboot/shutdown. Both of these
+ * flags are merely hints though; the session manager may choose to
+ * ignore them.
+ *
+ * Return value: %TRUE if the request was sent; %FALSE if it could not
+ * be (eg, because it could not connect to the session manager).
+ **/
+gboolean
+egg_sm_client_end_session (EggSMClientEndStyle  style,
+                           gboolean             request_confirmation)
+{
+    EggSMClient *client = egg_sm_client_get ();
+
+    g_return_val_if_fail (EGG_IS_SM_CLIENT (client), FALSE);
+
+    if (EGG_SM_CLIENT_GET_CLASS (client)->end_session)
+    {
+        return EGG_SM_CLIENT_GET_CLASS (client)->end_session (client, style,
+                request_confirmation);
+    }
+    else
+        return FALSE;
+}
+
+/* Signal-emitting callbacks from platform-specific code */
+
+GKeyFile *
+egg_sm_client_save_state (EggSMClient *client)
+{
+    GKeyFile *state_file;
+    char *group;
+
+    g_return_val_if_fail (client == global_client, NULL);
+
+    state_file = g_key_file_new ();
+
+    g_debug ("Emitting save_state");
+    g_signal_emit (client, signals[SAVE_STATE], 0, state_file);
+    g_debug ("Done emitting save_state");
+
+    group = g_key_file_get_start_group (state_file);
+    if (group)
+    {
+        g_free (group);
+        return state_file;
+    }
+    else
+    {
+        g_key_file_free (state_file);
+        return NULL;
+    }
+}
+
+void
+egg_sm_client_quit_requested (EggSMClient *client)
+{
+    g_return_if_fail (client == global_client);
+
+    if (!g_signal_has_handler_pending (client, signals[QUIT_REQUESTED], 0, FALSE))
+    {
+        g_debug ("Not emitting quit_requested because no one is listening");
+        egg_sm_client_will_quit (client, TRUE);
+        return;
+    }
+
+    g_debug ("Emitting quit_requested");
+    g_signal_emit (client, signals[QUIT_REQUESTED], 0);
+    g_debug ("Done emitting quit_requested");
+}
+
+void
+egg_sm_client_quit_cancelled (EggSMClient *client)
+{
+    g_return_if_fail (client == global_client);
+
+    g_debug ("Emitting quit_cancelled");
+    g_signal_emit (client, signals[QUIT_CANCELLED], 0);
+    g_debug ("Done emitting quit_cancelled");
+}
+
+void
+egg_sm_client_quit (EggSMClient *client)
+{
+    g_return_if_fail (client == global_client);
+
+    g_debug ("Emitting quit");
+    g_signal_emit (client, signals[QUIT], 0);
+    g_debug ("Done emitting quit");
+
+    /* FIXME: should we just call gtk_main_quit() here? */
+}
+
+static void
+egg_sm_client_debug_handler (const char *log_domain,
+                             GLogLevelFlags log_level,
+                             const char *message,
+                             gpointer user_data)
+{
+    static int debug = -1;
+
+    if (debug < 0)
+        debug = (g_getenv ("EGG_SM_CLIENT_DEBUG") != NULL);
+
+    if (debug)
+        g_log_default_handler (log_domain, log_level, message, NULL);
+}
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/9.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/9.html new file mode 100644 index 0000000..bdb5012 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/9.html @@ -0,0 +1,1071 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+
  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
/* eggtreemultidnd.c
+ * Copyright (C) 2001  Red Hat, 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#endif
+
+#include <string.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include <gtk/gtk.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
+#include "eggtreemultidnd.h"
+
+#define EGG_TREE_MULTI_DND_STRING "EggTreeMultiDndString"
+
+typedef struct
+{
+    guint pressed_button;
+    gint x;
+    gint y;
+    guint motion_notify_handler;
+    guint button_release_handler;
+    guint drag_data_get_handler;
+    GSList *event_list;
+} EggTreeMultiDndData;
+
+/* CUT-N-PASTE from gtktreeview.c */
+typedef struct _TreeViewDragInfo TreeViewDragInfo;
+struct _TreeViewDragInfo
+{
+    GdkModifierType start_button_mask;
+    GtkTargetList *source_target_list;<--- struct member '_TreeViewDragInfo::source_target_list' is never used.
+    GdkDragAction source_actions;
+
+    GtkTargetList *dest_target_list;<--- struct member '_TreeViewDragInfo::dest_target_list' is never used.
+
+    guint source_set : 1;
+    guint dest_set : 1;
+};
+
+
+GType
+egg_tree_multi_drag_source_get_type (void)
+{
+    static GType our_type = 0;
+
+    if (!our_type)
+    {
+        const GTypeInfo our_info =
+        {
+            sizeof (EggTreeMultiDragSourceIface), /* class_size */
+            NULL,		/* base_init */
+            NULL,		/* base_finalize */
+            NULL,
+            NULL,		/* class_finalize */
+            NULL,		/* class_data */
+            0,
+            0,              /* n_preallocs */
+            NULL
+        };
+
+        our_type = g_type_register_static (G_TYPE_INTERFACE, "EggTreeMultiDragSource", &our_info, 0);
+    }
+
+    return our_type;
+}
+
+
+/**
+ * egg_tree_multi_drag_source_row_draggable:
+ * @drag_source: a #EggTreeMultiDragSource
+ * @path: row on which user is initiating a drag
+ *
+ * Asks the #EggTreeMultiDragSource whether a particular row can be used as
+ * the source of a DND operation. If the source doesn't implement
+ * this interface, the row is assumed draggable.
+ *
+ * Return value: %TRUE if the row can be dragged
+ **/
+gboolean
+egg_tree_multi_drag_source_row_draggable (EggTreeMultiDragSource *drag_source,
+        GList                  *path_list)
+{
+    EggTreeMultiDragSourceIface *iface = EGG_TREE_MULTI_DRAG_SOURCE_GET_IFACE (drag_source);
+
+    g_return_val_if_fail (EGG_IS_TREE_MULTI_DRAG_SOURCE (drag_source), FALSE);
+    g_return_val_if_fail (iface->row_draggable != NULL, FALSE);
+    g_return_val_if_fail (path_list != NULL, FALSE);
+
+    if (iface->row_draggable)
+        return (* iface->row_draggable) (drag_source, path_list);
+    else
+        return TRUE;
+}
+
+
+/**
+ * egg_tree_multi_drag_source_drag_data_delete:
+ * @drag_source: a #EggTreeMultiDragSource
+ * @path: row that was being dragged
+ *
+ * Asks the #EggTreeMultiDragSource to delete the row at @path, because
+ * it was moved somewhere else via drag-and-drop. Returns %FALSE
+ * if the deletion fails because @path no longer exists, or for
+ * some model-specific reason. Should robustly handle a @path no
+ * longer found in the model!
+ *
+ * Return value: %TRUE if the row was successfully deleted
+ **/
+gboolean
+egg_tree_multi_drag_source_drag_data_delete (EggTreeMultiDragSource *drag_source,
+        GList                  *path_list)
+{
+    EggTreeMultiDragSourceIface *iface = EGG_TREE_MULTI_DRAG_SOURCE_GET_IFACE (drag_source);
+
+    g_return_val_if_fail (EGG_IS_TREE_MULTI_DRAG_SOURCE (drag_source), FALSE);
+    g_return_val_if_fail (iface->drag_data_delete != NULL, FALSE);
+    g_return_val_if_fail (path_list != NULL, FALSE);
+
+    return (* iface->drag_data_delete) (drag_source, path_list);
+}
+
+/**
+ * egg_tree_multi_drag_source_drag_data_get:
+ * @drag_source: a #EggTreeMultiDragSource
+ * @path: row that was dragged
+ * @selection_data: a #EggSelectionData to fill with data from the dragged row
+ *
+ * Asks the #EggTreeMultiDragSource to fill in @selection_data with a
+ * representation of the row at @path. @selection_data->target gives
+ * the required type of the data.  Should robustly handle a @path no
+ * longer found in the model!
+ *
+ * Return value: %TRUE if data of the required type was provided
+ **/
+gboolean
+egg_tree_multi_drag_source_drag_data_get    (EggTreeMultiDragSource *drag_source,
+        GList                  *path_list,
+        GtkSelectionData  *selection_data)
+{
+    EggTreeMultiDragSourceIface *iface = EGG_TREE_MULTI_DRAG_SOURCE_GET_IFACE (drag_source);
+
+    g_return_val_if_fail (EGG_IS_TREE_MULTI_DRAG_SOURCE (drag_source), FALSE);
+    g_return_val_if_fail (iface->drag_data_get != NULL, FALSE);
+    g_return_val_if_fail (path_list != NULL, FALSE);
+    g_return_val_if_fail (selection_data != NULL, FALSE);
+
+    return (* iface->drag_data_get) (drag_source, path_list, selection_data);
+}
+
+static void
+stop_drag_check (GtkWidget *widget)
+{
+    EggTreeMultiDndData *priv_data;
+    GSList *l;
+
+    priv_data = g_object_get_data (G_OBJECT (widget), EGG_TREE_MULTI_DND_STRING);
+
+    for (l = priv_data->event_list; l != NULL; l = l->next)
+        gdk_event_free (l->data);
+
+    g_slist_free (priv_data->event_list);
+    priv_data->event_list = NULL;
+    g_signal_handler_disconnect (widget, priv_data->motion_notify_handler);
+    g_signal_handler_disconnect (widget, priv_data->button_release_handler);
+}
+
+static gboolean
+egg_tree_multi_drag_button_release_event (GtkWidget      *widget,
+        GdkEventButton *event,
+        gpointer        data)
+{
+    EggTreeMultiDndData *priv_data;<--- Variable 'priv_data' can be declared as pointer to const
+    GSList *l;
+
+    priv_data = g_object_get_data (G_OBJECT (widget), EGG_TREE_MULTI_DND_STRING);
+
+    for (l = priv_data->event_list; l != NULL; l = l->next)
+        gtk_propagate_event (widget, l->data);
+
+    stop_drag_check (widget);
+
+    return FALSE;
+}
+
+static void
+selection_foreach (GtkTreeModel *model,
+                   GtkTreePath  *path,
+                   GtkTreeIter  *iter,
+                   gpointer      data)
+{
+    GList **list_ptr;
+
+    list_ptr = (GList **) data;
+
+    *list_ptr = g_list_prepend (*list_ptr, gtk_tree_row_reference_new (model, path));
+}
+
+static void
+path_list_free (GList *path_list)
+{
+    g_list_foreach (path_list, (GFunc) gtk_tree_row_reference_free, NULL);
+    g_list_free (path_list);
+}
+
+static void
+set_context_data (GdkDragContext *context,
+                  GList          *path_list)
+{
+    g_object_set_data_full (G_OBJECT (context),
+                            "egg-tree-view-multi-source-row",
+                            path_list,
+                            (GDestroyNotify) path_list_free);
+}
+
+static GList *
+get_context_data (GdkDragContext *context)
+{
+    return g_object_get_data (G_OBJECT (context),
+                              "egg-tree-view-multi-source-row");
+}
+
+/* CUT-N-PASTE from gtktreeview.c */
+static TreeViewDragInfo*
+get_info (GtkTreeView *tree_view)
+{
+    return g_object_get_data (G_OBJECT (tree_view), "gtk-tree-view-drag-info");
+}
+
+
+static void
+egg_tree_multi_drag_drag_data_get (GtkWidget        *widget,
+                                   GdkDragContext   *context,
+                                   GtkSelectionData *selection_data,
+                                   guint             info,
+                                   guint             time)
+{
+    GtkTreeView *tree_view;
+    GtkTreeModel *model;
+    TreeViewDragInfo *di;<--- Variable 'di' can be declared as pointer to const
+    GList *path_list;
+
+    tree_view = GTK_TREE_VIEW (widget);
+
+    model = gtk_tree_view_get_model (tree_view);
+
+    if (model == NULL)
+        return;
+
+    di = get_info (GTK_TREE_VIEW (widget));
+
+    if (di == NULL)
+        return;
+
+    path_list = get_context_data (context);
+
+    if (path_list == NULL)
+        return;
+
+    /* We can implement the GTK_TREE_MODEL_ROW target generically for
+     * any model; for DragSource models there are some other targets
+     * we also support.
+     */
+
+    if (EGG_IS_TREE_MULTI_DRAG_SOURCE (model))
+    {
+        egg_tree_multi_drag_source_drag_data_get (EGG_TREE_MULTI_DRAG_SOURCE (model),
+                path_list,
+                selection_data);
+    }
+}
+
+static gboolean
+egg_tree_multi_drag_motion_event (GtkWidget      *widget,
+                                  GdkEventMotion *event,
+                                  gpointer        data)
+{
+    EggTreeMultiDndData *priv_data;
+
+    priv_data = g_object_get_data (G_OBJECT (widget), EGG_TREE_MULTI_DND_STRING);
+
+    if (gtk_drag_check_threshold (widget,
+                                  priv_data->x,
+                                  priv_data->y,
+                                  event->x,
+                                  event->y))
+    {
+        GList *path_list = NULL;
+        GtkTreeSelection *selection;
+        GtkTreeModel *model;
+        TreeViewDragInfo *di;
+
+        di = get_info (GTK_TREE_VIEW (widget));
+
+        if (di == NULL)
+            return FALSE;
+
+        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+        stop_drag_check (widget);
+        gtk_tree_selection_selected_foreach (selection, selection_foreach, &path_list);
+        path_list = g_list_reverse (path_list);
+        model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
+        if (egg_tree_multi_drag_source_row_draggable (EGG_TREE_MULTI_DRAG_SOURCE (model), path_list))
+        {
+            GdkDragContext *context;
+
+            context = gtk_drag_begin_with_coordinates (widget,
+                                                       gtk_drag_source_get_target_list (widget),
+                                                       di->source_actions,
+                                                       priv_data->pressed_button,
+                                                       (GdkEvent*)event,
+                                                       event->x,
+                                                       event->y);
+            set_context_data (context, path_list);
+            gtk_drag_set_icon_default (context);
+
+        }
+        else
+        {
+            path_list_free (path_list);
+        }
+    }
+
+    return TRUE;
+}
+
+static gboolean
+egg_tree_multi_drag_button_press_event (GtkWidget      *widget,
+                                        GdkEventButton *event,
+                                        gpointer        data)
+{
+    GtkTreeView *tree_view;
+    GtkTreePath *path = NULL;
+    GtkTreeViewColumn *column = NULL;
+    gint cell_x, cell_y;
+    GtkTreeSelection *selection;
+    EggTreeMultiDndData *priv_data;
+
+    tree_view = GTK_TREE_VIEW (widget);
+    priv_data = g_object_get_data (G_OBJECT (tree_view), EGG_TREE_MULTI_DND_STRING);
+    if (priv_data == NULL)
+    {
+        priv_data = g_new0 (EggTreeMultiDndData, 1);
+        g_object_set_data (G_OBJECT (tree_view), EGG_TREE_MULTI_DND_STRING, priv_data);
+    }
+
+    if (g_slist_find (priv_data->event_list, event))
+        return FALSE;
+
+    if (priv_data->event_list)
+    {
+        /* save the event to be propagated in order */
+        priv_data->event_list = g_slist_append (priv_data->event_list, gdk_event_copy ((GdkEvent*)event));
+        return TRUE;
+    }
+
+    if (event->type == GDK_2BUTTON_PRESS)
+        return FALSE;
+
+    gtk_tree_view_get_path_at_pos (tree_view,
+                                   event->x, event->y,
+                                   &path, &column,
+                                   &cell_x, &cell_y);
+
+    selection = gtk_tree_view_get_selection (tree_view);
+
+    if (path && gtk_tree_selection_path_is_selected (selection, path))
+    {
+        priv_data->pressed_button = event->button;
+        priv_data->x = event->x;
+        priv_data->y = event->y;
+        priv_data->event_list = g_slist_append (priv_data->event_list, gdk_event_copy ((GdkEvent*)event));
+        priv_data->motion_notify_handler =
+            g_signal_connect (G_OBJECT (tree_view), "motion_notify_event", G_CALLBACK (egg_tree_multi_drag_motion_event), NULL);
+        priv_data->button_release_handler =
+            g_signal_connect (G_OBJECT (tree_view), "button_release_event", G_CALLBACK (egg_tree_multi_drag_button_release_event), NULL);
+
+        if (priv_data->drag_data_get_handler == 0)
+        {
+            priv_data->drag_data_get_handler =
+                g_signal_connect (G_OBJECT (tree_view), "drag_data_get", G_CALLBACK (egg_tree_multi_drag_drag_data_get), NULL);
+        }
+
+        gtk_tree_path_free (path);
+
+        return TRUE;
+    }
+
+    if (path)
+    {
+        gtk_tree_path_free (path);
+    }
+
+    return FALSE;
+}
+
+void
+egg_tree_multi_drag_add_drag_support (GtkTreeView *tree_view)
+{
+    g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
+    g_signal_connect (G_OBJECT (tree_view), "button_press_event", G_CALLBACK (egg_tree_multi_drag_button_press_event), NULL);
+}
+
+
+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/index.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/index.html new file mode 100644 index 0000000..330f933 --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/index.html @@ -0,0 +1,573 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineIdCWESeverityMessage
checkersReportinformationActive checkers: There was critical errors (use --checkers-report=<filename> to see details)
src/eggshell.c
36missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
40missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
41missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
42missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
43missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
44missingIncludeSysteminformationInclude file: <pwd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
46missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/eggshell.h
31missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/extra-strings.c
25unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If N_ is a macro then please configure it.
src/mate-submodules/libegg/eggdesktopfile.c
25missingIncludeinformationInclude file: "config.h" not found.
30missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
37missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
334constParameterPointer398styleParameter 'desktop_file' can be declared as pointer to const
348constParameterPointer398styleParameter 'desktop_file' can be declared as pointer to const
362constParameterPointer398styleParameter 'desktop_file' can be declared as pointer to const
383constParameterPointer398styleParameter 'desktop_file' can be declared as pointer to const
497variableScope398styleThe scope of the variable 'try_exec' can be reduced.
497variableScope398styleThe scope of the variable 'found_program' can be reduced.
498variableScope398styleThe scope of the variable 'only_show_in' can be reduced.
498variableScope398styleThe scope of the variable 'not_show_in' can be reduced.
500variableScope398styleThe scope of the variable 'i' can be reduced.
575constParameterPointer398styleParameter 'desktop_file' can be declared as pointer to const
594constParameterPointer398styleParameter 'desktop_file' can be declared as pointer to const
610constParameterPointer398styleParameter 'desktop_file' can be declared as pointer to const
622variableScope398styleThe scope of the variable 'p' can be reduced.
649constParameterPointer398styleParameter 'desktop_file' can be declared as pointer to const
657constVariablePointer398styleVariable 'doc' can be declared as pointer to const
src/mate-submodules/libegg/eggdesktopfile.h
23missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/mate-submodules/libegg/eggsmclient-private.h
23missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/mate-submodules/libegg/eggsmclient-xsmp.c
24missingIncludeinformationInclude file: "config.h" not found.
31missingIncludeSysteminformationInclude file: <errno.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <fcntl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
36missingIncludeSysteminformationInclude file: <X11/SM/SMlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
39missingIncludeSysteminformationInclude file: <gdk/gdk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
42missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
182unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
1298missingIncludeSysteminformationInclude file: <X11/ICE/ICElib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
1299missingIncludeSysteminformationInclude file: <fcntl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/mate-submodules/libegg/eggsmclient.c
20missingIncludeinformationInclude file: "config.h" not found.
22missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
48unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
src/mate-submodules/libegg/eggsmclient.h
23missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/mate-submodules/libegg/eggtreemultidnd.c
21missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
46unusedStructMember563stylestruct member '_TreeViewDragInfo::source_target_list' is never used.
49unusedStructMember563stylestruct member '_TreeViewDragInfo::dest_target_list' is never used.
187constVariablePointer398styleVariable 'priv_data' can be declared as pointer to const
254constVariablePointer398styleVariable 'di' can be declared as pointer to const
src/mate-submodules/libegg/eggtreemultidnd.h
23missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/profile-editor.c
21missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <math.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
136constParameterCallback398styleParameter 'pspec' can be declared as pointer to const. However it seems that 'profile_notify_sensitivity_cb' is a callback function, if 'pspec' is declared with const you might also need to cast function pointer(s).
459variableScope398styleThe scope of the variable 'w' can be reduced.
src/profile-editor.h
25missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/skey-popup.c
20missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
94oppositeInnerCondition398warningOpposite inner 'if' condition leads to a dead code block.
110oppositeInnerCondition398warningOpposite inner 'if' condition leads to a dead code block.
188varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
src/skey-popup.h
24missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/skey/btoe.c
6missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
7missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
8missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
10missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
247constParameterPointer398styleParameter 'md' can be declared as pointer to const
282constParameterPointer398styleParameter 's' can be declared as pointer to const
src/skey/md4.c
26missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeinformationInclude file: "config.h" not found.
308missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
309missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
310missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/skey/md4.h
4missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/skey/md5.c
1missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
2missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
4missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
5missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/skey/md5.h
4missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/skey/sha1.c
1missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
3missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
4missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
5missingIncludeSysteminformationInclude file: <arpa/inet.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
7missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
71redundantAssignment563styleVariable 'results' is reassigned a value before the old one has been used.
src/skey/sha1.h
4missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/skey/skey.c
1missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
3missingIncludeSysteminformationInclude file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
4missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
5missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
6missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/skey/skeyutil.c
1missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
3missingIncludeSysteminformationInclude file: <ctype.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
5missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/skey/test.c
1missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
3missingIncludeSysteminformationInclude file: <locale.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
4missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
5missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
7missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-accels.c
20missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
22missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <gdk/gdkkeysyms.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
1000varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
src/terminal-accels.h
24missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-app.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <errno.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <dconf.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
41missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
42missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
45missingIncludeinformationInclude file: "eggsmclient.h" not found.
46missingIncludeinformationInclude file: "eggdesktopfile.h" not found.
1398unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
src/terminal-app.h
25missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-close-button.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_CODE is a macro then please configure it.
src/terminal-close-button.h
25missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-debug.c
20missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
22missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-debug.h
25missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
61missingIncludeSysteminformationInclude file: <stdarg.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
62missingIncludeSysteminformationInclude file: <glib/gstdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-encoding.c
20missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
22missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
140unusedStructMember563stylestruct member 'EncodingDialogData::available_model' is never used.
143unusedStructMember563stylestruct member 'EncodingDialogData::active_model' is never used.
190constParameterPointer398styleParameter 'encoding' can be declared as pointer to const
198constParameterPointer398styleParameter 'encoding' can be declared as pointer to const
252unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_GSIZE_FORMAT is a macro then please configure it.
293variableScope398styleThe scope of the variable 'id_string' can be reduced.
350constParameterCallback398styleParameter 'button' can be declared as pointer to const. However it seems that 'button_clicked_cb' is a callback function, if 'button' is declared with const you might also need to cast function pointer(s).
480varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
src/terminal-encoding.h
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-info-bar.c
20missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
src/terminal-info-bar.h
23missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-intl.h
24missingIncludeSysteminformationInclude file: <glib/gi18n.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-marshal.c
2missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-marshal.h
5missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-options.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <errno.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
309variableScope398styleThe scope of the variable 'it' can be reduced.
335variableScope398styleThe scope of the variable 'iw' can be reduced.
361variableScope398styleThe scope of the variable 'iw' can be reduced.
393variableScope398styleThe scope of the variable 'iw' can be reduced.
425variableScope398styleThe scope of the variable 'iw' can be reduced.
641variableScope398styleThe scope of the variable 'it' can be reduced.
src/terminal-options.h
26missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-profile.c
21missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
1179constVariablePointer398styleVariable 'priv' can be declared as pointer to const
1574constVariablePointer398styleVariable 'pspec' can be declared as pointer to const
1619constVariablePointer398styleVariable 'color' can be declared as pointer to const
1675constVariablePointer398styleVariable 'old_color' can be declared as pointer to const
src/terminal-profile.h
26missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-resources.c
1missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
9unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
9unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
src/terminal-screen-container.c
21missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
54unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
src/terminal-screen-container.h
24missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-screen.c
20missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
22missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <sys/wait.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <gdk/gdkkeysyms.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <gdk/gdk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <gdk-pixbuf/gdk-pixbuf.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <cairo.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
50missingIncludeSysteminformationInclude file: <pcre2.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
201unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
src/terminal-screen.h
25missingIncludeSysteminformationInclude file: <vte/vte.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-search-dialog.c
22missingIncludeinformationInclude file: "config.h" not found.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <pcre2.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
95varFuncNullUB475portabilityPassing NULL after the last typed argument to a variadic function leads to undefined behaviour.
src/terminal-search-dialog.h
25missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <vte/vte.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-tab-label.c
21missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-tab-label.h
23missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-tabs-menu.c
22missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
68unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
src/terminal-type-builtins.c
4missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-type-builtins.h
7missingIncludeSysteminformationInclude file: <glib-object.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-util.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
29missingIncludeSysteminformationInclude file: <sys/types.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
33missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
37missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeSysteminformationInclude file: <X11/Xatom.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
79variableScope398styleThe scope of the variable 'args' can be reduced.
552variableScope398styleThe scope of the variable 'password' can be reduced.
src/terminal-util.h
25missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal-window.c
21missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
23missingIncludeSysteminformationInclude file: <string.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
24missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <gdk/gdk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <gdk/gdkkeysyms.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
270unknownMacroerrorThere is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE_WITH_PRIVATE is a macro then please configure it.
src/terminal-window.h
24missingIncludeSysteminformationInclude file: <gtk/gtk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
src/terminal.c
23missingIncludeSysteminformationInclude file: <config.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
25missingIncludeSysteminformationInclude file: <errno.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
26missingIncludeSysteminformationInclude file: <locale.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
27missingIncludeSysteminformationInclude file: <stdlib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
28missingIncludeSysteminformationInclude file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
30missingIncludeSysteminformationInclude file: <glib.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
31missingIncludeSysteminformationInclude file: <glib/gstdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
32missingIncludeSysteminformationInclude file: <gio/gio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
34missingIncludeSysteminformationInclude file: <gdk/gdk.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
35missingIncludeSysteminformationInclude file: <gdk/gdkx.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
38missingIncludeinformationInclude file: "eggsmclient.h" not found.
+
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/stats.html b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/stats.html new file mode 100644 index 0000000..293f4cb --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/stats.html @@ -0,0 +1,209 @@ + + + + + + Cppcheck - HTML report - mate-terminal + + + + + +
+ + + +
+

Top 10 files for error severity, total findings: 11
+   1  src/terminal-window.c
+   1  src/terminal-tabs-menu.c
+   1  src/terminal-screen.c
+   1  src/terminal-screen-container.c
+   1  src/terminal-info-bar.c
+   1  src/terminal-encoding.c
+   1  src/terminal-close-button.c
+   1  src/terminal-app.c
+   1  src/mate-submodules/libegg/eggsmclient.c
+   1  src/mate-submodules/libegg/eggsmclient-xsmp.c
+

+

Top 10 files for warning severity, total findings: 2
+   2  src/skey-popup.c
+

+

Top 10 files for portability severity, total findings: 4
+   1  src/terminal-search-dialog.c
+   1  src/terminal-encoding.c
+   1  src/terminal-accels.c
+   1  src/skey-popup.c
+

+

Top 10 files for style severity, total findings: 44
+   15  src/mate-submodules/libegg/eggdesktopfile.c
+   6   src/terminal-options.c
+   6   src/terminal-encoding.c
+   4   src/terminal-profile.c
+   4   src/mate-submodules/libegg/eggtreemultidnd.c
+   2   src/terminal-util.c
+   2   src/terminal-resources.c
+   2   src/skey/btoe.c
+   2   src/profile-editor.c
+   1   src/skey/sha1.c
+

+

Top 10 files for information severity, total findings: 186
+   13  src/terminal-screen.c
+   12  src/mate-submodules/libegg/eggsmclient-xsmp.c
+   11  src/terminal.c
+   10  src/terminal-util.c
+   8   src/terminal-app.c
+   7   src/terminal-window.c
+   7   src/eggshell.c
+   6   src/skey/md4.c
+   6   src/mate-submodules/libegg/eggdesktopfile.c
+   5   src/terminal-options.c
+

+ +
+ +
+ + diff --git a/2024-02-18-150112-8118-cppcheck@705094ddc117_master/style.css b/2024-02-18-150112-8118-cppcheck@705094ddc117_master/style.css new file mode 100644 index 0000000..3897bfa --- /dev/null +++ b/2024-02-18-150112-8118-cppcheck@705094ddc117_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