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 --- .../index.html | 169 + .../report-092d31.html | 2385 +++++++++ .../report-20669e.html | 2840 ++++++++++ .../report-215a71.html | 2840 ++++++++++ .../report-2b0dd9.html | 2840 ++++++++++ .../report-3c2acf.html | 2385 +++++++++ .../report-49a7b3.html | 2385 +++++++++ .../report-792baf.html | 2385 +++++++++ .../report-80c412.html | 2840 ++++++++++ .../report-86ff44.html | 1773 +++++++ .../report-8ae438.html | 1773 +++++++ .../report-8c30a3.html | 2385 +++++++++ .../report-8c7a76.html | 1021 ++++ .../report-959831.html | 747 +++ .../report-a2885e.html | 789 +++ .../report-b430a1.html | 747 +++ .../report-b8f564.html | 2089 ++++++++ .../report-c21a0f.html | 2385 +++++++++ .../report-cbf846.html | 1021 ++++ .../report-cf3974.html | 2089 ++++++++ .../report-d040d4.html | 2840 ++++++++++ .../report-d2e905.html | 2385 +++++++++ .../report-e22eee.html | 983 ++++ .../report-eb3cb1.html | 5495 ++++++++++++++++++++ .../report-f1a256.html | 789 +++ .../scanview.css | 62 + .../sorttable.js | 492 ++ 27 files changed, 50934 insertions(+) create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/index.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-092d31.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-20669e.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-215a71.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-2b0dd9.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-3c2acf.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-49a7b3.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-792baf.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-80c412.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-86ff44.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-8ae438.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-8c30a3.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-8c7a76.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-959831.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-a2885e.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-b430a1.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-b8f564.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-c21a0f.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-cbf846.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-cf3974.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-d040d4.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-d2e905.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-e22eee.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-eb3cb1.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/report-f1a256.html create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/scanview.css create mode 100644 2024-02-22-160956-4994-1@6043b1f90c7e_master/sorttable.js (limited to '2024-02-22-160956-4994-1@6043b1f90c7e_master') diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/index.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/index.html new file mode 100644 index 0000000..aa0a7c6 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/index.html @@ -0,0 +1,169 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@090ab8e2386e
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 17.0.6 (Fedora 17.0.6-2.fc39) +
Date:Thu Feb 22 16:09:56 2024
+

Bug Summary

+ + + + + + + + + + +
Bug TypeQuantityDisplay?
All Bugs24
Logic error
Branch condition evaluates to a garbage value1
Cast from non-struct type to struct type15
Security
Potential insecure memory buffer bounds restriction in call 'strcat'4
Potential insecure memory buffer bounds restriction in call 'strcpy'3
Unused code
Unreachable code1
+

Reports

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Bug GroupBug Type ▾FileFunction/MethodLinePath Length
Logic errorBranch condition evaluates to a garbage valueterminal-window.cconfirm_close_window_or_tab37189View Report
Logic errorCast from non-struct type to struct typeterminal-profile.cterminal_profile_gsettings_notify_cb6071View Report
Logic errorCast from non-struct type to struct typeterminal-app.cterminal_app_profile_list_notify_cb8171View Report
Logic errorCast from non-struct type to struct typeterminal-app.cterminal_app_system_font_notify_cb10431View Report
Logic errorCast from non-struct type to struct typeterminal-app.cterminal_app_default_profile_notify_cb9351View Report
Logic errorCast from non-struct type to struct typeterminal-profile.cterminal_profile_gsettings_notify_cb6501View Report
Logic errorCast from non-struct type to struct typeterminal-profile.cterminal_profile_gsettings_notify_cb6001View Report
Logic errorCast from non-struct type to struct typeterminal-profile.cterminal_profile_gsettings_notify_cb6411View Report
Logic errorCast from non-struct type to struct typeterminal-app.cterminal_app_profile_list_notify_cb8161View Report
Logic errorCast from non-struct type to struct typeterminal-accels.ckeys_change_notify5411View Report
Logic errorCast from non-struct type to struct typeterminal-accels.cbinding_from_value6561View Report
Logic errorCast from non-struct type to struct typeterminal-profile.cterminal_profile_gsettings_notify_cb6491View Report
Logic errorCast from non-struct type to struct typemate-submodules/libegg/eggsmclient-xsmp.carray_prop11991View Report
Logic errorCast from non-struct type to struct typemate-submodules/libegg/eggsmclient-xsmp.cptrarray_prop12321View Report
Logic errorCast from non-struct type to struct typeterminal-app.cterminal_app_encoding_list_notify_cb9991View Report
Logic errorCast from non-struct type to struct typeterminal-profile.cterminal_profile_gsettings_notify_cb6481View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcat'skey/md4.cMD4Keycrunch2761View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcat'skey/md5.cMD5Keycrunch271View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcat'skey/btoe.cbtoe2631View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcat'skey/sha1.cSHA1Keycrunch531View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'skey/sha1.cSHA1Keycrunch511View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'skey/md5.cMD5Keycrunch251View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'skey/md4.cMD4Keycrunch2741View Report
Unused codeUnreachable codeterminal-profile.cterminal_profile_property_locked15791View Report
+ + diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-092d31.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-092d31.html new file mode 100644 index 0000000..678fd5b --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-092d31.html @@ -0,0 +1,2385 @@ + + + +terminal-profile.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:terminal-profile.c
Warning:line 607, column 46
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name terminal-profile.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I .. -I ../src/mate-submodules/libegg -D TERMINAL_COMPILATION -D TERMINAL_RESOURCES_PATH_PREFIX="/org/mate/terminal" -D TERM_DATADIR="/usr/local/share" -D TERM_LOCALEDIR="/usr/local/share/locale" -D TERM_PKGDATADIR="/usr/local/share/mate-terminal" -D TERM_HELPDIR="/usr/local/share/help" -D SN_API_NOT_YET_FROZEN -D GDK_MULTIHEAD_SAFE -D G_DISABLE_SINGLE_INCLUDES -D PANGO_DISABLE_SINGLE_INCLUDES -D ATK_DISABLE_SINGLE_INCLUDES -D GDK_DISABLE_SINGLE_INCLUDES -D GDK_PIXBUF_DISABLE_SINGLE_INCLUDES -D GTK_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c terminal-profile.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright © 2001 Havoc Pennington
3 * Copyright © 2002 Mathias Hasselmann
4 * Copyright © 2008 Christian Persch
5 * Copyright (C) 2012-2021 MATE Developers
6 *
7 * Mate-terminal is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * Mate-terminal is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <config.h>
22
23#include <string.h>
24#include <stdlib.h>
25
26#include <gtk/gtk.h>
27
28#include "terminal-app.h"
29#include "terminal-debug.h"
30#include "terminal-intl.h"
31#include "terminal-profile.h"
32#include "terminal-screen.h"
33#include "terminal-type-builtins.h"
34
35/* To add a new key, you need to:
36 *
37 * - add an entry to the enum below
38 * - add a #define with its name in terminal-profile.h
39 * - add a gobject property for it in terminal_profile_class_init
40 * - if the property's type needs special casing, add that to
41 * terminal_profile_gsettings_notify_cb and
42 * terminal_profile_gsettings_changeset_add
43 * - if necessary the default value cannot be handled via the paramspec,
44 * handle that in terminal_profile_reset_property_internal
45 */
46enum
47{
48 PROP_0,
49 PROP_ALLOW_BOLD,
50 PROP_BACKGROUND_COLOR,
51 PROP_BACKGROUND_DARKNESS,
52 PROP_BACKGROUND_IMAGE,
53 PROP_BACKGROUND_IMAGE_FILE,
54 PROP_BACKGROUND_TYPE,
55 PROP_BACKSPACE_BINDING,
56 PROP_BOLD_COLOR,
57 PROP_BOLD_COLOR_SAME_AS_FG,
58 PROP_CURSOR_BLINK_MODE,
59 PROP_CURSOR_SHAPE,
60 PROP_CUSTOM_COMMAND,
61 PROP_DEFAULT_SIZE_COLUMNS,
62 PROP_DEFAULT_SIZE_ROWS,
63 PROP_DEFAULT_SHOW_MENUBAR,
64 PROP_DELETE_BINDING,
65 PROP_EXIT_ACTION,
66 PROP_FONT,
67 PROP_FOREGROUND_COLOR,
68 PROP_LOGIN_SHELL,
69 PROP_NAME,
70 PROP_PALETTE,
71 PROP_SCROLL_BACKGROUND,
72 PROP_SCROLLBACK_LINES,
73 PROP_SCROLLBACK_UNLIMITED,
74 PROP_SCROLLBAR_POSITION,
75 PROP_SCROLL_ON_KEYSTROKE,
76 PROP_SCROLL_ON_OUTPUT,
77 PROP_SILENT_BELL,
78 PROP_TITLE,
79 PROP_TITLE_MODE,
80 PROP_USE_CUSTOM_COMMAND,
81 PROP_USE_CUSTOM_DEFAULT_SIZE,
82 PROP_USE_SKEY,
83 PROP_USE_URLS,
84 PROP_USE_SYSTEM_FONT,
85 PROP_USE_THEME_COLORS,
86 PROP_VISIBLE_NAME,
87 PROP_WORD_CHARS,
88 PROP_COPY_SELECTION,
89 LAST_PROP
90};
91
92#define KEY_ALLOW_BOLD"allow-bold" "allow-bold"
93#define KEY_BACKGROUND_COLOR"background-color" "background-color"
94#define KEY_BACKGROUND_DARKNESS"background-darkness" "background-darkness"
95#define KEY_BACKGROUND_IMAGE_FILE"background-image" "background-image"
96#define KEY_BACKGROUND_TYPE"background-type" "background-type"
97#define KEY_BACKSPACE_BINDING"backspace-binding" "backspace-binding"
98#define KEY_BOLD_COLOR"bold-color" "bold-color"
99#define KEY_BOLD_COLOR_SAME_AS_FG"bold-color-same-as-fg" "bold-color-same-as-fg"
100#define KEY_CURSOR_BLINK_MODE"cursor-blink-mode" "cursor-blink-mode"
101#define KEY_CURSOR_SHAPE"cursor-shape" "cursor-shape"
102#define KEY_CUSTOM_COMMAND"custom-command" "custom-command"
103#define KEY_DEFAULT_SHOW_MENUBAR"default-show-menubar" "default-show-menubar"
104#define KEY_DEFAULT_SIZE_COLUMNS"default-size-columns" "default-size-columns"
105#define KEY_DEFAULT_SIZE_ROWS"default-size-rows" "default-size-rows"
106#define KEY_DELETE_BINDING"delete-binding" "delete-binding"
107#define KEY_EXIT_ACTION"exit-action" "exit-action"
108#define KEY_FONT"font" "font"
109#define KEY_FOREGROUND_COLOR"foreground-color" "foreground-color"
110#define KEY_LOGIN_SHELL"login-shell" "login-shell"
111#define KEY_PALETTE"palette" "palette"
112#define KEY_SCROLL_BACKGROUND"scroll-background" "scroll-background"
113#define KEY_SCROLLBACK_LINES"scrollback-lines" "scrollback-lines"
114#define KEY_SCROLLBACK_UNLIMITED"scrollback-unlimited" "scrollback-unlimited"
115#define KEY_SCROLLBAR_POSITION"scrollbar-position" "scrollbar-position"
116#define KEY_SCROLL_ON_KEYSTROKE"scroll-on-keystroke" "scroll-on-keystroke"
117#define KEY_SCROLL_ON_OUTPUT"scroll-on-output" "scroll-on-output"
118#define KEY_SILENT_BELL"silent-bell" "silent-bell"
119#define KEY_COPY_SELECTION"copy-selection" "copy-selection"
120#define KEY_TITLE_MODE"title-mode" "title-mode"
121#define KEY_TITLE"title" "title"
122#define KEY_USE_CUSTOM_COMMAND"use-custom-command" "use-custom-command"
123#define KEY_USE_CUSTOM_DEFAULT_SIZE"use-custom-default-size" "use-custom-default-size"
124#define KEY_USE_SKEY"use-skey" "use-skey"
125#define KEY_USE_URLS"use-urls" "use-urls"
126#define KEY_USE_SYSTEM_FONT"use-system-font" "use-system-font"
127#define KEY_USE_THEME_COLORS"use-theme-colors" "use-theme-colors"
128#define KEY_VISIBLE_NAME"visible-name" "visible-name"
129#define KEY_WORD_CHARS"word-chars" "word-chars"
130
131/* Keep these in sync with the GSettings schema! */
132#define DEFAULT_ALLOW_BOLD((!(0))) (TRUE(!(0)))
133#define DEFAULT_BACKGROUND_COLOR("#FFFFDD") ("#FFFFDD")
134#define DEFAULT_BOLD_COLOR_SAME_AS_FG((!(0))) (TRUE(!(0)))
135#define DEFAULT_BACKGROUND_DARKNESS(0.5) (0.5)
136#define DEFAULT_BACKGROUND_IMAGE_FILE("") ("")
137#define DEFAULT_BACKGROUND_TYPE(TERMINAL_BACKGROUND_SOLID) (TERMINAL_BACKGROUND_SOLID)
138#define DEFAULT_BACKSPACE_BINDING(VTE_ERASE_ASCII_DELETE) (VTE_ERASE_ASCII_DELETE)
139#define DEFAULT_CURSOR_BLINK_MODE(VTE_CURSOR_BLINK_SYSTEM) (VTE_CURSOR_BLINK_SYSTEM)
140#define DEFAULT_CURSOR_SHAPE(VTE_CURSOR_SHAPE_BLOCK) (VTE_CURSOR_SHAPE_BLOCK)
141#define DEFAULT_CUSTOM_COMMAND("") ("")
142#define DEFAULT_DEFAULT_SHOW_MENUBAR((!(0))) (TRUE(!(0)))
143#define DEFAULT_DEFAULT_SIZE_COLUMNS(80) (80)
144#define DEFAULT_DEFAULT_SIZE_ROWS(24) (24)
145#define DEFAULT_DELETE_BINDING(VTE_ERASE_DELETE_SEQUENCE) (VTE_ERASE_DELETE_SEQUENCE)
146#define DEFAULT_EXIT_ACTION(TERMINAL_EXIT_CLOSE) (TERMINAL_EXIT_CLOSE)
147#define DEFAULT_FONT("Monospace 12") ("Monospace 12")
148#define DEFAULT_FOREGROUND_COLOR("#000000") ("#000000")
149#define DEFAULT_LOGIN_SHELL((0)) (FALSE(0))
150#define DEFAULT_NAME(((void*)0)) (NULL((void*)0))
151#define DEFAULT_PALETTE(terminal_palettes[0]) (terminal_palettes[TERMINAL_PALETTE_TANGO0])
152#define DEFAULT_SCROLL_BACKGROUND((!(0))) (TRUE(!(0)))
153#define DEFAULT_SCROLLBACK_LINES(512) (512)
154#define DEFAULT_SCROLLBACK_UNLIMITED((0)) (FALSE(0))
155#define DEFAULT_SCROLLBAR_POSITION(TERMINAL_SCROLLBAR_RIGHT) (TERMINAL_SCROLLBAR_RIGHT)
156#define DEFAULT_SCROLL_ON_KEYSTROKE((!(0))) (TRUE(!(0)))
157#define DEFAULT_SCROLL_ON_OUTPUT((0)) (FALSE(0))
158#define DEFAULT_SILENT_BELL((0)) (FALSE(0))
159#define DEFAULT_COPY_SELECTION((0)) (FALSE(0))
160#define DEFAULT_TITLE_MODE(TERMINAL_TITLE_REPLACE) (TERMINAL_TITLE_REPLACE)
161#define DEFAULT_TITLE(("Terminal")) (N_("Terminal")("Terminal"))
162#define DEFAULT_USE_CUSTOM_COMMAND((0)) (FALSE(0))
163#define DEFAULT_USE_CUSTOM_DEFAULT_SIZE((0)) (FALSE(0))
164#define DEFAULT_USE_SKEY((!(0))) (TRUE(!(0)))
165#define DEFAULT_USE_URLS((!(0))) (TRUE(!(0)))
166#define DEFAULT_USE_SYSTEM_FONT((!(0))) (TRUE(!(0)))
167#define DEFAULT_USE_THEME_COLORS((!(0))) (TRUE(!(0)))
168#define DEFAULT_VISIBLE_NAME(("Unnamed")) (N_("Unnamed")("Unnamed"))
169#define DEFAULT_WORD_CHARS("-A-Za-z0-9,./?%&#:_=+@~") ("-A-Za-z0-9,./?%&#:_=+@~")
170
171struct _TerminalProfilePrivate
172{
173 GValueArray *properties;
174 gboolean *locked;
175
176 GSettings *settings;
177 char *profile_dir;
178
179 GSList *dirty_pspecs;
180 guint save_idle_id;
181
182 GParamSpec *gsettings_notification_pspec;
183
184 gboolean background_load_failed;
185
186 guint forgotten : 1;
187};
188
189static const GdkRGBA terminal_palettes[TERMINAL_PALETTE_N_BUILTINS5][TERMINAL_PALETTE_SIZE16] =
190{
191 /* Tango palette */
192 {
193 { 0, 0, 0, 1 },
194 { 0.8, 0, 0, 1 },
195 { 0.305882, 0.603922, 0.0235294, 1 },
196 { 0.768627, 0.627451, 0, 1 },
197 { 0.203922, 0.396078, 0.643137, 1 },
198 { 0.458824, 0.313725, 0.482353, 1 },
199 { 0.0235294, 0.596078, 0.603922, 1 },
200 { 0.827451, 0.843137, 0.811765, 1 },
201 { 0.333333, 0.341176, 0.32549, 1 },
202 { 0.937255, 0.160784, 0.160784, 1 },
203 { 0.541176, 0.886275, 0.203922, 1 },
204 { 0.988235, 0.913725, 0.309804, 1 },
205 { 0.447059, 0.623529, 0.811765, 1 },
206 { 0.678431, 0.498039, 0.658824, 1 },
207 { 0.203922, 0.886275, 0.886275, 1 },
208 { 0.933333, 0.933333, 0.92549, 1 },
209 },
210
211 /* Linux palette */
212 {
213 { 0, 0, 0, 1 },
214 { 0.666667, 0, 0, 1 },
215 { 0, 0.666667, 0, 1 },
216 { 0.666667, 0.333333, 0, 1 },
217 { 0, 0, 0.666667, 1 },
218 { 0.666667, 0, 0.666667, 1 },
219 { 0, 0.666667, 0.666667, 1 },
220 { 0.666667, 0.666667, 0.666667, 1 },
221 { 0.333333, 0.333333, 0.333333, 1 },
222 { 1, 0.333333, 0.333333, 1 },
223 { 0.333333, 1, 0.333333, 1 },
224 { 1, 1, 0.333333, 1 },
225 { 0.333333, 0.333333, 1, 1 },
226 { 1, 0.333333, 1, 1 },
227 { 0.333333, 1, 1, 1 },
228 { 1, 1, 1, 1 },
229 },
230
231 /* XTerm palette */
232 {
233 { 0, 0, 0, 1 },
234 { 0.803922, 0, 0, 1 },
235 { 0, 0.803922, 0, 1 },
236 { 0.803922, 0.803922, 0, 1 },
237 { 0.117647, 0.564706, 1, 1 },
238 { 0.803922, 0, 0.803922, 1 },
239 { 0, 0.803922, 0.803922, 1 },
240 { 0.898039, 0.898039, 0.898039, 1 },
241 { 0.298039, 0.298039, 0.298039, 1 },
242 { 1, 0, 0, 1 },
243 { 0, 1, 0, 1 },
244 { 1, 1, 0, 1 },
245 { 0.27451, 0.509804, 0.705882, 1 },
246 { 1, 0, 1, 1 },
247 { 0, 1, 1, 1 },
248 { 1, 1, 1, 1 },
249 },
250
251 /* RXVT palette */
252 {
253 { 0, 0, 0, 1 },
254 { 0.803922, 0, 0, 1 },
255 { 0, 0.803922, 0, 1 },
256 { 0.803922, 0.803922, 0, 1 },
257 { 0, 0, 0.803922, 1 },
258 { 0.803922, 0, 0.803922, 1 },
259 { 0, 0.803922, 0.803922, 1 },
260 { 0.980392, 0.921569, 0.843137, 1 },
261 { 0.25098, 0.25098, 0.25098, 1 },
262 { 1, 0, 0, 1 },
263 { 0, 1, 0, 1 },
264 { 1, 1, 0, 1 },
265 { 0, 0, 1, 1 },
266 { 1, 0, 1, 1 },
267 { 0, 1, 1, 1 },
268 { 1, 1, 1, 1 },
269 },
270
271 /* Solarized palette (1.0.0beta2): http://ethanschoonover.com/solarized */
272 {
273 { 0.02745, 0.211764, 0.258823, 1 },
274 { 0.862745, 0.196078, 0.184313, 1 },
275 { 0.521568, 0.6, 0, 1 },
276 { 0.709803, 0.537254, 0, 1 },
277 { 0.149019, 0.545098, 0.823529, 1 },
278 { 0.82745, 0.211764, 0.509803, 1 },
279 { 0.164705, 0.631372, 0.596078, 1 },
280 { 0.933333, 0.909803, 0.835294, 1 },
281 { 0, 0.168627, 0.211764, 1 },
282 { 0.796078, 0.294117, 0.086274, 1 },
283 { 0.345098, 0.431372, 0.458823, 1 },
284 { 0.396078, 0.482352, 0.513725, 1 },
285 { 0.513725, 0.580392, 0.588235, 1 },
286 { 0.423529, 0.443137, 0.768627, 1 },
287 { 0.57647, 0.631372, 0.631372, 1 },
288 { 0.992156, 0.964705, 0.890196, 1 },
289 },
290};
291
292enum
293{
294 FORGOTTEN,
295 LAST_SIGNAL
296};
297
298static void terminal_profile_finalize (GObject *object);
299static void terminal_profile_set_property (GObject *object,
300 guint prop_id,
301 const GValue *value,
302 GParamSpec *pspec);
303static void ensure_pixbuf_property (TerminalProfile *profile,
304 guint path_prop_id,
305 guint pixbuf_prop_id,
306 gboolean *load_failed);
307
308static guint signals[LAST_SIGNAL] = { 0 };
309static GQuark gsettings_key_quark;
310
311G_DEFINE_TYPE_WITH_PRIVATE (TerminalProfile, terminal_profile, G_TYPE_OBJECT)static void terminal_profile_init (TerminalProfile *self); static
void terminal_profile_class_init (TerminalProfileClass *klass
); static GType terminal_profile_get_type_once (void); static
gpointer terminal_profile_parent_class = ((void*)0); static gint
TerminalProfile_private_offset; static void terminal_profile_class_intern_init
(gpointer klass) { terminal_profile_parent_class = g_type_class_peek_parent
(klass); if (TerminalProfile_private_offset != 0) g_type_class_adjust_private_offset
(klass, &TerminalProfile_private_offset); terminal_profile_class_init
((TerminalProfileClass*) klass); } __attribute__ ((__unused__
)) static inline gpointer terminal_profile_get_instance_private
(TerminalProfile *self) { return (((gpointer) ((guint8*) (self
) + (glong) (TerminalProfile_private_offset)))); } GType terminal_profile_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ _Static_assert (sizeof *(&static_g_define_type_id) ==
sizeof (gpointer), "Expression evaluates to false"); (void) (
0 ? (gpointer) *(&static_g_define_type_id) : ((void*)0));
(!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = terminal_profile_get_type_once
(); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } __attribute__ ((__noinline__)) static GType terminal_profile_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
(((GType) ((20) << (2))), g_intern_static_string ("TerminalProfile"
), sizeof (TerminalProfileClass), (GClassInitFunc)(void (*)(void
)) terminal_profile_class_intern_init, sizeof (TerminalProfile
), (GInstanceInitFunc)(void (*)(void)) terminal_profile_init,
(GTypeFlags) 0); { {{ TerminalProfile_private_offset = g_type_add_instance_private
(g_define_type_id, sizeof (TerminalProfilePrivate)); };} } return
g_define_type_id; }
;
312
313/* gdk_rgba_equal is too strict! */
314static gboolean
315rgba_equal (const GdkRGBA *a,
316 const GdkRGBA *b)
317{
318 gdouble dr, dg, db, da;
319
320 dr = a->red - b->red;
321 dg = a->green - b->green;
322 db = a->blue - b->blue;
323 da = a->alpha - b->alpha;
324
325 return (dr * dr + dg * dg + db * db + da * da) < 1e-4;
326}
327
328static gboolean
329palette_cmp (const GdkRGBA *ca,
330 const GdkRGBA *cb)
331{
332 guint i;
333
334 for (i = 0; i < TERMINAL_PALETTE_SIZE16; ++i)
335 if (!rgba_equal (&ca[i], &cb[i]))
336 return FALSE(0);
337
338 return TRUE(!(0));
339}
340
341static GParamSpec *
342get_pspec_from_name (TerminalProfile *profile,
343 const char *prop_name)
344{
345 TerminalProfileClass *klass = TERMINAL_PROFILE_GET_CLASS (profile)((((TerminalProfileClass*) (((GTypeInstance*) ((profile)))->
g_class))))
;
346 GParamSpec *pspec;
347
348 pspec = g_object_class_find_property (G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
, prop_name);
349 if (pspec &&
350 pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
351 pspec = NULL((void*)0);
352
353 return pspec;
354}
355
356static const GValue *
357get_prop_value_from_prop_name (TerminalProfile *profile,
358 const char *prop_name)
359{
360 TerminalProfilePrivate *priv = profile->priv;
361 GParamSpec *pspec;
362
363 pspec = get_pspec_from_name (profile, prop_name);
364 if (!pspec)
365 return NULL((void*)0);
366
367 if (G_UNLIKELY (pspec->param_id == PROP_BACKGROUND_IMAGE)(pspec->param_id == PROP_BACKGROUND_IMAGE))
368 ensure_pixbuf_property (profile, PROP_BACKGROUND_IMAGE_FILE, PROP_BACKGROUND_IMAGE, &priv->background_load_failed);
369
370 return g_value_array_get_nth (priv->properties, pspec->param_id);
371}
372
373static void
374set_value_from_palette (GValue *ret_value,
375 const GdkRGBA *colors,
376 guint n_colors)
377{
378 GValueArray *array;
379 guint i, max_n_colors;
380
381 max_n_colors = MAX (n_colors, TERMINAL_PALETTE_SIZE)(((n_colors) > (16)) ? (n_colors) : (16));
382 array = g_value_array_new (max_n_colors);
383 for (i = 0; i < max_n_colors; ++i)
384 g_value_array_append (array, NULL((void*)0));
385
386 for (i = 0; i < n_colors; ++i)
387 {
388 GValue *value = g_value_array_get_nth (array, i);
389
390 g_value_init (value, GDK_TYPE_RGBA(gdk_rgba_get_type ()));
391 g_value_set_boxed (value, &colors[i]);
392 }
393
394 /* If we haven't enough colours yet, fill up with the default palette */
395 for (i = n_colors; i < TERMINAL_PALETTE_SIZE16; ++i)
396 {
397 GValue *value = g_value_array_get_nth (array, i);
398
399 g_value_init (value, GDK_TYPE_RGBA(gdk_rgba_get_type ()));
400 g_value_set_boxed (value, &DEFAULT_PALETTE(terminal_palettes[0])[i]);
401 }
402
403 g_value_take_boxed (ret_value, array);
404}
405
406static int
407values_equal (GParamSpec *pspec,
408 const GValue *va,
409 const GValue *vb)
410{
411 /* g_param_values_cmp isn't good enough for some types, since e.g.
412 * it compares colours and font descriptions by pointer value, not
413 * with the correct compare functions. Providing extra
414 * PangoParamSpecFontDescription and GdkParamSpecColor wouldn't
415 * have fixed this either, since it's unclear how to _order_ them.
416 * Luckily we only need to check them for equality here.
417 */
418
419 if (g_param_values_cmp (pspec, va, vb) == 0)
420 return TRUE(!(0));
421
422 if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
423 return rgba_equal (g_value_get_boxed (va), g_value_get_boxed (vb));
424
425 if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
426 return pango_font_description_equal (g_value_get_boxed (va), g_value_get_boxed (vb));
427
428 if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
429 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
430 {
431 GValueArray *ara, *arb;
432 guint i;
433
434 ara = g_value_get_boxed (va);
435 arb = g_value_get_boxed (vb);
436
437 if (!ara || !arb || ara->n_values != arb->n_values)
438 return FALSE(0);
439
440 for (i = 0; i < ara->n_values; ++i)
441 if (!rgba_equal (g_value_get_boxed (g_value_array_get_nth (ara, i)),
442 g_value_get_boxed (g_value_array_get_nth (arb, i))))
443 return FALSE(0);
444
445 return TRUE(!(0));
446 }
447
448 return FALSE(0);
449}
450
451static void
452ensure_pixbuf_property (TerminalProfile *profile,
453 guint path_prop_id,
454 guint pixbuf_prop_id,
455 gboolean *load_failed)
456{
457 TerminalProfilePrivate *priv = profile->priv;
458 GValue *path_value, *pixbuf_value;
459 GdkPixbuf *pixbuf;
460 const char *path_utf8;
461 char *path;
462 GError *error = NULL((void*)0);
463
464 pixbuf_value = g_value_array_get_nth (priv->properties, pixbuf_prop_id);
465
466 pixbuf = g_value_get_object (pixbuf_value);
467 if (pixbuf)
468 return;
469
470 if (*load_failed)
471 return;
472
473 path_value = g_value_array_get_nth (priv->properties, path_prop_id);
474 path_utf8 = g_value_get_string (path_value);
475 if (!path_utf8 || !path_utf8[0])
476 goto failed;
477
478 path = g_filename_from_utf8 (path_utf8, -1, NULL((void*)0), NULL((void*)0), NULL((void*)0));
479 if (!path)
480 goto failed;
481
482 pixbuf = gdk_pixbuf_new_from_file (path, &error);
483 if (!pixbuf)
484 {
485 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
486 "Failed to load image \"%s\": %s\n",do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
487 path, error->message)do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
;
488
489 g_error_free (error);
490 g_free (path);
491 goto failed;
492 }
493
494 g_value_take_object (pixbuf_value, pixbuf);
495 g_free (path);
496 return;
497
498failed:
499 *load_failed = TRUE(!(0));
500}
501
502static void
503terminal_profile_reset_property_internal (TerminalProfile *profile,
504 GParamSpec *pspec,
505 gboolean notify)
506{
507 TerminalProfilePrivate *priv = profile->priv;
508 GValue value_ = { 0, };
509 GValue *value;
510
511 if (notify)
512 {
513 value = &value_;
514 g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
515 }
516 else
517 value = g_value_array_get_nth (priv->properties, pspec->param_id);
518 g_assert (value != NULL)do { if (value != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 518, ((const char*) (__func__
)), "value != NULL"); } while (0)
;
519
520 /* A few properties don't have defaults via the param spec; set them explicitly */
521 switch (pspec->param_id)
522 {
523 case PROP_FOREGROUND_COLOR:
524 case PROP_BOLD_COLOR:
525 {
526 GdkRGBA color;
527
528 if (!gdk_rgba_parse (&color, DEFAULT_FOREGROUND_COLOR("#000000")))
529 return;
530 color.alpha = 1.0;
531 g_value_set_boxed (value, &color);
532 break;
533 }
534 case PROP_BACKGROUND_COLOR:
535 {
536 GdkRGBA color;
537
538 if (!gdk_rgba_parse (&color, DEFAULT_BACKGROUND_COLOR("#FFFFDD")))
539 return;
540 color.alpha = 1.0;
541 g_value_set_boxed (value, &color);
542 break;
543 }
544 case PROP_FONT:
545 g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_FONT("Monospace 12")));
546 break;
547
548 case PROP_PALETTE:
549 set_value_from_palette (value, DEFAULT_PALETTE(terminal_palettes[0]), TERMINAL_PALETTE_SIZE16);
550 break;
551
552 default:
553 g_param_value_set_default (pspec, value);
554 break;
555 }
556
557 if (notify)
558 {
559 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, pspec->name, value);
560 g_value_unset (value);
561 }
562}
563
564static void
565terminal_profile_gsettings_notify_cb (GSettings *settings,
566 gchar *key,
567 gpointer user_data)
568{
569 TerminalProfile *profile = TERMINAL_PROFILE (user_data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_profile_get_type ()))))))
;
570 TerminalProfilePrivate *priv = profile->priv;
571 TerminalProfileClass *klass;
572 GVariant *settings_value;
573 GParamSpec *pspec;
574 GValue value = { 0, };
575 gboolean equal;
576 gboolean force_set = FALSE(0);
577
578 if (!key) return;
579
580 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
581 "GSettings notification for key %s [%s]\n",do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
582 key,do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
583 g_settings_is_writable (settings, key) ? "writable" : "LOCKED")do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
;
584
585 klass = TERMINAL_PROFILE_GET_CLASS (profile)((((TerminalProfileClass*) (((GTypeInstance*) ((profile)))->
g_class))))
;
586 pspec = g_hash_table_lookup (klass->gsettings_keys, key);
587 if (!pspec)
588 return; /* ignore unknown keys, for future extensibility */
589
590 priv->locked[pspec->param_id] = !g_settings_is_writable (settings, key);
591
592 settings_value = g_settings_get_value (settings, key);
593 if (!settings_value)
594 return;
595
596 g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
597
598 if (G_IS_PARAM_SPEC_BOOLEAN (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[2])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
599 {
600 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_BOOLEAN((const GVariantType *) "b")))
601 goto out;
602
603 g_value_set_boolean (&value, g_variant_get_boolean (settings_value));
604 }
605 else if (G_IS_PARAM_SPEC_STRING (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[14])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
606 {
607 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
608 goto out;
609
610 g_value_set_string (&value, g_variant_get_string (settings_value, NULL((void*)0)));
611 }
612 else if (G_IS_PARAM_SPEC_ENUM (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[10])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
613 {
614
615 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
616 goto out;
617
618 g_value_set_enum (&value, g_settings_get_enum (settings, key));
619 }
620 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
621 {
622 GdkRGBA color;
623
624 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
625 goto out;
626
627 if (!gdk_rgba_parse (&color, g_variant_get_string (settings_value, NULL((void*)0))))
628 goto out;
629
630 g_value_set_boxed (&value, &color);
631 }
632 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
633 {
634 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
635 goto out;
636
637 g_value_take_boxed (&value, pango_font_description_from_string (g_variant_get_string (settings_value, NULL((void*)0))));
638 }
639 else if (G_IS_PARAM_SPEC_DOUBLE (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[13])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
640 {
641 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_DOUBLE((const GVariantType *) "d")))
642 goto out;
643
644 g_value_set_double (&value, g_variant_get_double (settings_value));
645 }
646 else if (G_IS_PARAM_SPEC_INT (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[3])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
647 {
648 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT16((const GVariantType *) "n")) &&
649 !g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT32((const GVariantType *) "i")) &&
650 !g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT64((const GVariantType *) "x")))
651 goto out;
652
653 g_value_set_int (&value, g_settings_get_int(settings, key));
654 }
655 else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
656 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
657 {
658 char **color_strings;
659 GdkRGBA *colors;
660 int n_colors, i;
661
662 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
663 goto out;
664
665 color_strings = g_strsplit (g_variant_get_string (settings_value, NULL((void*)0)), ":", -1);
666 if (!color_strings)
667 goto out;
668
669 n_colors = g_strv_length (color_strings);
670 colors = g_new0 (GdkRGBA, n_colors)((GdkRGBA *) g_malloc0_n ((n_colors), sizeof (GdkRGBA)));
671 for (i = 0; i < n_colors; ++i)
672 {
673 if (!gdk_rgba_parse (&colors[i], color_strings[i]))
674 continue; /* ignore errors */
675 }
676 g_strfreev (color_strings);
677
678 /* We continue even with a palette size != TERMINAL_PALETTE_SIZE,
679 * so we can change the palette size in future versions without
680 * causing too many issues.
681 */
682 set_value_from_palette (&value, colors, n_colors);
683 g_free (colors);
684 }
685 else
686 {
687 g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
), pspec->name);
688 goto out;
689 }
690
691 if (g_param_value_validate (pspec, &value))
692 {
693 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
694 "Invalid value in GSettings for key %s was changed to comply with pspec %s\n",do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
695 key, pspec->name)do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
;
696
697 force_set = TRUE(!(0));
698 }
699
700 /* Only set the property if the value is different than our current value,
701 * so we don't go into an infinite loop.
702 */
703 equal = values_equal (pspec, &value, g_value_array_get_nth (priv->properties, pspec->param_id));
704#ifdef MATE_ENABLE_DEBUG
705 _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_PROFILE)if (0)
706 {
707 if (!equal)
708 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("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)); } while (0)
709 "Setting property %s to a different value\n"do { if (0) g_printerr("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)); } while (0)
710 " now: %s\n"do { if (0) g_printerr("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)); } while (0)
711 " new: %s\n",do { if (0) g_printerr("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)); } while (0)
712 pspec->name,do { if (0) g_printerr("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)); } while (0)
713 g_strdup_value_contents (g_value_array_get_nth (priv->properties, pspec->param_id)),do { if (0) g_printerr("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)); } while (0)
714 g_strdup_value_contents (&value))do { if (0) g_printerr("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)); } while (0)
;
715 }
716#endif
717
718 if (!equal || force_set)
719 {
720 priv->gsettings_notification_pspec = pspec;
721 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, pspec->name, &value);
722 priv->gsettings_notification_pspec = NULL((void*)0);
723 }
724
725out:
726 /* FIXME: if we arrive here through goto in the error cases,
727 * should we maybe reset the property to its default value?
728 */
729
730 g_value_unset (&value);
731 g_variant_unref (settings_value);
732}
733
734static void
735terminal_profile_gsettings_changeset_add (TerminalProfile *profile,
736 GSettings *changeset,
737 GParamSpec *pspec)
738{
739 TerminalProfilePrivate *priv = profile->priv;
740 char *key;
741 const GValue *value;
742
743 /* FIXME: do this? */
744#if 0
745 if (priv->locked[pspec->param_id])
746 return;
747
748 if (!g_settings_is_writable (priv->settings, gsettings_key, NULL((void*)0)))
749 return;
750#endif
751
752 key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
753 if (!key)
754 return;
755
756 value = g_value_array_get_nth (priv->properties, pspec->param_id);
757
758 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
759 "Adding pspec %s with value %s to the GSettings changeset\n",do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
760 pspec->name, g_strdup_value_contents (value))do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
;
761
762 if (G_IS_PARAM_SPEC_BOOLEAN (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[2])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
763 g_settings_set_boolean (changeset, key, g_value_get_boolean (value));
764 else if (G_IS_PARAM_SPEC_STRING (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[14])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
765 {
766 const char *str;
767
768 str = g_value_get_string (value);
769 g_settings_set_string (changeset, key, str ? str : "");
770 }
771 else if (G_IS_PARAM_SPEC_ENUM (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[10])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
772 {
773 const GEnumValue *eval;
774
775 eval = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)((((GParamSpecEnum*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), ((g_param_spec_types[10]))))))
->enum_class, g_value_get_enum (value));
776
777 g_settings_set_enum (changeset, key, eval->value);
778 }
779 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
780 {
781 GdkRGBA *color;
782 char str[16];
783
784 color = g_value_get_boxed (value);
785 if (!color)
786 goto cleanup;
787
788 g_snprintf (str, sizeof (str),
789 "#%04X%04X%04X",
790 (guint) (color->red * 65535),
791 (guint) (color->green * 65535),
792 (guint) (color->blue * 65535));
793
794 g_settings_set_string (changeset, key, str);
795 }
796 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
797 {
798 PangoFontDescription *font_desc;
799 char *font;
800
801 font_desc = g_value_get_boxed (value);
802 if (!font_desc)
803 goto cleanup;
804
805 font = pango_font_description_to_string (font_desc);
806 g_settings_set_string (changeset, key, font);
807 g_free (font);
808 }
809 else if (G_IS_PARAM_SPEC_DOUBLE (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[13])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
810 g_settings_set_double (changeset, key, g_value_get_double (value));
811 else if (G_IS_PARAM_SPEC_INT (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[3])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
812 g_settings_set_int (changeset, key, g_value_get_int (value));
813 else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
814 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
815 {
816 GValueArray *array;
817 GString *string;
818 guint n_colors, i;
819
820 /* We need to do this ourselves, because the gtk_color_selection_palette_to_string
821 * does not carry all the bytes, and xterm's palette is messed up...
822 */
823
824 array = g_value_get_boxed (value);
825 if (!array)
826 goto cleanup;
827
828 n_colors = array->n_values;
829 string = g_string_sized_new (n_colors * (1 /* # */ + 3 * 4) + n_colors /* : separators and terminating \0 */);
830 for (i = 0; i < n_colors; ++i)
831 {
832 GdkRGBA *color;
833
834 if (i > 0)
835 g_string_append_c (string, ':')g_string_append_c_inline (string, ':');
836
837 color = g_value_get_boxed (g_value_array_get_nth (array, i));
838 if (!color)
839 continue;
840
841 g_string_append_printf (string,
842 "#%04X%04X%04X",
843 (guint) (color->red * 65535),
844 (guint) (color->green * 65535),
845 (guint) (color->blue * 65535));
846 }
847
848 g_settings_set_string (changeset, key, string->str);
849 g_string_free (string, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) (
(string), ((!(0)))) : g_string_free_and_steal (string)) : (g_string_free
) ((string), ((!(0)))))
;
850 }
851 else
852 g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
), pspec->name);
853
854cleanup:
855 return;
856}
857
858static void
859terminal_profile_save (TerminalProfile *profile)
860{
861 TerminalProfilePrivate *priv = profile->priv;
862 GSettings *changeset;
863 GSList *l;
864 gchar *concat;
865
866 priv->save_idle_id = 0;
867 concat = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", priv->profile_dir,"/", NULL((void*)0));
868 changeset = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
869 g_free (concat);
870 g_settings_delay (changeset);
871
872 for (l = priv->dirty_pspecs; l != NULL((void*)0); l = l->next)
873 {
874 GParamSpec *pspec = (GParamSpec *) l->data;
875
876 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
877 continue;
878
879 if ((pspec->flags & G_PARAM_WRITABLE) == 0)
880 continue;
881
882 terminal_profile_gsettings_changeset_add (profile, changeset, pspec);
883 }
884
885 g_slist_free (priv->dirty_pspecs);
886 priv->dirty_pspecs = NULL((void*)0);
887
888 g_settings_apply (changeset);
889 g_object_unref (changeset);
890}
891
892static gboolean
893terminal_profile_save_idle_cb (TerminalProfile *profile)
894{
895 terminal_profile_save (profile);
896
897 /* don't run again */
898 return FALSE(0);
899}
900
901static void
902terminal_profile_schedule_save (TerminalProfile *profile,
903 GParamSpec *pspec)
904{
905 TerminalProfilePrivate *priv = profile->priv;
906
907 g_assert (pspec != NULL)do { if (pspec != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 907, ((const char*) (__func__
)), "pspec != NULL"); } while (0)
;
908
909 if (!g_slist_find (priv->dirty_pspecs, pspec))
910 priv->dirty_pspecs = g_slist_prepend (priv->dirty_pspecs, pspec);
911
912 if (priv->save_idle_id != 0)
913 return;
914
915 priv->save_idle_id = g_idle_add ((GSourceFunc) terminal_profile_save_idle_cb, profile);
916}
917
918static void
919terminal_profile_init (TerminalProfile *profile)
920{
921 TerminalProfilePrivate *priv;
922 GObjectClass *object_class;
923 GParamSpec **pspecs;
924 guint n_pspecs, i;
925
926 priv = profile->priv = terminal_profile_get_instance_private (profile);
927
928 priv->gsettings_notification_pspec = NULL((void*)0);
929 priv->locked = g_new0 (gboolean, LAST_PROP)((gboolean *) g_malloc0_n ((LAST_PROP), sizeof (gboolean)));
930
931 priv->properties = g_value_array_new (LAST_PROP);
932 for (i = 0; i < LAST_PROP; ++i)
933 g_value_array_append (priv->properties, NULL((void*)0));
934
935 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
936 for (i = 0; i < n_pspecs; ++i)
937 {
938 GParamSpec *pspec = pspecs[i];
939 GValue *value;
940
941 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
942 continue;
943
944 g_assert (pspec->param_id < LAST_PROP)do { if (pspec->param_id < LAST_PROP) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 944, ((const char*) (__func__
)), "pspec->param_id < LAST_PROP"); } while (0)
;
945 value = g_value_array_get_nth (priv->properties, pspec->param_id);
946 g_value_init (value, pspec->value_type);
947 g_param_value_set_default (pspec, value);
948 }
949
950 g_free (pspecs);
951
952 /* A few properties don't have defaults via the param spec; set them explicitly */
953 object_class = G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
;
954 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_FOREGROUND_COLOR"foreground-color"), FALSE(0));
955 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_BOLD_COLOR"bold-color"), FALSE(0));
956 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_BACKGROUND_COLOR"background-color"), FALSE(0));
957 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_FONT"font"), FALSE(0));
958 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_PALETTE"palette"), FALSE(0));
959}
960
961static GObject *
962terminal_profile_constructor (GType type,
963 guint n_construct_properties,
964 GObjectConstructParam *construct_params)
965{
966 GObject *object;
967 TerminalProfile *profile;
968 TerminalProfilePrivate *priv;
969 const char *name;
970 GParamSpec **pspecs;
971 guint n_pspecs, i;
972 gchar *concat;
973
974 object = G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->constructor
975 (type, n_construct_properties, construct_params);
976
977 profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
978 priv = profile->priv;
979
980 name = g_value_get_string (g_value_array_get_nth (priv->properties, PROP_NAME));
981 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-profile.c", 981, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
982
983 concat = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", name, "/", NULL((void*)0));
984 priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
985 g_assert (priv->settings != NULL)do { if (priv->settings != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 985, ((const char*) (__func__
)), "priv->settings != NULL"); } while (0)
;
986 g_free (concat);
987 concat = g_strconcat("changed::", priv->profile_dir, "/", NULL((void*)0));
988 g_signal_connect (priv->settings,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
989 concat,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
990 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
991 profile)g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
;
992
993 g_free (concat);
994
995 /* Now load those properties from GSettings that were not set as construction params */
996 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
997 for (i = 0; i < n_pspecs; ++i)
998 {
999 GParamSpec *pspec = pspecs[i];
1000 guint j;
1001 gboolean is_construct = FALSE(0);
1002 char *key;
1003
1004 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
1005 continue;
1006
1007 if ((pspec->flags & G_PARAM_WRITABLE) == 0 ||
1008 (pspec->flags & G_PARAM_CONSTRUCT_ONLY) != 0)
1009 continue;
1010
1011 for (j = 0; j < n_construct_properties; ++j)
1012 if (pspec == construct_params[j].pspec)
1013 {
1014 is_construct = TRUE(!(0));
1015 break;
1016 }
1017
1018 if (is_construct)
1019 continue;
1020
1021 key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
1022 if (!key)
1023 continue;
1024
1025 terminal_profile_gsettings_notify_cb (priv->settings, key, profile);
1026 }
1027
1028 g_free (pspecs);
1029
1030 return object;
1031}
1032
1033static void
1034terminal_profile_finalize (GObject *object)
1035{
1036 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1037 TerminalProfilePrivate *priv = profile->priv;
1038
1039 g_signal_handlers_disconnect_by_func (priv->settings,g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1040 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1041 profile)g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
;
1042
1043 if (priv->save_idle_id)
1044 {
1045 g_source_remove (priv->save_idle_id);
1046
1047 /* Save now */
1048 terminal_profile_save (profile);
1049 }
1050
1051 _terminal_profile_forget (profile);
1052
1053 g_object_unref (priv->settings);
1054
1055 g_free (priv->profile_dir);
1056 g_free (priv->locked);
1057 g_value_array_free (priv->properties);
1058
1059 G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->finalize (object);
1060}
1061
1062static void
1063terminal_profile_get_property (GObject *object,
1064 guint prop_id,
1065 GValue *value,
1066 GParamSpec *pspec)
1067{
1068 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1069 TerminalProfilePrivate *priv = profile->priv;
1070
1071 if (prop_id == 0 || prop_id >= LAST_PROP)
1072 {
1073 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-profile.c", 1073, ("property"), _glib__property_id
, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance
*) (_glib__pspec))->g_class))->g_type)))), (g_type_name
((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1074 return;
1075 }
1076
1077 /* Note: When adding things here, do the same in get_prop_value_from_prop_name! */
1078 switch (prop_id)
1079 {
1080 case PROP_BACKGROUND_IMAGE:
1081 ensure_pixbuf_property (profile, PROP_BACKGROUND_IMAGE_FILE, PROP_BACKGROUND_IMAGE, &priv->background_load_failed);
1082 break;
1083 default:
1084 break;
1085 }
1086
1087 g_value_copy (g_value_array_get_nth (priv->properties, prop_id), value);
1088}
1089
1090static void
1091terminal_profile_set_property (GObject *object,
1092 guint prop_id,
1093 const GValue *value,
1094 GParamSpec *pspec)
1095{
1096 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1097 TerminalProfilePrivate *priv = profile->priv;
1098 GValue *prop_value;
1099
1100 if (prop_id == 0 || prop_id >= LAST_PROP)
1101 {
1102 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-profile.c", 1102, ("property"), _glib__property_id
, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance
*) (_glib__pspec))->g_class))->g_type)))), (g_type_name
((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1103 return;
1104 }
1105
1106 prop_value = g_value_array_get_nth (priv->properties, prop_id);
1107
1108 /* Preprocessing */
1109 switch (prop_id)
1110 {
1111#if 0
1112 case PROP_FONT:
1113 {
1114 PangoFontDescription *font_desc, *new_font_desc;
1115
1116 font_desc = g_value_get_boxed (prop_value);
1117 new_font_desc = g_value_get_boxed (value);
1118
1119 if (font_desc && new_font_desc)
1120 {
1121 /* Merge in case the new string isn't complete enough to load a font */
1122 pango_font_description_merge (font_desc, new_font_desc, TRUE(!(0)));
1123 pango_font_description_free (new_font_desc);
1124 break;
1125 }
1126
1127 /* fall-through */
1128 }
1129#endif
1130 default:
1131 g_value_copy (value, prop_value);
1132 break;
1133 }
1134
1135 /* Postprocessing */
1136 switch (prop_id)
1137 {
1138 case PROP_NAME:
1139 {
1140 const char *name = g_value_get_string (value);
1141
1142 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-profile.c", 1142, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
1143 priv->profile_dir = g_strdup (name)g_strdup_inline (name);
1144 if (priv->settings != NULL((void*)0)) {
1145 gchar *concat;
1146 g_signal_handlers_disconnect_by_func (priv->settings,g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1147 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1148 profile)g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
;
1149 g_object_unref (priv->settings);
1150 concat= g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", priv->profile_dir, "/", NULL((void*)0));
1151 priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
1152 g_free (concat);
1153 concat = g_strconcat("changed::", priv->profile_dir, "/", NULL((void*)0));
1154 g_signal_connect (priv->settings,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1155 concat,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1156 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1157 profile)g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
;
1158 g_free (concat);
1159 }
1160 break;
1161 }
1162
1163 case PROP_BACKGROUND_IMAGE_FILE:
1164 /* Clear the cached image */
1165 g_value_set_object (g_value_array_get_nth (priv->properties, PROP_BACKGROUND_IMAGE), NULL((void*)0));
1166 priv->background_load_failed = FALSE(0);
1167 g_object_notify (object, TERMINAL_PROFILE_BACKGROUND_IMAGE"background-image");
1168 break;
1169
1170 default:
1171 break;
1172 }
1173}
1174
1175static void
1176terminal_profile_notify (GObject *object,
1177 GParamSpec *pspec)
1178{
1179 TerminalProfilePrivate *priv = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
->priv;
1180 void (* notify) (GObject *, GParamSpec *) = G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->notify;
1181
1182 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
1183 "Property notification for prop %s\n",do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
1184 pspec->name)do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
;
1185
1186 if (notify)
1187 notify (object, pspec);
1188
1189 if (pspec->owner_type == TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) &&
1190 (pspec->flags & G_PARAM_WRITABLE) &&
1191 g_param_spec_get_qdata (pspec, gsettings_key_quark) != NULL((void*)0) &&
1192 pspec != priv->gsettings_notification_pspec)
1193 terminal_profile_schedule_save (TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
, pspec);
1194}
1195
1196static void
1197terminal_profile_class_init (TerminalProfileClass *klass)
1198{
1199 GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
;
1200
1201 gsettings_key_quark = g_quark_from_static_string ("GT::GSettingsKey");
1202
1203 object_class->constructor = terminal_profile_constructor;
1204 object_class->finalize = terminal_profile_finalize;
1205 object_class->get_property = terminal_profile_get_property;
1206 object_class->set_property = terminal_profile_set_property;
1207 object_class->notify = terminal_profile_notify;
1208
1209 signals[FORGOTTEN] =
1210 g_signal_new ("forgotten",
1211 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1212 G_SIGNAL_RUN_LAST,
1213 G_STRUCT_OFFSET (TerminalProfileClass, forgotten)((glong) __builtin_offsetof(TerminalProfileClass, forgotten)),
1214 NULL((void*)0), NULL((void*)0),
1215 g_cclosure_marshal_VOID__VOID,
1216 G_TYPE_NONE((GType) ((1) << (2))), 0);
1217
1218 /* gsettings_key -> pspec hash */
1219 klass->gsettings_keys = g_hash_table_new (g_str_hash, g_str_equal);
1220
1221#define TERMINAL_PROFILE_PSPEC_STATIC(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
1222
1223#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);
}
\
1224{\
1225 GParamSpec *pspec = propSpec;\
1226 g_object_class_install_property (object_class, propId, pspec);\
1227 g_param_spec_set_qdata (pspec, gsettings_key_quark, (gpointer) propGSettings);\
1228 g_hash_table_insert (klass->gsettings_keys, (gpointer) propGSettings, pspec);\
1229}
1230
1231#define TERMINAL_PROFILE_PROPERTY_OUTER(propId, propSpec){ GParamSpec *pspec = propSpec; g_object_class_install_property
(object_class, propId, pspec);}
\
1232{\
1233 GParamSpec *pspec = propSpec;\
1234 g_object_class_install_property (object_class, propId, pspec);\
1235}
1236
1237#define TERMINAL_PROFILE_PROPERTY_BOOLEAN(prop, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1238 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1239 g_param_spec_boolean (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1240 propDefault,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1241 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1242 propGSettings){ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1243
1244#define TERMINAL_PROFILE_PROPERTY_BOXED(prop, propType, propGSettings){ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1245 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1246 g_param_spec_boxed (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1247 propType,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1248 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1249 propGSettings){ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1250
1251#define TERMINAL_PROFILE_PROPERTY_DOUBLE(prop, propMin, propMax, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1252 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1253 g_param_spec_double (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1254 propMin, propMax, propDefault,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1255 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1256 propGSettings){ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1257
1258#define TERMINAL_PROFILE_PROPERTY_ENUM(prop, propType, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1259 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1260 g_param_spec_enum (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1261 propType, propDefault,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1262 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1263 propGSettings){ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1264
1265#define TERMINAL_PROFILE_PROPERTY_INT(prop, propMin, propMax, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1266 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1267 g_param_spec_int (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1268 propMin, propMax, propDefault,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1269 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1270 propGSettings){ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1271
1272 /* these are all read-only */
1273#define TERMINAL_PROFILE_PROPERTY_OBJECT(prop, propType){ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec);}
\
1274 TERMINAL_PROFILE_PROPERTY_OUTER (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1275 g_param_spec_object (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1276 propType,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1277 G_PARAM_READABLE | TERMINAL_PROFILE_PSPEC_STATIC)){ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1278
1279#define TERMINAL_PROFILE_PROPERTY_STRING(prop, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1280 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1281 g_param_spec_string (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1282 propDefault,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1283 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1284 propGSettings){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1285
1286#define TERMINAL_PROFILE_PROPERTY_STRING_CO(prop, propDefault){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec);}
\
1287 TERMINAL_PROFILE_PROPERTY_OUTER (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1288 g_param_spec_string (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1289 propDefault,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1290 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | TERMINAL_PROFILE_PSPEC_STATIC)){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1291
1292#define TERMINAL_PROFILE_PROPERTY_VALUE_ARRAY_BOXED(prop, propElementName, propElementType, propGSettings){ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1293 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1294 g_param_spec_value_array (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1295 g_param_spec_boxed (propElementName, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1296 propElementType, \{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1297 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1298 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1299 propGSettings){ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1300
1301 TERMINAL_PROFILE_PROPERTY_BOOLEAN (ALLOW_BOLD, DEFAULT_ALLOW_BOLD, KEY_ALLOW_BOLD){ GParamSpec *pspec = g_param_spec_boolean ("allow-bold", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_ALLOW_BOLD, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "allow-bold"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "allow-bold", pspec);}
;
1302 TERMINAL_PROFILE_PROPERTY_BOOLEAN (BOLD_COLOR_SAME_AS_FG, DEFAULT_BOLD_COLOR_SAME_AS_FG, KEY_BOLD_COLOR_SAME_AS_FG){ GParamSpec *pspec = g_param_spec_boolean ("bold-color-same-as-fg"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BOLD_COLOR_SAME_AS_FG, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "bold-color-same-as-fg"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "bold-color-same-as-fg"
, pspec);}
;
1303 TERMINAL_PROFILE_PROPERTY_BOOLEAN (DEFAULT_SHOW_MENUBAR, DEFAULT_DEFAULT_SHOW_MENUBAR, KEY_DEFAULT_SHOW_MENUBAR){ GParamSpec *pspec = g_param_spec_boolean ("default-show-menubar"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_DEFAULT_SHOW_MENUBAR, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "default-show-menubar"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "default-show-menubar"
, pspec);}
;
1304 TERMINAL_PROFILE_PROPERTY_BOOLEAN (LOGIN_SHELL, DEFAULT_LOGIN_SHELL, KEY_LOGIN_SHELL){ GParamSpec *pspec = g_param_spec_boolean ("login-shell", ((
void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_LOGIN_SHELL, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "login-shell"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "login-shell", pspec);
}
;
1305 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_BACKGROUND, DEFAULT_SCROLL_BACKGROUND, KEY_SCROLL_BACKGROUND){ GParamSpec *pspec = g_param_spec_boolean ("scroll-background"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_BACKGROUND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-background")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-background"
, pspec);}
;
1306 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLLBACK_UNLIMITED, DEFAULT_SCROLLBACK_UNLIMITED, KEY_SCROLLBACK_UNLIMITED){ GParamSpec *pspec = g_param_spec_boolean ("scrollback-unlimited"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLLBACK_UNLIMITED, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scrollback-unlimited"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scrollback-unlimited"
, pspec);}
;
1307 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_KEYSTROKE, DEFAULT_SCROLL_ON_KEYSTROKE, KEY_SCROLL_ON_KEYSTROKE){ GParamSpec *pspec = g_param_spec_boolean ("scroll-on-keystroke"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_ON_KEYSTROKE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-on-keystroke"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-on-keystroke"
, pspec);}
;
1308 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_OUTPUT, DEFAULT_SCROLL_ON_OUTPUT, KEY_SCROLL_ON_OUTPUT){ GParamSpec *pspec = g_param_spec_boolean ("scroll-on-output"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_ON_OUTPUT, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-on-output");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-on-output"
, pspec);}
;
1309 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SILENT_BELL, DEFAULT_SILENT_BELL, KEY_SILENT_BELL){ GParamSpec *pspec = g_param_spec_boolean ("silent-bell", ((
void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SILENT_BELL, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "silent-bell"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "silent-bell", pspec);
}
;
1310 TERMINAL_PROFILE_PROPERTY_BOOLEAN (COPY_SELECTION, DEFAULT_COPY_SELECTION, KEY_COPY_SELECTION){ GParamSpec *pspec = g_param_spec_boolean ("copy-selection",
((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_COPY_SELECTION, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "copy-selection"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "copy-selection", pspec
);}
;
1311 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_COMMAND, DEFAULT_USE_CUSTOM_COMMAND, KEY_USE_CUSTOM_COMMAND){ GParamSpec *pspec = g_param_spec_boolean ("use-custom-command"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_CUSTOM_COMMAND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-custom-command"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-custom-command"
, pspec);}
;
1312 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_DEFAULT_SIZE, DEFAULT_USE_CUSTOM_DEFAULT_SIZE, KEY_USE_CUSTOM_DEFAULT_SIZE){ GParamSpec *pspec = g_param_spec_boolean ("use-custom-default-size"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_CUSTOM_DEFAULT_SIZE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-custom-default-size"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-custom-default-size"
, pspec);}
;
1313 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SKEY, DEFAULT_USE_SKEY, KEY_USE_SKEY){ GParamSpec *pspec = g_param_spec_boolean ("use-skey", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_SKEY, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-skey"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-skey", pspec);}
;
1314 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_URLS, DEFAULT_USE_URLS, KEY_USE_URLS){ GParamSpec *pspec = g_param_spec_boolean ("use-urls", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_URLS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-urls"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-urls", pspec);}
;
1315 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SYSTEM_FONT, DEFAULT_USE_SYSTEM_FONT, KEY_USE_SYSTEM_FONT){ GParamSpec *pspec = g_param_spec_boolean ("use-system-font"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_SYSTEM_FONT, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-system-font"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-system-font", pspec
);}
;
1316 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_THEME_COLORS, DEFAULT_USE_THEME_COLORS, KEY_USE_THEME_COLORS){ GParamSpec *pspec = g_param_spec_boolean ("use-theme-colors"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_THEME_COLORS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-theme-colors");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-theme-colors"
, pspec);}
;
1317
1318 TERMINAL_PROFILE_PROPERTY_BOXED (BACKGROUND_COLOR, GDK_TYPE_RGBA, KEY_BACKGROUND_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("background-color",
((void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "background-color"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "background-color", pspec);}
;
1319 TERMINAL_PROFILE_PROPERTY_BOXED (BOLD_COLOR, GDK_TYPE_RGBA, KEY_BOLD_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("bold-color", ((void
*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BOLD_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "bold-color"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "bold-color", pspec);}
;
1320 TERMINAL_PROFILE_PROPERTY_BOXED (FONT, PANGO_TYPE_FONT_DESCRIPTION, KEY_FONT){ GParamSpec *pspec = g_param_spec_boxed ("font", ((void*)0),
((void*)0), (pango_font_description_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_FONT,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) "font"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "font", pspec);}
;
1321 TERMINAL_PROFILE_PROPERTY_BOXED (FOREGROUND_COLOR, GDK_TYPE_RGBA, KEY_FOREGROUND_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("foreground-color",
((void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_FOREGROUND_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "foreground-color"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "foreground-color", pspec);}
;
1322
1323 /* 0.0 = normal bg, 1.0 = all black bg, 0.5 = half darkened */
1324 TERMINAL_PROFILE_PROPERTY_DOUBLE (BACKGROUND_DARKNESS, 0.0, 1.0, DEFAULT_BACKGROUND_DARKNESS, KEY_BACKGROUND_DARKNESS){ GParamSpec *pspec = g_param_spec_double ("background-darkness"
, ((void*)0), ((void*)0), 0.0, 1.0, (0.5), G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_DARKNESS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "background-darkness"); g_hash_table_insert (klass
->gsettings_keys, (gpointer) "background-darkness", pspec)
;}
;
1325
1326 TERMINAL_PROFILE_PROPERTY_ENUM (BACKGROUND_TYPE, TERMINAL_TYPE_BACKGROUND_TYPE, DEFAULT_BACKGROUND_TYPE, KEY_BACKGROUND_TYPE){ GParamSpec *pspec = g_param_spec_enum ("background-type", (
(void*)0), ((void*)0), (terminal_background_type_get_type ())
, (TERMINAL_BACKGROUND_SOLID), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BACKGROUND_TYPE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "background-type"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "background-type", pspec
);}
;
1327 TERMINAL_PROFILE_PROPERTY_ENUM (BACKSPACE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_BACKSPACE_BINDING, KEY_BACKSPACE_BINDING){ GParamSpec *pspec = g_param_spec_enum ("backspace-binding",
((void*)0), ((void*)0), (vte_erase_binding_get_type ()), (VTE_ERASE_ASCII_DELETE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_BACKSPACE_BINDING, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) "backspace-binding"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "backspace-binding", pspec
);}
;
1328 TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_BLINK_MODE, VTE_TYPE_CURSOR_BLINK_MODE, DEFAULT_CURSOR_BLINK_MODE, KEY_CURSOR_BLINK_MODE){ GParamSpec *pspec = g_param_spec_enum ("cursor-blink-mode",
((void*)0), ((void*)0), (vte_cursor_blink_mode_get_type ()),
(VTE_CURSOR_BLINK_SYSTEM), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_CURSOR_BLINK_MODE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "cursor-blink-mode")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "cursor-blink-mode"
, pspec);}
;
1329 TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_SHAPE, VTE_TYPE_CURSOR_SHAPE, DEFAULT_CURSOR_SHAPE, KEY_CURSOR_SHAPE){ GParamSpec *pspec = g_param_spec_enum ("cursor-shape", ((void
*)0), ((void*)0), (vte_cursor_shape_get_type ()), (VTE_CURSOR_SHAPE_BLOCK
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_CURSOR_SHAPE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "cursor-shape"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "cursor-shape", pspec);}
;
1330 TERMINAL_PROFILE_PROPERTY_ENUM (DELETE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_DELETE_BINDING, KEY_DELETE_BINDING){ GParamSpec *pspec = g_param_spec_enum ("delete-binding", ((
void*)0), ((void*)0), (vte_erase_binding_get_type ()), (VTE_ERASE_DELETE_SEQUENCE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_DELETE_BINDING, pspec); g_param_spec_set_qdata (pspec,
gsettings_key_quark, (gpointer) "delete-binding"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "delete-binding", pspec
);}
;
1331 TERMINAL_PROFILE_PROPERTY_ENUM (EXIT_ACTION, TERMINAL_TYPE_EXIT_ACTION, DEFAULT_EXIT_ACTION, KEY_EXIT_ACTION){ GParamSpec *pspec = g_param_spec_enum ("exit-action", ((void
*)0), ((void*)0), (terminal_exit_action_get_type ()), (TERMINAL_EXIT_CLOSE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_EXIT_ACTION, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "exit-action"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "exit-action", pspec);}
;
1332 TERMINAL_PROFILE_PROPERTY_ENUM (SCROLLBAR_POSITION, TERMINAL_TYPE_SCROLLBAR_POSITION, DEFAULT_SCROLLBAR_POSITION, KEY_SCROLLBAR_POSITION){ GParamSpec *pspec = g_param_spec_enum ("scrollbar-position"
, ((void*)0), ((void*)0), (terminal_scrollbar_position_get_type
()), (TERMINAL_SCROLLBAR_RIGHT), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLLBAR_POSITION, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scrollbar-position"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scrollbar-position"
, pspec);}
;
1333 TERMINAL_PROFILE_PROPERTY_ENUM (TITLE_MODE, TERMINAL_TYPE_TITLE_MODE, DEFAULT_TITLE_MODE, KEY_TITLE_MODE){ GParamSpec *pspec = g_param_spec_enum ("title-mode", ((void
*)0), ((void*)0), (terminal_title_mode_get_type ()), (TERMINAL_TITLE_REPLACE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_TITLE_MODE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "title-mode"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "title-mode", pspec);}
;
1334
1335 TERMINAL_PROFILE_PROPERTY_INT (DEFAULT_SIZE_COLUMNS, 1, 1024, DEFAULT_DEFAULT_SIZE_COLUMNS, KEY_DEFAULT_SIZE_COLUMNS){ GParamSpec *pspec = g_param_spec_int ("default-size-columns"
, ((void*)0), ((void*)0), 1, 1024, (80), G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_DEFAULT_SIZE_COLUMNS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "default-size-columns"); g_hash_table_insert (klass
->gsettings_keys, (gpointer) "default-size-columns", pspec
);}
;
1336 TERMINAL_PROFILE_PROPERTY_INT (DEFAULT_SIZE_ROWS, 1, 1024, DEFAULT_DEFAULT_SIZE_ROWS, KEY_DEFAULT_SIZE_ROWS){ GParamSpec *pspec = g_param_spec_int ("default-size-rows", (
(void*)0), ((void*)0), 1, 1024, (24), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_DEFAULT_SIZE_ROWS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "default-size-rows")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "default-size-rows"
, pspec);}
;
1337 TERMINAL_PROFILE_PROPERTY_INT (SCROLLBACK_LINES, 1, G_MAXINT, DEFAULT_SCROLLBACK_LINES, KEY_SCROLLBACK_LINES){ GParamSpec *pspec = g_param_spec_int ("scrollback-lines", (
(void*)0), ((void*)0), 1, 2147483647, (512), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_SCROLLBACK_LINES
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "scrollback-lines"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "scrollback-lines", pspec);}
;
1338
1339 TERMINAL_PROFILE_PROPERTY_OBJECT (BACKGROUND_IMAGE, GDK_TYPE_PIXBUF){ GParamSpec *pspec = g_param_spec_object ("background-image"
, ((void*)0), ((void*)0), (gdk_pixbuf_get_type ()), G_PARAM_READABLE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_IMAGE
, pspec);}
;
1340
1341 TERMINAL_PROFILE_PROPERTY_STRING_CO (NAME, DEFAULT_NAME){ GParamSpec *pspec = g_param_spec_string ("name", ((void*)0)
, ((void*)0), (((void*)0)), G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_NAME,
pspec);}
;
1342
1343 TERMINAL_PROFILE_PROPERTY_STRING (BACKGROUND_IMAGE_FILE, DEFAULT_BACKGROUND_IMAGE_FILE, KEY_BACKGROUND_IMAGE_FILE){ GParamSpec *pspec = g_param_spec_string ("background-image-file"
, ((void*)0), ((void*)0), (""), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BACKGROUND_IMAGE_FILE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "background-image");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "background-image"
, pspec);}
;
1344 TERMINAL_PROFILE_PROPERTY_STRING (CUSTOM_COMMAND, DEFAULT_CUSTOM_COMMAND, KEY_CUSTOM_COMMAND){ GParamSpec *pspec = g_param_spec_string ("custom-command", (
(void*)0), ((void*)0), (""), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_CUSTOM_COMMAND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "custom-command"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "custom-command", pspec
);}
;
1345 TERMINAL_PROFILE_PROPERTY_STRING (TITLE, _(DEFAULT_TITLE), KEY_TITLE){ GParamSpec *pspec = g_param_spec_string ("title", ((void*)0
), ((void*)0), gettext ((("Terminal"))), G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_TITLE
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "title"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "title", pspec);}
;
1346 TERMINAL_PROFILE_PROPERTY_STRING (VISIBLE_NAME, _(DEFAULT_VISIBLE_NAME), KEY_VISIBLE_NAME){ GParamSpec *pspec = g_param_spec_string ("visible-name", ((
void*)0), ((void*)0), gettext ((("Unnamed"))), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_VISIBLE_NAME
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "visible-name"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "visible-name", pspec);}
;
1347 TERMINAL_PROFILE_PROPERTY_STRING (WORD_CHARS, DEFAULT_WORD_CHARS, KEY_WORD_CHARS){ GParamSpec *pspec = g_param_spec_string ("word-chars", ((void
*)0), ((void*)0), ("-A-Za-z0-9,./?%&#:_=+@~"), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_WORD_CHARS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "word-chars"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "word-chars", pspec);}
;
1348
1349 TERMINAL_PROFILE_PROPERTY_VALUE_ARRAY_BOXED (PALETTE, "palette-color", GDK_TYPE_RGBA, KEY_PALETTE){ GParamSpec *pspec = g_param_spec_value_array ("palette", ((
void*)0), ((void*)0), g_param_spec_boxed ("palette-color", ((
void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_PALETTE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "palette"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "palette", pspec);}
;
1350}
1351
1352/* Semi-Public API */
1353
1354TerminalProfile*
1355_terminal_profile_new (const char *name)
1356{
1357 return g_object_new (TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()),
1358 "name", name,
1359 NULL((void*)0));
1360}
1361
1362void
1363_terminal_profile_forget (TerminalProfile *profile)
1364{
1365 TerminalProfilePrivate *priv = profile->priv;
1366
1367 if (!priv->forgotten)
1368 {
1369 priv->forgotten = TRUE(!(0));
1370
1371 g_signal_emit (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, signals[FORGOTTEN], 0);
1372 }
1373}
1374
1375gboolean
1376_terminal_profile_get_forgotten (TerminalProfile *profile)
1377{
1378 return profile->priv->forgotten;
1379}
1380
1381TerminalProfile *
1382_terminal_profile_clone (TerminalProfile *base_profile,
1383 const char *visible_name)
1384{
1385 TerminalApp *app = terminal_app_get ();
1386 GObject *base_object = G_OBJECT (base_profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((base_profile)), (((GType) ((20) << (2))))))))
;
1387 TerminalProfilePrivate *new_priv;
1388 char profile_name[32];
1389 GParameter *params;
1390 GParamSpec **pspecs;
1391 guint n_pspecs, i, n_params, profile_num;
1392 TerminalProfile *new_profile;
1393
1394 g_object_ref (base_profile)((__typeof__ (base_profile)) (g_object_ref) (base_profile));
1395
1396 profile_num = 0;
1397 do
1398 {
1399 g_snprintf (profile_name, sizeof (profile_name), "profile%u", profile_num++);
1400 }
1401 while (terminal_app_get_profile_by_name (app, profile_name) != NULL((void*)0));
1402
1403 /* Now we have an unused profile name */
1404 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (base_profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((base_profile
)))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
1405
1406 params = g_newa (GParameter, n_pspecs)((GParameter*) __builtin_alloca (sizeof (GParameter) * (gsize
) (n_pspecs)))
;
1407 n_params = 0;
1408
1409 for (i = 0; i < n_pspecs; ++i)
1410 {
1411 GParamSpec *pspec = pspecs[i];
1412 GValue *value;
1413
1414 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) ||
1415 (pspec->flags & G_PARAM_WRITABLE) == 0)
1416 continue;
1417
1418 params[n_params].name = pspec->name;
1419
1420 value = &params[n_params].value;
1421 G_VALUE_TYPE (value)(((GValue*) (value))->g_type) = 0;
1422 g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
1423
1424 if (pspec->name == I_(TERMINAL_PROFILE_NAME)g_intern_static_string ("name"))
1425 g_value_set_static_string (value, profile_name);
1426 else if (pspec->name == I_(TERMINAL_PROFILE_VISIBLE_NAME)g_intern_static_string ("visible-name"))
1427 g_value_set_static_string (value, visible_name);
1428 else
1429 g_object_get_property (base_object, pspec->name, value);
1430
1431 ++n_params;
1432 }
1433
1434 new_profile = g_object_newv (TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()), n_params, params);
1435
1436 g_object_unref (base_profile);
1437
1438 for (i = 0; i < n_params; ++i)
1439 g_value_unset (&params[i].value);
1440
1441 /* Flush the new profile to GSettings */
1442 new_priv = new_profile->priv;
1443
1444 g_slist_free (new_priv->dirty_pspecs);
1445 new_priv->dirty_pspecs = NULL((void*)0);
1446 if (new_priv->save_idle_id != 0)
1447 {
1448 g_source_remove (new_priv->save_idle_id);
1449 new_priv->save_idle_id = 0;
1450 }
1451
1452 for (i = 0; i < n_pspecs; ++i)
1453 {
1454 GParamSpec *pspec = pspecs[i];
1455
1456 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) ||
1457 (pspec->flags & G_PARAM_WRITABLE) == 0)
1458 continue;
1459
1460 new_priv->dirty_pspecs = g_slist_prepend (new_priv->dirty_pspecs, pspec);
1461 }
1462 g_free (pspecs);
1463
1464 terminal_profile_save (new_profile);
1465
1466 return new_profile;
1467}
1468
1469/* Public API */
1470
1471gboolean
1472terminal_profile_get_property_boolean (TerminalProfile *profile,
1473 const char *prop_name)
1474{
1475 const GValue *value;
1476
1477 value = get_prop_value_from_prop_name (profile, prop_name);
1478 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_BOOLEAN (value), FALSE)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((5) << (2)))); gboolean __r; if (!__val) __r = (0); else
if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_BOOLEAN (value)"
); return ((0)); } } while (0)
;
1479 if (!value || !G_VALUE_HOLDS_BOOLEAN (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((5) << (2)))); gboolean __r;
if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1480 return FALSE(0);
1481
1482 return g_value_get_boolean (value);
1483}
1484
1485gconstpointer
1486terminal_profile_get_property_boxed (TerminalProfile *profile,
1487 const char *prop_name)
1488{
1489 const GValue *value;
1490
1491 value = get_prop_value_from_prop_name (profile, prop_name);
1492 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_BOXED (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((18) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_BOXED (value)"
); return (((void*)0)); } } while (0)
;
1493 if (!value || !G_VALUE_HOLDS_BOXED (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((18) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1494 return NULL((void*)0);
1495
1496 return g_value_get_boxed (value);
1497}
1498
1499double
1500terminal_profile_get_property_double (TerminalProfile *profile,
1501 const char *prop_name)
1502{
1503 const GValue *value;
1504
1505 value = get_prop_value_from_prop_name (profile, prop_name);
1506 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_DOUBLE (value), 0.0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((15) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_DOUBLE (value)"
); return (0.0); } } while (0)
;
1507 if (!value || !G_VALUE_HOLDS_DOUBLE (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((15) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1508 return 0.0;
1509
1510 return g_value_get_double (value);
1511}
1512
1513int
1514terminal_profile_get_property_enum (TerminalProfile *profile,
1515 const char *prop_name)
1516{
1517 const GValue *value;
1518
1519 value = get_prop_value_from_prop_name (profile, prop_name);
1520 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_ENUM (value), 0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((12) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_ENUM (value)"
); return (0); } } while (0)
;
1521 if (!value || !G_VALUE_HOLDS_ENUM (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((12) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1522 return 0;
1523
1524 return g_value_get_enum (value);
1525}
1526
1527int
1528terminal_profile_get_property_int (TerminalProfile *profile,
1529 const char *prop_name)
1530{
1531 const GValue *value;
1532
1533 value = get_prop_value_from_prop_name (profile, prop_name);
1534 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_INT (value), 0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((6) << (2)))); gboolean __r; if (!__val) __r = (0); else
if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_INT (value)"
); return (0); } } while (0)
;
1535 if (!value || !G_VALUE_HOLDS_INT (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((6) << (2)))); gboolean __r;
if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1536 return 0;
1537
1538 return g_value_get_int (value);
1539}
1540
1541gpointer
1542terminal_profile_get_property_object (TerminalProfile *profile,
1543 const char *prop_name)
1544{
1545 const GValue *value;
1546
1547 value = get_prop_value_from_prop_name (profile, prop_name);
1548 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_OBJECT (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((20) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_OBJECT (value)"
); return (((void*)0)); } } while (0)
;
1549 if (!value || !G_VALUE_HOLDS_OBJECT (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((20) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1550 return NULL((void*)0);
1551
1552 return g_value_get_object (value);
1553}
1554
1555const char*
1556terminal_profile_get_property_string (TerminalProfile *profile,
1557 const char *prop_name)
1558{
1559 const GValue *value;
1560
1561 value = get_prop_value_from_prop_name (profile, prop_name);
1562 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_STRING (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((16) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_STRING (value)"
); return (((void*)0)); } } while (0)
;
1563 if (!value || !G_VALUE_HOLDS_STRING (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((16) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1564 return NULL((void*)0);
1565
1566 return g_value_get_string (value);
1567}
1568
1569gboolean
1570terminal_profile_property_locked (TerminalProfile *profile,
1571 const char *prop_name)
1572{
1573 TerminalProfilePrivate *priv = profile->priv;
1574 GParamSpec *pspec;
1575
1576 pspec = get_pspec_from_name (profile, prop_name);
1577 g_return_val_if_fail (pspec != NULL, FALSE)do { if ((pspec != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "pspec != NULL");
return ((0)); } } while (0)
;
1578 if (!pspec)
1579 return FALSE(0);
1580
1581 return priv->locked[pspec->param_id];
1582}
1583
1584void
1585terminal_profile_reset_property (TerminalProfile *profile,
1586 const char *prop_name)
1587{
1588 GParamSpec *pspec;
1589
1590 pspec = get_pspec_from_name (profile, prop_name);
1591 g_return_if_fail (pspec != NULL)do { if ((pspec != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "pspec != NULL");
return; } } while (0)
;
1592 if (!pspec ||
1593 (pspec->flags & G_PARAM_WRITABLE) == 0)
1594 return;
1595
1596 terminal_profile_reset_property_internal (profile, pspec, TRUE(!(0)));
1597}
1598
1599gboolean
1600terminal_profile_get_palette (TerminalProfile *profile,
1601 GdkRGBA *colors,
1602 guint *n_colors)
1603{
1604 TerminalProfilePrivate *priv;
1605 GValueArray *array;
1606 guint i, n;
1607
1608 g_return_val_if_fail (TERMINAL_IS_PROFILE (profile), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((profile)); GType __t = ((terminal_profile_get_type ()));
gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class
&& __inst->g_class->g_type == __t) __r = (!(0)
); else __r = g_type_check_instance_is_a (__inst, __t); __r; }
)))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "TERMINAL_IS_PROFILE (profile)"); return
((0)); } } while (0)
;
1609 g_return_val_if_fail (colors != NULL && n_colors != NULL, FALSE)do { if ((colors != ((void*)0) && n_colors != ((void*
)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "colors != NULL && n_colors != NULL"
); return ((0)); } } while (0)
;
1610
1611 priv = profile->priv;
1612 array = g_value_get_boxed (g_value_array_get_nth (priv->properties, PROP_PALETTE));
1613 if (!array)
1614 return FALSE(0);
1615
1616 n = MIN (array->n_values, *n_colors)(((array->n_values) < (*n_colors)) ? (array->n_values
) : (*n_colors))
;
1617 for (i = 0; i < n; ++i)
1618 {
1619 GdkRGBA *color = g_value_get_boxed (g_value_array_get_nth (array, i));
1620 if (!color)
1621 continue; /* shouldn't happen!! */
1622
1623 colors[i] = *color;
1624 }
1625
1626 *n_colors = n;
1627 return TRUE(!(0));
1628}
1629
1630gboolean
1631terminal_profile_get_palette_is_builtin (TerminalProfile *profile,
1632 guint *n)
1633{
1634 GdkRGBA colors[TERMINAL_PALETTE_SIZE16];
1635 guint n_colors;
1636 guint i;
1637
1638 n_colors = G_N_ELEMENTS (colors)(sizeof (colors) / sizeof ((colors)[0]));
1639 if (!terminal_profile_get_palette (profile, colors, &n_colors) ||
1640 n_colors != TERMINAL_PALETTE_SIZE16)
1641 return FALSE(0);
1642
1643 for (i = 0; i < TERMINAL_PALETTE_N_BUILTINS5; ++i)
1644 if (palette_cmp (colors, terminal_palettes[i]))
1645 {
1646 *n = i;
1647 return TRUE(!(0));
1648 }
1649
1650 return FALSE(0);
1651}
1652
1653void
1654terminal_profile_set_palette_builtin (TerminalProfile *profile,
1655 guint n)
1656{
1657 GValue value = { 0, };
1658
1659 g_return_if_fail (n < TERMINAL_PALETTE_N_BUILTINS)do { if ((n < 5)) { } else { g_return_if_fail_warning (((gchar
*) 0), ((const char*) (__func__)), "n < TERMINAL_PALETTE_N_BUILTINS"
); return; } } while (0)
;
1660
1661 g_value_init (&value, G_TYPE_VALUE_ARRAY(g_value_array_get_type ()) GCC warning "Deprecated pre-processor symbol: replace with \"(g_array_get_type ())\""
+
);
1662 set_value_from_palette (&value, terminal_palettes[n], TERMINAL_PALETTE_SIZE16);
1663 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, TERMINAL_PROFILE_PALETTE"palette", &value);
1664 g_value_unset (&value);
1665}
1666
1667gboolean
1668terminal_profile_modify_palette_entry (TerminalProfile *profile,
1669 guint i,
1670 const GdkRGBA *color)
1671{
1672 TerminalProfilePrivate *priv = profile->priv;
1673 GValueArray *array;
1674 GValue *value;
1675 GdkRGBA *old_color;
1676
1677 array = g_value_get_boxed (g_value_array_get_nth (priv->properties, PROP_PALETTE));
1678 if (!array ||
1679 i >= array->n_values)
1680 return FALSE(0);
1681
1682 value = g_value_array_get_nth (array, i);
1683 old_color = g_value_get_boxed (value);
1684 if (!old_color ||
1685 !rgba_equal (old_color, color))
1686 {
1687 g_value_set_boxed (value, color);
1688 g_object_notify (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, TERMINAL_PROFILE_PALETTE"palette");
1689 }
1690
1691 return TRUE(!(0));
1692}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-20669e.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-20669e.html new file mode 100644 index 0000000..674077e --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-20669e.html @@ -0,0 +1,2840 @@ + + + +terminal-app.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:terminal-app.c
Warning:line 817, column 38
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name terminal-app.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I .. -I ../src/mate-submodules/libegg -D TERMINAL_COMPILATION -D TERMINAL_RESOURCES_PATH_PREFIX="/org/mate/terminal" -D TERM_DATADIR="/usr/local/share" -D TERM_LOCALEDIR="/usr/local/share/locale" -D TERM_PKGDATADIR="/usr/local/share/mate-terminal" -D TERM_HELPDIR="/usr/local/share/help" -D SN_API_NOT_YET_FROZEN -D GDK_MULTIHEAD_SAFE -D G_DISABLE_SINGLE_INCLUDES -D PANGO_DISABLE_SINGLE_INCLUDES -D ATK_DISABLE_SINGLE_INCLUDES -D GDK_DISABLE_SINGLE_INCLUDES -D GDK_PIXBUF_DISABLE_SINGLE_INCLUDES -D GTK_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c terminal-app.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright © 2001, 2002 Havoc Pennington
3 * Copyright © 2002 Red Hat, Inc.
4 * Copyright © 2002 Sun Microsystems
5 * Copyright © 2003 Mariano Suarez-Alvarez
6 * Copyright © 2008 Christian Persch
7 * Copyright (C) 2012-2021 MATE Developers
8 *
9 * Mate-terminal is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * Mate-terminal is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#include <config.h>
24
25#include <errno(*__errno_location ()).h>
26
27#include <glib.h>
28#include <dconf.h>
29
30#include "terminal-intl.h"
31
32#include "terminal-debug.h"
33#include "terminal-app.h"
34#include "terminal-accels.h"
35#include "terminal-screen.h"
36#include "terminal-screen-container.h"
37#include "terminal-window.h"
38#include "terminal-util.h"
39#include "profile-editor.h"
40#include "terminal-encoding.h"
41#include <string.h>
42#include <stdlib.h>
43
44#ifdef HAVE_SMCLIENT1
45#include "eggsmclient.h"
46#include "eggdesktopfile.h"
47#endif /* HAVE_SMCLIENT */
48
49#define FALLBACK_PROFILE_ID"default" "default"
50
51/* Settings storage works as follows:
52 * /apps/mate-terminal/global/
53 * /apps/mate-terminal/profiles/Foo/
54 *
55 * It's somewhat tricky to manage the profiles/ dir since we need to track
56 * the list of profiles, but GSettings doesn't have a concept of notifying that
57 * a directory has appeared or disappeared.
58 *
59 * Session state is stored entirely in the RestartCommand command line.
60 *
61 * The number one rule: all stored information is EITHER per-session,
62 * per-profile, or set from a command line option. THERE CAN BE NO
63 * OVERLAP. The UI and implementation totally break if you overlap
64 * these categories. See mate-terminal 1.x for why.
65 *
66 * Don't use this code as an example of how to use GSettings - it's hugely
67 * overcomplicated due to the profiles stuff. Most apps should not
68 * have to do scary things of this nature, and should not have
69 * a profiles feature.
70 *
71 */
72
73GSettings *settings_global;
74
75struct _TerminalAppClass
76{
77 GObjectClass parent_class;
78
79 void (* quit) (TerminalApp *app);
80 void (* profile_list_changed) (TerminalApp *app);
81 void (* encoding_list_changed) (TerminalApp *app);
82};
83
84struct _TerminalApp
85{
86 GObject parent_instance;
87
88 GList *windows;
89 GtkWidget *new_profile_dialog;
90 GtkWidget *manage_profiles_dialog;
91 GtkWidget *manage_profiles_list;
92 GtkWidget *manage_profiles_new_button;
93 GtkWidget *manage_profiles_edit_button;
94 GtkWidget *manage_profiles_delete_button;
95 GtkWidget *manage_profiles_default_menu;
96
97 GSettings *settings_font;
98
99 GHashTable *profiles;
100 char* default_profile_id;
101 TerminalProfile *default_profile;
102 gboolean default_profile_locked;
103
104 GHashTable *encodings;
105 gboolean encodings_locked;
106
107 PangoFontDescription *system_font_desc;
108 gboolean enable_mnemonics;
109 gboolean enable_menu_accels;
110};
111
112enum
113{
114 PROP_0,
115 PROP_DEFAULT_PROFILE,
116 PROP_ENABLE_MENU_BAR_ACCEL,
117 PROP_ENABLE_MNEMONICS,
118 PROP_SYSTEM_FONT,
119};
120
121enum
122{
123 QUIT,
124 PROFILE_LIST_CHANGED,
125 ENCODING_LIST_CHANGED,
126 LAST_SIGNAL
127};
128
129static guint signals[LAST_SIGNAL] = { 0 };
130
131enum
132{
133 COL_PROFILE,
134 NUM_COLUMNS
135};
136
137enum
138{
139 SOURCE_DEFAULT = 0,
140 SOURCE_SESSION = 1
141};
142
143static TerminalApp *global_app = NULL((void*)0);
144
145#define MONOSPACE_FONT_SCHEMA"org.mate.interface" "org.mate.interface"
146#define MONOSPACE_FONT_KEY"monospace-font-name" "monospace-font-name"
147#define DEFAULT_MONOSPACE_FONT("Monospace 10") ("Monospace 10")
148
149#define ENABLE_MNEMONICS_KEY"use-mnemonics" "use-mnemonics"
150#define DEFAULT_ENABLE_MNEMONICS((!(0))) (TRUE(!(0)))
151
152#define ENABLE_MENU_BAR_ACCEL_KEY"use-menu-accelerators" "use-menu-accelerators"
153#define DEFAULT_ENABLE_MENU_BAR_ACCEL((!(0))) (TRUE(!(0)))
154
155#define PROFILE_LIST_KEY"profile-list" "profile-list"
156#define DEFAULT_PROFILE_KEY"default-profile" "default-profile"
157
158#define ENCODING_LIST_KEY"active-encodings" "active-encodings"
159
160/* two following functions were copied from libmate-desktop to get rid
161 * of dependency on it
162 *
163 * FIXME: I suspect there's no need for excessive copies, we might use
164 * existing profile list to form GVariant's and write them to GSettings
165 */
166static gboolean
167gsettings_append_strv (GSettings *settings,
168 const gchar *key,
169 const gchar *value)
170{
171 gchar **old;
172 gchar **new;
173 gint size;
174 gboolean retval;
175
176 old = g_settings_get_strv (settings, key);
177
178 for (size = 0; old[size] != NULL((void*)0); size++);
179
180 size += 1; /* appended value */
181 size += 1; /* NULL */
182
183 new = g_realloc_n (old, size, sizeof (gchar *));
184
185 new[size - 2] = g_strdup (value)g_strdup_inline (value);
186 new[size - 1] = NULL((void*)0);
187
188 retval = g_settings_set_strv (settings, key,
189 (const gchar **) new);
190
191 g_strfreev (new);
192
193 return retval;
194}
195
196static gboolean
197gsettings_remove_all_from_strv (GSettings *settings,
198 const gchar *key,
199 const gchar *value)
200{
201 GArray *array;
202 gchar **old;
203 gint i;
204 gboolean retval;
205
206 old = g_settings_get_strv (settings, key);
207 array = g_array_new (TRUE(!(0)), TRUE(!(0)), sizeof (gchar *));
208
209 for (i = 0; old[i] != NULL((void*)0); i++) {
210 if (g_strcmp0 (old[i], value) != 0)
211 array = g_array_append_val (array, old[i])g_array_append_vals (array, &(old[i]), 1);
212 }
213
214 retval = g_settings_set_strv (settings, key,
215 (const gchar **) array->data);
216
217 g_strfreev (old);
218 g_array_free (array, TRUE(!(0)));
219
220 return retval;
221}
222
223/* Helper functions */
224
225static GdkScreen*
226terminal_app_get_screen_by_display_name (const char *display_name)
227{
228 GdkDisplay *display = NULL((void*)0);
229 GdkScreen *screen = NULL((void*)0);
230
231 if (display_name == NULL((void*)0))
232 display = gdk_display_get_default ();
233 else
234 {
235 GSList *displays, *l;
236 const char *period;
237
238 period = strrchr (display_name, '.');
239 displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
240 for (l = displays; l != NULL((void*)0); l = l->next)
241 {
242 GdkDisplay *disp = l->data;
243
244 /* compare without the screen number part, if present */
245 if ((period && strncmp (gdk_display_get_name (disp), display_name, period - display_name) == 0) ||
246 (period == NULL((void*)0) && strcmp (gdk_display_get_name (disp), display_name) == 0))
247 {
248 display = disp;
249 break;
250 }
251 }
252 g_slist_free (displays);
253
254 if (display == NULL((void*)0))
255 display = gdk_display_open (display_name); /* FIXME we never close displays */
256 }
257
258 if (display == NULL((void*)0))
259 return NULL((void*)0);
260 else
261 screen = gdk_display_get_default_screen (display);
262
263 return screen;
264}
265
266static int
267terminal_app_get_workspace_for_window (TerminalWindow *window)
268{
269 int ret = -1;
270 guchar *data = NULL((void*)0);
271 GdkAtom atom;
272 GdkAtom cardinal_atom;
273
274 atom = gdk_atom_intern_static_string ("_NET_WM_DESKTOP");
275 cardinal_atom = gdk_atom_intern_static_string ("CARDINAL");
276
277 gdk_property_get (gtk_widget_get_window(GTK_WIDGET(window)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_widget_get_type ()))))))
),
278 atom, cardinal_atom, 0, 8, FALSE(0),
279 NULL((void*)0), NULL((void*)0), NULL((void*)0), &data);
280
281 if (data)
282 ret = *(int *)data;
283
284 g_free (data);
285 return ret;
286}
287
288/* Menubar mnemonics settings handling */
289
290static int
291profiles_alphabetic_cmp (gconstpointer pa,
292 gconstpointer pb)
293{
294 TerminalProfile *a = (TerminalProfile *) pa;
295 TerminalProfile *b = (TerminalProfile *) pb;
296 int result;
297
298 result = g_utf8_collate (terminal_profile_get_property_string (a, TERMINAL_PROFILE_VISIBLE_NAME"visible-name"),
299 terminal_profile_get_property_string (b, TERMINAL_PROFILE_VISIBLE_NAME"visible-name"));
300 if (result == 0)
301 result = strcmp (terminal_profile_get_property_string (a, TERMINAL_PROFILE_NAME"name"),
302 terminal_profile_get_property_string (b, TERMINAL_PROFILE_NAME"name"));
303
304 return result;
305}
306
307typedef struct
308{
309 TerminalProfile *result;
310 const char *target;
311} LookupInfo;
312
313static void
314profiles_lookup_by_visible_name_foreach (gpointer key,
315 gpointer value,
316 gpointer data)
317{
318 LookupInfo *info = data;
319 const char *name;
320
321 name = terminal_profile_get_property_string (value, TERMINAL_PROFILE_VISIBLE_NAME"visible-name");
322 if (name && strcmp (info->target, name) == 0)
323 info->result = value;
324}
325
326static void
327terminal_window_destroyed (TerminalWindow *window,
328 TerminalApp *app)
329{
330 app->windows = g_list_remove (app->windows, window);
331
332 if (app->windows == NULL((void*)0))
333 g_signal_emit (app, signals[QUIT], 0);
334}
335
336static TerminalProfile *
337terminal_app_create_profile (TerminalApp *app,
338 const char *name)
339{
340 TerminalProfile *profile;
341
342 g_assert (terminal_app_get_profile_by_name (app, name) == NULL)do { if (terminal_app_get_profile_by_name (app, name) == ((void
*)0)) ; else g_assertion_message_expr (((gchar*) 0), "terminal-app.c"
, 342, ((const char*) (__func__)), "terminal_app_get_profile_by_name (app, name) == NULL"
); } while (0)
;
343
344 profile = _terminal_profile_new (name);
345
346 g_hash_table_insert (app->profiles,
347 g_strdup (terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME))g_strdup_inline (terminal_profile_get_property_string (profile
, "name"))
,
348 profile /* adopts the refcount */);
349
350 if (app->default_profile == NULL((void*)0) &&
351 app->default_profile_id != NULL((void*)0) &&
352 strcmp (app->default_profile_id,
353 terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name")) == 0)
354 {
355 /* We are the default profile */
356 app->default_profile = profile;
357 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
358 }
359
360 return profile;
361}
362
363static void
364terminal_app_delete_profile (TerminalProfile *profile)
365{
366 const char *profile_name;
367 char *profile_dir;
368 GError *error = NULL((void*)0);
369
370 profile_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name");
371 profile_dir = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", profile_name, "/", NULL((void*)0));
372
373 gsettings_remove_all_from_strv (settings_global, PROFILE_LIST_KEY"profile-list", profile_name);
374
375 /* And remove the profile directory */
376 DConfClient *client = dconf_client_new ();
377 if (!dconf_client_write_sync (client, profile_dir, NULL((void*)0), NULL((void*)0), NULL((void*)0), &error))
378 {
379 g_warning ("Failed to recursively unset %s: %s\n", profile_dir, error->message);
380 g_error_free (error);
381 }
382
383 g_object_unref (client);
384 g_free (profile_dir);
385}
386
387static void
388terminal_app_profile_cell_data_func (GtkTreeViewColumn *tree_column,
389 GtkCellRenderer *cell,
390 GtkTreeModel *tree_model,
391 GtkTreeIter *iter,
392 gpointer data)
393{
394 TerminalProfile *profile;
395 GValue value = { 0, };
396
397 gtk_tree_model_get (tree_model, iter, (int) COL_PROFILE, &profile, (int) -1);
398
399 g_value_init (&value, G_TYPE_STRING((GType) ((16) << (2))));
400 g_object_get_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, "visible-name", &value);
401 g_object_set_property (G_OBJECT (cell)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cell)), (((GType) ((20) << (2))))))))
, "text", &value);
402 g_value_unset (&value);
403}
404
405static int
406terminal_app_profile_sort_func (GtkTreeModel *model,
407 GtkTreeIter *a,
408 GtkTreeIter *b,
409 gpointer user_data)
410{
411 TerminalProfile *profile_a, *profile_b;
412 int retval;
413
414 gtk_tree_model_get (model, a, (int) COL_PROFILE, &profile_a, (int) -1);
415 gtk_tree_model_get (model, b, (int) COL_PROFILE, &profile_b, (int) -1);
416
417 retval = profiles_alphabetic_cmp (profile_a, profile_b);
418
419 g_object_unref (profile_a);
420 g_object_unref (profile_b);
421
422 return retval;
423}
424
425static /* ref */ GtkTreeModel *
426terminal_app_get_profile_liststore (TerminalApp *app,
427 TerminalProfile *selected_profile,
428 GtkTreeIter *selected_profile_iter,
429 gboolean *selected_profile_iter_set)
430{
431 GtkListStore *store;
432 GtkTreeIter iter;
433 GList *profiles, *l;
434
435 store = gtk_list_store_new (NUM_COLUMNS, TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()));
436
437 *selected_profile_iter_set = FALSE(0);
438
439 if (selected_profile &&
440 _terminal_profile_get_forgotten (selected_profile))
441 selected_profile = NULL((void*)0);
442
443 profiles = terminal_app_get_profile_list (app);
444
445 for (l = profiles; l != NULL((void*)0); l = l->next)
446 {
447 TerminalProfile *profile = TERMINAL_PROFILE (l->data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((terminal_profile_get_type ()))))))
;
448
449 gtk_list_store_insert_with_values (store, &iter, 0,
450 (int) COL_PROFILE, profile,
451 (int) -1);
452
453 if (selected_profile_iter && profile == selected_profile)
454 {
455 *selected_profile_iter = iter;
456 *selected_profile_iter_set = TRUE(!(0));
457 }
458 }
459 g_list_free (profiles);
460
461 /* Now turn on sorting */
462 gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (store)((((GtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((gtk_tree_sortable_get_type ()))))))
,
463 COL_PROFILE,
464 terminal_app_profile_sort_func,
465 NULL((void*)0), NULL((void*)0));
466 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store)((((GtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((gtk_tree_sortable_get_type ()))))))
,
467 COL_PROFILE, GTK_SORT_ASCENDING);
468
469 return GTK_TREE_MODEL (store)((((GtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((gtk_tree_model_get_type ()))))))
;
470}
471
472static /* ref */ TerminalProfile*
473profile_combo_box_get_selected (GtkWidget *widget)
474{
475 GtkComboBox *combo = GTK_COMBO_BOX (widget)((((GtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_combo_box_get_type ()))))))
;
476 TerminalProfile *profile = NULL((void*)0);
477 GtkTreeIter iter;
478
479 if (gtk_combo_box_get_active_iter (combo, &iter))
480 gtk_tree_model_get (gtk_combo_box_get_model (combo), &iter,
481 (int) COL_PROFILE, &profile, (int) -1);
482
483 return profile;
484}
485
486static void
487profile_combo_box_refill (TerminalApp *app,
488 GtkWidget *widget)
489{
490 GtkComboBox *combo = GTK_COMBO_BOX (widget)((((GtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_combo_box_get_type ()))))))
;
491 GtkTreeIter iter;
492 gboolean iter_set;
493 TerminalProfile *selected_profile;
494 GtkTreeModel *model;
495
496 selected_profile = profile_combo_box_get_selected (widget);
497 if (!selected_profile)
498 {
499 selected_profile = terminal_app_get_default_profile (app);
500 if (selected_profile)
501 g_object_ref (selected_profile)((__typeof__ (selected_profile)) (g_object_ref) (selected_profile
))
;
502 }
503
504 model = terminal_app_get_profile_liststore (app,
505 selected_profile,
506 &iter,
507 &iter_set);
508 gtk_combo_box_set_model (combo, model);
509 g_object_unref (model);
510
511 if (iter_set)
512 gtk_combo_box_set_active_iter (combo, &iter);
513
514 if (selected_profile)
515 g_object_unref (selected_profile);
516}
517
518static GtkWidget*
519profile_combo_box_new (TerminalApp *app)
520{
521 GtkWidget *combo;
522 GtkCellRenderer *renderer;
523
524 combo = gtk_combo_box_new ();
525 terminal_util_set_atk_name_description (combo, NULL((void*)0), _("Click button to choose profile")gettext ("Click button to choose profile"));
526
527 renderer = gtk_cell_renderer_text_new ();
528 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((gtk_cell_layout_get_type ()))))))
, renderer, TRUE(!(0)));
529 gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((gtk_cell_layout_get_type ()))))))
, renderer,
530 (GtkCellLayoutDataFunc) terminal_app_profile_cell_data_func,
531 NULL((void*)0), NULL((void*)0));
532
533 profile_combo_box_refill (app, combo);
534 g_signal_connect (app, "profile-list-changed",g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_combo_box_refill))), (combo), ((void*)0), (GConnectFlags
) 0)
535 G_CALLBACK (profile_combo_box_refill), combo)g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_combo_box_refill))), (combo), ((void*)0), (GConnectFlags
) 0)
;
536
537 gtk_widget_show (combo);
538 return combo;
539}
540
541static void
542profile_combo_box_changed_cb (GtkWidget *widget,
543 TerminalApp *app)
544{
545 TerminalProfile *profile;
546
547 profile = profile_combo_box_get_selected (widget);
548 if (!profile)
549 return;
550
551 g_settings_set_string (settings_global, DEFAULT_PROFILE_KEY"default-profile",
552 terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name"));
553
554 /* Even though the GSettings change notification does this, it happens too late.
555 * In some cases, the default profile changes twice in quick succession,
556 * and update_default_profile must be called in sync with those changes.
557 */
558 app->default_profile = profile;
559
560 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
561
562 g_object_unref (profile);
563}
564
565static void
566profile_list_treeview_refill (TerminalApp *app,
567 GtkWidget *widget)
568{
569 GtkTreeView *tree_view = GTK_TREE_VIEW (widget)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_tree_view_get_type ()))))))
;
570 GtkTreeIter iter;
571 gboolean iter_set;
572 GtkTreeSelection *selection;
573 GtkTreeModel *model;
574 TerminalProfile *selected_profile = NULL((void*)0);
575
576 model = gtk_tree_view_get_model (tree_view);
577
578 selection = gtk_tree_view_get_selection (tree_view);
579 if (gtk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
580 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
581
582 model = terminal_app_get_profile_liststore (terminal_app_get (),
583 selected_profile,
584 &iter,
585 &iter_set);
586 gtk_tree_view_set_model (tree_view, model);
587 g_object_unref (model);
588
589 if (!iter_set)
590 iter_set = gtk_tree_model_get_iter_first (model, &iter);
591
592 if (iter_set)
593 gtk_tree_selection_select_iter (selection, &iter);
594
595 if (selected_profile)
596 g_object_unref (selected_profile);
597}
598
599static GtkWidget*
600profile_list_treeview_create (TerminalApp *app)
601{
602 GtkWidget *tree_view;
603 GtkTreeSelection *selection;
604 GtkCellRenderer *renderer;
605 GtkTreeViewColumn *column;
606
607 tree_view = gtk_tree_view_new ();
608 terminal_util_set_atk_name_description (tree_view, _("Profile list")gettext ("Profile list"), NULL((void*)0));
609 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
, FALSE(0));
610
611 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
);
612 gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection)((((GtkTreeSelection*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((selection)), ((gtk_tree_selection_get_type (
)))))))
,
613 GTK_SELECTION_BROWSE);
614
615 column = gtk_tree_view_column_new ();
616 renderer = gtk_cell_renderer_text_new ();
617 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (column)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((column)), ((gtk_cell_layout_get_type ()))))))
, renderer, TRUE(!(0)));
618 gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (column)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((column)), ((gtk_cell_layout_get_type ()))))))
, renderer,
619 (GtkCellLayoutDataFunc) terminal_app_profile_cell_data_func,
620 NULL((void*)0), NULL((void*)0));
621 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
,
622 GTK_TREE_VIEW_COLUMN (column)((((GtkTreeViewColumn*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((column)), ((gtk_tree_view_column_get_type (
)))))))
);
623
624 return tree_view;
625}
626
627static void
628profile_list_delete_confirm_response_cb (GtkWidget *dialog,
629 int response)
630{
631 TerminalProfile *profile;
632
633 profile = TERMINAL_PROFILE (g_object_get_data (G_OBJECT (dialog), "profile"))((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_get_data (((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((dialog)), (((GType) ((20) << (2)))
))))), "profile"))), ((terminal_profile_get_type ()))))))
;
634 g_assert (profile != NULL)do { if (profile != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 634, ((const char*) (__func__
)), "profile != NULL"); } while (0)
;
635
636 if (response == GTK_RESPONSE_ACCEPT)
637 terminal_app_delete_profile (profile);
638
639 gtk_widget_destroy (dialog);
640}
641
642static void
643mate_dialog_add_button (GtkDialog *dialog,
644 const gchar *button_text,
645 const gchar *icon_name,
646 gint response_id)
647{
648 GtkWidget *button;
649
650 button = gtk_button_new_with_mnemonic (button_text);
651 gtk_button_set_image (GTK_BUTTON (button)((((GtkButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_button_get_type ()))))))
, gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON));
652
653 gtk_button_set_use_underline (GTK_BUTTON (button)((((GtkButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_button_get_type ()))))))
, TRUE(!(0)));
654 gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button");
655 gtk_widget_set_can_default (button, TRUE(!(0)));
656 gtk_widget_show (button);
657 gtk_dialog_add_action_widget (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
, button, response_id);
658}
659
660static void
661profile_list_delete_button_clicked_cb (GtkWidget *button,
662 GtkWidget *widget)
663{
664 GtkTreeView *tree_view = GTK_TREE_VIEW (widget)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_tree_view_get_type ()))))))
;
665 GtkTreeSelection *selection;
666 GtkWidget *dialog;
667 GtkTreeIter iter;
668 GtkTreeModel *model;
669 TerminalProfile *selected_profile;
670 GtkWidget *transient_parent;
671
672 model = gtk_tree_view_get_model (tree_view);
673 selection = gtk_tree_view_get_selection (tree_view);
674
675 if (!gtk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
676 return;
677
678 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
679
680 transient_parent = gtk_widget_get_toplevel (widget);
681 dialog = gtk_message_dialog_new (GTK_WINDOW (transient_parent)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((transient_parent)), ((gtk_window_get_type ()))))))
,
682 GTK_DIALOG_DESTROY_WITH_PARENT,
683 GTK_MESSAGE_QUESTION,
684 GTK_BUTTONS_NONE,
685 _("Delete profile “%s”?")gettext ("Delete profile “%s”?"),
686 terminal_profile_get_property_string (selected_profile, TERMINAL_PROFILE_VISIBLE_NAME"visible-name"));
687
688 mate_dialog_add_button (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
,
689 _("_Cancel")gettext ("_Cancel"),
690 "process-stop",
691 GTK_RESPONSE_REJECT);
692
693 mate_dialog_add_button (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
,
694 _("_Delete")gettext ("_Delete"),
695 "edit-delete",
696 GTK_RESPONSE_ACCEPT);
697
698 gtk_dialog_set_default_response (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
,
699 GTK_RESPONSE_ACCEPT);
700
701 gtk_window_set_title (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
, _("Delete Profile")gettext ("Delete Profile"));
702 gtk_window_set_resizable (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
, FALSE(0));
703
704 /* Transfer refcount of |selected_profile|, so no unref below */
705 g_object_set_data_full (G_OBJECT (dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), (((GType) ((20) << (2))))))))
, "profile", selected_profile, g_object_unref);
706
707 g_signal_connect (dialog, "response",g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_delete_confirm_response_cb))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
708 G_CALLBACK (profile_list_delete_confirm_response_cb),g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_delete_confirm_response_cb))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
709 NULL)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_delete_confirm_response_cb))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
;
710
711 gtk_window_present (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
);
712}
713
714static void
715profile_list_new_button_clicked_cb (GtkWidget *button,
716 gpointer data)
717{
718 TerminalApp *app;
719
720 app = terminal_app_get ();
721 terminal_app_new_profile (app, NULL((void*)0), GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
);
722}
723
724static void
725profile_list_edit_button_clicked_cb (GtkWidget *button,
726 GtkWidget *widget)
727{
728 GtkTreeView *tree_view = GTK_TREE_VIEW (widget)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_tree_view_get_type ()))))))
;
729 GtkTreeSelection *selection;
730 GtkTreeIter iter;
731 GtkTreeModel *model;
732 TerminalProfile *selected_profile;
733 TerminalApp *app;
734
735 app = terminal_app_get ();
736
737 model = gtk_tree_view_get_model (tree_view);
738 selection = gtk_tree_view_get_selection (tree_view);
739
740 if (!gtk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
741 return;
742
743 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
744
745 terminal_app_edit_profile (app, selected_profile,
746 GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
,
747 NULL((void*)0));
748 g_object_unref (selected_profile);
749}
750
751static void
752profile_list_row_activated_cb (GtkTreeView *tree_view,
753 GtkTreePath *path,
754 GtkTreeViewColumn *column,
755 gpointer data)
756{
757 GtkTreeIter iter;
758 GtkTreeModel *model;
759 TerminalProfile *selected_profile;
760 TerminalApp *app;
761
762 app = terminal_app_get ();
763
764 model = gtk_tree_view_get_model (tree_view);
765
766 if (!gtk_tree_model_get_iter (model, &iter, path))
767 return;
768
769 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
770
771 terminal_app_edit_profile (app, selected_profile,
772 GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
,
773 NULL((void*)0));
774 g_object_unref (selected_profile);
775}
776
777static GList*
778find_profile_link (GList *profiles,
779 const char *name)
780{
781 GList *l;
782
783 for (l = profiles; l != NULL((void*)0); l = l->next)
784 {
785 const char *profile_name;
786
787 profile_name = terminal_profile_get_property_string (TERMINAL_PROFILE (l->data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((terminal_profile_get_type ()))))))
, TERMINAL_PROFILE_NAME"name");
788 if (profile_name && strcmp (profile_name, name) == 0)
789 break;
790 }
791
792 return l;
793}
794
795static void
796terminal_app_profile_list_notify_cb (GSettings *settings,
797 const gchar *key,
798 gpointer user_data)
799{
800 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
801 GObject *object = G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
;
802 GVariant *val;
803 const gchar **value_list;
804 int i;
805 GList *profiles_to_delete, *l;
806 gboolean need_new_default;
807 TerminalProfile *fallback;
808 guint count;
809
810 g_object_freeze_notify (object);
811
812 profiles_to_delete = terminal_app_get_profile_list (app);
813
814 val = g_settings_get_value (settings, key);
815 if (val == NULL((void*)0) ||
816 (!g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY((const GVariantType *) "as")) &&
817 !g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s"))))
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
818 goto ensure_one_profile;
819
820 value_list = g_variant_get_strv (val, NULL((void*)0));
821 if (value_list == NULL((void*)0))
822 goto ensure_one_profile;
823
824 /* Add any new ones */
825 for (i = 0; value_list[i] != NULL((void*)0); ++i)
826 {
827 const char *profile_name = value_list[i];
828 GList *link;
829
830 if (!profile_name)
831 continue;
832
833 link = find_profile_link (profiles_to_delete, profile_name);
834 if (link)
835 /* make profiles_to_delete point to profiles we didn't find in the list */
836 profiles_to_delete = g_list_delete_link (profiles_to_delete, link);
837 else
838 terminal_app_create_profile (app, profile_name);
839 }
840
841 g_free (value_list);
842
843ensure_one_profile:
844
845 if (val != NULL((void*)0))
846 g_variant_unref (val);
847
848 fallback = NULL((void*)0);
849 count = g_hash_table_size (app->profiles);
850 if (count == 0 || count <= g_list_length (profiles_to_delete))
851 {
852 /* We are going to run out, so create the fallback
853 * to be sure we always have one. Must be done
854 * here before we emit "forgotten" signals so that
855 * screens have a profile to fall back to.
856 *
857 * If the profile with the FALLBACK_ID already exists,
858 * we aren't allowed to delete it, unless at least one
859 * other profile will still exist. And if you delete
860 * all profiles, the FALLBACK_ID profile returns as
861 * the living dead.
862 */
863 fallback = terminal_app_get_profile_by_name (app, FALLBACK_PROFILE_ID"default");
864 if (fallback == NULL((void*)0))
865 fallback = terminal_app_create_profile (app, FALLBACK_PROFILE_ID"default");
866 g_assert (fallback != NULL)do { if (fallback != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 866, ((const char*) (__func__
)), "fallback != NULL"); } while (0)
;
867 }
868
869 /* Forget no-longer-existing profiles */
870 need_new_default = FALSE(0);
871 for (l = profiles_to_delete; l != NULL((void*)0); l = l->next)
872 {
873 TerminalProfile *profile = TERMINAL_PROFILE (l->data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((terminal_profile_get_type ()))))))
;
874 const char *name;
875
876 name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name");
877 if (strcmp (name, FALLBACK_PROFILE_ID"default") == 0)
878 continue;
879
880 if (profile == app->default_profile)
881 {
882 app->default_profile = NULL((void*)0);
883 need_new_default = TRUE(!(0));
884 }
885
886 _terminal_profile_forget (profile);
887 g_hash_table_remove (app->profiles, name);
888
889 /* |profile| possibly isn't dead yet since the profiles dialogue's tree model holds a ref too... */
890 }
891 g_list_free (profiles_to_delete);
892
893 if (need_new_default)
894 {
895 TerminalProfile *new_default;
896 TerminalProfile **new_default_ptr = &new_default;
897
898 new_default = terminal_app_get_profile_by_name (app, FALLBACK_PROFILE_ID"default");
899 if (new_default == NULL((void*)0))
900 {
901 GHashTableIter iter;
902
903 g_hash_table_iter_init (&iter, app->profiles);
904 if (!g_hash_table_iter_next (&iter, NULL((void*)0), (gpointer *) new_default_ptr))
905 /* shouldn't really happen ever, but just to be safe */
906 new_default = terminal_app_create_profile (app, FALLBACK_PROFILE_ID"default");
907 }
908 g_assert (new_default != NULL)do { if (new_default != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 908, ((const char*) (__func__
)), "new_default != NULL"); } while (0)
;
909
910 app->default_profile = new_default;
911
912 g_object_notify (object, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
913 }
914
915 g_assert (g_hash_table_size (app->profiles) > 0)do { if (g_hash_table_size (app->profiles) > 0) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 915, ((const char*) (__func__
)), "g_hash_table_size (app->profiles) > 0"); } while (
0)
;
916
917 g_signal_emit (app, signals[PROFILE_LIST_CHANGED], 0);
918
919 g_object_thaw_notify (object);
920}
921
922static void
923terminal_app_default_profile_notify_cb (GSettings *settings,
924 const gchar *key,
925 gpointer user_data)
926{
927 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
928 GVariant *val;
929 const char *name = NULL((void*)0);
930
931 app->default_profile_locked = !g_settings_is_writable (settings, key);
932
933 val = g_settings_get_value (settings, key);
934 if (val != NULL((void*)0) &&
935 g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
936 name = g_variant_get_string (val, NULL((void*)0));
937 if (!name || !name[0])
938 name = FALLBACK_PROFILE_ID"default";
939 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-app.c", 939, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
940
941 g_free (app->default_profile_id);
942 app->default_profile_id = g_strdup (name)g_strdup_inline (name);
943
944 app->default_profile = terminal_app_get_profile_by_name (app, name);
945
946 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
947 g_variant_unref (val);
948}
949
950static int
951compare_encodings (TerminalEncoding *a,
952 TerminalEncoding *b)
953{
954 return g_utf8_collate (a->name, b->name);
955}
956
957static void
958encoding_mark_active (gpointer key,
959 gpointer value,
960 gpointer data)
961{
962 TerminalEncoding *encoding = (TerminalEncoding *) value;
963 guint active = GPOINTER_TO_UINT (data)((guint) (gulong) (data));
964
965 encoding->is_active = active;
966}
967
968static void
969terminal_app_encoding_list_notify_cb (GSettings *settings,
970 const gchar *key,
971 gpointer user_data)
972{
973 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
974 GVariant *val;
975 const gchar **strings;
976 int i;
977 TerminalEncoding *encoding;
978 const char *charset;
979
980 app->encodings_locked = !g_settings_is_writable (settings, key);
981
982 /* Mark all as non-active, then re-enable the active ones */
983 g_hash_table_foreach (app->encodings, (GHFunc) encoding_mark_active, GUINT_TO_POINTER (FALSE)((gpointer) (gulong) ((0))));
984
985 /* First add the locale's charset */
986 encoding = g_hash_table_lookup (app->encodings, "current");
987 g_assert (encoding)do { if (encoding) ; else g_assertion_message_expr (((gchar*)
0), "terminal-app.c", 987, ((const char*) (__func__)), "encoding"
); } while (0)
;
988 if (terminal_encoding_is_valid (encoding))
989 encoding->is_active = TRUE(!(0));
990
991 /* Also always make UTF-8 available */
992 encoding = g_hash_table_lookup (app->encodings, "UTF-8");
993 g_assert (encoding)do { if (encoding) ; else g_assertion_message_expr (((gchar*)
0), "terminal-app.c", 993, ((const char*) (__func__)), "encoding"
); } while (0)
;
994 if (terminal_encoding_is_valid (encoding))
995 encoding->is_active = TRUE(!(0));
996
997 val = g_settings_get_value (settings, key);
998 if (val != NULL((void*)0) &&
999 g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY((const GVariantType *) "as")))
1000 strings = g_variant_get_strv (val, NULL((void*)0));
1001 else
1002 strings = NULL((void*)0);
1003
1004 if (strings != NULL((void*)0))
1005 {
1006 for (i = 0; strings[i] != NULL((void*)0); ++i)
1007 {
1008 charset = strings[i];
1009 if (!charset)
1010 continue;
1011
1012 encoding = terminal_app_ensure_encoding (app, charset);
1013 if (!terminal_encoding_is_valid (encoding))
1014 continue;
1015
1016 encoding->is_active = TRUE(!(0));
1017 }
1018
1019 g_free (strings);
1020 }
1021
1022 g_signal_emit (app, signals[ENCODING_LIST_CHANGED], 0);
1023
1024 if (val != NULL((void*)0))
1025 g_variant_unref (val);
1026}
1027
1028static void
1029terminal_app_system_font_notify_cb (GSettings *settings,
1030 const gchar *key,
1031 gpointer user_data)
1032{
1033 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
1034 GVariant *val;
1035 const char *font = NULL((void*)0);
1036 PangoFontDescription *font_desc;
1037
1038 if (strcmp (key, MONOSPACE_FONT_KEY"monospace-font-name") != 0)
1039 return;
1040
1041 val = g_settings_get_value (settings, key);
1042 if (val &&
1043 g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
1044 font = g_variant_get_string (val, NULL((void*)0));
1045 if (!font)
1046 font = DEFAULT_MONOSPACE_FONT("Monospace 10");
1047 g_assert (font != NULL)do { if (font != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-app.c", 1047, ((const char*) (__func__
)), "font != NULL"); } while (0)
;
1048
1049 if (font && (strlen (font) == 0)) /* empty string */
1050 font = DEFAULT_MONOSPACE_FONT("Monospace 10");
1051
1052 font_desc = pango_font_description_from_string (font);
1053 if (app->system_font_desc &&
1054 pango_font_description_equal (app->system_font_desc, font_desc))
1055 {
1056 pango_font_description_free (font_desc);
1057 return;
1058 }
1059
1060 if (app->system_font_desc)
1061 pango_font_description_free (app->system_font_desc);
1062
1063 app->system_font_desc = font_desc;
1064
1065 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_SYSTEM_FONT"system-font");
1066 g_variant_unref (val);
1067}
1068
1069static void
1070terminal_app_enable_mnemonics_notify_cb (GSettings *settings,
1071 const gchar *key,
1072 gpointer user_data)
1073{
1074 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
1075 gboolean enable;
1076
1077 enable = g_settings_get_boolean (settings, key);
1078 if (enable == app->enable_mnemonics)
1079 return;
1080
1081 app->enable_mnemonics = enable;
1082 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_ENABLE_MNEMONICS"enable-mnemonics");
1083}
1084
1085static void
1086terminal_app_enable_menu_accels_notify_cb (GSettings *settings,
1087 const gchar *key,
1088 gpointer user_data)
1089{
1090 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
1091 gboolean enable;
1092
1093 enable = g_settings_get_boolean (settings, key);
1094 if (enable == app->enable_menu_accels)
1095 return;
1096
1097 app->enable_menu_accels = enable;
1098 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_ENABLE_MENU_BAR_ACCEL"enable-menu-accels");
1099}
1100
1101static void
1102new_profile_response_cb (GtkWidget *new_profile_dialog,
1103 int response_id,
1104 TerminalApp *app)
1105{
1106 if (response_id == GTK_RESPONSE_ACCEPT)
1107 {
1108 GtkWidget *name_entry;
1109 char *name;
1110 const char *new_profile_name;
1111 GtkWidget *base_option_menu;
1112 TerminalProfile *base_profile = NULL((void*)0);
1113 TerminalProfile *new_profile;
1114 GList *profiles;
1115 GList *tmp;
1116 GtkWindow *transient_parent;
1117 GtkWidget *confirm_dialog;
1118 gint retval;
1119
1120 base_option_menu = g_object_get_data (G_OBJECT (new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), (((GType) ((20) << (2)))))))
)
, "base_option_menu");
1121 base_profile = profile_combo_box_get_selected (base_option_menu);
1122 if (!base_profile)
1123 base_profile = terminal_app_get_default_profile (app);
1124 if (!base_profile)
1125 return; /* shouldn't happen ever though */
1126
1127 name_entry = g_object_get_data (G_OBJECT (new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), (((GType) ((20) << (2)))))))
)
, "name_entry");
1128 name = gtk_editable_get_chars (GTK_EDITABLE (name_entry)((((GtkEditable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((name_entry)), ((gtk_editable_get_type ()))))))
, 0, -1);
1129 g_strstrip (name)g_strchomp (g_strchug (name)); /* name will be non empty after stripping */
1130
1131 profiles = terminal_app_get_profile_list (app);
1132 for (tmp = profiles; tmp != NULL((void*)0); tmp = tmp->next)
1133 {
1134 TerminalProfile *profile = tmp->data;
1135 const char *visible_name;
1136
1137 visible_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_VISIBLE_NAME"visible-name");
1138
1139 if (visible_name && strcmp (name, visible_name) == 0)
1140 break;
1141 }
1142 if (tmp)
1143 {
1144 confirm_dialog = gtk_message_dialog_new (GTK_WINDOW (new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), ((gtk_window_get_type ()))))))
,
1145 GTK_DIALOG_DESTROY_WITH_PARENT,
1146 GTK_MESSAGE_QUESTION,
1147 GTK_BUTTONS_YES_NO,
1148 _("You already have a profile called “%s”. Do you want to create another profile with the same name?")gettext ("You already have a profile called “%s”. Do you want to create another profile with the same name?"
)
, name);
1149 /* Alternative button order was set automatically by GtkMessageDialog */
1150 retval = gtk_dialog_run (GTK_DIALOG (confirm_dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((confirm_dialog)), ((gtk_dialog_get_type ()))))))
);
1151 gtk_widget_destroy (confirm_dialog);
1152 if (retval == GTK_RESPONSE_NO)
1153 goto cleanup;
1154 }
1155 g_list_free (profiles);
1156
1157 transient_parent = gtk_window_get_transient_for (GTK_WINDOW (new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), ((gtk_window_get_type ()))))))
);
1158
1159 new_profile = _terminal_profile_clone (base_profile, name);
1160 new_profile_name = terminal_profile_get_property_string (new_profile, TERMINAL_PROFILE_NAME"name");
1161 g_hash_table_insert (app->profiles,
1162 g_strdup (new_profile_name)g_strdup_inline (new_profile_name),
1163 new_profile /* adopts the refcount */);
1164
1165 /* And now save the new profile name to GSettings */
1166 gsettings_append_strv (settings_global,
1167 PROFILE_LIST_KEY"profile-list",
1168 new_profile_name);
1169
1170 terminal_profile_edit (new_profile, transient_parent, NULL((void*)0));
1171
1172cleanup:
1173 g_free (name);
1174 }
1175
1176 gtk_widget_destroy (new_profile_dialog);
1177}
1178
1179static void
1180new_profile_dialog_destroy_cb (GtkWidget *new_profile_dialog,
1181 TerminalApp *app)
1182{
1183 GtkWidget *combo;
1184
1185 combo = g_object_get_data (G_OBJECT (new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), (((GType) ((20) << (2)))))))
)
, "base_option_menu");
1186 g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_combo_box_refill), combo)g_signal_handlers_disconnect_matched ((app), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (profile_combo_box_refill))), (combo))
;
1187
1188 app->new_profile_dialog = NULL((void*)0);
1189}
1190
1191static void
1192new_profile_name_entry_changed_cb (GtkEntry *entry,
1193 GtkDialog *dialog)
1194{
1195 const char *name;
1196
1197 name = gtk_entry_get_text (entry);
1198
1199 /* make the create button sensitive only if something other than space has been set */
1200 while (*name != '\0' && g_ascii_isspace (*name)((g_ascii_table[(guchar) (*name)] & G_ASCII_SPACE) != 0))
1201 ++name;
1202
1203 gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_ACCEPT, name[0] != '\0');
1204}
1205
1206void
1207terminal_app_new_profile (TerminalApp *app,
1208 TerminalProfile *default_base_profile,
1209 GtkWindow *transient_parent)
1210{
1211 if (app->new_profile_dialog == NULL((void*)0))
1212 {
1213 GtkWidget *create_button, *grid, *name_label, *name_entry, *base_label, *combo;
1214
1215 if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX"/org/mate/terminal" G_DIR_SEPARATOR_S"/" "ui/profile-new-dialog.ui",
1216 "new-profile-dialog", &app->new_profile_dialog,
1217 "new-profile-create-button", &create_button,
1218 "new-profile-grid", &grid,
1219 "new-profile-name-label", &name_label,
1220 "new-profile-name-entry", &name_entry,
1221 "new-profile-base-label", &base_label,
1222 NULL((void*)0)))
1223 return;
1224
1225 g_signal_connect (G_OBJECT (app->new_profile_dialog), "response", G_CALLBACK (new_profile_response_cb), app)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((app->new_profile_dialog)), (((GType) (
(20) << (2))))))))), ("response"), (((GCallback) (new_profile_response_cb
))), (app), ((void*)0), (GConnectFlags) 0)
;
1226 g_signal_connect (app->new_profile_dialog, "destroy", G_CALLBACK (new_profile_dialog_destroy_cb), app)g_signal_connect_data ((app->new_profile_dialog), ("destroy"
), (((GCallback) (new_profile_dialog_destroy_cb))), (app), ((
void*)0), (GConnectFlags) 0)
;
1227
1228 g_object_set_data (G_OBJECT (app->new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), (((GType) ((20) << (
2))))))))
, "create_button", create_button);
1229 gtk_widget_set_sensitive (create_button, FALSE(0));
1230
1231 /* the name entry */
1232 g_object_set_data (G_OBJECT (app->new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), (((GType) ((20) << (
2))))))))
, "name_entry", name_entry);
1233 g_signal_connect (name_entry, "changed", G_CALLBACK (new_profile_name_entry_changed_cb), app->new_profile_dialog)g_signal_connect_data ((name_entry), ("changed"), (((GCallback
) (new_profile_name_entry_changed_cb))), (app->new_profile_dialog
), ((void*)0), (GConnectFlags) 0)
;
1234 gtk_entry_set_activates_default (GTK_ENTRY (name_entry)((((GtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((name_entry)), ((gtk_entry_get_type ()))))))
, TRUE(!(0)));
1235 gtk_widget_grab_focus (name_entry);
1236
1237 gtk_label_set_mnemonic_widget (GTK_LABEL (name_label)((((GtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((name_label)), ((gtk_label_get_type ()))))))
, name_entry);
1238
1239 /* the base profile option menu */
1240 combo = profile_combo_box_new (app);
1241 gtk_grid_attach (GTK_GRID (grid)((((GtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((gtk_grid_get_type ()))))))
, combo, 2, 1, 1, 1);
1242 g_object_set_data (G_OBJECT (app->new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), (((GType) ((20) << (
2))))))))
, "base_option_menu", combo);
1243 terminal_util_set_atk_name_description (combo, NULL((void*)0), _("Choose base profile")gettext ("Choose base profile"));
1244
1245 gtk_label_set_mnemonic_widget (GTK_LABEL (base_label)((((GtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((base_label)), ((gtk_label_get_type ()))))))
, combo);
1246
1247 gtk_dialog_set_default_response (GTK_DIALOG (app->new_profile_dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_dialog_get_type ()))
))))
, GTK_RESPONSE_ACCEPT);
1248 gtk_dialog_set_response_sensitive (GTK_DIALOG (app->new_profile_dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_dialog_get_type ()))
))))
, GTK_RESPONSE_ACCEPT, FALSE(0));
1249 }
1250
1251 gtk_window_set_transient_for (GTK_WINDOW (app->new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_window_get_type ()))
))))
,
1252 transient_parent);
1253
1254 gtk_window_present (GTK_WINDOW (app->new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_window_get_type ()))
))))
);
1255}
1256
1257static void
1258profile_list_selection_changed_cb (GtkTreeSelection *selection,
1259 TerminalApp *app)
1260{
1261 gboolean selected;
1262
1263 selected = gtk_tree_selection_get_selected (selection, NULL((void*)0), NULL((void*)0));
1264
1265 gtk_widget_set_sensitive (app->manage_profiles_edit_button, selected);
1266 gtk_widget_set_sensitive (app->manage_profiles_delete_button,
1267 selected &&
1268 g_hash_table_size (app->profiles) > 1);
1269}
1270
1271static void
1272profile_list_response_cb (GtkWidget *dialog,
1273 int id,
1274 TerminalApp *app)
1275{
1276 g_assert (app->manage_profiles_dialog == dialog)do { if (app->manage_profiles_dialog == dialog) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1276, ((const char*) (__func__
)), "app->manage_profiles_dialog == dialog"); } while (0)
;
1277
1278 if (id == GTK_RESPONSE_HELP)
1279 {
1280 terminal_util_show_help ("mate-terminal-manage-profiles", GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
);
1281 return;
1282 }
1283
1284 gtk_widget_destroy (dialog);
1285}
1286
1287static void
1288profile_list_destroyed_cb (GtkWidget *manage_profiles_dialog,
1289 TerminalApp *app)
1290{
1291 g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_list_treeview_refill), app->manage_profiles_list)g_signal_handlers_disconnect_matched ((app), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (profile_list_treeview_refill))), (app->
manage_profiles_list))
;
1292 g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_combo_box_refill), app->manage_profiles_default_menu)g_signal_handlers_disconnect_matched ((app), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (profile_combo_box_refill))), (app->manage_profiles_default_menu
))
;
1293
1294 app->manage_profiles_dialog = NULL((void*)0);
1295 app->manage_profiles_list = NULL((void*)0);
1296 app->manage_profiles_new_button = NULL((void*)0);
1297 app->manage_profiles_edit_button = NULL((void*)0);
1298 app->manage_profiles_delete_button = NULL((void*)0);
1299 app->manage_profiles_default_menu = NULL((void*)0);
1300}
1301
1302void
1303terminal_app_manage_profiles (TerminalApp *app,
1304 GtkWindow *transient_parent)
1305{
1306 GObject *dialog;
1307 GObject *tree_view_container, *new_button, *edit_button, *remove_button;
1308 GObject *default_hbox, *default_label;
1309 GtkTreeSelection *selection;
1310
1311 if (app->manage_profiles_dialog)
1312 {
1313 gtk_window_set_transient_for (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
, transient_parent);
1314 gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
);
1315 return;
1316 }
1317
1318 if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX"/org/mate/terminal" G_DIR_SEPARATOR_S"/" "ui/profile-manager.ui",
1319 "profile-manager", &dialog,
1320 "profiles-treeview-container", &tree_view_container,
1321 "new-profile-button", &new_button,
1322 "edit-profile-button", &edit_button,
1323 "delete-profile-button", &remove_button,
1324 "default-profile-hbox", &default_hbox,
1325 "default-profile-label", &default_label,
1326 NULL((void*)0)))
1327 return;
1328
1329 app->manage_profiles_dialog = GTK_WIDGET (dialog)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_widget_get_type ()))))))
;
1330 app->manage_profiles_new_button = GTK_WIDGET (new_button)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_button)), ((gtk_widget_get_type ()))))))
;
1331 app->manage_profiles_edit_button = GTK_WIDGET (edit_button)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((edit_button)), ((gtk_widget_get_type ()))))))
;
1332 app->manage_profiles_delete_button = GTK_WIDGET (remove_button)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((remove_button)), ((gtk_widget_get_type ()))))))
;
1333
1334 g_signal_connect (dialog, "response", G_CALLBACK (profile_list_response_cb), app)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_response_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1335 g_signal_connect (dialog, "destroy", G_CALLBACK (profile_list_destroyed_cb), app)g_signal_connect_data ((dialog), ("destroy"), (((GCallback) (
profile_list_destroyed_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1336
1337 app->manage_profiles_list = profile_list_treeview_create (app);
1338
1339 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (app->manage_profiles_list)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_list)), ((gtk_tree_view_get_type
()))))))
);
1340 g_signal_connect (selection, "changed", G_CALLBACK (profile_list_selection_changed_cb), app)g_signal_connect_data ((selection), ("changed"), (((GCallback
) (profile_list_selection_changed_cb))), (app), ((void*)0), (
GConnectFlags) 0)
;
1341
1342 profile_list_treeview_refill (app, app->manage_profiles_list);
1343 g_signal_connect (app, "profile-list-changed",g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_list_treeview_refill))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1344 G_CALLBACK (profile_list_treeview_refill), app->manage_profiles_list)g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_list_treeview_refill))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1345
1346 g_signal_connect (app->manage_profiles_list, "row-activated",g_signal_connect_data ((app->manage_profiles_list), ("row-activated"
), (((GCallback) (profile_list_row_activated_cb))), (app), ((
void*)0), (GConnectFlags) 0)
1347 G_CALLBACK (profile_list_row_activated_cb), app)g_signal_connect_data ((app->manage_profiles_list), ("row-activated"
), (((GCallback) (profile_list_row_activated_cb))), (app), ((
void*)0), (GConnectFlags) 0)
;
1348
1349 gtk_container_add (GTK_CONTAINER (tree_view_container)((((GtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view_container)), ((gtk_container_get_type ()))))))
, app->manage_profiles_list);
1350 gtk_widget_show (app->manage_profiles_list);
1351
1352 g_signal_connect (new_button, "clicked",g_signal_connect_data ((new_button), ("clicked"), (((GCallback
) (profile_list_new_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1353 G_CALLBACK (profile_list_new_button_clicked_cb),g_signal_connect_data ((new_button), ("clicked"), (((GCallback
) (profile_list_new_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1354 app->manage_profiles_list)g_signal_connect_data ((new_button), ("clicked"), (((GCallback
) (profile_list_new_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1355 g_signal_connect (edit_button, "clicked",g_signal_connect_data ((edit_button), ("clicked"), (((GCallback
) (profile_list_edit_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1356 G_CALLBACK (profile_list_edit_button_clicked_cb),g_signal_connect_data ((edit_button), ("clicked"), (((GCallback
) (profile_list_edit_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1357 app->manage_profiles_list)g_signal_connect_data ((edit_button), ("clicked"), (((GCallback
) (profile_list_edit_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1358 g_signal_connect (remove_button, "clicked",g_signal_connect_data ((remove_button), ("clicked"), (((GCallback
) (profile_list_delete_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1359 G_CALLBACK (profile_list_delete_button_clicked_cb),g_signal_connect_data ((remove_button), ("clicked"), (((GCallback
) (profile_list_delete_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1360 app->manage_profiles_list)g_signal_connect_data ((remove_button), ("clicked"), (((GCallback
) (profile_list_delete_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1361
1362 app->manage_profiles_default_menu = profile_combo_box_new (app);
1363 g_signal_connect (app->manage_profiles_default_menu, "changed",g_signal_connect_data ((app->manage_profiles_default_menu)
, ("changed"), (((GCallback) (profile_combo_box_changed_cb)))
, (app), ((void*)0), (GConnectFlags) 0)
1364 G_CALLBACK (profile_combo_box_changed_cb), app)g_signal_connect_data ((app->manage_profiles_default_menu)
, ("changed"), (((GCallback) (profile_combo_box_changed_cb)))
, (app), ((void*)0), (GConnectFlags) 0)
;
1365
1366 gtk_box_pack_start (GTK_BOX (default_hbox)((((GtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((default_hbox)), ((gtk_box_get_type ()))))))
, app->manage_profiles_default_menu, FALSE(0), FALSE(0), 0);
1367 gtk_widget_show (app->manage_profiles_default_menu);
1368
1369 gtk_label_set_mnemonic_widget (GTK_LABEL (default_label)((((GtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((default_label)), ((gtk_label_get_type ()))))))
, app->manage_profiles_default_menu);
1370
1371 gtk_widget_grab_focus (app->manage_profiles_list);
1372
1373 gtk_window_set_transient_for (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
,
1374 transient_parent);
1375
1376 gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
);
1377}
1378
1379#ifdef HAVE_SMCLIENT1
1380static void
1381terminal_app_save_state_cb (EggSMClient *client,
1382 GKeyFile *key_file,
1383 TerminalApp *app)
1384{
1385 terminal_app_save_config (app, key_file);
1386}
1387
1388static void
1389terminal_app_client_quit_cb (EggSMClient *client,
1390 TerminalApp *app)
1391{
1392 g_signal_emit (app, signals[QUIT], 0);
1393}
1394#endif /* HAVE_SMCLIENT */
1395
1396/* Class implementation */
1397
1398G_DEFINE_TYPE (TerminalApp, terminal_app, G_TYPE_OBJECT)static void terminal_app_init (TerminalApp *self); static void
terminal_app_class_init (TerminalAppClass *klass); static GType
terminal_app_get_type_once (void); static gpointer terminal_app_parent_class
= ((void*)0); static gint TerminalApp_private_offset; static
void terminal_app_class_intern_init (gpointer klass) { terminal_app_parent_class
= g_type_class_peek_parent (klass); if (TerminalApp_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &TerminalApp_private_offset
); terminal_app_class_init ((TerminalAppClass*) klass); } __attribute__
((__unused__)) static inline gpointer terminal_app_get_instance_private
(TerminalApp *self) { return (((gpointer) ((guint8*) (self) +
(glong) (TerminalApp_private_offset)))); } GType terminal_app_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ _Static_assert (sizeof *(&static_g_define_type_id) ==
sizeof (gpointer), "Expression evaluates to false"); (void) (
0 ? (gpointer) *(&static_g_define_type_id) : ((void*)0));
(!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = terminal_app_get_type_once
(); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } __attribute__ ((__noinline__)) static GType terminal_app_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
(((GType) ((20) << (2))), g_intern_static_string ("TerminalApp"
), sizeof (TerminalAppClass), (GClassInitFunc)(void (*)(void)
) terminal_app_class_intern_init, sizeof (TerminalApp), (GInstanceInitFunc
)(void (*)(void)) terminal_app_init, (GTypeFlags) 0); { {{};}
} return g_define_type_id; }
1399
1400static void
1401terminal_app_init (TerminalApp *app)
1402{
1403 global_app = app;
1404
1405 gtk_window_set_default_icon_name (MATE_TERMINAL_ICON_NAME"utilities-terminal");
1406
1407 /* Initialise defaults */
1408 app->enable_mnemonics = DEFAULT_ENABLE_MNEMONICS((!(0)));
1409 app->enable_menu_accels = DEFAULT_ENABLE_MENU_BAR_ACCEL((!(0)));
1410
1411 app->profiles = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
1412
1413 app->encodings = terminal_encodings_get_builtins ();
1414
1415 settings_global = g_settings_new (CONF_GLOBAL_SCHEMA"org.mate.terminal" ".global");
1416 app->settings_font = g_settings_new (MONOSPACE_FONT_SCHEMA"org.mate.interface");
1417
1418 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1419 "changed::" PROFILE_LIST_KEY,g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1420 G_CALLBACK(terminal_app_profile_list_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1421 app)g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
;
1422
1423 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
1424 "changed::" DEFAULT_PROFILE_KEY,g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
1425 G_CALLBACK(terminal_app_default_profile_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
1426 app)g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
;
1427
1428 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1429 "changed::" ENCODING_LIST_KEY,g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1430 G_CALLBACK(terminal_app_encoding_list_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1431 app)g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
;
1432
1433 g_signal_connect (app->settings_font,g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1434 "changed::" MONOSPACE_FONT_KEY,g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1435 G_CALLBACK(terminal_app_system_font_notify_cb),g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1436 app)g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
;
1437
1438 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
1439 "changed::" ENABLE_MNEMONICS_KEY,g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
1440 G_CALLBACK(terminal_app_enable_mnemonics_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
1441 app)g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
;
1442
1443 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
1444 "changed::" ENABLE_MENU_BAR_ACCEL_KEY,g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
1445 G_CALLBACK(terminal_app_enable_menu_accels_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
1446 app)g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
;
1447
1448 /* Load the settings */
1449 terminal_app_profile_list_notify_cb (settings_global,
1450 PROFILE_LIST_KEY"profile-list",
1451 app);
1452 terminal_app_default_profile_notify_cb (settings_global,
1453 DEFAULT_PROFILE_KEY"default-profile",
1454 app);
1455 terminal_app_encoding_list_notify_cb (settings_global,
1456 ENCODING_LIST_KEY"active-encodings",
1457 app);
1458 terminal_app_system_font_notify_cb (app->settings_font,
1459 MONOSPACE_FONT_KEY"monospace-font-name",
1460 app);
1461 terminal_app_enable_menu_accels_notify_cb (settings_global,
1462 ENABLE_MENU_BAR_ACCEL_KEY"use-menu-accelerators",
1463 app);
1464 terminal_app_enable_mnemonics_notify_cb (settings_global,
1465 ENABLE_MNEMONICS_KEY"use-mnemonics",
1466 app);
1467
1468 /* Ensure we have valid settings */
1469 g_assert (app->default_profile_id != NULL)do { if (app->default_profile_id != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1469, ((const char*) (__func__
)), "app->default_profile_id != NULL"); } while (0)
;
1470 g_assert (app->system_font_desc != NULL)do { if (app->system_font_desc != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1470, ((const char*) (__func__
)), "app->system_font_desc != NULL"); } while (0)
;
1471
1472 terminal_accels_init ();
1473
1474#ifdef HAVE_SMCLIENT1
1475 EggSMClient *sm_client;
1476 char *desktop_file;
1477
1478 desktop_file = g_build_filename (TERM_DATADIR"/usr/local/share",
1479 "applications",
1480 PACKAGE"mate-terminal" ".desktop",
1481 NULL((void*)0));
1482 egg_set_desktop_file_without_defaults (desktop_file);
1483 g_free (desktop_file);
1484
1485 sm_client = egg_sm_client_get ();
1486 g_signal_connect (sm_client, "save-state",g_signal_connect_data ((sm_client), ("save-state"), (((GCallback
) (terminal_app_save_state_cb))), (app), ((void*)0), (GConnectFlags
) 0)
1487 G_CALLBACK (terminal_app_save_state_cb), app)g_signal_connect_data ((sm_client), ("save-state"), (((GCallback
) (terminal_app_save_state_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1488 g_signal_connect (sm_client, "quit",g_signal_connect_data ((sm_client), ("quit"), (((GCallback) (
terminal_app_client_quit_cb))), (app), ((void*)0), (GConnectFlags
) 0)
1489 G_CALLBACK (terminal_app_client_quit_cb), app)g_signal_connect_data ((sm_client), ("quit"), (((GCallback) (
terminal_app_client_quit_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1490#endif /* HAVE_SMCLIENT */
1491}
1492
1493static void
1494terminal_app_finalize (GObject *object)
1495{
1496 TerminalApp *app = TERMINAL_APP (object)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_app_get_type ()))))))
;
1497
1498#ifdef HAVE_SMCLIENT1
1499 EggSMClient *sm_client;
1500
1501 sm_client = egg_sm_client_get ();
1502 g_signal_handlers_disconnect_matched (sm_client, G_SIGNAL_MATCH_DATA,
1503 0, 0, NULL((void*)0), NULL((void*)0), app);
1504#endif /* HAVE_SMCLIENT */
1505
1506 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
))
1507 G_CALLBACK(terminal_app_profile_list_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
))
1508 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
))
;
1509 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_default_profile_notify_cb))),
(app))
1510 G_CALLBACK(terminal_app_default_profile_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_default_profile_notify_cb))),
(app))
1511 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_default_profile_notify_cb))),
(app))
;
1512 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_encoding_list_notify_cb))), (
app))
1513 G_CALLBACK(terminal_app_encoding_list_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_encoding_list_notify_cb))), (
app))
1514 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_encoding_list_notify_cb))), (
app))
;
1515 g_signal_handlers_disconnect_by_func (app->settings_font,g_signal_handlers_disconnect_matched ((app->settings_font)
, (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (terminal_app_system_font_notify_cb
))), (app))
1516 G_CALLBACK(terminal_app_system_font_notify_cb),g_signal_handlers_disconnect_matched ((app->settings_font)
, (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (terminal_app_system_font_notify_cb
))), (app))
1517 app)g_signal_handlers_disconnect_matched ((app->settings_font)
, (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (terminal_app_system_font_notify_cb
))), (app))
;
1518 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_menu_accels_notify_cb)
)), (app))
1519 G_CALLBACK(terminal_app_enable_menu_accels_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_menu_accels_notify_cb)
)), (app))
1520 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_menu_accels_notify_cb)
)), (app))
;
1521 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_mnemonics_notify_cb)))
, (app))
1522 G_CALLBACK(terminal_app_enable_mnemonics_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_mnemonics_notify_cb)))
, (app))
1523 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_mnemonics_notify_cb)))
, (app))
;
1524
1525 g_object_unref (settings_global);
1526 g_object_unref (app->settings_font);
1527
1528 g_free (app->default_profile_id);
1529
1530 g_hash_table_destroy (app->profiles);
1531
1532 g_hash_table_destroy (app->encodings);
1533
1534 pango_font_description_free (app->system_font_desc);
1535
1536 terminal_accels_shutdown ();
1537
1538 G_OBJECT_CLASS (terminal_app_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_app_parent_class)), (((GType) ((20) << (2
))))))))
->finalize (object);
1539
1540 global_app = NULL((void*)0);
1541}
1542
1543static void
1544terminal_app_get_property (GObject *object,
1545 guint prop_id,
1546 GValue *value,
1547 GParamSpec *pspec)
1548{
1549 TerminalApp *app = TERMINAL_APP (object)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_app_get_type ()))))))
;
1550
1551 switch (prop_id)
1552 {
1553 case PROP_SYSTEM_FONT:
1554 if (app->system_font_desc)
1555 g_value_set_boxed (value, app->system_font_desc);
1556 else
1557 g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_MONOSPACE_FONT("Monospace 10")));
1558 break;
1559 case PROP_ENABLE_MENU_BAR_ACCEL:
1560 g_value_set_boolean (value, app->enable_menu_accels);
1561 break;
1562 case PROP_ENABLE_MNEMONICS:
1563 g_value_set_boolean (value, app->enable_mnemonics);
1564 break;
1565 case PROP_DEFAULT_PROFILE:
1566 g_value_set_object (value, app->default_profile);
1567 break;
1568 default:
1569 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-app.c", 1569, ("property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1570 break;
1571 }
1572}
1573
1574static void
1575terminal_app_set_property (GObject *object,
1576 guint prop_id,
1577 const GValue *value,
1578 GParamSpec *pspec)
1579{
1580 TerminalApp *app = TERMINAL_APP (object)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_app_get_type ()))))))
;
1581
1582 switch (prop_id)
1583 {
1584 case PROP_ENABLE_MENU_BAR_ACCEL:
1585 app->enable_menu_accels = g_value_get_boolean (value);
1586 g_settings_set_boolean (settings_global, ENABLE_MENU_BAR_ACCEL_KEY"use-menu-accelerators", app->enable_menu_accels);
1587 break;
1588 case PROP_ENABLE_MNEMONICS:
1589 app->enable_mnemonics = g_value_get_boolean (value);
1590 g_settings_set_boolean (settings_global, ENABLE_MNEMONICS_KEY"use-mnemonics", app->enable_mnemonics);
1591 break;
1592 case PROP_DEFAULT_PROFILE:
1593 case PROP_SYSTEM_FONT:
1594 /* not writable */
1595 default:
1596 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-app.c", 1596, ("property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1597 break;
1598 }
1599}
1600
1601static void
1602terminal_app_real_quit (TerminalApp *app)
1603{
1604 gtk_main_quit();
1605}
1606
1607static void
1608terminal_app_class_init (TerminalAppClass *klass)
1609{
1610 GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
;
1611
1612 object_class->finalize = terminal_app_finalize;
1613 object_class->get_property = terminal_app_get_property;
1614 object_class->set_property = terminal_app_set_property;
1615
1616 klass->quit = terminal_app_real_quit;
1617
1618 signals[QUIT] =
1619 g_signal_new (I_("quit")g_intern_static_string ("quit"),
1620 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1621 G_SIGNAL_RUN_LAST,
1622 G_STRUCT_OFFSET (TerminalAppClass, quit)((glong) __builtin_offsetof(TerminalAppClass, quit)),
1623 NULL((void*)0), NULL((void*)0),
1624 g_cclosure_marshal_VOID__VOID,
1625 G_TYPE_NONE((GType) ((1) << (2))), 0);
1626
1627 signals[PROFILE_LIST_CHANGED] =
1628 g_signal_new (I_("profile-list-changed")g_intern_static_string ("profile-list-changed"),
1629 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1630 G_SIGNAL_RUN_LAST,
1631 G_STRUCT_OFFSET (TerminalAppClass, profile_list_changed)((glong) __builtin_offsetof(TerminalAppClass, profile_list_changed
))
,
1632 NULL((void*)0), NULL((void*)0),
1633 g_cclosure_marshal_VOID__VOID,
1634 G_TYPE_NONE((GType) ((1) << (2))), 0);
1635
1636 signals[ENCODING_LIST_CHANGED] =
1637 g_signal_new (I_("encoding-list-changed")g_intern_static_string ("encoding-list-changed"),
1638 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1639 G_SIGNAL_RUN_LAST,
1640 G_STRUCT_OFFSET (TerminalAppClass, profile_list_changed)((glong) __builtin_offsetof(TerminalAppClass, profile_list_changed
))
,
1641 NULL((void*)0), NULL((void*)0),
1642 g_cclosure_marshal_VOID__VOID,
1643 G_TYPE_NONE((GType) ((1) << (2))), 0);
1644
1645 g_object_class_install_property
1646 (object_class,
1647 PROP_ENABLE_MENU_BAR_ACCEL,
1648 g_param_spec_boolean (TERMINAL_APP_ENABLE_MENU_BAR_ACCEL"enable-menu-accels", NULL((void*)0), NULL((void*)0),
1649 DEFAULT_ENABLE_MENU_BAR_ACCEL((!(0))),
1650 G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1651
1652 g_object_class_install_property
1653 (object_class,
1654 PROP_ENABLE_MNEMONICS,
1655 g_param_spec_boolean (TERMINAL_APP_ENABLE_MNEMONICS"enable-mnemonics", NULL((void*)0), NULL((void*)0),
1656 DEFAULT_ENABLE_MNEMONICS((!(0))),
1657 G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1658
1659 g_object_class_install_property
1660 (object_class,
1661 PROP_SYSTEM_FONT,
1662 g_param_spec_boxed (TERMINAL_APP_SYSTEM_FONT"system-font", NULL((void*)0), NULL((void*)0),
1663 PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()),
1664 G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1665
1666 g_object_class_install_property
1667 (object_class,
1668 PROP_DEFAULT_PROFILE,
1669 g_param_spec_object (TERMINAL_APP_DEFAULT_PROFILE"default-profile", NULL((void*)0), NULL((void*)0),
1670 TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()),
1671 G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1672}
1673
1674/* Public API */
1675
1676TerminalApp*
1677terminal_app_get (void)
1678{
1679 if (global_app == NULL((void*)0))
1680 {
1681 g_object_new (TERMINAL_TYPE_APP(terminal_app_get_type ()), NULL((void*)0));
1682 g_assert (global_app != NULL)do { if (global_app != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1682, ((const char*) (__func__
)), "global_app != NULL"); } while (0)
;
1683 }
1684
1685 return global_app;
1686}
1687
1688void
1689terminal_app_shutdown (void)
1690{
1691 if (global_app == NULL((void*)0))
1692 return;
1693
1694 g_object_unref (global_app);
1695 g_assert (global_app == NULL)do { if (global_app == ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1695, ((const char*) (__func__
)), "global_app == NULL"); } while (0)
;
1696}
1697
1698/**
1699 * terminal_app_handle_options:
1700 * @app:
1701 * @options: a #TerminalOptions
1702 * @allow_resume: whether to merge the terminal configuration from the
1703 * saved session on resume
1704 * @error: a #GError to fill in
1705 *
1706 * Processes @options. It loads or saves the terminal configuration, or
1707 * opens the specified windows and tabs.
1708 *
1709 * Returns: %TRUE if @options could be successfully handled, or %FALSE on
1710 * error
1711 */
1712gboolean
1713terminal_app_handle_options (TerminalApp *app,
1714 TerminalOptions *options,
1715 gboolean allow_resume,
1716 GError **error)
1717{
1718 GList *lw;
1719 GdkScreen *gdk_screen;
1720
1721 gdk_screen = terminal_app_get_screen_by_display_name (options->display_name);
1722
1723 if (options->save_config)
1724 {
1725 if (options->remote_arguments)
1726 return terminal_app_save_config_file (app, options->config_file, error);
1727
1728 g_set_error_literal (error, TERMINAL_OPTION_ERROR(g_quark_from_static_string ("terminal-option-error")), TERMINAL_OPTION_ERROR_NOT_IN_FACTORY,
1729 "Cannot use \"--save-config\" when starting the factory process");
1730 return FALSE(0);
1731 }
1732
1733 if (options->load_config)
1734 {
1735 GKeyFile *key_file;
1736 gboolean result;
1737
1738 key_file = g_key_file_new ();
1739 result = g_key_file_load_from_file (key_file, options->config_file, 0, error) &&
1740 terminal_options_merge_config (options, key_file, SOURCE_DEFAULT, error);
1741 g_key_file_free (key_file);
1742
1743 if (!result)
1744 return FALSE(0);
1745
1746 /* fall-through on success */
1747 }
1748
1749#ifdef HAVE_SMCLIENT1
1750 EggSMClient *sm_client;
1751
1752 sm_client = egg_sm_client_get ();
1753
1754 if (allow_resume && egg_sm_client_is_resumed (sm_client))
1755 {
1756 GKeyFile *key_file;
1757
1758 key_file = egg_sm_client_get_state_file (sm_client);
1759 if (key_file != NULL((void*)0) &&
1760 !terminal_options_merge_config (options, key_file, SOURCE_SESSION, error))
1761 return FALSE(0);
1762 }
1763#endif /* HAVE_SMCLIENT */
1764
1765 /* Make sure we open at least one window */
1766 terminal_options_ensure_window (options);
1767
1768 if (options->startup_id != NULL((void*)0))
1769 _terminal_debug_print (TERMINAL_DEBUG_FACTORY,do { if (0) g_printerr("Startup ID is '%s'\n", options->startup_id
); } while (0)
1770 "Startup ID is '%s'\n",do { if (0) g_printerr("Startup ID is '%s'\n", options->startup_id
); } while (0)
1771 options->startup_id)do { if (0) g_printerr("Startup ID is '%s'\n", options->startup_id
); } while (0)
;
1772
1773 for (lw = options->initial_windows; lw != NULL((void*)0); lw = lw->next)
1774 {
1775 InitialWindow *iw = lw->data;
1776 TerminalWindow *window = NULL((void*)0);
1777 GList *lt;
1778
1779 g_assert (iw->tabs)do { if (iw->tabs) ; else g_assertion_message_expr (((gchar
*) 0), "terminal-app.c", 1779, ((const char*) (__func__)), "iw->tabs"
); } while (0)
;
1780
1781 if ( lw == options->initial_windows && ((InitialTab *)iw->tabs->data)->attach_window )
1782 window = terminal_app_get_current_window(app, gdk_screen, options->initial_workspace);
1783
1784 if (!window)
1785 {
1786 /* Create & setup new window */
1787 window = terminal_app_new_window (app, gdk_screen);
1788
1789 /* Restored windows shouldn't demand attention; see bug #586308. */
1790 if (iw->source_tag == SOURCE_SESSION)
1791 terminal_window_set_is_restored (window);
1792
1793 if (options->startup_id != NULL((void*)0))
1794 gtk_window_set_startup_id (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
, options->startup_id);
1795
1796 /* Overwrite the default, unique window role set in terminal_window_init */
1797 if (iw->role)
1798 gtk_window_set_role (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
, iw->role);
1799
1800 if (iw->force_menubar_state)
1801 terminal_window_set_menubar_visible (window, iw->menubar_state);
1802
1803 if (iw->start_fullscreen)
1804 gtk_window_fullscreen (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
);
1805 if (iw->start_maximized)
1806 gtk_window_maximize (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
);
1807 }
1808
1809 /* Now add the tabs */
1810 for (lt = iw->tabs; lt != NULL((void*)0); lt = lt->next)
1811 {
1812 InitialTab *it = lt->data;
1813 TerminalProfile *profile = NULL((void*)0);
1814 TerminalScreen *screen;
1815 const char *profile_name;
1816 gboolean profile_is_id;
1817
1818 if (it->profile)
1819 {
1820 profile_name = it->profile;
1821 profile_is_id = it->profile_is_id;
1822 }
1823 else
1824 {
1825 profile_name = options->default_profile;
1826 profile_is_id = options->default_profile_is_id;
1827 }
1828
1829 if (profile_name)
1830 {
1831 if (profile_is_id)
1832 profile = terminal_app_get_profile_by_name (app, profile_name);
1833 else
1834 profile = terminal_app_get_profile_by_visible_name (app, profile_name);
1835
1836 if (profile == NULL((void*)0))
1837 g_printerr (_("No such profile \"%s\", using default profile\n")gettext ("No such profile \"%s\", using default profile\n"), it->profile);
1838 }
1839 if (profile == NULL((void*)0))
1840 profile = terminal_app_get_profile_for_new_term (app);
1841 g_assert (profile)do { if (profile) ; else g_assertion_message_expr (((gchar*) 0
), "terminal-app.c", 1841, ((const char*) (__func__)), "profile"
); } while (0)
;
1842
1843 screen = terminal_app_new_terminal (app, window, profile,
1844 it->exec_argv ? it->exec_argv : options->exec_argv,
1845 it->title ? it->title : options->default_title,
1846 it->working_dir ? it->working_dir : options->default_working_dir,
1847 options->env,
1848 it->zoom_set ? it->zoom : options->zoom);
1849
1850 if (it->active)
1851 terminal_window_switch_screen (window, screen);
1852 }
1853
1854 if (iw->geometry)
1855 {
1856 _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,do { if (0) g_printerr("[window %p] applying geometry %s\n", window
, iw->geometry); } while (0)
1857 "[window %p] applying geometry %s\n",do { if (0) g_printerr("[window %p] applying geometry %s\n", window
, iw->geometry); } while (0)
1858 window, iw->geometry)do { if (0) g_printerr("[window %p] applying geometry %s\n", window
, iw->geometry); } while (0)
;
1859
1860 if (!terminal_window_update_size_set_geometry (window,
1861 terminal_window_get_active (window),
1862 FALSE(0),
1863 iw->geometry))
1864 g_printerr (_("Invalid geometry string \"%s\"\n")gettext ("Invalid geometry string \"%s\"\n"), iw->geometry);
1865 }
1866
1867 gtk_window_present (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
);
1868 }
1869
1870 return TRUE(!(0));
1871}
1872
1873TerminalWindow *
1874terminal_app_new_window (TerminalApp *app,
1875 GdkScreen *screen)
1876{
1877 TerminalWindow *window;
1878
1879 window = terminal_window_new ();
1880
1881 app->windows = g_list_append (app->windows, window);
1882 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
terminal_window_destroyed))), (app), ((void*)0), (GConnectFlags
) 0)
1883 G_CALLBACK (terminal_window_destroyed), app)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
terminal_window_destroyed))), (app), ((void*)0), (GConnectFlags
) 0)
;
1884
1885 if (screen)
1886 gtk_window_set_screen (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
, screen);
1887
1888 return window;
1889}
1890
1891TerminalScreen *
1892terminal_app_new_terminal (TerminalApp *app,
1893 TerminalWindow *window,
1894 TerminalProfile *profile,
1895 char **override_command,
1896 const char *title,
1897 const char *working_dir,
1898 char **child_env,
1899 double zoom)
1900{
1901 TerminalScreen *screen;
1902
1903 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
1904 g_return_val_if_fail (TERMINAL_IS_WINDOW (window), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((terminal_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_WINDOW (window)"); return (((void
*)0)); } } while (0)
;
1905
1906 screen = terminal_screen_new (profile, override_command, title,
1907 working_dir, child_env, zoom);
1908
1909 terminal_window_add_screen (window, screen, -1);
1910 terminal_window_switch_screen (window, screen);
1911 gtk_widget_grab_focus (GTK_WIDGET (screen)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((screen)), ((gtk_widget_get_type ()))))))
);
1912
1913 return screen;
1914}
1915
1916void
1917terminal_app_edit_profile (TerminalApp *app,
1918 TerminalProfile *profile,
1919 GtkWindow *transient_parent,
1920 const char *widget_name)
1921{
1922 terminal_profile_edit (profile, transient_parent, widget_name);
1923}
1924
1925void
1926terminal_app_edit_keybindings (TerminalApp *app,
1927 GtkWindow *transient_parent)
1928{
1929 terminal_edit_keys_dialog_show (transient_parent);
1930}
1931
1932void
1933terminal_app_edit_encodings (TerminalApp *app,
1934 GtkWindow *transient_parent)
1935{
1936 terminal_encoding_dialog_show (transient_parent);
1937}
1938
1939/*
1940* Get the window in the given screen and workspace. If nothing is found,
1941* a NULL is returned.
1942*/
1943TerminalWindow *
1944terminal_app_get_current_window (TerminalApp *app,
1945 GdkScreen *from_screen,
1946 int workspace)
1947{
1948 GList *res = NULL((void*)0);
1949 TerminalWindow *ret = NULL((void*)0);
1950
1951 if (app->windows == NULL((void*)0))
1952 return NULL((void*)0);
1953
1954 res = g_list_last (app->windows);
1955
1956 g_assert (from_screen != NULL)do { if (from_screen != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1956, ((const char*) (__func__
)), "from_screen != NULL"); } while (0)
;
1957
1958 while (res)
1959 {
1960 int win_workspace;
1961 if (gtk_window_get_screen(GTK_WINDOW(res->data)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((res->data)), ((gtk_window_get_type ()))))))
) != from_screen)
1962 continue;
1963
1964 win_workspace = terminal_app_get_workspace_for_window(res->data);
1965
1966 /* Same workspace or if the window is set to show up on all workspaces */
1967 if (win_workspace == workspace || win_workspace == -1)
1968 ret = terminal_window_get_latest_focused (ret, TERMINAL_WINDOW(res->data)((((TerminalWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((res->data)), ((terminal_window_get_type ()))))))
);
1969
1970 res = g_list_previous (res)((res) ? (((GList *)(res))->prev) : ((void*)0));
1971 }
1972
1973 return ret;
1974}
1975
1976/**
1977 * terminal_profile_get_list:
1978 *
1979 * Returns: a #GList containing all #TerminalProfile objects.
1980 * The content of the list is owned by the backend and
1981 * should not be modified or freed. Use g_list_free() when done
1982 * using the list.
1983 */
1984GList*
1985terminal_app_get_profile_list (TerminalApp *app)
1986{
1987 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
1988
1989 return g_list_sort (g_hash_table_get_values (app->profiles), profiles_alphabetic_cmp);
1990}
1991
1992TerminalProfile*
1993terminal_app_get_profile_by_name (TerminalApp *app,
1994 const char *name)
1995{
1996 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
1997 g_return_val_if_fail (name != NULL, NULL)do { if ((name != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "name != NULL"); return
(((void*)0)); } } while (0)
;
1998
1999 return g_hash_table_lookup (app->profiles, name);
2000}
2001
2002TerminalProfile*
2003terminal_app_get_profile_by_visible_name (TerminalApp *app,
2004 const char *name)
2005{
2006 LookupInfo info;
2007
2008 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
2009 g_return_val_if_fail (name != NULL, NULL)do { if ((name != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "name != NULL"); return
(((void*)0)); } } while (0)
;
2010
2011 info.result = NULL((void*)0);
2012 info.target = name;
2013
2014 g_hash_table_foreach (app->profiles,
2015 profiles_lookup_by_visible_name_foreach,
2016 &info);
2017 return info.result;
2018}
2019
2020TerminalProfile*
2021terminal_app_get_default_profile (TerminalApp *app)
2022{
2023 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
2024
2025 return app->default_profile;
2026}
2027
2028TerminalProfile*
2029terminal_app_get_profile_for_new_term (TerminalApp *app)
2030{
2031 GHashTableIter iter;
2032 TerminalProfile *profile = NULL((void*)0);
2033 TerminalProfile **profileptr = &profile;
2034
2035 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
2036
2037 if (app->default_profile)
2038 return app->default_profile;
2039
2040 g_hash_table_iter_init (&iter, app->profiles);
2041 if (g_hash_table_iter_next (&iter, NULL((void*)0), (gpointer *) profileptr))
2042 return profile;
2043
2044 return NULL((void*)0);
2045}
2046
2047GHashTable *
2048terminal_app_get_encodings (TerminalApp *app)
2049{
2050 return app->encodings;
2051}
2052
2053/**
2054 * terminal_app_ensure_encoding:
2055 * @app:
2056 * @charset:
2057 *
2058 * Ensures there's a #TerminalEncoding for @charset available.
2059 */
2060TerminalEncoding *
2061terminal_app_ensure_encoding (TerminalApp *app,
2062 const char *charset)
2063{
2064 TerminalEncoding *encoding;
2065
2066 encoding = g_hash_table_lookup (app->encodings, charset);
2067 if (encoding == NULL((void*)0))
2068 {
2069 encoding = terminal_encoding_new (charset,
2070 _("User Defined")gettext ("User Defined"),
2071 TRUE(!(0)),
2072 TRUE(!(0)) /* scary! */);
2073 g_hash_table_insert (app->encodings,
2074 (gpointer) terminal_encoding_get_id (encoding),
2075 encoding);
2076 }
2077
2078 return encoding;
2079}
2080
2081/**
2082 * terminal_app_get_active_encodings:
2083 *
2084 * Returns: a newly allocated list of newly referenced #TerminalEncoding objects.
2085 */
2086GSList*
2087terminal_app_get_active_encodings (TerminalApp *app)
2088{
2089 GSList *list = NULL((void*)0);
2090 GHashTableIter iter;
2091 gpointer key, value;
2092
2093 g_hash_table_iter_init (&iter, app->encodings);
2094 while (g_hash_table_iter_next (&iter, &key, &value))
2095 {
2096 TerminalEncoding *encoding = (TerminalEncoding *) value;
2097
2098 if (!encoding->is_active)
2099 continue;
2100
2101 list = g_slist_prepend (list, terminal_encoding_ref (encoding));
2102 }
2103
2104 return g_slist_sort (list, (GCompareFunc) compare_encodings);
2105}
2106
2107void
2108terminal_app_save_config (TerminalApp *app,
2109 GKeyFile *key_file)
2110{
2111 GList *lw;
2112 guint n = 0;
2113 GPtrArray *window_names_array;
2114 char **window_names;
2115 gsize len;
2116
2117 g_key_file_set_comment (key_file, NULL((void*)0), NULL((void*)0), "Written by " PACKAGE_STRING"mate-terminal 1.28.0", NULL((void*)0));
2118
2119 g_key_file_set_integer (key_file, TERMINAL_CONFIG_GROUP"MATE Terminal Configuration", TERMINAL_CONFIG_PROP_VERSION"Version", TERMINAL_CONFIG_VERSION(1));
2120 g_key_file_set_integer (key_file, TERMINAL_CONFIG_GROUP"MATE Terminal Configuration", TERMINAL_CONFIG_PROP_COMPAT_VERSION"CompatVersion", TERMINAL_CONFIG_COMPAT_VERSION(1));
2121
2122 window_names_array = g_ptr_array_sized_new (g_list_length (app->windows) + 1);
2123
2124 for (lw = app->windows; lw != NULL((void*)0); lw = lw->next)
2125 {
2126 TerminalWindow *window = TERMINAL_WINDOW (lw->data)((((TerminalWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((lw->data)), ((terminal_window_get_type ()))))))
;
2127 char *group;
2128
2129 group = g_strdup_printf ("Window%u", n++);
2130 g_ptr_array_add (window_names_array, group);
2131
2132 terminal_window_save_state (window, key_file, group);
2133 }
2134
2135 len = window_names_array->len;
2136 g_ptr_array_add (window_names_array, NULL((void*)0));
2137 window_names = (char **) g_ptr_array_free (window_names_array, FALSE(0));
2138 g_key_file_set_string_list (key_file, TERMINAL_CONFIG_GROUP"MATE Terminal Configuration", TERMINAL_CONFIG_PROP_WINDOWS"Windows", (const char * const *) window_names, len);
2139 g_strfreev (window_names);
2140}
2141
2142gboolean
2143terminal_app_save_config_file (TerminalApp *app,
2144 const char *file_name,
2145 GError **error)
2146{
2147 GKeyFile *key_file;
2148 char *data;
2149 gsize len;
2150 gboolean result;
2151
2152 key_file = g_key_file_new ();
2153 terminal_app_save_config (app, key_file);
2154
2155 data = g_key_file_to_data (key_file, &len, NULL((void*)0));
2156 result = g_file_set_contents (file_name, data, len, error);
2157 g_free (data);
2158
2159 return result;
2160}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-215a71.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-215a71.html new file mode 100644 index 0000000..c38d448 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-215a71.html @@ -0,0 +1,2840 @@ + + + +terminal-app.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:terminal-app.c
Warning:line 1043, column 37
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name terminal-app.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I .. -I ../src/mate-submodules/libegg -D TERMINAL_COMPILATION -D TERMINAL_RESOURCES_PATH_PREFIX="/org/mate/terminal" -D TERM_DATADIR="/usr/local/share" -D TERM_LOCALEDIR="/usr/local/share/locale" -D TERM_PKGDATADIR="/usr/local/share/mate-terminal" -D TERM_HELPDIR="/usr/local/share/help" -D SN_API_NOT_YET_FROZEN -D GDK_MULTIHEAD_SAFE -D G_DISABLE_SINGLE_INCLUDES -D PANGO_DISABLE_SINGLE_INCLUDES -D ATK_DISABLE_SINGLE_INCLUDES -D GDK_DISABLE_SINGLE_INCLUDES -D GDK_PIXBUF_DISABLE_SINGLE_INCLUDES -D GTK_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c terminal-app.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright © 2001, 2002 Havoc Pennington
3 * Copyright © 2002 Red Hat, Inc.
4 * Copyright © 2002 Sun Microsystems
5 * Copyright © 2003 Mariano Suarez-Alvarez
6 * Copyright © 2008 Christian Persch
7 * Copyright (C) 2012-2021 MATE Developers
8 *
9 * Mate-terminal is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * Mate-terminal is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#include <config.h>
24
25#include <errno(*__errno_location ()).h>
26
27#include <glib.h>
28#include <dconf.h>
29
30#include "terminal-intl.h"
31
32#include "terminal-debug.h"
33#include "terminal-app.h"
34#include "terminal-accels.h"
35#include "terminal-screen.h"
36#include "terminal-screen-container.h"
37#include "terminal-window.h"
38#include "terminal-util.h"
39#include "profile-editor.h"
40#include "terminal-encoding.h"
41#include <string.h>
42#include <stdlib.h>
43
44#ifdef HAVE_SMCLIENT1
45#include "eggsmclient.h"
46#include "eggdesktopfile.h"
47#endif /* HAVE_SMCLIENT */
48
49#define FALLBACK_PROFILE_ID"default" "default"
50
51/* Settings storage works as follows:
52 * /apps/mate-terminal/global/
53 * /apps/mate-terminal/profiles/Foo/
54 *
55 * It's somewhat tricky to manage the profiles/ dir since we need to track
56 * the list of profiles, but GSettings doesn't have a concept of notifying that
57 * a directory has appeared or disappeared.
58 *
59 * Session state is stored entirely in the RestartCommand command line.
60 *
61 * The number one rule: all stored information is EITHER per-session,
62 * per-profile, or set from a command line option. THERE CAN BE NO
63 * OVERLAP. The UI and implementation totally break if you overlap
64 * these categories. See mate-terminal 1.x for why.
65 *
66 * Don't use this code as an example of how to use GSettings - it's hugely
67 * overcomplicated due to the profiles stuff. Most apps should not
68 * have to do scary things of this nature, and should not have
69 * a profiles feature.
70 *
71 */
72
73GSettings *settings_global;
74
75struct _TerminalAppClass
76{
77 GObjectClass parent_class;
78
79 void (* quit) (TerminalApp *app);
80 void (* profile_list_changed) (TerminalApp *app);
81 void (* encoding_list_changed) (TerminalApp *app);
82};
83
84struct _TerminalApp
85{
86 GObject parent_instance;
87
88 GList *windows;
89 GtkWidget *new_profile_dialog;
90 GtkWidget *manage_profiles_dialog;
91 GtkWidget *manage_profiles_list;
92 GtkWidget *manage_profiles_new_button;
93 GtkWidget *manage_profiles_edit_button;
94 GtkWidget *manage_profiles_delete_button;
95 GtkWidget *manage_profiles_default_menu;
96
97 GSettings *settings_font;
98
99 GHashTable *profiles;
100 char* default_profile_id;
101 TerminalProfile *default_profile;
102 gboolean default_profile_locked;
103
104 GHashTable *encodings;
105 gboolean encodings_locked;
106
107 PangoFontDescription *system_font_desc;
108 gboolean enable_mnemonics;
109 gboolean enable_menu_accels;
110};
111
112enum
113{
114 PROP_0,
115 PROP_DEFAULT_PROFILE,
116 PROP_ENABLE_MENU_BAR_ACCEL,
117 PROP_ENABLE_MNEMONICS,
118 PROP_SYSTEM_FONT,
119};
120
121enum
122{
123 QUIT,
124 PROFILE_LIST_CHANGED,
125 ENCODING_LIST_CHANGED,
126 LAST_SIGNAL
127};
128
129static guint signals[LAST_SIGNAL] = { 0 };
130
131enum
132{
133 COL_PROFILE,
134 NUM_COLUMNS
135};
136
137enum
138{
139 SOURCE_DEFAULT = 0,
140 SOURCE_SESSION = 1
141};
142
143static TerminalApp *global_app = NULL((void*)0);
144
145#define MONOSPACE_FONT_SCHEMA"org.mate.interface" "org.mate.interface"
146#define MONOSPACE_FONT_KEY"monospace-font-name" "monospace-font-name"
147#define DEFAULT_MONOSPACE_FONT("Monospace 10") ("Monospace 10")
148
149#define ENABLE_MNEMONICS_KEY"use-mnemonics" "use-mnemonics"
150#define DEFAULT_ENABLE_MNEMONICS((!(0))) (TRUE(!(0)))
151
152#define ENABLE_MENU_BAR_ACCEL_KEY"use-menu-accelerators" "use-menu-accelerators"
153#define DEFAULT_ENABLE_MENU_BAR_ACCEL((!(0))) (TRUE(!(0)))
154
155#define PROFILE_LIST_KEY"profile-list" "profile-list"
156#define DEFAULT_PROFILE_KEY"default-profile" "default-profile"
157
158#define ENCODING_LIST_KEY"active-encodings" "active-encodings"
159
160/* two following functions were copied from libmate-desktop to get rid
161 * of dependency on it
162 *
163 * FIXME: I suspect there's no need for excessive copies, we might use
164 * existing profile list to form GVariant's and write them to GSettings
165 */
166static gboolean
167gsettings_append_strv (GSettings *settings,
168 const gchar *key,
169 const gchar *value)
170{
171 gchar **old;
172 gchar **new;
173 gint size;
174 gboolean retval;
175
176 old = g_settings_get_strv (settings, key);
177
178 for (size = 0; old[size] != NULL((void*)0); size++);
179
180 size += 1; /* appended value */
181 size += 1; /* NULL */
182
183 new = g_realloc_n (old, size, sizeof (gchar *));
184
185 new[size - 2] = g_strdup (value)g_strdup_inline (value);
186 new[size - 1] = NULL((void*)0);
187
188 retval = g_settings_set_strv (settings, key,
189 (const gchar **) new);
190
191 g_strfreev (new);
192
193 return retval;
194}
195
196static gboolean
197gsettings_remove_all_from_strv (GSettings *settings,
198 const gchar *key,
199 const gchar *value)
200{
201 GArray *array;
202 gchar **old;
203 gint i;
204 gboolean retval;
205
206 old = g_settings_get_strv (settings, key);
207 array = g_array_new (TRUE(!(0)), TRUE(!(0)), sizeof (gchar *));
208
209 for (i = 0; old[i] != NULL((void*)0); i++) {
210 if (g_strcmp0 (old[i], value) != 0)
211 array = g_array_append_val (array, old[i])g_array_append_vals (array, &(old[i]), 1);
212 }
213
214 retval = g_settings_set_strv (settings, key,
215 (const gchar **) array->data);
216
217 g_strfreev (old);
218 g_array_free (array, TRUE(!(0)));
219
220 return retval;
221}
222
223/* Helper functions */
224
225static GdkScreen*
226terminal_app_get_screen_by_display_name (const char *display_name)
227{
228 GdkDisplay *display = NULL((void*)0);
229 GdkScreen *screen = NULL((void*)0);
230
231 if (display_name == NULL((void*)0))
232 display = gdk_display_get_default ();
233 else
234 {
235 GSList *displays, *l;
236 const char *period;
237
238 period = strrchr (display_name, '.');
239 displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
240 for (l = displays; l != NULL((void*)0); l = l->next)
241 {
242 GdkDisplay *disp = l->data;
243
244 /* compare without the screen number part, if present */
245 if ((period && strncmp (gdk_display_get_name (disp), display_name, period - display_name) == 0) ||
246 (period == NULL((void*)0) && strcmp (gdk_display_get_name (disp), display_name) == 0))
247 {
248 display = disp;
249 break;
250 }
251 }
252 g_slist_free (displays);
253
254 if (display == NULL((void*)0))
255 display = gdk_display_open (display_name); /* FIXME we never close displays */
256 }
257
258 if (display == NULL((void*)0))
259 return NULL((void*)0);
260 else
261 screen = gdk_display_get_default_screen (display);
262
263 return screen;
264}
265
266static int
267terminal_app_get_workspace_for_window (TerminalWindow *window)
268{
269 int ret = -1;
270 guchar *data = NULL((void*)0);
271 GdkAtom atom;
272 GdkAtom cardinal_atom;
273
274 atom = gdk_atom_intern_static_string ("_NET_WM_DESKTOP");
275 cardinal_atom = gdk_atom_intern_static_string ("CARDINAL");
276
277 gdk_property_get (gtk_widget_get_window(GTK_WIDGET(window)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_widget_get_type ()))))))
),
278 atom, cardinal_atom, 0, 8, FALSE(0),
279 NULL((void*)0), NULL((void*)0), NULL((void*)0), &data);
280
281 if (data)
282 ret = *(int *)data;
283
284 g_free (data);
285 return ret;
286}
287
288/* Menubar mnemonics settings handling */
289
290static int
291profiles_alphabetic_cmp (gconstpointer pa,
292 gconstpointer pb)
293{
294 TerminalProfile *a = (TerminalProfile *) pa;
295 TerminalProfile *b = (TerminalProfile *) pb;
296 int result;
297
298 result = g_utf8_collate (terminal_profile_get_property_string (a, TERMINAL_PROFILE_VISIBLE_NAME"visible-name"),
299 terminal_profile_get_property_string (b, TERMINAL_PROFILE_VISIBLE_NAME"visible-name"));
300 if (result == 0)
301 result = strcmp (terminal_profile_get_property_string (a, TERMINAL_PROFILE_NAME"name"),
302 terminal_profile_get_property_string (b, TERMINAL_PROFILE_NAME"name"));
303
304 return result;
305}
306
307typedef struct
308{
309 TerminalProfile *result;
310 const char *target;
311} LookupInfo;
312
313static void
314profiles_lookup_by_visible_name_foreach (gpointer key,
315 gpointer value,
316 gpointer data)
317{
318 LookupInfo *info = data;
319 const char *name;
320
321 name = terminal_profile_get_property_string (value, TERMINAL_PROFILE_VISIBLE_NAME"visible-name");
322 if (name && strcmp (info->target, name) == 0)
323 info->result = value;
324}
325
326static void
327terminal_window_destroyed (TerminalWindow *window,
328 TerminalApp *app)
329{
330 app->windows = g_list_remove (app->windows, window);
331
332 if (app->windows == NULL((void*)0))
333 g_signal_emit (app, signals[QUIT], 0);
334}
335
336static TerminalProfile *
337terminal_app_create_profile (TerminalApp *app,
338 const char *name)
339{
340 TerminalProfile *profile;
341
342 g_assert (terminal_app_get_profile_by_name (app, name) == NULL)do { if (terminal_app_get_profile_by_name (app, name) == ((void
*)0)) ; else g_assertion_message_expr (((gchar*) 0), "terminal-app.c"
, 342, ((const char*) (__func__)), "terminal_app_get_profile_by_name (app, name) == NULL"
); } while (0)
;
343
344 profile = _terminal_profile_new (name);
345
346 g_hash_table_insert (app->profiles,
347 g_strdup (terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME))g_strdup_inline (terminal_profile_get_property_string (profile
, "name"))
,
348 profile /* adopts the refcount */);
349
350 if (app->default_profile == NULL((void*)0) &&
351 app->default_profile_id != NULL((void*)0) &&
352 strcmp (app->default_profile_id,
353 terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name")) == 0)
354 {
355 /* We are the default profile */
356 app->default_profile = profile;
357 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
358 }
359
360 return profile;
361}
362
363static void
364terminal_app_delete_profile (TerminalProfile *profile)
365{
366 const char *profile_name;
367 char *profile_dir;
368 GError *error = NULL((void*)0);
369
370 profile_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name");
371 profile_dir = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", profile_name, "/", NULL((void*)0));
372
373 gsettings_remove_all_from_strv (settings_global, PROFILE_LIST_KEY"profile-list", profile_name);
374
375 /* And remove the profile directory */
376 DConfClient *client = dconf_client_new ();
377 if (!dconf_client_write_sync (client, profile_dir, NULL((void*)0), NULL((void*)0), NULL((void*)0), &error))
378 {
379 g_warning ("Failed to recursively unset %s: %s\n", profile_dir, error->message);
380 g_error_free (error);
381 }
382
383 g_object_unref (client);
384 g_free (profile_dir);
385}
386
387static void
388terminal_app_profile_cell_data_func (GtkTreeViewColumn *tree_column,
389 GtkCellRenderer *cell,
390 GtkTreeModel *tree_model,
391 GtkTreeIter *iter,
392 gpointer data)
393{
394 TerminalProfile *profile;
395 GValue value = { 0, };
396
397 gtk_tree_model_get (tree_model, iter, (int) COL_PROFILE, &profile, (int) -1);
398
399 g_value_init (&value, G_TYPE_STRING((GType) ((16) << (2))));
400 g_object_get_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, "visible-name", &value);
401 g_object_set_property (G_OBJECT (cell)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cell)), (((GType) ((20) << (2))))))))
, "text", &value);
402 g_value_unset (&value);
403}
404
405static int
406terminal_app_profile_sort_func (GtkTreeModel *model,
407 GtkTreeIter *a,
408 GtkTreeIter *b,
409 gpointer user_data)
410{
411 TerminalProfile *profile_a, *profile_b;
412 int retval;
413
414 gtk_tree_model_get (model, a, (int) COL_PROFILE, &profile_a, (int) -1);
415 gtk_tree_model_get (model, b, (int) COL_PROFILE, &profile_b, (int) -1);
416
417 retval = profiles_alphabetic_cmp (profile_a, profile_b);
418
419 g_object_unref (profile_a);
420 g_object_unref (profile_b);
421
422 return retval;
423}
424
425static /* ref */ GtkTreeModel *
426terminal_app_get_profile_liststore (TerminalApp *app,
427 TerminalProfile *selected_profile,
428 GtkTreeIter *selected_profile_iter,
429 gboolean *selected_profile_iter_set)
430{
431 GtkListStore *store;
432 GtkTreeIter iter;
433 GList *profiles, *l;
434
435 store = gtk_list_store_new (NUM_COLUMNS, TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()));
436
437 *selected_profile_iter_set = FALSE(0);
438
439 if (selected_profile &&
440 _terminal_profile_get_forgotten (selected_profile))
441 selected_profile = NULL((void*)0);
442
443 profiles = terminal_app_get_profile_list (app);
444
445 for (l = profiles; l != NULL((void*)0); l = l->next)
446 {
447 TerminalProfile *profile = TERMINAL_PROFILE (l->data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((terminal_profile_get_type ()))))))
;
448
449 gtk_list_store_insert_with_values (store, &iter, 0,
450 (int) COL_PROFILE, profile,
451 (int) -1);
452
453 if (selected_profile_iter && profile == selected_profile)
454 {
455 *selected_profile_iter = iter;
456 *selected_profile_iter_set = TRUE(!(0));
457 }
458 }
459 g_list_free (profiles);
460
461 /* Now turn on sorting */
462 gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (store)((((GtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((gtk_tree_sortable_get_type ()))))))
,
463 COL_PROFILE,
464 terminal_app_profile_sort_func,
465 NULL((void*)0), NULL((void*)0));
466 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store)((((GtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((gtk_tree_sortable_get_type ()))))))
,
467 COL_PROFILE, GTK_SORT_ASCENDING);
468
469 return GTK_TREE_MODEL (store)((((GtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((gtk_tree_model_get_type ()))))))
;
470}
471
472static /* ref */ TerminalProfile*
473profile_combo_box_get_selected (GtkWidget *widget)
474{
475 GtkComboBox *combo = GTK_COMBO_BOX (widget)((((GtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_combo_box_get_type ()))))))
;
476 TerminalProfile *profile = NULL((void*)0);
477 GtkTreeIter iter;
478
479 if (gtk_combo_box_get_active_iter (combo, &iter))
480 gtk_tree_model_get (gtk_combo_box_get_model (combo), &iter,
481 (int) COL_PROFILE, &profile, (int) -1);
482
483 return profile;
484}
485
486static void
487profile_combo_box_refill (TerminalApp *app,
488 GtkWidget *widget)
489{
490 GtkComboBox *combo = GTK_COMBO_BOX (widget)((((GtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_combo_box_get_type ()))))))
;
491 GtkTreeIter iter;
492 gboolean iter_set;
493 TerminalProfile *selected_profile;
494 GtkTreeModel *model;
495
496 selected_profile = profile_combo_box_get_selected (widget);
497 if (!selected_profile)
498 {
499 selected_profile = terminal_app_get_default_profile (app);
500 if (selected_profile)
501 g_object_ref (selected_profile)((__typeof__ (selected_profile)) (g_object_ref) (selected_profile
))
;
502 }
503
504 model = terminal_app_get_profile_liststore (app,
505 selected_profile,
506 &iter,
507 &iter_set);
508 gtk_combo_box_set_model (combo, model);
509 g_object_unref (model);
510
511 if (iter_set)
512 gtk_combo_box_set_active_iter (combo, &iter);
513
514 if (selected_profile)
515 g_object_unref (selected_profile);
516}
517
518static GtkWidget*
519profile_combo_box_new (TerminalApp *app)
520{
521 GtkWidget *combo;
522 GtkCellRenderer *renderer;
523
524 combo = gtk_combo_box_new ();
525 terminal_util_set_atk_name_description (combo, NULL((void*)0), _("Click button to choose profile")gettext ("Click button to choose profile"));
526
527 renderer = gtk_cell_renderer_text_new ();
528 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((gtk_cell_layout_get_type ()))))))
, renderer, TRUE(!(0)));
529 gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((gtk_cell_layout_get_type ()))))))
, renderer,
530 (GtkCellLayoutDataFunc) terminal_app_profile_cell_data_func,
531 NULL((void*)0), NULL((void*)0));
532
533 profile_combo_box_refill (app, combo);
534 g_signal_connect (app, "profile-list-changed",g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_combo_box_refill))), (combo), ((void*)0), (GConnectFlags
) 0)
535 G_CALLBACK (profile_combo_box_refill), combo)g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_combo_box_refill))), (combo), ((void*)0), (GConnectFlags
) 0)
;
536
537 gtk_widget_show (combo);
538 return combo;
539}
540
541static void
542profile_combo_box_changed_cb (GtkWidget *widget,
543 TerminalApp *app)
544{
545 TerminalProfile *profile;
546
547 profile = profile_combo_box_get_selected (widget);
548 if (!profile)
549 return;
550
551 g_settings_set_string (settings_global, DEFAULT_PROFILE_KEY"default-profile",
552 terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name"));
553
554 /* Even though the GSettings change notification does this, it happens too late.
555 * In some cases, the default profile changes twice in quick succession,
556 * and update_default_profile must be called in sync with those changes.
557 */
558 app->default_profile = profile;
559
560 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
561
562 g_object_unref (profile);
563}
564
565static void
566profile_list_treeview_refill (TerminalApp *app,
567 GtkWidget *widget)
568{
569 GtkTreeView *tree_view = GTK_TREE_VIEW (widget)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_tree_view_get_type ()))))))
;
570 GtkTreeIter iter;
571 gboolean iter_set;
572 GtkTreeSelection *selection;
573 GtkTreeModel *model;
574 TerminalProfile *selected_profile = NULL((void*)0);
575
576 model = gtk_tree_view_get_model (tree_view);
577
578 selection = gtk_tree_view_get_selection (tree_view);
579 if (gtk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
580 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
581
582 model = terminal_app_get_profile_liststore (terminal_app_get (),
583 selected_profile,
584 &iter,
585 &iter_set);
586 gtk_tree_view_set_model (tree_view, model);
587 g_object_unref (model);
588
589 if (!iter_set)
590 iter_set = gtk_tree_model_get_iter_first (model, &iter);
591
592 if (iter_set)
593 gtk_tree_selection_select_iter (selection, &iter);
594
595 if (selected_profile)
596 g_object_unref (selected_profile);
597}
598
599static GtkWidget*
600profile_list_treeview_create (TerminalApp *app)
601{
602 GtkWidget *tree_view;
603 GtkTreeSelection *selection;
604 GtkCellRenderer *renderer;
605 GtkTreeViewColumn *column;
606
607 tree_view = gtk_tree_view_new ();
608 terminal_util_set_atk_name_description (tree_view, _("Profile list")gettext ("Profile list"), NULL((void*)0));
609 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
, FALSE(0));
610
611 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
);
612 gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection)((((GtkTreeSelection*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((selection)), ((gtk_tree_selection_get_type (
)))))))
,
613 GTK_SELECTION_BROWSE);
614
615 column = gtk_tree_view_column_new ();
616 renderer = gtk_cell_renderer_text_new ();
617 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (column)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((column)), ((gtk_cell_layout_get_type ()))))))
, renderer, TRUE(!(0)));
618 gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (column)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((column)), ((gtk_cell_layout_get_type ()))))))
, renderer,
619 (GtkCellLayoutDataFunc) terminal_app_profile_cell_data_func,
620 NULL((void*)0), NULL((void*)0));
621 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
,
622 GTK_TREE_VIEW_COLUMN (column)((((GtkTreeViewColumn*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((column)), ((gtk_tree_view_column_get_type (
)))))))
);
623
624 return tree_view;
625}
626
627static void
628profile_list_delete_confirm_response_cb (GtkWidget *dialog,
629 int response)
630{
631 TerminalProfile *profile;
632
633 profile = TERMINAL_PROFILE (g_object_get_data (G_OBJECT (dialog), "profile"))((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_get_data (((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((dialog)), (((GType) ((20) << (2)))
))))), "profile"))), ((terminal_profile_get_type ()))))))
;
634 g_assert (profile != NULL)do { if (profile != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 634, ((const char*) (__func__
)), "profile != NULL"); } while (0)
;
635
636 if (response == GTK_RESPONSE_ACCEPT)
637 terminal_app_delete_profile (profile);
638
639 gtk_widget_destroy (dialog);
640}
641
642static void
643mate_dialog_add_button (GtkDialog *dialog,
644 const gchar *button_text,
645 const gchar *icon_name,
646 gint response_id)
647{
648 GtkWidget *button;
649
650 button = gtk_button_new_with_mnemonic (button_text);
651 gtk_button_set_image (GTK_BUTTON (button)((((GtkButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_button_get_type ()))))))
, gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON));
652
653 gtk_button_set_use_underline (GTK_BUTTON (button)((((GtkButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_button_get_type ()))))))
, TRUE(!(0)));
654 gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button");
655 gtk_widget_set_can_default (button, TRUE(!(0)));
656 gtk_widget_show (button);
657 gtk_dialog_add_action_widget (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
, button, response_id);
658}
659
660static void
661profile_list_delete_button_clicked_cb (GtkWidget *button,
662 GtkWidget *widget)
663{
664 GtkTreeView *tree_view = GTK_TREE_VIEW (widget)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_tree_view_get_type ()))))))
;
665 GtkTreeSelection *selection;
666 GtkWidget *dialog;
667 GtkTreeIter iter;
668 GtkTreeModel *model;
669 TerminalProfile *selected_profile;
670 GtkWidget *transient_parent;
671
672 model = gtk_tree_view_get_model (tree_view);
673 selection = gtk_tree_view_get_selection (tree_view);
674
675 if (!gtk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
676 return;
677
678 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
679
680 transient_parent = gtk_widget_get_toplevel (widget);
681 dialog = gtk_message_dialog_new (GTK_WINDOW (transient_parent)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((transient_parent)), ((gtk_window_get_type ()))))))
,
682 GTK_DIALOG_DESTROY_WITH_PARENT,
683 GTK_MESSAGE_QUESTION,
684 GTK_BUTTONS_NONE,
685 _("Delete profile “%s”?")gettext ("Delete profile “%s”?"),
686 terminal_profile_get_property_string (selected_profile, TERMINAL_PROFILE_VISIBLE_NAME"visible-name"));
687
688 mate_dialog_add_button (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
,
689 _("_Cancel")gettext ("_Cancel"),
690 "process-stop",
691 GTK_RESPONSE_REJECT);
692
693 mate_dialog_add_button (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
,
694 _("_Delete")gettext ("_Delete"),
695 "edit-delete",
696 GTK_RESPONSE_ACCEPT);
697
698 gtk_dialog_set_default_response (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
,
699 GTK_RESPONSE_ACCEPT);
700
701 gtk_window_set_title (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
, _("Delete Profile")gettext ("Delete Profile"));
702 gtk_window_set_resizable (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
, FALSE(0));
703
704 /* Transfer refcount of |selected_profile|, so no unref below */
705 g_object_set_data_full (G_OBJECT (dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), (((GType) ((20) << (2))))))))
, "profile", selected_profile, g_object_unref);
706
707 g_signal_connect (dialog, "response",g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_delete_confirm_response_cb))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
708 G_CALLBACK (profile_list_delete_confirm_response_cb),g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_delete_confirm_response_cb))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
709 NULL)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_delete_confirm_response_cb))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
;
710
711 gtk_window_present (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
);
712}
713
714static void
715profile_list_new_button_clicked_cb (GtkWidget *button,
716 gpointer data)
717{
718 TerminalApp *app;
719
720 app = terminal_app_get ();
721 terminal_app_new_profile (app, NULL((void*)0), GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
);
722}
723
724static void
725profile_list_edit_button_clicked_cb (GtkWidget *button,
726 GtkWidget *widget)
727{
728 GtkTreeView *tree_view = GTK_TREE_VIEW (widget)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_tree_view_get_type ()))))))
;
729 GtkTreeSelection *selection;
730 GtkTreeIter iter;
731 GtkTreeModel *model;
732 TerminalProfile *selected_profile;
733 TerminalApp *app;
734
735 app = terminal_app_get ();
736
737 model = gtk_tree_view_get_model (tree_view);
738 selection = gtk_tree_view_get_selection (tree_view);
739
740 if (!gtk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
741 return;
742
743 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
744
745 terminal_app_edit_profile (app, selected_profile,
746 GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
,
747 NULL((void*)0));
748 g_object_unref (selected_profile);
749}
750
751static void
752profile_list_row_activated_cb (GtkTreeView *tree_view,
753 GtkTreePath *path,
754 GtkTreeViewColumn *column,
755 gpointer data)
756{
757 GtkTreeIter iter;
758 GtkTreeModel *model;
759 TerminalProfile *selected_profile;
760 TerminalApp *app;
761
762 app = terminal_app_get ();
763
764 model = gtk_tree_view_get_model (tree_view);
765
766 if (!gtk_tree_model_get_iter (model, &iter, path))
767 return;
768
769 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
770
771 terminal_app_edit_profile (app, selected_profile,
772 GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
,
773 NULL((void*)0));
774 g_object_unref (selected_profile);
775}
776
777static GList*
778find_profile_link (GList *profiles,
779 const char *name)
780{
781 GList *l;
782
783 for (l = profiles; l != NULL((void*)0); l = l->next)
784 {
785 const char *profile_name;
786
787 profile_name = terminal_profile_get_property_string (TERMINAL_PROFILE (l->data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((terminal_profile_get_type ()))))))
, TERMINAL_PROFILE_NAME"name");
788 if (profile_name && strcmp (profile_name, name) == 0)
789 break;
790 }
791
792 return l;
793}
794
795static void
796terminal_app_profile_list_notify_cb (GSettings *settings,
797 const gchar *key,
798 gpointer user_data)
799{
800 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
801 GObject *object = G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
;
802 GVariant *val;
803 const gchar **value_list;
804 int i;
805 GList *profiles_to_delete, *l;
806 gboolean need_new_default;
807 TerminalProfile *fallback;
808 guint count;
809
810 g_object_freeze_notify (object);
811
812 profiles_to_delete = terminal_app_get_profile_list (app);
813
814 val = g_settings_get_value (settings, key);
815 if (val == NULL((void*)0) ||
816 (!g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY((const GVariantType *) "as")) &&
817 !g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s"))))
818 goto ensure_one_profile;
819
820 value_list = g_variant_get_strv (val, NULL((void*)0));
821 if (value_list == NULL((void*)0))
822 goto ensure_one_profile;
823
824 /* Add any new ones */
825 for (i = 0; value_list[i] != NULL((void*)0); ++i)
826 {
827 const char *profile_name = value_list[i];
828 GList *link;
829
830 if (!profile_name)
831 continue;
832
833 link = find_profile_link (profiles_to_delete, profile_name);
834 if (link)
835 /* make profiles_to_delete point to profiles we didn't find in the list */
836 profiles_to_delete = g_list_delete_link (profiles_to_delete, link);
837 else
838 terminal_app_create_profile (app, profile_name);
839 }
840
841 g_free (value_list);
842
843ensure_one_profile:
844
845 if (val != NULL((void*)0))
846 g_variant_unref (val);
847
848 fallback = NULL((void*)0);
849 count = g_hash_table_size (app->profiles);
850 if (count == 0 || count <= g_list_length (profiles_to_delete))
851 {
852 /* We are going to run out, so create the fallback
853 * to be sure we always have one. Must be done
854 * here before we emit "forgotten" signals so that
855 * screens have a profile to fall back to.
856 *
857 * If the profile with the FALLBACK_ID already exists,
858 * we aren't allowed to delete it, unless at least one
859 * other profile will still exist. And if you delete
860 * all profiles, the FALLBACK_ID profile returns as
861 * the living dead.
862 */
863 fallback = terminal_app_get_profile_by_name (app, FALLBACK_PROFILE_ID"default");
864 if (fallback == NULL((void*)0))
865 fallback = terminal_app_create_profile (app, FALLBACK_PROFILE_ID"default");
866 g_assert (fallback != NULL)do { if (fallback != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 866, ((const char*) (__func__
)), "fallback != NULL"); } while (0)
;
867 }
868
869 /* Forget no-longer-existing profiles */
870 need_new_default = FALSE(0);
871 for (l = profiles_to_delete; l != NULL((void*)0); l = l->next)
872 {
873 TerminalProfile *profile = TERMINAL_PROFILE (l->data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((terminal_profile_get_type ()))))))
;
874 const char *name;
875
876 name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name");
877 if (strcmp (name, FALLBACK_PROFILE_ID"default") == 0)
878 continue;
879
880 if (profile == app->default_profile)
881 {
882 app->default_profile = NULL((void*)0);
883 need_new_default = TRUE(!(0));
884 }
885
886 _terminal_profile_forget (profile);
887 g_hash_table_remove (app->profiles, name);
888
889 /* |profile| possibly isn't dead yet since the profiles dialogue's tree model holds a ref too... */
890 }
891 g_list_free (profiles_to_delete);
892
893 if (need_new_default)
894 {
895 TerminalProfile *new_default;
896 TerminalProfile **new_default_ptr = &new_default;
897
898 new_default = terminal_app_get_profile_by_name (app, FALLBACK_PROFILE_ID"default");
899 if (new_default == NULL((void*)0))
900 {
901 GHashTableIter iter;
902
903 g_hash_table_iter_init (&iter, app->profiles);
904 if (!g_hash_table_iter_next (&iter, NULL((void*)0), (gpointer *) new_default_ptr))
905 /* shouldn't really happen ever, but just to be safe */
906 new_default = terminal_app_create_profile (app, FALLBACK_PROFILE_ID"default");
907 }
908 g_assert (new_default != NULL)do { if (new_default != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 908, ((const char*) (__func__
)), "new_default != NULL"); } while (0)
;
909
910 app->default_profile = new_default;
911
912 g_object_notify (object, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
913 }
914
915 g_assert (g_hash_table_size (app->profiles) > 0)do { if (g_hash_table_size (app->profiles) > 0) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 915, ((const char*) (__func__
)), "g_hash_table_size (app->profiles) > 0"); } while (
0)
;
916
917 g_signal_emit (app, signals[PROFILE_LIST_CHANGED], 0);
918
919 g_object_thaw_notify (object);
920}
921
922static void
923terminal_app_default_profile_notify_cb (GSettings *settings,
924 const gchar *key,
925 gpointer user_data)
926{
927 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
928 GVariant *val;
929 const char *name = NULL((void*)0);
930
931 app->default_profile_locked = !g_settings_is_writable (settings, key);
932
933 val = g_settings_get_value (settings, key);
934 if (val != NULL((void*)0) &&
935 g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
936 name = g_variant_get_string (val, NULL((void*)0));
937 if (!name || !name[0])
938 name = FALLBACK_PROFILE_ID"default";
939 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-app.c", 939, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
940
941 g_free (app->default_profile_id);
942 app->default_profile_id = g_strdup (name)g_strdup_inline (name);
943
944 app->default_profile = terminal_app_get_profile_by_name (app, name);
945
946 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
947 g_variant_unref (val);
948}
949
950static int
951compare_encodings (TerminalEncoding *a,
952 TerminalEncoding *b)
953{
954 return g_utf8_collate (a->name, b->name);
955}
956
957static void
958encoding_mark_active (gpointer key,
959 gpointer value,
960 gpointer data)
961{
962 TerminalEncoding *encoding = (TerminalEncoding *) value;
963 guint active = GPOINTER_TO_UINT (data)((guint) (gulong) (data));
964
965 encoding->is_active = active;
966}
967
968static void
969terminal_app_encoding_list_notify_cb (GSettings *settings,
970 const gchar *key,
971 gpointer user_data)
972{
973 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
974 GVariant *val;
975 const gchar **strings;
976 int i;
977 TerminalEncoding *encoding;
978 const char *charset;
979
980 app->encodings_locked = !g_settings_is_writable (settings, key);
981
982 /* Mark all as non-active, then re-enable the active ones */
983 g_hash_table_foreach (app->encodings, (GHFunc) encoding_mark_active, GUINT_TO_POINTER (FALSE)((gpointer) (gulong) ((0))));
984
985 /* First add the locale's charset */
986 encoding = g_hash_table_lookup (app->encodings, "current");
987 g_assert (encoding)do { if (encoding) ; else g_assertion_message_expr (((gchar*)
0), "terminal-app.c", 987, ((const char*) (__func__)), "encoding"
); } while (0)
;
988 if (terminal_encoding_is_valid (encoding))
989 encoding->is_active = TRUE(!(0));
990
991 /* Also always make UTF-8 available */
992 encoding = g_hash_table_lookup (app->encodings, "UTF-8");
993 g_assert (encoding)do { if (encoding) ; else g_assertion_message_expr (((gchar*)
0), "terminal-app.c", 993, ((const char*) (__func__)), "encoding"
); } while (0)
;
994 if (terminal_encoding_is_valid (encoding))
995 encoding->is_active = TRUE(!(0));
996
997 val = g_settings_get_value (settings, key);
998 if (val != NULL((void*)0) &&
999 g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY((const GVariantType *) "as")))
1000 strings = g_variant_get_strv (val, NULL((void*)0));
1001 else
1002 strings = NULL((void*)0);
1003
1004 if (strings != NULL((void*)0))
1005 {
1006 for (i = 0; strings[i] != NULL((void*)0); ++i)
1007 {
1008 charset = strings[i];
1009 if (!charset)
1010 continue;
1011
1012 encoding = terminal_app_ensure_encoding (app, charset);
1013 if (!terminal_encoding_is_valid (encoding))
1014 continue;
1015
1016 encoding->is_active = TRUE(!(0));
1017 }
1018
1019 g_free (strings);
1020 }
1021
1022 g_signal_emit (app, signals[ENCODING_LIST_CHANGED], 0);
1023
1024 if (val != NULL((void*)0))
1025 g_variant_unref (val);
1026}
1027
1028static void
1029terminal_app_system_font_notify_cb (GSettings *settings,
1030 const gchar *key,
1031 gpointer user_data)
1032{
1033 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
1034 GVariant *val;
1035 const char *font = NULL((void*)0);
1036 PangoFontDescription *font_desc;
1037
1038 if (strcmp (key, MONOSPACE_FONT_KEY"monospace-font-name") != 0)
1039 return;
1040
1041 val = g_settings_get_value (settings, key);
1042 if (val &&
1043 g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
1044 font = g_variant_get_string (val, NULL((void*)0));
1045 if (!font)
1046 font = DEFAULT_MONOSPACE_FONT("Monospace 10");
1047 g_assert (font != NULL)do { if (font != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-app.c", 1047, ((const char*) (__func__
)), "font != NULL"); } while (0)
;
1048
1049 if (font && (strlen (font) == 0)) /* empty string */
1050 font = DEFAULT_MONOSPACE_FONT("Monospace 10");
1051
1052 font_desc = pango_font_description_from_string (font);
1053 if (app->system_font_desc &&
1054 pango_font_description_equal (app->system_font_desc, font_desc))
1055 {
1056 pango_font_description_free (font_desc);
1057 return;
1058 }
1059
1060 if (app->system_font_desc)
1061 pango_font_description_free (app->system_font_desc);
1062
1063 app->system_font_desc = font_desc;
1064
1065 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_SYSTEM_FONT"system-font");
1066 g_variant_unref (val);
1067}
1068
1069static void
1070terminal_app_enable_mnemonics_notify_cb (GSettings *settings,
1071 const gchar *key,
1072 gpointer user_data)
1073{
1074 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
1075 gboolean enable;
1076
1077 enable = g_settings_get_boolean (settings, key);
1078 if (enable == app->enable_mnemonics)
1079 return;
1080
1081 app->enable_mnemonics = enable;
1082 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_ENABLE_MNEMONICS"enable-mnemonics");
1083}
1084
1085static void
1086terminal_app_enable_menu_accels_notify_cb (GSettings *settings,
1087 const gchar *key,
1088 gpointer user_data)
1089{
1090 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
1091 gboolean enable;
1092
1093 enable = g_settings_get_boolean (settings, key);
1094 if (enable == app->enable_menu_accels)
1095 return;
1096
1097 app->enable_menu_accels = enable;
1098 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_ENABLE_MENU_BAR_ACCEL"enable-menu-accels");
1099}
1100
1101static void
1102new_profile_response_cb (GtkWidget *new_profile_dialog,
1103 int response_id,
1104 TerminalApp *app)
1105{
1106 if (response_id == GTK_RESPONSE_ACCEPT)
1107 {
1108 GtkWidget *name_entry;
1109 char *name;
1110 const char *new_profile_name;
1111 GtkWidget *base_option_menu;
1112 TerminalProfile *base_profile = NULL((void*)0);
1113 TerminalProfile *new_profile;
1114 GList *profiles;
1115 GList *tmp;
1116 GtkWindow *transient_parent;
1117 GtkWidget *confirm_dialog;
1118 gint retval;
1119
1120 base_option_menu = g_object_get_data (G_OBJECT (new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), (((GType) ((20) << (2)))))))
)
, "base_option_menu");
1121 base_profile = profile_combo_box_get_selected (base_option_menu);
1122 if (!base_profile)
1123 base_profile = terminal_app_get_default_profile (app);
1124 if (!base_profile)
1125 return; /* shouldn't happen ever though */
1126
1127 name_entry = g_object_get_data (G_OBJECT (new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), (((GType) ((20) << (2)))))))
)
, "name_entry");
1128 name = gtk_editable_get_chars (GTK_EDITABLE (name_entry)((((GtkEditable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((name_entry)), ((gtk_editable_get_type ()))))))
, 0, -1);
1129 g_strstrip (name)g_strchomp (g_strchug (name)); /* name will be non empty after stripping */
1130
1131 profiles = terminal_app_get_profile_list (app);
1132 for (tmp = profiles; tmp != NULL((void*)0); tmp = tmp->next)
1133 {
1134 TerminalProfile *profile = tmp->data;
1135 const char *visible_name;
1136
1137 visible_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_VISIBLE_NAME"visible-name");
1138
1139 if (visible_name && strcmp (name, visible_name) == 0)
1140 break;
1141 }
1142 if (tmp)
1143 {
1144 confirm_dialog = gtk_message_dialog_new (GTK_WINDOW (new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), ((gtk_window_get_type ()))))))
,
1145 GTK_DIALOG_DESTROY_WITH_PARENT,
1146 GTK_MESSAGE_QUESTION,
1147 GTK_BUTTONS_YES_NO,
1148 _("You already have a profile called “%s”. Do you want to create another profile with the same name?")gettext ("You already have a profile called “%s”. Do you want to create another profile with the same name?"
)
, name);
1149 /* Alternative button order was set automatically by GtkMessageDialog */
1150 retval = gtk_dialog_run (GTK_DIALOG (confirm_dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((confirm_dialog)), ((gtk_dialog_get_type ()))))))
);
1151 gtk_widget_destroy (confirm_dialog);
1152 if (retval == GTK_RESPONSE_NO)
1153 goto cleanup;
1154 }
1155 g_list_free (profiles);
1156
1157 transient_parent = gtk_window_get_transient_for (GTK_WINDOW (new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), ((gtk_window_get_type ()))))))
);
1158
1159 new_profile = _terminal_profile_clone (base_profile, name);
1160 new_profile_name = terminal_profile_get_property_string (new_profile, TERMINAL_PROFILE_NAME"name");
1161 g_hash_table_insert (app->profiles,
1162 g_strdup (new_profile_name)g_strdup_inline (new_profile_name),
1163 new_profile /* adopts the refcount */);
1164
1165 /* And now save the new profile name to GSettings */
1166 gsettings_append_strv (settings_global,
1167 PROFILE_LIST_KEY"profile-list",
1168 new_profile_name);
1169
1170 terminal_profile_edit (new_profile, transient_parent, NULL((void*)0));
1171
1172cleanup:
1173 g_free (name);
1174 }
1175
1176 gtk_widget_destroy (new_profile_dialog);
1177}
1178
1179static void
1180new_profile_dialog_destroy_cb (GtkWidget *new_profile_dialog,
1181 TerminalApp *app)
1182{
1183 GtkWidget *combo;
1184
1185 combo = g_object_get_data (G_OBJECT (new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), (((GType) ((20) << (2)))))))
)
, "base_option_menu");
1186 g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_combo_box_refill), combo)g_signal_handlers_disconnect_matched ((app), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (profile_combo_box_refill))), (combo))
;
1187
1188 app->new_profile_dialog = NULL((void*)0);
1189}
1190
1191static void
1192new_profile_name_entry_changed_cb (GtkEntry *entry,
1193 GtkDialog *dialog)
1194{
1195 const char *name;
1196
1197 name = gtk_entry_get_text (entry);
1198
1199 /* make the create button sensitive only if something other than space has been set */
1200 while (*name != '\0' && g_ascii_isspace (*name)((g_ascii_table[(guchar) (*name)] & G_ASCII_SPACE) != 0))
1201 ++name;
1202
1203 gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_ACCEPT, name[0] != '\0');
1204}
1205
1206void
1207terminal_app_new_profile (TerminalApp *app,
1208 TerminalProfile *default_base_profile,
1209 GtkWindow *transient_parent)
1210{
1211 if (app->new_profile_dialog == NULL((void*)0))
1212 {
1213 GtkWidget *create_button, *grid, *name_label, *name_entry, *base_label, *combo;
1214
1215 if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX"/org/mate/terminal" G_DIR_SEPARATOR_S"/" "ui/profile-new-dialog.ui",
1216 "new-profile-dialog", &app->new_profile_dialog,
1217 "new-profile-create-button", &create_button,
1218 "new-profile-grid", &grid,
1219 "new-profile-name-label", &name_label,
1220 "new-profile-name-entry", &name_entry,
1221 "new-profile-base-label", &base_label,
1222 NULL((void*)0)))
1223 return;
1224
1225 g_signal_connect (G_OBJECT (app->new_profile_dialog), "response", G_CALLBACK (new_profile_response_cb), app)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((app->new_profile_dialog)), (((GType) (
(20) << (2))))))))), ("response"), (((GCallback) (new_profile_response_cb
))), (app), ((void*)0), (GConnectFlags) 0)
;
1226 g_signal_connect (app->new_profile_dialog, "destroy", G_CALLBACK (new_profile_dialog_destroy_cb), app)g_signal_connect_data ((app->new_profile_dialog), ("destroy"
), (((GCallback) (new_profile_dialog_destroy_cb))), (app), ((
void*)0), (GConnectFlags) 0)
;
1227
1228 g_object_set_data (G_OBJECT (app->new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), (((GType) ((20) << (
2))))))))
, "create_button", create_button);
1229 gtk_widget_set_sensitive (create_button, FALSE(0));
1230
1231 /* the name entry */
1232 g_object_set_data (G_OBJECT (app->new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), (((GType) ((20) << (
2))))))))
, "name_entry", name_entry);
1233 g_signal_connect (name_entry, "changed", G_CALLBACK (new_profile_name_entry_changed_cb), app->new_profile_dialog)g_signal_connect_data ((name_entry), ("changed"), (((GCallback
) (new_profile_name_entry_changed_cb))), (app->new_profile_dialog
), ((void*)0), (GConnectFlags) 0)
;
1234 gtk_entry_set_activates_default (GTK_ENTRY (name_entry)((((GtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((name_entry)), ((gtk_entry_get_type ()))))))
, TRUE(!(0)));
1235 gtk_widget_grab_focus (name_entry);
1236
1237 gtk_label_set_mnemonic_widget (GTK_LABEL (name_label)((((GtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((name_label)), ((gtk_label_get_type ()))))))
, name_entry);
1238
1239 /* the base profile option menu */
1240 combo = profile_combo_box_new (app);
1241 gtk_grid_attach (GTK_GRID (grid)((((GtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((gtk_grid_get_type ()))))))
, combo, 2, 1, 1, 1);
1242 g_object_set_data (G_OBJECT (app->new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), (((GType) ((20) << (
2))))))))
, "base_option_menu", combo);
1243 terminal_util_set_atk_name_description (combo, NULL((void*)0), _("Choose base profile")gettext ("Choose base profile"));
1244
1245 gtk_label_set_mnemonic_widget (GTK_LABEL (base_label)((((GtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((base_label)), ((gtk_label_get_type ()))))))
, combo);
1246
1247 gtk_dialog_set_default_response (GTK_DIALOG (app->new_profile_dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_dialog_get_type ()))
))))
, GTK_RESPONSE_ACCEPT);
1248 gtk_dialog_set_response_sensitive (GTK_DIALOG (app->new_profile_dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_dialog_get_type ()))
))))
, GTK_RESPONSE_ACCEPT, FALSE(0));
1249 }
1250
1251 gtk_window_set_transient_for (GTK_WINDOW (app->new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_window_get_type ()))
))))
,
1252 transient_parent);
1253
1254 gtk_window_present (GTK_WINDOW (app->new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_window_get_type ()))
))))
);
1255}
1256
1257static void
1258profile_list_selection_changed_cb (GtkTreeSelection *selection,
1259 TerminalApp *app)
1260{
1261 gboolean selected;
1262
1263 selected = gtk_tree_selection_get_selected (selection, NULL((void*)0), NULL((void*)0));
1264
1265 gtk_widget_set_sensitive (app->manage_profiles_edit_button, selected);
1266 gtk_widget_set_sensitive (app->manage_profiles_delete_button,
1267 selected &&
1268 g_hash_table_size (app->profiles) > 1);
1269}
1270
1271static void
1272profile_list_response_cb (GtkWidget *dialog,
1273 int id,
1274 TerminalApp *app)
1275{
1276 g_assert (app->manage_profiles_dialog == dialog)do { if (app->manage_profiles_dialog == dialog) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1276, ((const char*) (__func__
)), "app->manage_profiles_dialog == dialog"); } while (0)
;
1277
1278 if (id == GTK_RESPONSE_HELP)
1279 {
1280 terminal_util_show_help ("mate-terminal-manage-profiles", GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
);
1281 return;
1282 }
1283
1284 gtk_widget_destroy (dialog);
1285}
1286
1287static void
1288profile_list_destroyed_cb (GtkWidget *manage_profiles_dialog,
1289 TerminalApp *app)
1290{
1291 g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_list_treeview_refill), app->manage_profiles_list)g_signal_handlers_disconnect_matched ((app), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (profile_list_treeview_refill))), (app->
manage_profiles_list))
;
1292 g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_combo_box_refill), app->manage_profiles_default_menu)g_signal_handlers_disconnect_matched ((app), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (profile_combo_box_refill))), (app->manage_profiles_default_menu
))
;
1293
1294 app->manage_profiles_dialog = NULL((void*)0);
1295 app->manage_profiles_list = NULL((void*)0);
1296 app->manage_profiles_new_button = NULL((void*)0);
1297 app->manage_profiles_edit_button = NULL((void*)0);
1298 app->manage_profiles_delete_button = NULL((void*)0);
1299 app->manage_profiles_default_menu = NULL((void*)0);
1300}
1301
1302void
1303terminal_app_manage_profiles (TerminalApp *app,
1304 GtkWindow *transient_parent)
1305{
1306 GObject *dialog;
1307 GObject *tree_view_container, *new_button, *edit_button, *remove_button;
1308 GObject *default_hbox, *default_label;
1309 GtkTreeSelection *selection;
1310
1311 if (app->manage_profiles_dialog)
1312 {
1313 gtk_window_set_transient_for (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
, transient_parent);
1314 gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
);
1315 return;
1316 }
1317
1318 if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX"/org/mate/terminal" G_DIR_SEPARATOR_S"/" "ui/profile-manager.ui",
1319 "profile-manager", &dialog,
1320 "profiles-treeview-container", &tree_view_container,
1321 "new-profile-button", &new_button,
1322 "edit-profile-button", &edit_button,
1323 "delete-profile-button", &remove_button,
1324 "default-profile-hbox", &default_hbox,
1325 "default-profile-label", &default_label,
1326 NULL((void*)0)))
1327 return;
1328
1329 app->manage_profiles_dialog = GTK_WIDGET (dialog)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_widget_get_type ()))))))
;
1330 app->manage_profiles_new_button = GTK_WIDGET (new_button)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_button)), ((gtk_widget_get_type ()))))))
;
1331 app->manage_profiles_edit_button = GTK_WIDGET (edit_button)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((edit_button)), ((gtk_widget_get_type ()))))))
;
1332 app->manage_profiles_delete_button = GTK_WIDGET (remove_button)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((remove_button)), ((gtk_widget_get_type ()))))))
;
1333
1334 g_signal_connect (dialog, "response", G_CALLBACK (profile_list_response_cb), app)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_response_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1335 g_signal_connect (dialog, "destroy", G_CALLBACK (profile_list_destroyed_cb), app)g_signal_connect_data ((dialog), ("destroy"), (((GCallback) (
profile_list_destroyed_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1336
1337 app->manage_profiles_list = profile_list_treeview_create (app);
1338
1339 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (app->manage_profiles_list)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_list)), ((gtk_tree_view_get_type
()))))))
);
1340 g_signal_connect (selection, "changed", G_CALLBACK (profile_list_selection_changed_cb), app)g_signal_connect_data ((selection), ("changed"), (((GCallback
) (profile_list_selection_changed_cb))), (app), ((void*)0), (
GConnectFlags) 0)
;
1341
1342 profile_list_treeview_refill (app, app->manage_profiles_list);
1343 g_signal_connect (app, "profile-list-changed",g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_list_treeview_refill))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1344 G_CALLBACK (profile_list_treeview_refill), app->manage_profiles_list)g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_list_treeview_refill))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1345
1346 g_signal_connect (app->manage_profiles_list, "row-activated",g_signal_connect_data ((app->manage_profiles_list), ("row-activated"
), (((GCallback) (profile_list_row_activated_cb))), (app), ((
void*)0), (GConnectFlags) 0)
1347 G_CALLBACK (profile_list_row_activated_cb), app)g_signal_connect_data ((app->manage_profiles_list), ("row-activated"
), (((GCallback) (profile_list_row_activated_cb))), (app), ((
void*)0), (GConnectFlags) 0)
;
1348
1349 gtk_container_add (GTK_CONTAINER (tree_view_container)((((GtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view_container)), ((gtk_container_get_type ()))))))
, app->manage_profiles_list);
1350 gtk_widget_show (app->manage_profiles_list);
1351
1352 g_signal_connect (new_button, "clicked",g_signal_connect_data ((new_button), ("clicked"), (((GCallback
) (profile_list_new_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1353 G_CALLBACK (profile_list_new_button_clicked_cb),g_signal_connect_data ((new_button), ("clicked"), (((GCallback
) (profile_list_new_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1354 app->manage_profiles_list)g_signal_connect_data ((new_button), ("clicked"), (((GCallback
) (profile_list_new_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1355 g_signal_connect (edit_button, "clicked",g_signal_connect_data ((edit_button), ("clicked"), (((GCallback
) (profile_list_edit_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1356 G_CALLBACK (profile_list_edit_button_clicked_cb),g_signal_connect_data ((edit_button), ("clicked"), (((GCallback
) (profile_list_edit_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1357 app->manage_profiles_list)g_signal_connect_data ((edit_button), ("clicked"), (((GCallback
) (profile_list_edit_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1358 g_signal_connect (remove_button, "clicked",g_signal_connect_data ((remove_button), ("clicked"), (((GCallback
) (profile_list_delete_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1359 G_CALLBACK (profile_list_delete_button_clicked_cb),g_signal_connect_data ((remove_button), ("clicked"), (((GCallback
) (profile_list_delete_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1360 app->manage_profiles_list)g_signal_connect_data ((remove_button), ("clicked"), (((GCallback
) (profile_list_delete_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1361
1362 app->manage_profiles_default_menu = profile_combo_box_new (app);
1363 g_signal_connect (app->manage_profiles_default_menu, "changed",g_signal_connect_data ((app->manage_profiles_default_menu)
, ("changed"), (((GCallback) (profile_combo_box_changed_cb)))
, (app), ((void*)0), (GConnectFlags) 0)
1364 G_CALLBACK (profile_combo_box_changed_cb), app)g_signal_connect_data ((app->manage_profiles_default_menu)
, ("changed"), (((GCallback) (profile_combo_box_changed_cb)))
, (app), ((void*)0), (GConnectFlags) 0)
;
1365
1366 gtk_box_pack_start (GTK_BOX (default_hbox)((((GtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((default_hbox)), ((gtk_box_get_type ()))))))
, app->manage_profiles_default_menu, FALSE(0), FALSE(0), 0);
1367 gtk_widget_show (app->manage_profiles_default_menu);
1368
1369 gtk_label_set_mnemonic_widget (GTK_LABEL (default_label)((((GtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((default_label)), ((gtk_label_get_type ()))))))
, app->manage_profiles_default_menu);
1370
1371 gtk_widget_grab_focus (app->manage_profiles_list);
1372
1373 gtk_window_set_transient_for (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
,
1374 transient_parent);
1375
1376 gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
);
1377}
1378
1379#ifdef HAVE_SMCLIENT1
1380static void
1381terminal_app_save_state_cb (EggSMClient *client,
1382 GKeyFile *key_file,
1383 TerminalApp *app)
1384{
1385 terminal_app_save_config (app, key_file);
1386}
1387
1388static void
1389terminal_app_client_quit_cb (EggSMClient *client,
1390 TerminalApp *app)
1391{
1392 g_signal_emit (app, signals[QUIT], 0);
1393}
1394#endif /* HAVE_SMCLIENT */
1395
1396/* Class implementation */
1397
1398G_DEFINE_TYPE (TerminalApp, terminal_app, G_TYPE_OBJECT)static void terminal_app_init (TerminalApp *self); static void
terminal_app_class_init (TerminalAppClass *klass); static GType
terminal_app_get_type_once (void); static gpointer terminal_app_parent_class
= ((void*)0); static gint TerminalApp_private_offset; static
void terminal_app_class_intern_init (gpointer klass) { terminal_app_parent_class
= g_type_class_peek_parent (klass); if (TerminalApp_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &TerminalApp_private_offset
); terminal_app_class_init ((TerminalAppClass*) klass); } __attribute__
((__unused__)) static inline gpointer terminal_app_get_instance_private
(TerminalApp *self) { return (((gpointer) ((guint8*) (self) +
(glong) (TerminalApp_private_offset)))); } GType terminal_app_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ _Static_assert (sizeof *(&static_g_define_type_id) ==
sizeof (gpointer), "Expression evaluates to false"); (void) (
0 ? (gpointer) *(&static_g_define_type_id) : ((void*)0));
(!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = terminal_app_get_type_once
(); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } __attribute__ ((__noinline__)) static GType terminal_app_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
(((GType) ((20) << (2))), g_intern_static_string ("TerminalApp"
), sizeof (TerminalAppClass), (GClassInitFunc)(void (*)(void)
) terminal_app_class_intern_init, sizeof (TerminalApp), (GInstanceInitFunc
)(void (*)(void)) terminal_app_init, (GTypeFlags) 0); { {{};}
} return g_define_type_id; }
1399
1400static void
1401terminal_app_init (TerminalApp *app)
1402{
1403 global_app = app;
1404
1405 gtk_window_set_default_icon_name (MATE_TERMINAL_ICON_NAME"utilities-terminal");
1406
1407 /* Initialise defaults */
1408 app->enable_mnemonics = DEFAULT_ENABLE_MNEMONICS((!(0)));
1409 app->enable_menu_accels = DEFAULT_ENABLE_MENU_BAR_ACCEL((!(0)));
1410
1411 app->profiles = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
1412
1413 app->encodings = terminal_encodings_get_builtins ();
1414
1415 settings_global = g_settings_new (CONF_GLOBAL_SCHEMA"org.mate.terminal" ".global");
1416 app->settings_font = g_settings_new (MONOSPACE_FONT_SCHEMA"org.mate.interface");
1417
1418 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1419 "changed::" PROFILE_LIST_KEY,g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1420 G_CALLBACK(terminal_app_profile_list_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1421 app)g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
;
1422
1423 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
1424 "changed::" DEFAULT_PROFILE_KEY,g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
1425 G_CALLBACK(terminal_app_default_profile_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
1426 app)g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
;
1427
1428 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1429 "changed::" ENCODING_LIST_KEY,g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1430 G_CALLBACK(terminal_app_encoding_list_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1431 app)g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
;
1432
1433 g_signal_connect (app->settings_font,g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1434 "changed::" MONOSPACE_FONT_KEY,g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1435 G_CALLBACK(terminal_app_system_font_notify_cb),g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1436 app)g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
;
1437
1438 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
1439 "changed::" ENABLE_MNEMONICS_KEY,g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
1440 G_CALLBACK(terminal_app_enable_mnemonics_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
1441 app)g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
;
1442
1443 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
1444 "changed::" ENABLE_MENU_BAR_ACCEL_KEY,g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
1445 G_CALLBACK(terminal_app_enable_menu_accels_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
1446 app)g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
;
1447
1448 /* Load the settings */
1449 terminal_app_profile_list_notify_cb (settings_global,
1450 PROFILE_LIST_KEY"profile-list",
1451 app);
1452 terminal_app_default_profile_notify_cb (settings_global,
1453 DEFAULT_PROFILE_KEY"default-profile",
1454 app);
1455 terminal_app_encoding_list_notify_cb (settings_global,
1456 ENCODING_LIST_KEY"active-encodings",
1457 app);
1458 terminal_app_system_font_notify_cb (app->settings_font,
1459 MONOSPACE_FONT_KEY"monospace-font-name",
1460 app);
1461 terminal_app_enable_menu_accels_notify_cb (settings_global,
1462 ENABLE_MENU_BAR_ACCEL_KEY"use-menu-accelerators",
1463 app);
1464 terminal_app_enable_mnemonics_notify_cb (settings_global,
1465 ENABLE_MNEMONICS_KEY"use-mnemonics",
1466 app);
1467
1468 /* Ensure we have valid settings */
1469 g_assert (app->default_profile_id != NULL)do { if (app->default_profile_id != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1469, ((const char*) (__func__
)), "app->default_profile_id != NULL"); } while (0)
;
1470 g_assert (app->system_font_desc != NULL)do { if (app->system_font_desc != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1470, ((const char*) (__func__
)), "app->system_font_desc != NULL"); } while (0)
;
1471
1472 terminal_accels_init ();
1473
1474#ifdef HAVE_SMCLIENT1
1475 EggSMClient *sm_client;
1476 char *desktop_file;
1477
1478 desktop_file = g_build_filename (TERM_DATADIR"/usr/local/share",
1479 "applications",
1480 PACKAGE"mate-terminal" ".desktop",
1481 NULL((void*)0));
1482 egg_set_desktop_file_without_defaults (desktop_file);
1483 g_free (desktop_file);
1484
1485 sm_client = egg_sm_client_get ();
1486 g_signal_connect (sm_client, "save-state",g_signal_connect_data ((sm_client), ("save-state"), (((GCallback
) (terminal_app_save_state_cb))), (app), ((void*)0), (GConnectFlags
) 0)
1487 G_CALLBACK (terminal_app_save_state_cb), app)g_signal_connect_data ((sm_client), ("save-state"), (((GCallback
) (terminal_app_save_state_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1488 g_signal_connect (sm_client, "quit",g_signal_connect_data ((sm_client), ("quit"), (((GCallback) (
terminal_app_client_quit_cb))), (app), ((void*)0), (GConnectFlags
) 0)
1489 G_CALLBACK (terminal_app_client_quit_cb), app)g_signal_connect_data ((sm_client), ("quit"), (((GCallback) (
terminal_app_client_quit_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1490#endif /* HAVE_SMCLIENT */
1491}
1492
1493static void
1494terminal_app_finalize (GObject *object)
1495{
1496 TerminalApp *app = TERMINAL_APP (object)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_app_get_type ()))))))
;
1497
1498#ifdef HAVE_SMCLIENT1
1499 EggSMClient *sm_client;
1500
1501 sm_client = egg_sm_client_get ();
1502 g_signal_handlers_disconnect_matched (sm_client, G_SIGNAL_MATCH_DATA,
1503 0, 0, NULL((void*)0), NULL((void*)0), app);
1504#endif /* HAVE_SMCLIENT */
1505
1506 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
))
1507 G_CALLBACK(terminal_app_profile_list_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
))
1508 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
))
;
1509 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_default_profile_notify_cb))),
(app))
1510 G_CALLBACK(terminal_app_default_profile_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_default_profile_notify_cb))),
(app))
1511 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_default_profile_notify_cb))),
(app))
;
1512 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_encoding_list_notify_cb))), (
app))
1513 G_CALLBACK(terminal_app_encoding_list_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_encoding_list_notify_cb))), (
app))
1514 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_encoding_list_notify_cb))), (
app))
;
1515 g_signal_handlers_disconnect_by_func (app->settings_font,g_signal_handlers_disconnect_matched ((app->settings_font)
, (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (terminal_app_system_font_notify_cb
))), (app))
1516 G_CALLBACK(terminal_app_system_font_notify_cb),g_signal_handlers_disconnect_matched ((app->settings_font)
, (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (terminal_app_system_font_notify_cb
))), (app))
1517 app)g_signal_handlers_disconnect_matched ((app->settings_font)
, (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (terminal_app_system_font_notify_cb
))), (app))
;
1518 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_menu_accels_notify_cb)
)), (app))
1519 G_CALLBACK(terminal_app_enable_menu_accels_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_menu_accels_notify_cb)
)), (app))
1520 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_menu_accels_notify_cb)
)), (app))
;
1521 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_mnemonics_notify_cb)))
, (app))
1522 G_CALLBACK(terminal_app_enable_mnemonics_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_mnemonics_notify_cb)))
, (app))
1523 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_mnemonics_notify_cb)))
, (app))
;
1524
1525 g_object_unref (settings_global);
1526 g_object_unref (app->settings_font);
1527
1528 g_free (app->default_profile_id);
1529
1530 g_hash_table_destroy (app->profiles);
1531
1532 g_hash_table_destroy (app->encodings);
1533
1534 pango_font_description_free (app->system_font_desc);
1535
1536 terminal_accels_shutdown ();
1537
1538 G_OBJECT_CLASS (terminal_app_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_app_parent_class)), (((GType) ((20) << (2
))))))))
->finalize (object);
1539
1540 global_app = NULL((void*)0);
1541}
1542
1543static void
1544terminal_app_get_property (GObject *object,
1545 guint prop_id,
1546 GValue *value,
1547 GParamSpec *pspec)
1548{
1549 TerminalApp *app = TERMINAL_APP (object)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_app_get_type ()))))))
;
1550
1551 switch (prop_id)
1552 {
1553 case PROP_SYSTEM_FONT:
1554 if (app->system_font_desc)
1555 g_value_set_boxed (value, app->system_font_desc);
1556 else
1557 g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_MONOSPACE_FONT("Monospace 10")));
1558 break;
1559 case PROP_ENABLE_MENU_BAR_ACCEL:
1560 g_value_set_boolean (value, app->enable_menu_accels);
1561 break;
1562 case PROP_ENABLE_MNEMONICS:
1563 g_value_set_boolean (value, app->enable_mnemonics);
1564 break;
1565 case PROP_DEFAULT_PROFILE:
1566 g_value_set_object (value, app->default_profile);
1567 break;
1568 default:
1569 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-app.c", 1569, ("property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1570 break;
1571 }
1572}
1573
1574static void
1575terminal_app_set_property (GObject *object,
1576 guint prop_id,
1577 const GValue *value,
1578 GParamSpec *pspec)
1579{
1580 TerminalApp *app = TERMINAL_APP (object)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_app_get_type ()))))))
;
1581
1582 switch (prop_id)
1583 {
1584 case PROP_ENABLE_MENU_BAR_ACCEL:
1585 app->enable_menu_accels = g_value_get_boolean (value);
1586 g_settings_set_boolean (settings_global, ENABLE_MENU_BAR_ACCEL_KEY"use-menu-accelerators", app->enable_menu_accels);
1587 break;
1588 case PROP_ENABLE_MNEMONICS:
1589 app->enable_mnemonics = g_value_get_boolean (value);
1590 g_settings_set_boolean (settings_global, ENABLE_MNEMONICS_KEY"use-mnemonics", app->enable_mnemonics);
1591 break;
1592 case PROP_DEFAULT_PROFILE:
1593 case PROP_SYSTEM_FONT:
1594 /* not writable */
1595 default:
1596 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-app.c", 1596, ("property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1597 break;
1598 }
1599}
1600
1601static void
1602terminal_app_real_quit (TerminalApp *app)
1603{
1604 gtk_main_quit();
1605}
1606
1607static void
1608terminal_app_class_init (TerminalAppClass *klass)
1609{
1610 GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
;
1611
1612 object_class->finalize = terminal_app_finalize;
1613 object_class->get_property = terminal_app_get_property;
1614 object_class->set_property = terminal_app_set_property;
1615
1616 klass->quit = terminal_app_real_quit;
1617
1618 signals[QUIT] =
1619 g_signal_new (I_("quit")g_intern_static_string ("quit"),
1620 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1621 G_SIGNAL_RUN_LAST,
1622 G_STRUCT_OFFSET (TerminalAppClass, quit)((glong) __builtin_offsetof(TerminalAppClass, quit)),
1623 NULL((void*)0), NULL((void*)0),
1624 g_cclosure_marshal_VOID__VOID,
1625 G_TYPE_NONE((GType) ((1) << (2))), 0);
1626
1627 signals[PROFILE_LIST_CHANGED] =
1628 g_signal_new (I_("profile-list-changed")g_intern_static_string ("profile-list-changed"),
1629 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1630 G_SIGNAL_RUN_LAST,
1631 G_STRUCT_OFFSET (TerminalAppClass, profile_list_changed)((glong) __builtin_offsetof(TerminalAppClass, profile_list_changed
))
,
1632 NULL((void*)0), NULL((void*)0),
1633 g_cclosure_marshal_VOID__VOID,
1634 G_TYPE_NONE((GType) ((1) << (2))), 0);
1635
1636 signals[ENCODING_LIST_CHANGED] =
1637 g_signal_new (I_("encoding-list-changed")g_intern_static_string ("encoding-list-changed"),
1638 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1639 G_SIGNAL_RUN_LAST,
1640 G_STRUCT_OFFSET (TerminalAppClass, profile_list_changed)((glong) __builtin_offsetof(TerminalAppClass, profile_list_changed
))
,
1641 NULL((void*)0), NULL((void*)0),
1642 g_cclosure_marshal_VOID__VOID,
1643 G_TYPE_NONE((GType) ((1) << (2))), 0);
1644
1645 g_object_class_install_property
1646 (object_class,
1647 PROP_ENABLE_MENU_BAR_ACCEL,
1648 g_param_spec_boolean (TERMINAL_APP_ENABLE_MENU_BAR_ACCEL"enable-menu-accels", NULL((void*)0), NULL((void*)0),
1649 DEFAULT_ENABLE_MENU_BAR_ACCEL((!(0))),
1650 G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1651
1652 g_object_class_install_property
1653 (object_class,
1654 PROP_ENABLE_MNEMONICS,
1655 g_param_spec_boolean (TERMINAL_APP_ENABLE_MNEMONICS"enable-mnemonics", NULL((void*)0), NULL((void*)0),
1656 DEFAULT_ENABLE_MNEMONICS((!(0))),
1657 G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1658
1659 g_object_class_install_property
1660 (object_class,
1661 PROP_SYSTEM_FONT,
1662 g_param_spec_boxed (TERMINAL_APP_SYSTEM_FONT"system-font", NULL((void*)0), NULL((void*)0),
1663 PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()),
1664 G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1665
1666 g_object_class_install_property
1667 (object_class,
1668 PROP_DEFAULT_PROFILE,
1669 g_param_spec_object (TERMINAL_APP_DEFAULT_PROFILE"default-profile", NULL((void*)0), NULL((void*)0),
1670 TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()),
1671 G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1672}
1673
1674/* Public API */
1675
1676TerminalApp*
1677terminal_app_get (void)
1678{
1679 if (global_app == NULL((void*)0))
1680 {
1681 g_object_new (TERMINAL_TYPE_APP(terminal_app_get_type ()), NULL((void*)0));
1682 g_assert (global_app != NULL)do { if (global_app != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1682, ((const char*) (__func__
)), "global_app != NULL"); } while (0)
;
1683 }
1684
1685 return global_app;
1686}
1687
1688void
1689terminal_app_shutdown (void)
1690{
1691 if (global_app == NULL((void*)0))
1692 return;
1693
1694 g_object_unref (global_app);
1695 g_assert (global_app == NULL)do { if (global_app == ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1695, ((const char*) (__func__
)), "global_app == NULL"); } while (0)
;
1696}
1697
1698/**
1699 * terminal_app_handle_options:
1700 * @app:
1701 * @options: a #TerminalOptions
1702 * @allow_resume: whether to merge the terminal configuration from the
1703 * saved session on resume
1704 * @error: a #GError to fill in
1705 *
1706 * Processes @options. It loads or saves the terminal configuration, or
1707 * opens the specified windows and tabs.
1708 *
1709 * Returns: %TRUE if @options could be successfully handled, or %FALSE on
1710 * error
1711 */
1712gboolean
1713terminal_app_handle_options (TerminalApp *app,
1714 TerminalOptions *options,
1715 gboolean allow_resume,
1716 GError **error)
1717{
1718 GList *lw;
1719 GdkScreen *gdk_screen;
1720
1721 gdk_screen = terminal_app_get_screen_by_display_name (options->display_name);
1722
1723 if (options->save_config)
1724 {
1725 if (options->remote_arguments)
1726 return terminal_app_save_config_file (app, options->config_file, error);
1727
1728 g_set_error_literal (error, TERMINAL_OPTION_ERROR(g_quark_from_static_string ("terminal-option-error")), TERMINAL_OPTION_ERROR_NOT_IN_FACTORY,
1729 "Cannot use \"--save-config\" when starting the factory process");
1730 return FALSE(0);
1731 }
1732
1733 if (options->load_config)
1734 {
1735 GKeyFile *key_file;
1736 gboolean result;
1737
1738 key_file = g_key_file_new ();
1739 result = g_key_file_load_from_file (key_file, options->config_file, 0, error) &&
1740 terminal_options_merge_config (options, key_file, SOURCE_DEFAULT, error);
1741 g_key_file_free (key_file);
1742
1743 if (!result)
1744 return FALSE(0);
1745
1746 /* fall-through on success */
1747 }
1748
1749#ifdef HAVE_SMCLIENT1
1750 EggSMClient *sm_client;
1751
1752 sm_client = egg_sm_client_get ();
1753
1754 if (allow_resume && egg_sm_client_is_resumed (sm_client))
1755 {
1756 GKeyFile *key_file;
1757
1758 key_file = egg_sm_client_get_state_file (sm_client);
1759 if (key_file != NULL((void*)0) &&
1760 !terminal_options_merge_config (options, key_file, SOURCE_SESSION, error))
1761 return FALSE(0);
1762 }
1763#endif /* HAVE_SMCLIENT */
1764
1765 /* Make sure we open at least one window */
1766 terminal_options_ensure_window (options);
1767
1768 if (options->startup_id != NULL((void*)0))
1769 _terminal_debug_print (TERMINAL_DEBUG_FACTORY,do { if (0) g_printerr("Startup ID is '%s'\n", options->startup_id
); } while (0)
1770 "Startup ID is '%s'\n",do { if (0) g_printerr("Startup ID is '%s'\n", options->startup_id
); } while (0)
1771 options->startup_id)do { if (0) g_printerr("Startup ID is '%s'\n", options->startup_id
); } while (0)
;
1772
1773 for (lw = options->initial_windows; lw != NULL((void*)0); lw = lw->next)
1774 {
1775 InitialWindow *iw = lw->data;
1776 TerminalWindow *window = NULL((void*)0);
1777 GList *lt;
1778
1779 g_assert (iw->tabs)do { if (iw->tabs) ; else g_assertion_message_expr (((gchar
*) 0), "terminal-app.c", 1779, ((const char*) (__func__)), "iw->tabs"
); } while (0)
;
1780
1781 if ( lw == options->initial_windows && ((InitialTab *)iw->tabs->data)->attach_window )
1782 window = terminal_app_get_current_window(app, gdk_screen, options->initial_workspace);
1783
1784 if (!window)
1785 {
1786 /* Create & setup new window */
1787 window = terminal_app_new_window (app, gdk_screen);
1788
1789 /* Restored windows shouldn't demand attention; see bug #586308. */
1790 if (iw->source_tag == SOURCE_SESSION)
1791 terminal_window_set_is_restored (window);
1792
1793 if (options->startup_id != NULL((void*)0))
1794 gtk_window_set_startup_id (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
, options->startup_id);
1795
1796 /* Overwrite the default, unique window role set in terminal_window_init */
1797 if (iw->role)
1798 gtk_window_set_role (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
, iw->role);
1799
1800 if (iw->force_menubar_state)
1801 terminal_window_set_menubar_visible (window, iw->menubar_state);
1802
1803 if (iw->start_fullscreen)
1804 gtk_window_fullscreen (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
);
1805 if (iw->start_maximized)
1806 gtk_window_maximize (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
);
1807 }
1808
1809 /* Now add the tabs */
1810 for (lt = iw->tabs; lt != NULL((void*)0); lt = lt->next)
1811 {
1812 InitialTab *it = lt->data;
1813 TerminalProfile *profile = NULL((void*)0);
1814 TerminalScreen *screen;
1815 const char *profile_name;
1816 gboolean profile_is_id;
1817
1818 if (it->profile)
1819 {
1820 profile_name = it->profile;
1821 profile_is_id = it->profile_is_id;
1822 }
1823 else
1824 {
1825 profile_name = options->default_profile;
1826 profile_is_id = options->default_profile_is_id;
1827 }
1828
1829 if (profile_name)
1830 {
1831 if (profile_is_id)
1832 profile = terminal_app_get_profile_by_name (app, profile_name);
1833 else
1834 profile = terminal_app_get_profile_by_visible_name (app, profile_name);
1835
1836 if (profile == NULL((void*)0))
1837 g_printerr (_("No such profile \"%s\", using default profile\n")gettext ("No such profile \"%s\", using default profile\n"), it->profile);
1838 }
1839 if (profile == NULL((void*)0))
1840 profile = terminal_app_get_profile_for_new_term (app);
1841 g_assert (profile)do { if (profile) ; else g_assertion_message_expr (((gchar*) 0
), "terminal-app.c", 1841, ((const char*) (__func__)), "profile"
); } while (0)
;
1842
1843 screen = terminal_app_new_terminal (app, window, profile,
1844 it->exec_argv ? it->exec_argv : options->exec_argv,
1845 it->title ? it->title : options->default_title,
1846 it->working_dir ? it->working_dir : options->default_working_dir,
1847 options->env,
1848 it->zoom_set ? it->zoom : options->zoom);
1849
1850 if (it->active)
1851 terminal_window_switch_screen (window, screen);
1852 }
1853
1854 if (iw->geometry)
1855 {
1856 _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,do { if (0) g_printerr("[window %p] applying geometry %s\n", window
, iw->geometry); } while (0)
1857 "[window %p] applying geometry %s\n",do { if (0) g_printerr("[window %p] applying geometry %s\n", window
, iw->geometry); } while (0)
1858 window, iw->geometry)do { if (0) g_printerr("[window %p] applying geometry %s\n", window
, iw->geometry); } while (0)
;
1859
1860 if (!terminal_window_update_size_set_geometry (window,
1861 terminal_window_get_active (window),
1862 FALSE(0),
1863 iw->geometry))
1864 g_printerr (_("Invalid geometry string \"%s\"\n")gettext ("Invalid geometry string \"%s\"\n"), iw->geometry);
1865 }
1866
1867 gtk_window_present (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
);
1868 }
1869
1870 return TRUE(!(0));
1871}
1872
1873TerminalWindow *
1874terminal_app_new_window (TerminalApp *app,
1875 GdkScreen *screen)
1876{
1877 TerminalWindow *window;
1878
1879 window = terminal_window_new ();
1880
1881 app->windows = g_list_append (app->windows, window);
1882 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
terminal_window_destroyed))), (app), ((void*)0), (GConnectFlags
) 0)
1883 G_CALLBACK (terminal_window_destroyed), app)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
terminal_window_destroyed))), (app), ((void*)0), (GConnectFlags
) 0)
;
1884
1885 if (screen)
1886 gtk_window_set_screen (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
, screen);
1887
1888 return window;
1889}
1890
1891TerminalScreen *
1892terminal_app_new_terminal (TerminalApp *app,
1893 TerminalWindow *window,
1894 TerminalProfile *profile,
1895 char **override_command,
1896 const char *title,
1897 const char *working_dir,
1898 char **child_env,
1899 double zoom)
1900{
1901 TerminalScreen *screen;
1902
1903 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
1904 g_return_val_if_fail (TERMINAL_IS_WINDOW (window), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((terminal_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_WINDOW (window)"); return (((void
*)0)); } } while (0)
;
1905
1906 screen = terminal_screen_new (profile, override_command, title,
1907 working_dir, child_env, zoom);
1908
1909 terminal_window_add_screen (window, screen, -1);
1910 terminal_window_switch_screen (window, screen);
1911 gtk_widget_grab_focus (GTK_WIDGET (screen)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((screen)), ((gtk_widget_get_type ()))))))
);
1912
1913 return screen;
1914}
1915
1916void
1917terminal_app_edit_profile (TerminalApp *app,
1918 TerminalProfile *profile,
1919 GtkWindow *transient_parent,
1920 const char *widget_name)
1921{
1922 terminal_profile_edit (profile, transient_parent, widget_name);
1923}
1924
1925void
1926terminal_app_edit_keybindings (TerminalApp *app,
1927 GtkWindow *transient_parent)
1928{
1929 terminal_edit_keys_dialog_show (transient_parent);
1930}
1931
1932void
1933terminal_app_edit_encodings (TerminalApp *app,
1934 GtkWindow *transient_parent)
1935{
1936 terminal_encoding_dialog_show (transient_parent);
1937}
1938
1939/*
1940* Get the window in the given screen and workspace. If nothing is found,
1941* a NULL is returned.
1942*/
1943TerminalWindow *
1944terminal_app_get_current_window (TerminalApp *app,
1945 GdkScreen *from_screen,
1946 int workspace)
1947{
1948 GList *res = NULL((void*)0);
1949 TerminalWindow *ret = NULL((void*)0);
1950
1951 if (app->windows == NULL((void*)0))
1952 return NULL((void*)0);
1953
1954 res = g_list_last (app->windows);
1955
1956 g_assert (from_screen != NULL)do { if (from_screen != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1956, ((const char*) (__func__
)), "from_screen != NULL"); } while (0)
;
1957
1958 while (res)
1959 {
1960 int win_workspace;
1961 if (gtk_window_get_screen(GTK_WINDOW(res->data)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((res->data)), ((gtk_window_get_type ()))))))
) != from_screen)
1962 continue;
1963
1964 win_workspace = terminal_app_get_workspace_for_window(res->data);
1965
1966 /* Same workspace or if the window is set to show up on all workspaces */
1967 if (win_workspace == workspace || win_workspace == -1)
1968 ret = terminal_window_get_latest_focused (ret, TERMINAL_WINDOW(res->data)((((TerminalWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((res->data)), ((terminal_window_get_type ()))))))
);
1969
1970 res = g_list_previous (res)((res) ? (((GList *)(res))->prev) : ((void*)0));
1971 }
1972
1973 return ret;
1974}
1975
1976/**
1977 * terminal_profile_get_list:
1978 *
1979 * Returns: a #GList containing all #TerminalProfile objects.
1980 * The content of the list is owned by the backend and
1981 * should not be modified or freed. Use g_list_free() when done
1982 * using the list.
1983 */
1984GList*
1985terminal_app_get_profile_list (TerminalApp *app)
1986{
1987 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
1988
1989 return g_list_sort (g_hash_table_get_values (app->profiles), profiles_alphabetic_cmp);
1990}
1991
1992TerminalProfile*
1993terminal_app_get_profile_by_name (TerminalApp *app,
1994 const char *name)
1995{
1996 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
1997 g_return_val_if_fail (name != NULL, NULL)do { if ((name != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "name != NULL"); return
(((void*)0)); } } while (0)
;
1998
1999 return g_hash_table_lookup (app->profiles, name);
2000}
2001
2002TerminalProfile*
2003terminal_app_get_profile_by_visible_name (TerminalApp *app,
2004 const char *name)
2005{
2006 LookupInfo info;
2007
2008 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
2009 g_return_val_if_fail (name != NULL, NULL)do { if ((name != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "name != NULL"); return
(((void*)0)); } } while (0)
;
2010
2011 info.result = NULL((void*)0);
2012 info.target = name;
2013
2014 g_hash_table_foreach (app->profiles,
2015 profiles_lookup_by_visible_name_foreach,
2016 &info);
2017 return info.result;
2018}
2019
2020TerminalProfile*
2021terminal_app_get_default_profile (TerminalApp *app)
2022{
2023 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
2024
2025 return app->default_profile;
2026}
2027
2028TerminalProfile*
2029terminal_app_get_profile_for_new_term (TerminalApp *app)
2030{
2031 GHashTableIter iter;
2032 TerminalProfile *profile = NULL((void*)0);
2033 TerminalProfile **profileptr = &profile;
2034
2035 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
2036
2037 if (app->default_profile)
2038 return app->default_profile;
2039
2040 g_hash_table_iter_init (&iter, app->profiles);
2041 if (g_hash_table_iter_next (&iter, NULL((void*)0), (gpointer *) profileptr))
2042 return profile;
2043
2044 return NULL((void*)0);
2045}
2046
2047GHashTable *
2048terminal_app_get_encodings (TerminalApp *app)
2049{
2050 return app->encodings;
2051}
2052
2053/**
2054 * terminal_app_ensure_encoding:
2055 * @app:
2056 * @charset:
2057 *
2058 * Ensures there's a #TerminalEncoding for @charset available.
2059 */
2060TerminalEncoding *
2061terminal_app_ensure_encoding (TerminalApp *app,
2062 const char *charset)
2063{
2064 TerminalEncoding *encoding;
2065
2066 encoding = g_hash_table_lookup (app->encodings, charset);
2067 if (encoding == NULL((void*)0))
2068 {
2069 encoding = terminal_encoding_new (charset,
2070 _("User Defined")gettext ("User Defined"),
2071 TRUE(!(0)),
2072 TRUE(!(0)) /* scary! */);
2073 g_hash_table_insert (app->encodings,
2074 (gpointer) terminal_encoding_get_id (encoding),
2075 encoding);
2076 }
2077
2078 return encoding;
2079}
2080
2081/**
2082 * terminal_app_get_active_encodings:
2083 *
2084 * Returns: a newly allocated list of newly referenced #TerminalEncoding objects.
2085 */
2086GSList*
2087terminal_app_get_active_encodings (TerminalApp *app)
2088{
2089 GSList *list = NULL((void*)0);
2090 GHashTableIter iter;
2091 gpointer key, value;
2092
2093 g_hash_table_iter_init (&iter, app->encodings);
2094 while (g_hash_table_iter_next (&iter, &key, &value))
2095 {
2096 TerminalEncoding *encoding = (TerminalEncoding *) value;
2097
2098 if (!encoding->is_active)
2099 continue;
2100
2101 list = g_slist_prepend (list, terminal_encoding_ref (encoding));
2102 }
2103
2104 return g_slist_sort (list, (GCompareFunc) compare_encodings);
2105}
2106
2107void
2108terminal_app_save_config (TerminalApp *app,
2109 GKeyFile *key_file)
2110{
2111 GList *lw;
2112 guint n = 0;
2113 GPtrArray *window_names_array;
2114 char **window_names;
2115 gsize len;
2116
2117 g_key_file_set_comment (key_file, NULL((void*)0), NULL((void*)0), "Written by " PACKAGE_STRING"mate-terminal 1.28.0", NULL((void*)0));
2118
2119 g_key_file_set_integer (key_file, TERMINAL_CONFIG_GROUP"MATE Terminal Configuration", TERMINAL_CONFIG_PROP_VERSION"Version", TERMINAL_CONFIG_VERSION(1));
2120 g_key_file_set_integer (key_file, TERMINAL_CONFIG_GROUP"MATE Terminal Configuration", TERMINAL_CONFIG_PROP_COMPAT_VERSION"CompatVersion", TERMINAL_CONFIG_COMPAT_VERSION(1));
2121
2122 window_names_array = g_ptr_array_sized_new (g_list_length (app->windows) + 1);
2123
2124 for (lw = app->windows; lw != NULL((void*)0); lw = lw->next)
2125 {
2126 TerminalWindow *window = TERMINAL_WINDOW (lw->data)((((TerminalWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((lw->data)), ((terminal_window_get_type ()))))))
;
2127 char *group;
2128
2129 group = g_strdup_printf ("Window%u", n++);
2130 g_ptr_array_add (window_names_array, group);
2131
2132 terminal_window_save_state (window, key_file, group);
2133 }
2134
2135 len = window_names_array->len;
2136 g_ptr_array_add (window_names_array, NULL((void*)0));
2137 window_names = (char **) g_ptr_array_free (window_names_array, FALSE(0));
2138 g_key_file_set_string_list (key_file, TERMINAL_CONFIG_GROUP"MATE Terminal Configuration", TERMINAL_CONFIG_PROP_WINDOWS"Windows", (const char * const *) window_names, len);
2139 g_strfreev (window_names);
2140}
2141
2142gboolean
2143terminal_app_save_config_file (TerminalApp *app,
2144 const char *file_name,
2145 GError **error)
2146{
2147 GKeyFile *key_file;
2148 char *data;
2149 gsize len;
2150 gboolean result;
2151
2152 key_file = g_key_file_new ();
2153 terminal_app_save_config (app, key_file);
2154
2155 data = g_key_file_to_data (key_file, &len, NULL((void*)0));
2156 result = g_file_set_contents (file_name, data, len, error);
2157 g_free (data);
2158
2159 return result;
2160}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-2b0dd9.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-2b0dd9.html new file mode 100644 index 0000000..dd29e9f --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-2b0dd9.html @@ -0,0 +1,2840 @@ + + + +terminal-app.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:terminal-app.c
Warning:line 935, column 37
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name terminal-app.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I .. -I ../src/mate-submodules/libegg -D TERMINAL_COMPILATION -D TERMINAL_RESOURCES_PATH_PREFIX="/org/mate/terminal" -D TERM_DATADIR="/usr/local/share" -D TERM_LOCALEDIR="/usr/local/share/locale" -D TERM_PKGDATADIR="/usr/local/share/mate-terminal" -D TERM_HELPDIR="/usr/local/share/help" -D SN_API_NOT_YET_FROZEN -D GDK_MULTIHEAD_SAFE -D G_DISABLE_SINGLE_INCLUDES -D PANGO_DISABLE_SINGLE_INCLUDES -D ATK_DISABLE_SINGLE_INCLUDES -D GDK_DISABLE_SINGLE_INCLUDES -D GDK_PIXBUF_DISABLE_SINGLE_INCLUDES -D GTK_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c terminal-app.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright © 2001, 2002 Havoc Pennington
3 * Copyright © 2002 Red Hat, Inc.
4 * Copyright © 2002 Sun Microsystems
5 * Copyright © 2003 Mariano Suarez-Alvarez
6 * Copyright © 2008 Christian Persch
7 * Copyright (C) 2012-2021 MATE Developers
8 *
9 * Mate-terminal is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * Mate-terminal is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#include <config.h>
24
25#include <errno(*__errno_location ()).h>
26
27#include <glib.h>
28#include <dconf.h>
29
30#include "terminal-intl.h"
31
32#include "terminal-debug.h"
33#include "terminal-app.h"
34#include "terminal-accels.h"
35#include "terminal-screen.h"
36#include "terminal-screen-container.h"
37#include "terminal-window.h"
38#include "terminal-util.h"
39#include "profile-editor.h"
40#include "terminal-encoding.h"
41#include <string.h>
42#include <stdlib.h>
43
44#ifdef HAVE_SMCLIENT1
45#include "eggsmclient.h"
46#include "eggdesktopfile.h"
47#endif /* HAVE_SMCLIENT */
48
49#define FALLBACK_PROFILE_ID"default" "default"
50
51/* Settings storage works as follows:
52 * /apps/mate-terminal/global/
53 * /apps/mate-terminal/profiles/Foo/
54 *
55 * It's somewhat tricky to manage the profiles/ dir since we need to track
56 * the list of profiles, but GSettings doesn't have a concept of notifying that
57 * a directory has appeared or disappeared.
58 *
59 * Session state is stored entirely in the RestartCommand command line.
60 *
61 * The number one rule: all stored information is EITHER per-session,
62 * per-profile, or set from a command line option. THERE CAN BE NO
63 * OVERLAP. The UI and implementation totally break if you overlap
64 * these categories. See mate-terminal 1.x for why.
65 *
66 * Don't use this code as an example of how to use GSettings - it's hugely
67 * overcomplicated due to the profiles stuff. Most apps should not
68 * have to do scary things of this nature, and should not have
69 * a profiles feature.
70 *
71 */
72
73GSettings *settings_global;
74
75struct _TerminalAppClass
76{
77 GObjectClass parent_class;
78
79 void (* quit) (TerminalApp *app);
80 void (* profile_list_changed) (TerminalApp *app);
81 void (* encoding_list_changed) (TerminalApp *app);
82};
83
84struct _TerminalApp
85{
86 GObject parent_instance;
87
88 GList *windows;
89 GtkWidget *new_profile_dialog;
90 GtkWidget *manage_profiles_dialog;
91 GtkWidget *manage_profiles_list;
92 GtkWidget *manage_profiles_new_button;
93 GtkWidget *manage_profiles_edit_button;
94 GtkWidget *manage_profiles_delete_button;
95 GtkWidget *manage_profiles_default_menu;
96
97 GSettings *settings_font;
98
99 GHashTable *profiles;
100 char* default_profile_id;
101 TerminalProfile *default_profile;
102 gboolean default_profile_locked;
103
104 GHashTable *encodings;
105 gboolean encodings_locked;
106
107 PangoFontDescription *system_font_desc;
108 gboolean enable_mnemonics;
109 gboolean enable_menu_accels;
110};
111
112enum
113{
114 PROP_0,
115 PROP_DEFAULT_PROFILE,
116 PROP_ENABLE_MENU_BAR_ACCEL,
117 PROP_ENABLE_MNEMONICS,
118 PROP_SYSTEM_FONT,
119};
120
121enum
122{
123 QUIT,
124 PROFILE_LIST_CHANGED,
125 ENCODING_LIST_CHANGED,
126 LAST_SIGNAL
127};
128
129static guint signals[LAST_SIGNAL] = { 0 };
130
131enum
132{
133 COL_PROFILE,
134 NUM_COLUMNS
135};
136
137enum
138{
139 SOURCE_DEFAULT = 0,
140 SOURCE_SESSION = 1
141};
142
143static TerminalApp *global_app = NULL((void*)0);
144
145#define MONOSPACE_FONT_SCHEMA"org.mate.interface" "org.mate.interface"
146#define MONOSPACE_FONT_KEY"monospace-font-name" "monospace-font-name"
147#define DEFAULT_MONOSPACE_FONT("Monospace 10") ("Monospace 10")
148
149#define ENABLE_MNEMONICS_KEY"use-mnemonics" "use-mnemonics"
150#define DEFAULT_ENABLE_MNEMONICS((!(0))) (TRUE(!(0)))
151
152#define ENABLE_MENU_BAR_ACCEL_KEY"use-menu-accelerators" "use-menu-accelerators"
153#define DEFAULT_ENABLE_MENU_BAR_ACCEL((!(0))) (TRUE(!(0)))
154
155#define PROFILE_LIST_KEY"profile-list" "profile-list"
156#define DEFAULT_PROFILE_KEY"default-profile" "default-profile"
157
158#define ENCODING_LIST_KEY"active-encodings" "active-encodings"
159
160/* two following functions were copied from libmate-desktop to get rid
161 * of dependency on it
162 *
163 * FIXME: I suspect there's no need for excessive copies, we might use
164 * existing profile list to form GVariant's and write them to GSettings
165 */
166static gboolean
167gsettings_append_strv (GSettings *settings,
168 const gchar *key,
169 const gchar *value)
170{
171 gchar **old;
172 gchar **new;
173 gint size;
174 gboolean retval;
175
176 old = g_settings_get_strv (settings, key);
177
178 for (size = 0; old[size] != NULL((void*)0); size++);
179
180 size += 1; /* appended value */
181 size += 1; /* NULL */
182
183 new = g_realloc_n (old, size, sizeof (gchar *));
184
185 new[size - 2] = g_strdup (value)g_strdup_inline (value);
186 new[size - 1] = NULL((void*)0);
187
188 retval = g_settings_set_strv (settings, key,
189 (const gchar **) new);
190
191 g_strfreev (new);
192
193 return retval;
194}
195
196static gboolean
197gsettings_remove_all_from_strv (GSettings *settings,
198 const gchar *key,
199 const gchar *value)
200{
201 GArray *array;
202 gchar **old;
203 gint i;
204 gboolean retval;
205
206 old = g_settings_get_strv (settings, key);
207 array = g_array_new (TRUE(!(0)), TRUE(!(0)), sizeof (gchar *));
208
209 for (i = 0; old[i] != NULL((void*)0); i++) {
210 if (g_strcmp0 (old[i], value) != 0)
211 array = g_array_append_val (array, old[i])g_array_append_vals (array, &(old[i]), 1);
212 }
213
214 retval = g_settings_set_strv (settings, key,
215 (const gchar **) array->data);
216
217 g_strfreev (old);
218 g_array_free (array, TRUE(!(0)));
219
220 return retval;
221}
222
223/* Helper functions */
224
225static GdkScreen*
226terminal_app_get_screen_by_display_name (const char *display_name)
227{
228 GdkDisplay *display = NULL((void*)0);
229 GdkScreen *screen = NULL((void*)0);
230
231 if (display_name == NULL((void*)0))
232 display = gdk_display_get_default ();
233 else
234 {
235 GSList *displays, *l;
236 const char *period;
237
238 period = strrchr (display_name, '.');
239 displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
240 for (l = displays; l != NULL((void*)0); l = l->next)
241 {
242 GdkDisplay *disp = l->data;
243
244 /* compare without the screen number part, if present */
245 if ((period && strncmp (gdk_display_get_name (disp), display_name, period - display_name) == 0) ||
246 (period == NULL((void*)0) && strcmp (gdk_display_get_name (disp), display_name) == 0))
247 {
248 display = disp;
249 break;
250 }
251 }
252 g_slist_free (displays);
253
254 if (display == NULL((void*)0))
255 display = gdk_display_open (display_name); /* FIXME we never close displays */
256 }
257
258 if (display == NULL((void*)0))
259 return NULL((void*)0);
260 else
261 screen = gdk_display_get_default_screen (display);
262
263 return screen;
264}
265
266static int
267terminal_app_get_workspace_for_window (TerminalWindow *window)
268{
269 int ret = -1;
270 guchar *data = NULL((void*)0);
271 GdkAtom atom;
272 GdkAtom cardinal_atom;
273
274 atom = gdk_atom_intern_static_string ("_NET_WM_DESKTOP");
275 cardinal_atom = gdk_atom_intern_static_string ("CARDINAL");
276
277 gdk_property_get (gtk_widget_get_window(GTK_WIDGET(window)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_widget_get_type ()))))))
),
278 atom, cardinal_atom, 0, 8, FALSE(0),
279 NULL((void*)0), NULL((void*)0), NULL((void*)0), &data);
280
281 if (data)
282 ret = *(int *)data;
283
284 g_free (data);
285 return ret;
286}
287
288/* Menubar mnemonics settings handling */
289
290static int
291profiles_alphabetic_cmp (gconstpointer pa,
292 gconstpointer pb)
293{
294 TerminalProfile *a = (TerminalProfile *) pa;
295 TerminalProfile *b = (TerminalProfile *) pb;
296 int result;
297
298 result = g_utf8_collate (terminal_profile_get_property_string (a, TERMINAL_PROFILE_VISIBLE_NAME"visible-name"),
299 terminal_profile_get_property_string (b, TERMINAL_PROFILE_VISIBLE_NAME"visible-name"));
300 if (result == 0)
301 result = strcmp (terminal_profile_get_property_string (a, TERMINAL_PROFILE_NAME"name"),
302 terminal_profile_get_property_string (b, TERMINAL_PROFILE_NAME"name"));
303
304 return result;
305}
306
307typedef struct
308{
309 TerminalProfile *result;
310 const char *target;
311} LookupInfo;
312
313static void
314profiles_lookup_by_visible_name_foreach (gpointer key,
315 gpointer value,
316 gpointer data)
317{
318 LookupInfo *info = data;
319 const char *name;
320
321 name = terminal_profile_get_property_string (value, TERMINAL_PROFILE_VISIBLE_NAME"visible-name");
322 if (name && strcmp (info->target, name) == 0)
323 info->result = value;
324}
325
326static void
327terminal_window_destroyed (TerminalWindow *window,
328 TerminalApp *app)
329{
330 app->windows = g_list_remove (app->windows, window);
331
332 if (app->windows == NULL((void*)0))
333 g_signal_emit (app, signals[QUIT], 0);
334}
335
336static TerminalProfile *
337terminal_app_create_profile (TerminalApp *app,
338 const char *name)
339{
340 TerminalProfile *profile;
341
342 g_assert (terminal_app_get_profile_by_name (app, name) == NULL)do { if (terminal_app_get_profile_by_name (app, name) == ((void
*)0)) ; else g_assertion_message_expr (((gchar*) 0), "terminal-app.c"
, 342, ((const char*) (__func__)), "terminal_app_get_profile_by_name (app, name) == NULL"
); } while (0)
;
343
344 profile = _terminal_profile_new (name);
345
346 g_hash_table_insert (app->profiles,
347 g_strdup (terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME))g_strdup_inline (terminal_profile_get_property_string (profile
, "name"))
,
348 profile /* adopts the refcount */);
349
350 if (app->default_profile == NULL((void*)0) &&
351 app->default_profile_id != NULL((void*)0) &&
352 strcmp (app->default_profile_id,
353 terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name")) == 0)
354 {
355 /* We are the default profile */
356 app->default_profile = profile;
357 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
358 }
359
360 return profile;
361}
362
363static void
364terminal_app_delete_profile (TerminalProfile *profile)
365{
366 const char *profile_name;
367 char *profile_dir;
368 GError *error = NULL((void*)0);
369
370 profile_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name");
371 profile_dir = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", profile_name, "/", NULL((void*)0));
372
373 gsettings_remove_all_from_strv (settings_global, PROFILE_LIST_KEY"profile-list", profile_name);
374
375 /* And remove the profile directory */
376 DConfClient *client = dconf_client_new ();
377 if (!dconf_client_write_sync (client, profile_dir, NULL((void*)0), NULL((void*)0), NULL((void*)0), &error))
378 {
379 g_warning ("Failed to recursively unset %s: %s\n", profile_dir, error->message);
380 g_error_free (error);
381 }
382
383 g_object_unref (client);
384 g_free (profile_dir);
385}
386
387static void
388terminal_app_profile_cell_data_func (GtkTreeViewColumn *tree_column,
389 GtkCellRenderer *cell,
390 GtkTreeModel *tree_model,
391 GtkTreeIter *iter,
392 gpointer data)
393{
394 TerminalProfile *profile;
395 GValue value = { 0, };
396
397 gtk_tree_model_get (tree_model, iter, (int) COL_PROFILE, &profile, (int) -1);
398
399 g_value_init (&value, G_TYPE_STRING((GType) ((16) << (2))));
400 g_object_get_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, "visible-name", &value);
401 g_object_set_property (G_OBJECT (cell)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cell)), (((GType) ((20) << (2))))))))
, "text", &value);
402 g_value_unset (&value);
403}
404
405static int
406terminal_app_profile_sort_func (GtkTreeModel *model,
407 GtkTreeIter *a,
408 GtkTreeIter *b,
409 gpointer user_data)
410{
411 TerminalProfile *profile_a, *profile_b;
412 int retval;
413
414 gtk_tree_model_get (model, a, (int) COL_PROFILE, &profile_a, (int) -1);
415 gtk_tree_model_get (model, b, (int) COL_PROFILE, &profile_b, (int) -1);
416
417 retval = profiles_alphabetic_cmp (profile_a, profile_b);
418
419 g_object_unref (profile_a);
420 g_object_unref (profile_b);
421
422 return retval;
423}
424
425static /* ref */ GtkTreeModel *
426terminal_app_get_profile_liststore (TerminalApp *app,
427 TerminalProfile *selected_profile,
428 GtkTreeIter *selected_profile_iter,
429 gboolean *selected_profile_iter_set)
430{
431 GtkListStore *store;
432 GtkTreeIter iter;
433 GList *profiles, *l;
434
435 store = gtk_list_store_new (NUM_COLUMNS, TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()));
436
437 *selected_profile_iter_set = FALSE(0);
438
439 if (selected_profile &&
440 _terminal_profile_get_forgotten (selected_profile))
441 selected_profile = NULL((void*)0);
442
443 profiles = terminal_app_get_profile_list (app);
444
445 for (l = profiles; l != NULL((void*)0); l = l->next)
446 {
447 TerminalProfile *profile = TERMINAL_PROFILE (l->data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((terminal_profile_get_type ()))))))
;
448
449 gtk_list_store_insert_with_values (store, &iter, 0,
450 (int) COL_PROFILE, profile,
451 (int) -1);
452
453 if (selected_profile_iter && profile == selected_profile)
454 {
455 *selected_profile_iter = iter;
456 *selected_profile_iter_set = TRUE(!(0));
457 }
458 }
459 g_list_free (profiles);
460
461 /* Now turn on sorting */
462 gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (store)((((GtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((gtk_tree_sortable_get_type ()))))))
,
463 COL_PROFILE,
464 terminal_app_profile_sort_func,
465 NULL((void*)0), NULL((void*)0));
466 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store)((((GtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((gtk_tree_sortable_get_type ()))))))
,
467 COL_PROFILE, GTK_SORT_ASCENDING);
468
469 return GTK_TREE_MODEL (store)((((GtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((gtk_tree_model_get_type ()))))))
;
470}
471
472static /* ref */ TerminalProfile*
473profile_combo_box_get_selected (GtkWidget *widget)
474{
475 GtkComboBox *combo = GTK_COMBO_BOX (widget)((((GtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_combo_box_get_type ()))))))
;
476 TerminalProfile *profile = NULL((void*)0);
477 GtkTreeIter iter;
478
479 if (gtk_combo_box_get_active_iter (combo, &iter))
480 gtk_tree_model_get (gtk_combo_box_get_model (combo), &iter,
481 (int) COL_PROFILE, &profile, (int) -1);
482
483 return profile;
484}
485
486static void
487profile_combo_box_refill (TerminalApp *app,
488 GtkWidget *widget)
489{
490 GtkComboBox *combo = GTK_COMBO_BOX (widget)((((GtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_combo_box_get_type ()))))))
;
491 GtkTreeIter iter;
492 gboolean iter_set;
493 TerminalProfile *selected_profile;
494 GtkTreeModel *model;
495
496 selected_profile = profile_combo_box_get_selected (widget);
497 if (!selected_profile)
498 {
499 selected_profile = terminal_app_get_default_profile (app);
500 if (selected_profile)
501 g_object_ref (selected_profile)((__typeof__ (selected_profile)) (g_object_ref) (selected_profile
))
;
502 }
503
504 model = terminal_app_get_profile_liststore (app,
505 selected_profile,
506 &iter,
507 &iter_set);
508 gtk_combo_box_set_model (combo, model);
509 g_object_unref (model);
510
511 if (iter_set)
512 gtk_combo_box_set_active_iter (combo, &iter);
513
514 if (selected_profile)
515 g_object_unref (selected_profile);
516}
517
518static GtkWidget*
519profile_combo_box_new (TerminalApp *app)
520{
521 GtkWidget *combo;
522 GtkCellRenderer *renderer;
523
524 combo = gtk_combo_box_new ();
525 terminal_util_set_atk_name_description (combo, NULL((void*)0), _("Click button to choose profile")gettext ("Click button to choose profile"));
526
527 renderer = gtk_cell_renderer_text_new ();
528 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((gtk_cell_layout_get_type ()))))))
, renderer, TRUE(!(0)));
529 gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((gtk_cell_layout_get_type ()))))))
, renderer,
530 (GtkCellLayoutDataFunc) terminal_app_profile_cell_data_func,
531 NULL((void*)0), NULL((void*)0));
532
533 profile_combo_box_refill (app, combo);
534 g_signal_connect (app, "profile-list-changed",g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_combo_box_refill))), (combo), ((void*)0), (GConnectFlags
) 0)
535 G_CALLBACK (profile_combo_box_refill), combo)g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_combo_box_refill))), (combo), ((void*)0), (GConnectFlags
) 0)
;
536
537 gtk_widget_show (combo);
538 return combo;
539}
540
541static void
542profile_combo_box_changed_cb (GtkWidget *widget,
543 TerminalApp *app)
544{
545 TerminalProfile *profile;
546
547 profile = profile_combo_box_get_selected (widget);
548 if (!profile)
549 return;
550
551 g_settings_set_string (settings_global, DEFAULT_PROFILE_KEY"default-profile",
552 terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name"));
553
554 /* Even though the GSettings change notification does this, it happens too late.
555 * In some cases, the default profile changes twice in quick succession,
556 * and update_default_profile must be called in sync with those changes.
557 */
558 app->default_profile = profile;
559
560 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
561
562 g_object_unref (profile);
563}
564
565static void
566profile_list_treeview_refill (TerminalApp *app,
567 GtkWidget *widget)
568{
569 GtkTreeView *tree_view = GTK_TREE_VIEW (widget)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_tree_view_get_type ()))))))
;
570 GtkTreeIter iter;
571 gboolean iter_set;
572 GtkTreeSelection *selection;
573 GtkTreeModel *model;
574 TerminalProfile *selected_profile = NULL((void*)0);
575
576 model = gtk_tree_view_get_model (tree_view);
577
578 selection = gtk_tree_view_get_selection (tree_view);
579 if (gtk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
580 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
581
582 model = terminal_app_get_profile_liststore (terminal_app_get (),
583 selected_profile,
584 &iter,
585 &iter_set);
586 gtk_tree_view_set_model (tree_view, model);
587 g_object_unref (model);
588
589 if (!iter_set)
590 iter_set = gtk_tree_model_get_iter_first (model, &iter);
591
592 if (iter_set)
593 gtk_tree_selection_select_iter (selection, &iter);
594
595 if (selected_profile)
596 g_object_unref (selected_profile);
597}
598
599static GtkWidget*
600profile_list_treeview_create (TerminalApp *app)
601{
602 GtkWidget *tree_view;
603 GtkTreeSelection *selection;
604 GtkCellRenderer *renderer;
605 GtkTreeViewColumn *column;
606
607 tree_view = gtk_tree_view_new ();
608 terminal_util_set_atk_name_description (tree_view, _("Profile list")gettext ("Profile list"), NULL((void*)0));
609 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
, FALSE(0));
610
611 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
);
612 gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection)((((GtkTreeSelection*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((selection)), ((gtk_tree_selection_get_type (
)))))))
,
613 GTK_SELECTION_BROWSE);
614
615 column = gtk_tree_view_column_new ();
616 renderer = gtk_cell_renderer_text_new ();
617 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (column)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((column)), ((gtk_cell_layout_get_type ()))))))
, renderer, TRUE(!(0)));
618 gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (column)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((column)), ((gtk_cell_layout_get_type ()))))))
, renderer,
619 (GtkCellLayoutDataFunc) terminal_app_profile_cell_data_func,
620 NULL((void*)0), NULL((void*)0));
621 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
,
622 GTK_TREE_VIEW_COLUMN (column)((((GtkTreeViewColumn*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((column)), ((gtk_tree_view_column_get_type (
)))))))
);
623
624 return tree_view;
625}
626
627static void
628profile_list_delete_confirm_response_cb (GtkWidget *dialog,
629 int response)
630{
631 TerminalProfile *profile;
632
633 profile = TERMINAL_PROFILE (g_object_get_data (G_OBJECT (dialog), "profile"))((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_get_data (((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((dialog)), (((GType) ((20) << (2)))
))))), "profile"))), ((terminal_profile_get_type ()))))))
;
634 g_assert (profile != NULL)do { if (profile != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 634, ((const char*) (__func__
)), "profile != NULL"); } while (0)
;
635
636 if (response == GTK_RESPONSE_ACCEPT)
637 terminal_app_delete_profile (profile);
638
639 gtk_widget_destroy (dialog);
640}
641
642static void
643mate_dialog_add_button (GtkDialog *dialog,
644 const gchar *button_text,
645 const gchar *icon_name,
646 gint response_id)
647{
648 GtkWidget *button;
649
650 button = gtk_button_new_with_mnemonic (button_text);
651 gtk_button_set_image (GTK_BUTTON (button)((((GtkButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_button_get_type ()))))))
, gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON));
652
653 gtk_button_set_use_underline (GTK_BUTTON (button)((((GtkButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_button_get_type ()))))))
, TRUE(!(0)));
654 gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button");
655 gtk_widget_set_can_default (button, TRUE(!(0)));
656 gtk_widget_show (button);
657 gtk_dialog_add_action_widget (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
, button, response_id);
658}
659
660static void
661profile_list_delete_button_clicked_cb (GtkWidget *button,
662 GtkWidget *widget)
663{
664 GtkTreeView *tree_view = GTK_TREE_VIEW (widget)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_tree_view_get_type ()))))))
;
665 GtkTreeSelection *selection;
666 GtkWidget *dialog;
667 GtkTreeIter iter;
668 GtkTreeModel *model;
669 TerminalProfile *selected_profile;
670 GtkWidget *transient_parent;
671
672 model = gtk_tree_view_get_model (tree_view);
673 selection = gtk_tree_view_get_selection (tree_view);
674
675 if (!gtk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
676 return;
677
678 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
679
680 transient_parent = gtk_widget_get_toplevel (widget);
681 dialog = gtk_message_dialog_new (GTK_WINDOW (transient_parent)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((transient_parent)), ((gtk_window_get_type ()))))))
,
682 GTK_DIALOG_DESTROY_WITH_PARENT,
683 GTK_MESSAGE_QUESTION,
684 GTK_BUTTONS_NONE,
685 _("Delete profile “%s”?")gettext ("Delete profile “%s”?"),
686 terminal_profile_get_property_string (selected_profile, TERMINAL_PROFILE_VISIBLE_NAME"visible-name"));
687
688 mate_dialog_add_button (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
,
689 _("_Cancel")gettext ("_Cancel"),
690 "process-stop",
691 GTK_RESPONSE_REJECT);
692
693 mate_dialog_add_button (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
,
694 _("_Delete")gettext ("_Delete"),
695 "edit-delete",
696 GTK_RESPONSE_ACCEPT);
697
698 gtk_dialog_set_default_response (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
,
699 GTK_RESPONSE_ACCEPT);
700
701 gtk_window_set_title (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
, _("Delete Profile")gettext ("Delete Profile"));
702 gtk_window_set_resizable (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
, FALSE(0));
703
704 /* Transfer refcount of |selected_profile|, so no unref below */
705 g_object_set_data_full (G_OBJECT (dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), (((GType) ((20) << (2))))))))
, "profile", selected_profile, g_object_unref);
706
707 g_signal_connect (dialog, "response",g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_delete_confirm_response_cb))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
708 G_CALLBACK (profile_list_delete_confirm_response_cb),g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_delete_confirm_response_cb))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
709 NULL)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_delete_confirm_response_cb))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
;
710
711 gtk_window_present (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
);
712}
713
714static void
715profile_list_new_button_clicked_cb (GtkWidget *button,
716 gpointer data)
717{
718 TerminalApp *app;
719
720 app = terminal_app_get ();
721 terminal_app_new_profile (app, NULL((void*)0), GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
);
722}
723
724static void
725profile_list_edit_button_clicked_cb (GtkWidget *button,
726 GtkWidget *widget)
727{
728 GtkTreeView *tree_view = GTK_TREE_VIEW (widget)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_tree_view_get_type ()))))))
;
729 GtkTreeSelection *selection;
730 GtkTreeIter iter;
731 GtkTreeModel *model;
732 TerminalProfile *selected_profile;
733 TerminalApp *app;
734
735 app = terminal_app_get ();
736
737 model = gtk_tree_view_get_model (tree_view);
738 selection = gtk_tree_view_get_selection (tree_view);
739
740 if (!gtk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
741 return;
742
743 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
744
745 terminal_app_edit_profile (app, selected_profile,
746 GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
,
747 NULL((void*)0));
748 g_object_unref (selected_profile);
749}
750
751static void
752profile_list_row_activated_cb (GtkTreeView *tree_view,
753 GtkTreePath *path,
754 GtkTreeViewColumn *column,
755 gpointer data)
756{
757 GtkTreeIter iter;
758 GtkTreeModel *model;
759 TerminalProfile *selected_profile;
760 TerminalApp *app;
761
762 app = terminal_app_get ();
763
764 model = gtk_tree_view_get_model (tree_view);
765
766 if (!gtk_tree_model_get_iter (model, &iter, path))
767 return;
768
769 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
770
771 terminal_app_edit_profile (app, selected_profile,
772 GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
,
773 NULL((void*)0));
774 g_object_unref (selected_profile);
775}
776
777static GList*
778find_profile_link (GList *profiles,
779 const char *name)
780{
781 GList *l;
782
783 for (l = profiles; l != NULL((void*)0); l = l->next)
784 {
785 const char *profile_name;
786
787 profile_name = terminal_profile_get_property_string (TERMINAL_PROFILE (l->data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((terminal_profile_get_type ()))))))
, TERMINAL_PROFILE_NAME"name");
788 if (profile_name && strcmp (profile_name, name) == 0)
789 break;
790 }
791
792 return l;
793}
794
795static void
796terminal_app_profile_list_notify_cb (GSettings *settings,
797 const gchar *key,
798 gpointer user_data)
799{
800 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
801 GObject *object = G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
;
802 GVariant *val;
803 const gchar **value_list;
804 int i;
805 GList *profiles_to_delete, *l;
806 gboolean need_new_default;
807 TerminalProfile *fallback;
808 guint count;
809
810 g_object_freeze_notify (object);
811
812 profiles_to_delete = terminal_app_get_profile_list (app);
813
814 val = g_settings_get_value (settings, key);
815 if (val == NULL((void*)0) ||
816 (!g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY((const GVariantType *) "as")) &&
817 !g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s"))))
818 goto ensure_one_profile;
819
820 value_list = g_variant_get_strv (val, NULL((void*)0));
821 if (value_list == NULL((void*)0))
822 goto ensure_one_profile;
823
824 /* Add any new ones */
825 for (i = 0; value_list[i] != NULL((void*)0); ++i)
826 {
827 const char *profile_name = value_list[i];
828 GList *link;
829
830 if (!profile_name)
831 continue;
832
833 link = find_profile_link (profiles_to_delete, profile_name);
834 if (link)
835 /* make profiles_to_delete point to profiles we didn't find in the list */
836 profiles_to_delete = g_list_delete_link (profiles_to_delete, link);
837 else
838 terminal_app_create_profile (app, profile_name);
839 }
840
841 g_free (value_list);
842
843ensure_one_profile:
844
845 if (val != NULL((void*)0))
846 g_variant_unref (val);
847
848 fallback = NULL((void*)0);
849 count = g_hash_table_size (app->profiles);
850 if (count == 0 || count <= g_list_length (profiles_to_delete))
851 {
852 /* We are going to run out, so create the fallback
853 * to be sure we always have one. Must be done
854 * here before we emit "forgotten" signals so that
855 * screens have a profile to fall back to.
856 *
857 * If the profile with the FALLBACK_ID already exists,
858 * we aren't allowed to delete it, unless at least one
859 * other profile will still exist. And if you delete
860 * all profiles, the FALLBACK_ID profile returns as
861 * the living dead.
862 */
863 fallback = terminal_app_get_profile_by_name (app, FALLBACK_PROFILE_ID"default");
864 if (fallback == NULL((void*)0))
865 fallback = terminal_app_create_profile (app, FALLBACK_PROFILE_ID"default");
866 g_assert (fallback != NULL)do { if (fallback != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 866, ((const char*) (__func__
)), "fallback != NULL"); } while (0)
;
867 }
868
869 /* Forget no-longer-existing profiles */
870 need_new_default = FALSE(0);
871 for (l = profiles_to_delete; l != NULL((void*)0); l = l->next)
872 {
873 TerminalProfile *profile = TERMINAL_PROFILE (l->data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((terminal_profile_get_type ()))))))
;
874 const char *name;
875
876 name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name");
877 if (strcmp (name, FALLBACK_PROFILE_ID"default") == 0)
878 continue;
879
880 if (profile == app->default_profile)
881 {
882 app->default_profile = NULL((void*)0);
883 need_new_default = TRUE(!(0));
884 }
885
886 _terminal_profile_forget (profile);
887 g_hash_table_remove (app->profiles, name);
888
889 /* |profile| possibly isn't dead yet since the profiles dialogue's tree model holds a ref too... */
890 }
891 g_list_free (profiles_to_delete);
892
893 if (need_new_default)
894 {
895 TerminalProfile *new_default;
896 TerminalProfile **new_default_ptr = &new_default;
897
898 new_default = terminal_app_get_profile_by_name (app, FALLBACK_PROFILE_ID"default");
899 if (new_default == NULL((void*)0))
900 {
901 GHashTableIter iter;
902
903 g_hash_table_iter_init (&iter, app->profiles);
904 if (!g_hash_table_iter_next (&iter, NULL((void*)0), (gpointer *) new_default_ptr))
905 /* shouldn't really happen ever, but just to be safe */
906 new_default = terminal_app_create_profile (app, FALLBACK_PROFILE_ID"default");
907 }
908 g_assert (new_default != NULL)do { if (new_default != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 908, ((const char*) (__func__
)), "new_default != NULL"); } while (0)
;
909
910 app->default_profile = new_default;
911
912 g_object_notify (object, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
913 }
914
915 g_assert (g_hash_table_size (app->profiles) > 0)do { if (g_hash_table_size (app->profiles) > 0) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 915, ((const char*) (__func__
)), "g_hash_table_size (app->profiles) > 0"); } while (
0)
;
916
917 g_signal_emit (app, signals[PROFILE_LIST_CHANGED], 0);
918
919 g_object_thaw_notify (object);
920}
921
922static void
923terminal_app_default_profile_notify_cb (GSettings *settings,
924 const gchar *key,
925 gpointer user_data)
926{
927 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
928 GVariant *val;
929 const char *name = NULL((void*)0);
930
931 app->default_profile_locked = !g_settings_is_writable (settings, key);
932
933 val = g_settings_get_value (settings, key);
934 if (val != NULL((void*)0) &&
935 g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
936 name = g_variant_get_string (val, NULL((void*)0));
937 if (!name || !name[0])
938 name = FALLBACK_PROFILE_ID"default";
939 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-app.c", 939, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
940
941 g_free (app->default_profile_id);
942 app->default_profile_id = g_strdup (name)g_strdup_inline (name);
943
944 app->default_profile = terminal_app_get_profile_by_name (app, name);
945
946 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
947 g_variant_unref (val);
948}
949
950static int
951compare_encodings (TerminalEncoding *a,
952 TerminalEncoding *b)
953{
954 return g_utf8_collate (a->name, b->name);
955}
956
957static void
958encoding_mark_active (gpointer key,
959 gpointer value,
960 gpointer data)
961{
962 TerminalEncoding *encoding = (TerminalEncoding *) value;
963 guint active = GPOINTER_TO_UINT (data)((guint) (gulong) (data));
964
965 encoding->is_active = active;
966}
967
968static void
969terminal_app_encoding_list_notify_cb (GSettings *settings,
970 const gchar *key,
971 gpointer user_data)
972{
973 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
974 GVariant *val;
975 const gchar **strings;
976 int i;
977 TerminalEncoding *encoding;
978 const char *charset;
979
980 app->encodings_locked = !g_settings_is_writable (settings, key);
981
982 /* Mark all as non-active, then re-enable the active ones */
983 g_hash_table_foreach (app->encodings, (GHFunc) encoding_mark_active, GUINT_TO_POINTER (FALSE)((gpointer) (gulong) ((0))));
984
985 /* First add the locale's charset */
986 encoding = g_hash_table_lookup (app->encodings, "current");
987 g_assert (encoding)do { if (encoding) ; else g_assertion_message_expr (((gchar*)
0), "terminal-app.c", 987, ((const char*) (__func__)), "encoding"
); } while (0)
;
988 if (terminal_encoding_is_valid (encoding))
989 encoding->is_active = TRUE(!(0));
990
991 /* Also always make UTF-8 available */
992 encoding = g_hash_table_lookup (app->encodings, "UTF-8");
993 g_assert (encoding)do { if (encoding) ; else g_assertion_message_expr (((gchar*)
0), "terminal-app.c", 993, ((const char*) (__func__)), "encoding"
); } while (0)
;
994 if (terminal_encoding_is_valid (encoding))
995 encoding->is_active = TRUE(!(0));
996
997 val = g_settings_get_value (settings, key);
998 if (val != NULL((void*)0) &&
999 g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY((const GVariantType *) "as")))
1000 strings = g_variant_get_strv (val, NULL((void*)0));
1001 else
1002 strings = NULL((void*)0);
1003
1004 if (strings != NULL((void*)0))
1005 {
1006 for (i = 0; strings[i] != NULL((void*)0); ++i)
1007 {
1008 charset = strings[i];
1009 if (!charset)
1010 continue;
1011
1012 encoding = terminal_app_ensure_encoding (app, charset);
1013 if (!terminal_encoding_is_valid (encoding))
1014 continue;
1015
1016 encoding->is_active = TRUE(!(0));
1017 }
1018
1019 g_free (strings);
1020 }
1021
1022 g_signal_emit (app, signals[ENCODING_LIST_CHANGED], 0);
1023
1024 if (val != NULL((void*)0))
1025 g_variant_unref (val);
1026}
1027
1028static void
1029terminal_app_system_font_notify_cb (GSettings *settings,
1030 const gchar *key,
1031 gpointer user_data)
1032{
1033 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
1034 GVariant *val;
1035 const char *font = NULL((void*)0);
1036 PangoFontDescription *font_desc;
1037
1038 if (strcmp (key, MONOSPACE_FONT_KEY"monospace-font-name") != 0)
1039 return;
1040
1041 val = g_settings_get_value (settings, key);
1042 if (val &&
1043 g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
1044 font = g_variant_get_string (val, NULL((void*)0));
1045 if (!font)
1046 font = DEFAULT_MONOSPACE_FONT("Monospace 10");
1047 g_assert (font != NULL)do { if (font != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-app.c", 1047, ((const char*) (__func__
)), "font != NULL"); } while (0)
;
1048
1049 if (font && (strlen (font) == 0)) /* empty string */
1050 font = DEFAULT_MONOSPACE_FONT("Monospace 10");
1051
1052 font_desc = pango_font_description_from_string (font);
1053 if (app->system_font_desc &&
1054 pango_font_description_equal (app->system_font_desc, font_desc))
1055 {
1056 pango_font_description_free (font_desc);
1057 return;
1058 }
1059
1060 if (app->system_font_desc)
1061 pango_font_description_free (app->system_font_desc);
1062
1063 app->system_font_desc = font_desc;
1064
1065 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_SYSTEM_FONT"system-font");
1066 g_variant_unref (val);
1067}
1068
1069static void
1070terminal_app_enable_mnemonics_notify_cb (GSettings *settings,
1071 const gchar *key,
1072 gpointer user_data)
1073{
1074 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
1075 gboolean enable;
1076
1077 enable = g_settings_get_boolean (settings, key);
1078 if (enable == app->enable_mnemonics)
1079 return;
1080
1081 app->enable_mnemonics = enable;
1082 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_ENABLE_MNEMONICS"enable-mnemonics");
1083}
1084
1085static void
1086terminal_app_enable_menu_accels_notify_cb (GSettings *settings,
1087 const gchar *key,
1088 gpointer user_data)
1089{
1090 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
1091 gboolean enable;
1092
1093 enable = g_settings_get_boolean (settings, key);
1094 if (enable == app->enable_menu_accels)
1095 return;
1096
1097 app->enable_menu_accels = enable;
1098 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_ENABLE_MENU_BAR_ACCEL"enable-menu-accels");
1099}
1100
1101static void
1102new_profile_response_cb (GtkWidget *new_profile_dialog,
1103 int response_id,
1104 TerminalApp *app)
1105{
1106 if (response_id == GTK_RESPONSE_ACCEPT)
1107 {
1108 GtkWidget *name_entry;
1109 char *name;
1110 const char *new_profile_name;
1111 GtkWidget *base_option_menu;
1112 TerminalProfile *base_profile = NULL((void*)0);
1113 TerminalProfile *new_profile;
1114 GList *profiles;
1115 GList *tmp;
1116 GtkWindow *transient_parent;
1117 GtkWidget *confirm_dialog;
1118 gint retval;
1119
1120 base_option_menu = g_object_get_data (G_OBJECT (new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), (((GType) ((20) << (2)))))))
)
, "base_option_menu");
1121 base_profile = profile_combo_box_get_selected (base_option_menu);
1122 if (!base_profile)
1123 base_profile = terminal_app_get_default_profile (app);
1124 if (!base_profile)
1125 return; /* shouldn't happen ever though */
1126
1127 name_entry = g_object_get_data (G_OBJECT (new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), (((GType) ((20) << (2)))))))
)
, "name_entry");
1128 name = gtk_editable_get_chars (GTK_EDITABLE (name_entry)((((GtkEditable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((name_entry)), ((gtk_editable_get_type ()))))))
, 0, -1);
1129 g_strstrip (name)g_strchomp (g_strchug (name)); /* name will be non empty after stripping */
1130
1131 profiles = terminal_app_get_profile_list (app);
1132 for (tmp = profiles; tmp != NULL((void*)0); tmp = tmp->next)
1133 {
1134 TerminalProfile *profile = tmp->data;
1135 const char *visible_name;
1136
1137 visible_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_VISIBLE_NAME"visible-name");
1138
1139 if (visible_name && strcmp (name, visible_name) == 0)
1140 break;
1141 }
1142 if (tmp)
1143 {
1144 confirm_dialog = gtk_message_dialog_new (GTK_WINDOW (new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), ((gtk_window_get_type ()))))))
,
1145 GTK_DIALOG_DESTROY_WITH_PARENT,
1146 GTK_MESSAGE_QUESTION,
1147 GTK_BUTTONS_YES_NO,
1148 _("You already have a profile called “%s”. Do you want to create another profile with the same name?")gettext ("You already have a profile called “%s”. Do you want to create another profile with the same name?"
)
, name);
1149 /* Alternative button order was set automatically by GtkMessageDialog */
1150 retval = gtk_dialog_run (GTK_DIALOG (confirm_dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((confirm_dialog)), ((gtk_dialog_get_type ()))))))
);
1151 gtk_widget_destroy (confirm_dialog);
1152 if (retval == GTK_RESPONSE_NO)
1153 goto cleanup;
1154 }
1155 g_list_free (profiles);
1156
1157 transient_parent = gtk_window_get_transient_for (GTK_WINDOW (new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), ((gtk_window_get_type ()))))))
);
1158
1159 new_profile = _terminal_profile_clone (base_profile, name);
1160 new_profile_name = terminal_profile_get_property_string (new_profile, TERMINAL_PROFILE_NAME"name");
1161 g_hash_table_insert (app->profiles,
1162 g_strdup (new_profile_name)g_strdup_inline (new_profile_name),
1163 new_profile /* adopts the refcount */);
1164
1165 /* And now save the new profile name to GSettings */
1166 gsettings_append_strv (settings_global,
1167 PROFILE_LIST_KEY"profile-list",
1168 new_profile_name);
1169
1170 terminal_profile_edit (new_profile, transient_parent, NULL((void*)0));
1171
1172cleanup:
1173 g_free (name);
1174 }
1175
1176 gtk_widget_destroy (new_profile_dialog);
1177}
1178
1179static void
1180new_profile_dialog_destroy_cb (GtkWidget *new_profile_dialog,
1181 TerminalApp *app)
1182{
1183 GtkWidget *combo;
1184
1185 combo = g_object_get_data (G_OBJECT (new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), (((GType) ((20) << (2)))))))
)
, "base_option_menu");
1186 g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_combo_box_refill), combo)g_signal_handlers_disconnect_matched ((app), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (profile_combo_box_refill))), (combo))
;
1187
1188 app->new_profile_dialog = NULL((void*)0);
1189}
1190
1191static void
1192new_profile_name_entry_changed_cb (GtkEntry *entry,
1193 GtkDialog *dialog)
1194{
1195 const char *name;
1196
1197 name = gtk_entry_get_text (entry);
1198
1199 /* make the create button sensitive only if something other than space has been set */
1200 while (*name != '\0' && g_ascii_isspace (*name)((g_ascii_table[(guchar) (*name)] & G_ASCII_SPACE) != 0))
1201 ++name;
1202
1203 gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_ACCEPT, name[0] != '\0');
1204}
1205
1206void
1207terminal_app_new_profile (TerminalApp *app,
1208 TerminalProfile *default_base_profile,
1209 GtkWindow *transient_parent)
1210{
1211 if (app->new_profile_dialog == NULL((void*)0))
1212 {
1213 GtkWidget *create_button, *grid, *name_label, *name_entry, *base_label, *combo;
1214
1215 if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX"/org/mate/terminal" G_DIR_SEPARATOR_S"/" "ui/profile-new-dialog.ui",
1216 "new-profile-dialog", &app->new_profile_dialog,
1217 "new-profile-create-button", &create_button,
1218 "new-profile-grid", &grid,
1219 "new-profile-name-label", &name_label,
1220 "new-profile-name-entry", &name_entry,
1221 "new-profile-base-label", &base_label,
1222 NULL((void*)0)))
1223 return;
1224
1225 g_signal_connect (G_OBJECT (app->new_profile_dialog), "response", G_CALLBACK (new_profile_response_cb), app)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((app->new_profile_dialog)), (((GType) (
(20) << (2))))))))), ("response"), (((GCallback) (new_profile_response_cb
))), (app), ((void*)0), (GConnectFlags) 0)
;
1226 g_signal_connect (app->new_profile_dialog, "destroy", G_CALLBACK (new_profile_dialog_destroy_cb), app)g_signal_connect_data ((app->new_profile_dialog), ("destroy"
), (((GCallback) (new_profile_dialog_destroy_cb))), (app), ((
void*)0), (GConnectFlags) 0)
;
1227
1228 g_object_set_data (G_OBJECT (app->new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), (((GType) ((20) << (
2))))))))
, "create_button", create_button);
1229 gtk_widget_set_sensitive (create_button, FALSE(0));
1230
1231 /* the name entry */
1232 g_object_set_data (G_OBJECT (app->new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), (((GType) ((20) << (
2))))))))
, "name_entry", name_entry);
1233 g_signal_connect (name_entry, "changed", G_CALLBACK (new_profile_name_entry_changed_cb), app->new_profile_dialog)g_signal_connect_data ((name_entry), ("changed"), (((GCallback
) (new_profile_name_entry_changed_cb))), (app->new_profile_dialog
), ((void*)0), (GConnectFlags) 0)
;
1234 gtk_entry_set_activates_default (GTK_ENTRY (name_entry)((((GtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((name_entry)), ((gtk_entry_get_type ()))))))
, TRUE(!(0)));
1235 gtk_widget_grab_focus (name_entry);
1236
1237 gtk_label_set_mnemonic_widget (GTK_LABEL (name_label)((((GtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((name_label)), ((gtk_label_get_type ()))))))
, name_entry);
1238
1239 /* the base profile option menu */
1240 combo = profile_combo_box_new (app);
1241 gtk_grid_attach (GTK_GRID (grid)((((GtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((gtk_grid_get_type ()))))))
, combo, 2, 1, 1, 1);
1242 g_object_set_data (G_OBJECT (app->new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), (((GType) ((20) << (
2))))))))
, "base_option_menu", combo);
1243 terminal_util_set_atk_name_description (combo, NULL((void*)0), _("Choose base profile")gettext ("Choose base profile"));
1244
1245 gtk_label_set_mnemonic_widget (GTK_LABEL (base_label)((((GtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((base_label)), ((gtk_label_get_type ()))))))
, combo);
1246
1247 gtk_dialog_set_default_response (GTK_DIALOG (app->new_profile_dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_dialog_get_type ()))
))))
, GTK_RESPONSE_ACCEPT);
1248 gtk_dialog_set_response_sensitive (GTK_DIALOG (app->new_profile_dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_dialog_get_type ()))
))))
, GTK_RESPONSE_ACCEPT, FALSE(0));
1249 }
1250
1251 gtk_window_set_transient_for (GTK_WINDOW (app->new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_window_get_type ()))
))))
,
1252 transient_parent);
1253
1254 gtk_window_present (GTK_WINDOW (app->new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_window_get_type ()))
))))
);
1255}
1256
1257static void
1258profile_list_selection_changed_cb (GtkTreeSelection *selection,
1259 TerminalApp *app)
1260{
1261 gboolean selected;
1262
1263 selected = gtk_tree_selection_get_selected (selection, NULL((void*)0), NULL((void*)0));
1264
1265 gtk_widget_set_sensitive (app->manage_profiles_edit_button, selected);
1266 gtk_widget_set_sensitive (app->manage_profiles_delete_button,
1267 selected &&
1268 g_hash_table_size (app->profiles) > 1);
1269}
1270
1271static void
1272profile_list_response_cb (GtkWidget *dialog,
1273 int id,
1274 TerminalApp *app)
1275{
1276 g_assert (app->manage_profiles_dialog == dialog)do { if (app->manage_profiles_dialog == dialog) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1276, ((const char*) (__func__
)), "app->manage_profiles_dialog == dialog"); } while (0)
;
1277
1278 if (id == GTK_RESPONSE_HELP)
1279 {
1280 terminal_util_show_help ("mate-terminal-manage-profiles", GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
);
1281 return;
1282 }
1283
1284 gtk_widget_destroy (dialog);
1285}
1286
1287static void
1288profile_list_destroyed_cb (GtkWidget *manage_profiles_dialog,
1289 TerminalApp *app)
1290{
1291 g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_list_treeview_refill), app->manage_profiles_list)g_signal_handlers_disconnect_matched ((app), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (profile_list_treeview_refill))), (app->
manage_profiles_list))
;
1292 g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_combo_box_refill), app->manage_profiles_default_menu)g_signal_handlers_disconnect_matched ((app), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (profile_combo_box_refill))), (app->manage_profiles_default_menu
))
;
1293
1294 app->manage_profiles_dialog = NULL((void*)0);
1295 app->manage_profiles_list = NULL((void*)0);
1296 app->manage_profiles_new_button = NULL((void*)0);
1297 app->manage_profiles_edit_button = NULL((void*)0);
1298 app->manage_profiles_delete_button = NULL((void*)0);
1299 app->manage_profiles_default_menu = NULL((void*)0);
1300}
1301
1302void
1303terminal_app_manage_profiles (TerminalApp *app,
1304 GtkWindow *transient_parent)
1305{
1306 GObject *dialog;
1307 GObject *tree_view_container, *new_button, *edit_button, *remove_button;
1308 GObject *default_hbox, *default_label;
1309 GtkTreeSelection *selection;
1310
1311 if (app->manage_profiles_dialog)
1312 {
1313 gtk_window_set_transient_for (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
, transient_parent);
1314 gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
);
1315 return;
1316 }
1317
1318 if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX"/org/mate/terminal" G_DIR_SEPARATOR_S"/" "ui/profile-manager.ui",
1319 "profile-manager", &dialog,
1320 "profiles-treeview-container", &tree_view_container,
1321 "new-profile-button", &new_button,
1322 "edit-profile-button", &edit_button,
1323 "delete-profile-button", &remove_button,
1324 "default-profile-hbox", &default_hbox,
1325 "default-profile-label", &default_label,
1326 NULL((void*)0)))
1327 return;
1328
1329 app->manage_profiles_dialog = GTK_WIDGET (dialog)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_widget_get_type ()))))))
;
1330 app->manage_profiles_new_button = GTK_WIDGET (new_button)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_button)), ((gtk_widget_get_type ()))))))
;
1331 app->manage_profiles_edit_button = GTK_WIDGET (edit_button)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((edit_button)), ((gtk_widget_get_type ()))))))
;
1332 app->manage_profiles_delete_button = GTK_WIDGET (remove_button)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((remove_button)), ((gtk_widget_get_type ()))))))
;
1333
1334 g_signal_connect (dialog, "response", G_CALLBACK (profile_list_response_cb), app)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_response_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1335 g_signal_connect (dialog, "destroy", G_CALLBACK (profile_list_destroyed_cb), app)g_signal_connect_data ((dialog), ("destroy"), (((GCallback) (
profile_list_destroyed_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1336
1337 app->manage_profiles_list = profile_list_treeview_create (app);
1338
1339 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (app->manage_profiles_list)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_list)), ((gtk_tree_view_get_type
()))))))
);
1340 g_signal_connect (selection, "changed", G_CALLBACK (profile_list_selection_changed_cb), app)g_signal_connect_data ((selection), ("changed"), (((GCallback
) (profile_list_selection_changed_cb))), (app), ((void*)0), (
GConnectFlags) 0)
;
1341
1342 profile_list_treeview_refill (app, app->manage_profiles_list);
1343 g_signal_connect (app, "profile-list-changed",g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_list_treeview_refill))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1344 G_CALLBACK (profile_list_treeview_refill), app->manage_profiles_list)g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_list_treeview_refill))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1345
1346 g_signal_connect (app->manage_profiles_list, "row-activated",g_signal_connect_data ((app->manage_profiles_list), ("row-activated"
), (((GCallback) (profile_list_row_activated_cb))), (app), ((
void*)0), (GConnectFlags) 0)
1347 G_CALLBACK (profile_list_row_activated_cb), app)g_signal_connect_data ((app->manage_profiles_list), ("row-activated"
), (((GCallback) (profile_list_row_activated_cb))), (app), ((
void*)0), (GConnectFlags) 0)
;
1348
1349 gtk_container_add (GTK_CONTAINER (tree_view_container)((((GtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view_container)), ((gtk_container_get_type ()))))))
, app->manage_profiles_list);
1350 gtk_widget_show (app->manage_profiles_list);
1351
1352 g_signal_connect (new_button, "clicked",g_signal_connect_data ((new_button), ("clicked"), (((GCallback
) (profile_list_new_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1353 G_CALLBACK (profile_list_new_button_clicked_cb),g_signal_connect_data ((new_button), ("clicked"), (((GCallback
) (profile_list_new_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1354 app->manage_profiles_list)g_signal_connect_data ((new_button), ("clicked"), (((GCallback
) (profile_list_new_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1355 g_signal_connect (edit_button, "clicked",g_signal_connect_data ((edit_button), ("clicked"), (((GCallback
) (profile_list_edit_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1356 G_CALLBACK (profile_list_edit_button_clicked_cb),g_signal_connect_data ((edit_button), ("clicked"), (((GCallback
) (profile_list_edit_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1357 app->manage_profiles_list)g_signal_connect_data ((edit_button), ("clicked"), (((GCallback
) (profile_list_edit_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1358 g_signal_connect (remove_button, "clicked",g_signal_connect_data ((remove_button), ("clicked"), (((GCallback
) (profile_list_delete_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1359 G_CALLBACK (profile_list_delete_button_clicked_cb),g_signal_connect_data ((remove_button), ("clicked"), (((GCallback
) (profile_list_delete_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1360 app->manage_profiles_list)g_signal_connect_data ((remove_button), ("clicked"), (((GCallback
) (profile_list_delete_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1361
1362 app->manage_profiles_default_menu = profile_combo_box_new (app);
1363 g_signal_connect (app->manage_profiles_default_menu, "changed",g_signal_connect_data ((app->manage_profiles_default_menu)
, ("changed"), (((GCallback) (profile_combo_box_changed_cb)))
, (app), ((void*)0), (GConnectFlags) 0)
1364 G_CALLBACK (profile_combo_box_changed_cb), app)g_signal_connect_data ((app->manage_profiles_default_menu)
, ("changed"), (((GCallback) (profile_combo_box_changed_cb)))
, (app), ((void*)0), (GConnectFlags) 0)
;
1365
1366 gtk_box_pack_start (GTK_BOX (default_hbox)((((GtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((default_hbox)), ((gtk_box_get_type ()))))))
, app->manage_profiles_default_menu, FALSE(0), FALSE(0), 0);
1367 gtk_widget_show (app->manage_profiles_default_menu);
1368
1369 gtk_label_set_mnemonic_widget (GTK_LABEL (default_label)((((GtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((default_label)), ((gtk_label_get_type ()))))))
, app->manage_profiles_default_menu);
1370
1371 gtk_widget_grab_focus (app->manage_profiles_list);
1372
1373 gtk_window_set_transient_for (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
,
1374 transient_parent);
1375
1376 gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
);
1377}
1378
1379#ifdef HAVE_SMCLIENT1
1380static void
1381terminal_app_save_state_cb (EggSMClient *client,
1382 GKeyFile *key_file,
1383 TerminalApp *app)
1384{
1385 terminal_app_save_config (app, key_file);
1386}
1387
1388static void
1389terminal_app_client_quit_cb (EggSMClient *client,
1390 TerminalApp *app)
1391{
1392 g_signal_emit (app, signals[QUIT], 0);
1393}
1394#endif /* HAVE_SMCLIENT */
1395
1396/* Class implementation */
1397
1398G_DEFINE_TYPE (TerminalApp, terminal_app, G_TYPE_OBJECT)static void terminal_app_init (TerminalApp *self); static void
terminal_app_class_init (TerminalAppClass *klass); static GType
terminal_app_get_type_once (void); static gpointer terminal_app_parent_class
= ((void*)0); static gint TerminalApp_private_offset; static
void terminal_app_class_intern_init (gpointer klass) { terminal_app_parent_class
= g_type_class_peek_parent (klass); if (TerminalApp_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &TerminalApp_private_offset
); terminal_app_class_init ((TerminalAppClass*) klass); } __attribute__
((__unused__)) static inline gpointer terminal_app_get_instance_private
(TerminalApp *self) { return (((gpointer) ((guint8*) (self) +
(glong) (TerminalApp_private_offset)))); } GType terminal_app_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ _Static_assert (sizeof *(&static_g_define_type_id) ==
sizeof (gpointer), "Expression evaluates to false"); (void) (
0 ? (gpointer) *(&static_g_define_type_id) : ((void*)0));
(!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = terminal_app_get_type_once
(); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } __attribute__ ((__noinline__)) static GType terminal_app_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
(((GType) ((20) << (2))), g_intern_static_string ("TerminalApp"
), sizeof (TerminalAppClass), (GClassInitFunc)(void (*)(void)
) terminal_app_class_intern_init, sizeof (TerminalApp), (GInstanceInitFunc
)(void (*)(void)) terminal_app_init, (GTypeFlags) 0); { {{};}
} return g_define_type_id; }
1399
1400static void
1401terminal_app_init (TerminalApp *app)
1402{
1403 global_app = app;
1404
1405 gtk_window_set_default_icon_name (MATE_TERMINAL_ICON_NAME"utilities-terminal");
1406
1407 /* Initialise defaults */
1408 app->enable_mnemonics = DEFAULT_ENABLE_MNEMONICS((!(0)));
1409 app->enable_menu_accels = DEFAULT_ENABLE_MENU_BAR_ACCEL((!(0)));
1410
1411 app->profiles = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
1412
1413 app->encodings = terminal_encodings_get_builtins ();
1414
1415 settings_global = g_settings_new (CONF_GLOBAL_SCHEMA"org.mate.terminal" ".global");
1416 app->settings_font = g_settings_new (MONOSPACE_FONT_SCHEMA"org.mate.interface");
1417
1418 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1419 "changed::" PROFILE_LIST_KEY,g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1420 G_CALLBACK(terminal_app_profile_list_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1421 app)g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
;
1422
1423 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
1424 "changed::" DEFAULT_PROFILE_KEY,g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
1425 G_CALLBACK(terminal_app_default_profile_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
1426 app)g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
;
1427
1428 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1429 "changed::" ENCODING_LIST_KEY,g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1430 G_CALLBACK(terminal_app_encoding_list_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1431 app)g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
;
1432
1433 g_signal_connect (app->settings_font,g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1434 "changed::" MONOSPACE_FONT_KEY,g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1435 G_CALLBACK(terminal_app_system_font_notify_cb),g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1436 app)g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
;
1437
1438 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
1439 "changed::" ENABLE_MNEMONICS_KEY,g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
1440 G_CALLBACK(terminal_app_enable_mnemonics_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
1441 app)g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
;
1442
1443 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
1444 "changed::" ENABLE_MENU_BAR_ACCEL_KEY,g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
1445 G_CALLBACK(terminal_app_enable_menu_accels_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
1446 app)g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
;
1447
1448 /* Load the settings */
1449 terminal_app_profile_list_notify_cb (settings_global,
1450 PROFILE_LIST_KEY"profile-list",
1451 app);
1452 terminal_app_default_profile_notify_cb (settings_global,
1453 DEFAULT_PROFILE_KEY"default-profile",
1454 app);
1455 terminal_app_encoding_list_notify_cb (settings_global,
1456 ENCODING_LIST_KEY"active-encodings",
1457 app);
1458 terminal_app_system_font_notify_cb (app->settings_font,
1459 MONOSPACE_FONT_KEY"monospace-font-name",
1460 app);
1461 terminal_app_enable_menu_accels_notify_cb (settings_global,
1462 ENABLE_MENU_BAR_ACCEL_KEY"use-menu-accelerators",
1463 app);
1464 terminal_app_enable_mnemonics_notify_cb (settings_global,
1465 ENABLE_MNEMONICS_KEY"use-mnemonics",
1466 app);
1467
1468 /* Ensure we have valid settings */
1469 g_assert (app->default_profile_id != NULL)do { if (app->default_profile_id != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1469, ((const char*) (__func__
)), "app->default_profile_id != NULL"); } while (0)
;
1470 g_assert (app->system_font_desc != NULL)do { if (app->system_font_desc != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1470, ((const char*) (__func__
)), "app->system_font_desc != NULL"); } while (0)
;
1471
1472 terminal_accels_init ();
1473
1474#ifdef HAVE_SMCLIENT1
1475 EggSMClient *sm_client;
1476 char *desktop_file;
1477
1478 desktop_file = g_build_filename (TERM_DATADIR"/usr/local/share",
1479 "applications",
1480 PACKAGE"mate-terminal" ".desktop",
1481 NULL((void*)0));
1482 egg_set_desktop_file_without_defaults (desktop_file);
1483 g_free (desktop_file);
1484
1485 sm_client = egg_sm_client_get ();
1486 g_signal_connect (sm_client, "save-state",g_signal_connect_data ((sm_client), ("save-state"), (((GCallback
) (terminal_app_save_state_cb))), (app), ((void*)0), (GConnectFlags
) 0)
1487 G_CALLBACK (terminal_app_save_state_cb), app)g_signal_connect_data ((sm_client), ("save-state"), (((GCallback
) (terminal_app_save_state_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1488 g_signal_connect (sm_client, "quit",g_signal_connect_data ((sm_client), ("quit"), (((GCallback) (
terminal_app_client_quit_cb))), (app), ((void*)0), (GConnectFlags
) 0)
1489 G_CALLBACK (terminal_app_client_quit_cb), app)g_signal_connect_data ((sm_client), ("quit"), (((GCallback) (
terminal_app_client_quit_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1490#endif /* HAVE_SMCLIENT */
1491}
1492
1493static void
1494terminal_app_finalize (GObject *object)
1495{
1496 TerminalApp *app = TERMINAL_APP (object)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_app_get_type ()))))))
;
1497
1498#ifdef HAVE_SMCLIENT1
1499 EggSMClient *sm_client;
1500
1501 sm_client = egg_sm_client_get ();
1502 g_signal_handlers_disconnect_matched (sm_client, G_SIGNAL_MATCH_DATA,
1503 0, 0, NULL((void*)0), NULL((void*)0), app);
1504#endif /* HAVE_SMCLIENT */
1505
1506 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
))
1507 G_CALLBACK(terminal_app_profile_list_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
))
1508 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
))
;
1509 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_default_profile_notify_cb))),
(app))
1510 G_CALLBACK(terminal_app_default_profile_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_default_profile_notify_cb))),
(app))
1511 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_default_profile_notify_cb))),
(app))
;
1512 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_encoding_list_notify_cb))), (
app))
1513 G_CALLBACK(terminal_app_encoding_list_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_encoding_list_notify_cb))), (
app))
1514 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_encoding_list_notify_cb))), (
app))
;
1515 g_signal_handlers_disconnect_by_func (app->settings_font,g_signal_handlers_disconnect_matched ((app->settings_font)
, (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (terminal_app_system_font_notify_cb
))), (app))
1516 G_CALLBACK(terminal_app_system_font_notify_cb),g_signal_handlers_disconnect_matched ((app->settings_font)
, (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (terminal_app_system_font_notify_cb
))), (app))
1517 app)g_signal_handlers_disconnect_matched ((app->settings_font)
, (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (terminal_app_system_font_notify_cb
))), (app))
;
1518 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_menu_accels_notify_cb)
)), (app))
1519 G_CALLBACK(terminal_app_enable_menu_accels_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_menu_accels_notify_cb)
)), (app))
1520 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_menu_accels_notify_cb)
)), (app))
;
1521 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_mnemonics_notify_cb)))
, (app))
1522 G_CALLBACK(terminal_app_enable_mnemonics_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_mnemonics_notify_cb)))
, (app))
1523 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_mnemonics_notify_cb)))
, (app))
;
1524
1525 g_object_unref (settings_global);
1526 g_object_unref (app->settings_font);
1527
1528 g_free (app->default_profile_id);
1529
1530 g_hash_table_destroy (app->profiles);
1531
1532 g_hash_table_destroy (app->encodings);
1533
1534 pango_font_description_free (app->system_font_desc);
1535
1536 terminal_accels_shutdown ();
1537
1538 G_OBJECT_CLASS (terminal_app_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_app_parent_class)), (((GType) ((20) << (2
))))))))
->finalize (object);
1539
1540 global_app = NULL((void*)0);
1541}
1542
1543static void
1544terminal_app_get_property (GObject *object,
1545 guint prop_id,
1546 GValue *value,
1547 GParamSpec *pspec)
1548{
1549 TerminalApp *app = TERMINAL_APP (object)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_app_get_type ()))))))
;
1550
1551 switch (prop_id)
1552 {
1553 case PROP_SYSTEM_FONT:
1554 if (app->system_font_desc)
1555 g_value_set_boxed (value, app->system_font_desc);
1556 else
1557 g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_MONOSPACE_FONT("Monospace 10")));
1558 break;
1559 case PROP_ENABLE_MENU_BAR_ACCEL:
1560 g_value_set_boolean (value, app->enable_menu_accels);
1561 break;
1562 case PROP_ENABLE_MNEMONICS:
1563 g_value_set_boolean (value, app->enable_mnemonics);
1564 break;
1565 case PROP_DEFAULT_PROFILE:
1566 g_value_set_object (value, app->default_profile);
1567 break;
1568 default:
1569 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-app.c", 1569, ("property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1570 break;
1571 }
1572}
1573
1574static void
1575terminal_app_set_property (GObject *object,
1576 guint prop_id,
1577 const GValue *value,
1578 GParamSpec *pspec)
1579{
1580 TerminalApp *app = TERMINAL_APP (object)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_app_get_type ()))))))
;
1581
1582 switch (prop_id)
1583 {
1584 case PROP_ENABLE_MENU_BAR_ACCEL:
1585 app->enable_menu_accels = g_value_get_boolean (value);
1586 g_settings_set_boolean (settings_global, ENABLE_MENU_BAR_ACCEL_KEY"use-menu-accelerators", app->enable_menu_accels);
1587 break;
1588 case PROP_ENABLE_MNEMONICS:
1589 app->enable_mnemonics = g_value_get_boolean (value);
1590 g_settings_set_boolean (settings_global, ENABLE_MNEMONICS_KEY"use-mnemonics", app->enable_mnemonics);
1591 break;
1592 case PROP_DEFAULT_PROFILE:
1593 case PROP_SYSTEM_FONT:
1594 /* not writable */
1595 default:
1596 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-app.c", 1596, ("property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1597 break;
1598 }
1599}
1600
1601static void
1602terminal_app_real_quit (TerminalApp *app)
1603{
1604 gtk_main_quit();
1605}
1606
1607static void
1608terminal_app_class_init (TerminalAppClass *klass)
1609{
1610 GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
;
1611
1612 object_class->finalize = terminal_app_finalize;
1613 object_class->get_property = terminal_app_get_property;
1614 object_class->set_property = terminal_app_set_property;
1615
1616 klass->quit = terminal_app_real_quit;
1617
1618 signals[QUIT] =
1619 g_signal_new (I_("quit")g_intern_static_string ("quit"),
1620 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1621 G_SIGNAL_RUN_LAST,
1622 G_STRUCT_OFFSET (TerminalAppClass, quit)((glong) __builtin_offsetof(TerminalAppClass, quit)),
1623 NULL((void*)0), NULL((void*)0),
1624 g_cclosure_marshal_VOID__VOID,
1625 G_TYPE_NONE((GType) ((1) << (2))), 0);
1626
1627 signals[PROFILE_LIST_CHANGED] =
1628 g_signal_new (I_("profile-list-changed")g_intern_static_string ("profile-list-changed"),
1629 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1630 G_SIGNAL_RUN_LAST,
1631 G_STRUCT_OFFSET (TerminalAppClass, profile_list_changed)((glong) __builtin_offsetof(TerminalAppClass, profile_list_changed
))
,
1632 NULL((void*)0), NULL((void*)0),
1633 g_cclosure_marshal_VOID__VOID,
1634 G_TYPE_NONE((GType) ((1) << (2))), 0);
1635
1636 signals[ENCODING_LIST_CHANGED] =
1637 g_signal_new (I_("encoding-list-changed")g_intern_static_string ("encoding-list-changed"),
1638 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1639 G_SIGNAL_RUN_LAST,
1640 G_STRUCT_OFFSET (TerminalAppClass, profile_list_changed)((glong) __builtin_offsetof(TerminalAppClass, profile_list_changed
))
,
1641 NULL((void*)0), NULL((void*)0),
1642 g_cclosure_marshal_VOID__VOID,
1643 G_TYPE_NONE((GType) ((1) << (2))), 0);
1644
1645 g_object_class_install_property
1646 (object_class,
1647 PROP_ENABLE_MENU_BAR_ACCEL,
1648 g_param_spec_boolean (TERMINAL_APP_ENABLE_MENU_BAR_ACCEL"enable-menu-accels", NULL((void*)0), NULL((void*)0),
1649 DEFAULT_ENABLE_MENU_BAR_ACCEL((!(0))),
1650 G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1651
1652 g_object_class_install_property
1653 (object_class,
1654 PROP_ENABLE_MNEMONICS,
1655 g_param_spec_boolean (TERMINAL_APP_ENABLE_MNEMONICS"enable-mnemonics", NULL((void*)0), NULL((void*)0),
1656 DEFAULT_ENABLE_MNEMONICS((!(0))),
1657 G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1658
1659 g_object_class_install_property
1660 (object_class,
1661 PROP_SYSTEM_FONT,
1662 g_param_spec_boxed (TERMINAL_APP_SYSTEM_FONT"system-font", NULL((void*)0), NULL((void*)0),
1663 PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()),
1664 G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1665
1666 g_object_class_install_property
1667 (object_class,
1668 PROP_DEFAULT_PROFILE,
1669 g_param_spec_object (TERMINAL_APP_DEFAULT_PROFILE"default-profile", NULL((void*)0), NULL((void*)0),
1670 TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()),
1671 G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1672}
1673
1674/* Public API */
1675
1676TerminalApp*
1677terminal_app_get (void)
1678{
1679 if (global_app == NULL((void*)0))
1680 {
1681 g_object_new (TERMINAL_TYPE_APP(terminal_app_get_type ()), NULL((void*)0));
1682 g_assert (global_app != NULL)do { if (global_app != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1682, ((const char*) (__func__
)), "global_app != NULL"); } while (0)
;
1683 }
1684
1685 return global_app;
1686}
1687
1688void
1689terminal_app_shutdown (void)
1690{
1691 if (global_app == NULL((void*)0))
1692 return;
1693
1694 g_object_unref (global_app);
1695 g_assert (global_app == NULL)do { if (global_app == ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1695, ((const char*) (__func__
)), "global_app == NULL"); } while (0)
;
1696}
1697
1698/**
1699 * terminal_app_handle_options:
1700 * @app:
1701 * @options: a #TerminalOptions
1702 * @allow_resume: whether to merge the terminal configuration from the
1703 * saved session on resume
1704 * @error: a #GError to fill in
1705 *
1706 * Processes @options. It loads or saves the terminal configuration, or
1707 * opens the specified windows and tabs.
1708 *
1709 * Returns: %TRUE if @options could be successfully handled, or %FALSE on
1710 * error
1711 */
1712gboolean
1713terminal_app_handle_options (TerminalApp *app,
1714 TerminalOptions *options,
1715 gboolean allow_resume,
1716 GError **error)
1717{
1718 GList *lw;
1719 GdkScreen *gdk_screen;
1720
1721 gdk_screen = terminal_app_get_screen_by_display_name (options->display_name);
1722
1723 if (options->save_config)
1724 {
1725 if (options->remote_arguments)
1726 return terminal_app_save_config_file (app, options->config_file, error);
1727
1728 g_set_error_literal (error, TERMINAL_OPTION_ERROR(g_quark_from_static_string ("terminal-option-error")), TERMINAL_OPTION_ERROR_NOT_IN_FACTORY,
1729 "Cannot use \"--save-config\" when starting the factory process");
1730 return FALSE(0);
1731 }
1732
1733 if (options->load_config)
1734 {
1735 GKeyFile *key_file;
1736 gboolean result;
1737
1738 key_file = g_key_file_new ();
1739 result = g_key_file_load_from_file (key_file, options->config_file, 0, error) &&
1740 terminal_options_merge_config (options, key_file, SOURCE_DEFAULT, error);
1741 g_key_file_free (key_file);
1742
1743 if (!result)
1744 return FALSE(0);
1745
1746 /* fall-through on success */
1747 }
1748
1749#ifdef HAVE_SMCLIENT1
1750 EggSMClient *sm_client;
1751
1752 sm_client = egg_sm_client_get ();
1753
1754 if (allow_resume && egg_sm_client_is_resumed (sm_client))
1755 {
1756 GKeyFile *key_file;
1757
1758 key_file = egg_sm_client_get_state_file (sm_client);
1759 if (key_file != NULL((void*)0) &&
1760 !terminal_options_merge_config (options, key_file, SOURCE_SESSION, error))
1761 return FALSE(0);
1762 }
1763#endif /* HAVE_SMCLIENT */
1764
1765 /* Make sure we open at least one window */
1766 terminal_options_ensure_window (options);
1767
1768 if (options->startup_id != NULL((void*)0))
1769 _terminal_debug_print (TERMINAL_DEBUG_FACTORY,do { if (0) g_printerr("Startup ID is '%s'\n", options->startup_id
); } while (0)
1770 "Startup ID is '%s'\n",do { if (0) g_printerr("Startup ID is '%s'\n", options->startup_id
); } while (0)
1771 options->startup_id)do { if (0) g_printerr("Startup ID is '%s'\n", options->startup_id
); } while (0)
;
1772
1773 for (lw = options->initial_windows; lw != NULL((void*)0); lw = lw->next)
1774 {
1775 InitialWindow *iw = lw->data;
1776 TerminalWindow *window = NULL((void*)0);
1777 GList *lt;
1778
1779 g_assert (iw->tabs)do { if (iw->tabs) ; else g_assertion_message_expr (((gchar
*) 0), "terminal-app.c", 1779, ((const char*) (__func__)), "iw->tabs"
); } while (0)
;
1780
1781 if ( lw == options->initial_windows && ((InitialTab *)iw->tabs->data)->attach_window )
1782 window = terminal_app_get_current_window(app, gdk_screen, options->initial_workspace);
1783
1784 if (!window)
1785 {
1786 /* Create & setup new window */
1787 window = terminal_app_new_window (app, gdk_screen);
1788
1789 /* Restored windows shouldn't demand attention; see bug #586308. */
1790 if (iw->source_tag == SOURCE_SESSION)
1791 terminal_window_set_is_restored (window);
1792
1793 if (options->startup_id != NULL((void*)0))
1794 gtk_window_set_startup_id (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
, options->startup_id);
1795
1796 /* Overwrite the default, unique window role set in terminal_window_init */
1797 if (iw->role)
1798 gtk_window_set_role (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
, iw->role);
1799
1800 if (iw->force_menubar_state)
1801 terminal_window_set_menubar_visible (window, iw->menubar_state);
1802
1803 if (iw->start_fullscreen)
1804 gtk_window_fullscreen (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
);
1805 if (iw->start_maximized)
1806 gtk_window_maximize (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
);
1807 }
1808
1809 /* Now add the tabs */
1810 for (lt = iw->tabs; lt != NULL((void*)0); lt = lt->next)
1811 {
1812 InitialTab *it = lt->data;
1813 TerminalProfile *profile = NULL((void*)0);
1814 TerminalScreen *screen;
1815 const char *profile_name;
1816 gboolean profile_is_id;
1817
1818 if (it->profile)
1819 {
1820 profile_name = it->profile;
1821 profile_is_id = it->profile_is_id;
1822 }
1823 else
1824 {
1825 profile_name = options->default_profile;
1826 profile_is_id = options->default_profile_is_id;
1827 }
1828
1829 if (profile_name)
1830 {
1831 if (profile_is_id)
1832 profile = terminal_app_get_profile_by_name (app, profile_name);
1833 else
1834 profile = terminal_app_get_profile_by_visible_name (app, profile_name);
1835
1836 if (profile == NULL((void*)0))
1837 g_printerr (_("No such profile \"%s\", using default profile\n")gettext ("No such profile \"%s\", using default profile\n"), it->profile);
1838 }
1839 if (profile == NULL((void*)0))
1840 profile = terminal_app_get_profile_for_new_term (app);
1841 g_assert (profile)do { if (profile) ; else g_assertion_message_expr (((gchar*) 0
), "terminal-app.c", 1841, ((const char*) (__func__)), "profile"
); } while (0)
;
1842
1843 screen = terminal_app_new_terminal (app, window, profile,
1844 it->exec_argv ? it->exec_argv : options->exec_argv,
1845 it->title ? it->title : options->default_title,
1846 it->working_dir ? it->working_dir : options->default_working_dir,
1847 options->env,
1848 it->zoom_set ? it->zoom : options->zoom);
1849
1850 if (it->active)
1851 terminal_window_switch_screen (window, screen);
1852 }
1853
1854 if (iw->geometry)
1855 {
1856 _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,do { if (0) g_printerr("[window %p] applying geometry %s\n", window
, iw->geometry); } while (0)
1857 "[window %p] applying geometry %s\n",do { if (0) g_printerr("[window %p] applying geometry %s\n", window
, iw->geometry); } while (0)
1858 window, iw->geometry)do { if (0) g_printerr("[window %p] applying geometry %s\n", window
, iw->geometry); } while (0)
;
1859
1860 if (!terminal_window_update_size_set_geometry (window,
1861 terminal_window_get_active (window),
1862 FALSE(0),
1863 iw->geometry))
1864 g_printerr (_("Invalid geometry string \"%s\"\n")gettext ("Invalid geometry string \"%s\"\n"), iw->geometry);
1865 }
1866
1867 gtk_window_present (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
);
1868 }
1869
1870 return TRUE(!(0));
1871}
1872
1873TerminalWindow *
1874terminal_app_new_window (TerminalApp *app,
1875 GdkScreen *screen)
1876{
1877 TerminalWindow *window;
1878
1879 window = terminal_window_new ();
1880
1881 app->windows = g_list_append (app->windows, window);
1882 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
terminal_window_destroyed))), (app), ((void*)0), (GConnectFlags
) 0)
1883 G_CALLBACK (terminal_window_destroyed), app)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
terminal_window_destroyed))), (app), ((void*)0), (GConnectFlags
) 0)
;
1884
1885 if (screen)
1886 gtk_window_set_screen (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
, screen);
1887
1888 return window;
1889}
1890
1891TerminalScreen *
1892terminal_app_new_terminal (TerminalApp *app,
1893 TerminalWindow *window,
1894 TerminalProfile *profile,
1895 char **override_command,
1896 const char *title,
1897 const char *working_dir,
1898 char **child_env,
1899 double zoom)
1900{
1901 TerminalScreen *screen;
1902
1903 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
1904 g_return_val_if_fail (TERMINAL_IS_WINDOW (window), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((terminal_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_WINDOW (window)"); return (((void
*)0)); } } while (0)
;
1905
1906 screen = terminal_screen_new (profile, override_command, title,
1907 working_dir, child_env, zoom);
1908
1909 terminal_window_add_screen (window, screen, -1);
1910 terminal_window_switch_screen (window, screen);
1911 gtk_widget_grab_focus (GTK_WIDGET (screen)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((screen)), ((gtk_widget_get_type ()))))))
);
1912
1913 return screen;
1914}
1915
1916void
1917terminal_app_edit_profile (TerminalApp *app,
1918 TerminalProfile *profile,
1919 GtkWindow *transient_parent,
1920 const char *widget_name)
1921{
1922 terminal_profile_edit (profile, transient_parent, widget_name);
1923}
1924
1925void
1926terminal_app_edit_keybindings (TerminalApp *app,
1927 GtkWindow *transient_parent)
1928{
1929 terminal_edit_keys_dialog_show (transient_parent);
1930}
1931
1932void
1933terminal_app_edit_encodings (TerminalApp *app,
1934 GtkWindow *transient_parent)
1935{
1936 terminal_encoding_dialog_show (transient_parent);
1937}
1938
1939/*
1940* Get the window in the given screen and workspace. If nothing is found,
1941* a NULL is returned.
1942*/
1943TerminalWindow *
1944terminal_app_get_current_window (TerminalApp *app,
1945 GdkScreen *from_screen,
1946 int workspace)
1947{
1948 GList *res = NULL((void*)0);
1949 TerminalWindow *ret = NULL((void*)0);
1950
1951 if (app->windows == NULL((void*)0))
1952 return NULL((void*)0);
1953
1954 res = g_list_last (app->windows);
1955
1956 g_assert (from_screen != NULL)do { if (from_screen != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1956, ((const char*) (__func__
)), "from_screen != NULL"); } while (0)
;
1957
1958 while (res)
1959 {
1960 int win_workspace;
1961 if (gtk_window_get_screen(GTK_WINDOW(res->data)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((res->data)), ((gtk_window_get_type ()))))))
) != from_screen)
1962 continue;
1963
1964 win_workspace = terminal_app_get_workspace_for_window(res->data);
1965
1966 /* Same workspace or if the window is set to show up on all workspaces */
1967 if (win_workspace == workspace || win_workspace == -1)
1968 ret = terminal_window_get_latest_focused (ret, TERMINAL_WINDOW(res->data)((((TerminalWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((res->data)), ((terminal_window_get_type ()))))))
);
1969
1970 res = g_list_previous (res)((res) ? (((GList *)(res))->prev) : ((void*)0));
1971 }
1972
1973 return ret;
1974}
1975
1976/**
1977 * terminal_profile_get_list:
1978 *
1979 * Returns: a #GList containing all #TerminalProfile objects.
1980 * The content of the list is owned by the backend and
1981 * should not be modified or freed. Use g_list_free() when done
1982 * using the list.
1983 */
1984GList*
1985terminal_app_get_profile_list (TerminalApp *app)
1986{
1987 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
1988
1989 return g_list_sort (g_hash_table_get_values (app->profiles), profiles_alphabetic_cmp);
1990}
1991
1992TerminalProfile*
1993terminal_app_get_profile_by_name (TerminalApp *app,
1994 const char *name)
1995{
1996 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
1997 g_return_val_if_fail (name != NULL, NULL)do { if ((name != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "name != NULL"); return
(((void*)0)); } } while (0)
;
1998
1999 return g_hash_table_lookup (app->profiles, name);
2000}
2001
2002TerminalProfile*
2003terminal_app_get_profile_by_visible_name (TerminalApp *app,
2004 const char *name)
2005{
2006 LookupInfo info;
2007
2008 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
2009 g_return_val_if_fail (name != NULL, NULL)do { if ((name != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "name != NULL"); return
(((void*)0)); } } while (0)
;
2010
2011 info.result = NULL((void*)0);
2012 info.target = name;
2013
2014 g_hash_table_foreach (app->profiles,
2015 profiles_lookup_by_visible_name_foreach,
2016 &info);
2017 return info.result;
2018}
2019
2020TerminalProfile*
2021terminal_app_get_default_profile (TerminalApp *app)
2022{
2023 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
2024
2025 return app->default_profile;
2026}
2027
2028TerminalProfile*
2029terminal_app_get_profile_for_new_term (TerminalApp *app)
2030{
2031 GHashTableIter iter;
2032 TerminalProfile *profile = NULL((void*)0);
2033 TerminalProfile **profileptr = &profile;
2034
2035 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
2036
2037 if (app->default_profile)
2038 return app->default_profile;
2039
2040 g_hash_table_iter_init (&iter, app->profiles);
2041 if (g_hash_table_iter_next (&iter, NULL((void*)0), (gpointer *) profileptr))
2042 return profile;
2043
2044 return NULL((void*)0);
2045}
2046
2047GHashTable *
2048terminal_app_get_encodings (TerminalApp *app)
2049{
2050 return app->encodings;
2051}
2052
2053/**
2054 * terminal_app_ensure_encoding:
2055 * @app:
2056 * @charset:
2057 *
2058 * Ensures there's a #TerminalEncoding for @charset available.
2059 */
2060TerminalEncoding *
2061terminal_app_ensure_encoding (TerminalApp *app,
2062 const char *charset)
2063{
2064 TerminalEncoding *encoding;
2065
2066 encoding = g_hash_table_lookup (app->encodings, charset);
2067 if (encoding == NULL((void*)0))
2068 {
2069 encoding = terminal_encoding_new (charset,
2070 _("User Defined")gettext ("User Defined"),
2071 TRUE(!(0)),
2072 TRUE(!(0)) /* scary! */);
2073 g_hash_table_insert (app->encodings,
2074 (gpointer) terminal_encoding_get_id (encoding),
2075 encoding);
2076 }
2077
2078 return encoding;
2079}
2080
2081/**
2082 * terminal_app_get_active_encodings:
2083 *
2084 * Returns: a newly allocated list of newly referenced #TerminalEncoding objects.
2085 */
2086GSList*
2087terminal_app_get_active_encodings (TerminalApp *app)
2088{
2089 GSList *list = NULL((void*)0);
2090 GHashTableIter iter;
2091 gpointer key, value;
2092
2093 g_hash_table_iter_init (&iter, app->encodings);
2094 while (g_hash_table_iter_next (&iter, &key, &value))
2095 {
2096 TerminalEncoding *encoding = (TerminalEncoding *) value;
2097
2098 if (!encoding->is_active)
2099 continue;
2100
2101 list = g_slist_prepend (list, terminal_encoding_ref (encoding));
2102 }
2103
2104 return g_slist_sort (list, (GCompareFunc) compare_encodings);
2105}
2106
2107void
2108terminal_app_save_config (TerminalApp *app,
2109 GKeyFile *key_file)
2110{
2111 GList *lw;
2112 guint n = 0;
2113 GPtrArray *window_names_array;
2114 char **window_names;
2115 gsize len;
2116
2117 g_key_file_set_comment (key_file, NULL((void*)0), NULL((void*)0), "Written by " PACKAGE_STRING"mate-terminal 1.28.0", NULL((void*)0));
2118
2119 g_key_file_set_integer (key_file, TERMINAL_CONFIG_GROUP"MATE Terminal Configuration", TERMINAL_CONFIG_PROP_VERSION"Version", TERMINAL_CONFIG_VERSION(1));
2120 g_key_file_set_integer (key_file, TERMINAL_CONFIG_GROUP"MATE Terminal Configuration", TERMINAL_CONFIG_PROP_COMPAT_VERSION"CompatVersion", TERMINAL_CONFIG_COMPAT_VERSION(1));
2121
2122 window_names_array = g_ptr_array_sized_new (g_list_length (app->windows) + 1);
2123
2124 for (lw = app->windows; lw != NULL((void*)0); lw = lw->next)
2125 {
2126 TerminalWindow *window = TERMINAL_WINDOW (lw->data)((((TerminalWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((lw->data)), ((terminal_window_get_type ()))))))
;
2127 char *group;
2128
2129 group = g_strdup_printf ("Window%u", n++);
2130 g_ptr_array_add (window_names_array, group);
2131
2132 terminal_window_save_state (window, key_file, group);
2133 }
2134
2135 len = window_names_array->len;
2136 g_ptr_array_add (window_names_array, NULL((void*)0));
2137 window_names = (char **) g_ptr_array_free (window_names_array, FALSE(0));
2138 g_key_file_set_string_list (key_file, TERMINAL_CONFIG_GROUP"MATE Terminal Configuration", TERMINAL_CONFIG_PROP_WINDOWS"Windows", (const char * const *) window_names, len);
2139 g_strfreev (window_names);
2140}
2141
2142gboolean
2143terminal_app_save_config_file (TerminalApp *app,
2144 const char *file_name,
2145 GError **error)
2146{
2147 GKeyFile *key_file;
2148 char *data;
2149 gsize len;
2150 gboolean result;
2151
2152 key_file = g_key_file_new ();
2153 terminal_app_save_config (app, key_file);
2154
2155 data = g_key_file_to_data (key_file, &len, NULL((void*)0));
2156 result = g_file_set_contents (file_name, data, len, error);
2157 g_free (data);
2158
2159 return result;
2160}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-3c2acf.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-3c2acf.html new file mode 100644 index 0000000..8236c87 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-3c2acf.html @@ -0,0 +1,2385 @@ + + + +terminal-profile.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:terminal-profile.c
Warning:line 650, column 46
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name terminal-profile.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I .. -I ../src/mate-submodules/libegg -D TERMINAL_COMPILATION -D TERMINAL_RESOURCES_PATH_PREFIX="/org/mate/terminal" -D TERM_DATADIR="/usr/local/share" -D TERM_LOCALEDIR="/usr/local/share/locale" -D TERM_PKGDATADIR="/usr/local/share/mate-terminal" -D TERM_HELPDIR="/usr/local/share/help" -D SN_API_NOT_YET_FROZEN -D GDK_MULTIHEAD_SAFE -D G_DISABLE_SINGLE_INCLUDES -D PANGO_DISABLE_SINGLE_INCLUDES -D ATK_DISABLE_SINGLE_INCLUDES -D GDK_DISABLE_SINGLE_INCLUDES -D GDK_PIXBUF_DISABLE_SINGLE_INCLUDES -D GTK_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c terminal-profile.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright © 2001 Havoc Pennington
3 * Copyright © 2002 Mathias Hasselmann
4 * Copyright © 2008 Christian Persch
5 * Copyright (C) 2012-2021 MATE Developers
6 *
7 * Mate-terminal is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * Mate-terminal is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <config.h>
22
23#include <string.h>
24#include <stdlib.h>
25
26#include <gtk/gtk.h>
27
28#include "terminal-app.h"
29#include "terminal-debug.h"
30#include "terminal-intl.h"
31#include "terminal-profile.h"
32#include "terminal-screen.h"
33#include "terminal-type-builtins.h"
34
35/* To add a new key, you need to:
36 *
37 * - add an entry to the enum below
38 * - add a #define with its name in terminal-profile.h
39 * - add a gobject property for it in terminal_profile_class_init
40 * - if the property's type needs special casing, add that to
41 * terminal_profile_gsettings_notify_cb and
42 * terminal_profile_gsettings_changeset_add
43 * - if necessary the default value cannot be handled via the paramspec,
44 * handle that in terminal_profile_reset_property_internal
45 */
46enum
47{
48 PROP_0,
49 PROP_ALLOW_BOLD,
50 PROP_BACKGROUND_COLOR,
51 PROP_BACKGROUND_DARKNESS,
52 PROP_BACKGROUND_IMAGE,
53 PROP_BACKGROUND_IMAGE_FILE,
54 PROP_BACKGROUND_TYPE,
55 PROP_BACKSPACE_BINDING,
56 PROP_BOLD_COLOR,
57 PROP_BOLD_COLOR_SAME_AS_FG,
58 PROP_CURSOR_BLINK_MODE,
59 PROP_CURSOR_SHAPE,
60 PROP_CUSTOM_COMMAND,
61 PROP_DEFAULT_SIZE_COLUMNS,
62 PROP_DEFAULT_SIZE_ROWS,
63 PROP_DEFAULT_SHOW_MENUBAR,
64 PROP_DELETE_BINDING,
65 PROP_EXIT_ACTION,
66 PROP_FONT,
67 PROP_FOREGROUND_COLOR,
68 PROP_LOGIN_SHELL,
69 PROP_NAME,
70 PROP_PALETTE,
71 PROP_SCROLL_BACKGROUND,
72 PROP_SCROLLBACK_LINES,
73 PROP_SCROLLBACK_UNLIMITED,
74 PROP_SCROLLBAR_POSITION,
75 PROP_SCROLL_ON_KEYSTROKE,
76 PROP_SCROLL_ON_OUTPUT,
77 PROP_SILENT_BELL,
78 PROP_TITLE,
79 PROP_TITLE_MODE,
80 PROP_USE_CUSTOM_COMMAND,
81 PROP_USE_CUSTOM_DEFAULT_SIZE,
82 PROP_USE_SKEY,
83 PROP_USE_URLS,
84 PROP_USE_SYSTEM_FONT,
85 PROP_USE_THEME_COLORS,
86 PROP_VISIBLE_NAME,
87 PROP_WORD_CHARS,
88 PROP_COPY_SELECTION,
89 LAST_PROP
90};
91
92#define KEY_ALLOW_BOLD"allow-bold" "allow-bold"
93#define KEY_BACKGROUND_COLOR"background-color" "background-color"
94#define KEY_BACKGROUND_DARKNESS"background-darkness" "background-darkness"
95#define KEY_BACKGROUND_IMAGE_FILE"background-image" "background-image"
96#define KEY_BACKGROUND_TYPE"background-type" "background-type"
97#define KEY_BACKSPACE_BINDING"backspace-binding" "backspace-binding"
98#define KEY_BOLD_COLOR"bold-color" "bold-color"
99#define KEY_BOLD_COLOR_SAME_AS_FG"bold-color-same-as-fg" "bold-color-same-as-fg"
100#define KEY_CURSOR_BLINK_MODE"cursor-blink-mode" "cursor-blink-mode"
101#define KEY_CURSOR_SHAPE"cursor-shape" "cursor-shape"
102#define KEY_CUSTOM_COMMAND"custom-command" "custom-command"
103#define KEY_DEFAULT_SHOW_MENUBAR"default-show-menubar" "default-show-menubar"
104#define KEY_DEFAULT_SIZE_COLUMNS"default-size-columns" "default-size-columns"
105#define KEY_DEFAULT_SIZE_ROWS"default-size-rows" "default-size-rows"
106#define KEY_DELETE_BINDING"delete-binding" "delete-binding"
107#define KEY_EXIT_ACTION"exit-action" "exit-action"
108#define KEY_FONT"font" "font"
109#define KEY_FOREGROUND_COLOR"foreground-color" "foreground-color"
110#define KEY_LOGIN_SHELL"login-shell" "login-shell"
111#define KEY_PALETTE"palette" "palette"
112#define KEY_SCROLL_BACKGROUND"scroll-background" "scroll-background"
113#define KEY_SCROLLBACK_LINES"scrollback-lines" "scrollback-lines"
114#define KEY_SCROLLBACK_UNLIMITED"scrollback-unlimited" "scrollback-unlimited"
115#define KEY_SCROLLBAR_POSITION"scrollbar-position" "scrollbar-position"
116#define KEY_SCROLL_ON_KEYSTROKE"scroll-on-keystroke" "scroll-on-keystroke"
117#define KEY_SCROLL_ON_OUTPUT"scroll-on-output" "scroll-on-output"
118#define KEY_SILENT_BELL"silent-bell" "silent-bell"
119#define KEY_COPY_SELECTION"copy-selection" "copy-selection"
120#define KEY_TITLE_MODE"title-mode" "title-mode"
121#define KEY_TITLE"title" "title"
122#define KEY_USE_CUSTOM_COMMAND"use-custom-command" "use-custom-command"
123#define KEY_USE_CUSTOM_DEFAULT_SIZE"use-custom-default-size" "use-custom-default-size"
124#define KEY_USE_SKEY"use-skey" "use-skey"
125#define KEY_USE_URLS"use-urls" "use-urls"
126#define KEY_USE_SYSTEM_FONT"use-system-font" "use-system-font"
127#define KEY_USE_THEME_COLORS"use-theme-colors" "use-theme-colors"
128#define KEY_VISIBLE_NAME"visible-name" "visible-name"
129#define KEY_WORD_CHARS"word-chars" "word-chars"
130
131/* Keep these in sync with the GSettings schema! */
132#define DEFAULT_ALLOW_BOLD((!(0))) (TRUE(!(0)))
133#define DEFAULT_BACKGROUND_COLOR("#FFFFDD") ("#FFFFDD")
134#define DEFAULT_BOLD_COLOR_SAME_AS_FG((!(0))) (TRUE(!(0)))
135#define DEFAULT_BACKGROUND_DARKNESS(0.5) (0.5)
136#define DEFAULT_BACKGROUND_IMAGE_FILE("") ("")
137#define DEFAULT_BACKGROUND_TYPE(TERMINAL_BACKGROUND_SOLID) (TERMINAL_BACKGROUND_SOLID)
138#define DEFAULT_BACKSPACE_BINDING(VTE_ERASE_ASCII_DELETE) (VTE_ERASE_ASCII_DELETE)
139#define DEFAULT_CURSOR_BLINK_MODE(VTE_CURSOR_BLINK_SYSTEM) (VTE_CURSOR_BLINK_SYSTEM)
140#define DEFAULT_CURSOR_SHAPE(VTE_CURSOR_SHAPE_BLOCK) (VTE_CURSOR_SHAPE_BLOCK)
141#define DEFAULT_CUSTOM_COMMAND("") ("")
142#define DEFAULT_DEFAULT_SHOW_MENUBAR((!(0))) (TRUE(!(0)))
143#define DEFAULT_DEFAULT_SIZE_COLUMNS(80) (80)
144#define DEFAULT_DEFAULT_SIZE_ROWS(24) (24)
145#define DEFAULT_DELETE_BINDING(VTE_ERASE_DELETE_SEQUENCE) (VTE_ERASE_DELETE_SEQUENCE)
146#define DEFAULT_EXIT_ACTION(TERMINAL_EXIT_CLOSE) (TERMINAL_EXIT_CLOSE)
147#define DEFAULT_FONT("Monospace 12") ("Monospace 12")
148#define DEFAULT_FOREGROUND_COLOR("#000000") ("#000000")
149#define DEFAULT_LOGIN_SHELL((0)) (FALSE(0))
150#define DEFAULT_NAME(((void*)0)) (NULL((void*)0))
151#define DEFAULT_PALETTE(terminal_palettes[0]) (terminal_palettes[TERMINAL_PALETTE_TANGO0])
152#define DEFAULT_SCROLL_BACKGROUND((!(0))) (TRUE(!(0)))
153#define DEFAULT_SCROLLBACK_LINES(512) (512)
154#define DEFAULT_SCROLLBACK_UNLIMITED((0)) (FALSE(0))
155#define DEFAULT_SCROLLBAR_POSITION(TERMINAL_SCROLLBAR_RIGHT) (TERMINAL_SCROLLBAR_RIGHT)
156#define DEFAULT_SCROLL_ON_KEYSTROKE((!(0))) (TRUE(!(0)))
157#define DEFAULT_SCROLL_ON_OUTPUT((0)) (FALSE(0))
158#define DEFAULT_SILENT_BELL((0)) (FALSE(0))
159#define DEFAULT_COPY_SELECTION((0)) (FALSE(0))
160#define DEFAULT_TITLE_MODE(TERMINAL_TITLE_REPLACE) (TERMINAL_TITLE_REPLACE)
161#define DEFAULT_TITLE(("Terminal")) (N_("Terminal")("Terminal"))
162#define DEFAULT_USE_CUSTOM_COMMAND((0)) (FALSE(0))
163#define DEFAULT_USE_CUSTOM_DEFAULT_SIZE((0)) (FALSE(0))
164#define DEFAULT_USE_SKEY((!(0))) (TRUE(!(0)))
165#define DEFAULT_USE_URLS((!(0))) (TRUE(!(0)))
166#define DEFAULT_USE_SYSTEM_FONT((!(0))) (TRUE(!(0)))
167#define DEFAULT_USE_THEME_COLORS((!(0))) (TRUE(!(0)))
168#define DEFAULT_VISIBLE_NAME(("Unnamed")) (N_("Unnamed")("Unnamed"))
169#define DEFAULT_WORD_CHARS("-A-Za-z0-9,./?%&#:_=+@~") ("-A-Za-z0-9,./?%&#:_=+@~")
170
171struct _TerminalProfilePrivate
172{
173 GValueArray *properties;
174 gboolean *locked;
175
176 GSettings *settings;
177 char *profile_dir;
178
179 GSList *dirty_pspecs;
180 guint save_idle_id;
181
182 GParamSpec *gsettings_notification_pspec;
183
184 gboolean background_load_failed;
185
186 guint forgotten : 1;
187};
188
189static const GdkRGBA terminal_palettes[TERMINAL_PALETTE_N_BUILTINS5][TERMINAL_PALETTE_SIZE16] =
190{
191 /* Tango palette */
192 {
193 { 0, 0, 0, 1 },
194 { 0.8, 0, 0, 1 },
195 { 0.305882, 0.603922, 0.0235294, 1 },
196 { 0.768627, 0.627451, 0, 1 },
197 { 0.203922, 0.396078, 0.643137, 1 },
198 { 0.458824, 0.313725, 0.482353, 1 },
199 { 0.0235294, 0.596078, 0.603922, 1 },
200 { 0.827451, 0.843137, 0.811765, 1 },
201 { 0.333333, 0.341176, 0.32549, 1 },
202 { 0.937255, 0.160784, 0.160784, 1 },
203 { 0.541176, 0.886275, 0.203922, 1 },
204 { 0.988235, 0.913725, 0.309804, 1 },
205 { 0.447059, 0.623529, 0.811765, 1 },
206 { 0.678431, 0.498039, 0.658824, 1 },
207 { 0.203922, 0.886275, 0.886275, 1 },
208 { 0.933333, 0.933333, 0.92549, 1 },
209 },
210
211 /* Linux palette */
212 {
213 { 0, 0, 0, 1 },
214 { 0.666667, 0, 0, 1 },
215 { 0, 0.666667, 0, 1 },
216 { 0.666667, 0.333333, 0, 1 },
217 { 0, 0, 0.666667, 1 },
218 { 0.666667, 0, 0.666667, 1 },
219 { 0, 0.666667, 0.666667, 1 },
220 { 0.666667, 0.666667, 0.666667, 1 },
221 { 0.333333, 0.333333, 0.333333, 1 },
222 { 1, 0.333333, 0.333333, 1 },
223 { 0.333333, 1, 0.333333, 1 },
224 { 1, 1, 0.333333, 1 },
225 { 0.333333, 0.333333, 1, 1 },
226 { 1, 0.333333, 1, 1 },
227 { 0.333333, 1, 1, 1 },
228 { 1, 1, 1, 1 },
229 },
230
231 /* XTerm palette */
232 {
233 { 0, 0, 0, 1 },
234 { 0.803922, 0, 0, 1 },
235 { 0, 0.803922, 0, 1 },
236 { 0.803922, 0.803922, 0, 1 },
237 { 0.117647, 0.564706, 1, 1 },
238 { 0.803922, 0, 0.803922, 1 },
239 { 0, 0.803922, 0.803922, 1 },
240 { 0.898039, 0.898039, 0.898039, 1 },
241 { 0.298039, 0.298039, 0.298039, 1 },
242 { 1, 0, 0, 1 },
243 { 0, 1, 0, 1 },
244 { 1, 1, 0, 1 },
245 { 0.27451, 0.509804, 0.705882, 1 },
246 { 1, 0, 1, 1 },
247 { 0, 1, 1, 1 },
248 { 1, 1, 1, 1 },
249 },
250
251 /* RXVT palette */
252 {
253 { 0, 0, 0, 1 },
254 { 0.803922, 0, 0, 1 },
255 { 0, 0.803922, 0, 1 },
256 { 0.803922, 0.803922, 0, 1 },
257 { 0, 0, 0.803922, 1 },
258 { 0.803922, 0, 0.803922, 1 },
259 { 0, 0.803922, 0.803922, 1 },
260 { 0.980392, 0.921569, 0.843137, 1 },
261 { 0.25098, 0.25098, 0.25098, 1 },
262 { 1, 0, 0, 1 },
263 { 0, 1, 0, 1 },
264 { 1, 1, 0, 1 },
265 { 0, 0, 1, 1 },
266 { 1, 0, 1, 1 },
267 { 0, 1, 1, 1 },
268 { 1, 1, 1, 1 },
269 },
270
271 /* Solarized palette (1.0.0beta2): http://ethanschoonover.com/solarized */
272 {
273 { 0.02745, 0.211764, 0.258823, 1 },
274 { 0.862745, 0.196078, 0.184313, 1 },
275 { 0.521568, 0.6, 0, 1 },
276 { 0.709803, 0.537254, 0, 1 },
277 { 0.149019, 0.545098, 0.823529, 1 },
278 { 0.82745, 0.211764, 0.509803, 1 },
279 { 0.164705, 0.631372, 0.596078, 1 },
280 { 0.933333, 0.909803, 0.835294, 1 },
281 { 0, 0.168627, 0.211764, 1 },
282 { 0.796078, 0.294117, 0.086274, 1 },
283 { 0.345098, 0.431372, 0.458823, 1 },
284 { 0.396078, 0.482352, 0.513725, 1 },
285 { 0.513725, 0.580392, 0.588235, 1 },
286 { 0.423529, 0.443137, 0.768627, 1 },
287 { 0.57647, 0.631372, 0.631372, 1 },
288 { 0.992156, 0.964705, 0.890196, 1 },
289 },
290};
291
292enum
293{
294 FORGOTTEN,
295 LAST_SIGNAL
296};
297
298static void terminal_profile_finalize (GObject *object);
299static void terminal_profile_set_property (GObject *object,
300 guint prop_id,
301 const GValue *value,
302 GParamSpec *pspec);
303static void ensure_pixbuf_property (TerminalProfile *profile,
304 guint path_prop_id,
305 guint pixbuf_prop_id,
306 gboolean *load_failed);
307
308static guint signals[LAST_SIGNAL] = { 0 };
309static GQuark gsettings_key_quark;
310
311G_DEFINE_TYPE_WITH_PRIVATE (TerminalProfile, terminal_profile, G_TYPE_OBJECT)static void terminal_profile_init (TerminalProfile *self); static
void terminal_profile_class_init (TerminalProfileClass *klass
); static GType terminal_profile_get_type_once (void); static
gpointer terminal_profile_parent_class = ((void*)0); static gint
TerminalProfile_private_offset; static void terminal_profile_class_intern_init
(gpointer klass) { terminal_profile_parent_class = g_type_class_peek_parent
(klass); if (TerminalProfile_private_offset != 0) g_type_class_adjust_private_offset
(klass, &TerminalProfile_private_offset); terminal_profile_class_init
((TerminalProfileClass*) klass); } __attribute__ ((__unused__
)) static inline gpointer terminal_profile_get_instance_private
(TerminalProfile *self) { return (((gpointer) ((guint8*) (self
) + (glong) (TerminalProfile_private_offset)))); } GType terminal_profile_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ _Static_assert (sizeof *(&static_g_define_type_id) ==
sizeof (gpointer), "Expression evaluates to false"); (void) (
0 ? (gpointer) *(&static_g_define_type_id) : ((void*)0));
(!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = terminal_profile_get_type_once
(); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } __attribute__ ((__noinline__)) static GType terminal_profile_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
(((GType) ((20) << (2))), g_intern_static_string ("TerminalProfile"
), sizeof (TerminalProfileClass), (GClassInitFunc)(void (*)(void
)) terminal_profile_class_intern_init, sizeof (TerminalProfile
), (GInstanceInitFunc)(void (*)(void)) terminal_profile_init,
(GTypeFlags) 0); { {{ TerminalProfile_private_offset = g_type_add_instance_private
(g_define_type_id, sizeof (TerminalProfilePrivate)); };} } return
g_define_type_id; }
;
312
313/* gdk_rgba_equal is too strict! */
314static gboolean
315rgba_equal (const GdkRGBA *a,
316 const GdkRGBA *b)
317{
318 gdouble dr, dg, db, da;
319
320 dr = a->red - b->red;
321 dg = a->green - b->green;
322 db = a->blue - b->blue;
323 da = a->alpha - b->alpha;
324
325 return (dr * dr + dg * dg + db * db + da * da) < 1e-4;
326}
327
328static gboolean
329palette_cmp (const GdkRGBA *ca,
330 const GdkRGBA *cb)
331{
332 guint i;
333
334 for (i = 0; i < TERMINAL_PALETTE_SIZE16; ++i)
335 if (!rgba_equal (&ca[i], &cb[i]))
336 return FALSE(0);
337
338 return TRUE(!(0));
339}
340
341static GParamSpec *
342get_pspec_from_name (TerminalProfile *profile,
343 const char *prop_name)
344{
345 TerminalProfileClass *klass = TERMINAL_PROFILE_GET_CLASS (profile)((((TerminalProfileClass*) (((GTypeInstance*) ((profile)))->
g_class))))
;
346 GParamSpec *pspec;
347
348 pspec = g_object_class_find_property (G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
, prop_name);
349 if (pspec &&
350 pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
351 pspec = NULL((void*)0);
352
353 return pspec;
354}
355
356static const GValue *
357get_prop_value_from_prop_name (TerminalProfile *profile,
358 const char *prop_name)
359{
360 TerminalProfilePrivate *priv = profile->priv;
361 GParamSpec *pspec;
362
363 pspec = get_pspec_from_name (profile, prop_name);
364 if (!pspec)
365 return NULL((void*)0);
366
367 if (G_UNLIKELY (pspec->param_id == PROP_BACKGROUND_IMAGE)(pspec->param_id == PROP_BACKGROUND_IMAGE))
368 ensure_pixbuf_property (profile, PROP_BACKGROUND_IMAGE_FILE, PROP_BACKGROUND_IMAGE, &priv->background_load_failed);
369
370 return g_value_array_get_nth (priv->properties, pspec->param_id);
371}
372
373static void
374set_value_from_palette (GValue *ret_value,
375 const GdkRGBA *colors,
376 guint n_colors)
377{
378 GValueArray *array;
379 guint i, max_n_colors;
380
381 max_n_colors = MAX (n_colors, TERMINAL_PALETTE_SIZE)(((n_colors) > (16)) ? (n_colors) : (16));
382 array = g_value_array_new (max_n_colors);
383 for (i = 0; i < max_n_colors; ++i)
384 g_value_array_append (array, NULL((void*)0));
385
386 for (i = 0; i < n_colors; ++i)
387 {
388 GValue *value = g_value_array_get_nth (array, i);
389
390 g_value_init (value, GDK_TYPE_RGBA(gdk_rgba_get_type ()));
391 g_value_set_boxed (value, &colors[i]);
392 }
393
394 /* If we haven't enough colours yet, fill up with the default palette */
395 for (i = n_colors; i < TERMINAL_PALETTE_SIZE16; ++i)
396 {
397 GValue *value = g_value_array_get_nth (array, i);
398
399 g_value_init (value, GDK_TYPE_RGBA(gdk_rgba_get_type ()));
400 g_value_set_boxed (value, &DEFAULT_PALETTE(terminal_palettes[0])[i]);
401 }
402
403 g_value_take_boxed (ret_value, array);
404}
405
406static int
407values_equal (GParamSpec *pspec,
408 const GValue *va,
409 const GValue *vb)
410{
411 /* g_param_values_cmp isn't good enough for some types, since e.g.
412 * it compares colours and font descriptions by pointer value, not
413 * with the correct compare functions. Providing extra
414 * PangoParamSpecFontDescription and GdkParamSpecColor wouldn't
415 * have fixed this either, since it's unclear how to _order_ them.
416 * Luckily we only need to check them for equality here.
417 */
418
419 if (g_param_values_cmp (pspec, va, vb) == 0)
420 return TRUE(!(0));
421
422 if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
423 return rgba_equal (g_value_get_boxed (va), g_value_get_boxed (vb));
424
425 if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
426 return pango_font_description_equal (g_value_get_boxed (va), g_value_get_boxed (vb));
427
428 if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
429 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
430 {
431 GValueArray *ara, *arb;
432 guint i;
433
434 ara = g_value_get_boxed (va);
435 arb = g_value_get_boxed (vb);
436
437 if (!ara || !arb || ara->n_values != arb->n_values)
438 return FALSE(0);
439
440 for (i = 0; i < ara->n_values; ++i)
441 if (!rgba_equal (g_value_get_boxed (g_value_array_get_nth (ara, i)),
442 g_value_get_boxed (g_value_array_get_nth (arb, i))))
443 return FALSE(0);
444
445 return TRUE(!(0));
446 }
447
448 return FALSE(0);
449}
450
451static void
452ensure_pixbuf_property (TerminalProfile *profile,
453 guint path_prop_id,
454 guint pixbuf_prop_id,
455 gboolean *load_failed)
456{
457 TerminalProfilePrivate *priv = profile->priv;
458 GValue *path_value, *pixbuf_value;
459 GdkPixbuf *pixbuf;
460 const char *path_utf8;
461 char *path;
462 GError *error = NULL((void*)0);
463
464 pixbuf_value = g_value_array_get_nth (priv->properties, pixbuf_prop_id);
465
466 pixbuf = g_value_get_object (pixbuf_value);
467 if (pixbuf)
468 return;
469
470 if (*load_failed)
471 return;
472
473 path_value = g_value_array_get_nth (priv->properties, path_prop_id);
474 path_utf8 = g_value_get_string (path_value);
475 if (!path_utf8 || !path_utf8[0])
476 goto failed;
477
478 path = g_filename_from_utf8 (path_utf8, -1, NULL((void*)0), NULL((void*)0), NULL((void*)0));
479 if (!path)
480 goto failed;
481
482 pixbuf = gdk_pixbuf_new_from_file (path, &error);
483 if (!pixbuf)
484 {
485 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
486 "Failed to load image \"%s\": %s\n",do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
487 path, error->message)do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
;
488
489 g_error_free (error);
490 g_free (path);
491 goto failed;
492 }
493
494 g_value_take_object (pixbuf_value, pixbuf);
495 g_free (path);
496 return;
497
498failed:
499 *load_failed = TRUE(!(0));
500}
501
502static void
503terminal_profile_reset_property_internal (TerminalProfile *profile,
504 GParamSpec *pspec,
505 gboolean notify)
506{
507 TerminalProfilePrivate *priv = profile->priv;
508 GValue value_ = { 0, };
509 GValue *value;
510
511 if (notify)
512 {
513 value = &value_;
514 g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
515 }
516 else
517 value = g_value_array_get_nth (priv->properties, pspec->param_id);
518 g_assert (value != NULL)do { if (value != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 518, ((const char*) (__func__
)), "value != NULL"); } while (0)
;
519
520 /* A few properties don't have defaults via the param spec; set them explicitly */
521 switch (pspec->param_id)
522 {
523 case PROP_FOREGROUND_COLOR:
524 case PROP_BOLD_COLOR:
525 {
526 GdkRGBA color;
527
528 if (!gdk_rgba_parse (&color, DEFAULT_FOREGROUND_COLOR("#000000")))
529 return;
530 color.alpha = 1.0;
531 g_value_set_boxed (value, &color);
532 break;
533 }
534 case PROP_BACKGROUND_COLOR:
535 {
536 GdkRGBA color;
537
538 if (!gdk_rgba_parse (&color, DEFAULT_BACKGROUND_COLOR("#FFFFDD")))
539 return;
540 color.alpha = 1.0;
541 g_value_set_boxed (value, &color);
542 break;
543 }
544 case PROP_FONT:
545 g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_FONT("Monospace 12")));
546 break;
547
548 case PROP_PALETTE:
549 set_value_from_palette (value, DEFAULT_PALETTE(terminal_palettes[0]), TERMINAL_PALETTE_SIZE16);
550 break;
551
552 default:
553 g_param_value_set_default (pspec, value);
554 break;
555 }
556
557 if (notify)
558 {
559 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, pspec->name, value);
560 g_value_unset (value);
561 }
562}
563
564static void
565terminal_profile_gsettings_notify_cb (GSettings *settings,
566 gchar *key,
567 gpointer user_data)
568{
569 TerminalProfile *profile = TERMINAL_PROFILE (user_data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_profile_get_type ()))))))
;
570 TerminalProfilePrivate *priv = profile->priv;
571 TerminalProfileClass *klass;
572 GVariant *settings_value;
573 GParamSpec *pspec;
574 GValue value = { 0, };
575 gboolean equal;
576 gboolean force_set = FALSE(0);
577
578 if (!key) return;
579
580 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
581 "GSettings notification for key %s [%s]\n",do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
582 key,do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
583 g_settings_is_writable (settings, key) ? "writable" : "LOCKED")do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
;
584
585 klass = TERMINAL_PROFILE_GET_CLASS (profile)((((TerminalProfileClass*) (((GTypeInstance*) ((profile)))->
g_class))))
;
586 pspec = g_hash_table_lookup (klass->gsettings_keys, key);
587 if (!pspec)
588 return; /* ignore unknown keys, for future extensibility */
589
590 priv->locked[pspec->param_id] = !g_settings_is_writable (settings, key);
591
592 settings_value = g_settings_get_value (settings, key);
593 if (!settings_value)
594 return;
595
596 g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
597
598 if (G_IS_PARAM_SPEC_BOOLEAN (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[2])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
599 {
600 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_BOOLEAN((const GVariantType *) "b")))
601 goto out;
602
603 g_value_set_boolean (&value, g_variant_get_boolean (settings_value));
604 }
605 else if (G_IS_PARAM_SPEC_STRING (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[14])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
606 {
607 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
608 goto out;
609
610 g_value_set_string (&value, g_variant_get_string (settings_value, NULL((void*)0)));
611 }
612 else if (G_IS_PARAM_SPEC_ENUM (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[10])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
613 {
614
615 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
616 goto out;
617
618 g_value_set_enum (&value, g_settings_get_enum (settings, key));
619 }
620 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
621 {
622 GdkRGBA color;
623
624 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
625 goto out;
626
627 if (!gdk_rgba_parse (&color, g_variant_get_string (settings_value, NULL((void*)0))))
628 goto out;
629
630 g_value_set_boxed (&value, &color);
631 }
632 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
633 {
634 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
635 goto out;
636
637 g_value_take_boxed (&value, pango_font_description_from_string (g_variant_get_string (settings_value, NULL((void*)0))));
638 }
639 else if (G_IS_PARAM_SPEC_DOUBLE (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[13])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
640 {
641 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_DOUBLE((const GVariantType *) "d")))
642 goto out;
643
644 g_value_set_double (&value, g_variant_get_double (settings_value));
645 }
646 else if (G_IS_PARAM_SPEC_INT (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[3])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
647 {
648 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT16((const GVariantType *) "n")) &&
649 !g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT32((const GVariantType *) "i")) &&
650 !g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT64((const GVariantType *) "x")))
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
651 goto out;
652
653 g_value_set_int (&value, g_settings_get_int(settings, key));
654 }
655 else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
656 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
657 {
658 char **color_strings;
659 GdkRGBA *colors;
660 int n_colors, i;
661
662 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
663 goto out;
664
665 color_strings = g_strsplit (g_variant_get_string (settings_value, NULL((void*)0)), ":", -1);
666 if (!color_strings)
667 goto out;
668
669 n_colors = g_strv_length (color_strings);
670 colors = g_new0 (GdkRGBA, n_colors)((GdkRGBA *) g_malloc0_n ((n_colors), sizeof (GdkRGBA)));
671 for (i = 0; i < n_colors; ++i)
672 {
673 if (!gdk_rgba_parse (&colors[i], color_strings[i]))
674 continue; /* ignore errors */
675 }
676 g_strfreev (color_strings);
677
678 /* We continue even with a palette size != TERMINAL_PALETTE_SIZE,
679 * so we can change the palette size in future versions without
680 * causing too many issues.
681 */
682 set_value_from_palette (&value, colors, n_colors);
683 g_free (colors);
684 }
685 else
686 {
687 g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
), pspec->name);
688 goto out;
689 }
690
691 if (g_param_value_validate (pspec, &value))
692 {
693 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
694 "Invalid value in GSettings for key %s was changed to comply with pspec %s\n",do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
695 key, pspec->name)do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
;
696
697 force_set = TRUE(!(0));
698 }
699
700 /* Only set the property if the value is different than our current value,
701 * so we don't go into an infinite loop.
702 */
703 equal = values_equal (pspec, &value, g_value_array_get_nth (priv->properties, pspec->param_id));
704#ifdef MATE_ENABLE_DEBUG
705 _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_PROFILE)if (0)
706 {
707 if (!equal)
708 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("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)); } while (0)
709 "Setting property %s to a different value\n"do { if (0) g_printerr("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)); } while (0)
710 " now: %s\n"do { if (0) g_printerr("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)); } while (0)
711 " new: %s\n",do { if (0) g_printerr("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)); } while (0)
712 pspec->name,do { if (0) g_printerr("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)); } while (0)
713 g_strdup_value_contents (g_value_array_get_nth (priv->properties, pspec->param_id)),do { if (0) g_printerr("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)); } while (0)
714 g_strdup_value_contents (&value))do { if (0) g_printerr("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)); } while (0)
;
715 }
716#endif
717
718 if (!equal || force_set)
719 {
720 priv->gsettings_notification_pspec = pspec;
721 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, pspec->name, &value);
722 priv->gsettings_notification_pspec = NULL((void*)0);
723 }
724
725out:
726 /* FIXME: if we arrive here through goto in the error cases,
727 * should we maybe reset the property to its default value?
728 */
729
730 g_value_unset (&value);
731 g_variant_unref (settings_value);
732}
733
734static void
735terminal_profile_gsettings_changeset_add (TerminalProfile *profile,
736 GSettings *changeset,
737 GParamSpec *pspec)
738{
739 TerminalProfilePrivate *priv = profile->priv;
740 char *key;
741 const GValue *value;
742
743 /* FIXME: do this? */
744#if 0
745 if (priv->locked[pspec->param_id])
746 return;
747
748 if (!g_settings_is_writable (priv->settings, gsettings_key, NULL((void*)0)))
749 return;
750#endif
751
752 key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
753 if (!key)
754 return;
755
756 value = g_value_array_get_nth (priv->properties, pspec->param_id);
757
758 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
759 "Adding pspec %s with value %s to the GSettings changeset\n",do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
760 pspec->name, g_strdup_value_contents (value))do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
;
761
762 if (G_IS_PARAM_SPEC_BOOLEAN (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[2])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
763 g_settings_set_boolean (changeset, key, g_value_get_boolean (value));
764 else if (G_IS_PARAM_SPEC_STRING (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[14])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
765 {
766 const char *str;
767
768 str = g_value_get_string (value);
769 g_settings_set_string (changeset, key, str ? str : "");
770 }
771 else if (G_IS_PARAM_SPEC_ENUM (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[10])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
772 {
773 const GEnumValue *eval;
774
775 eval = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)((((GParamSpecEnum*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), ((g_param_spec_types[10]))))))
->enum_class, g_value_get_enum (value));
776
777 g_settings_set_enum (changeset, key, eval->value);
778 }
779 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
780 {
781 GdkRGBA *color;
782 char str[16];
783
784 color = g_value_get_boxed (value);
785 if (!color)
786 goto cleanup;
787
788 g_snprintf (str, sizeof (str),
789 "#%04X%04X%04X",
790 (guint) (color->red * 65535),
791 (guint) (color->green * 65535),
792 (guint) (color->blue * 65535));
793
794 g_settings_set_string (changeset, key, str);
795 }
796 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
797 {
798 PangoFontDescription *font_desc;
799 char *font;
800
801 font_desc = g_value_get_boxed (value);
802 if (!font_desc)
803 goto cleanup;
804
805 font = pango_font_description_to_string (font_desc);
806 g_settings_set_string (changeset, key, font);
807 g_free (font);
808 }
809 else if (G_IS_PARAM_SPEC_DOUBLE (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[13])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
810 g_settings_set_double (changeset, key, g_value_get_double (value));
811 else if (G_IS_PARAM_SPEC_INT (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[3])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
812 g_settings_set_int (changeset, key, g_value_get_int (value));
813 else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
814 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
815 {
816 GValueArray *array;
817 GString *string;
818 guint n_colors, i;
819
820 /* We need to do this ourselves, because the gtk_color_selection_palette_to_string
821 * does not carry all the bytes, and xterm's palette is messed up...
822 */
823
824 array = g_value_get_boxed (value);
825 if (!array)
826 goto cleanup;
827
828 n_colors = array->n_values;
829 string = g_string_sized_new (n_colors * (1 /* # */ + 3 * 4) + n_colors /* : separators and terminating \0 */);
830 for (i = 0; i < n_colors; ++i)
831 {
832 GdkRGBA *color;
833
834 if (i > 0)
835 g_string_append_c (string, ':')g_string_append_c_inline (string, ':');
836
837 color = g_value_get_boxed (g_value_array_get_nth (array, i));
838 if (!color)
839 continue;
840
841 g_string_append_printf (string,
842 "#%04X%04X%04X",
843 (guint) (color->red * 65535),
844 (guint) (color->green * 65535),
845 (guint) (color->blue * 65535));
846 }
847
848 g_settings_set_string (changeset, key, string->str);
849 g_string_free (string, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) (
(string), ((!(0)))) : g_string_free_and_steal (string)) : (g_string_free
) ((string), ((!(0)))))
;
850 }
851 else
852 g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
), pspec->name);
853
854cleanup:
855 return;
856}
857
858static void
859terminal_profile_save (TerminalProfile *profile)
860{
861 TerminalProfilePrivate *priv = profile->priv;
862 GSettings *changeset;
863 GSList *l;
864 gchar *concat;
865
866 priv->save_idle_id = 0;
867 concat = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", priv->profile_dir,"/", NULL((void*)0));
868 changeset = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
869 g_free (concat);
870 g_settings_delay (changeset);
871
872 for (l = priv->dirty_pspecs; l != NULL((void*)0); l = l->next)
873 {
874 GParamSpec *pspec = (GParamSpec *) l->data;
875
876 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
877 continue;
878
879 if ((pspec->flags & G_PARAM_WRITABLE) == 0)
880 continue;
881
882 terminal_profile_gsettings_changeset_add (profile, changeset, pspec);
883 }
884
885 g_slist_free (priv->dirty_pspecs);
886 priv->dirty_pspecs = NULL((void*)0);
887
888 g_settings_apply (changeset);
889 g_object_unref (changeset);
890}
891
892static gboolean
893terminal_profile_save_idle_cb (TerminalProfile *profile)
894{
895 terminal_profile_save (profile);
896
897 /* don't run again */
898 return FALSE(0);
899}
900
901static void
902terminal_profile_schedule_save (TerminalProfile *profile,
903 GParamSpec *pspec)
904{
905 TerminalProfilePrivate *priv = profile->priv;
906
907 g_assert (pspec != NULL)do { if (pspec != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 907, ((const char*) (__func__
)), "pspec != NULL"); } while (0)
;
908
909 if (!g_slist_find (priv->dirty_pspecs, pspec))
910 priv->dirty_pspecs = g_slist_prepend (priv->dirty_pspecs, pspec);
911
912 if (priv->save_idle_id != 0)
913 return;
914
915 priv->save_idle_id = g_idle_add ((GSourceFunc) terminal_profile_save_idle_cb, profile);
916}
917
918static void
919terminal_profile_init (TerminalProfile *profile)
920{
921 TerminalProfilePrivate *priv;
922 GObjectClass *object_class;
923 GParamSpec **pspecs;
924 guint n_pspecs, i;
925
926 priv = profile->priv = terminal_profile_get_instance_private (profile);
927
928 priv->gsettings_notification_pspec = NULL((void*)0);
929 priv->locked = g_new0 (gboolean, LAST_PROP)((gboolean *) g_malloc0_n ((LAST_PROP), sizeof (gboolean)));
930
931 priv->properties = g_value_array_new (LAST_PROP);
932 for (i = 0; i < LAST_PROP; ++i)
933 g_value_array_append (priv->properties, NULL((void*)0));
934
935 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
936 for (i = 0; i < n_pspecs; ++i)
937 {
938 GParamSpec *pspec = pspecs[i];
939 GValue *value;
940
941 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
942 continue;
943
944 g_assert (pspec->param_id < LAST_PROP)do { if (pspec->param_id < LAST_PROP) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 944, ((const char*) (__func__
)), "pspec->param_id < LAST_PROP"); } while (0)
;
945 value = g_value_array_get_nth (priv->properties, pspec->param_id);
946 g_value_init (value, pspec->value_type);
947 g_param_value_set_default (pspec, value);
948 }
949
950 g_free (pspecs);
951
952 /* A few properties don't have defaults via the param spec; set them explicitly */
953 object_class = G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
;
954 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_FOREGROUND_COLOR"foreground-color"), FALSE(0));
955 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_BOLD_COLOR"bold-color"), FALSE(0));
956 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_BACKGROUND_COLOR"background-color"), FALSE(0));
957 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_FONT"font"), FALSE(0));
958 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_PALETTE"palette"), FALSE(0));
959}
960
961static GObject *
962terminal_profile_constructor (GType type,
963 guint n_construct_properties,
964 GObjectConstructParam *construct_params)
965{
966 GObject *object;
967 TerminalProfile *profile;
968 TerminalProfilePrivate *priv;
969 const char *name;
970 GParamSpec **pspecs;
971 guint n_pspecs, i;
972 gchar *concat;
973
974 object = G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->constructor
975 (type, n_construct_properties, construct_params);
976
977 profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
978 priv = profile->priv;
979
980 name = g_value_get_string (g_value_array_get_nth (priv->properties, PROP_NAME));
981 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-profile.c", 981, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
982
983 concat = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", name, "/", NULL((void*)0));
984 priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
985 g_assert (priv->settings != NULL)do { if (priv->settings != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 985, ((const char*) (__func__
)), "priv->settings != NULL"); } while (0)
;
986 g_free (concat);
987 concat = g_strconcat("changed::", priv->profile_dir, "/", NULL((void*)0));
988 g_signal_connect (priv->settings,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
989 concat,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
990 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
991 profile)g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
;
992
993 g_free (concat);
994
995 /* Now load those properties from GSettings that were not set as construction params */
996 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
997 for (i = 0; i < n_pspecs; ++i)
998 {
999 GParamSpec *pspec = pspecs[i];
1000 guint j;
1001 gboolean is_construct = FALSE(0);
1002 char *key;
1003
1004 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
1005 continue;
1006
1007 if ((pspec->flags & G_PARAM_WRITABLE) == 0 ||
1008 (pspec->flags & G_PARAM_CONSTRUCT_ONLY) != 0)
1009 continue;
1010
1011 for (j = 0; j < n_construct_properties; ++j)
1012 if (pspec == construct_params[j].pspec)
1013 {
1014 is_construct = TRUE(!(0));
1015 break;
1016 }
1017
1018 if (is_construct)
1019 continue;
1020
1021 key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
1022 if (!key)
1023 continue;
1024
1025 terminal_profile_gsettings_notify_cb (priv->settings, key, profile);
1026 }
1027
1028 g_free (pspecs);
1029
1030 return object;
1031}
1032
1033static void
1034terminal_profile_finalize (GObject *object)
1035{
1036 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1037 TerminalProfilePrivate *priv = profile->priv;
1038
1039 g_signal_handlers_disconnect_by_func (priv->settings,g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1040 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1041 profile)g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
;
1042
1043 if (priv->save_idle_id)
1044 {
1045 g_source_remove (priv->save_idle_id);
1046
1047 /* Save now */
1048 terminal_profile_save (profile);
1049 }
1050
1051 _terminal_profile_forget (profile);
1052
1053 g_object_unref (priv->settings);
1054
1055 g_free (priv->profile_dir);
1056 g_free (priv->locked);
1057 g_value_array_free (priv->properties);
1058
1059 G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->finalize (object);
1060}
1061
1062static void
1063terminal_profile_get_property (GObject *object,
1064 guint prop_id,
1065 GValue *value,
1066 GParamSpec *pspec)
1067{
1068 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1069 TerminalProfilePrivate *priv = profile->priv;
1070
1071 if (prop_id == 0 || prop_id >= LAST_PROP)
1072 {
1073 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-profile.c", 1073, ("property"), _glib__property_id
, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance
*) (_glib__pspec))->g_class))->g_type)))), (g_type_name
((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1074 return;
1075 }
1076
1077 /* Note: When adding things here, do the same in get_prop_value_from_prop_name! */
1078 switch (prop_id)
1079 {
1080 case PROP_BACKGROUND_IMAGE:
1081 ensure_pixbuf_property (profile, PROP_BACKGROUND_IMAGE_FILE, PROP_BACKGROUND_IMAGE, &priv->background_load_failed);
1082 break;
1083 default:
1084 break;
1085 }
1086
1087 g_value_copy (g_value_array_get_nth (priv->properties, prop_id), value);
1088}
1089
1090static void
1091terminal_profile_set_property (GObject *object,
1092 guint prop_id,
1093 const GValue *value,
1094 GParamSpec *pspec)
1095{
1096 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1097 TerminalProfilePrivate *priv = profile->priv;
1098 GValue *prop_value;
1099
1100 if (prop_id == 0 || prop_id >= LAST_PROP)
1101 {
1102 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-profile.c", 1102, ("property"), _glib__property_id
, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance
*) (_glib__pspec))->g_class))->g_type)))), (g_type_name
((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1103 return;
1104 }
1105
1106 prop_value = g_value_array_get_nth (priv->properties, prop_id);
1107
1108 /* Preprocessing */
1109 switch (prop_id)
1110 {
1111#if 0
1112 case PROP_FONT:
1113 {
1114 PangoFontDescription *font_desc, *new_font_desc;
1115
1116 font_desc = g_value_get_boxed (prop_value);
1117 new_font_desc = g_value_get_boxed (value);
1118
1119 if (font_desc && new_font_desc)
1120 {
1121 /* Merge in case the new string isn't complete enough to load a font */
1122 pango_font_description_merge (font_desc, new_font_desc, TRUE(!(0)));
1123 pango_font_description_free (new_font_desc);
1124 break;
1125 }
1126
1127 /* fall-through */
1128 }
1129#endif
1130 default:
1131 g_value_copy (value, prop_value);
1132 break;
1133 }
1134
1135 /* Postprocessing */
1136 switch (prop_id)
1137 {
1138 case PROP_NAME:
1139 {
1140 const char *name = g_value_get_string (value);
1141
1142 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-profile.c", 1142, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
1143 priv->profile_dir = g_strdup (name)g_strdup_inline (name);
1144 if (priv->settings != NULL((void*)0)) {
1145 gchar *concat;
1146 g_signal_handlers_disconnect_by_func (priv->settings,g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1147 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1148 profile)g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
;
1149 g_object_unref (priv->settings);
1150 concat= g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", priv->profile_dir, "/", NULL((void*)0));
1151 priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
1152 g_free (concat);
1153 concat = g_strconcat("changed::", priv->profile_dir, "/", NULL((void*)0));
1154 g_signal_connect (priv->settings,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1155 concat,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1156 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1157 profile)g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
;
1158 g_free (concat);
1159 }
1160 break;
1161 }
1162
1163 case PROP_BACKGROUND_IMAGE_FILE:
1164 /* Clear the cached image */
1165 g_value_set_object (g_value_array_get_nth (priv->properties, PROP_BACKGROUND_IMAGE), NULL((void*)0));
1166 priv->background_load_failed = FALSE(0);
1167 g_object_notify (object, TERMINAL_PROFILE_BACKGROUND_IMAGE"background-image");
1168 break;
1169
1170 default:
1171 break;
1172 }
1173}
1174
1175static void
1176terminal_profile_notify (GObject *object,
1177 GParamSpec *pspec)
1178{
1179 TerminalProfilePrivate *priv = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
->priv;
1180 void (* notify) (GObject *, GParamSpec *) = G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->notify;
1181
1182 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
1183 "Property notification for prop %s\n",do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
1184 pspec->name)do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
;
1185
1186 if (notify)
1187 notify (object, pspec);
1188
1189 if (pspec->owner_type == TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) &&
1190 (pspec->flags & G_PARAM_WRITABLE) &&
1191 g_param_spec_get_qdata (pspec, gsettings_key_quark) != NULL((void*)0) &&
1192 pspec != priv->gsettings_notification_pspec)
1193 terminal_profile_schedule_save (TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
, pspec);
1194}
1195
1196static void
1197terminal_profile_class_init (TerminalProfileClass *klass)
1198{
1199 GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
;
1200
1201 gsettings_key_quark = g_quark_from_static_string ("GT::GSettingsKey");
1202
1203 object_class->constructor = terminal_profile_constructor;
1204 object_class->finalize = terminal_profile_finalize;
1205 object_class->get_property = terminal_profile_get_property;
1206 object_class->set_property = terminal_profile_set_property;
1207 object_class->notify = terminal_profile_notify;
1208
1209 signals[FORGOTTEN] =
1210 g_signal_new ("forgotten",
1211 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1212 G_SIGNAL_RUN_LAST,
1213 G_STRUCT_OFFSET (TerminalProfileClass, forgotten)((glong) __builtin_offsetof(TerminalProfileClass, forgotten)),
1214 NULL((void*)0), NULL((void*)0),
1215 g_cclosure_marshal_VOID__VOID,
1216 G_TYPE_NONE((GType) ((1) << (2))), 0);
1217
1218 /* gsettings_key -> pspec hash */
1219 klass->gsettings_keys = g_hash_table_new (g_str_hash, g_str_equal);
1220
1221#define TERMINAL_PROFILE_PSPEC_STATIC(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
1222
1223#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);
}
\
1224{\
1225 GParamSpec *pspec = propSpec;\
1226 g_object_class_install_property (object_class, propId, pspec);\
1227 g_param_spec_set_qdata (pspec, gsettings_key_quark, (gpointer) propGSettings);\
1228 g_hash_table_insert (klass->gsettings_keys, (gpointer) propGSettings, pspec);\
1229}
1230
1231#define TERMINAL_PROFILE_PROPERTY_OUTER(propId, propSpec){ GParamSpec *pspec = propSpec; g_object_class_install_property
(object_class, propId, pspec);}
\
1232{\
1233 GParamSpec *pspec = propSpec;\
1234 g_object_class_install_property (object_class, propId, pspec);\
1235}
1236
1237#define TERMINAL_PROFILE_PROPERTY_BOOLEAN(prop, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1238 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1239 g_param_spec_boolean (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1240 propDefault,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1241 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1242 propGSettings){ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1243
1244#define TERMINAL_PROFILE_PROPERTY_BOXED(prop, propType, propGSettings){ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1245 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1246 g_param_spec_boxed (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1247 propType,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1248 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1249 propGSettings){ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1250
1251#define TERMINAL_PROFILE_PROPERTY_DOUBLE(prop, propMin, propMax, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1252 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1253 g_param_spec_double (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1254 propMin, propMax, propDefault,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1255 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1256 propGSettings){ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1257
1258#define TERMINAL_PROFILE_PROPERTY_ENUM(prop, propType, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1259 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1260 g_param_spec_enum (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1261 propType, propDefault,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1262 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1263 propGSettings){ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1264
1265#define TERMINAL_PROFILE_PROPERTY_INT(prop, propMin, propMax, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1266 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1267 g_param_spec_int (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1268 propMin, propMax, propDefault,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1269 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1270 propGSettings){ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1271
1272 /* these are all read-only */
1273#define TERMINAL_PROFILE_PROPERTY_OBJECT(prop, propType){ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec);}
\
1274 TERMINAL_PROFILE_PROPERTY_OUTER (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1275 g_param_spec_object (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1276 propType,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1277 G_PARAM_READABLE | TERMINAL_PROFILE_PSPEC_STATIC)){ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1278
1279#define TERMINAL_PROFILE_PROPERTY_STRING(prop, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1280 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1281 g_param_spec_string (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1282 propDefault,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1283 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1284 propGSettings){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1285
1286#define TERMINAL_PROFILE_PROPERTY_STRING_CO(prop, propDefault){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec);}
\
1287 TERMINAL_PROFILE_PROPERTY_OUTER (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1288 g_param_spec_string (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1289 propDefault,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1290 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | TERMINAL_PROFILE_PSPEC_STATIC)){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1291
1292#define TERMINAL_PROFILE_PROPERTY_VALUE_ARRAY_BOXED(prop, propElementName, propElementType, propGSettings){ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1293 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1294 g_param_spec_value_array (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1295 g_param_spec_boxed (propElementName, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1296 propElementType, \{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1297 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1298 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1299 propGSettings){ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1300
1301 TERMINAL_PROFILE_PROPERTY_BOOLEAN (ALLOW_BOLD, DEFAULT_ALLOW_BOLD, KEY_ALLOW_BOLD){ GParamSpec *pspec = g_param_spec_boolean ("allow-bold", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_ALLOW_BOLD, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "allow-bold"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "allow-bold", pspec);}
;
1302 TERMINAL_PROFILE_PROPERTY_BOOLEAN (BOLD_COLOR_SAME_AS_FG, DEFAULT_BOLD_COLOR_SAME_AS_FG, KEY_BOLD_COLOR_SAME_AS_FG){ GParamSpec *pspec = g_param_spec_boolean ("bold-color-same-as-fg"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BOLD_COLOR_SAME_AS_FG, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "bold-color-same-as-fg"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "bold-color-same-as-fg"
, pspec);}
;
1303 TERMINAL_PROFILE_PROPERTY_BOOLEAN (DEFAULT_SHOW_MENUBAR, DEFAULT_DEFAULT_SHOW_MENUBAR, KEY_DEFAULT_SHOW_MENUBAR){ GParamSpec *pspec = g_param_spec_boolean ("default-show-menubar"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_DEFAULT_SHOW_MENUBAR, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "default-show-menubar"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "default-show-menubar"
, pspec);}
;
1304 TERMINAL_PROFILE_PROPERTY_BOOLEAN (LOGIN_SHELL, DEFAULT_LOGIN_SHELL, KEY_LOGIN_SHELL){ GParamSpec *pspec = g_param_spec_boolean ("login-shell", ((
void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_LOGIN_SHELL, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "login-shell"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "login-shell", pspec);
}
;
1305 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_BACKGROUND, DEFAULT_SCROLL_BACKGROUND, KEY_SCROLL_BACKGROUND){ GParamSpec *pspec = g_param_spec_boolean ("scroll-background"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_BACKGROUND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-background")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-background"
, pspec);}
;
1306 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLLBACK_UNLIMITED, DEFAULT_SCROLLBACK_UNLIMITED, KEY_SCROLLBACK_UNLIMITED){ GParamSpec *pspec = g_param_spec_boolean ("scrollback-unlimited"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLLBACK_UNLIMITED, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scrollback-unlimited"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scrollback-unlimited"
, pspec);}
;
1307 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_KEYSTROKE, DEFAULT_SCROLL_ON_KEYSTROKE, KEY_SCROLL_ON_KEYSTROKE){ GParamSpec *pspec = g_param_spec_boolean ("scroll-on-keystroke"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_ON_KEYSTROKE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-on-keystroke"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-on-keystroke"
, pspec);}
;
1308 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_OUTPUT, DEFAULT_SCROLL_ON_OUTPUT, KEY_SCROLL_ON_OUTPUT){ GParamSpec *pspec = g_param_spec_boolean ("scroll-on-output"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_ON_OUTPUT, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-on-output");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-on-output"
, pspec);}
;
1309 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SILENT_BELL, DEFAULT_SILENT_BELL, KEY_SILENT_BELL){ GParamSpec *pspec = g_param_spec_boolean ("silent-bell", ((
void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SILENT_BELL, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "silent-bell"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "silent-bell", pspec);
}
;
1310 TERMINAL_PROFILE_PROPERTY_BOOLEAN (COPY_SELECTION, DEFAULT_COPY_SELECTION, KEY_COPY_SELECTION){ GParamSpec *pspec = g_param_spec_boolean ("copy-selection",
((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_COPY_SELECTION, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "copy-selection"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "copy-selection", pspec
);}
;
1311 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_COMMAND, DEFAULT_USE_CUSTOM_COMMAND, KEY_USE_CUSTOM_COMMAND){ GParamSpec *pspec = g_param_spec_boolean ("use-custom-command"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_CUSTOM_COMMAND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-custom-command"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-custom-command"
, pspec);}
;
1312 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_DEFAULT_SIZE, DEFAULT_USE_CUSTOM_DEFAULT_SIZE, KEY_USE_CUSTOM_DEFAULT_SIZE){ GParamSpec *pspec = g_param_spec_boolean ("use-custom-default-size"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_CUSTOM_DEFAULT_SIZE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-custom-default-size"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-custom-default-size"
, pspec);}
;
1313 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SKEY, DEFAULT_USE_SKEY, KEY_USE_SKEY){ GParamSpec *pspec = g_param_spec_boolean ("use-skey", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_SKEY, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-skey"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-skey", pspec);}
;
1314 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_URLS, DEFAULT_USE_URLS, KEY_USE_URLS){ GParamSpec *pspec = g_param_spec_boolean ("use-urls", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_URLS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-urls"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-urls", pspec);}
;
1315 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SYSTEM_FONT, DEFAULT_USE_SYSTEM_FONT, KEY_USE_SYSTEM_FONT){ GParamSpec *pspec = g_param_spec_boolean ("use-system-font"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_SYSTEM_FONT, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-system-font"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-system-font", pspec
);}
;
1316 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_THEME_COLORS, DEFAULT_USE_THEME_COLORS, KEY_USE_THEME_COLORS){ GParamSpec *pspec = g_param_spec_boolean ("use-theme-colors"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_THEME_COLORS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-theme-colors");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-theme-colors"
, pspec);}
;
1317
1318 TERMINAL_PROFILE_PROPERTY_BOXED (BACKGROUND_COLOR, GDK_TYPE_RGBA, KEY_BACKGROUND_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("background-color",
((void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "background-color"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "background-color", pspec);}
;
1319 TERMINAL_PROFILE_PROPERTY_BOXED (BOLD_COLOR, GDK_TYPE_RGBA, KEY_BOLD_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("bold-color", ((void
*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BOLD_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "bold-color"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "bold-color", pspec);}
;
1320 TERMINAL_PROFILE_PROPERTY_BOXED (FONT, PANGO_TYPE_FONT_DESCRIPTION, KEY_FONT){ GParamSpec *pspec = g_param_spec_boxed ("font", ((void*)0),
((void*)0), (pango_font_description_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_FONT,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) "font"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "font", pspec);}
;
1321 TERMINAL_PROFILE_PROPERTY_BOXED (FOREGROUND_COLOR, GDK_TYPE_RGBA, KEY_FOREGROUND_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("foreground-color",
((void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_FOREGROUND_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "foreground-color"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "foreground-color", pspec);}
;
1322
1323 /* 0.0 = normal bg, 1.0 = all black bg, 0.5 = half darkened */
1324 TERMINAL_PROFILE_PROPERTY_DOUBLE (BACKGROUND_DARKNESS, 0.0, 1.0, DEFAULT_BACKGROUND_DARKNESS, KEY_BACKGROUND_DARKNESS){ GParamSpec *pspec = g_param_spec_double ("background-darkness"
, ((void*)0), ((void*)0), 0.0, 1.0, (0.5), G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_DARKNESS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "background-darkness"); g_hash_table_insert (klass
->gsettings_keys, (gpointer) "background-darkness", pspec)
;}
;
1325
1326 TERMINAL_PROFILE_PROPERTY_ENUM (BACKGROUND_TYPE, TERMINAL_TYPE_BACKGROUND_TYPE, DEFAULT_BACKGROUND_TYPE, KEY_BACKGROUND_TYPE){ GParamSpec *pspec = g_param_spec_enum ("background-type", (
(void*)0), ((void*)0), (terminal_background_type_get_type ())
, (TERMINAL_BACKGROUND_SOLID), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BACKGROUND_TYPE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "background-type"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "background-type", pspec
);}
;
1327 TERMINAL_PROFILE_PROPERTY_ENUM (BACKSPACE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_BACKSPACE_BINDING, KEY_BACKSPACE_BINDING){ GParamSpec *pspec = g_param_spec_enum ("backspace-binding",
((void*)0), ((void*)0), (vte_erase_binding_get_type ()), (VTE_ERASE_ASCII_DELETE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_BACKSPACE_BINDING, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) "backspace-binding"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "backspace-binding", pspec
);}
;
1328 TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_BLINK_MODE, VTE_TYPE_CURSOR_BLINK_MODE, DEFAULT_CURSOR_BLINK_MODE, KEY_CURSOR_BLINK_MODE){ GParamSpec *pspec = g_param_spec_enum ("cursor-blink-mode",
((void*)0), ((void*)0), (vte_cursor_blink_mode_get_type ()),
(VTE_CURSOR_BLINK_SYSTEM), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_CURSOR_BLINK_MODE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "cursor-blink-mode")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "cursor-blink-mode"
, pspec);}
;
1329 TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_SHAPE, VTE_TYPE_CURSOR_SHAPE, DEFAULT_CURSOR_SHAPE, KEY_CURSOR_SHAPE){ GParamSpec *pspec = g_param_spec_enum ("cursor-shape", ((void
*)0), ((void*)0), (vte_cursor_shape_get_type ()), (VTE_CURSOR_SHAPE_BLOCK
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_CURSOR_SHAPE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "cursor-shape"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "cursor-shape", pspec);}
;
1330 TERMINAL_PROFILE_PROPERTY_ENUM (DELETE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_DELETE_BINDING, KEY_DELETE_BINDING){ GParamSpec *pspec = g_param_spec_enum ("delete-binding", ((
void*)0), ((void*)0), (vte_erase_binding_get_type ()), (VTE_ERASE_DELETE_SEQUENCE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_DELETE_BINDING, pspec); g_param_spec_set_qdata (pspec,
gsettings_key_quark, (gpointer) "delete-binding"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "delete-binding", pspec
);}
;
1331 TERMINAL_PROFILE_PROPERTY_ENUM (EXIT_ACTION, TERMINAL_TYPE_EXIT_ACTION, DEFAULT_EXIT_ACTION, KEY_EXIT_ACTION){ GParamSpec *pspec = g_param_spec_enum ("exit-action", ((void
*)0), ((void*)0), (terminal_exit_action_get_type ()), (TERMINAL_EXIT_CLOSE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_EXIT_ACTION, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "exit-action"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "exit-action", pspec);}
;
1332 TERMINAL_PROFILE_PROPERTY_ENUM (SCROLLBAR_POSITION, TERMINAL_TYPE_SCROLLBAR_POSITION, DEFAULT_SCROLLBAR_POSITION, KEY_SCROLLBAR_POSITION){ GParamSpec *pspec = g_param_spec_enum ("scrollbar-position"
, ((void*)0), ((void*)0), (terminal_scrollbar_position_get_type
()), (TERMINAL_SCROLLBAR_RIGHT), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLLBAR_POSITION, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scrollbar-position"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scrollbar-position"
, pspec);}
;
1333 TERMINAL_PROFILE_PROPERTY_ENUM (TITLE_MODE, TERMINAL_TYPE_TITLE_MODE, DEFAULT_TITLE_MODE, KEY_TITLE_MODE){ GParamSpec *pspec = g_param_spec_enum ("title-mode", ((void
*)0), ((void*)0), (terminal_title_mode_get_type ()), (TERMINAL_TITLE_REPLACE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_TITLE_MODE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "title-mode"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "title-mode", pspec);}
;
1334
1335 TERMINAL_PROFILE_PROPERTY_INT (DEFAULT_SIZE_COLUMNS, 1, 1024, DEFAULT_DEFAULT_SIZE_COLUMNS, KEY_DEFAULT_SIZE_COLUMNS){ GParamSpec *pspec = g_param_spec_int ("default-size-columns"
, ((void*)0), ((void*)0), 1, 1024, (80), G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_DEFAULT_SIZE_COLUMNS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "default-size-columns"); g_hash_table_insert (klass
->gsettings_keys, (gpointer) "default-size-columns", pspec
);}
;
1336 TERMINAL_PROFILE_PROPERTY_INT (DEFAULT_SIZE_ROWS, 1, 1024, DEFAULT_DEFAULT_SIZE_ROWS, KEY_DEFAULT_SIZE_ROWS){ GParamSpec *pspec = g_param_spec_int ("default-size-rows", (
(void*)0), ((void*)0), 1, 1024, (24), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_DEFAULT_SIZE_ROWS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "default-size-rows")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "default-size-rows"
, pspec);}
;
1337 TERMINAL_PROFILE_PROPERTY_INT (SCROLLBACK_LINES, 1, G_MAXINT, DEFAULT_SCROLLBACK_LINES, KEY_SCROLLBACK_LINES){ GParamSpec *pspec = g_param_spec_int ("scrollback-lines", (
(void*)0), ((void*)0), 1, 2147483647, (512), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_SCROLLBACK_LINES
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "scrollback-lines"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "scrollback-lines", pspec);}
;
1338
1339 TERMINAL_PROFILE_PROPERTY_OBJECT (BACKGROUND_IMAGE, GDK_TYPE_PIXBUF){ GParamSpec *pspec = g_param_spec_object ("background-image"
, ((void*)0), ((void*)0), (gdk_pixbuf_get_type ()), G_PARAM_READABLE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_IMAGE
, pspec);}
;
1340
1341 TERMINAL_PROFILE_PROPERTY_STRING_CO (NAME, DEFAULT_NAME){ GParamSpec *pspec = g_param_spec_string ("name", ((void*)0)
, ((void*)0), (((void*)0)), G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_NAME,
pspec);}
;
1342
1343 TERMINAL_PROFILE_PROPERTY_STRING (BACKGROUND_IMAGE_FILE, DEFAULT_BACKGROUND_IMAGE_FILE, KEY_BACKGROUND_IMAGE_FILE){ GParamSpec *pspec = g_param_spec_string ("background-image-file"
, ((void*)0), ((void*)0), (""), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BACKGROUND_IMAGE_FILE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "background-image");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "background-image"
, pspec);}
;
1344 TERMINAL_PROFILE_PROPERTY_STRING (CUSTOM_COMMAND, DEFAULT_CUSTOM_COMMAND, KEY_CUSTOM_COMMAND){ GParamSpec *pspec = g_param_spec_string ("custom-command", (
(void*)0), ((void*)0), (""), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_CUSTOM_COMMAND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "custom-command"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "custom-command", pspec
);}
;
1345 TERMINAL_PROFILE_PROPERTY_STRING (TITLE, _(DEFAULT_TITLE), KEY_TITLE){ GParamSpec *pspec = g_param_spec_string ("title", ((void*)0
), ((void*)0), gettext ((("Terminal"))), G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_TITLE
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "title"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "title", pspec);}
;
1346 TERMINAL_PROFILE_PROPERTY_STRING (VISIBLE_NAME, _(DEFAULT_VISIBLE_NAME), KEY_VISIBLE_NAME){ GParamSpec *pspec = g_param_spec_string ("visible-name", ((
void*)0), ((void*)0), gettext ((("Unnamed"))), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_VISIBLE_NAME
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "visible-name"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "visible-name", pspec);}
;
1347 TERMINAL_PROFILE_PROPERTY_STRING (WORD_CHARS, DEFAULT_WORD_CHARS, KEY_WORD_CHARS){ GParamSpec *pspec = g_param_spec_string ("word-chars", ((void
*)0), ((void*)0), ("-A-Za-z0-9,./?%&#:_=+@~"), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_WORD_CHARS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "word-chars"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "word-chars", pspec);}
;
1348
1349 TERMINAL_PROFILE_PROPERTY_VALUE_ARRAY_BOXED (PALETTE, "palette-color", GDK_TYPE_RGBA, KEY_PALETTE){ GParamSpec *pspec = g_param_spec_value_array ("palette", ((
void*)0), ((void*)0), g_param_spec_boxed ("palette-color", ((
void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_PALETTE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "palette"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "palette", pspec);}
;
1350}
1351
1352/* Semi-Public API */
1353
1354TerminalProfile*
1355_terminal_profile_new (const char *name)
1356{
1357 return g_object_new (TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()),
1358 "name", name,
1359 NULL((void*)0));
1360}
1361
1362void
1363_terminal_profile_forget (TerminalProfile *profile)
1364{
1365 TerminalProfilePrivate *priv = profile->priv;
1366
1367 if (!priv->forgotten)
1368 {
1369 priv->forgotten = TRUE(!(0));
1370
1371 g_signal_emit (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, signals[FORGOTTEN], 0);
1372 }
1373}
1374
1375gboolean
1376_terminal_profile_get_forgotten (TerminalProfile *profile)
1377{
1378 return profile->priv->forgotten;
1379}
1380
1381TerminalProfile *
1382_terminal_profile_clone (TerminalProfile *base_profile,
1383 const char *visible_name)
1384{
1385 TerminalApp *app = terminal_app_get ();
1386 GObject *base_object = G_OBJECT (base_profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((base_profile)), (((GType) ((20) << (2))))))))
;
1387 TerminalProfilePrivate *new_priv;
1388 char profile_name[32];
1389 GParameter *params;
1390 GParamSpec **pspecs;
1391 guint n_pspecs, i, n_params, profile_num;
1392 TerminalProfile *new_profile;
1393
1394 g_object_ref (base_profile)((__typeof__ (base_profile)) (g_object_ref) (base_profile));
1395
1396 profile_num = 0;
1397 do
1398 {
1399 g_snprintf (profile_name, sizeof (profile_name), "profile%u", profile_num++);
1400 }
1401 while (terminal_app_get_profile_by_name (app, profile_name) != NULL((void*)0));
1402
1403 /* Now we have an unused profile name */
1404 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (base_profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((base_profile
)))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
1405
1406 params = g_newa (GParameter, n_pspecs)((GParameter*) __builtin_alloca (sizeof (GParameter) * (gsize
) (n_pspecs)))
;
1407 n_params = 0;
1408
1409 for (i = 0; i < n_pspecs; ++i)
1410 {
1411 GParamSpec *pspec = pspecs[i];
1412 GValue *value;
1413
1414 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) ||
1415 (pspec->flags & G_PARAM_WRITABLE) == 0)
1416 continue;
1417
1418 params[n_params].name = pspec->name;
1419
1420 value = &params[n_params].value;
1421 G_VALUE_TYPE (value)(((GValue*) (value))->g_type) = 0;
1422 g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
1423
1424 if (pspec->name == I_(TERMINAL_PROFILE_NAME)g_intern_static_string ("name"))
1425 g_value_set_static_string (value, profile_name);
1426 else if (pspec->name == I_(TERMINAL_PROFILE_VISIBLE_NAME)g_intern_static_string ("visible-name"))
1427 g_value_set_static_string (value, visible_name);
1428 else
1429 g_object_get_property (base_object, pspec->name, value);
1430
1431 ++n_params;
1432 }
1433
1434 new_profile = g_object_newv (TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()), n_params, params);
1435
1436 g_object_unref (base_profile);
1437
1438 for (i = 0; i < n_params; ++i)
1439 g_value_unset (&params[i].value);
1440
1441 /* Flush the new profile to GSettings */
1442 new_priv = new_profile->priv;
1443
1444 g_slist_free (new_priv->dirty_pspecs);
1445 new_priv->dirty_pspecs = NULL((void*)0);
1446 if (new_priv->save_idle_id != 0)
1447 {
1448 g_source_remove (new_priv->save_idle_id);
1449 new_priv->save_idle_id = 0;
1450 }
1451
1452 for (i = 0; i < n_pspecs; ++i)
1453 {
1454 GParamSpec *pspec = pspecs[i];
1455
1456 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) ||
1457 (pspec->flags & G_PARAM_WRITABLE) == 0)
1458 continue;
1459
1460 new_priv->dirty_pspecs = g_slist_prepend (new_priv->dirty_pspecs, pspec);
1461 }
1462 g_free (pspecs);
1463
1464 terminal_profile_save (new_profile);
1465
1466 return new_profile;
1467}
1468
1469/* Public API */
1470
1471gboolean
1472terminal_profile_get_property_boolean (TerminalProfile *profile,
1473 const char *prop_name)
1474{
1475 const GValue *value;
1476
1477 value = get_prop_value_from_prop_name (profile, prop_name);
1478 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_BOOLEAN (value), FALSE)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((5) << (2)))); gboolean __r; if (!__val) __r = (0); else
if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_BOOLEAN (value)"
); return ((0)); } } while (0)
;
1479 if (!value || !G_VALUE_HOLDS_BOOLEAN (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((5) << (2)))); gboolean __r;
if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1480 return FALSE(0);
1481
1482 return g_value_get_boolean (value);
1483}
1484
1485gconstpointer
1486terminal_profile_get_property_boxed (TerminalProfile *profile,
1487 const char *prop_name)
1488{
1489 const GValue *value;
1490
1491 value = get_prop_value_from_prop_name (profile, prop_name);
1492 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_BOXED (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((18) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_BOXED (value)"
); return (((void*)0)); } } while (0)
;
1493 if (!value || !G_VALUE_HOLDS_BOXED (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((18) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1494 return NULL((void*)0);
1495
1496 return g_value_get_boxed (value);
1497}
1498
1499double
1500terminal_profile_get_property_double (TerminalProfile *profile,
1501 const char *prop_name)
1502{
1503 const GValue *value;
1504
1505 value = get_prop_value_from_prop_name (profile, prop_name);
1506 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_DOUBLE (value), 0.0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((15) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_DOUBLE (value)"
); return (0.0); } } while (0)
;
1507 if (!value || !G_VALUE_HOLDS_DOUBLE (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((15) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1508 return 0.0;
1509
1510 return g_value_get_double (value);
1511}
1512
1513int
1514terminal_profile_get_property_enum (TerminalProfile *profile,
1515 const char *prop_name)
1516{
1517 const GValue *value;
1518
1519 value = get_prop_value_from_prop_name (profile, prop_name);
1520 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_ENUM (value), 0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((12) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_ENUM (value)"
); return (0); } } while (0)
;
1521 if (!value || !G_VALUE_HOLDS_ENUM (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((12) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1522 return 0;
1523
1524 return g_value_get_enum (value);
1525}
1526
1527int
1528terminal_profile_get_property_int (TerminalProfile *profile,
1529 const char *prop_name)
1530{
1531 const GValue *value;
1532
1533 value = get_prop_value_from_prop_name (profile, prop_name);
1534 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_INT (value), 0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((6) << (2)))); gboolean __r; if (!__val) __r = (0); else
if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_INT (value)"
); return (0); } } while (0)
;
1535 if (!value || !G_VALUE_HOLDS_INT (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((6) << (2)))); gboolean __r;
if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1536 return 0;
1537
1538 return g_value_get_int (value);
1539}
1540
1541gpointer
1542terminal_profile_get_property_object (TerminalProfile *profile,
1543 const char *prop_name)
1544{
1545 const GValue *value;
1546
1547 value = get_prop_value_from_prop_name (profile, prop_name);
1548 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_OBJECT (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((20) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_OBJECT (value)"
); return (((void*)0)); } } while (0)
;
1549 if (!value || !G_VALUE_HOLDS_OBJECT (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((20) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1550 return NULL((void*)0);
1551
1552 return g_value_get_object (value);
1553}
1554
1555const char*
1556terminal_profile_get_property_string (TerminalProfile *profile,
1557 const char *prop_name)
1558{
1559 const GValue *value;
1560
1561 value = get_prop_value_from_prop_name (profile, prop_name);
1562 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_STRING (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((16) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_STRING (value)"
); return (((void*)0)); } } while (0)
;
1563 if (!value || !G_VALUE_HOLDS_STRING (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((16) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1564 return NULL((void*)0);
1565
1566 return g_value_get_string (value);
1567}
1568
1569gboolean
1570terminal_profile_property_locked (TerminalProfile *profile,
1571 const char *prop_name)
1572{
1573 TerminalProfilePrivate *priv = profile->priv;
1574 GParamSpec *pspec;
1575
1576 pspec = get_pspec_from_name (profile, prop_name);
1577 g_return_val_if_fail (pspec != NULL, FALSE)do { if ((pspec != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "pspec != NULL");
return ((0)); } } while (0)
;
1578 if (!pspec)
1579 return FALSE(0);
1580
1581 return priv->locked[pspec->param_id];
1582}
1583
1584void
1585terminal_profile_reset_property (TerminalProfile *profile,
1586 const char *prop_name)
1587{
1588 GParamSpec *pspec;
1589
1590 pspec = get_pspec_from_name (profile, prop_name);
1591 g_return_if_fail (pspec != NULL)do { if ((pspec != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "pspec != NULL");
return; } } while (0)
;
1592 if (!pspec ||
1593 (pspec->flags & G_PARAM_WRITABLE) == 0)
1594 return;
1595
1596 terminal_profile_reset_property_internal (profile, pspec, TRUE(!(0)));
1597}
1598
1599gboolean
1600terminal_profile_get_palette (TerminalProfile *profile,
1601 GdkRGBA *colors,
1602 guint *n_colors)
1603{
1604 TerminalProfilePrivate *priv;
1605 GValueArray *array;
1606 guint i, n;
1607
1608 g_return_val_if_fail (TERMINAL_IS_PROFILE (profile), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((profile)); GType __t = ((terminal_profile_get_type ()));
gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class
&& __inst->g_class->g_type == __t) __r = (!(0)
); else __r = g_type_check_instance_is_a (__inst, __t); __r; }
)))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "TERMINAL_IS_PROFILE (profile)"); return
((0)); } } while (0)
;
1609 g_return_val_if_fail (colors != NULL && n_colors != NULL, FALSE)do { if ((colors != ((void*)0) && n_colors != ((void*
)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "colors != NULL && n_colors != NULL"
); return ((0)); } } while (0)
;
1610
1611 priv = profile->priv;
1612 array = g_value_get_boxed (g_value_array_get_nth (priv->properties, PROP_PALETTE));
1613 if (!array)
1614 return FALSE(0);
1615
1616 n = MIN (array->n_values, *n_colors)(((array->n_values) < (*n_colors)) ? (array->n_values
) : (*n_colors))
;
1617 for (i = 0; i < n; ++i)
1618 {
1619 GdkRGBA *color = g_value_get_boxed (g_value_array_get_nth (array, i));
1620 if (!color)
1621 continue; /* shouldn't happen!! */
1622
1623 colors[i] = *color;
1624 }
1625
1626 *n_colors = n;
1627 return TRUE(!(0));
1628}
1629
1630gboolean
1631terminal_profile_get_palette_is_builtin (TerminalProfile *profile,
1632 guint *n)
1633{
1634 GdkRGBA colors[TERMINAL_PALETTE_SIZE16];
1635 guint n_colors;
1636 guint i;
1637
1638 n_colors = G_N_ELEMENTS (colors)(sizeof (colors) / sizeof ((colors)[0]));
1639 if (!terminal_profile_get_palette (profile, colors, &n_colors) ||
1640 n_colors != TERMINAL_PALETTE_SIZE16)
1641 return FALSE(0);
1642
1643 for (i = 0; i < TERMINAL_PALETTE_N_BUILTINS5; ++i)
1644 if (palette_cmp (colors, terminal_palettes[i]))
1645 {
1646 *n = i;
1647 return TRUE(!(0));
1648 }
1649
1650 return FALSE(0);
1651}
1652
1653void
1654terminal_profile_set_palette_builtin (TerminalProfile *profile,
1655 guint n)
1656{
1657 GValue value = { 0, };
1658
1659 g_return_if_fail (n < TERMINAL_PALETTE_N_BUILTINS)do { if ((n < 5)) { } else { g_return_if_fail_warning (((gchar
*) 0), ((const char*) (__func__)), "n < TERMINAL_PALETTE_N_BUILTINS"
); return; } } while (0)
;
1660
1661 g_value_init (&value, G_TYPE_VALUE_ARRAY(g_value_array_get_type ()) GCC warning "Deprecated pre-processor symbol: replace with \"(g_array_get_type ())\""
+
);
1662 set_value_from_palette (&value, terminal_palettes[n], TERMINAL_PALETTE_SIZE16);
1663 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, TERMINAL_PROFILE_PALETTE"palette", &value);
1664 g_value_unset (&value);
1665}
1666
1667gboolean
1668terminal_profile_modify_palette_entry (TerminalProfile *profile,
1669 guint i,
1670 const GdkRGBA *color)
1671{
1672 TerminalProfilePrivate *priv = profile->priv;
1673 GValueArray *array;
1674 GValue *value;
1675 GdkRGBA *old_color;
1676
1677 array = g_value_get_boxed (g_value_array_get_nth (priv->properties, PROP_PALETTE));
1678 if (!array ||
1679 i >= array->n_values)
1680 return FALSE(0);
1681
1682 value = g_value_array_get_nth (array, i);
1683 old_color = g_value_get_boxed (value);
1684 if (!old_color ||
1685 !rgba_equal (old_color, color))
1686 {
1687 g_value_set_boxed (value, color);
1688 g_object_notify (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, TERMINAL_PROFILE_PALETTE"palette");
1689 }
1690
1691 return TRUE(!(0));
1692}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-49a7b3.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-49a7b3.html new file mode 100644 index 0000000..3a6de42 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-49a7b3.html @@ -0,0 +1,2385 @@ + + + +terminal-profile.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:terminal-profile.c
Warning:line 600, column 46
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name terminal-profile.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I .. -I ../src/mate-submodules/libegg -D TERMINAL_COMPILATION -D TERMINAL_RESOURCES_PATH_PREFIX="/org/mate/terminal" -D TERM_DATADIR="/usr/local/share" -D TERM_LOCALEDIR="/usr/local/share/locale" -D TERM_PKGDATADIR="/usr/local/share/mate-terminal" -D TERM_HELPDIR="/usr/local/share/help" -D SN_API_NOT_YET_FROZEN -D GDK_MULTIHEAD_SAFE -D G_DISABLE_SINGLE_INCLUDES -D PANGO_DISABLE_SINGLE_INCLUDES -D ATK_DISABLE_SINGLE_INCLUDES -D GDK_DISABLE_SINGLE_INCLUDES -D GDK_PIXBUF_DISABLE_SINGLE_INCLUDES -D GTK_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c terminal-profile.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright © 2001 Havoc Pennington
3 * Copyright © 2002 Mathias Hasselmann
4 * Copyright © 2008 Christian Persch
5 * Copyright (C) 2012-2021 MATE Developers
6 *
7 * Mate-terminal is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * Mate-terminal is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <config.h>
22
23#include <string.h>
24#include <stdlib.h>
25
26#include <gtk/gtk.h>
27
28#include "terminal-app.h"
29#include "terminal-debug.h"
30#include "terminal-intl.h"
31#include "terminal-profile.h"
32#include "terminal-screen.h"
33#include "terminal-type-builtins.h"
34
35/* To add a new key, you need to:
36 *
37 * - add an entry to the enum below
38 * - add a #define with its name in terminal-profile.h
39 * - add a gobject property for it in terminal_profile_class_init
40 * - if the property's type needs special casing, add that to
41 * terminal_profile_gsettings_notify_cb and
42 * terminal_profile_gsettings_changeset_add
43 * - if necessary the default value cannot be handled via the paramspec,
44 * handle that in terminal_profile_reset_property_internal
45 */
46enum
47{
48 PROP_0,
49 PROP_ALLOW_BOLD,
50 PROP_BACKGROUND_COLOR,
51 PROP_BACKGROUND_DARKNESS,
52 PROP_BACKGROUND_IMAGE,
53 PROP_BACKGROUND_IMAGE_FILE,
54 PROP_BACKGROUND_TYPE,
55 PROP_BACKSPACE_BINDING,
56 PROP_BOLD_COLOR,
57 PROP_BOLD_COLOR_SAME_AS_FG,
58 PROP_CURSOR_BLINK_MODE,
59 PROP_CURSOR_SHAPE,
60 PROP_CUSTOM_COMMAND,
61 PROP_DEFAULT_SIZE_COLUMNS,
62 PROP_DEFAULT_SIZE_ROWS,
63 PROP_DEFAULT_SHOW_MENUBAR,
64 PROP_DELETE_BINDING,
65 PROP_EXIT_ACTION,
66 PROP_FONT,
67 PROP_FOREGROUND_COLOR,
68 PROP_LOGIN_SHELL,
69 PROP_NAME,
70 PROP_PALETTE,
71 PROP_SCROLL_BACKGROUND,
72 PROP_SCROLLBACK_LINES,
73 PROP_SCROLLBACK_UNLIMITED,
74 PROP_SCROLLBAR_POSITION,
75 PROP_SCROLL_ON_KEYSTROKE,
76 PROP_SCROLL_ON_OUTPUT,
77 PROP_SILENT_BELL,
78 PROP_TITLE,
79 PROP_TITLE_MODE,
80 PROP_USE_CUSTOM_COMMAND,
81 PROP_USE_CUSTOM_DEFAULT_SIZE,
82 PROP_USE_SKEY,
83 PROP_USE_URLS,
84 PROP_USE_SYSTEM_FONT,
85 PROP_USE_THEME_COLORS,
86 PROP_VISIBLE_NAME,
87 PROP_WORD_CHARS,
88 PROP_COPY_SELECTION,
89 LAST_PROP
90};
91
92#define KEY_ALLOW_BOLD"allow-bold" "allow-bold"
93#define KEY_BACKGROUND_COLOR"background-color" "background-color"
94#define KEY_BACKGROUND_DARKNESS"background-darkness" "background-darkness"
95#define KEY_BACKGROUND_IMAGE_FILE"background-image" "background-image"
96#define KEY_BACKGROUND_TYPE"background-type" "background-type"
97#define KEY_BACKSPACE_BINDING"backspace-binding" "backspace-binding"
98#define KEY_BOLD_COLOR"bold-color" "bold-color"
99#define KEY_BOLD_COLOR_SAME_AS_FG"bold-color-same-as-fg" "bold-color-same-as-fg"
100#define KEY_CURSOR_BLINK_MODE"cursor-blink-mode" "cursor-blink-mode"
101#define KEY_CURSOR_SHAPE"cursor-shape" "cursor-shape"
102#define KEY_CUSTOM_COMMAND"custom-command" "custom-command"
103#define KEY_DEFAULT_SHOW_MENUBAR"default-show-menubar" "default-show-menubar"
104#define KEY_DEFAULT_SIZE_COLUMNS"default-size-columns" "default-size-columns"
105#define KEY_DEFAULT_SIZE_ROWS"default-size-rows" "default-size-rows"
106#define KEY_DELETE_BINDING"delete-binding" "delete-binding"
107#define KEY_EXIT_ACTION"exit-action" "exit-action"
108#define KEY_FONT"font" "font"
109#define KEY_FOREGROUND_COLOR"foreground-color" "foreground-color"
110#define KEY_LOGIN_SHELL"login-shell" "login-shell"
111#define KEY_PALETTE"palette" "palette"
112#define KEY_SCROLL_BACKGROUND"scroll-background" "scroll-background"
113#define KEY_SCROLLBACK_LINES"scrollback-lines" "scrollback-lines"
114#define KEY_SCROLLBACK_UNLIMITED"scrollback-unlimited" "scrollback-unlimited"
115#define KEY_SCROLLBAR_POSITION"scrollbar-position" "scrollbar-position"
116#define KEY_SCROLL_ON_KEYSTROKE"scroll-on-keystroke" "scroll-on-keystroke"
117#define KEY_SCROLL_ON_OUTPUT"scroll-on-output" "scroll-on-output"
118#define KEY_SILENT_BELL"silent-bell" "silent-bell"
119#define KEY_COPY_SELECTION"copy-selection" "copy-selection"
120#define KEY_TITLE_MODE"title-mode" "title-mode"
121#define KEY_TITLE"title" "title"
122#define KEY_USE_CUSTOM_COMMAND"use-custom-command" "use-custom-command"
123#define KEY_USE_CUSTOM_DEFAULT_SIZE"use-custom-default-size" "use-custom-default-size"
124#define KEY_USE_SKEY"use-skey" "use-skey"
125#define KEY_USE_URLS"use-urls" "use-urls"
126#define KEY_USE_SYSTEM_FONT"use-system-font" "use-system-font"
127#define KEY_USE_THEME_COLORS"use-theme-colors" "use-theme-colors"
128#define KEY_VISIBLE_NAME"visible-name" "visible-name"
129#define KEY_WORD_CHARS"word-chars" "word-chars"
130
131/* Keep these in sync with the GSettings schema! */
132#define DEFAULT_ALLOW_BOLD((!(0))) (TRUE(!(0)))
133#define DEFAULT_BACKGROUND_COLOR("#FFFFDD") ("#FFFFDD")
134#define DEFAULT_BOLD_COLOR_SAME_AS_FG((!(0))) (TRUE(!(0)))
135#define DEFAULT_BACKGROUND_DARKNESS(0.5) (0.5)
136#define DEFAULT_BACKGROUND_IMAGE_FILE("") ("")
137#define DEFAULT_BACKGROUND_TYPE(TERMINAL_BACKGROUND_SOLID) (TERMINAL_BACKGROUND_SOLID)
138#define DEFAULT_BACKSPACE_BINDING(VTE_ERASE_ASCII_DELETE) (VTE_ERASE_ASCII_DELETE)
139#define DEFAULT_CURSOR_BLINK_MODE(VTE_CURSOR_BLINK_SYSTEM) (VTE_CURSOR_BLINK_SYSTEM)
140#define DEFAULT_CURSOR_SHAPE(VTE_CURSOR_SHAPE_BLOCK) (VTE_CURSOR_SHAPE_BLOCK)
141#define DEFAULT_CUSTOM_COMMAND("") ("")
142#define DEFAULT_DEFAULT_SHOW_MENUBAR((!(0))) (TRUE(!(0)))
143#define DEFAULT_DEFAULT_SIZE_COLUMNS(80) (80)
144#define DEFAULT_DEFAULT_SIZE_ROWS(24) (24)
145#define DEFAULT_DELETE_BINDING(VTE_ERASE_DELETE_SEQUENCE) (VTE_ERASE_DELETE_SEQUENCE)
146#define DEFAULT_EXIT_ACTION(TERMINAL_EXIT_CLOSE) (TERMINAL_EXIT_CLOSE)
147#define DEFAULT_FONT("Monospace 12") ("Monospace 12")
148#define DEFAULT_FOREGROUND_COLOR("#000000") ("#000000")
149#define DEFAULT_LOGIN_SHELL((0)) (FALSE(0))
150#define DEFAULT_NAME(((void*)0)) (NULL((void*)0))
151#define DEFAULT_PALETTE(terminal_palettes[0]) (terminal_palettes[TERMINAL_PALETTE_TANGO0])
152#define DEFAULT_SCROLL_BACKGROUND((!(0))) (TRUE(!(0)))
153#define DEFAULT_SCROLLBACK_LINES(512) (512)
154#define DEFAULT_SCROLLBACK_UNLIMITED((0)) (FALSE(0))
155#define DEFAULT_SCROLLBAR_POSITION(TERMINAL_SCROLLBAR_RIGHT) (TERMINAL_SCROLLBAR_RIGHT)
156#define DEFAULT_SCROLL_ON_KEYSTROKE((!(0))) (TRUE(!(0)))
157#define DEFAULT_SCROLL_ON_OUTPUT((0)) (FALSE(0))
158#define DEFAULT_SILENT_BELL((0)) (FALSE(0))
159#define DEFAULT_COPY_SELECTION((0)) (FALSE(0))
160#define DEFAULT_TITLE_MODE(TERMINAL_TITLE_REPLACE) (TERMINAL_TITLE_REPLACE)
161#define DEFAULT_TITLE(("Terminal")) (N_("Terminal")("Terminal"))
162#define DEFAULT_USE_CUSTOM_COMMAND((0)) (FALSE(0))
163#define DEFAULT_USE_CUSTOM_DEFAULT_SIZE((0)) (FALSE(0))
164#define DEFAULT_USE_SKEY((!(0))) (TRUE(!(0)))
165#define DEFAULT_USE_URLS((!(0))) (TRUE(!(0)))
166#define DEFAULT_USE_SYSTEM_FONT((!(0))) (TRUE(!(0)))
167#define DEFAULT_USE_THEME_COLORS((!(0))) (TRUE(!(0)))
168#define DEFAULT_VISIBLE_NAME(("Unnamed")) (N_("Unnamed")("Unnamed"))
169#define DEFAULT_WORD_CHARS("-A-Za-z0-9,./?%&#:_=+@~") ("-A-Za-z0-9,./?%&#:_=+@~")
170
171struct _TerminalProfilePrivate
172{
173 GValueArray *properties;
174 gboolean *locked;
175
176 GSettings *settings;
177 char *profile_dir;
178
179 GSList *dirty_pspecs;
180 guint save_idle_id;
181
182 GParamSpec *gsettings_notification_pspec;
183
184 gboolean background_load_failed;
185
186 guint forgotten : 1;
187};
188
189static const GdkRGBA terminal_palettes[TERMINAL_PALETTE_N_BUILTINS5][TERMINAL_PALETTE_SIZE16] =
190{
191 /* Tango palette */
192 {
193 { 0, 0, 0, 1 },
194 { 0.8, 0, 0, 1 },
195 { 0.305882, 0.603922, 0.0235294, 1 },
196 { 0.768627, 0.627451, 0, 1 },
197 { 0.203922, 0.396078, 0.643137, 1 },
198 { 0.458824, 0.313725, 0.482353, 1 },
199 { 0.0235294, 0.596078, 0.603922, 1 },
200 { 0.827451, 0.843137, 0.811765, 1 },
201 { 0.333333, 0.341176, 0.32549, 1 },
202 { 0.937255, 0.160784, 0.160784, 1 },
203 { 0.541176, 0.886275, 0.203922, 1 },
204 { 0.988235, 0.913725, 0.309804, 1 },
205 { 0.447059, 0.623529, 0.811765, 1 },
206 { 0.678431, 0.498039, 0.658824, 1 },
207 { 0.203922, 0.886275, 0.886275, 1 },
208 { 0.933333, 0.933333, 0.92549, 1 },
209 },
210
211 /* Linux palette */
212 {
213 { 0, 0, 0, 1 },
214 { 0.666667, 0, 0, 1 },
215 { 0, 0.666667, 0, 1 },
216 { 0.666667, 0.333333, 0, 1 },
217 { 0, 0, 0.666667, 1 },
218 { 0.666667, 0, 0.666667, 1 },
219 { 0, 0.666667, 0.666667, 1 },
220 { 0.666667, 0.666667, 0.666667, 1 },
221 { 0.333333, 0.333333, 0.333333, 1 },
222 { 1, 0.333333, 0.333333, 1 },
223 { 0.333333, 1, 0.333333, 1 },
224 { 1, 1, 0.333333, 1 },
225 { 0.333333, 0.333333, 1, 1 },
226 { 1, 0.333333, 1, 1 },
227 { 0.333333, 1, 1, 1 },
228 { 1, 1, 1, 1 },
229 },
230
231 /* XTerm palette */
232 {
233 { 0, 0, 0, 1 },
234 { 0.803922, 0, 0, 1 },
235 { 0, 0.803922, 0, 1 },
236 { 0.803922, 0.803922, 0, 1 },
237 { 0.117647, 0.564706, 1, 1 },
238 { 0.803922, 0, 0.803922, 1 },
239 { 0, 0.803922, 0.803922, 1 },
240 { 0.898039, 0.898039, 0.898039, 1 },
241 { 0.298039, 0.298039, 0.298039, 1 },
242 { 1, 0, 0, 1 },
243 { 0, 1, 0, 1 },
244 { 1, 1, 0, 1 },
245 { 0.27451, 0.509804, 0.705882, 1 },
246 { 1, 0, 1, 1 },
247 { 0, 1, 1, 1 },
248 { 1, 1, 1, 1 },
249 },
250
251 /* RXVT palette */
252 {
253 { 0, 0, 0, 1 },
254 { 0.803922, 0, 0, 1 },
255 { 0, 0.803922, 0, 1 },
256 { 0.803922, 0.803922, 0, 1 },
257 { 0, 0, 0.803922, 1 },
258 { 0.803922, 0, 0.803922, 1 },
259 { 0, 0.803922, 0.803922, 1 },
260 { 0.980392, 0.921569, 0.843137, 1 },
261 { 0.25098, 0.25098, 0.25098, 1 },
262 { 1, 0, 0, 1 },
263 { 0, 1, 0, 1 },
264 { 1, 1, 0, 1 },
265 { 0, 0, 1, 1 },
266 { 1, 0, 1, 1 },
267 { 0, 1, 1, 1 },
268 { 1, 1, 1, 1 },
269 },
270
271 /* Solarized palette (1.0.0beta2): http://ethanschoonover.com/solarized */
272 {
273 { 0.02745, 0.211764, 0.258823, 1 },
274 { 0.862745, 0.196078, 0.184313, 1 },
275 { 0.521568, 0.6, 0, 1 },
276 { 0.709803, 0.537254, 0, 1 },
277 { 0.149019, 0.545098, 0.823529, 1 },
278 { 0.82745, 0.211764, 0.509803, 1 },
279 { 0.164705, 0.631372, 0.596078, 1 },
280 { 0.933333, 0.909803, 0.835294, 1 },
281 { 0, 0.168627, 0.211764, 1 },
282 { 0.796078, 0.294117, 0.086274, 1 },
283 { 0.345098, 0.431372, 0.458823, 1 },
284 { 0.396078, 0.482352, 0.513725, 1 },
285 { 0.513725, 0.580392, 0.588235, 1 },
286 { 0.423529, 0.443137, 0.768627, 1 },
287 { 0.57647, 0.631372, 0.631372, 1 },
288 { 0.992156, 0.964705, 0.890196, 1 },
289 },
290};
291
292enum
293{
294 FORGOTTEN,
295 LAST_SIGNAL
296};
297
298static void terminal_profile_finalize (GObject *object);
299static void terminal_profile_set_property (GObject *object,
300 guint prop_id,
301 const GValue *value,
302 GParamSpec *pspec);
303static void ensure_pixbuf_property (TerminalProfile *profile,
304 guint path_prop_id,
305 guint pixbuf_prop_id,
306 gboolean *load_failed);
307
308static guint signals[LAST_SIGNAL] = { 0 };
309static GQuark gsettings_key_quark;
310
311G_DEFINE_TYPE_WITH_PRIVATE (TerminalProfile, terminal_profile, G_TYPE_OBJECT)static void terminal_profile_init (TerminalProfile *self); static
void terminal_profile_class_init (TerminalProfileClass *klass
); static GType terminal_profile_get_type_once (void); static
gpointer terminal_profile_parent_class = ((void*)0); static gint
TerminalProfile_private_offset; static void terminal_profile_class_intern_init
(gpointer klass) { terminal_profile_parent_class = g_type_class_peek_parent
(klass); if (TerminalProfile_private_offset != 0) g_type_class_adjust_private_offset
(klass, &TerminalProfile_private_offset); terminal_profile_class_init
((TerminalProfileClass*) klass); } __attribute__ ((__unused__
)) static inline gpointer terminal_profile_get_instance_private
(TerminalProfile *self) { return (((gpointer) ((guint8*) (self
) + (glong) (TerminalProfile_private_offset)))); } GType terminal_profile_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ _Static_assert (sizeof *(&static_g_define_type_id) ==
sizeof (gpointer), "Expression evaluates to false"); (void) (
0 ? (gpointer) *(&static_g_define_type_id) : ((void*)0));
(!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = terminal_profile_get_type_once
(); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } __attribute__ ((__noinline__)) static GType terminal_profile_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
(((GType) ((20) << (2))), g_intern_static_string ("TerminalProfile"
), sizeof (TerminalProfileClass), (GClassInitFunc)(void (*)(void
)) terminal_profile_class_intern_init, sizeof (TerminalProfile
), (GInstanceInitFunc)(void (*)(void)) terminal_profile_init,
(GTypeFlags) 0); { {{ TerminalProfile_private_offset = g_type_add_instance_private
(g_define_type_id, sizeof (TerminalProfilePrivate)); };} } return
g_define_type_id; }
;
312
313/* gdk_rgba_equal is too strict! */
314static gboolean
315rgba_equal (const GdkRGBA *a,
316 const GdkRGBA *b)
317{
318 gdouble dr, dg, db, da;
319
320 dr = a->red - b->red;
321 dg = a->green - b->green;
322 db = a->blue - b->blue;
323 da = a->alpha - b->alpha;
324
325 return (dr * dr + dg * dg + db * db + da * da) < 1e-4;
326}
327
328static gboolean
329palette_cmp (const GdkRGBA *ca,
330 const GdkRGBA *cb)
331{
332 guint i;
333
334 for (i = 0; i < TERMINAL_PALETTE_SIZE16; ++i)
335 if (!rgba_equal (&ca[i], &cb[i]))
336 return FALSE(0);
337
338 return TRUE(!(0));
339}
340
341static GParamSpec *
342get_pspec_from_name (TerminalProfile *profile,
343 const char *prop_name)
344{
345 TerminalProfileClass *klass = TERMINAL_PROFILE_GET_CLASS (profile)((((TerminalProfileClass*) (((GTypeInstance*) ((profile)))->
g_class))))
;
346 GParamSpec *pspec;
347
348 pspec = g_object_class_find_property (G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
, prop_name);
349 if (pspec &&
350 pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
351 pspec = NULL((void*)0);
352
353 return pspec;
354}
355
356static const GValue *
357get_prop_value_from_prop_name (TerminalProfile *profile,
358 const char *prop_name)
359{
360 TerminalProfilePrivate *priv = profile->priv;
361 GParamSpec *pspec;
362
363 pspec = get_pspec_from_name (profile, prop_name);
364 if (!pspec)
365 return NULL((void*)0);
366
367 if (G_UNLIKELY (pspec->param_id == PROP_BACKGROUND_IMAGE)(pspec->param_id == PROP_BACKGROUND_IMAGE))
368 ensure_pixbuf_property (profile, PROP_BACKGROUND_IMAGE_FILE, PROP_BACKGROUND_IMAGE, &priv->background_load_failed);
369
370 return g_value_array_get_nth (priv->properties, pspec->param_id);
371}
372
373static void
374set_value_from_palette (GValue *ret_value,
375 const GdkRGBA *colors,
376 guint n_colors)
377{
378 GValueArray *array;
379 guint i, max_n_colors;
380
381 max_n_colors = MAX (n_colors, TERMINAL_PALETTE_SIZE)(((n_colors) > (16)) ? (n_colors) : (16));
382 array = g_value_array_new (max_n_colors);
383 for (i = 0; i < max_n_colors; ++i)
384 g_value_array_append (array, NULL((void*)0));
385
386 for (i = 0; i < n_colors; ++i)
387 {
388 GValue *value = g_value_array_get_nth (array, i);
389
390 g_value_init (value, GDK_TYPE_RGBA(gdk_rgba_get_type ()));
391 g_value_set_boxed (value, &colors[i]);
392 }
393
394 /* If we haven't enough colours yet, fill up with the default palette */
395 for (i = n_colors; i < TERMINAL_PALETTE_SIZE16; ++i)
396 {
397 GValue *value = g_value_array_get_nth (array, i);
398
399 g_value_init (value, GDK_TYPE_RGBA(gdk_rgba_get_type ()));
400 g_value_set_boxed (value, &DEFAULT_PALETTE(terminal_palettes[0])[i]);
401 }
402
403 g_value_take_boxed (ret_value, array);
404}
405
406static int
407values_equal (GParamSpec *pspec,
408 const GValue *va,
409 const GValue *vb)
410{
411 /* g_param_values_cmp isn't good enough for some types, since e.g.
412 * it compares colours and font descriptions by pointer value, not
413 * with the correct compare functions. Providing extra
414 * PangoParamSpecFontDescription and GdkParamSpecColor wouldn't
415 * have fixed this either, since it's unclear how to _order_ them.
416 * Luckily we only need to check them for equality here.
417 */
418
419 if (g_param_values_cmp (pspec, va, vb) == 0)
420 return TRUE(!(0));
421
422 if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
423 return rgba_equal (g_value_get_boxed (va), g_value_get_boxed (vb));
424
425 if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
426 return pango_font_description_equal (g_value_get_boxed (va), g_value_get_boxed (vb));
427
428 if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
429 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
430 {
431 GValueArray *ara, *arb;
432 guint i;
433
434 ara = g_value_get_boxed (va);
435 arb = g_value_get_boxed (vb);
436
437 if (!ara || !arb || ara->n_values != arb->n_values)
438 return FALSE(0);
439
440 for (i = 0; i < ara->n_values; ++i)
441 if (!rgba_equal (g_value_get_boxed (g_value_array_get_nth (ara, i)),
442 g_value_get_boxed (g_value_array_get_nth (arb, i))))
443 return FALSE(0);
444
445 return TRUE(!(0));
446 }
447
448 return FALSE(0);
449}
450
451static void
452ensure_pixbuf_property (TerminalProfile *profile,
453 guint path_prop_id,
454 guint pixbuf_prop_id,
455 gboolean *load_failed)
456{
457 TerminalProfilePrivate *priv = profile->priv;
458 GValue *path_value, *pixbuf_value;
459 GdkPixbuf *pixbuf;
460 const char *path_utf8;
461 char *path;
462 GError *error = NULL((void*)0);
463
464 pixbuf_value = g_value_array_get_nth (priv->properties, pixbuf_prop_id);
465
466 pixbuf = g_value_get_object (pixbuf_value);
467 if (pixbuf)
468 return;
469
470 if (*load_failed)
471 return;
472
473 path_value = g_value_array_get_nth (priv->properties, path_prop_id);
474 path_utf8 = g_value_get_string (path_value);
475 if (!path_utf8 || !path_utf8[0])
476 goto failed;
477
478 path = g_filename_from_utf8 (path_utf8, -1, NULL((void*)0), NULL((void*)0), NULL((void*)0));
479 if (!path)
480 goto failed;
481
482 pixbuf = gdk_pixbuf_new_from_file (path, &error);
483 if (!pixbuf)
484 {
485 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
486 "Failed to load image \"%s\": %s\n",do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
487 path, error->message)do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
;
488
489 g_error_free (error);
490 g_free (path);
491 goto failed;
492 }
493
494 g_value_take_object (pixbuf_value, pixbuf);
495 g_free (path);
496 return;
497
498failed:
499 *load_failed = TRUE(!(0));
500}
501
502static void
503terminal_profile_reset_property_internal (TerminalProfile *profile,
504 GParamSpec *pspec,
505 gboolean notify)
506{
507 TerminalProfilePrivate *priv = profile->priv;
508 GValue value_ = { 0, };
509 GValue *value;
510
511 if (notify)
512 {
513 value = &value_;
514 g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
515 }
516 else
517 value = g_value_array_get_nth (priv->properties, pspec->param_id);
518 g_assert (value != NULL)do { if (value != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 518, ((const char*) (__func__
)), "value != NULL"); } while (0)
;
519
520 /* A few properties don't have defaults via the param spec; set them explicitly */
521 switch (pspec->param_id)
522 {
523 case PROP_FOREGROUND_COLOR:
524 case PROP_BOLD_COLOR:
525 {
526 GdkRGBA color;
527
528 if (!gdk_rgba_parse (&color, DEFAULT_FOREGROUND_COLOR("#000000")))
529 return;
530 color.alpha = 1.0;
531 g_value_set_boxed (value, &color);
532 break;
533 }
534 case PROP_BACKGROUND_COLOR:
535 {
536 GdkRGBA color;
537
538 if (!gdk_rgba_parse (&color, DEFAULT_BACKGROUND_COLOR("#FFFFDD")))
539 return;
540 color.alpha = 1.0;
541 g_value_set_boxed (value, &color);
542 break;
543 }
544 case PROP_FONT:
545 g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_FONT("Monospace 12")));
546 break;
547
548 case PROP_PALETTE:
549 set_value_from_palette (value, DEFAULT_PALETTE(terminal_palettes[0]), TERMINAL_PALETTE_SIZE16);
550 break;
551
552 default:
553 g_param_value_set_default (pspec, value);
554 break;
555 }
556
557 if (notify)
558 {
559 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, pspec->name, value);
560 g_value_unset (value);
561 }
562}
563
564static void
565terminal_profile_gsettings_notify_cb (GSettings *settings,
566 gchar *key,
567 gpointer user_data)
568{
569 TerminalProfile *profile = TERMINAL_PROFILE (user_data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_profile_get_type ()))))))
;
570 TerminalProfilePrivate *priv = profile->priv;
571 TerminalProfileClass *klass;
572 GVariant *settings_value;
573 GParamSpec *pspec;
574 GValue value = { 0, };
575 gboolean equal;
576 gboolean force_set = FALSE(0);
577
578 if (!key) return;
579
580 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
581 "GSettings notification for key %s [%s]\n",do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
582 key,do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
583 g_settings_is_writable (settings, key) ? "writable" : "LOCKED")do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
;
584
585 klass = TERMINAL_PROFILE_GET_CLASS (profile)((((TerminalProfileClass*) (((GTypeInstance*) ((profile)))->
g_class))))
;
586 pspec = g_hash_table_lookup (klass->gsettings_keys, key);
587 if (!pspec)
588 return; /* ignore unknown keys, for future extensibility */
589
590 priv->locked[pspec->param_id] = !g_settings_is_writable (settings, key);
591
592 settings_value = g_settings_get_value (settings, key);
593 if (!settings_value)
594 return;
595
596 g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
597
598 if (G_IS_PARAM_SPEC_BOOLEAN (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[2])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
599 {
600 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_BOOLEAN((const GVariantType *) "b")))
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
601 goto out;
602
603 g_value_set_boolean (&value, g_variant_get_boolean (settings_value));
604 }
605 else if (G_IS_PARAM_SPEC_STRING (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[14])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
606 {
607 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
608 goto out;
609
610 g_value_set_string (&value, g_variant_get_string (settings_value, NULL((void*)0)));
611 }
612 else if (G_IS_PARAM_SPEC_ENUM (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[10])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
613 {
614
615 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
616 goto out;
617
618 g_value_set_enum (&value, g_settings_get_enum (settings, key));
619 }
620 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
621 {
622 GdkRGBA color;
623
624 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
625 goto out;
626
627 if (!gdk_rgba_parse (&color, g_variant_get_string (settings_value, NULL((void*)0))))
628 goto out;
629
630 g_value_set_boxed (&value, &color);
631 }
632 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
633 {
634 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
635 goto out;
636
637 g_value_take_boxed (&value, pango_font_description_from_string (g_variant_get_string (settings_value, NULL((void*)0))));
638 }
639 else if (G_IS_PARAM_SPEC_DOUBLE (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[13])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
640 {
641 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_DOUBLE((const GVariantType *) "d")))
642 goto out;
643
644 g_value_set_double (&value, g_variant_get_double (settings_value));
645 }
646 else if (G_IS_PARAM_SPEC_INT (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[3])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
647 {
648 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT16((const GVariantType *) "n")) &&
649 !g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT32((const GVariantType *) "i")) &&
650 !g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT64((const GVariantType *) "x")))
651 goto out;
652
653 g_value_set_int (&value, g_settings_get_int(settings, key));
654 }
655 else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
656 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
657 {
658 char **color_strings;
659 GdkRGBA *colors;
660 int n_colors, i;
661
662 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
663 goto out;
664
665 color_strings = g_strsplit (g_variant_get_string (settings_value, NULL((void*)0)), ":", -1);
666 if (!color_strings)
667 goto out;
668
669 n_colors = g_strv_length (color_strings);
670 colors = g_new0 (GdkRGBA, n_colors)((GdkRGBA *) g_malloc0_n ((n_colors), sizeof (GdkRGBA)));
671 for (i = 0; i < n_colors; ++i)
672 {
673 if (!gdk_rgba_parse (&colors[i], color_strings[i]))
674 continue; /* ignore errors */
675 }
676 g_strfreev (color_strings);
677
678 /* We continue even with a palette size != TERMINAL_PALETTE_SIZE,
679 * so we can change the palette size in future versions without
680 * causing too many issues.
681 */
682 set_value_from_palette (&value, colors, n_colors);
683 g_free (colors);
684 }
685 else
686 {
687 g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
), pspec->name);
688 goto out;
689 }
690
691 if (g_param_value_validate (pspec, &value))
692 {
693 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
694 "Invalid value in GSettings for key %s was changed to comply with pspec %s\n",do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
695 key, pspec->name)do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
;
696
697 force_set = TRUE(!(0));
698 }
699
700 /* Only set the property if the value is different than our current value,
701 * so we don't go into an infinite loop.
702 */
703 equal = values_equal (pspec, &value, g_value_array_get_nth (priv->properties, pspec->param_id));
704#ifdef MATE_ENABLE_DEBUG
705 _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_PROFILE)if (0)
706 {
707 if (!equal)
708 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("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)); } while (0)
709 "Setting property %s to a different value\n"do { if (0) g_printerr("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)); } while (0)
710 " now: %s\n"do { if (0) g_printerr("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)); } while (0)
711 " new: %s\n",do { if (0) g_printerr("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)); } while (0)
712 pspec->name,do { if (0) g_printerr("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)); } while (0)
713 g_strdup_value_contents (g_value_array_get_nth (priv->properties, pspec->param_id)),do { if (0) g_printerr("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)); } while (0)
714 g_strdup_value_contents (&value))do { if (0) g_printerr("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)); } while (0)
;
715 }
716#endif
717
718 if (!equal || force_set)
719 {
720 priv->gsettings_notification_pspec = pspec;
721 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, pspec->name, &value);
722 priv->gsettings_notification_pspec = NULL((void*)0);
723 }
724
725out:
726 /* FIXME: if we arrive here through goto in the error cases,
727 * should we maybe reset the property to its default value?
728 */
729
730 g_value_unset (&value);
731 g_variant_unref (settings_value);
732}
733
734static void
735terminal_profile_gsettings_changeset_add (TerminalProfile *profile,
736 GSettings *changeset,
737 GParamSpec *pspec)
738{
739 TerminalProfilePrivate *priv = profile->priv;
740 char *key;
741 const GValue *value;
742
743 /* FIXME: do this? */
744#if 0
745 if (priv->locked[pspec->param_id])
746 return;
747
748 if (!g_settings_is_writable (priv->settings, gsettings_key, NULL((void*)0)))
749 return;
750#endif
751
752 key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
753 if (!key)
754 return;
755
756 value = g_value_array_get_nth (priv->properties, pspec->param_id);
757
758 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
759 "Adding pspec %s with value %s to the GSettings changeset\n",do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
760 pspec->name, g_strdup_value_contents (value))do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
;
761
762 if (G_IS_PARAM_SPEC_BOOLEAN (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[2])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
763 g_settings_set_boolean (changeset, key, g_value_get_boolean (value));
764 else if (G_IS_PARAM_SPEC_STRING (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[14])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
765 {
766 const char *str;
767
768 str = g_value_get_string (value);
769 g_settings_set_string (changeset, key, str ? str : "");
770 }
771 else if (G_IS_PARAM_SPEC_ENUM (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[10])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
772 {
773 const GEnumValue *eval;
774
775 eval = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)((((GParamSpecEnum*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), ((g_param_spec_types[10]))))))
->enum_class, g_value_get_enum (value));
776
777 g_settings_set_enum (changeset, key, eval->value);
778 }
779 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
780 {
781 GdkRGBA *color;
782 char str[16];
783
784 color = g_value_get_boxed (value);
785 if (!color)
786 goto cleanup;
787
788 g_snprintf (str, sizeof (str),
789 "#%04X%04X%04X",
790 (guint) (color->red * 65535),
791 (guint) (color->green * 65535),
792 (guint) (color->blue * 65535));
793
794 g_settings_set_string (changeset, key, str);
795 }
796 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
797 {
798 PangoFontDescription *font_desc;
799 char *font;
800
801 font_desc = g_value_get_boxed (value);
802 if (!font_desc)
803 goto cleanup;
804
805 font = pango_font_description_to_string (font_desc);
806 g_settings_set_string (changeset, key, font);
807 g_free (font);
808 }
809 else if (G_IS_PARAM_SPEC_DOUBLE (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[13])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
810 g_settings_set_double (changeset, key, g_value_get_double (value));
811 else if (G_IS_PARAM_SPEC_INT (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[3])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
812 g_settings_set_int (changeset, key, g_value_get_int (value));
813 else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
814 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
815 {
816 GValueArray *array;
817 GString *string;
818 guint n_colors, i;
819
820 /* We need to do this ourselves, because the gtk_color_selection_palette_to_string
821 * does not carry all the bytes, and xterm's palette is messed up...
822 */
823
824 array = g_value_get_boxed (value);
825 if (!array)
826 goto cleanup;
827
828 n_colors = array->n_values;
829 string = g_string_sized_new (n_colors * (1 /* # */ + 3 * 4) + n_colors /* : separators and terminating \0 */);
830 for (i = 0; i < n_colors; ++i)
831 {
832 GdkRGBA *color;
833
834 if (i > 0)
835 g_string_append_c (string, ':')g_string_append_c_inline (string, ':');
836
837 color = g_value_get_boxed (g_value_array_get_nth (array, i));
838 if (!color)
839 continue;
840
841 g_string_append_printf (string,
842 "#%04X%04X%04X",
843 (guint) (color->red * 65535),
844 (guint) (color->green * 65535),
845 (guint) (color->blue * 65535));
846 }
847
848 g_settings_set_string (changeset, key, string->str);
849 g_string_free (string, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) (
(string), ((!(0)))) : g_string_free_and_steal (string)) : (g_string_free
) ((string), ((!(0)))))
;
850 }
851 else
852 g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
), pspec->name);
853
854cleanup:
855 return;
856}
857
858static void
859terminal_profile_save (TerminalProfile *profile)
860{
861 TerminalProfilePrivate *priv = profile->priv;
862 GSettings *changeset;
863 GSList *l;
864 gchar *concat;
865
866 priv->save_idle_id = 0;
867 concat = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", priv->profile_dir,"/", NULL((void*)0));
868 changeset = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
869 g_free (concat);
870 g_settings_delay (changeset);
871
872 for (l = priv->dirty_pspecs; l != NULL((void*)0); l = l->next)
873 {
874 GParamSpec *pspec = (GParamSpec *) l->data;
875
876 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
877 continue;
878
879 if ((pspec->flags & G_PARAM_WRITABLE) == 0)
880 continue;
881
882 terminal_profile_gsettings_changeset_add (profile, changeset, pspec);
883 }
884
885 g_slist_free (priv->dirty_pspecs);
886 priv->dirty_pspecs = NULL((void*)0);
887
888 g_settings_apply (changeset);
889 g_object_unref (changeset);
890}
891
892static gboolean
893terminal_profile_save_idle_cb (TerminalProfile *profile)
894{
895 terminal_profile_save (profile);
896
897 /* don't run again */
898 return FALSE(0);
899}
900
901static void
902terminal_profile_schedule_save (TerminalProfile *profile,
903 GParamSpec *pspec)
904{
905 TerminalProfilePrivate *priv = profile->priv;
906
907 g_assert (pspec != NULL)do { if (pspec != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 907, ((const char*) (__func__
)), "pspec != NULL"); } while (0)
;
908
909 if (!g_slist_find (priv->dirty_pspecs, pspec))
910 priv->dirty_pspecs = g_slist_prepend (priv->dirty_pspecs, pspec);
911
912 if (priv->save_idle_id != 0)
913 return;
914
915 priv->save_idle_id = g_idle_add ((GSourceFunc) terminal_profile_save_idle_cb, profile);
916}
917
918static void
919terminal_profile_init (TerminalProfile *profile)
920{
921 TerminalProfilePrivate *priv;
922 GObjectClass *object_class;
923 GParamSpec **pspecs;
924 guint n_pspecs, i;
925
926 priv = profile->priv = terminal_profile_get_instance_private (profile);
927
928 priv->gsettings_notification_pspec = NULL((void*)0);
929 priv->locked = g_new0 (gboolean, LAST_PROP)((gboolean *) g_malloc0_n ((LAST_PROP), sizeof (gboolean)));
930
931 priv->properties = g_value_array_new (LAST_PROP);
932 for (i = 0; i < LAST_PROP; ++i)
933 g_value_array_append (priv->properties, NULL((void*)0));
934
935 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
936 for (i = 0; i < n_pspecs; ++i)
937 {
938 GParamSpec *pspec = pspecs[i];
939 GValue *value;
940
941 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
942 continue;
943
944 g_assert (pspec->param_id < LAST_PROP)do { if (pspec->param_id < LAST_PROP) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 944, ((const char*) (__func__
)), "pspec->param_id < LAST_PROP"); } while (0)
;
945 value = g_value_array_get_nth (priv->properties, pspec->param_id);
946 g_value_init (value, pspec->value_type);
947 g_param_value_set_default (pspec, value);
948 }
949
950 g_free (pspecs);
951
952 /* A few properties don't have defaults via the param spec; set them explicitly */
953 object_class = G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
;
954 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_FOREGROUND_COLOR"foreground-color"), FALSE(0));
955 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_BOLD_COLOR"bold-color"), FALSE(0));
956 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_BACKGROUND_COLOR"background-color"), FALSE(0));
957 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_FONT"font"), FALSE(0));
958 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_PALETTE"palette"), FALSE(0));
959}
960
961static GObject *
962terminal_profile_constructor (GType type,
963 guint n_construct_properties,
964 GObjectConstructParam *construct_params)
965{
966 GObject *object;
967 TerminalProfile *profile;
968 TerminalProfilePrivate *priv;
969 const char *name;
970 GParamSpec **pspecs;
971 guint n_pspecs, i;
972 gchar *concat;
973
974 object = G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->constructor
975 (type, n_construct_properties, construct_params);
976
977 profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
978 priv = profile->priv;
979
980 name = g_value_get_string (g_value_array_get_nth (priv->properties, PROP_NAME));
981 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-profile.c", 981, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
982
983 concat = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", name, "/", NULL((void*)0));
984 priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
985 g_assert (priv->settings != NULL)do { if (priv->settings != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 985, ((const char*) (__func__
)), "priv->settings != NULL"); } while (0)
;
986 g_free (concat);
987 concat = g_strconcat("changed::", priv->profile_dir, "/", NULL((void*)0));
988 g_signal_connect (priv->settings,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
989 concat,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
990 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
991 profile)g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
;
992
993 g_free (concat);
994
995 /* Now load those properties from GSettings that were not set as construction params */
996 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
997 for (i = 0; i < n_pspecs; ++i)
998 {
999 GParamSpec *pspec = pspecs[i];
1000 guint j;
1001 gboolean is_construct = FALSE(0);
1002 char *key;
1003
1004 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
1005 continue;
1006
1007 if ((pspec->flags & G_PARAM_WRITABLE) == 0 ||
1008 (pspec->flags & G_PARAM_CONSTRUCT_ONLY) != 0)
1009 continue;
1010
1011 for (j = 0; j < n_construct_properties; ++j)
1012 if (pspec == construct_params[j].pspec)
1013 {
1014 is_construct = TRUE(!(0));
1015 break;
1016 }
1017
1018 if (is_construct)
1019 continue;
1020
1021 key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
1022 if (!key)
1023 continue;
1024
1025 terminal_profile_gsettings_notify_cb (priv->settings, key, profile);
1026 }
1027
1028 g_free (pspecs);
1029
1030 return object;
1031}
1032
1033static void
1034terminal_profile_finalize (GObject *object)
1035{
1036 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1037 TerminalProfilePrivate *priv = profile->priv;
1038
1039 g_signal_handlers_disconnect_by_func (priv->settings,g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1040 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1041 profile)g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
;
1042
1043 if (priv->save_idle_id)
1044 {
1045 g_source_remove (priv->save_idle_id);
1046
1047 /* Save now */
1048 terminal_profile_save (profile);
1049 }
1050
1051 _terminal_profile_forget (profile);
1052
1053 g_object_unref (priv->settings);
1054
1055 g_free (priv->profile_dir);
1056 g_free (priv->locked);
1057 g_value_array_free (priv->properties);
1058
1059 G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->finalize (object);
1060}
1061
1062static void
1063terminal_profile_get_property (GObject *object,
1064 guint prop_id,
1065 GValue *value,
1066 GParamSpec *pspec)
1067{
1068 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1069 TerminalProfilePrivate *priv = profile->priv;
1070
1071 if (prop_id == 0 || prop_id >= LAST_PROP)
1072 {
1073 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-profile.c", 1073, ("property"), _glib__property_id
, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance
*) (_glib__pspec))->g_class))->g_type)))), (g_type_name
((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1074 return;
1075 }
1076
1077 /* Note: When adding things here, do the same in get_prop_value_from_prop_name! */
1078 switch (prop_id)
1079 {
1080 case PROP_BACKGROUND_IMAGE:
1081 ensure_pixbuf_property (profile, PROP_BACKGROUND_IMAGE_FILE, PROP_BACKGROUND_IMAGE, &priv->background_load_failed);
1082 break;
1083 default:
1084 break;
1085 }
1086
1087 g_value_copy (g_value_array_get_nth (priv->properties, prop_id), value);
1088}
1089
1090static void
1091terminal_profile_set_property (GObject *object,
1092 guint prop_id,
1093 const GValue *value,
1094 GParamSpec *pspec)
1095{
1096 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1097 TerminalProfilePrivate *priv = profile->priv;
1098 GValue *prop_value;
1099
1100 if (prop_id == 0 || prop_id >= LAST_PROP)
1101 {
1102 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-profile.c", 1102, ("property"), _glib__property_id
, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance
*) (_glib__pspec))->g_class))->g_type)))), (g_type_name
((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1103 return;
1104 }
1105
1106 prop_value = g_value_array_get_nth (priv->properties, prop_id);
1107
1108 /* Preprocessing */
1109 switch (prop_id)
1110 {
1111#if 0
1112 case PROP_FONT:
1113 {
1114 PangoFontDescription *font_desc, *new_font_desc;
1115
1116 font_desc = g_value_get_boxed (prop_value);
1117 new_font_desc = g_value_get_boxed (value);
1118
1119 if (font_desc && new_font_desc)
1120 {
1121 /* Merge in case the new string isn't complete enough to load a font */
1122 pango_font_description_merge (font_desc, new_font_desc, TRUE(!(0)));
1123 pango_font_description_free (new_font_desc);
1124 break;
1125 }
1126
1127 /* fall-through */
1128 }
1129#endif
1130 default:
1131 g_value_copy (value, prop_value);
1132 break;
1133 }
1134
1135 /* Postprocessing */
1136 switch (prop_id)
1137 {
1138 case PROP_NAME:
1139 {
1140 const char *name = g_value_get_string (value);
1141
1142 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-profile.c", 1142, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
1143 priv->profile_dir = g_strdup (name)g_strdup_inline (name);
1144 if (priv->settings != NULL((void*)0)) {
1145 gchar *concat;
1146 g_signal_handlers_disconnect_by_func (priv->settings,g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1147 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1148 profile)g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
;
1149 g_object_unref (priv->settings);
1150 concat= g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", priv->profile_dir, "/", NULL((void*)0));
1151 priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
1152 g_free (concat);
1153 concat = g_strconcat("changed::", priv->profile_dir, "/", NULL((void*)0));
1154 g_signal_connect (priv->settings,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1155 concat,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1156 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1157 profile)g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
;
1158 g_free (concat);
1159 }
1160 break;
1161 }
1162
1163 case PROP_BACKGROUND_IMAGE_FILE:
1164 /* Clear the cached image */
1165 g_value_set_object (g_value_array_get_nth (priv->properties, PROP_BACKGROUND_IMAGE), NULL((void*)0));
1166 priv->background_load_failed = FALSE(0);
1167 g_object_notify (object, TERMINAL_PROFILE_BACKGROUND_IMAGE"background-image");
1168 break;
1169
1170 default:
1171 break;
1172 }
1173}
1174
1175static void
1176terminal_profile_notify (GObject *object,
1177 GParamSpec *pspec)
1178{
1179 TerminalProfilePrivate *priv = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
->priv;
1180 void (* notify) (GObject *, GParamSpec *) = G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->notify;
1181
1182 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
1183 "Property notification for prop %s\n",do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
1184 pspec->name)do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
;
1185
1186 if (notify)
1187 notify (object, pspec);
1188
1189 if (pspec->owner_type == TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) &&
1190 (pspec->flags & G_PARAM_WRITABLE) &&
1191 g_param_spec_get_qdata (pspec, gsettings_key_quark) != NULL((void*)0) &&
1192 pspec != priv->gsettings_notification_pspec)
1193 terminal_profile_schedule_save (TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
, pspec);
1194}
1195
1196static void
1197terminal_profile_class_init (TerminalProfileClass *klass)
1198{
1199 GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
;
1200
1201 gsettings_key_quark = g_quark_from_static_string ("GT::GSettingsKey");
1202
1203 object_class->constructor = terminal_profile_constructor;
1204 object_class->finalize = terminal_profile_finalize;
1205 object_class->get_property = terminal_profile_get_property;
1206 object_class->set_property = terminal_profile_set_property;
1207 object_class->notify = terminal_profile_notify;
1208
1209 signals[FORGOTTEN] =
1210 g_signal_new ("forgotten",
1211 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1212 G_SIGNAL_RUN_LAST,
1213 G_STRUCT_OFFSET (TerminalProfileClass, forgotten)((glong) __builtin_offsetof(TerminalProfileClass, forgotten)),
1214 NULL((void*)0), NULL((void*)0),
1215 g_cclosure_marshal_VOID__VOID,
1216 G_TYPE_NONE((GType) ((1) << (2))), 0);
1217
1218 /* gsettings_key -> pspec hash */
1219 klass->gsettings_keys = g_hash_table_new (g_str_hash, g_str_equal);
1220
1221#define TERMINAL_PROFILE_PSPEC_STATIC(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
1222
1223#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);
}
\
1224{\
1225 GParamSpec *pspec = propSpec;\
1226 g_object_class_install_property (object_class, propId, pspec);\
1227 g_param_spec_set_qdata (pspec, gsettings_key_quark, (gpointer) propGSettings);\
1228 g_hash_table_insert (klass->gsettings_keys, (gpointer) propGSettings, pspec);\
1229}
1230
1231#define TERMINAL_PROFILE_PROPERTY_OUTER(propId, propSpec){ GParamSpec *pspec = propSpec; g_object_class_install_property
(object_class, propId, pspec);}
\
1232{\
1233 GParamSpec *pspec = propSpec;\
1234 g_object_class_install_property (object_class, propId, pspec);\
1235}
1236
1237#define TERMINAL_PROFILE_PROPERTY_BOOLEAN(prop, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1238 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1239 g_param_spec_boolean (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1240 propDefault,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1241 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1242 propGSettings){ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1243
1244#define TERMINAL_PROFILE_PROPERTY_BOXED(prop, propType, propGSettings){ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1245 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1246 g_param_spec_boxed (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1247 propType,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1248 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1249 propGSettings){ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1250
1251#define TERMINAL_PROFILE_PROPERTY_DOUBLE(prop, propMin, propMax, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1252 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1253 g_param_spec_double (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1254 propMin, propMax, propDefault,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1255 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1256 propGSettings){ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1257
1258#define TERMINAL_PROFILE_PROPERTY_ENUM(prop, propType, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1259 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1260 g_param_spec_enum (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1261 propType, propDefault,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1262 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1263 propGSettings){ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1264
1265#define TERMINAL_PROFILE_PROPERTY_INT(prop, propMin, propMax, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1266 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1267 g_param_spec_int (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1268 propMin, propMax, propDefault,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1269 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1270 propGSettings){ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1271
1272 /* these are all read-only */
1273#define TERMINAL_PROFILE_PROPERTY_OBJECT(prop, propType){ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec);}
\
1274 TERMINAL_PROFILE_PROPERTY_OUTER (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1275 g_param_spec_object (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1276 propType,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1277 G_PARAM_READABLE | TERMINAL_PROFILE_PSPEC_STATIC)){ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1278
1279#define TERMINAL_PROFILE_PROPERTY_STRING(prop, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1280 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1281 g_param_spec_string (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1282 propDefault,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1283 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1284 propGSettings){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1285
1286#define TERMINAL_PROFILE_PROPERTY_STRING_CO(prop, propDefault){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec);}
\
1287 TERMINAL_PROFILE_PROPERTY_OUTER (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1288 g_param_spec_string (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1289 propDefault,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1290 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | TERMINAL_PROFILE_PSPEC_STATIC)){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1291
1292#define TERMINAL_PROFILE_PROPERTY_VALUE_ARRAY_BOXED(prop, propElementName, propElementType, propGSettings){ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1293 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1294 g_param_spec_value_array (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1295 g_param_spec_boxed (propElementName, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1296 propElementType, \{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1297 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1298 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1299 propGSettings){ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1300
1301 TERMINAL_PROFILE_PROPERTY_BOOLEAN (ALLOW_BOLD, DEFAULT_ALLOW_BOLD, KEY_ALLOW_BOLD){ GParamSpec *pspec = g_param_spec_boolean ("allow-bold", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_ALLOW_BOLD, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "allow-bold"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "allow-bold", pspec);}
;
1302 TERMINAL_PROFILE_PROPERTY_BOOLEAN (BOLD_COLOR_SAME_AS_FG, DEFAULT_BOLD_COLOR_SAME_AS_FG, KEY_BOLD_COLOR_SAME_AS_FG){ GParamSpec *pspec = g_param_spec_boolean ("bold-color-same-as-fg"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BOLD_COLOR_SAME_AS_FG, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "bold-color-same-as-fg"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "bold-color-same-as-fg"
, pspec);}
;
1303 TERMINAL_PROFILE_PROPERTY_BOOLEAN (DEFAULT_SHOW_MENUBAR, DEFAULT_DEFAULT_SHOW_MENUBAR, KEY_DEFAULT_SHOW_MENUBAR){ GParamSpec *pspec = g_param_spec_boolean ("default-show-menubar"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_DEFAULT_SHOW_MENUBAR, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "default-show-menubar"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "default-show-menubar"
, pspec);}
;
1304 TERMINAL_PROFILE_PROPERTY_BOOLEAN (LOGIN_SHELL, DEFAULT_LOGIN_SHELL, KEY_LOGIN_SHELL){ GParamSpec *pspec = g_param_spec_boolean ("login-shell", ((
void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_LOGIN_SHELL, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "login-shell"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "login-shell", pspec);
}
;
1305 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_BACKGROUND, DEFAULT_SCROLL_BACKGROUND, KEY_SCROLL_BACKGROUND){ GParamSpec *pspec = g_param_spec_boolean ("scroll-background"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_BACKGROUND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-background")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-background"
, pspec);}
;
1306 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLLBACK_UNLIMITED, DEFAULT_SCROLLBACK_UNLIMITED, KEY_SCROLLBACK_UNLIMITED){ GParamSpec *pspec = g_param_spec_boolean ("scrollback-unlimited"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLLBACK_UNLIMITED, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scrollback-unlimited"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scrollback-unlimited"
, pspec);}
;
1307 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_KEYSTROKE, DEFAULT_SCROLL_ON_KEYSTROKE, KEY_SCROLL_ON_KEYSTROKE){ GParamSpec *pspec = g_param_spec_boolean ("scroll-on-keystroke"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_ON_KEYSTROKE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-on-keystroke"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-on-keystroke"
, pspec);}
;
1308 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_OUTPUT, DEFAULT_SCROLL_ON_OUTPUT, KEY_SCROLL_ON_OUTPUT){ GParamSpec *pspec = g_param_spec_boolean ("scroll-on-output"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_ON_OUTPUT, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-on-output");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-on-output"
, pspec);}
;
1309 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SILENT_BELL, DEFAULT_SILENT_BELL, KEY_SILENT_BELL){ GParamSpec *pspec = g_param_spec_boolean ("silent-bell", ((
void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SILENT_BELL, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "silent-bell"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "silent-bell", pspec);
}
;
1310 TERMINAL_PROFILE_PROPERTY_BOOLEAN (COPY_SELECTION, DEFAULT_COPY_SELECTION, KEY_COPY_SELECTION){ GParamSpec *pspec = g_param_spec_boolean ("copy-selection",
((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_COPY_SELECTION, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "copy-selection"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "copy-selection", pspec
);}
;
1311 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_COMMAND, DEFAULT_USE_CUSTOM_COMMAND, KEY_USE_CUSTOM_COMMAND){ GParamSpec *pspec = g_param_spec_boolean ("use-custom-command"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_CUSTOM_COMMAND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-custom-command"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-custom-command"
, pspec);}
;
1312 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_DEFAULT_SIZE, DEFAULT_USE_CUSTOM_DEFAULT_SIZE, KEY_USE_CUSTOM_DEFAULT_SIZE){ GParamSpec *pspec = g_param_spec_boolean ("use-custom-default-size"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_CUSTOM_DEFAULT_SIZE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-custom-default-size"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-custom-default-size"
, pspec);}
;
1313 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SKEY, DEFAULT_USE_SKEY, KEY_USE_SKEY){ GParamSpec *pspec = g_param_spec_boolean ("use-skey", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_SKEY, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-skey"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-skey", pspec);}
;
1314 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_URLS, DEFAULT_USE_URLS, KEY_USE_URLS){ GParamSpec *pspec = g_param_spec_boolean ("use-urls", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_URLS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-urls"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-urls", pspec);}
;
1315 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SYSTEM_FONT, DEFAULT_USE_SYSTEM_FONT, KEY_USE_SYSTEM_FONT){ GParamSpec *pspec = g_param_spec_boolean ("use-system-font"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_SYSTEM_FONT, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-system-font"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-system-font", pspec
);}
;
1316 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_THEME_COLORS, DEFAULT_USE_THEME_COLORS, KEY_USE_THEME_COLORS){ GParamSpec *pspec = g_param_spec_boolean ("use-theme-colors"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_THEME_COLORS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-theme-colors");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-theme-colors"
, pspec);}
;
1317
1318 TERMINAL_PROFILE_PROPERTY_BOXED (BACKGROUND_COLOR, GDK_TYPE_RGBA, KEY_BACKGROUND_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("background-color",
((void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "background-color"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "background-color", pspec);}
;
1319 TERMINAL_PROFILE_PROPERTY_BOXED (BOLD_COLOR, GDK_TYPE_RGBA, KEY_BOLD_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("bold-color", ((void
*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BOLD_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "bold-color"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "bold-color", pspec);}
;
1320 TERMINAL_PROFILE_PROPERTY_BOXED (FONT, PANGO_TYPE_FONT_DESCRIPTION, KEY_FONT){ GParamSpec *pspec = g_param_spec_boxed ("font", ((void*)0),
((void*)0), (pango_font_description_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_FONT,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) "font"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "font", pspec);}
;
1321 TERMINAL_PROFILE_PROPERTY_BOXED (FOREGROUND_COLOR, GDK_TYPE_RGBA, KEY_FOREGROUND_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("foreground-color",
((void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_FOREGROUND_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "foreground-color"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "foreground-color", pspec);}
;
1322
1323 /* 0.0 = normal bg, 1.0 = all black bg, 0.5 = half darkened */
1324 TERMINAL_PROFILE_PROPERTY_DOUBLE (BACKGROUND_DARKNESS, 0.0, 1.0, DEFAULT_BACKGROUND_DARKNESS, KEY_BACKGROUND_DARKNESS){ GParamSpec *pspec = g_param_spec_double ("background-darkness"
, ((void*)0), ((void*)0), 0.0, 1.0, (0.5), G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_DARKNESS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "background-darkness"); g_hash_table_insert (klass
->gsettings_keys, (gpointer) "background-darkness", pspec)
;}
;
1325
1326 TERMINAL_PROFILE_PROPERTY_ENUM (BACKGROUND_TYPE, TERMINAL_TYPE_BACKGROUND_TYPE, DEFAULT_BACKGROUND_TYPE, KEY_BACKGROUND_TYPE){ GParamSpec *pspec = g_param_spec_enum ("background-type", (
(void*)0), ((void*)0), (terminal_background_type_get_type ())
, (TERMINAL_BACKGROUND_SOLID), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BACKGROUND_TYPE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "background-type"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "background-type", pspec
);}
;
1327 TERMINAL_PROFILE_PROPERTY_ENUM (BACKSPACE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_BACKSPACE_BINDING, KEY_BACKSPACE_BINDING){ GParamSpec *pspec = g_param_spec_enum ("backspace-binding",
((void*)0), ((void*)0), (vte_erase_binding_get_type ()), (VTE_ERASE_ASCII_DELETE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_BACKSPACE_BINDING, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) "backspace-binding"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "backspace-binding", pspec
);}
;
1328 TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_BLINK_MODE, VTE_TYPE_CURSOR_BLINK_MODE, DEFAULT_CURSOR_BLINK_MODE, KEY_CURSOR_BLINK_MODE){ GParamSpec *pspec = g_param_spec_enum ("cursor-blink-mode",
((void*)0), ((void*)0), (vte_cursor_blink_mode_get_type ()),
(VTE_CURSOR_BLINK_SYSTEM), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_CURSOR_BLINK_MODE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "cursor-blink-mode")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "cursor-blink-mode"
, pspec);}
;
1329 TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_SHAPE, VTE_TYPE_CURSOR_SHAPE, DEFAULT_CURSOR_SHAPE, KEY_CURSOR_SHAPE){ GParamSpec *pspec = g_param_spec_enum ("cursor-shape", ((void
*)0), ((void*)0), (vte_cursor_shape_get_type ()), (VTE_CURSOR_SHAPE_BLOCK
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_CURSOR_SHAPE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "cursor-shape"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "cursor-shape", pspec);}
;
1330 TERMINAL_PROFILE_PROPERTY_ENUM (DELETE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_DELETE_BINDING, KEY_DELETE_BINDING){ GParamSpec *pspec = g_param_spec_enum ("delete-binding", ((
void*)0), ((void*)0), (vte_erase_binding_get_type ()), (VTE_ERASE_DELETE_SEQUENCE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_DELETE_BINDING, pspec); g_param_spec_set_qdata (pspec,
gsettings_key_quark, (gpointer) "delete-binding"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "delete-binding", pspec
);}
;
1331 TERMINAL_PROFILE_PROPERTY_ENUM (EXIT_ACTION, TERMINAL_TYPE_EXIT_ACTION, DEFAULT_EXIT_ACTION, KEY_EXIT_ACTION){ GParamSpec *pspec = g_param_spec_enum ("exit-action", ((void
*)0), ((void*)0), (terminal_exit_action_get_type ()), (TERMINAL_EXIT_CLOSE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_EXIT_ACTION, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "exit-action"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "exit-action", pspec);}
;
1332 TERMINAL_PROFILE_PROPERTY_ENUM (SCROLLBAR_POSITION, TERMINAL_TYPE_SCROLLBAR_POSITION, DEFAULT_SCROLLBAR_POSITION, KEY_SCROLLBAR_POSITION){ GParamSpec *pspec = g_param_spec_enum ("scrollbar-position"
, ((void*)0), ((void*)0), (terminal_scrollbar_position_get_type
()), (TERMINAL_SCROLLBAR_RIGHT), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLLBAR_POSITION, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scrollbar-position"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scrollbar-position"
, pspec);}
;
1333 TERMINAL_PROFILE_PROPERTY_ENUM (TITLE_MODE, TERMINAL_TYPE_TITLE_MODE, DEFAULT_TITLE_MODE, KEY_TITLE_MODE){ GParamSpec *pspec = g_param_spec_enum ("title-mode", ((void
*)0), ((void*)0), (terminal_title_mode_get_type ()), (TERMINAL_TITLE_REPLACE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_TITLE_MODE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "title-mode"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "title-mode", pspec);}
;
1334
1335 TERMINAL_PROFILE_PROPERTY_INT (DEFAULT_SIZE_COLUMNS, 1, 1024, DEFAULT_DEFAULT_SIZE_COLUMNS, KEY_DEFAULT_SIZE_COLUMNS){ GParamSpec *pspec = g_param_spec_int ("default-size-columns"
, ((void*)0), ((void*)0), 1, 1024, (80), G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_DEFAULT_SIZE_COLUMNS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "default-size-columns"); g_hash_table_insert (klass
->gsettings_keys, (gpointer) "default-size-columns", pspec
);}
;
1336 TERMINAL_PROFILE_PROPERTY_INT (DEFAULT_SIZE_ROWS, 1, 1024, DEFAULT_DEFAULT_SIZE_ROWS, KEY_DEFAULT_SIZE_ROWS){ GParamSpec *pspec = g_param_spec_int ("default-size-rows", (
(void*)0), ((void*)0), 1, 1024, (24), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_DEFAULT_SIZE_ROWS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "default-size-rows")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "default-size-rows"
, pspec);}
;
1337 TERMINAL_PROFILE_PROPERTY_INT (SCROLLBACK_LINES, 1, G_MAXINT, DEFAULT_SCROLLBACK_LINES, KEY_SCROLLBACK_LINES){ GParamSpec *pspec = g_param_spec_int ("scrollback-lines", (
(void*)0), ((void*)0), 1, 2147483647, (512), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_SCROLLBACK_LINES
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "scrollback-lines"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "scrollback-lines", pspec);}
;
1338
1339 TERMINAL_PROFILE_PROPERTY_OBJECT (BACKGROUND_IMAGE, GDK_TYPE_PIXBUF){ GParamSpec *pspec = g_param_spec_object ("background-image"
, ((void*)0), ((void*)0), (gdk_pixbuf_get_type ()), G_PARAM_READABLE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_IMAGE
, pspec);}
;
1340
1341 TERMINAL_PROFILE_PROPERTY_STRING_CO (NAME, DEFAULT_NAME){ GParamSpec *pspec = g_param_spec_string ("name", ((void*)0)
, ((void*)0), (((void*)0)), G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_NAME,
pspec);}
;
1342
1343 TERMINAL_PROFILE_PROPERTY_STRING (BACKGROUND_IMAGE_FILE, DEFAULT_BACKGROUND_IMAGE_FILE, KEY_BACKGROUND_IMAGE_FILE){ GParamSpec *pspec = g_param_spec_string ("background-image-file"
, ((void*)0), ((void*)0), (""), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BACKGROUND_IMAGE_FILE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "background-image");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "background-image"
, pspec);}
;
1344 TERMINAL_PROFILE_PROPERTY_STRING (CUSTOM_COMMAND, DEFAULT_CUSTOM_COMMAND, KEY_CUSTOM_COMMAND){ GParamSpec *pspec = g_param_spec_string ("custom-command", (
(void*)0), ((void*)0), (""), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_CUSTOM_COMMAND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "custom-command"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "custom-command", pspec
);}
;
1345 TERMINAL_PROFILE_PROPERTY_STRING (TITLE, _(DEFAULT_TITLE), KEY_TITLE){ GParamSpec *pspec = g_param_spec_string ("title", ((void*)0
), ((void*)0), gettext ((("Terminal"))), G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_TITLE
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "title"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "title", pspec);}
;
1346 TERMINAL_PROFILE_PROPERTY_STRING (VISIBLE_NAME, _(DEFAULT_VISIBLE_NAME), KEY_VISIBLE_NAME){ GParamSpec *pspec = g_param_spec_string ("visible-name", ((
void*)0), ((void*)0), gettext ((("Unnamed"))), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_VISIBLE_NAME
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "visible-name"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "visible-name", pspec);}
;
1347 TERMINAL_PROFILE_PROPERTY_STRING (WORD_CHARS, DEFAULT_WORD_CHARS, KEY_WORD_CHARS){ GParamSpec *pspec = g_param_spec_string ("word-chars", ((void
*)0), ((void*)0), ("-A-Za-z0-9,./?%&#:_=+@~"), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_WORD_CHARS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "word-chars"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "word-chars", pspec);}
;
1348
1349 TERMINAL_PROFILE_PROPERTY_VALUE_ARRAY_BOXED (PALETTE, "palette-color", GDK_TYPE_RGBA, KEY_PALETTE){ GParamSpec *pspec = g_param_spec_value_array ("palette", ((
void*)0), ((void*)0), g_param_spec_boxed ("palette-color", ((
void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_PALETTE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "palette"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "palette", pspec);}
;
1350}
1351
1352/* Semi-Public API */
1353
1354TerminalProfile*
1355_terminal_profile_new (const char *name)
1356{
1357 return g_object_new (TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()),
1358 "name", name,
1359 NULL((void*)0));
1360}
1361
1362void
1363_terminal_profile_forget (TerminalProfile *profile)
1364{
1365 TerminalProfilePrivate *priv = profile->priv;
1366
1367 if (!priv->forgotten)
1368 {
1369 priv->forgotten = TRUE(!(0));
1370
1371 g_signal_emit (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, signals[FORGOTTEN], 0);
1372 }
1373}
1374
1375gboolean
1376_terminal_profile_get_forgotten (TerminalProfile *profile)
1377{
1378 return profile->priv->forgotten;
1379}
1380
1381TerminalProfile *
1382_terminal_profile_clone (TerminalProfile *base_profile,
1383 const char *visible_name)
1384{
1385 TerminalApp *app = terminal_app_get ();
1386 GObject *base_object = G_OBJECT (base_profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((base_profile)), (((GType) ((20) << (2))))))))
;
1387 TerminalProfilePrivate *new_priv;
1388 char profile_name[32];
1389 GParameter *params;
1390 GParamSpec **pspecs;
1391 guint n_pspecs, i, n_params, profile_num;
1392 TerminalProfile *new_profile;
1393
1394 g_object_ref (base_profile)((__typeof__ (base_profile)) (g_object_ref) (base_profile));
1395
1396 profile_num = 0;
1397 do
1398 {
1399 g_snprintf (profile_name, sizeof (profile_name), "profile%u", profile_num++);
1400 }
1401 while (terminal_app_get_profile_by_name (app, profile_name) != NULL((void*)0));
1402
1403 /* Now we have an unused profile name */
1404 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (base_profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((base_profile
)))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
1405
1406 params = g_newa (GParameter, n_pspecs)((GParameter*) __builtin_alloca (sizeof (GParameter) * (gsize
) (n_pspecs)))
;
1407 n_params = 0;
1408
1409 for (i = 0; i < n_pspecs; ++i)
1410 {
1411 GParamSpec *pspec = pspecs[i];
1412 GValue *value;
1413
1414 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) ||
1415 (pspec->flags & G_PARAM_WRITABLE) == 0)
1416 continue;
1417
1418 params[n_params].name = pspec->name;
1419
1420 value = &params[n_params].value;
1421 G_VALUE_TYPE (value)(((GValue*) (value))->g_type) = 0;
1422 g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
1423
1424 if (pspec->name == I_(TERMINAL_PROFILE_NAME)g_intern_static_string ("name"))
1425 g_value_set_static_string (value, profile_name);
1426 else if (pspec->name == I_(TERMINAL_PROFILE_VISIBLE_NAME)g_intern_static_string ("visible-name"))
1427 g_value_set_static_string (value, visible_name);
1428 else
1429 g_object_get_property (base_object, pspec->name, value);
1430
1431 ++n_params;
1432 }
1433
1434 new_profile = g_object_newv (TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()), n_params, params);
1435
1436 g_object_unref (base_profile);
1437
1438 for (i = 0; i < n_params; ++i)
1439 g_value_unset (&params[i].value);
1440
1441 /* Flush the new profile to GSettings */
1442 new_priv = new_profile->priv;
1443
1444 g_slist_free (new_priv->dirty_pspecs);
1445 new_priv->dirty_pspecs = NULL((void*)0);
1446 if (new_priv->save_idle_id != 0)
1447 {
1448 g_source_remove (new_priv->save_idle_id);
1449 new_priv->save_idle_id = 0;
1450 }
1451
1452 for (i = 0; i < n_pspecs; ++i)
1453 {
1454 GParamSpec *pspec = pspecs[i];
1455
1456 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) ||
1457 (pspec->flags & G_PARAM_WRITABLE) == 0)
1458 continue;
1459
1460 new_priv->dirty_pspecs = g_slist_prepend (new_priv->dirty_pspecs, pspec);
1461 }
1462 g_free (pspecs);
1463
1464 terminal_profile_save (new_profile);
1465
1466 return new_profile;
1467}
1468
1469/* Public API */
1470
1471gboolean
1472terminal_profile_get_property_boolean (TerminalProfile *profile,
1473 const char *prop_name)
1474{
1475 const GValue *value;
1476
1477 value = get_prop_value_from_prop_name (profile, prop_name);
1478 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_BOOLEAN (value), FALSE)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((5) << (2)))); gboolean __r; if (!__val) __r = (0); else
if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_BOOLEAN (value)"
); return ((0)); } } while (0)
;
1479 if (!value || !G_VALUE_HOLDS_BOOLEAN (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((5) << (2)))); gboolean __r;
if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1480 return FALSE(0);
1481
1482 return g_value_get_boolean (value);
1483}
1484
1485gconstpointer
1486terminal_profile_get_property_boxed (TerminalProfile *profile,
1487 const char *prop_name)
1488{
1489 const GValue *value;
1490
1491 value = get_prop_value_from_prop_name (profile, prop_name);
1492 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_BOXED (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((18) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_BOXED (value)"
); return (((void*)0)); } } while (0)
;
1493 if (!value || !G_VALUE_HOLDS_BOXED (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((18) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1494 return NULL((void*)0);
1495
1496 return g_value_get_boxed (value);
1497}
1498
1499double
1500terminal_profile_get_property_double (TerminalProfile *profile,
1501 const char *prop_name)
1502{
1503 const GValue *value;
1504
1505 value = get_prop_value_from_prop_name (profile, prop_name);
1506 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_DOUBLE (value), 0.0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((15) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_DOUBLE (value)"
); return (0.0); } } while (0)
;
1507 if (!value || !G_VALUE_HOLDS_DOUBLE (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((15) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1508 return 0.0;
1509
1510 return g_value_get_double (value);
1511}
1512
1513int
1514terminal_profile_get_property_enum (TerminalProfile *profile,
1515 const char *prop_name)
1516{
1517 const GValue *value;
1518
1519 value = get_prop_value_from_prop_name (profile, prop_name);
1520 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_ENUM (value), 0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((12) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_ENUM (value)"
); return (0); } } while (0)
;
1521 if (!value || !G_VALUE_HOLDS_ENUM (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((12) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1522 return 0;
1523
1524 return g_value_get_enum (value);
1525}
1526
1527int
1528terminal_profile_get_property_int (TerminalProfile *profile,
1529 const char *prop_name)
1530{
1531 const GValue *value;
1532
1533 value = get_prop_value_from_prop_name (profile, prop_name);
1534 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_INT (value), 0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((6) << (2)))); gboolean __r; if (!__val) __r = (0); else
if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_INT (value)"
); return (0); } } while (0)
;
1535 if (!value || !G_VALUE_HOLDS_INT (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((6) << (2)))); gboolean __r;
if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1536 return 0;
1537
1538 return g_value_get_int (value);
1539}
1540
1541gpointer
1542terminal_profile_get_property_object (TerminalProfile *profile,
1543 const char *prop_name)
1544{
1545 const GValue *value;
1546
1547 value = get_prop_value_from_prop_name (profile, prop_name);
1548 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_OBJECT (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((20) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_OBJECT (value)"
); return (((void*)0)); } } while (0)
;
1549 if (!value || !G_VALUE_HOLDS_OBJECT (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((20) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1550 return NULL((void*)0);
1551
1552 return g_value_get_object (value);
1553}
1554
1555const char*
1556terminal_profile_get_property_string (TerminalProfile *profile,
1557 const char *prop_name)
1558{
1559 const GValue *value;
1560
1561 value = get_prop_value_from_prop_name (profile, prop_name);
1562 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_STRING (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((16) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_STRING (value)"
); return (((void*)0)); } } while (0)
;
1563 if (!value || !G_VALUE_HOLDS_STRING (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((16) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1564 return NULL((void*)0);
1565
1566 return g_value_get_string (value);
1567}
1568
1569gboolean
1570terminal_profile_property_locked (TerminalProfile *profile,
1571 const char *prop_name)
1572{
1573 TerminalProfilePrivate *priv = profile->priv;
1574 GParamSpec *pspec;
1575
1576 pspec = get_pspec_from_name (profile, prop_name);
1577 g_return_val_if_fail (pspec != NULL, FALSE)do { if ((pspec != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "pspec != NULL");
return ((0)); } } while (0)
;
1578 if (!pspec)
1579 return FALSE(0);
1580
1581 return priv->locked[pspec->param_id];
1582}
1583
1584void
1585terminal_profile_reset_property (TerminalProfile *profile,
1586 const char *prop_name)
1587{
1588 GParamSpec *pspec;
1589
1590 pspec = get_pspec_from_name (profile, prop_name);
1591 g_return_if_fail (pspec != NULL)do { if ((pspec != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "pspec != NULL");
return; } } while (0)
;
1592 if (!pspec ||
1593 (pspec->flags & G_PARAM_WRITABLE) == 0)
1594 return;
1595
1596 terminal_profile_reset_property_internal (profile, pspec, TRUE(!(0)));
1597}
1598
1599gboolean
1600terminal_profile_get_palette (TerminalProfile *profile,
1601 GdkRGBA *colors,
1602 guint *n_colors)
1603{
1604 TerminalProfilePrivate *priv;
1605 GValueArray *array;
1606 guint i, n;
1607
1608 g_return_val_if_fail (TERMINAL_IS_PROFILE (profile), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((profile)); GType __t = ((terminal_profile_get_type ()));
gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class
&& __inst->g_class->g_type == __t) __r = (!(0)
); else __r = g_type_check_instance_is_a (__inst, __t); __r; }
)))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "TERMINAL_IS_PROFILE (profile)"); return
((0)); } } while (0)
;
1609 g_return_val_if_fail (colors != NULL && n_colors != NULL, FALSE)do { if ((colors != ((void*)0) && n_colors != ((void*
)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "colors != NULL && n_colors != NULL"
); return ((0)); } } while (0)
;
1610
1611 priv = profile->priv;
1612 array = g_value_get_boxed (g_value_array_get_nth (priv->properties, PROP_PALETTE));
1613 if (!array)
1614 return FALSE(0);
1615
1616 n = MIN (array->n_values, *n_colors)(((array->n_values) < (*n_colors)) ? (array->n_values
) : (*n_colors))
;
1617 for (i = 0; i < n; ++i)
1618 {
1619 GdkRGBA *color = g_value_get_boxed (g_value_array_get_nth (array, i));
1620 if (!color)
1621 continue; /* shouldn't happen!! */
1622
1623 colors[i] = *color;
1624 }
1625
1626 *n_colors = n;
1627 return TRUE(!(0));
1628}
1629
1630gboolean
1631terminal_profile_get_palette_is_builtin (TerminalProfile *profile,
1632 guint *n)
1633{
1634 GdkRGBA colors[TERMINAL_PALETTE_SIZE16];
1635 guint n_colors;
1636 guint i;
1637
1638 n_colors = G_N_ELEMENTS (colors)(sizeof (colors) / sizeof ((colors)[0]));
1639 if (!terminal_profile_get_palette (profile, colors, &n_colors) ||
1640 n_colors != TERMINAL_PALETTE_SIZE16)
1641 return FALSE(0);
1642
1643 for (i = 0; i < TERMINAL_PALETTE_N_BUILTINS5; ++i)
1644 if (palette_cmp (colors, terminal_palettes[i]))
1645 {
1646 *n = i;
1647 return TRUE(!(0));
1648 }
1649
1650 return FALSE(0);
1651}
1652
1653void
1654terminal_profile_set_palette_builtin (TerminalProfile *profile,
1655 guint n)
1656{
1657 GValue value = { 0, };
1658
1659 g_return_if_fail (n < TERMINAL_PALETTE_N_BUILTINS)do { if ((n < 5)) { } else { g_return_if_fail_warning (((gchar
*) 0), ((const char*) (__func__)), "n < TERMINAL_PALETTE_N_BUILTINS"
); return; } } while (0)
;
1660
1661 g_value_init (&value, G_TYPE_VALUE_ARRAY(g_value_array_get_type ()) GCC warning "Deprecated pre-processor symbol: replace with \"(g_array_get_type ())\""
+
);
1662 set_value_from_palette (&value, terminal_palettes[n], TERMINAL_PALETTE_SIZE16);
1663 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, TERMINAL_PROFILE_PALETTE"palette", &value);
1664 g_value_unset (&value);
1665}
1666
1667gboolean
1668terminal_profile_modify_palette_entry (TerminalProfile *profile,
1669 guint i,
1670 const GdkRGBA *color)
1671{
1672 TerminalProfilePrivate *priv = profile->priv;
1673 GValueArray *array;
1674 GValue *value;
1675 GdkRGBA *old_color;
1676
1677 array = g_value_get_boxed (g_value_array_get_nth (priv->properties, PROP_PALETTE));
1678 if (!array ||
1679 i >= array->n_values)
1680 return FALSE(0);
1681
1682 value = g_value_array_get_nth (array, i);
1683 old_color = g_value_get_boxed (value);
1684 if (!old_color ||
1685 !rgba_equal (old_color, color))
1686 {
1687 g_value_set_boxed (value, color);
1688 g_object_notify (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, TERMINAL_PROFILE_PALETTE"palette");
1689 }
1690
1691 return TRUE(!(0));
1692}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-792baf.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-792baf.html new file mode 100644 index 0000000..1bdda9b --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-792baf.html @@ -0,0 +1,2385 @@ + + + +terminal-profile.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:terminal-profile.c
Warning:line 641, column 46
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name terminal-profile.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I .. -I ../src/mate-submodules/libegg -D TERMINAL_COMPILATION -D TERMINAL_RESOURCES_PATH_PREFIX="/org/mate/terminal" -D TERM_DATADIR="/usr/local/share" -D TERM_LOCALEDIR="/usr/local/share/locale" -D TERM_PKGDATADIR="/usr/local/share/mate-terminal" -D TERM_HELPDIR="/usr/local/share/help" -D SN_API_NOT_YET_FROZEN -D GDK_MULTIHEAD_SAFE -D G_DISABLE_SINGLE_INCLUDES -D PANGO_DISABLE_SINGLE_INCLUDES -D ATK_DISABLE_SINGLE_INCLUDES -D GDK_DISABLE_SINGLE_INCLUDES -D GDK_PIXBUF_DISABLE_SINGLE_INCLUDES -D GTK_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c terminal-profile.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright © 2001 Havoc Pennington
3 * Copyright © 2002 Mathias Hasselmann
4 * Copyright © 2008 Christian Persch
5 * Copyright (C) 2012-2021 MATE Developers
6 *
7 * Mate-terminal is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * Mate-terminal is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <config.h>
22
23#include <string.h>
24#include <stdlib.h>
25
26#include <gtk/gtk.h>
27
28#include "terminal-app.h"
29#include "terminal-debug.h"
30#include "terminal-intl.h"
31#include "terminal-profile.h"
32#include "terminal-screen.h"
33#include "terminal-type-builtins.h"
34
35/* To add a new key, you need to:
36 *
37 * - add an entry to the enum below
38 * - add a #define with its name in terminal-profile.h
39 * - add a gobject property for it in terminal_profile_class_init
40 * - if the property's type needs special casing, add that to
41 * terminal_profile_gsettings_notify_cb and
42 * terminal_profile_gsettings_changeset_add
43 * - if necessary the default value cannot be handled via the paramspec,
44 * handle that in terminal_profile_reset_property_internal
45 */
46enum
47{
48 PROP_0,
49 PROP_ALLOW_BOLD,
50 PROP_BACKGROUND_COLOR,
51 PROP_BACKGROUND_DARKNESS,
52 PROP_BACKGROUND_IMAGE,
53 PROP_BACKGROUND_IMAGE_FILE,
54 PROP_BACKGROUND_TYPE,
55 PROP_BACKSPACE_BINDING,
56 PROP_BOLD_COLOR,
57 PROP_BOLD_COLOR_SAME_AS_FG,
58 PROP_CURSOR_BLINK_MODE,
59 PROP_CURSOR_SHAPE,
60 PROP_CUSTOM_COMMAND,
61 PROP_DEFAULT_SIZE_COLUMNS,
62 PROP_DEFAULT_SIZE_ROWS,
63 PROP_DEFAULT_SHOW_MENUBAR,
64 PROP_DELETE_BINDING,
65 PROP_EXIT_ACTION,
66 PROP_FONT,
67 PROP_FOREGROUND_COLOR,
68 PROP_LOGIN_SHELL,
69 PROP_NAME,
70 PROP_PALETTE,
71 PROP_SCROLL_BACKGROUND,
72 PROP_SCROLLBACK_LINES,
73 PROP_SCROLLBACK_UNLIMITED,
74 PROP_SCROLLBAR_POSITION,
75 PROP_SCROLL_ON_KEYSTROKE,
76 PROP_SCROLL_ON_OUTPUT,
77 PROP_SILENT_BELL,
78 PROP_TITLE,
79 PROP_TITLE_MODE,
80 PROP_USE_CUSTOM_COMMAND,
81 PROP_USE_CUSTOM_DEFAULT_SIZE,
82 PROP_USE_SKEY,
83 PROP_USE_URLS,
84 PROP_USE_SYSTEM_FONT,
85 PROP_USE_THEME_COLORS,
86 PROP_VISIBLE_NAME,
87 PROP_WORD_CHARS,
88 PROP_COPY_SELECTION,
89 LAST_PROP
90};
91
92#define KEY_ALLOW_BOLD"allow-bold" "allow-bold"
93#define KEY_BACKGROUND_COLOR"background-color" "background-color"
94#define KEY_BACKGROUND_DARKNESS"background-darkness" "background-darkness"
95#define KEY_BACKGROUND_IMAGE_FILE"background-image" "background-image"
96#define KEY_BACKGROUND_TYPE"background-type" "background-type"
97#define KEY_BACKSPACE_BINDING"backspace-binding" "backspace-binding"
98#define KEY_BOLD_COLOR"bold-color" "bold-color"
99#define KEY_BOLD_COLOR_SAME_AS_FG"bold-color-same-as-fg" "bold-color-same-as-fg"
100#define KEY_CURSOR_BLINK_MODE"cursor-blink-mode" "cursor-blink-mode"
101#define KEY_CURSOR_SHAPE"cursor-shape" "cursor-shape"
102#define KEY_CUSTOM_COMMAND"custom-command" "custom-command"
103#define KEY_DEFAULT_SHOW_MENUBAR"default-show-menubar" "default-show-menubar"
104#define KEY_DEFAULT_SIZE_COLUMNS"default-size-columns" "default-size-columns"
105#define KEY_DEFAULT_SIZE_ROWS"default-size-rows" "default-size-rows"
106#define KEY_DELETE_BINDING"delete-binding" "delete-binding"
107#define KEY_EXIT_ACTION"exit-action" "exit-action"
108#define KEY_FONT"font" "font"
109#define KEY_FOREGROUND_COLOR"foreground-color" "foreground-color"
110#define KEY_LOGIN_SHELL"login-shell" "login-shell"
111#define KEY_PALETTE"palette" "palette"
112#define KEY_SCROLL_BACKGROUND"scroll-background" "scroll-background"
113#define KEY_SCROLLBACK_LINES"scrollback-lines" "scrollback-lines"
114#define KEY_SCROLLBACK_UNLIMITED"scrollback-unlimited" "scrollback-unlimited"
115#define KEY_SCROLLBAR_POSITION"scrollbar-position" "scrollbar-position"
116#define KEY_SCROLL_ON_KEYSTROKE"scroll-on-keystroke" "scroll-on-keystroke"
117#define KEY_SCROLL_ON_OUTPUT"scroll-on-output" "scroll-on-output"
118#define KEY_SILENT_BELL"silent-bell" "silent-bell"
119#define KEY_COPY_SELECTION"copy-selection" "copy-selection"
120#define KEY_TITLE_MODE"title-mode" "title-mode"
121#define KEY_TITLE"title" "title"
122#define KEY_USE_CUSTOM_COMMAND"use-custom-command" "use-custom-command"
123#define KEY_USE_CUSTOM_DEFAULT_SIZE"use-custom-default-size" "use-custom-default-size"
124#define KEY_USE_SKEY"use-skey" "use-skey"
125#define KEY_USE_URLS"use-urls" "use-urls"
126#define KEY_USE_SYSTEM_FONT"use-system-font" "use-system-font"
127#define KEY_USE_THEME_COLORS"use-theme-colors" "use-theme-colors"
128#define KEY_VISIBLE_NAME"visible-name" "visible-name"
129#define KEY_WORD_CHARS"word-chars" "word-chars"
130
131/* Keep these in sync with the GSettings schema! */
132#define DEFAULT_ALLOW_BOLD((!(0))) (TRUE(!(0)))
133#define DEFAULT_BACKGROUND_COLOR("#FFFFDD") ("#FFFFDD")
134#define DEFAULT_BOLD_COLOR_SAME_AS_FG((!(0))) (TRUE(!(0)))
135#define DEFAULT_BACKGROUND_DARKNESS(0.5) (0.5)
136#define DEFAULT_BACKGROUND_IMAGE_FILE("") ("")
137#define DEFAULT_BACKGROUND_TYPE(TERMINAL_BACKGROUND_SOLID) (TERMINAL_BACKGROUND_SOLID)
138#define DEFAULT_BACKSPACE_BINDING(VTE_ERASE_ASCII_DELETE) (VTE_ERASE_ASCII_DELETE)
139#define DEFAULT_CURSOR_BLINK_MODE(VTE_CURSOR_BLINK_SYSTEM) (VTE_CURSOR_BLINK_SYSTEM)
140#define DEFAULT_CURSOR_SHAPE(VTE_CURSOR_SHAPE_BLOCK) (VTE_CURSOR_SHAPE_BLOCK)
141#define DEFAULT_CUSTOM_COMMAND("") ("")
142#define DEFAULT_DEFAULT_SHOW_MENUBAR((!(0))) (TRUE(!(0)))
143#define DEFAULT_DEFAULT_SIZE_COLUMNS(80) (80)
144#define DEFAULT_DEFAULT_SIZE_ROWS(24) (24)
145#define DEFAULT_DELETE_BINDING(VTE_ERASE_DELETE_SEQUENCE) (VTE_ERASE_DELETE_SEQUENCE)
146#define DEFAULT_EXIT_ACTION(TERMINAL_EXIT_CLOSE) (TERMINAL_EXIT_CLOSE)
147#define DEFAULT_FONT("Monospace 12") ("Monospace 12")
148#define DEFAULT_FOREGROUND_COLOR("#000000") ("#000000")
149#define DEFAULT_LOGIN_SHELL((0)) (FALSE(0))
150#define DEFAULT_NAME(((void*)0)) (NULL((void*)0))
151#define DEFAULT_PALETTE(terminal_palettes[0]) (terminal_palettes[TERMINAL_PALETTE_TANGO0])
152#define DEFAULT_SCROLL_BACKGROUND((!(0))) (TRUE(!(0)))
153#define DEFAULT_SCROLLBACK_LINES(512) (512)
154#define DEFAULT_SCROLLBACK_UNLIMITED((0)) (FALSE(0))
155#define DEFAULT_SCROLLBAR_POSITION(TERMINAL_SCROLLBAR_RIGHT) (TERMINAL_SCROLLBAR_RIGHT)
156#define DEFAULT_SCROLL_ON_KEYSTROKE((!(0))) (TRUE(!(0)))
157#define DEFAULT_SCROLL_ON_OUTPUT((0)) (FALSE(0))
158#define DEFAULT_SILENT_BELL((0)) (FALSE(0))
159#define DEFAULT_COPY_SELECTION((0)) (FALSE(0))
160#define DEFAULT_TITLE_MODE(TERMINAL_TITLE_REPLACE) (TERMINAL_TITLE_REPLACE)
161#define DEFAULT_TITLE(("Terminal")) (N_("Terminal")("Terminal"))
162#define DEFAULT_USE_CUSTOM_COMMAND((0)) (FALSE(0))
163#define DEFAULT_USE_CUSTOM_DEFAULT_SIZE((0)) (FALSE(0))
164#define DEFAULT_USE_SKEY((!(0))) (TRUE(!(0)))
165#define DEFAULT_USE_URLS((!(0))) (TRUE(!(0)))
166#define DEFAULT_USE_SYSTEM_FONT((!(0))) (TRUE(!(0)))
167#define DEFAULT_USE_THEME_COLORS((!(0))) (TRUE(!(0)))
168#define DEFAULT_VISIBLE_NAME(("Unnamed")) (N_("Unnamed")("Unnamed"))
169#define DEFAULT_WORD_CHARS("-A-Za-z0-9,./?%&#:_=+@~") ("-A-Za-z0-9,./?%&#:_=+@~")
170
171struct _TerminalProfilePrivate
172{
173 GValueArray *properties;
174 gboolean *locked;
175
176 GSettings *settings;
177 char *profile_dir;
178
179 GSList *dirty_pspecs;
180 guint save_idle_id;
181
182 GParamSpec *gsettings_notification_pspec;
183
184 gboolean background_load_failed;
185
186 guint forgotten : 1;
187};
188
189static const GdkRGBA terminal_palettes[TERMINAL_PALETTE_N_BUILTINS5][TERMINAL_PALETTE_SIZE16] =
190{
191 /* Tango palette */
192 {
193 { 0, 0, 0, 1 },
194 { 0.8, 0, 0, 1 },
195 { 0.305882, 0.603922, 0.0235294, 1 },
196 { 0.768627, 0.627451, 0, 1 },
197 { 0.203922, 0.396078, 0.643137, 1 },
198 { 0.458824, 0.313725, 0.482353, 1 },
199 { 0.0235294, 0.596078, 0.603922, 1 },
200 { 0.827451, 0.843137, 0.811765, 1 },
201 { 0.333333, 0.341176, 0.32549, 1 },
202 { 0.937255, 0.160784, 0.160784, 1 },
203 { 0.541176, 0.886275, 0.203922, 1 },
204 { 0.988235, 0.913725, 0.309804, 1 },
205 { 0.447059, 0.623529, 0.811765, 1 },
206 { 0.678431, 0.498039, 0.658824, 1 },
207 { 0.203922, 0.886275, 0.886275, 1 },
208 { 0.933333, 0.933333, 0.92549, 1 },
209 },
210
211 /* Linux palette */
212 {
213 { 0, 0, 0, 1 },
214 { 0.666667, 0, 0, 1 },
215 { 0, 0.666667, 0, 1 },
216 { 0.666667, 0.333333, 0, 1 },
217 { 0, 0, 0.666667, 1 },
218 { 0.666667, 0, 0.666667, 1 },
219 { 0, 0.666667, 0.666667, 1 },
220 { 0.666667, 0.666667, 0.666667, 1 },
221 { 0.333333, 0.333333, 0.333333, 1 },
222 { 1, 0.333333, 0.333333, 1 },
223 { 0.333333, 1, 0.333333, 1 },
224 { 1, 1, 0.333333, 1 },
225 { 0.333333, 0.333333, 1, 1 },
226 { 1, 0.333333, 1, 1 },
227 { 0.333333, 1, 1, 1 },
228 { 1, 1, 1, 1 },
229 },
230
231 /* XTerm palette */
232 {
233 { 0, 0, 0, 1 },
234 { 0.803922, 0, 0, 1 },
235 { 0, 0.803922, 0, 1 },
236 { 0.803922, 0.803922, 0, 1 },
237 { 0.117647, 0.564706, 1, 1 },
238 { 0.803922, 0, 0.803922, 1 },
239 { 0, 0.803922, 0.803922, 1 },
240 { 0.898039, 0.898039, 0.898039, 1 },
241 { 0.298039, 0.298039, 0.298039, 1 },
242 { 1, 0, 0, 1 },
243 { 0, 1, 0, 1 },
244 { 1, 1, 0, 1 },
245 { 0.27451, 0.509804, 0.705882, 1 },
246 { 1, 0, 1, 1 },
247 { 0, 1, 1, 1 },
248 { 1, 1, 1, 1 },
249 },
250
251 /* RXVT palette */
252 {
253 { 0, 0, 0, 1 },
254 { 0.803922, 0, 0, 1 },
255 { 0, 0.803922, 0, 1 },
256 { 0.803922, 0.803922, 0, 1 },
257 { 0, 0, 0.803922, 1 },
258 { 0.803922, 0, 0.803922, 1 },
259 { 0, 0.803922, 0.803922, 1 },
260 { 0.980392, 0.921569, 0.843137, 1 },
261 { 0.25098, 0.25098, 0.25098, 1 },
262 { 1, 0, 0, 1 },
263 { 0, 1, 0, 1 },
264 { 1, 1, 0, 1 },
265 { 0, 0, 1, 1 },
266 { 1, 0, 1, 1 },
267 { 0, 1, 1, 1 },
268 { 1, 1, 1, 1 },
269 },
270
271 /* Solarized palette (1.0.0beta2): http://ethanschoonover.com/solarized */
272 {
273 { 0.02745, 0.211764, 0.258823, 1 },
274 { 0.862745, 0.196078, 0.184313, 1 },
275 { 0.521568, 0.6, 0, 1 },
276 { 0.709803, 0.537254, 0, 1 },
277 { 0.149019, 0.545098, 0.823529, 1 },
278 { 0.82745, 0.211764, 0.509803, 1 },
279 { 0.164705, 0.631372, 0.596078, 1 },
280 { 0.933333, 0.909803, 0.835294, 1 },
281 { 0, 0.168627, 0.211764, 1 },
282 { 0.796078, 0.294117, 0.086274, 1 },
283 { 0.345098, 0.431372, 0.458823, 1 },
284 { 0.396078, 0.482352, 0.513725, 1 },
285 { 0.513725, 0.580392, 0.588235, 1 },
286 { 0.423529, 0.443137, 0.768627, 1 },
287 { 0.57647, 0.631372, 0.631372, 1 },
288 { 0.992156, 0.964705, 0.890196, 1 },
289 },
290};
291
292enum
293{
294 FORGOTTEN,
295 LAST_SIGNAL
296};
297
298static void terminal_profile_finalize (GObject *object);
299static void terminal_profile_set_property (GObject *object,
300 guint prop_id,
301 const GValue *value,
302 GParamSpec *pspec);
303static void ensure_pixbuf_property (TerminalProfile *profile,
304 guint path_prop_id,
305 guint pixbuf_prop_id,
306 gboolean *load_failed);
307
308static guint signals[LAST_SIGNAL] = { 0 };
309static GQuark gsettings_key_quark;
310
311G_DEFINE_TYPE_WITH_PRIVATE (TerminalProfile, terminal_profile, G_TYPE_OBJECT)static void terminal_profile_init (TerminalProfile *self); static
void terminal_profile_class_init (TerminalProfileClass *klass
); static GType terminal_profile_get_type_once (void); static
gpointer terminal_profile_parent_class = ((void*)0); static gint
TerminalProfile_private_offset; static void terminal_profile_class_intern_init
(gpointer klass) { terminal_profile_parent_class = g_type_class_peek_parent
(klass); if (TerminalProfile_private_offset != 0) g_type_class_adjust_private_offset
(klass, &TerminalProfile_private_offset); terminal_profile_class_init
((TerminalProfileClass*) klass); } __attribute__ ((__unused__
)) static inline gpointer terminal_profile_get_instance_private
(TerminalProfile *self) { return (((gpointer) ((guint8*) (self
) + (glong) (TerminalProfile_private_offset)))); } GType terminal_profile_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ _Static_assert (sizeof *(&static_g_define_type_id) ==
sizeof (gpointer), "Expression evaluates to false"); (void) (
0 ? (gpointer) *(&static_g_define_type_id) : ((void*)0));
(!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = terminal_profile_get_type_once
(); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } __attribute__ ((__noinline__)) static GType terminal_profile_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
(((GType) ((20) << (2))), g_intern_static_string ("TerminalProfile"
), sizeof (TerminalProfileClass), (GClassInitFunc)(void (*)(void
)) terminal_profile_class_intern_init, sizeof (TerminalProfile
), (GInstanceInitFunc)(void (*)(void)) terminal_profile_init,
(GTypeFlags) 0); { {{ TerminalProfile_private_offset = g_type_add_instance_private
(g_define_type_id, sizeof (TerminalProfilePrivate)); };} } return
g_define_type_id; }
;
312
313/* gdk_rgba_equal is too strict! */
314static gboolean
315rgba_equal (const GdkRGBA *a,
316 const GdkRGBA *b)
317{
318 gdouble dr, dg, db, da;
319
320 dr = a->red - b->red;
321 dg = a->green - b->green;
322 db = a->blue - b->blue;
323 da = a->alpha - b->alpha;
324
325 return (dr * dr + dg * dg + db * db + da * da) < 1e-4;
326}
327
328static gboolean
329palette_cmp (const GdkRGBA *ca,
330 const GdkRGBA *cb)
331{
332 guint i;
333
334 for (i = 0; i < TERMINAL_PALETTE_SIZE16; ++i)
335 if (!rgba_equal (&ca[i], &cb[i]))
336 return FALSE(0);
337
338 return TRUE(!(0));
339}
340
341static GParamSpec *
342get_pspec_from_name (TerminalProfile *profile,
343 const char *prop_name)
344{
345 TerminalProfileClass *klass = TERMINAL_PROFILE_GET_CLASS (profile)((((TerminalProfileClass*) (((GTypeInstance*) ((profile)))->
g_class))))
;
346 GParamSpec *pspec;
347
348 pspec = g_object_class_find_property (G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
, prop_name);
349 if (pspec &&
350 pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
351 pspec = NULL((void*)0);
352
353 return pspec;
354}
355
356static const GValue *
357get_prop_value_from_prop_name (TerminalProfile *profile,
358 const char *prop_name)
359{
360 TerminalProfilePrivate *priv = profile->priv;
361 GParamSpec *pspec;
362
363 pspec = get_pspec_from_name (profile, prop_name);
364 if (!pspec)
365 return NULL((void*)0);
366
367 if (G_UNLIKELY (pspec->param_id == PROP_BACKGROUND_IMAGE)(pspec->param_id == PROP_BACKGROUND_IMAGE))
368 ensure_pixbuf_property (profile, PROP_BACKGROUND_IMAGE_FILE, PROP_BACKGROUND_IMAGE, &priv->background_load_failed);
369
370 return g_value_array_get_nth (priv->properties, pspec->param_id);
371}
372
373static void
374set_value_from_palette (GValue *ret_value,
375 const GdkRGBA *colors,
376 guint n_colors)
377{
378 GValueArray *array;
379 guint i, max_n_colors;
380
381 max_n_colors = MAX (n_colors, TERMINAL_PALETTE_SIZE)(((n_colors) > (16)) ? (n_colors) : (16));
382 array = g_value_array_new (max_n_colors);
383 for (i = 0; i < max_n_colors; ++i)
384 g_value_array_append (array, NULL((void*)0));
385
386 for (i = 0; i < n_colors; ++i)
387 {
388 GValue *value = g_value_array_get_nth (array, i);
389
390 g_value_init (value, GDK_TYPE_RGBA(gdk_rgba_get_type ()));
391 g_value_set_boxed (value, &colors[i]);
392 }
393
394 /* If we haven't enough colours yet, fill up with the default palette */
395 for (i = n_colors; i < TERMINAL_PALETTE_SIZE16; ++i)
396 {
397 GValue *value = g_value_array_get_nth (array, i);
398
399 g_value_init (value, GDK_TYPE_RGBA(gdk_rgba_get_type ()));
400 g_value_set_boxed (value, &DEFAULT_PALETTE(terminal_palettes[0])[i]);
401 }
402
403 g_value_take_boxed (ret_value, array);
404}
405
406static int
407values_equal (GParamSpec *pspec,
408 const GValue *va,
409 const GValue *vb)
410{
411 /* g_param_values_cmp isn't good enough for some types, since e.g.
412 * it compares colours and font descriptions by pointer value, not
413 * with the correct compare functions. Providing extra
414 * PangoParamSpecFontDescription and GdkParamSpecColor wouldn't
415 * have fixed this either, since it's unclear how to _order_ them.
416 * Luckily we only need to check them for equality here.
417 */
418
419 if (g_param_values_cmp (pspec, va, vb) == 0)
420 return TRUE(!(0));
421
422 if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
423 return rgba_equal (g_value_get_boxed (va), g_value_get_boxed (vb));
424
425 if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
426 return pango_font_description_equal (g_value_get_boxed (va), g_value_get_boxed (vb));
427
428 if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
429 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
430 {
431 GValueArray *ara, *arb;
432 guint i;
433
434 ara = g_value_get_boxed (va);
435 arb = g_value_get_boxed (vb);
436
437 if (!ara || !arb || ara->n_values != arb->n_values)
438 return FALSE(0);
439
440 for (i = 0; i < ara->n_values; ++i)
441 if (!rgba_equal (g_value_get_boxed (g_value_array_get_nth (ara, i)),
442 g_value_get_boxed (g_value_array_get_nth (arb, i))))
443 return FALSE(0);
444
445 return TRUE(!(0));
446 }
447
448 return FALSE(0);
449}
450
451static void
452ensure_pixbuf_property (TerminalProfile *profile,
453 guint path_prop_id,
454 guint pixbuf_prop_id,
455 gboolean *load_failed)
456{
457 TerminalProfilePrivate *priv = profile->priv;
458 GValue *path_value, *pixbuf_value;
459 GdkPixbuf *pixbuf;
460 const char *path_utf8;
461 char *path;
462 GError *error = NULL((void*)0);
463
464 pixbuf_value = g_value_array_get_nth (priv->properties, pixbuf_prop_id);
465
466 pixbuf = g_value_get_object (pixbuf_value);
467 if (pixbuf)
468 return;
469
470 if (*load_failed)
471 return;
472
473 path_value = g_value_array_get_nth (priv->properties, path_prop_id);
474 path_utf8 = g_value_get_string (path_value);
475 if (!path_utf8 || !path_utf8[0])
476 goto failed;
477
478 path = g_filename_from_utf8 (path_utf8, -1, NULL((void*)0), NULL((void*)0), NULL((void*)0));
479 if (!path)
480 goto failed;
481
482 pixbuf = gdk_pixbuf_new_from_file (path, &error);
483 if (!pixbuf)
484 {
485 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
486 "Failed to load image \"%s\": %s\n",do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
487 path, error->message)do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
;
488
489 g_error_free (error);
490 g_free (path);
491 goto failed;
492 }
493
494 g_value_take_object (pixbuf_value, pixbuf);
495 g_free (path);
496 return;
497
498failed:
499 *load_failed = TRUE(!(0));
500}
501
502static void
503terminal_profile_reset_property_internal (TerminalProfile *profile,
504 GParamSpec *pspec,
505 gboolean notify)
506{
507 TerminalProfilePrivate *priv = profile->priv;
508 GValue value_ = { 0, };
509 GValue *value;
510
511 if (notify)
512 {
513 value = &value_;
514 g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
515 }
516 else
517 value = g_value_array_get_nth (priv->properties, pspec->param_id);
518 g_assert (value != NULL)do { if (value != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 518, ((const char*) (__func__
)), "value != NULL"); } while (0)
;
519
520 /* A few properties don't have defaults via the param spec; set them explicitly */
521 switch (pspec->param_id)
522 {
523 case PROP_FOREGROUND_COLOR:
524 case PROP_BOLD_COLOR:
525 {
526 GdkRGBA color;
527
528 if (!gdk_rgba_parse (&color, DEFAULT_FOREGROUND_COLOR("#000000")))
529 return;
530 color.alpha = 1.0;
531 g_value_set_boxed (value, &color);
532 break;
533 }
534 case PROP_BACKGROUND_COLOR:
535 {
536 GdkRGBA color;
537
538 if (!gdk_rgba_parse (&color, DEFAULT_BACKGROUND_COLOR("#FFFFDD")))
539 return;
540 color.alpha = 1.0;
541 g_value_set_boxed (value, &color);
542 break;
543 }
544 case PROP_FONT:
545 g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_FONT("Monospace 12")));
546 break;
547
548 case PROP_PALETTE:
549 set_value_from_palette (value, DEFAULT_PALETTE(terminal_palettes[0]), TERMINAL_PALETTE_SIZE16);
550 break;
551
552 default:
553 g_param_value_set_default (pspec, value);
554 break;
555 }
556
557 if (notify)
558 {
559 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, pspec->name, value);
560 g_value_unset (value);
561 }
562}
563
564static void
565terminal_profile_gsettings_notify_cb (GSettings *settings,
566 gchar *key,
567 gpointer user_data)
568{
569 TerminalProfile *profile = TERMINAL_PROFILE (user_data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_profile_get_type ()))))))
;
570 TerminalProfilePrivate *priv = profile->priv;
571 TerminalProfileClass *klass;
572 GVariant *settings_value;
573 GParamSpec *pspec;
574 GValue value = { 0, };
575 gboolean equal;
576 gboolean force_set = FALSE(0);
577
578 if (!key) return;
579
580 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
581 "GSettings notification for key %s [%s]\n",do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
582 key,do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
583 g_settings_is_writable (settings, key) ? "writable" : "LOCKED")do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
;
584
585 klass = TERMINAL_PROFILE_GET_CLASS (profile)((((TerminalProfileClass*) (((GTypeInstance*) ((profile)))->
g_class))))
;
586 pspec = g_hash_table_lookup (klass->gsettings_keys, key);
587 if (!pspec)
588 return; /* ignore unknown keys, for future extensibility */
589
590 priv->locked[pspec->param_id] = !g_settings_is_writable (settings, key);
591
592 settings_value = g_settings_get_value (settings, key);
593 if (!settings_value)
594 return;
595
596 g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
597
598 if (G_IS_PARAM_SPEC_BOOLEAN (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[2])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
599 {
600 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_BOOLEAN((const GVariantType *) "b")))
601 goto out;
602
603 g_value_set_boolean (&value, g_variant_get_boolean (settings_value));
604 }
605 else if (G_IS_PARAM_SPEC_STRING (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[14])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
606 {
607 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
608 goto out;
609
610 g_value_set_string (&value, g_variant_get_string (settings_value, NULL((void*)0)));
611 }
612 else if (G_IS_PARAM_SPEC_ENUM (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[10])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
613 {
614
615 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
616 goto out;
617
618 g_value_set_enum (&value, g_settings_get_enum (settings, key));
619 }
620 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
621 {
622 GdkRGBA color;
623
624 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
625 goto out;
626
627 if (!gdk_rgba_parse (&color, g_variant_get_string (settings_value, NULL((void*)0))))
628 goto out;
629
630 g_value_set_boxed (&value, &color);
631 }
632 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
633 {
634 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
635 goto out;
636
637 g_value_take_boxed (&value, pango_font_description_from_string (g_variant_get_string (settings_value, NULL((void*)0))));
638 }
639 else if (G_IS_PARAM_SPEC_DOUBLE (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[13])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
640 {
641 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_DOUBLE((const GVariantType *) "d")))
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
642 goto out;
643
644 g_value_set_double (&value, g_variant_get_double (settings_value));
645 }
646 else if (G_IS_PARAM_SPEC_INT (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[3])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
647 {
648 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT16((const GVariantType *) "n")) &&
649 !g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT32((const GVariantType *) "i")) &&
650 !g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT64((const GVariantType *) "x")))
651 goto out;
652
653 g_value_set_int (&value, g_settings_get_int(settings, key));
654 }
655 else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
656 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
657 {
658 char **color_strings;
659 GdkRGBA *colors;
660 int n_colors, i;
661
662 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
663 goto out;
664
665 color_strings = g_strsplit (g_variant_get_string (settings_value, NULL((void*)0)), ":", -1);
666 if (!color_strings)
667 goto out;
668
669 n_colors = g_strv_length (color_strings);
670 colors = g_new0 (GdkRGBA, n_colors)((GdkRGBA *) g_malloc0_n ((n_colors), sizeof (GdkRGBA)));
671 for (i = 0; i < n_colors; ++i)
672 {
673 if (!gdk_rgba_parse (&colors[i], color_strings[i]))
674 continue; /* ignore errors */
675 }
676 g_strfreev (color_strings);
677
678 /* We continue even with a palette size != TERMINAL_PALETTE_SIZE,
679 * so we can change the palette size in future versions without
680 * causing too many issues.
681 */
682 set_value_from_palette (&value, colors, n_colors);
683 g_free (colors);
684 }
685 else
686 {
687 g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
), pspec->name);
688 goto out;
689 }
690
691 if (g_param_value_validate (pspec, &value))
692 {
693 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
694 "Invalid value in GSettings for key %s was changed to comply with pspec %s\n",do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
695 key, pspec->name)do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
;
696
697 force_set = TRUE(!(0));
698 }
699
700 /* Only set the property if the value is different than our current value,
701 * so we don't go into an infinite loop.
702 */
703 equal = values_equal (pspec, &value, g_value_array_get_nth (priv->properties, pspec->param_id));
704#ifdef MATE_ENABLE_DEBUG
705 _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_PROFILE)if (0)
706 {
707 if (!equal)
708 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("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)); } while (0)
709 "Setting property %s to a different value\n"do { if (0) g_printerr("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)); } while (0)
710 " now: %s\n"do { if (0) g_printerr("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)); } while (0)
711 " new: %s\n",do { if (0) g_printerr("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)); } while (0)
712 pspec->name,do { if (0) g_printerr("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)); } while (0)
713 g_strdup_value_contents (g_value_array_get_nth (priv->properties, pspec->param_id)),do { if (0) g_printerr("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)); } while (0)
714 g_strdup_value_contents (&value))do { if (0) g_printerr("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)); } while (0)
;
715 }
716#endif
717
718 if (!equal || force_set)
719 {
720 priv->gsettings_notification_pspec = pspec;
721 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, pspec->name, &value);
722 priv->gsettings_notification_pspec = NULL((void*)0);
723 }
724
725out:
726 /* FIXME: if we arrive here through goto in the error cases,
727 * should we maybe reset the property to its default value?
728 */
729
730 g_value_unset (&value);
731 g_variant_unref (settings_value);
732}
733
734static void
735terminal_profile_gsettings_changeset_add (TerminalProfile *profile,
736 GSettings *changeset,
737 GParamSpec *pspec)
738{
739 TerminalProfilePrivate *priv = profile->priv;
740 char *key;
741 const GValue *value;
742
743 /* FIXME: do this? */
744#if 0
745 if (priv->locked[pspec->param_id])
746 return;
747
748 if (!g_settings_is_writable (priv->settings, gsettings_key, NULL((void*)0)))
749 return;
750#endif
751
752 key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
753 if (!key)
754 return;
755
756 value = g_value_array_get_nth (priv->properties, pspec->param_id);
757
758 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
759 "Adding pspec %s with value %s to the GSettings changeset\n",do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
760 pspec->name, g_strdup_value_contents (value))do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
;
761
762 if (G_IS_PARAM_SPEC_BOOLEAN (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[2])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
763 g_settings_set_boolean (changeset, key, g_value_get_boolean (value));
764 else if (G_IS_PARAM_SPEC_STRING (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[14])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
765 {
766 const char *str;
767
768 str = g_value_get_string (value);
769 g_settings_set_string (changeset, key, str ? str : "");
770 }
771 else if (G_IS_PARAM_SPEC_ENUM (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[10])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
772 {
773 const GEnumValue *eval;
774
775 eval = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)((((GParamSpecEnum*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), ((g_param_spec_types[10]))))))
->enum_class, g_value_get_enum (value));
776
777 g_settings_set_enum (changeset, key, eval->value);
778 }
779 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
780 {
781 GdkRGBA *color;
782 char str[16];
783
784 color = g_value_get_boxed (value);
785 if (!color)
786 goto cleanup;
787
788 g_snprintf (str, sizeof (str),
789 "#%04X%04X%04X",
790 (guint) (color->red * 65535),
791 (guint) (color->green * 65535),
792 (guint) (color->blue * 65535));
793
794 g_settings_set_string (changeset, key, str);
795 }
796 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
797 {
798 PangoFontDescription *font_desc;
799 char *font;
800
801 font_desc = g_value_get_boxed (value);
802 if (!font_desc)
803 goto cleanup;
804
805 font = pango_font_description_to_string (font_desc);
806 g_settings_set_string (changeset, key, font);
807 g_free (font);
808 }
809 else if (G_IS_PARAM_SPEC_DOUBLE (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[13])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
810 g_settings_set_double (changeset, key, g_value_get_double (value));
811 else if (G_IS_PARAM_SPEC_INT (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[3])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
812 g_settings_set_int (changeset, key, g_value_get_int (value));
813 else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
814 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
815 {
816 GValueArray *array;
817 GString *string;
818 guint n_colors, i;
819
820 /* We need to do this ourselves, because the gtk_color_selection_palette_to_string
821 * does not carry all the bytes, and xterm's palette is messed up...
822 */
823
824 array = g_value_get_boxed (value);
825 if (!array)
826 goto cleanup;
827
828 n_colors = array->n_values;
829 string = g_string_sized_new (n_colors * (1 /* # */ + 3 * 4) + n_colors /* : separators and terminating \0 */);
830 for (i = 0; i < n_colors; ++i)
831 {
832 GdkRGBA *color;
833
834 if (i > 0)
835 g_string_append_c (string, ':')g_string_append_c_inline (string, ':');
836
837 color = g_value_get_boxed (g_value_array_get_nth (array, i));
838 if (!color)
839 continue;
840
841 g_string_append_printf (string,
842 "#%04X%04X%04X",
843 (guint) (color->red * 65535),
844 (guint) (color->green * 65535),
845 (guint) (color->blue * 65535));
846 }
847
848 g_settings_set_string (changeset, key, string->str);
849 g_string_free (string, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) (
(string), ((!(0)))) : g_string_free_and_steal (string)) : (g_string_free
) ((string), ((!(0)))))
;
850 }
851 else
852 g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
), pspec->name);
853
854cleanup:
855 return;
856}
857
858static void
859terminal_profile_save (TerminalProfile *profile)
860{
861 TerminalProfilePrivate *priv = profile->priv;
862 GSettings *changeset;
863 GSList *l;
864 gchar *concat;
865
866 priv->save_idle_id = 0;
867 concat = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", priv->profile_dir,"/", NULL((void*)0));
868 changeset = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
869 g_free (concat);
870 g_settings_delay (changeset);
871
872 for (l = priv->dirty_pspecs; l != NULL((void*)0); l = l->next)
873 {
874 GParamSpec *pspec = (GParamSpec *) l->data;
875
876 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
877 continue;
878
879 if ((pspec->flags & G_PARAM_WRITABLE) == 0)
880 continue;
881
882 terminal_profile_gsettings_changeset_add (profile, changeset, pspec);
883 }
884
885 g_slist_free (priv->dirty_pspecs);
886 priv->dirty_pspecs = NULL((void*)0);
887
888 g_settings_apply (changeset);
889 g_object_unref (changeset);
890}
891
892static gboolean
893terminal_profile_save_idle_cb (TerminalProfile *profile)
894{
895 terminal_profile_save (profile);
896
897 /* don't run again */
898 return FALSE(0);
899}
900
901static void
902terminal_profile_schedule_save (TerminalProfile *profile,
903 GParamSpec *pspec)
904{
905 TerminalProfilePrivate *priv = profile->priv;
906
907 g_assert (pspec != NULL)do { if (pspec != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 907, ((const char*) (__func__
)), "pspec != NULL"); } while (0)
;
908
909 if (!g_slist_find (priv->dirty_pspecs, pspec))
910 priv->dirty_pspecs = g_slist_prepend (priv->dirty_pspecs, pspec);
911
912 if (priv->save_idle_id != 0)
913 return;
914
915 priv->save_idle_id = g_idle_add ((GSourceFunc) terminal_profile_save_idle_cb, profile);
916}
917
918static void
919terminal_profile_init (TerminalProfile *profile)
920{
921 TerminalProfilePrivate *priv;
922 GObjectClass *object_class;
923 GParamSpec **pspecs;
924 guint n_pspecs, i;
925
926 priv = profile->priv = terminal_profile_get_instance_private (profile);
927
928 priv->gsettings_notification_pspec = NULL((void*)0);
929 priv->locked = g_new0 (gboolean, LAST_PROP)((gboolean *) g_malloc0_n ((LAST_PROP), sizeof (gboolean)));
930
931 priv->properties = g_value_array_new (LAST_PROP);
932 for (i = 0; i < LAST_PROP; ++i)
933 g_value_array_append (priv->properties, NULL((void*)0));
934
935 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
936 for (i = 0; i < n_pspecs; ++i)
937 {
938 GParamSpec *pspec = pspecs[i];
939 GValue *value;
940
941 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
942 continue;
943
944 g_assert (pspec->param_id < LAST_PROP)do { if (pspec->param_id < LAST_PROP) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 944, ((const char*) (__func__
)), "pspec->param_id < LAST_PROP"); } while (0)
;
945 value = g_value_array_get_nth (priv->properties, pspec->param_id);
946 g_value_init (value, pspec->value_type);
947 g_param_value_set_default (pspec, value);
948 }
949
950 g_free (pspecs);
951
952 /* A few properties don't have defaults via the param spec; set them explicitly */
953 object_class = G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
;
954 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_FOREGROUND_COLOR"foreground-color"), FALSE(0));
955 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_BOLD_COLOR"bold-color"), FALSE(0));
956 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_BACKGROUND_COLOR"background-color"), FALSE(0));
957 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_FONT"font"), FALSE(0));
958 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_PALETTE"palette"), FALSE(0));
959}
960
961static GObject *
962terminal_profile_constructor (GType type,
963 guint n_construct_properties,
964 GObjectConstructParam *construct_params)
965{
966 GObject *object;
967 TerminalProfile *profile;
968 TerminalProfilePrivate *priv;
969 const char *name;
970 GParamSpec **pspecs;
971 guint n_pspecs, i;
972 gchar *concat;
973
974 object = G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->constructor
975 (type, n_construct_properties, construct_params);
976
977 profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
978 priv = profile->priv;
979
980 name = g_value_get_string (g_value_array_get_nth (priv->properties, PROP_NAME));
981 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-profile.c", 981, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
982
983 concat = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", name, "/", NULL((void*)0));
984 priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
985 g_assert (priv->settings != NULL)do { if (priv->settings != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 985, ((const char*) (__func__
)), "priv->settings != NULL"); } while (0)
;
986 g_free (concat);
987 concat = g_strconcat("changed::", priv->profile_dir, "/", NULL((void*)0));
988 g_signal_connect (priv->settings,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
989 concat,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
990 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
991 profile)g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
;
992
993 g_free (concat);
994
995 /* Now load those properties from GSettings that were not set as construction params */
996 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
997 for (i = 0; i < n_pspecs; ++i)
998 {
999 GParamSpec *pspec = pspecs[i];
1000 guint j;
1001 gboolean is_construct = FALSE(0);
1002 char *key;
1003
1004 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
1005 continue;
1006
1007 if ((pspec->flags & G_PARAM_WRITABLE) == 0 ||
1008 (pspec->flags & G_PARAM_CONSTRUCT_ONLY) != 0)
1009 continue;
1010
1011 for (j = 0; j < n_construct_properties; ++j)
1012 if (pspec == construct_params[j].pspec)
1013 {
1014 is_construct = TRUE(!(0));
1015 break;
1016 }
1017
1018 if (is_construct)
1019 continue;
1020
1021 key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
1022 if (!key)
1023 continue;
1024
1025 terminal_profile_gsettings_notify_cb (priv->settings, key, profile);
1026 }
1027
1028 g_free (pspecs);
1029
1030 return object;
1031}
1032
1033static void
1034terminal_profile_finalize (GObject *object)
1035{
1036 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1037 TerminalProfilePrivate *priv = profile->priv;
1038
1039 g_signal_handlers_disconnect_by_func (priv->settings,g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1040 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1041 profile)g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
;
1042
1043 if (priv->save_idle_id)
1044 {
1045 g_source_remove (priv->save_idle_id);
1046
1047 /* Save now */
1048 terminal_profile_save (profile);
1049 }
1050
1051 _terminal_profile_forget (profile);
1052
1053 g_object_unref (priv->settings);
1054
1055 g_free (priv->profile_dir);
1056 g_free (priv->locked);
1057 g_value_array_free (priv->properties);
1058
1059 G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->finalize (object);
1060}
1061
1062static void
1063terminal_profile_get_property (GObject *object,
1064 guint prop_id,
1065 GValue *value,
1066 GParamSpec *pspec)
1067{
1068 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1069 TerminalProfilePrivate *priv = profile->priv;
1070
1071 if (prop_id == 0 || prop_id >= LAST_PROP)
1072 {
1073 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-profile.c", 1073, ("property"), _glib__property_id
, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance
*) (_glib__pspec))->g_class))->g_type)))), (g_type_name
((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1074 return;
1075 }
1076
1077 /* Note: When adding things here, do the same in get_prop_value_from_prop_name! */
1078 switch (prop_id)
1079 {
1080 case PROP_BACKGROUND_IMAGE:
1081 ensure_pixbuf_property (profile, PROP_BACKGROUND_IMAGE_FILE, PROP_BACKGROUND_IMAGE, &priv->background_load_failed);
1082 break;
1083 default:
1084 break;
1085 }
1086
1087 g_value_copy (g_value_array_get_nth (priv->properties, prop_id), value);
1088}
1089
1090static void
1091terminal_profile_set_property (GObject *object,
1092 guint prop_id,
1093 const GValue *value,
1094 GParamSpec *pspec)
1095{
1096 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1097 TerminalProfilePrivate *priv = profile->priv;
1098 GValue *prop_value;
1099
1100 if (prop_id == 0 || prop_id >= LAST_PROP)
1101 {
1102 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-profile.c", 1102, ("property"), _glib__property_id
, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance
*) (_glib__pspec))->g_class))->g_type)))), (g_type_name
((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1103 return;
1104 }
1105
1106 prop_value = g_value_array_get_nth (priv->properties, prop_id);
1107
1108 /* Preprocessing */
1109 switch (prop_id)
1110 {
1111#if 0
1112 case PROP_FONT:
1113 {
1114 PangoFontDescription *font_desc, *new_font_desc;
1115
1116 font_desc = g_value_get_boxed (prop_value);
1117 new_font_desc = g_value_get_boxed (value);
1118
1119 if (font_desc && new_font_desc)
1120 {
1121 /* Merge in case the new string isn't complete enough to load a font */
1122 pango_font_description_merge (font_desc, new_font_desc, TRUE(!(0)));
1123 pango_font_description_free (new_font_desc);
1124 break;
1125 }
1126
1127 /* fall-through */
1128 }
1129#endif
1130 default:
1131 g_value_copy (value, prop_value);
1132 break;
1133 }
1134
1135 /* Postprocessing */
1136 switch (prop_id)
1137 {
1138 case PROP_NAME:
1139 {
1140 const char *name = g_value_get_string (value);
1141
1142 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-profile.c", 1142, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
1143 priv->profile_dir = g_strdup (name)g_strdup_inline (name);
1144 if (priv->settings != NULL((void*)0)) {
1145 gchar *concat;
1146 g_signal_handlers_disconnect_by_func (priv->settings,g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1147 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1148 profile)g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
;
1149 g_object_unref (priv->settings);
1150 concat= g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", priv->profile_dir, "/", NULL((void*)0));
1151 priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
1152 g_free (concat);
1153 concat = g_strconcat("changed::", priv->profile_dir, "/", NULL((void*)0));
1154 g_signal_connect (priv->settings,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1155 concat,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1156 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1157 profile)g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
;
1158 g_free (concat);
1159 }
1160 break;
1161 }
1162
1163 case PROP_BACKGROUND_IMAGE_FILE:
1164 /* Clear the cached image */
1165 g_value_set_object (g_value_array_get_nth (priv->properties, PROP_BACKGROUND_IMAGE), NULL((void*)0));
1166 priv->background_load_failed = FALSE(0);
1167 g_object_notify (object, TERMINAL_PROFILE_BACKGROUND_IMAGE"background-image");
1168 break;
1169
1170 default:
1171 break;
1172 }
1173}
1174
1175static void
1176terminal_profile_notify (GObject *object,
1177 GParamSpec *pspec)
1178{
1179 TerminalProfilePrivate *priv = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
->priv;
1180 void (* notify) (GObject *, GParamSpec *) = G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->notify;
1181
1182 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
1183 "Property notification for prop %s\n",do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
1184 pspec->name)do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
;
1185
1186 if (notify)
1187 notify (object, pspec);
1188
1189 if (pspec->owner_type == TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) &&
1190 (pspec->flags & G_PARAM_WRITABLE) &&
1191 g_param_spec_get_qdata (pspec, gsettings_key_quark) != NULL((void*)0) &&
1192 pspec != priv->gsettings_notification_pspec)
1193 terminal_profile_schedule_save (TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
, pspec);
1194}
1195
1196static void
1197terminal_profile_class_init (TerminalProfileClass *klass)
1198{
1199 GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
;
1200
1201 gsettings_key_quark = g_quark_from_static_string ("GT::GSettingsKey");
1202
1203 object_class->constructor = terminal_profile_constructor;
1204 object_class->finalize = terminal_profile_finalize;
1205 object_class->get_property = terminal_profile_get_property;
1206 object_class->set_property = terminal_profile_set_property;
1207 object_class->notify = terminal_profile_notify;
1208
1209 signals[FORGOTTEN] =
1210 g_signal_new ("forgotten",
1211 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1212 G_SIGNAL_RUN_LAST,
1213 G_STRUCT_OFFSET (TerminalProfileClass, forgotten)((glong) __builtin_offsetof(TerminalProfileClass, forgotten)),
1214 NULL((void*)0), NULL((void*)0),
1215 g_cclosure_marshal_VOID__VOID,
1216 G_TYPE_NONE((GType) ((1) << (2))), 0);
1217
1218 /* gsettings_key -> pspec hash */
1219 klass->gsettings_keys = g_hash_table_new (g_str_hash, g_str_equal);
1220
1221#define TERMINAL_PROFILE_PSPEC_STATIC(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
1222
1223#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);
}
\
1224{\
1225 GParamSpec *pspec = propSpec;\
1226 g_object_class_install_property (object_class, propId, pspec);\
1227 g_param_spec_set_qdata (pspec, gsettings_key_quark, (gpointer) propGSettings);\
1228 g_hash_table_insert (klass->gsettings_keys, (gpointer) propGSettings, pspec);\
1229}
1230
1231#define TERMINAL_PROFILE_PROPERTY_OUTER(propId, propSpec){ GParamSpec *pspec = propSpec; g_object_class_install_property
(object_class, propId, pspec);}
\
1232{\
1233 GParamSpec *pspec = propSpec;\
1234 g_object_class_install_property (object_class, propId, pspec);\
1235}
1236
1237#define TERMINAL_PROFILE_PROPERTY_BOOLEAN(prop, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1238 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1239 g_param_spec_boolean (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1240 propDefault,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1241 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1242 propGSettings){ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1243
1244#define TERMINAL_PROFILE_PROPERTY_BOXED(prop, propType, propGSettings){ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1245 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1246 g_param_spec_boxed (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1247 propType,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1248 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1249 propGSettings){ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1250
1251#define TERMINAL_PROFILE_PROPERTY_DOUBLE(prop, propMin, propMax, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1252 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1253 g_param_spec_double (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1254 propMin, propMax, propDefault,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1255 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1256 propGSettings){ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1257
1258#define TERMINAL_PROFILE_PROPERTY_ENUM(prop, propType, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1259 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1260 g_param_spec_enum (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1261 propType, propDefault,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1262 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1263 propGSettings){ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1264
1265#define TERMINAL_PROFILE_PROPERTY_INT(prop, propMin, propMax, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1266 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1267 g_param_spec_int (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1268 propMin, propMax, propDefault,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1269 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1270 propGSettings){ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1271
1272 /* these are all read-only */
1273#define TERMINAL_PROFILE_PROPERTY_OBJECT(prop, propType){ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec);}
\
1274 TERMINAL_PROFILE_PROPERTY_OUTER (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1275 g_param_spec_object (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1276 propType,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1277 G_PARAM_READABLE | TERMINAL_PROFILE_PSPEC_STATIC)){ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1278
1279#define TERMINAL_PROFILE_PROPERTY_STRING(prop, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1280 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1281 g_param_spec_string (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1282 propDefault,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1283 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1284 propGSettings){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1285
1286#define TERMINAL_PROFILE_PROPERTY_STRING_CO(prop, propDefault){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec);}
\
1287 TERMINAL_PROFILE_PROPERTY_OUTER (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1288 g_param_spec_string (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1289 propDefault,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1290 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | TERMINAL_PROFILE_PSPEC_STATIC)){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1291
1292#define TERMINAL_PROFILE_PROPERTY_VALUE_ARRAY_BOXED(prop, propElementName, propElementType, propGSettings){ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1293 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1294 g_param_spec_value_array (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1295 g_param_spec_boxed (propElementName, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1296 propElementType, \{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1297 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1298 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1299 propGSettings){ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1300
1301 TERMINAL_PROFILE_PROPERTY_BOOLEAN (ALLOW_BOLD, DEFAULT_ALLOW_BOLD, KEY_ALLOW_BOLD){ GParamSpec *pspec = g_param_spec_boolean ("allow-bold", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_ALLOW_BOLD, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "allow-bold"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "allow-bold", pspec);}
;
1302 TERMINAL_PROFILE_PROPERTY_BOOLEAN (BOLD_COLOR_SAME_AS_FG, DEFAULT_BOLD_COLOR_SAME_AS_FG, KEY_BOLD_COLOR_SAME_AS_FG){ GParamSpec *pspec = g_param_spec_boolean ("bold-color-same-as-fg"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BOLD_COLOR_SAME_AS_FG, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "bold-color-same-as-fg"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "bold-color-same-as-fg"
, pspec);}
;
1303 TERMINAL_PROFILE_PROPERTY_BOOLEAN (DEFAULT_SHOW_MENUBAR, DEFAULT_DEFAULT_SHOW_MENUBAR, KEY_DEFAULT_SHOW_MENUBAR){ GParamSpec *pspec = g_param_spec_boolean ("default-show-menubar"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_DEFAULT_SHOW_MENUBAR, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "default-show-menubar"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "default-show-menubar"
, pspec);}
;
1304 TERMINAL_PROFILE_PROPERTY_BOOLEAN (LOGIN_SHELL, DEFAULT_LOGIN_SHELL, KEY_LOGIN_SHELL){ GParamSpec *pspec = g_param_spec_boolean ("login-shell", ((
void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_LOGIN_SHELL, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "login-shell"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "login-shell", pspec);
}
;
1305 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_BACKGROUND, DEFAULT_SCROLL_BACKGROUND, KEY_SCROLL_BACKGROUND){ GParamSpec *pspec = g_param_spec_boolean ("scroll-background"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_BACKGROUND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-background")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-background"
, pspec);}
;
1306 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLLBACK_UNLIMITED, DEFAULT_SCROLLBACK_UNLIMITED, KEY_SCROLLBACK_UNLIMITED){ GParamSpec *pspec = g_param_spec_boolean ("scrollback-unlimited"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLLBACK_UNLIMITED, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scrollback-unlimited"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scrollback-unlimited"
, pspec);}
;
1307 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_KEYSTROKE, DEFAULT_SCROLL_ON_KEYSTROKE, KEY_SCROLL_ON_KEYSTROKE){ GParamSpec *pspec = g_param_spec_boolean ("scroll-on-keystroke"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_ON_KEYSTROKE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-on-keystroke"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-on-keystroke"
, pspec);}
;
1308 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_OUTPUT, DEFAULT_SCROLL_ON_OUTPUT, KEY_SCROLL_ON_OUTPUT){ GParamSpec *pspec = g_param_spec_boolean ("scroll-on-output"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_ON_OUTPUT, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-on-output");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-on-output"
, pspec);}
;
1309 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SILENT_BELL, DEFAULT_SILENT_BELL, KEY_SILENT_BELL){ GParamSpec *pspec = g_param_spec_boolean ("silent-bell", ((
void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SILENT_BELL, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "silent-bell"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "silent-bell", pspec);
}
;
1310 TERMINAL_PROFILE_PROPERTY_BOOLEAN (COPY_SELECTION, DEFAULT_COPY_SELECTION, KEY_COPY_SELECTION){ GParamSpec *pspec = g_param_spec_boolean ("copy-selection",
((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_COPY_SELECTION, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "copy-selection"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "copy-selection", pspec
);}
;
1311 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_COMMAND, DEFAULT_USE_CUSTOM_COMMAND, KEY_USE_CUSTOM_COMMAND){ GParamSpec *pspec = g_param_spec_boolean ("use-custom-command"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_CUSTOM_COMMAND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-custom-command"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-custom-command"
, pspec);}
;
1312 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_DEFAULT_SIZE, DEFAULT_USE_CUSTOM_DEFAULT_SIZE, KEY_USE_CUSTOM_DEFAULT_SIZE){ GParamSpec *pspec = g_param_spec_boolean ("use-custom-default-size"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_CUSTOM_DEFAULT_SIZE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-custom-default-size"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-custom-default-size"
, pspec);}
;
1313 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SKEY, DEFAULT_USE_SKEY, KEY_USE_SKEY){ GParamSpec *pspec = g_param_spec_boolean ("use-skey", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_SKEY, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-skey"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-skey", pspec);}
;
1314 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_URLS, DEFAULT_USE_URLS, KEY_USE_URLS){ GParamSpec *pspec = g_param_spec_boolean ("use-urls", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_URLS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-urls"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-urls", pspec);}
;
1315 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SYSTEM_FONT, DEFAULT_USE_SYSTEM_FONT, KEY_USE_SYSTEM_FONT){ GParamSpec *pspec = g_param_spec_boolean ("use-system-font"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_SYSTEM_FONT, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-system-font"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-system-font", pspec
);}
;
1316 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_THEME_COLORS, DEFAULT_USE_THEME_COLORS, KEY_USE_THEME_COLORS){ GParamSpec *pspec = g_param_spec_boolean ("use-theme-colors"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_THEME_COLORS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-theme-colors");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-theme-colors"
, pspec);}
;
1317
1318 TERMINAL_PROFILE_PROPERTY_BOXED (BACKGROUND_COLOR, GDK_TYPE_RGBA, KEY_BACKGROUND_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("background-color",
((void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "background-color"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "background-color", pspec);}
;
1319 TERMINAL_PROFILE_PROPERTY_BOXED (BOLD_COLOR, GDK_TYPE_RGBA, KEY_BOLD_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("bold-color", ((void
*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BOLD_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "bold-color"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "bold-color", pspec);}
;
1320 TERMINAL_PROFILE_PROPERTY_BOXED (FONT, PANGO_TYPE_FONT_DESCRIPTION, KEY_FONT){ GParamSpec *pspec = g_param_spec_boxed ("font", ((void*)0),
((void*)0), (pango_font_description_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_FONT,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) "font"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "font", pspec);}
;
1321 TERMINAL_PROFILE_PROPERTY_BOXED (FOREGROUND_COLOR, GDK_TYPE_RGBA, KEY_FOREGROUND_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("foreground-color",
((void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_FOREGROUND_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "foreground-color"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "foreground-color", pspec);}
;
1322
1323 /* 0.0 = normal bg, 1.0 = all black bg, 0.5 = half darkened */
1324 TERMINAL_PROFILE_PROPERTY_DOUBLE (BACKGROUND_DARKNESS, 0.0, 1.0, DEFAULT_BACKGROUND_DARKNESS, KEY_BACKGROUND_DARKNESS){ GParamSpec *pspec = g_param_spec_double ("background-darkness"
, ((void*)0), ((void*)0), 0.0, 1.0, (0.5), G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_DARKNESS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "background-darkness"); g_hash_table_insert (klass
->gsettings_keys, (gpointer) "background-darkness", pspec)
;}
;
1325
1326 TERMINAL_PROFILE_PROPERTY_ENUM (BACKGROUND_TYPE, TERMINAL_TYPE_BACKGROUND_TYPE, DEFAULT_BACKGROUND_TYPE, KEY_BACKGROUND_TYPE){ GParamSpec *pspec = g_param_spec_enum ("background-type", (
(void*)0), ((void*)0), (terminal_background_type_get_type ())
, (TERMINAL_BACKGROUND_SOLID), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BACKGROUND_TYPE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "background-type"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "background-type", pspec
);}
;
1327 TERMINAL_PROFILE_PROPERTY_ENUM (BACKSPACE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_BACKSPACE_BINDING, KEY_BACKSPACE_BINDING){ GParamSpec *pspec = g_param_spec_enum ("backspace-binding",
((void*)0), ((void*)0), (vte_erase_binding_get_type ()), (VTE_ERASE_ASCII_DELETE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_BACKSPACE_BINDING, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) "backspace-binding"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "backspace-binding", pspec
);}
;
1328 TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_BLINK_MODE, VTE_TYPE_CURSOR_BLINK_MODE, DEFAULT_CURSOR_BLINK_MODE, KEY_CURSOR_BLINK_MODE){ GParamSpec *pspec = g_param_spec_enum ("cursor-blink-mode",
((void*)0), ((void*)0), (vte_cursor_blink_mode_get_type ()),
(VTE_CURSOR_BLINK_SYSTEM), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_CURSOR_BLINK_MODE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "cursor-blink-mode")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "cursor-blink-mode"
, pspec);}
;
1329 TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_SHAPE, VTE_TYPE_CURSOR_SHAPE, DEFAULT_CURSOR_SHAPE, KEY_CURSOR_SHAPE){ GParamSpec *pspec = g_param_spec_enum ("cursor-shape", ((void
*)0), ((void*)0), (vte_cursor_shape_get_type ()), (VTE_CURSOR_SHAPE_BLOCK
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_CURSOR_SHAPE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "cursor-shape"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "cursor-shape", pspec);}
;
1330 TERMINAL_PROFILE_PROPERTY_ENUM (DELETE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_DELETE_BINDING, KEY_DELETE_BINDING){ GParamSpec *pspec = g_param_spec_enum ("delete-binding", ((
void*)0), ((void*)0), (vte_erase_binding_get_type ()), (VTE_ERASE_DELETE_SEQUENCE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_DELETE_BINDING, pspec); g_param_spec_set_qdata (pspec,
gsettings_key_quark, (gpointer) "delete-binding"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "delete-binding", pspec
);}
;
1331 TERMINAL_PROFILE_PROPERTY_ENUM (EXIT_ACTION, TERMINAL_TYPE_EXIT_ACTION, DEFAULT_EXIT_ACTION, KEY_EXIT_ACTION){ GParamSpec *pspec = g_param_spec_enum ("exit-action", ((void
*)0), ((void*)0), (terminal_exit_action_get_type ()), (TERMINAL_EXIT_CLOSE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_EXIT_ACTION, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "exit-action"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "exit-action", pspec);}
;
1332 TERMINAL_PROFILE_PROPERTY_ENUM (SCROLLBAR_POSITION, TERMINAL_TYPE_SCROLLBAR_POSITION, DEFAULT_SCROLLBAR_POSITION, KEY_SCROLLBAR_POSITION){ GParamSpec *pspec = g_param_spec_enum ("scrollbar-position"
, ((void*)0), ((void*)0), (terminal_scrollbar_position_get_type
()), (TERMINAL_SCROLLBAR_RIGHT), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLLBAR_POSITION, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scrollbar-position"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scrollbar-position"
, pspec);}
;
1333 TERMINAL_PROFILE_PROPERTY_ENUM (TITLE_MODE, TERMINAL_TYPE_TITLE_MODE, DEFAULT_TITLE_MODE, KEY_TITLE_MODE){ GParamSpec *pspec = g_param_spec_enum ("title-mode", ((void
*)0), ((void*)0), (terminal_title_mode_get_type ()), (TERMINAL_TITLE_REPLACE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_TITLE_MODE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "title-mode"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "title-mode", pspec);}
;
1334
1335 TERMINAL_PROFILE_PROPERTY_INT (DEFAULT_SIZE_COLUMNS, 1, 1024, DEFAULT_DEFAULT_SIZE_COLUMNS, KEY_DEFAULT_SIZE_COLUMNS){ GParamSpec *pspec = g_param_spec_int ("default-size-columns"
, ((void*)0), ((void*)0), 1, 1024, (80), G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_DEFAULT_SIZE_COLUMNS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "default-size-columns"); g_hash_table_insert (klass
->gsettings_keys, (gpointer) "default-size-columns", pspec
);}
;
1336 TERMINAL_PROFILE_PROPERTY_INT (DEFAULT_SIZE_ROWS, 1, 1024, DEFAULT_DEFAULT_SIZE_ROWS, KEY_DEFAULT_SIZE_ROWS){ GParamSpec *pspec = g_param_spec_int ("default-size-rows", (
(void*)0), ((void*)0), 1, 1024, (24), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_DEFAULT_SIZE_ROWS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "default-size-rows")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "default-size-rows"
, pspec);}
;
1337 TERMINAL_PROFILE_PROPERTY_INT (SCROLLBACK_LINES, 1, G_MAXINT, DEFAULT_SCROLLBACK_LINES, KEY_SCROLLBACK_LINES){ GParamSpec *pspec = g_param_spec_int ("scrollback-lines", (
(void*)0), ((void*)0), 1, 2147483647, (512), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_SCROLLBACK_LINES
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "scrollback-lines"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "scrollback-lines", pspec);}
;
1338
1339 TERMINAL_PROFILE_PROPERTY_OBJECT (BACKGROUND_IMAGE, GDK_TYPE_PIXBUF){ GParamSpec *pspec = g_param_spec_object ("background-image"
, ((void*)0), ((void*)0), (gdk_pixbuf_get_type ()), G_PARAM_READABLE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_IMAGE
, pspec);}
;
1340
1341 TERMINAL_PROFILE_PROPERTY_STRING_CO (NAME, DEFAULT_NAME){ GParamSpec *pspec = g_param_spec_string ("name", ((void*)0)
, ((void*)0), (((void*)0)), G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_NAME,
pspec);}
;
1342
1343 TERMINAL_PROFILE_PROPERTY_STRING (BACKGROUND_IMAGE_FILE, DEFAULT_BACKGROUND_IMAGE_FILE, KEY_BACKGROUND_IMAGE_FILE){ GParamSpec *pspec = g_param_spec_string ("background-image-file"
, ((void*)0), ((void*)0), (""), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BACKGROUND_IMAGE_FILE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "background-image");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "background-image"
, pspec);}
;
1344 TERMINAL_PROFILE_PROPERTY_STRING (CUSTOM_COMMAND, DEFAULT_CUSTOM_COMMAND, KEY_CUSTOM_COMMAND){ GParamSpec *pspec = g_param_spec_string ("custom-command", (
(void*)0), ((void*)0), (""), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_CUSTOM_COMMAND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "custom-command"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "custom-command", pspec
);}
;
1345 TERMINAL_PROFILE_PROPERTY_STRING (TITLE, _(DEFAULT_TITLE), KEY_TITLE){ GParamSpec *pspec = g_param_spec_string ("title", ((void*)0
), ((void*)0), gettext ((("Terminal"))), G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_TITLE
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "title"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "title", pspec);}
;
1346 TERMINAL_PROFILE_PROPERTY_STRING (VISIBLE_NAME, _(DEFAULT_VISIBLE_NAME), KEY_VISIBLE_NAME){ GParamSpec *pspec = g_param_spec_string ("visible-name", ((
void*)0), ((void*)0), gettext ((("Unnamed"))), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_VISIBLE_NAME
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "visible-name"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "visible-name", pspec);}
;
1347 TERMINAL_PROFILE_PROPERTY_STRING (WORD_CHARS, DEFAULT_WORD_CHARS, KEY_WORD_CHARS){ GParamSpec *pspec = g_param_spec_string ("word-chars", ((void
*)0), ((void*)0), ("-A-Za-z0-9,./?%&#:_=+@~"), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_WORD_CHARS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "word-chars"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "word-chars", pspec);}
;
1348
1349 TERMINAL_PROFILE_PROPERTY_VALUE_ARRAY_BOXED (PALETTE, "palette-color", GDK_TYPE_RGBA, KEY_PALETTE){ GParamSpec *pspec = g_param_spec_value_array ("palette", ((
void*)0), ((void*)0), g_param_spec_boxed ("palette-color", ((
void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_PALETTE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "palette"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "palette", pspec);}
;
1350}
1351
1352/* Semi-Public API */
1353
1354TerminalProfile*
1355_terminal_profile_new (const char *name)
1356{
1357 return g_object_new (TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()),
1358 "name", name,
1359 NULL((void*)0));
1360}
1361
1362void
1363_terminal_profile_forget (TerminalProfile *profile)
1364{
1365 TerminalProfilePrivate *priv = profile->priv;
1366
1367 if (!priv->forgotten)
1368 {
1369 priv->forgotten = TRUE(!(0));
1370
1371 g_signal_emit (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, signals[FORGOTTEN], 0);
1372 }
1373}
1374
1375gboolean
1376_terminal_profile_get_forgotten (TerminalProfile *profile)
1377{
1378 return profile->priv->forgotten;
1379}
1380
1381TerminalProfile *
1382_terminal_profile_clone (TerminalProfile *base_profile,
1383 const char *visible_name)
1384{
1385 TerminalApp *app = terminal_app_get ();
1386 GObject *base_object = G_OBJECT (base_profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((base_profile)), (((GType) ((20) << (2))))))))
;
1387 TerminalProfilePrivate *new_priv;
1388 char profile_name[32];
1389 GParameter *params;
1390 GParamSpec **pspecs;
1391 guint n_pspecs, i, n_params, profile_num;
1392 TerminalProfile *new_profile;
1393
1394 g_object_ref (base_profile)((__typeof__ (base_profile)) (g_object_ref) (base_profile));
1395
1396 profile_num = 0;
1397 do
1398 {
1399 g_snprintf (profile_name, sizeof (profile_name), "profile%u", profile_num++);
1400 }
1401 while (terminal_app_get_profile_by_name (app, profile_name) != NULL((void*)0));
1402
1403 /* Now we have an unused profile name */
1404 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (base_profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((base_profile
)))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
1405
1406 params = g_newa (GParameter, n_pspecs)((GParameter*) __builtin_alloca (sizeof (GParameter) * (gsize
) (n_pspecs)))
;
1407 n_params = 0;
1408
1409 for (i = 0; i < n_pspecs; ++i)
1410 {
1411 GParamSpec *pspec = pspecs[i];
1412 GValue *value;
1413
1414 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) ||
1415 (pspec->flags & G_PARAM_WRITABLE) == 0)
1416 continue;
1417
1418 params[n_params].name = pspec->name;
1419
1420 value = &params[n_params].value;
1421 G_VALUE_TYPE (value)(((GValue*) (value))->g_type) = 0;
1422 g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
1423
1424 if (pspec->name == I_(TERMINAL_PROFILE_NAME)g_intern_static_string ("name"))
1425 g_value_set_static_string (value, profile_name);
1426 else if (pspec->name == I_(TERMINAL_PROFILE_VISIBLE_NAME)g_intern_static_string ("visible-name"))
1427 g_value_set_static_string (value, visible_name);
1428 else
1429 g_object_get_property (base_object, pspec->name, value);
1430
1431 ++n_params;
1432 }
1433
1434 new_profile = g_object_newv (TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()), n_params, params);
1435
1436 g_object_unref (base_profile);
1437
1438 for (i = 0; i < n_params; ++i)
1439 g_value_unset (&params[i].value);
1440
1441 /* Flush the new profile to GSettings */
1442 new_priv = new_profile->priv;
1443
1444 g_slist_free (new_priv->dirty_pspecs);
1445 new_priv->dirty_pspecs = NULL((void*)0);
1446 if (new_priv->save_idle_id != 0)
1447 {
1448 g_source_remove (new_priv->save_idle_id);
1449 new_priv->save_idle_id = 0;
1450 }
1451
1452 for (i = 0; i < n_pspecs; ++i)
1453 {
1454 GParamSpec *pspec = pspecs[i];
1455
1456 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) ||
1457 (pspec->flags & G_PARAM_WRITABLE) == 0)
1458 continue;
1459
1460 new_priv->dirty_pspecs = g_slist_prepend (new_priv->dirty_pspecs, pspec);
1461 }
1462 g_free (pspecs);
1463
1464 terminal_profile_save (new_profile);
1465
1466 return new_profile;
1467}
1468
1469/* Public API */
1470
1471gboolean
1472terminal_profile_get_property_boolean (TerminalProfile *profile,
1473 const char *prop_name)
1474{
1475 const GValue *value;
1476
1477 value = get_prop_value_from_prop_name (profile, prop_name);
1478 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_BOOLEAN (value), FALSE)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((5) << (2)))); gboolean __r; if (!__val) __r = (0); else
if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_BOOLEAN (value)"
); return ((0)); } } while (0)
;
1479 if (!value || !G_VALUE_HOLDS_BOOLEAN (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((5) << (2)))); gboolean __r;
if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1480 return FALSE(0);
1481
1482 return g_value_get_boolean (value);
1483}
1484
1485gconstpointer
1486terminal_profile_get_property_boxed (TerminalProfile *profile,
1487 const char *prop_name)
1488{
1489 const GValue *value;
1490
1491 value = get_prop_value_from_prop_name (profile, prop_name);
1492 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_BOXED (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((18) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_BOXED (value)"
); return (((void*)0)); } } while (0)
;
1493 if (!value || !G_VALUE_HOLDS_BOXED (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((18) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1494 return NULL((void*)0);
1495
1496 return g_value_get_boxed (value);
1497}
1498
1499double
1500terminal_profile_get_property_double (TerminalProfile *profile,
1501 const char *prop_name)
1502{
1503 const GValue *value;
1504
1505 value = get_prop_value_from_prop_name (profile, prop_name);
1506 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_DOUBLE (value), 0.0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((15) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_DOUBLE (value)"
); return (0.0); } } while (0)
;
1507 if (!value || !G_VALUE_HOLDS_DOUBLE (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((15) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1508 return 0.0;
1509
1510 return g_value_get_double (value);
1511}
1512
1513int
1514terminal_profile_get_property_enum (TerminalProfile *profile,
1515 const char *prop_name)
1516{
1517 const GValue *value;
1518
1519 value = get_prop_value_from_prop_name (profile, prop_name);
1520 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_ENUM (value), 0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((12) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_ENUM (value)"
); return (0); } } while (0)
;
1521 if (!value || !G_VALUE_HOLDS_ENUM (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((12) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1522 return 0;
1523
1524 return g_value_get_enum (value);
1525}
1526
1527int
1528terminal_profile_get_property_int (TerminalProfile *profile,
1529 const char *prop_name)
1530{
1531 const GValue *value;
1532
1533 value = get_prop_value_from_prop_name (profile, prop_name);
1534 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_INT (value), 0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((6) << (2)))); gboolean __r; if (!__val) __r = (0); else
if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_INT (value)"
); return (0); } } while (0)
;
1535 if (!value || !G_VALUE_HOLDS_INT (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((6) << (2)))); gboolean __r;
if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1536 return 0;
1537
1538 return g_value_get_int (value);
1539}
1540
1541gpointer
1542terminal_profile_get_property_object (TerminalProfile *profile,
1543 const char *prop_name)
1544{
1545 const GValue *value;
1546
1547 value = get_prop_value_from_prop_name (profile, prop_name);
1548 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_OBJECT (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((20) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_OBJECT (value)"
); return (((void*)0)); } } while (0)
;
1549 if (!value || !G_VALUE_HOLDS_OBJECT (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((20) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1550 return NULL((void*)0);
1551
1552 return g_value_get_object (value);
1553}
1554
1555const char*
1556terminal_profile_get_property_string (TerminalProfile *profile,
1557 const char *prop_name)
1558{
1559 const GValue *value;
1560
1561 value = get_prop_value_from_prop_name (profile, prop_name);
1562 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_STRING (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((16) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_STRING (value)"
); return (((void*)0)); } } while (0)
;
1563 if (!value || !G_VALUE_HOLDS_STRING (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((16) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1564 return NULL((void*)0);
1565
1566 return g_value_get_string (value);
1567}
1568
1569gboolean
1570terminal_profile_property_locked (TerminalProfile *profile,
1571 const char *prop_name)
1572{
1573 TerminalProfilePrivate *priv = profile->priv;
1574 GParamSpec *pspec;
1575
1576 pspec = get_pspec_from_name (profile, prop_name);
1577 g_return_val_if_fail (pspec != NULL, FALSE)do { if ((pspec != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "pspec != NULL");
return ((0)); } } while (0)
;
1578 if (!pspec)
1579 return FALSE(0);
1580
1581 return priv->locked[pspec->param_id];
1582}
1583
1584void
1585terminal_profile_reset_property (TerminalProfile *profile,
1586 const char *prop_name)
1587{
1588 GParamSpec *pspec;
1589
1590 pspec = get_pspec_from_name (profile, prop_name);
1591 g_return_if_fail (pspec != NULL)do { if ((pspec != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "pspec != NULL");
return; } } while (0)
;
1592 if (!pspec ||
1593 (pspec->flags & G_PARAM_WRITABLE) == 0)
1594 return;
1595
1596 terminal_profile_reset_property_internal (profile, pspec, TRUE(!(0)));
1597}
1598
1599gboolean
1600terminal_profile_get_palette (TerminalProfile *profile,
1601 GdkRGBA *colors,
1602 guint *n_colors)
1603{
1604 TerminalProfilePrivate *priv;
1605 GValueArray *array;
1606 guint i, n;
1607
1608 g_return_val_if_fail (TERMINAL_IS_PROFILE (profile), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((profile)); GType __t = ((terminal_profile_get_type ()));
gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class
&& __inst->g_class->g_type == __t) __r = (!(0)
); else __r = g_type_check_instance_is_a (__inst, __t); __r; }
)))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "TERMINAL_IS_PROFILE (profile)"); return
((0)); } } while (0)
;
1609 g_return_val_if_fail (colors != NULL && n_colors != NULL, FALSE)do { if ((colors != ((void*)0) && n_colors != ((void*
)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "colors != NULL && n_colors != NULL"
); return ((0)); } } while (0)
;
1610
1611 priv = profile->priv;
1612 array = g_value_get_boxed (g_value_array_get_nth (priv->properties, PROP_PALETTE));
1613 if (!array)
1614 return FALSE(0);
1615
1616 n = MIN (array->n_values, *n_colors)(((array->n_values) < (*n_colors)) ? (array->n_values
) : (*n_colors))
;
1617 for (i = 0; i < n; ++i)
1618 {
1619 GdkRGBA *color = g_value_get_boxed (g_value_array_get_nth (array, i));
1620 if (!color)
1621 continue; /* shouldn't happen!! */
1622
1623 colors[i] = *color;
1624 }
1625
1626 *n_colors = n;
1627 return TRUE(!(0));
1628}
1629
1630gboolean
1631terminal_profile_get_palette_is_builtin (TerminalProfile *profile,
1632 guint *n)
1633{
1634 GdkRGBA colors[TERMINAL_PALETTE_SIZE16];
1635 guint n_colors;
1636 guint i;
1637
1638 n_colors = G_N_ELEMENTS (colors)(sizeof (colors) / sizeof ((colors)[0]));
1639 if (!terminal_profile_get_palette (profile, colors, &n_colors) ||
1640 n_colors != TERMINAL_PALETTE_SIZE16)
1641 return FALSE(0);
1642
1643 for (i = 0; i < TERMINAL_PALETTE_N_BUILTINS5; ++i)
1644 if (palette_cmp (colors, terminal_palettes[i]))
1645 {
1646 *n = i;
1647 return TRUE(!(0));
1648 }
1649
1650 return FALSE(0);
1651}
1652
1653void
1654terminal_profile_set_palette_builtin (TerminalProfile *profile,
1655 guint n)
1656{
1657 GValue value = { 0, };
1658
1659 g_return_if_fail (n < TERMINAL_PALETTE_N_BUILTINS)do { if ((n < 5)) { } else { g_return_if_fail_warning (((gchar
*) 0), ((const char*) (__func__)), "n < TERMINAL_PALETTE_N_BUILTINS"
); return; } } while (0)
;
1660
1661 g_value_init (&value, G_TYPE_VALUE_ARRAY(g_value_array_get_type ()) GCC warning "Deprecated pre-processor symbol: replace with \"(g_array_get_type ())\""
+
);
1662 set_value_from_palette (&value, terminal_palettes[n], TERMINAL_PALETTE_SIZE16);
1663 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, TERMINAL_PROFILE_PALETTE"palette", &value);
1664 g_value_unset (&value);
1665}
1666
1667gboolean
1668terminal_profile_modify_palette_entry (TerminalProfile *profile,
1669 guint i,
1670 const GdkRGBA *color)
1671{
1672 TerminalProfilePrivate *priv = profile->priv;
1673 GValueArray *array;
1674 GValue *value;
1675 GdkRGBA *old_color;
1676
1677 array = g_value_get_boxed (g_value_array_get_nth (priv->properties, PROP_PALETTE));
1678 if (!array ||
1679 i >= array->n_values)
1680 return FALSE(0);
1681
1682 value = g_value_array_get_nth (array, i);
1683 old_color = g_value_get_boxed (value);
1684 if (!old_color ||
1685 !rgba_equal (old_color, color))
1686 {
1687 g_value_set_boxed (value, color);
1688 g_object_notify (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, TERMINAL_PROFILE_PALETTE"palette");
1689 }
1690
1691 return TRUE(!(0));
1692}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-80c412.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-80c412.html new file mode 100644 index 0000000..e4a342f --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-80c412.html @@ -0,0 +1,2840 @@ + + + +terminal-app.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:terminal-app.c
Warning:line 816, column 39
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name terminal-app.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I .. -I ../src/mate-submodules/libegg -D TERMINAL_COMPILATION -D TERMINAL_RESOURCES_PATH_PREFIX="/org/mate/terminal" -D TERM_DATADIR="/usr/local/share" -D TERM_LOCALEDIR="/usr/local/share/locale" -D TERM_PKGDATADIR="/usr/local/share/mate-terminal" -D TERM_HELPDIR="/usr/local/share/help" -D SN_API_NOT_YET_FROZEN -D GDK_MULTIHEAD_SAFE -D G_DISABLE_SINGLE_INCLUDES -D PANGO_DISABLE_SINGLE_INCLUDES -D ATK_DISABLE_SINGLE_INCLUDES -D GDK_DISABLE_SINGLE_INCLUDES -D GDK_PIXBUF_DISABLE_SINGLE_INCLUDES -D GTK_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c terminal-app.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright © 2001, 2002 Havoc Pennington
3 * Copyright © 2002 Red Hat, Inc.
4 * Copyright © 2002 Sun Microsystems
5 * Copyright © 2003 Mariano Suarez-Alvarez
6 * Copyright © 2008 Christian Persch
7 * Copyright (C) 2012-2021 MATE Developers
8 *
9 * Mate-terminal is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * Mate-terminal is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#include <config.h>
24
25#include <errno(*__errno_location ()).h>
26
27#include <glib.h>
28#include <dconf.h>
29
30#include "terminal-intl.h"
31
32#include "terminal-debug.h"
33#include "terminal-app.h"
34#include "terminal-accels.h"
35#include "terminal-screen.h"
36#include "terminal-screen-container.h"
37#include "terminal-window.h"
38#include "terminal-util.h"
39#include "profile-editor.h"
40#include "terminal-encoding.h"
41#include <string.h>
42#include <stdlib.h>
43
44#ifdef HAVE_SMCLIENT1
45#include "eggsmclient.h"
46#include "eggdesktopfile.h"
47#endif /* HAVE_SMCLIENT */
48
49#define FALLBACK_PROFILE_ID"default" "default"
50
51/* Settings storage works as follows:
52 * /apps/mate-terminal/global/
53 * /apps/mate-terminal/profiles/Foo/
54 *
55 * It's somewhat tricky to manage the profiles/ dir since we need to track
56 * the list of profiles, but GSettings doesn't have a concept of notifying that
57 * a directory has appeared or disappeared.
58 *
59 * Session state is stored entirely in the RestartCommand command line.
60 *
61 * The number one rule: all stored information is EITHER per-session,
62 * per-profile, or set from a command line option. THERE CAN BE NO
63 * OVERLAP. The UI and implementation totally break if you overlap
64 * these categories. See mate-terminal 1.x for why.
65 *
66 * Don't use this code as an example of how to use GSettings - it's hugely
67 * overcomplicated due to the profiles stuff. Most apps should not
68 * have to do scary things of this nature, and should not have
69 * a profiles feature.
70 *
71 */
72
73GSettings *settings_global;
74
75struct _TerminalAppClass
76{
77 GObjectClass parent_class;
78
79 void (* quit) (TerminalApp *app);
80 void (* profile_list_changed) (TerminalApp *app);
81 void (* encoding_list_changed) (TerminalApp *app);
82};
83
84struct _TerminalApp
85{
86 GObject parent_instance;
87
88 GList *windows;
89 GtkWidget *new_profile_dialog;
90 GtkWidget *manage_profiles_dialog;
91 GtkWidget *manage_profiles_list;
92 GtkWidget *manage_profiles_new_button;
93 GtkWidget *manage_profiles_edit_button;
94 GtkWidget *manage_profiles_delete_button;
95 GtkWidget *manage_profiles_default_menu;
96
97 GSettings *settings_font;
98
99 GHashTable *profiles;
100 char* default_profile_id;
101 TerminalProfile *default_profile;
102 gboolean default_profile_locked;
103
104 GHashTable *encodings;
105 gboolean encodings_locked;
106
107 PangoFontDescription *system_font_desc;
108 gboolean enable_mnemonics;
109 gboolean enable_menu_accels;
110};
111
112enum
113{
114 PROP_0,
115 PROP_DEFAULT_PROFILE,
116 PROP_ENABLE_MENU_BAR_ACCEL,
117 PROP_ENABLE_MNEMONICS,
118 PROP_SYSTEM_FONT,
119};
120
121enum
122{
123 QUIT,
124 PROFILE_LIST_CHANGED,
125 ENCODING_LIST_CHANGED,
126 LAST_SIGNAL
127};
128
129static guint signals[LAST_SIGNAL] = { 0 };
130
131enum
132{
133 COL_PROFILE,
134 NUM_COLUMNS
135};
136
137enum
138{
139 SOURCE_DEFAULT = 0,
140 SOURCE_SESSION = 1
141};
142
143static TerminalApp *global_app = NULL((void*)0);
144
145#define MONOSPACE_FONT_SCHEMA"org.mate.interface" "org.mate.interface"
146#define MONOSPACE_FONT_KEY"monospace-font-name" "monospace-font-name"
147#define DEFAULT_MONOSPACE_FONT("Monospace 10") ("Monospace 10")
148
149#define ENABLE_MNEMONICS_KEY"use-mnemonics" "use-mnemonics"
150#define DEFAULT_ENABLE_MNEMONICS((!(0))) (TRUE(!(0)))
151
152#define ENABLE_MENU_BAR_ACCEL_KEY"use-menu-accelerators" "use-menu-accelerators"
153#define DEFAULT_ENABLE_MENU_BAR_ACCEL((!(0))) (TRUE(!(0)))
154
155#define PROFILE_LIST_KEY"profile-list" "profile-list"
156#define DEFAULT_PROFILE_KEY"default-profile" "default-profile"
157
158#define ENCODING_LIST_KEY"active-encodings" "active-encodings"
159
160/* two following functions were copied from libmate-desktop to get rid
161 * of dependency on it
162 *
163 * FIXME: I suspect there's no need for excessive copies, we might use
164 * existing profile list to form GVariant's and write them to GSettings
165 */
166static gboolean
167gsettings_append_strv (GSettings *settings,
168 const gchar *key,
169 const gchar *value)
170{
171 gchar **old;
172 gchar **new;
173 gint size;
174 gboolean retval;
175
176 old = g_settings_get_strv (settings, key);
177
178 for (size = 0; old[size] != NULL((void*)0); size++);
179
180 size += 1; /* appended value */
181 size += 1; /* NULL */
182
183 new = g_realloc_n (old, size, sizeof (gchar *));
184
185 new[size - 2] = g_strdup (value)g_strdup_inline (value);
186 new[size - 1] = NULL((void*)0);
187
188 retval = g_settings_set_strv (settings, key,
189 (const gchar **) new);
190
191 g_strfreev (new);
192
193 return retval;
194}
195
196static gboolean
197gsettings_remove_all_from_strv (GSettings *settings,
198 const gchar *key,
199 const gchar *value)
200{
201 GArray *array;
202 gchar **old;
203 gint i;
204 gboolean retval;
205
206 old = g_settings_get_strv (settings, key);
207 array = g_array_new (TRUE(!(0)), TRUE(!(0)), sizeof (gchar *));
208
209 for (i = 0; old[i] != NULL((void*)0); i++) {
210 if (g_strcmp0 (old[i], value) != 0)
211 array = g_array_append_val (array, old[i])g_array_append_vals (array, &(old[i]), 1);
212 }
213
214 retval = g_settings_set_strv (settings, key,
215 (const gchar **) array->data);
216
217 g_strfreev (old);
218 g_array_free (array, TRUE(!(0)));
219
220 return retval;
221}
222
223/* Helper functions */
224
225static GdkScreen*
226terminal_app_get_screen_by_display_name (const char *display_name)
227{
228 GdkDisplay *display = NULL((void*)0);
229 GdkScreen *screen = NULL((void*)0);
230
231 if (display_name == NULL((void*)0))
232 display = gdk_display_get_default ();
233 else
234 {
235 GSList *displays, *l;
236 const char *period;
237
238 period = strrchr (display_name, '.');
239 displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
240 for (l = displays; l != NULL((void*)0); l = l->next)
241 {
242 GdkDisplay *disp = l->data;
243
244 /* compare without the screen number part, if present */
245 if ((period && strncmp (gdk_display_get_name (disp), display_name, period - display_name) == 0) ||
246 (period == NULL((void*)0) && strcmp (gdk_display_get_name (disp), display_name) == 0))
247 {
248 display = disp;
249 break;
250 }
251 }
252 g_slist_free (displays);
253
254 if (display == NULL((void*)0))
255 display = gdk_display_open (display_name); /* FIXME we never close displays */
256 }
257
258 if (display == NULL((void*)0))
259 return NULL((void*)0);
260 else
261 screen = gdk_display_get_default_screen (display);
262
263 return screen;
264}
265
266static int
267terminal_app_get_workspace_for_window (TerminalWindow *window)
268{
269 int ret = -1;
270 guchar *data = NULL((void*)0);
271 GdkAtom atom;
272 GdkAtom cardinal_atom;
273
274 atom = gdk_atom_intern_static_string ("_NET_WM_DESKTOP");
275 cardinal_atom = gdk_atom_intern_static_string ("CARDINAL");
276
277 gdk_property_get (gtk_widget_get_window(GTK_WIDGET(window)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_widget_get_type ()))))))
),
278 atom, cardinal_atom, 0, 8, FALSE(0),
279 NULL((void*)0), NULL((void*)0), NULL((void*)0), &data);
280
281 if (data)
282 ret = *(int *)data;
283
284 g_free (data);
285 return ret;
286}
287
288/* Menubar mnemonics settings handling */
289
290static int
291profiles_alphabetic_cmp (gconstpointer pa,
292 gconstpointer pb)
293{
294 TerminalProfile *a = (TerminalProfile *) pa;
295 TerminalProfile *b = (TerminalProfile *) pb;
296 int result;
297
298 result = g_utf8_collate (terminal_profile_get_property_string (a, TERMINAL_PROFILE_VISIBLE_NAME"visible-name"),
299 terminal_profile_get_property_string (b, TERMINAL_PROFILE_VISIBLE_NAME"visible-name"));
300 if (result == 0)
301 result = strcmp (terminal_profile_get_property_string (a, TERMINAL_PROFILE_NAME"name"),
302 terminal_profile_get_property_string (b, TERMINAL_PROFILE_NAME"name"));
303
304 return result;
305}
306
307typedef struct
308{
309 TerminalProfile *result;
310 const char *target;
311} LookupInfo;
312
313static void
314profiles_lookup_by_visible_name_foreach (gpointer key,
315 gpointer value,
316 gpointer data)
317{
318 LookupInfo *info = data;
319 const char *name;
320
321 name = terminal_profile_get_property_string (value, TERMINAL_PROFILE_VISIBLE_NAME"visible-name");
322 if (name && strcmp (info->target, name) == 0)
323 info->result = value;
324}
325
326static void
327terminal_window_destroyed (TerminalWindow *window,
328 TerminalApp *app)
329{
330 app->windows = g_list_remove (app->windows, window);
331
332 if (app->windows == NULL((void*)0))
333 g_signal_emit (app, signals[QUIT], 0);
334}
335
336static TerminalProfile *
337terminal_app_create_profile (TerminalApp *app,
338 const char *name)
339{
340 TerminalProfile *profile;
341
342 g_assert (terminal_app_get_profile_by_name (app, name) == NULL)do { if (terminal_app_get_profile_by_name (app, name) == ((void
*)0)) ; else g_assertion_message_expr (((gchar*) 0), "terminal-app.c"
, 342, ((const char*) (__func__)), "terminal_app_get_profile_by_name (app, name) == NULL"
); } while (0)
;
343
344 profile = _terminal_profile_new (name);
345
346 g_hash_table_insert (app->profiles,
347 g_strdup (terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME))g_strdup_inline (terminal_profile_get_property_string (profile
, "name"))
,
348 profile /* adopts the refcount */);
349
350 if (app->default_profile == NULL((void*)0) &&
351 app->default_profile_id != NULL((void*)0) &&
352 strcmp (app->default_profile_id,
353 terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name")) == 0)
354 {
355 /* We are the default profile */
356 app->default_profile = profile;
357 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
358 }
359
360 return profile;
361}
362
363static void
364terminal_app_delete_profile (TerminalProfile *profile)
365{
366 const char *profile_name;
367 char *profile_dir;
368 GError *error = NULL((void*)0);
369
370 profile_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name");
371 profile_dir = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", profile_name, "/", NULL((void*)0));
372
373 gsettings_remove_all_from_strv (settings_global, PROFILE_LIST_KEY"profile-list", profile_name);
374
375 /* And remove the profile directory */
376 DConfClient *client = dconf_client_new ();
377 if (!dconf_client_write_sync (client, profile_dir, NULL((void*)0), NULL((void*)0), NULL((void*)0), &error))
378 {
379 g_warning ("Failed to recursively unset %s: %s\n", profile_dir, error->message);
380 g_error_free (error);
381 }
382
383 g_object_unref (client);
384 g_free (profile_dir);
385}
386
387static void
388terminal_app_profile_cell_data_func (GtkTreeViewColumn *tree_column,
389 GtkCellRenderer *cell,
390 GtkTreeModel *tree_model,
391 GtkTreeIter *iter,
392 gpointer data)
393{
394 TerminalProfile *profile;
395 GValue value = { 0, };
396
397 gtk_tree_model_get (tree_model, iter, (int) COL_PROFILE, &profile, (int) -1);
398
399 g_value_init (&value, G_TYPE_STRING((GType) ((16) << (2))));
400 g_object_get_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, "visible-name", &value);
401 g_object_set_property (G_OBJECT (cell)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cell)), (((GType) ((20) << (2))))))))
, "text", &value);
402 g_value_unset (&value);
403}
404
405static int
406terminal_app_profile_sort_func (GtkTreeModel *model,
407 GtkTreeIter *a,
408 GtkTreeIter *b,
409 gpointer user_data)
410{
411 TerminalProfile *profile_a, *profile_b;
412 int retval;
413
414 gtk_tree_model_get (model, a, (int) COL_PROFILE, &profile_a, (int) -1);
415 gtk_tree_model_get (model, b, (int) COL_PROFILE, &profile_b, (int) -1);
416
417 retval = profiles_alphabetic_cmp (profile_a, profile_b);
418
419 g_object_unref (profile_a);
420 g_object_unref (profile_b);
421
422 return retval;
423}
424
425static /* ref */ GtkTreeModel *
426terminal_app_get_profile_liststore (TerminalApp *app,
427 TerminalProfile *selected_profile,
428 GtkTreeIter *selected_profile_iter,
429 gboolean *selected_profile_iter_set)
430{
431 GtkListStore *store;
432 GtkTreeIter iter;
433 GList *profiles, *l;
434
435 store = gtk_list_store_new (NUM_COLUMNS, TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()));
436
437 *selected_profile_iter_set = FALSE(0);
438
439 if (selected_profile &&
440 _terminal_profile_get_forgotten (selected_profile))
441 selected_profile = NULL((void*)0);
442
443 profiles = terminal_app_get_profile_list (app);
444
445 for (l = profiles; l != NULL((void*)0); l = l->next)
446 {
447 TerminalProfile *profile = TERMINAL_PROFILE (l->data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((terminal_profile_get_type ()))))))
;
448
449 gtk_list_store_insert_with_values (store, &iter, 0,
450 (int) COL_PROFILE, profile,
451 (int) -1);
452
453 if (selected_profile_iter && profile == selected_profile)
454 {
455 *selected_profile_iter = iter;
456 *selected_profile_iter_set = TRUE(!(0));
457 }
458 }
459 g_list_free (profiles);
460
461 /* Now turn on sorting */
462 gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (store)((((GtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((gtk_tree_sortable_get_type ()))))))
,
463 COL_PROFILE,
464 terminal_app_profile_sort_func,
465 NULL((void*)0), NULL((void*)0));
466 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store)((((GtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((gtk_tree_sortable_get_type ()))))))
,
467 COL_PROFILE, GTK_SORT_ASCENDING);
468
469 return GTK_TREE_MODEL (store)((((GtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((gtk_tree_model_get_type ()))))))
;
470}
471
472static /* ref */ TerminalProfile*
473profile_combo_box_get_selected (GtkWidget *widget)
474{
475 GtkComboBox *combo = GTK_COMBO_BOX (widget)((((GtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_combo_box_get_type ()))))))
;
476 TerminalProfile *profile = NULL((void*)0);
477 GtkTreeIter iter;
478
479 if (gtk_combo_box_get_active_iter (combo, &iter))
480 gtk_tree_model_get (gtk_combo_box_get_model (combo), &iter,
481 (int) COL_PROFILE, &profile, (int) -1);
482
483 return profile;
484}
485
486static void
487profile_combo_box_refill (TerminalApp *app,
488 GtkWidget *widget)
489{
490 GtkComboBox *combo = GTK_COMBO_BOX (widget)((((GtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_combo_box_get_type ()))))))
;
491 GtkTreeIter iter;
492 gboolean iter_set;
493 TerminalProfile *selected_profile;
494 GtkTreeModel *model;
495
496 selected_profile = profile_combo_box_get_selected (widget);
497 if (!selected_profile)
498 {
499 selected_profile = terminal_app_get_default_profile (app);
500 if (selected_profile)
501 g_object_ref (selected_profile)((__typeof__ (selected_profile)) (g_object_ref) (selected_profile
))
;
502 }
503
504 model = terminal_app_get_profile_liststore (app,
505 selected_profile,
506 &iter,
507 &iter_set);
508 gtk_combo_box_set_model (combo, model);
509 g_object_unref (model);
510
511 if (iter_set)
512 gtk_combo_box_set_active_iter (combo, &iter);
513
514 if (selected_profile)
515 g_object_unref (selected_profile);
516}
517
518static GtkWidget*
519profile_combo_box_new (TerminalApp *app)
520{
521 GtkWidget *combo;
522 GtkCellRenderer *renderer;
523
524 combo = gtk_combo_box_new ();
525 terminal_util_set_atk_name_description (combo, NULL((void*)0), _("Click button to choose profile")gettext ("Click button to choose profile"));
526
527 renderer = gtk_cell_renderer_text_new ();
528 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((gtk_cell_layout_get_type ()))))))
, renderer, TRUE(!(0)));
529 gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((gtk_cell_layout_get_type ()))))))
, renderer,
530 (GtkCellLayoutDataFunc) terminal_app_profile_cell_data_func,
531 NULL((void*)0), NULL((void*)0));
532
533 profile_combo_box_refill (app, combo);
534 g_signal_connect (app, "profile-list-changed",g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_combo_box_refill))), (combo), ((void*)0), (GConnectFlags
) 0)
535 G_CALLBACK (profile_combo_box_refill), combo)g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_combo_box_refill))), (combo), ((void*)0), (GConnectFlags
) 0)
;
536
537 gtk_widget_show (combo);
538 return combo;
539}
540
541static void
542profile_combo_box_changed_cb (GtkWidget *widget,
543 TerminalApp *app)
544{
545 TerminalProfile *profile;
546
547 profile = profile_combo_box_get_selected (widget);
548 if (!profile)
549 return;
550
551 g_settings_set_string (settings_global, DEFAULT_PROFILE_KEY"default-profile",
552 terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name"));
553
554 /* Even though the GSettings change notification does this, it happens too late.
555 * In some cases, the default profile changes twice in quick succession,
556 * and update_default_profile must be called in sync with those changes.
557 */
558 app->default_profile = profile;
559
560 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
561
562 g_object_unref (profile);
563}
564
565static void
566profile_list_treeview_refill (TerminalApp *app,
567 GtkWidget *widget)
568{
569 GtkTreeView *tree_view = GTK_TREE_VIEW (widget)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_tree_view_get_type ()))))))
;
570 GtkTreeIter iter;
571 gboolean iter_set;
572 GtkTreeSelection *selection;
573 GtkTreeModel *model;
574 TerminalProfile *selected_profile = NULL((void*)0);
575
576 model = gtk_tree_view_get_model (tree_view);
577
578 selection = gtk_tree_view_get_selection (tree_view);
579 if (gtk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
580 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
581
582 model = terminal_app_get_profile_liststore (terminal_app_get (),
583 selected_profile,
584 &iter,
585 &iter_set);
586 gtk_tree_view_set_model (tree_view, model);
587 g_object_unref (model);
588
589 if (!iter_set)
590 iter_set = gtk_tree_model_get_iter_first (model, &iter);
591
592 if (iter_set)
593 gtk_tree_selection_select_iter (selection, &iter);
594
595 if (selected_profile)
596 g_object_unref (selected_profile);
597}
598
599static GtkWidget*
600profile_list_treeview_create (TerminalApp *app)
601{
602 GtkWidget *tree_view;
603 GtkTreeSelection *selection;
604 GtkCellRenderer *renderer;
605 GtkTreeViewColumn *column;
606
607 tree_view = gtk_tree_view_new ();
608 terminal_util_set_atk_name_description (tree_view, _("Profile list")gettext ("Profile list"), NULL((void*)0));
609 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
, FALSE(0));
610
611 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
);
612 gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection)((((GtkTreeSelection*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((selection)), ((gtk_tree_selection_get_type (
)))))))
,
613 GTK_SELECTION_BROWSE);
614
615 column = gtk_tree_view_column_new ();
616 renderer = gtk_cell_renderer_text_new ();
617 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (column)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((column)), ((gtk_cell_layout_get_type ()))))))
, renderer, TRUE(!(0)));
618 gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (column)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((column)), ((gtk_cell_layout_get_type ()))))))
, renderer,
619 (GtkCellLayoutDataFunc) terminal_app_profile_cell_data_func,
620 NULL((void*)0), NULL((void*)0));
621 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
,
622 GTK_TREE_VIEW_COLUMN (column)((((GtkTreeViewColumn*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((column)), ((gtk_tree_view_column_get_type (
)))))))
);
623
624 return tree_view;
625}
626
627static void
628profile_list_delete_confirm_response_cb (GtkWidget *dialog,
629 int response)
630{
631 TerminalProfile *profile;
632
633 profile = TERMINAL_PROFILE (g_object_get_data (G_OBJECT (dialog), "profile"))((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_get_data (((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((dialog)), (((GType) ((20) << (2)))
))))), "profile"))), ((terminal_profile_get_type ()))))))
;
634 g_assert (profile != NULL)do { if (profile != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 634, ((const char*) (__func__
)), "profile != NULL"); } while (0)
;
635
636 if (response == GTK_RESPONSE_ACCEPT)
637 terminal_app_delete_profile (profile);
638
639 gtk_widget_destroy (dialog);
640}
641
642static void
643mate_dialog_add_button (GtkDialog *dialog,
644 const gchar *button_text,
645 const gchar *icon_name,
646 gint response_id)
647{
648 GtkWidget *button;
649
650 button = gtk_button_new_with_mnemonic (button_text);
651 gtk_button_set_image (GTK_BUTTON (button)((((GtkButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_button_get_type ()))))))
, gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON));
652
653 gtk_button_set_use_underline (GTK_BUTTON (button)((((GtkButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_button_get_type ()))))))
, TRUE(!(0)));
654 gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button");
655 gtk_widget_set_can_default (button, TRUE(!(0)));
656 gtk_widget_show (button);
657 gtk_dialog_add_action_widget (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
, button, response_id);
658}
659
660static void
661profile_list_delete_button_clicked_cb (GtkWidget *button,
662 GtkWidget *widget)
663{
664 GtkTreeView *tree_view = GTK_TREE_VIEW (widget)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_tree_view_get_type ()))))))
;
665 GtkTreeSelection *selection;
666 GtkWidget *dialog;
667 GtkTreeIter iter;
668 GtkTreeModel *model;
669 TerminalProfile *selected_profile;
670 GtkWidget *transient_parent;
671
672 model = gtk_tree_view_get_model (tree_view);
673 selection = gtk_tree_view_get_selection (tree_view);
674
675 if (!gtk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
676 return;
677
678 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
679
680 transient_parent = gtk_widget_get_toplevel (widget);
681 dialog = gtk_message_dialog_new (GTK_WINDOW (transient_parent)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((transient_parent)), ((gtk_window_get_type ()))))))
,
682 GTK_DIALOG_DESTROY_WITH_PARENT,
683 GTK_MESSAGE_QUESTION,
684 GTK_BUTTONS_NONE,
685 _("Delete profile “%s”?")gettext ("Delete profile “%s”?"),
686 terminal_profile_get_property_string (selected_profile, TERMINAL_PROFILE_VISIBLE_NAME"visible-name"));
687
688 mate_dialog_add_button (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
,
689 _("_Cancel")gettext ("_Cancel"),
690 "process-stop",
691 GTK_RESPONSE_REJECT);
692
693 mate_dialog_add_button (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
,
694 _("_Delete")gettext ("_Delete"),
695 "edit-delete",
696 GTK_RESPONSE_ACCEPT);
697
698 gtk_dialog_set_default_response (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
,
699 GTK_RESPONSE_ACCEPT);
700
701 gtk_window_set_title (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
, _("Delete Profile")gettext ("Delete Profile"));
702 gtk_window_set_resizable (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
, FALSE(0));
703
704 /* Transfer refcount of |selected_profile|, so no unref below */
705 g_object_set_data_full (G_OBJECT (dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), (((GType) ((20) << (2))))))))
, "profile", selected_profile, g_object_unref);
706
707 g_signal_connect (dialog, "response",g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_delete_confirm_response_cb))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
708 G_CALLBACK (profile_list_delete_confirm_response_cb),g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_delete_confirm_response_cb))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
709 NULL)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_delete_confirm_response_cb))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
;
710
711 gtk_window_present (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
);
712}
713
714static void
715profile_list_new_button_clicked_cb (GtkWidget *button,
716 gpointer data)
717{
718 TerminalApp *app;
719
720 app = terminal_app_get ();
721 terminal_app_new_profile (app, NULL((void*)0), GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
);
722}
723
724static void
725profile_list_edit_button_clicked_cb (GtkWidget *button,
726 GtkWidget *widget)
727{
728 GtkTreeView *tree_view = GTK_TREE_VIEW (widget)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_tree_view_get_type ()))))))
;
729 GtkTreeSelection *selection;
730 GtkTreeIter iter;
731 GtkTreeModel *model;
732 TerminalProfile *selected_profile;
733 TerminalApp *app;
734
735 app = terminal_app_get ();
736
737 model = gtk_tree_view_get_model (tree_view);
738 selection = gtk_tree_view_get_selection (tree_view);
739
740 if (!gtk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
741 return;
742
743 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
744
745 terminal_app_edit_profile (app, selected_profile,
746 GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
,
747 NULL((void*)0));
748 g_object_unref (selected_profile);
749}
750
751static void
752profile_list_row_activated_cb (GtkTreeView *tree_view,
753 GtkTreePath *path,
754 GtkTreeViewColumn *column,
755 gpointer data)
756{
757 GtkTreeIter iter;
758 GtkTreeModel *model;
759 TerminalProfile *selected_profile;
760 TerminalApp *app;
761
762 app = terminal_app_get ();
763
764 model = gtk_tree_view_get_model (tree_view);
765
766 if (!gtk_tree_model_get_iter (model, &iter, path))
767 return;
768
769 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
770
771 terminal_app_edit_profile (app, selected_profile,
772 GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
,
773 NULL((void*)0));
774 g_object_unref (selected_profile);
775}
776
777static GList*
778find_profile_link (GList *profiles,
779 const char *name)
780{
781 GList *l;
782
783 for (l = profiles; l != NULL((void*)0); l = l->next)
784 {
785 const char *profile_name;
786
787 profile_name = terminal_profile_get_property_string (TERMINAL_PROFILE (l->data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((terminal_profile_get_type ()))))))
, TERMINAL_PROFILE_NAME"name");
788 if (profile_name && strcmp (profile_name, name) == 0)
789 break;
790 }
791
792 return l;
793}
794
795static void
796terminal_app_profile_list_notify_cb (GSettings *settings,
797 const gchar *key,
798 gpointer user_data)
799{
800 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
801 GObject *object = G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
;
802 GVariant *val;
803 const gchar **value_list;
804 int i;
805 GList *profiles_to_delete, *l;
806 gboolean need_new_default;
807 TerminalProfile *fallback;
808 guint count;
809
810 g_object_freeze_notify (object);
811
812 profiles_to_delete = terminal_app_get_profile_list (app);
813
814 val = g_settings_get_value (settings, key);
815 if (val == NULL((void*)0) ||
816 (!g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY((const GVariantType *) "as")) &&
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
817 !g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s"))))
818 goto ensure_one_profile;
819
820 value_list = g_variant_get_strv (val, NULL((void*)0));
821 if (value_list == NULL((void*)0))
822 goto ensure_one_profile;
823
824 /* Add any new ones */
825 for (i = 0; value_list[i] != NULL((void*)0); ++i)
826 {
827 const char *profile_name = value_list[i];
828 GList *link;
829
830 if (!profile_name)
831 continue;
832
833 link = find_profile_link (profiles_to_delete, profile_name);
834 if (link)
835 /* make profiles_to_delete point to profiles we didn't find in the list */
836 profiles_to_delete = g_list_delete_link (profiles_to_delete, link);
837 else
838 terminal_app_create_profile (app, profile_name);
839 }
840
841 g_free (value_list);
842
843ensure_one_profile:
844
845 if (val != NULL((void*)0))
846 g_variant_unref (val);
847
848 fallback = NULL((void*)0);
849 count = g_hash_table_size (app->profiles);
850 if (count == 0 || count <= g_list_length (profiles_to_delete))
851 {
852 /* We are going to run out, so create the fallback
853 * to be sure we always have one. Must be done
854 * here before we emit "forgotten" signals so that
855 * screens have a profile to fall back to.
856 *
857 * If the profile with the FALLBACK_ID already exists,
858 * we aren't allowed to delete it, unless at least one
859 * other profile will still exist. And if you delete
860 * all profiles, the FALLBACK_ID profile returns as
861 * the living dead.
862 */
863 fallback = terminal_app_get_profile_by_name (app, FALLBACK_PROFILE_ID"default");
864 if (fallback == NULL((void*)0))
865 fallback = terminal_app_create_profile (app, FALLBACK_PROFILE_ID"default");
866 g_assert (fallback != NULL)do { if (fallback != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 866, ((const char*) (__func__
)), "fallback != NULL"); } while (0)
;
867 }
868
869 /* Forget no-longer-existing profiles */
870 need_new_default = FALSE(0);
871 for (l = profiles_to_delete; l != NULL((void*)0); l = l->next)
872 {
873 TerminalProfile *profile = TERMINAL_PROFILE (l->data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((terminal_profile_get_type ()))))))
;
874 const char *name;
875
876 name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name");
877 if (strcmp (name, FALLBACK_PROFILE_ID"default") == 0)
878 continue;
879
880 if (profile == app->default_profile)
881 {
882 app->default_profile = NULL((void*)0);
883 need_new_default = TRUE(!(0));
884 }
885
886 _terminal_profile_forget (profile);
887 g_hash_table_remove (app->profiles, name);
888
889 /* |profile| possibly isn't dead yet since the profiles dialogue's tree model holds a ref too... */
890 }
891 g_list_free (profiles_to_delete);
892
893 if (need_new_default)
894 {
895 TerminalProfile *new_default;
896 TerminalProfile **new_default_ptr = &new_default;
897
898 new_default = terminal_app_get_profile_by_name (app, FALLBACK_PROFILE_ID"default");
899 if (new_default == NULL((void*)0))
900 {
901 GHashTableIter iter;
902
903 g_hash_table_iter_init (&iter, app->profiles);
904 if (!g_hash_table_iter_next (&iter, NULL((void*)0), (gpointer *) new_default_ptr))
905 /* shouldn't really happen ever, but just to be safe */
906 new_default = terminal_app_create_profile (app, FALLBACK_PROFILE_ID"default");
907 }
908 g_assert (new_default != NULL)do { if (new_default != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 908, ((const char*) (__func__
)), "new_default != NULL"); } while (0)
;
909
910 app->default_profile = new_default;
911
912 g_object_notify (object, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
913 }
914
915 g_assert (g_hash_table_size (app->profiles) > 0)do { if (g_hash_table_size (app->profiles) > 0) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 915, ((const char*) (__func__
)), "g_hash_table_size (app->profiles) > 0"); } while (
0)
;
916
917 g_signal_emit (app, signals[PROFILE_LIST_CHANGED], 0);
918
919 g_object_thaw_notify (object);
920}
921
922static void
923terminal_app_default_profile_notify_cb (GSettings *settings,
924 const gchar *key,
925 gpointer user_data)
926{
927 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
928 GVariant *val;
929 const char *name = NULL((void*)0);
930
931 app->default_profile_locked = !g_settings_is_writable (settings, key);
932
933 val = g_settings_get_value (settings, key);
934 if (val != NULL((void*)0) &&
935 g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
936 name = g_variant_get_string (val, NULL((void*)0));
937 if (!name || !name[0])
938 name = FALLBACK_PROFILE_ID"default";
939 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-app.c", 939, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
940
941 g_free (app->default_profile_id);
942 app->default_profile_id = g_strdup (name)g_strdup_inline (name);
943
944 app->default_profile = terminal_app_get_profile_by_name (app, name);
945
946 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
947 g_variant_unref (val);
948}
949
950static int
951compare_encodings (TerminalEncoding *a,
952 TerminalEncoding *b)
953{
954 return g_utf8_collate (a->name, b->name);
955}
956
957static void
958encoding_mark_active (gpointer key,
959 gpointer value,
960 gpointer data)
961{
962 TerminalEncoding *encoding = (TerminalEncoding *) value;
963 guint active = GPOINTER_TO_UINT (data)((guint) (gulong) (data));
964
965 encoding->is_active = active;
966}
967
968static void
969terminal_app_encoding_list_notify_cb (GSettings *settings,
970 const gchar *key,
971 gpointer user_data)
972{
973 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
974 GVariant *val;
975 const gchar **strings;
976 int i;
977 TerminalEncoding *encoding;
978 const char *charset;
979
980 app->encodings_locked = !g_settings_is_writable (settings, key);
981
982 /* Mark all as non-active, then re-enable the active ones */
983 g_hash_table_foreach (app->encodings, (GHFunc) encoding_mark_active, GUINT_TO_POINTER (FALSE)((gpointer) (gulong) ((0))));
984
985 /* First add the locale's charset */
986 encoding = g_hash_table_lookup (app->encodings, "current");
987 g_assert (encoding)do { if (encoding) ; else g_assertion_message_expr (((gchar*)
0), "terminal-app.c", 987, ((const char*) (__func__)), "encoding"
); } while (0)
;
988 if (terminal_encoding_is_valid (encoding))
989 encoding->is_active = TRUE(!(0));
990
991 /* Also always make UTF-8 available */
992 encoding = g_hash_table_lookup (app->encodings, "UTF-8");
993 g_assert (encoding)do { if (encoding) ; else g_assertion_message_expr (((gchar*)
0), "terminal-app.c", 993, ((const char*) (__func__)), "encoding"
); } while (0)
;
994 if (terminal_encoding_is_valid (encoding))
995 encoding->is_active = TRUE(!(0));
996
997 val = g_settings_get_value (settings, key);
998 if (val != NULL((void*)0) &&
999 g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY((const GVariantType *) "as")))
1000 strings = g_variant_get_strv (val, NULL((void*)0));
1001 else
1002 strings = NULL((void*)0);
1003
1004 if (strings != NULL((void*)0))
1005 {
1006 for (i = 0; strings[i] != NULL((void*)0); ++i)
1007 {
1008 charset = strings[i];
1009 if (!charset)
1010 continue;
1011
1012 encoding = terminal_app_ensure_encoding (app, charset);
1013 if (!terminal_encoding_is_valid (encoding))
1014 continue;
1015
1016 encoding->is_active = TRUE(!(0));
1017 }
1018
1019 g_free (strings);
1020 }
1021
1022 g_signal_emit (app, signals[ENCODING_LIST_CHANGED], 0);
1023
1024 if (val != NULL((void*)0))
1025 g_variant_unref (val);
1026}
1027
1028static void
1029terminal_app_system_font_notify_cb (GSettings *settings,
1030 const gchar *key,
1031 gpointer user_data)
1032{
1033 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
1034 GVariant *val;
1035 const char *font = NULL((void*)0);
1036 PangoFontDescription *font_desc;
1037
1038 if (strcmp (key, MONOSPACE_FONT_KEY"monospace-font-name") != 0)
1039 return;
1040
1041 val = g_settings_get_value (settings, key);
1042 if (val &&
1043 g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
1044 font = g_variant_get_string (val, NULL((void*)0));
1045 if (!font)
1046 font = DEFAULT_MONOSPACE_FONT("Monospace 10");
1047 g_assert (font != NULL)do { if (font != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-app.c", 1047, ((const char*) (__func__
)), "font != NULL"); } while (0)
;
1048
1049 if (font && (strlen (font) == 0)) /* empty string */
1050 font = DEFAULT_MONOSPACE_FONT("Monospace 10");
1051
1052 font_desc = pango_font_description_from_string (font);
1053 if (app->system_font_desc &&
1054 pango_font_description_equal (app->system_font_desc, font_desc))
1055 {
1056 pango_font_description_free (font_desc);
1057 return;
1058 }
1059
1060 if (app->system_font_desc)
1061 pango_font_description_free (app->system_font_desc);
1062
1063 app->system_font_desc = font_desc;
1064
1065 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_SYSTEM_FONT"system-font");
1066 g_variant_unref (val);
1067}
1068
1069static void
1070terminal_app_enable_mnemonics_notify_cb (GSettings *settings,
1071 const gchar *key,
1072 gpointer user_data)
1073{
1074 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
1075 gboolean enable;
1076
1077 enable = g_settings_get_boolean (settings, key);
1078 if (enable == app->enable_mnemonics)
1079 return;
1080
1081 app->enable_mnemonics = enable;
1082 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_ENABLE_MNEMONICS"enable-mnemonics");
1083}
1084
1085static void
1086terminal_app_enable_menu_accels_notify_cb (GSettings *settings,
1087 const gchar *key,
1088 gpointer user_data)
1089{
1090 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
1091 gboolean enable;
1092
1093 enable = g_settings_get_boolean (settings, key);
1094 if (enable == app->enable_menu_accels)
1095 return;
1096
1097 app->enable_menu_accels = enable;
1098 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_ENABLE_MENU_BAR_ACCEL"enable-menu-accels");
1099}
1100
1101static void
1102new_profile_response_cb (GtkWidget *new_profile_dialog,
1103 int response_id,
1104 TerminalApp *app)
1105{
1106 if (response_id == GTK_RESPONSE_ACCEPT)
1107 {
1108 GtkWidget *name_entry;
1109 char *name;
1110 const char *new_profile_name;
1111 GtkWidget *base_option_menu;
1112 TerminalProfile *base_profile = NULL((void*)0);
1113 TerminalProfile *new_profile;
1114 GList *profiles;
1115 GList *tmp;
1116 GtkWindow *transient_parent;
1117 GtkWidget *confirm_dialog;
1118 gint retval;
1119
1120 base_option_menu = g_object_get_data (G_OBJECT (new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), (((GType) ((20) << (2)))))))
)
, "base_option_menu");
1121 base_profile = profile_combo_box_get_selected (base_option_menu);
1122 if (!base_profile)
1123 base_profile = terminal_app_get_default_profile (app);
1124 if (!base_profile)
1125 return; /* shouldn't happen ever though */
1126
1127 name_entry = g_object_get_data (G_OBJECT (new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), (((GType) ((20) << (2)))))))
)
, "name_entry");
1128 name = gtk_editable_get_chars (GTK_EDITABLE (name_entry)((((GtkEditable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((name_entry)), ((gtk_editable_get_type ()))))))
, 0, -1);
1129 g_strstrip (name)g_strchomp (g_strchug (name)); /* name will be non empty after stripping */
1130
1131 profiles = terminal_app_get_profile_list (app);
1132 for (tmp = profiles; tmp != NULL((void*)0); tmp = tmp->next)
1133 {
1134 TerminalProfile *profile = tmp->data;
1135 const char *visible_name;
1136
1137 visible_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_VISIBLE_NAME"visible-name");
1138
1139 if (visible_name && strcmp (name, visible_name) == 0)
1140 break;
1141 }
1142 if (tmp)
1143 {
1144 confirm_dialog = gtk_message_dialog_new (GTK_WINDOW (new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), ((gtk_window_get_type ()))))))
,
1145 GTK_DIALOG_DESTROY_WITH_PARENT,
1146 GTK_MESSAGE_QUESTION,
1147 GTK_BUTTONS_YES_NO,
1148 _("You already have a profile called “%s”. Do you want to create another profile with the same name?")gettext ("You already have a profile called “%s”. Do you want to create another profile with the same name?"
)
, name);
1149 /* Alternative button order was set automatically by GtkMessageDialog */
1150 retval = gtk_dialog_run (GTK_DIALOG (confirm_dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((confirm_dialog)), ((gtk_dialog_get_type ()))))))
);
1151 gtk_widget_destroy (confirm_dialog);
1152 if (retval == GTK_RESPONSE_NO)
1153 goto cleanup;
1154 }
1155 g_list_free (profiles);
1156
1157 transient_parent = gtk_window_get_transient_for (GTK_WINDOW (new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), ((gtk_window_get_type ()))))))
);
1158
1159 new_profile = _terminal_profile_clone (base_profile, name);
1160 new_profile_name = terminal_profile_get_property_string (new_profile, TERMINAL_PROFILE_NAME"name");
1161 g_hash_table_insert (app->profiles,
1162 g_strdup (new_profile_name)g_strdup_inline (new_profile_name),
1163 new_profile /* adopts the refcount */);
1164
1165 /* And now save the new profile name to GSettings */
1166 gsettings_append_strv (settings_global,
1167 PROFILE_LIST_KEY"profile-list",
1168 new_profile_name);
1169
1170 terminal_profile_edit (new_profile, transient_parent, NULL((void*)0));
1171
1172cleanup:
1173 g_free (name);
1174 }
1175
1176 gtk_widget_destroy (new_profile_dialog);
1177}
1178
1179static void
1180new_profile_dialog_destroy_cb (GtkWidget *new_profile_dialog,
1181 TerminalApp *app)
1182{
1183 GtkWidget *combo;
1184
1185 combo = g_object_get_data (G_OBJECT (new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), (((GType) ((20) << (2)))))))
)
, "base_option_menu");
1186 g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_combo_box_refill), combo)g_signal_handlers_disconnect_matched ((app), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (profile_combo_box_refill))), (combo))
;
1187
1188 app->new_profile_dialog = NULL((void*)0);
1189}
1190
1191static void
1192new_profile_name_entry_changed_cb (GtkEntry *entry,
1193 GtkDialog *dialog)
1194{
1195 const char *name;
1196
1197 name = gtk_entry_get_text (entry);
1198
1199 /* make the create button sensitive only if something other than space has been set */
1200 while (*name != '\0' && g_ascii_isspace (*name)((g_ascii_table[(guchar) (*name)] & G_ASCII_SPACE) != 0))
1201 ++name;
1202
1203 gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_ACCEPT, name[0] != '\0');
1204}
1205
1206void
1207terminal_app_new_profile (TerminalApp *app,
1208 TerminalProfile *default_base_profile,
1209 GtkWindow *transient_parent)
1210{
1211 if (app->new_profile_dialog == NULL((void*)0))
1212 {
1213 GtkWidget *create_button, *grid, *name_label, *name_entry, *base_label, *combo;
1214
1215 if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX"/org/mate/terminal" G_DIR_SEPARATOR_S"/" "ui/profile-new-dialog.ui",
1216 "new-profile-dialog", &app->new_profile_dialog,
1217 "new-profile-create-button", &create_button,
1218 "new-profile-grid", &grid,
1219 "new-profile-name-label", &name_label,
1220 "new-profile-name-entry", &name_entry,
1221 "new-profile-base-label", &base_label,
1222 NULL((void*)0)))
1223 return;
1224
1225 g_signal_connect (G_OBJECT (app->new_profile_dialog), "response", G_CALLBACK (new_profile_response_cb), app)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((app->new_profile_dialog)), (((GType) (
(20) << (2))))))))), ("response"), (((GCallback) (new_profile_response_cb
))), (app), ((void*)0), (GConnectFlags) 0)
;
1226 g_signal_connect (app->new_profile_dialog, "destroy", G_CALLBACK (new_profile_dialog_destroy_cb), app)g_signal_connect_data ((app->new_profile_dialog), ("destroy"
), (((GCallback) (new_profile_dialog_destroy_cb))), (app), ((
void*)0), (GConnectFlags) 0)
;
1227
1228 g_object_set_data (G_OBJECT (app->new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), (((GType) ((20) << (
2))))))))
, "create_button", create_button);
1229 gtk_widget_set_sensitive (create_button, FALSE(0));
1230
1231 /* the name entry */
1232 g_object_set_data (G_OBJECT (app->new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), (((GType) ((20) << (
2))))))))
, "name_entry", name_entry);
1233 g_signal_connect (name_entry, "changed", G_CALLBACK (new_profile_name_entry_changed_cb), app->new_profile_dialog)g_signal_connect_data ((name_entry), ("changed"), (((GCallback
) (new_profile_name_entry_changed_cb))), (app->new_profile_dialog
), ((void*)0), (GConnectFlags) 0)
;
1234 gtk_entry_set_activates_default (GTK_ENTRY (name_entry)((((GtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((name_entry)), ((gtk_entry_get_type ()))))))
, TRUE(!(0)));
1235 gtk_widget_grab_focus (name_entry);
1236
1237 gtk_label_set_mnemonic_widget (GTK_LABEL (name_label)((((GtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((name_label)), ((gtk_label_get_type ()))))))
, name_entry);
1238
1239 /* the base profile option menu */
1240 combo = profile_combo_box_new (app);
1241 gtk_grid_attach (GTK_GRID (grid)((((GtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((gtk_grid_get_type ()))))))
, combo, 2, 1, 1, 1);
1242 g_object_set_data (G_OBJECT (app->new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), (((GType) ((20) << (
2))))))))
, "base_option_menu", combo);
1243 terminal_util_set_atk_name_description (combo, NULL((void*)0), _("Choose base profile")gettext ("Choose base profile"));
1244
1245 gtk_label_set_mnemonic_widget (GTK_LABEL (base_label)((((GtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((base_label)), ((gtk_label_get_type ()))))))
, combo);
1246
1247 gtk_dialog_set_default_response (GTK_DIALOG (app->new_profile_dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_dialog_get_type ()))
))))
, GTK_RESPONSE_ACCEPT);
1248 gtk_dialog_set_response_sensitive (GTK_DIALOG (app->new_profile_dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_dialog_get_type ()))
))))
, GTK_RESPONSE_ACCEPT, FALSE(0));
1249 }
1250
1251 gtk_window_set_transient_for (GTK_WINDOW (app->new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_window_get_type ()))
))))
,
1252 transient_parent);
1253
1254 gtk_window_present (GTK_WINDOW (app->new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_window_get_type ()))
))))
);
1255}
1256
1257static void
1258profile_list_selection_changed_cb (GtkTreeSelection *selection,
1259 TerminalApp *app)
1260{
1261 gboolean selected;
1262
1263 selected = gtk_tree_selection_get_selected (selection, NULL((void*)0), NULL((void*)0));
1264
1265 gtk_widget_set_sensitive (app->manage_profiles_edit_button, selected);
1266 gtk_widget_set_sensitive (app->manage_profiles_delete_button,
1267 selected &&
1268 g_hash_table_size (app->profiles) > 1);
1269}
1270
1271static void
1272profile_list_response_cb (GtkWidget *dialog,
1273 int id,
1274 TerminalApp *app)
1275{
1276 g_assert (app->manage_profiles_dialog == dialog)do { if (app->manage_profiles_dialog == dialog) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1276, ((const char*) (__func__
)), "app->manage_profiles_dialog == dialog"); } while (0)
;
1277
1278 if (id == GTK_RESPONSE_HELP)
1279 {
1280 terminal_util_show_help ("mate-terminal-manage-profiles", GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
);
1281 return;
1282 }
1283
1284 gtk_widget_destroy (dialog);
1285}
1286
1287static void
1288profile_list_destroyed_cb (GtkWidget *manage_profiles_dialog,
1289 TerminalApp *app)
1290{
1291 g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_list_treeview_refill), app->manage_profiles_list)g_signal_handlers_disconnect_matched ((app), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (profile_list_treeview_refill))), (app->
manage_profiles_list))
;
1292 g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_combo_box_refill), app->manage_profiles_default_menu)g_signal_handlers_disconnect_matched ((app), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (profile_combo_box_refill))), (app->manage_profiles_default_menu
))
;
1293
1294 app->manage_profiles_dialog = NULL((void*)0);
1295 app->manage_profiles_list = NULL((void*)0);
1296 app->manage_profiles_new_button = NULL((void*)0);
1297 app->manage_profiles_edit_button = NULL((void*)0);
1298 app->manage_profiles_delete_button = NULL((void*)0);
1299 app->manage_profiles_default_menu = NULL((void*)0);
1300}
1301
1302void
1303terminal_app_manage_profiles (TerminalApp *app,
1304 GtkWindow *transient_parent)
1305{
1306 GObject *dialog;
1307 GObject *tree_view_container, *new_button, *edit_button, *remove_button;
1308 GObject *default_hbox, *default_label;
1309 GtkTreeSelection *selection;
1310
1311 if (app->manage_profiles_dialog)
1312 {
1313 gtk_window_set_transient_for (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
, transient_parent);
1314 gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
);
1315 return;
1316 }
1317
1318 if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX"/org/mate/terminal" G_DIR_SEPARATOR_S"/" "ui/profile-manager.ui",
1319 "profile-manager", &dialog,
1320 "profiles-treeview-container", &tree_view_container,
1321 "new-profile-button", &new_button,
1322 "edit-profile-button", &edit_button,
1323 "delete-profile-button", &remove_button,
1324 "default-profile-hbox", &default_hbox,
1325 "default-profile-label", &default_label,
1326 NULL((void*)0)))
1327 return;
1328
1329 app->manage_profiles_dialog = GTK_WIDGET (dialog)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_widget_get_type ()))))))
;
1330 app->manage_profiles_new_button = GTK_WIDGET (new_button)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_button)), ((gtk_widget_get_type ()))))))
;
1331 app->manage_profiles_edit_button = GTK_WIDGET (edit_button)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((edit_button)), ((gtk_widget_get_type ()))))))
;
1332 app->manage_profiles_delete_button = GTK_WIDGET (remove_button)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((remove_button)), ((gtk_widget_get_type ()))))))
;
1333
1334 g_signal_connect (dialog, "response", G_CALLBACK (profile_list_response_cb), app)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_response_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1335 g_signal_connect (dialog, "destroy", G_CALLBACK (profile_list_destroyed_cb), app)g_signal_connect_data ((dialog), ("destroy"), (((GCallback) (
profile_list_destroyed_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1336
1337 app->manage_profiles_list = profile_list_treeview_create (app);
1338
1339 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (app->manage_profiles_list)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_list)), ((gtk_tree_view_get_type
()))))))
);
1340 g_signal_connect (selection, "changed", G_CALLBACK (profile_list_selection_changed_cb), app)g_signal_connect_data ((selection), ("changed"), (((GCallback
) (profile_list_selection_changed_cb))), (app), ((void*)0), (
GConnectFlags) 0)
;
1341
1342 profile_list_treeview_refill (app, app->manage_profiles_list);
1343 g_signal_connect (app, "profile-list-changed",g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_list_treeview_refill))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1344 G_CALLBACK (profile_list_treeview_refill), app->manage_profiles_list)g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_list_treeview_refill))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1345
1346 g_signal_connect (app->manage_profiles_list, "row-activated",g_signal_connect_data ((app->manage_profiles_list), ("row-activated"
), (((GCallback) (profile_list_row_activated_cb))), (app), ((
void*)0), (GConnectFlags) 0)
1347 G_CALLBACK (profile_list_row_activated_cb), app)g_signal_connect_data ((app->manage_profiles_list), ("row-activated"
), (((GCallback) (profile_list_row_activated_cb))), (app), ((
void*)0), (GConnectFlags) 0)
;
1348
1349 gtk_container_add (GTK_CONTAINER (tree_view_container)((((GtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view_container)), ((gtk_container_get_type ()))))))
, app->manage_profiles_list);
1350 gtk_widget_show (app->manage_profiles_list);
1351
1352 g_signal_connect (new_button, "clicked",g_signal_connect_data ((new_button), ("clicked"), (((GCallback
) (profile_list_new_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1353 G_CALLBACK (profile_list_new_button_clicked_cb),g_signal_connect_data ((new_button), ("clicked"), (((GCallback
) (profile_list_new_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1354 app->manage_profiles_list)g_signal_connect_data ((new_button), ("clicked"), (((GCallback
) (profile_list_new_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1355 g_signal_connect (edit_button, "clicked",g_signal_connect_data ((edit_button), ("clicked"), (((GCallback
) (profile_list_edit_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1356 G_CALLBACK (profile_list_edit_button_clicked_cb),g_signal_connect_data ((edit_button), ("clicked"), (((GCallback
) (profile_list_edit_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1357 app->manage_profiles_list)g_signal_connect_data ((edit_button), ("clicked"), (((GCallback
) (profile_list_edit_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1358 g_signal_connect (remove_button, "clicked",g_signal_connect_data ((remove_button), ("clicked"), (((GCallback
) (profile_list_delete_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1359 G_CALLBACK (profile_list_delete_button_clicked_cb),g_signal_connect_data ((remove_button), ("clicked"), (((GCallback
) (profile_list_delete_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1360 app->manage_profiles_list)g_signal_connect_data ((remove_button), ("clicked"), (((GCallback
) (profile_list_delete_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1361
1362 app->manage_profiles_default_menu = profile_combo_box_new (app);
1363 g_signal_connect (app->manage_profiles_default_menu, "changed",g_signal_connect_data ((app->manage_profiles_default_menu)
, ("changed"), (((GCallback) (profile_combo_box_changed_cb)))
, (app), ((void*)0), (GConnectFlags) 0)
1364 G_CALLBACK (profile_combo_box_changed_cb), app)g_signal_connect_data ((app->manage_profiles_default_menu)
, ("changed"), (((GCallback) (profile_combo_box_changed_cb)))
, (app), ((void*)0), (GConnectFlags) 0)
;
1365
1366 gtk_box_pack_start (GTK_BOX (default_hbox)((((GtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((default_hbox)), ((gtk_box_get_type ()))))))
, app->manage_profiles_default_menu, FALSE(0), FALSE(0), 0);
1367 gtk_widget_show (app->manage_profiles_default_menu);
1368
1369 gtk_label_set_mnemonic_widget (GTK_LABEL (default_label)((((GtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((default_label)), ((gtk_label_get_type ()))))))
, app->manage_profiles_default_menu);
1370
1371 gtk_widget_grab_focus (app->manage_profiles_list);
1372
1373 gtk_window_set_transient_for (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
,
1374 transient_parent);
1375
1376 gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
);
1377}
1378
1379#ifdef HAVE_SMCLIENT1
1380static void
1381terminal_app_save_state_cb (EggSMClient *client,
1382 GKeyFile *key_file,
1383 TerminalApp *app)
1384{
1385 terminal_app_save_config (app, key_file);
1386}
1387
1388static void
1389terminal_app_client_quit_cb (EggSMClient *client,
1390 TerminalApp *app)
1391{
1392 g_signal_emit (app, signals[QUIT], 0);
1393}
1394#endif /* HAVE_SMCLIENT */
1395
1396/* Class implementation */
1397
1398G_DEFINE_TYPE (TerminalApp, terminal_app, G_TYPE_OBJECT)static void terminal_app_init (TerminalApp *self); static void
terminal_app_class_init (TerminalAppClass *klass); static GType
terminal_app_get_type_once (void); static gpointer terminal_app_parent_class
= ((void*)0); static gint TerminalApp_private_offset; static
void terminal_app_class_intern_init (gpointer klass) { terminal_app_parent_class
= g_type_class_peek_parent (klass); if (TerminalApp_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &TerminalApp_private_offset
); terminal_app_class_init ((TerminalAppClass*) klass); } __attribute__
((__unused__)) static inline gpointer terminal_app_get_instance_private
(TerminalApp *self) { return (((gpointer) ((guint8*) (self) +
(glong) (TerminalApp_private_offset)))); } GType terminal_app_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ _Static_assert (sizeof *(&static_g_define_type_id) ==
sizeof (gpointer), "Expression evaluates to false"); (void) (
0 ? (gpointer) *(&static_g_define_type_id) : ((void*)0));
(!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = terminal_app_get_type_once
(); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } __attribute__ ((__noinline__)) static GType terminal_app_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
(((GType) ((20) << (2))), g_intern_static_string ("TerminalApp"
), sizeof (TerminalAppClass), (GClassInitFunc)(void (*)(void)
) terminal_app_class_intern_init, sizeof (TerminalApp), (GInstanceInitFunc
)(void (*)(void)) terminal_app_init, (GTypeFlags) 0); { {{};}
} return g_define_type_id; }
1399
1400static void
1401terminal_app_init (TerminalApp *app)
1402{
1403 global_app = app;
1404
1405 gtk_window_set_default_icon_name (MATE_TERMINAL_ICON_NAME"utilities-terminal");
1406
1407 /* Initialise defaults */
1408 app->enable_mnemonics = DEFAULT_ENABLE_MNEMONICS((!(0)));
1409 app->enable_menu_accels = DEFAULT_ENABLE_MENU_BAR_ACCEL((!(0)));
1410
1411 app->profiles = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
1412
1413 app->encodings = terminal_encodings_get_builtins ();
1414
1415 settings_global = g_settings_new (CONF_GLOBAL_SCHEMA"org.mate.terminal" ".global");
1416 app->settings_font = g_settings_new (MONOSPACE_FONT_SCHEMA"org.mate.interface");
1417
1418 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1419 "changed::" PROFILE_LIST_KEY,g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1420 G_CALLBACK(terminal_app_profile_list_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1421 app)g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
;
1422
1423 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
1424 "changed::" DEFAULT_PROFILE_KEY,g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
1425 G_CALLBACK(terminal_app_default_profile_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
1426 app)g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
;
1427
1428 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1429 "changed::" ENCODING_LIST_KEY,g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1430 G_CALLBACK(terminal_app_encoding_list_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1431 app)g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
;
1432
1433 g_signal_connect (app->settings_font,g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1434 "changed::" MONOSPACE_FONT_KEY,g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1435 G_CALLBACK(terminal_app_system_font_notify_cb),g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1436 app)g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
;
1437
1438 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
1439 "changed::" ENABLE_MNEMONICS_KEY,g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
1440 G_CALLBACK(terminal_app_enable_mnemonics_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
1441 app)g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
;
1442
1443 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
1444 "changed::" ENABLE_MENU_BAR_ACCEL_KEY,g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
1445 G_CALLBACK(terminal_app_enable_menu_accels_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
1446 app)g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
;
1447
1448 /* Load the settings */
1449 terminal_app_profile_list_notify_cb (settings_global,
1450 PROFILE_LIST_KEY"profile-list",
1451 app);
1452 terminal_app_default_profile_notify_cb (settings_global,
1453 DEFAULT_PROFILE_KEY"default-profile",
1454 app);
1455 terminal_app_encoding_list_notify_cb (settings_global,
1456 ENCODING_LIST_KEY"active-encodings",
1457 app);
1458 terminal_app_system_font_notify_cb (app->settings_font,
1459 MONOSPACE_FONT_KEY"monospace-font-name",
1460 app);
1461 terminal_app_enable_menu_accels_notify_cb (settings_global,
1462 ENABLE_MENU_BAR_ACCEL_KEY"use-menu-accelerators",
1463 app);
1464 terminal_app_enable_mnemonics_notify_cb (settings_global,
1465 ENABLE_MNEMONICS_KEY"use-mnemonics",
1466 app);
1467
1468 /* Ensure we have valid settings */
1469 g_assert (app->default_profile_id != NULL)do { if (app->default_profile_id != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1469, ((const char*) (__func__
)), "app->default_profile_id != NULL"); } while (0)
;
1470 g_assert (app->system_font_desc != NULL)do { if (app->system_font_desc != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1470, ((const char*) (__func__
)), "app->system_font_desc != NULL"); } while (0)
;
1471
1472 terminal_accels_init ();
1473
1474#ifdef HAVE_SMCLIENT1
1475 EggSMClient *sm_client;
1476 char *desktop_file;
1477
1478 desktop_file = g_build_filename (TERM_DATADIR"/usr/local/share",
1479 "applications",
1480 PACKAGE"mate-terminal" ".desktop",
1481 NULL((void*)0));
1482 egg_set_desktop_file_without_defaults (desktop_file);
1483 g_free (desktop_file);
1484
1485 sm_client = egg_sm_client_get ();
1486 g_signal_connect (sm_client, "save-state",g_signal_connect_data ((sm_client), ("save-state"), (((GCallback
) (terminal_app_save_state_cb))), (app), ((void*)0), (GConnectFlags
) 0)
1487 G_CALLBACK (terminal_app_save_state_cb), app)g_signal_connect_data ((sm_client), ("save-state"), (((GCallback
) (terminal_app_save_state_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1488 g_signal_connect (sm_client, "quit",g_signal_connect_data ((sm_client), ("quit"), (((GCallback) (
terminal_app_client_quit_cb))), (app), ((void*)0), (GConnectFlags
) 0)
1489 G_CALLBACK (terminal_app_client_quit_cb), app)g_signal_connect_data ((sm_client), ("quit"), (((GCallback) (
terminal_app_client_quit_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1490#endif /* HAVE_SMCLIENT */
1491}
1492
1493static void
1494terminal_app_finalize (GObject *object)
1495{
1496 TerminalApp *app = TERMINAL_APP (object)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_app_get_type ()))))))
;
1497
1498#ifdef HAVE_SMCLIENT1
1499 EggSMClient *sm_client;
1500
1501 sm_client = egg_sm_client_get ();
1502 g_signal_handlers_disconnect_matched (sm_client, G_SIGNAL_MATCH_DATA,
1503 0, 0, NULL((void*)0), NULL((void*)0), app);
1504#endif /* HAVE_SMCLIENT */
1505
1506 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
))
1507 G_CALLBACK(terminal_app_profile_list_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
))
1508 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
))
;
1509 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_default_profile_notify_cb))),
(app))
1510 G_CALLBACK(terminal_app_default_profile_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_default_profile_notify_cb))),
(app))
1511 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_default_profile_notify_cb))),
(app))
;
1512 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_encoding_list_notify_cb))), (
app))
1513 G_CALLBACK(terminal_app_encoding_list_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_encoding_list_notify_cb))), (
app))
1514 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_encoding_list_notify_cb))), (
app))
;
1515 g_signal_handlers_disconnect_by_func (app->settings_font,g_signal_handlers_disconnect_matched ((app->settings_font)
, (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (terminal_app_system_font_notify_cb
))), (app))
1516 G_CALLBACK(terminal_app_system_font_notify_cb),g_signal_handlers_disconnect_matched ((app->settings_font)
, (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (terminal_app_system_font_notify_cb
))), (app))
1517 app)g_signal_handlers_disconnect_matched ((app->settings_font)
, (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (terminal_app_system_font_notify_cb
))), (app))
;
1518 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_menu_accels_notify_cb)
)), (app))
1519 G_CALLBACK(terminal_app_enable_menu_accels_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_menu_accels_notify_cb)
)), (app))
1520 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_menu_accels_notify_cb)
)), (app))
;
1521 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_mnemonics_notify_cb)))
, (app))
1522 G_CALLBACK(terminal_app_enable_mnemonics_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_mnemonics_notify_cb)))
, (app))
1523 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_mnemonics_notify_cb)))
, (app))
;
1524
1525 g_object_unref (settings_global);
1526 g_object_unref (app->settings_font);
1527
1528 g_free (app->default_profile_id);
1529
1530 g_hash_table_destroy (app->profiles);
1531
1532 g_hash_table_destroy (app->encodings);
1533
1534 pango_font_description_free (app->system_font_desc);
1535
1536 terminal_accels_shutdown ();
1537
1538 G_OBJECT_CLASS (terminal_app_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_app_parent_class)), (((GType) ((20) << (2
))))))))
->finalize (object);
1539
1540 global_app = NULL((void*)0);
1541}
1542
1543static void
1544terminal_app_get_property (GObject *object,
1545 guint prop_id,
1546 GValue *value,
1547 GParamSpec *pspec)
1548{
1549 TerminalApp *app = TERMINAL_APP (object)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_app_get_type ()))))))
;
1550
1551 switch (prop_id)
1552 {
1553 case PROP_SYSTEM_FONT:
1554 if (app->system_font_desc)
1555 g_value_set_boxed (value, app->system_font_desc);
1556 else
1557 g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_MONOSPACE_FONT("Monospace 10")));
1558 break;
1559 case PROP_ENABLE_MENU_BAR_ACCEL:
1560 g_value_set_boolean (value, app->enable_menu_accels);
1561 break;
1562 case PROP_ENABLE_MNEMONICS:
1563 g_value_set_boolean (value, app->enable_mnemonics);
1564 break;
1565 case PROP_DEFAULT_PROFILE:
1566 g_value_set_object (value, app->default_profile);
1567 break;
1568 default:
1569 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-app.c", 1569, ("property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1570 break;
1571 }
1572}
1573
1574static void
1575terminal_app_set_property (GObject *object,
1576 guint prop_id,
1577 const GValue *value,
1578 GParamSpec *pspec)
1579{
1580 TerminalApp *app = TERMINAL_APP (object)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_app_get_type ()))))))
;
1581
1582 switch (prop_id)
1583 {
1584 case PROP_ENABLE_MENU_BAR_ACCEL:
1585 app->enable_menu_accels = g_value_get_boolean (value);
1586 g_settings_set_boolean (settings_global, ENABLE_MENU_BAR_ACCEL_KEY"use-menu-accelerators", app->enable_menu_accels);
1587 break;
1588 case PROP_ENABLE_MNEMONICS:
1589 app->enable_mnemonics = g_value_get_boolean (value);
1590 g_settings_set_boolean (settings_global, ENABLE_MNEMONICS_KEY"use-mnemonics", app->enable_mnemonics);
1591 break;
1592 case PROP_DEFAULT_PROFILE:
1593 case PROP_SYSTEM_FONT:
1594 /* not writable */
1595 default:
1596 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-app.c", 1596, ("property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1597 break;
1598 }
1599}
1600
1601static void
1602terminal_app_real_quit (TerminalApp *app)
1603{
1604 gtk_main_quit();
1605}
1606
1607static void
1608terminal_app_class_init (TerminalAppClass *klass)
1609{
1610 GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
;
1611
1612 object_class->finalize = terminal_app_finalize;
1613 object_class->get_property = terminal_app_get_property;
1614 object_class->set_property = terminal_app_set_property;
1615
1616 klass->quit = terminal_app_real_quit;
1617
1618 signals[QUIT] =
1619 g_signal_new (I_("quit")g_intern_static_string ("quit"),
1620 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1621 G_SIGNAL_RUN_LAST,
1622 G_STRUCT_OFFSET (TerminalAppClass, quit)((glong) __builtin_offsetof(TerminalAppClass, quit)),
1623 NULL((void*)0), NULL((void*)0),
1624 g_cclosure_marshal_VOID__VOID,
1625 G_TYPE_NONE((GType) ((1) << (2))), 0);
1626
1627 signals[PROFILE_LIST_CHANGED] =
1628 g_signal_new (I_("profile-list-changed")g_intern_static_string ("profile-list-changed"),
1629 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1630 G_SIGNAL_RUN_LAST,
1631 G_STRUCT_OFFSET (TerminalAppClass, profile_list_changed)((glong) __builtin_offsetof(TerminalAppClass, profile_list_changed
))
,
1632 NULL((void*)0), NULL((void*)0),
1633 g_cclosure_marshal_VOID__VOID,
1634 G_TYPE_NONE((GType) ((1) << (2))), 0);
1635
1636 signals[ENCODING_LIST_CHANGED] =
1637 g_signal_new (I_("encoding-list-changed")g_intern_static_string ("encoding-list-changed"),
1638 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1639 G_SIGNAL_RUN_LAST,
1640 G_STRUCT_OFFSET (TerminalAppClass, profile_list_changed)((glong) __builtin_offsetof(TerminalAppClass, profile_list_changed
))
,
1641 NULL((void*)0), NULL((void*)0),
1642 g_cclosure_marshal_VOID__VOID,
1643 G_TYPE_NONE((GType) ((1) << (2))), 0);
1644
1645 g_object_class_install_property
1646 (object_class,
1647 PROP_ENABLE_MENU_BAR_ACCEL,
1648 g_param_spec_boolean (TERMINAL_APP_ENABLE_MENU_BAR_ACCEL"enable-menu-accels", NULL((void*)0), NULL((void*)0),
1649 DEFAULT_ENABLE_MENU_BAR_ACCEL((!(0))),
1650 G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1651
1652 g_object_class_install_property
1653 (object_class,
1654 PROP_ENABLE_MNEMONICS,
1655 g_param_spec_boolean (TERMINAL_APP_ENABLE_MNEMONICS"enable-mnemonics", NULL((void*)0), NULL((void*)0),
1656 DEFAULT_ENABLE_MNEMONICS((!(0))),
1657 G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1658
1659 g_object_class_install_property
1660 (object_class,
1661 PROP_SYSTEM_FONT,
1662 g_param_spec_boxed (TERMINAL_APP_SYSTEM_FONT"system-font", NULL((void*)0), NULL((void*)0),
1663 PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()),
1664 G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1665
1666 g_object_class_install_property
1667 (object_class,
1668 PROP_DEFAULT_PROFILE,
1669 g_param_spec_object (TERMINAL_APP_DEFAULT_PROFILE"default-profile", NULL((void*)0), NULL((void*)0),
1670 TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()),
1671 G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1672}
1673
1674/* Public API */
1675
1676TerminalApp*
1677terminal_app_get (void)
1678{
1679 if (global_app == NULL((void*)0))
1680 {
1681 g_object_new (TERMINAL_TYPE_APP(terminal_app_get_type ()), NULL((void*)0));
1682 g_assert (global_app != NULL)do { if (global_app != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1682, ((const char*) (__func__
)), "global_app != NULL"); } while (0)
;
1683 }
1684
1685 return global_app;
1686}
1687
1688void
1689terminal_app_shutdown (void)
1690{
1691 if (global_app == NULL((void*)0))
1692 return;
1693
1694 g_object_unref (global_app);
1695 g_assert (global_app == NULL)do { if (global_app == ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1695, ((const char*) (__func__
)), "global_app == NULL"); } while (0)
;
1696}
1697
1698/**
1699 * terminal_app_handle_options:
1700 * @app:
1701 * @options: a #TerminalOptions
1702 * @allow_resume: whether to merge the terminal configuration from the
1703 * saved session on resume
1704 * @error: a #GError to fill in
1705 *
1706 * Processes @options. It loads or saves the terminal configuration, or
1707 * opens the specified windows and tabs.
1708 *
1709 * Returns: %TRUE if @options could be successfully handled, or %FALSE on
1710 * error
1711 */
1712gboolean
1713terminal_app_handle_options (TerminalApp *app,
1714 TerminalOptions *options,
1715 gboolean allow_resume,
1716 GError **error)
1717{
1718 GList *lw;
1719 GdkScreen *gdk_screen;
1720
1721 gdk_screen = terminal_app_get_screen_by_display_name (options->display_name);
1722
1723 if (options->save_config)
1724 {
1725 if (options->remote_arguments)
1726 return terminal_app_save_config_file (app, options->config_file, error);
1727
1728 g_set_error_literal (error, TERMINAL_OPTION_ERROR(g_quark_from_static_string ("terminal-option-error")), TERMINAL_OPTION_ERROR_NOT_IN_FACTORY,
1729 "Cannot use \"--save-config\" when starting the factory process");
1730 return FALSE(0);
1731 }
1732
1733 if (options->load_config)
1734 {
1735 GKeyFile *key_file;
1736 gboolean result;
1737
1738 key_file = g_key_file_new ();
1739 result = g_key_file_load_from_file (key_file, options->config_file, 0, error) &&
1740 terminal_options_merge_config (options, key_file, SOURCE_DEFAULT, error);
1741 g_key_file_free (key_file);
1742
1743 if (!result)
1744 return FALSE(0);
1745
1746 /* fall-through on success */
1747 }
1748
1749#ifdef HAVE_SMCLIENT1
1750 EggSMClient *sm_client;
1751
1752 sm_client = egg_sm_client_get ();
1753
1754 if (allow_resume && egg_sm_client_is_resumed (sm_client))
1755 {
1756 GKeyFile *key_file;
1757
1758 key_file = egg_sm_client_get_state_file (sm_client);
1759 if (key_file != NULL((void*)0) &&
1760 !terminal_options_merge_config (options, key_file, SOURCE_SESSION, error))
1761 return FALSE(0);
1762 }
1763#endif /* HAVE_SMCLIENT */
1764
1765 /* Make sure we open at least one window */
1766 terminal_options_ensure_window (options);
1767
1768 if (options->startup_id != NULL((void*)0))
1769 _terminal_debug_print (TERMINAL_DEBUG_FACTORY,do { if (0) g_printerr("Startup ID is '%s'\n", options->startup_id
); } while (0)
1770 "Startup ID is '%s'\n",do { if (0) g_printerr("Startup ID is '%s'\n", options->startup_id
); } while (0)
1771 options->startup_id)do { if (0) g_printerr("Startup ID is '%s'\n", options->startup_id
); } while (0)
;
1772
1773 for (lw = options->initial_windows; lw != NULL((void*)0); lw = lw->next)
1774 {
1775 InitialWindow *iw = lw->data;
1776 TerminalWindow *window = NULL((void*)0);
1777 GList *lt;
1778
1779 g_assert (iw->tabs)do { if (iw->tabs) ; else g_assertion_message_expr (((gchar
*) 0), "terminal-app.c", 1779, ((const char*) (__func__)), "iw->tabs"
); } while (0)
;
1780
1781 if ( lw == options->initial_windows && ((InitialTab *)iw->tabs->data)->attach_window )
1782 window = terminal_app_get_current_window(app, gdk_screen, options->initial_workspace);
1783
1784 if (!window)
1785 {
1786 /* Create & setup new window */
1787 window = terminal_app_new_window (app, gdk_screen);
1788
1789 /* Restored windows shouldn't demand attention; see bug #586308. */
1790 if (iw->source_tag == SOURCE_SESSION)
1791 terminal_window_set_is_restored (window);
1792
1793 if (options->startup_id != NULL((void*)0))
1794 gtk_window_set_startup_id (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
, options->startup_id);
1795
1796 /* Overwrite the default, unique window role set in terminal_window_init */
1797 if (iw->role)
1798 gtk_window_set_role (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
, iw->role);
1799
1800 if (iw->force_menubar_state)
1801 terminal_window_set_menubar_visible (window, iw->menubar_state);
1802
1803 if (iw->start_fullscreen)
1804 gtk_window_fullscreen (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
);
1805 if (iw->start_maximized)
1806 gtk_window_maximize (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
);
1807 }
1808
1809 /* Now add the tabs */
1810 for (lt = iw->tabs; lt != NULL((void*)0); lt = lt->next)
1811 {
1812 InitialTab *it = lt->data;
1813 TerminalProfile *profile = NULL((void*)0);
1814 TerminalScreen *screen;
1815 const char *profile_name;
1816 gboolean profile_is_id;
1817
1818 if (it->profile)
1819 {
1820 profile_name = it->profile;
1821 profile_is_id = it->profile_is_id;
1822 }
1823 else
1824 {
1825 profile_name = options->default_profile;
1826 profile_is_id = options->default_profile_is_id;
1827 }
1828
1829 if (profile_name)
1830 {
1831 if (profile_is_id)
1832 profile = terminal_app_get_profile_by_name (app, profile_name);
1833 else
1834 profile = terminal_app_get_profile_by_visible_name (app, profile_name);
1835
1836 if (profile == NULL((void*)0))
1837 g_printerr (_("No such profile \"%s\", using default profile\n")gettext ("No such profile \"%s\", using default profile\n"), it->profile);
1838 }
1839 if (profile == NULL((void*)0))
1840 profile = terminal_app_get_profile_for_new_term (app);
1841 g_assert (profile)do { if (profile) ; else g_assertion_message_expr (((gchar*) 0
), "terminal-app.c", 1841, ((const char*) (__func__)), "profile"
); } while (0)
;
1842
1843 screen = terminal_app_new_terminal (app, window, profile,
1844 it->exec_argv ? it->exec_argv : options->exec_argv,
1845 it->title ? it->title : options->default_title,
1846 it->working_dir ? it->working_dir : options->default_working_dir,
1847 options->env,
1848 it->zoom_set ? it->zoom : options->zoom);
1849
1850 if (it->active)
1851 terminal_window_switch_screen (window, screen);
1852 }
1853
1854 if (iw->geometry)
1855 {
1856 _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,do { if (0) g_printerr("[window %p] applying geometry %s\n", window
, iw->geometry); } while (0)
1857 "[window %p] applying geometry %s\n",do { if (0) g_printerr("[window %p] applying geometry %s\n", window
, iw->geometry); } while (0)
1858 window, iw->geometry)do { if (0) g_printerr("[window %p] applying geometry %s\n", window
, iw->geometry); } while (0)
;
1859
1860 if (!terminal_window_update_size_set_geometry (window,
1861 terminal_window_get_active (window),
1862 FALSE(0),
1863 iw->geometry))
1864 g_printerr (_("Invalid geometry string \"%s\"\n")gettext ("Invalid geometry string \"%s\"\n"), iw->geometry);
1865 }
1866
1867 gtk_window_present (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
);
1868 }
1869
1870 return TRUE(!(0));
1871}
1872
1873TerminalWindow *
1874terminal_app_new_window (TerminalApp *app,
1875 GdkScreen *screen)
1876{
1877 TerminalWindow *window;
1878
1879 window = terminal_window_new ();
1880
1881 app->windows = g_list_append (app->windows, window);
1882 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
terminal_window_destroyed))), (app), ((void*)0), (GConnectFlags
) 0)
1883 G_CALLBACK (terminal_window_destroyed), app)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
terminal_window_destroyed))), (app), ((void*)0), (GConnectFlags
) 0)
;
1884
1885 if (screen)
1886 gtk_window_set_screen (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
, screen);
1887
1888 return window;
1889}
1890
1891TerminalScreen *
1892terminal_app_new_terminal (TerminalApp *app,
1893 TerminalWindow *window,
1894 TerminalProfile *profile,
1895 char **override_command,
1896 const char *title,
1897 const char *working_dir,
1898 char **child_env,
1899 double zoom)
1900{
1901 TerminalScreen *screen;
1902
1903 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
1904 g_return_val_if_fail (TERMINAL_IS_WINDOW (window), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((terminal_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_WINDOW (window)"); return (((void
*)0)); } } while (0)
;
1905
1906 screen = terminal_screen_new (profile, override_command, title,
1907 working_dir, child_env, zoom);
1908
1909 terminal_window_add_screen (window, screen, -1);
1910 terminal_window_switch_screen (window, screen);
1911 gtk_widget_grab_focus (GTK_WIDGET (screen)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((screen)), ((gtk_widget_get_type ()))))))
);
1912
1913 return screen;
1914}
1915
1916void
1917terminal_app_edit_profile (TerminalApp *app,
1918 TerminalProfile *profile,
1919 GtkWindow *transient_parent,
1920 const char *widget_name)
1921{
1922 terminal_profile_edit (profile, transient_parent, widget_name);
1923}
1924
1925void
1926terminal_app_edit_keybindings (TerminalApp *app,
1927 GtkWindow *transient_parent)
1928{
1929 terminal_edit_keys_dialog_show (transient_parent);
1930}
1931
1932void
1933terminal_app_edit_encodings (TerminalApp *app,
1934 GtkWindow *transient_parent)
1935{
1936 terminal_encoding_dialog_show (transient_parent);
1937}
1938
1939/*
1940* Get the window in the given screen and workspace. If nothing is found,
1941* a NULL is returned.
1942*/
1943TerminalWindow *
1944terminal_app_get_current_window (TerminalApp *app,
1945 GdkScreen *from_screen,
1946 int workspace)
1947{
1948 GList *res = NULL((void*)0);
1949 TerminalWindow *ret = NULL((void*)0);
1950
1951 if (app->windows == NULL((void*)0))
1952 return NULL((void*)0);
1953
1954 res = g_list_last (app->windows);
1955
1956 g_assert (from_screen != NULL)do { if (from_screen != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1956, ((const char*) (__func__
)), "from_screen != NULL"); } while (0)
;
1957
1958 while (res)
1959 {
1960 int win_workspace;
1961 if (gtk_window_get_screen(GTK_WINDOW(res->data)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((res->data)), ((gtk_window_get_type ()))))))
) != from_screen)
1962 continue;
1963
1964 win_workspace = terminal_app_get_workspace_for_window(res->data);
1965
1966 /* Same workspace or if the window is set to show up on all workspaces */
1967 if (win_workspace == workspace || win_workspace == -1)
1968 ret = terminal_window_get_latest_focused (ret, TERMINAL_WINDOW(res->data)((((TerminalWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((res->data)), ((terminal_window_get_type ()))))))
);
1969
1970 res = g_list_previous (res)((res) ? (((GList *)(res))->prev) : ((void*)0));
1971 }
1972
1973 return ret;
1974}
1975
1976/**
1977 * terminal_profile_get_list:
1978 *
1979 * Returns: a #GList containing all #TerminalProfile objects.
1980 * The content of the list is owned by the backend and
1981 * should not be modified or freed. Use g_list_free() when done
1982 * using the list.
1983 */
1984GList*
1985terminal_app_get_profile_list (TerminalApp *app)
1986{
1987 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
1988
1989 return g_list_sort (g_hash_table_get_values (app->profiles), profiles_alphabetic_cmp);
1990}
1991
1992TerminalProfile*
1993terminal_app_get_profile_by_name (TerminalApp *app,
1994 const char *name)
1995{
1996 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
1997 g_return_val_if_fail (name != NULL, NULL)do { if ((name != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "name != NULL"); return
(((void*)0)); } } while (0)
;
1998
1999 return g_hash_table_lookup (app->profiles, name);
2000}
2001
2002TerminalProfile*
2003terminal_app_get_profile_by_visible_name (TerminalApp *app,
2004 const char *name)
2005{
2006 LookupInfo info;
2007
2008 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
2009 g_return_val_if_fail (name != NULL, NULL)do { if ((name != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "name != NULL"); return
(((void*)0)); } } while (0)
;
2010
2011 info.result = NULL((void*)0);
2012 info.target = name;
2013
2014 g_hash_table_foreach (app->profiles,
2015 profiles_lookup_by_visible_name_foreach,
2016 &info);
2017 return info.result;
2018}
2019
2020TerminalProfile*
2021terminal_app_get_default_profile (TerminalApp *app)
2022{
2023 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
2024
2025 return app->default_profile;
2026}
2027
2028TerminalProfile*
2029terminal_app_get_profile_for_new_term (TerminalApp *app)
2030{
2031 GHashTableIter iter;
2032 TerminalProfile *profile = NULL((void*)0);
2033 TerminalProfile **profileptr = &profile;
2034
2035 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
2036
2037 if (app->default_profile)
2038 return app->default_profile;
2039
2040 g_hash_table_iter_init (&iter, app->profiles);
2041 if (g_hash_table_iter_next (&iter, NULL((void*)0), (gpointer *) profileptr))
2042 return profile;
2043
2044 return NULL((void*)0);
2045}
2046
2047GHashTable *
2048terminal_app_get_encodings (TerminalApp *app)
2049{
2050 return app->encodings;
2051}
2052
2053/**
2054 * terminal_app_ensure_encoding:
2055 * @app:
2056 * @charset:
2057 *
2058 * Ensures there's a #TerminalEncoding for @charset available.
2059 */
2060TerminalEncoding *
2061terminal_app_ensure_encoding (TerminalApp *app,
2062 const char *charset)
2063{
2064 TerminalEncoding *encoding;
2065
2066 encoding = g_hash_table_lookup (app->encodings, charset);
2067 if (encoding == NULL((void*)0))
2068 {
2069 encoding = terminal_encoding_new (charset,
2070 _("User Defined")gettext ("User Defined"),
2071 TRUE(!(0)),
2072 TRUE(!(0)) /* scary! */);
2073 g_hash_table_insert (app->encodings,
2074 (gpointer) terminal_encoding_get_id (encoding),
2075 encoding);
2076 }
2077
2078 return encoding;
2079}
2080
2081/**
2082 * terminal_app_get_active_encodings:
2083 *
2084 * Returns: a newly allocated list of newly referenced #TerminalEncoding objects.
2085 */
2086GSList*
2087terminal_app_get_active_encodings (TerminalApp *app)
2088{
2089 GSList *list = NULL((void*)0);
2090 GHashTableIter iter;
2091 gpointer key, value;
2092
2093 g_hash_table_iter_init (&iter, app->encodings);
2094 while (g_hash_table_iter_next (&iter, &key, &value))
2095 {
2096 TerminalEncoding *encoding = (TerminalEncoding *) value;
2097
2098 if (!encoding->is_active)
2099 continue;
2100
2101 list = g_slist_prepend (list, terminal_encoding_ref (encoding));
2102 }
2103
2104 return g_slist_sort (list, (GCompareFunc) compare_encodings);
2105}
2106
2107void
2108terminal_app_save_config (TerminalApp *app,
2109 GKeyFile *key_file)
2110{
2111 GList *lw;
2112 guint n = 0;
2113 GPtrArray *window_names_array;
2114 char **window_names;
2115 gsize len;
2116
2117 g_key_file_set_comment (key_file, NULL((void*)0), NULL((void*)0), "Written by " PACKAGE_STRING"mate-terminal 1.28.0", NULL((void*)0));
2118
2119 g_key_file_set_integer (key_file, TERMINAL_CONFIG_GROUP"MATE Terminal Configuration", TERMINAL_CONFIG_PROP_VERSION"Version", TERMINAL_CONFIG_VERSION(1));
2120 g_key_file_set_integer (key_file, TERMINAL_CONFIG_GROUP"MATE Terminal Configuration", TERMINAL_CONFIG_PROP_COMPAT_VERSION"CompatVersion", TERMINAL_CONFIG_COMPAT_VERSION(1));
2121
2122 window_names_array = g_ptr_array_sized_new (g_list_length (app->windows) + 1);
2123
2124 for (lw = app->windows; lw != NULL((void*)0); lw = lw->next)
2125 {
2126 TerminalWindow *window = TERMINAL_WINDOW (lw->data)((((TerminalWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((lw->data)), ((terminal_window_get_type ()))))))
;
2127 char *group;
2128
2129 group = g_strdup_printf ("Window%u", n++);
2130 g_ptr_array_add (window_names_array, group);
2131
2132 terminal_window_save_state (window, key_file, group);
2133 }
2134
2135 len = window_names_array->len;
2136 g_ptr_array_add (window_names_array, NULL((void*)0));
2137 window_names = (char **) g_ptr_array_free (window_names_array, FALSE(0));
2138 g_key_file_set_string_list (key_file, TERMINAL_CONFIG_GROUP"MATE Terminal Configuration", TERMINAL_CONFIG_PROP_WINDOWS"Windows", (const char * const *) window_names, len);
2139 g_strfreev (window_names);
2140}
2141
2142gboolean
2143terminal_app_save_config_file (TerminalApp *app,
2144 const char *file_name,
2145 GError **error)
2146{
2147 GKeyFile *key_file;
2148 char *data;
2149 gsize len;
2150 gboolean result;
2151
2152 key_file = g_key_file_new ();
2153 terminal_app_save_config (app, key_file);
2154
2155 data = g_key_file_to_data (key_file, &len, NULL((void*)0));
2156 result = g_file_set_contents (file_name, data, len, error);
2157 g_free (data);
2158
2159 return result;
2160}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-86ff44.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-86ff44.html new file mode 100644 index 0000000..ff38f57 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-86ff44.html @@ -0,0 +1,1773 @@ + + + +terminal-accels.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:terminal-accels.c
Warning:line 541, column 48
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name terminal-accels.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I .. -I ../src/mate-submodules/libegg -D TERMINAL_COMPILATION -D TERMINAL_RESOURCES_PATH_PREFIX="/org/mate/terminal" -D TERM_DATADIR="/usr/local/share" -D TERM_LOCALEDIR="/usr/local/share/locale" -D TERM_PKGDATADIR="/usr/local/share/mate-terminal" -D TERM_HELPDIR="/usr/local/share/help" -D SN_API_NOT_YET_FROZEN -D GDK_MULTIHEAD_SAFE -D G_DISABLE_SINGLE_INCLUDES -D PANGO_DISABLE_SINGLE_INCLUDES -D ATK_DISABLE_SINGLE_INCLUDES -D GDK_DISABLE_SINGLE_INCLUDES -D GDK_PIXBUF_DISABLE_SINGLE_INCLUDES -D GTK_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c terminal-accels.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright © 2001, 2002 Havoc Pennington, Red Hat Inc.
3 * Copyright © 2008 Christian Persch
4 * Copyright (C) 2012-2021 MATE Developers
5 *
6 * Mate-terminal is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * Mate-terminal is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <config.h>
21
22#include <string.h>
23
24#include <gdk/gdkkeysyms.h>
25
26#include "terminal-accels.h"
27#include "terminal-app.h"
28#include "terminal-debug.h"
29#include "terminal-intl.h"
30#include "terminal-profile.h"
31#include "terminal-util.h"
32
33/* NOTES
34 *
35 * There are two sources of keybindings changes, from GSettings and from
36 * the accel map (happens with in-place menu editing).
37 *
38 * When a keybinding GSettins key changes, we propagate that into the
39 * accel map.
40 * When the accel map changes, we queue a sync to GSettings.
41 *
42 * To avoid infinite loops, we short-circuit in both directions
43 * if the value is unchanged from last known.
44 *
45 * In the keybinding editor, when editing or clearing an accel, we write
46 * the change directly to GSettings and rely on the GSettings callback to
47 * actually apply the change to the accel map.
48 */
49
50#define ACCEL_PATH_ROOT"<Actions>/Main/" "<Actions>/Main/"
51#define ACCEL_PATH_NEW_TAB"<Actions>/Main/" "FileNewTab" ACCEL_PATH_ROOT"<Actions>/Main/" "FileNewTab"
52#define ACCEL_PATH_NEW_WINDOW"<Actions>/Main/" "FileNewWindow" ACCEL_PATH_ROOT"<Actions>/Main/" "FileNewWindow"
53#define ACCEL_PATH_NEW_PROFILE"<Actions>/Main/" "FileNewProfile" ACCEL_PATH_ROOT"<Actions>/Main/" "FileNewProfile"
54#define ACCEL_PATH_SAVE_CONTENTS"<Actions>/Main/" "FileSaveContents" ACCEL_PATH_ROOT"<Actions>/Main/" "FileSaveContents"
55#define ACCEL_PATH_CLOSE_TAB"<Actions>/Main/" "FileCloseTab" ACCEL_PATH_ROOT"<Actions>/Main/" "FileCloseTab"
56#define ACCEL_PATH_CLOSE_WINDOW"<Actions>/Main/" "FileCloseWindow" ACCEL_PATH_ROOT"<Actions>/Main/" "FileCloseWindow"
57#define ACCEL_PATH_COPY"<Actions>/Main/" "EditCopy" ACCEL_PATH_ROOT"<Actions>/Main/" "EditCopy"
58#define ACCEL_PATH_PASTE"<Actions>/Main/" "EditPaste" ACCEL_PATH_ROOT"<Actions>/Main/" "EditPaste"
59#define ACCEL_PATH_SELECT_ALL"<Actions>/Main/" "EditSelectAll" ACCEL_PATH_ROOT"<Actions>/Main/" "EditSelectAll"
60#define ACCEL_PATH_SEARCH_FIND"<Actions>/Main/" "SearchFind" ACCEL_PATH_ROOT"<Actions>/Main/" "SearchFind"
61#define ACCEL_PATH_SEARCH_FIND_NEXT"<Actions>/Main/" "SearchFindNext" ACCEL_PATH_ROOT"<Actions>/Main/" "SearchFindNext"
62#define ACCEL_PATH_SEARCH_FIND_PREVIOUS"<Actions>/Main/" "SearchFindPrevious" ACCEL_PATH_ROOT"<Actions>/Main/" "SearchFindPrevious"
63#define ACCEL_PATH_TOGGLE_MENUBAR"<Actions>/Main/" "ViewMenubar" ACCEL_PATH_ROOT"<Actions>/Main/" "ViewMenubar"
64#define ACCEL_PATH_FULL_SCREEN"<Actions>/Main/" "ViewFullscreen" ACCEL_PATH_ROOT"<Actions>/Main/" "ViewFullscreen"
65#define ACCEL_PATH_RESET"<Actions>/Main/" "TerminalReset" ACCEL_PATH_ROOT"<Actions>/Main/" "TerminalReset"
66#define ACCEL_PATH_RESET_AND_CLEAR"<Actions>/Main/" "TerminalResetClear" ACCEL_PATH_ROOT"<Actions>/Main/" "TerminalResetClear"
67#define ACCEL_PATH_PREV_PROFILE"<Actions>/Main/" "ProfilePrevious" ACCEL_PATH_ROOT"<Actions>/Main/" "ProfilePrevious"
68#define ACCEL_PATH_NEXT_PROFILE"<Actions>/Main/" "ProfileNext" ACCEL_PATH_ROOT"<Actions>/Main/" "ProfileNext"
69#define ACCEL_PATH_PREV_TAB"<Actions>/Main/" "TabsPrevious" ACCEL_PATH_ROOT"<Actions>/Main/" "TabsPrevious"
70#define ACCEL_PATH_NEXT_TAB"<Actions>/Main/" "TabsNext" ACCEL_PATH_ROOT"<Actions>/Main/" "TabsNext"
71#define ACCEL_PATH_SET_TERMINAL_TITLE"<Actions>/Main/" "TerminalSetTitle" ACCEL_PATH_ROOT"<Actions>/Main/" "TerminalSetTitle"
72#define ACCEL_PATH_HELP"<Actions>/Main/" "HelpContents" ACCEL_PATH_ROOT"<Actions>/Main/" "HelpContents"
73#define ACCEL_PATH_ZOOM_IN"<Actions>/Main/" "ViewZoomIn" ACCEL_PATH_ROOT"<Actions>/Main/" "ViewZoomIn"
74#define ACCEL_PATH_ZOOM_OUT"<Actions>/Main/" "ViewZoomOut" ACCEL_PATH_ROOT"<Actions>/Main/" "ViewZoomOut"
75#define ACCEL_PATH_ZOOM_NORMAL"<Actions>/Main/" "ViewZoom100" ACCEL_PATH_ROOT"<Actions>/Main/" "ViewZoom100"
76#define ACCEL_PATH_MOVE_TAB_LEFT"<Actions>/Main/" "TabsMoveLeft" ACCEL_PATH_ROOT"<Actions>/Main/" "TabsMoveLeft"
77#define ACCEL_PATH_MOVE_TAB_RIGHT"<Actions>/Main/" "TabsMoveRight" ACCEL_PATH_ROOT"<Actions>/Main/" "TabsMoveRight"
78#define ACCEL_PATH_DETACH_TAB"<Actions>/Main/" "TabsDetach" ACCEL_PATH_ROOT"<Actions>/Main/" "TabsDetach"
79#define ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" ACCEL_PATH_ROOT"<Actions>/Main/" "TabsSwitch"
80
81#define KEY_CLOSE_TAB"close-tab" "close-tab"
82#define KEY_CLOSE_WINDOW"close-window" "close-window"
83#define KEY_COPY"copy" "copy"
84#define KEY_DETACH_TAB"detach-tab" "detach-tab"
85#define KEY_FULL_SCREEN"full-screen" "full-screen"
86#define KEY_HELP"help" "help"
87#define KEY_MOVE_TAB_LEFT"move-tab-left" "move-tab-left"
88#define KEY_MOVE_TAB_RIGHT"move-tab-right" "move-tab-right"
89#define KEY_NEW_PROFILE"new-profile" "new-profile"
90#define KEY_NEW_TAB"new-tab" "new-tab"
91#define KEY_NEW_WINDOW"new-window" "new-window"
92#define KEY_NEXT_PROFILE"next-profile" "next-profile"
93#define KEY_NEXT_TAB"next-tab" "next-tab"
94#define KEY_PASTE"paste" "paste"
95#define KEY_PREV_PROFILE"prev-profile" "prev-profile"
96#define KEY_PREV_TAB"prev-tab" "prev-tab"
97#define KEY_RESET_AND_CLEAR"reset-and-clear" "reset-and-clear"
98#define KEY_RESET"reset" "reset"
99#define KEY_SEARCH_FIND"search-find" "search-find"
100#define KEY_SEARCH_FIND_NEXT"search-find-next" "search-find-next"
101#define KEY_SEARCH_FIND_PREVIOUS"search-find-previous" "search-find-previous"
102#define KEY_SELECT_ALL"select-all" "select-all"
103#define KEY_SAVE_CONTENTS"save-contents" "save-contents"
104#define KEY_SET_TERMINAL_TITLE"set-terminal-title" "set-terminal-title"
105#define KEY_TOGGLE_MENUBAR"toggle-menubar" "toggle-menubar"
106#define KEY_ZOOM_IN"zoom-in" "zoom-in"
107#define KEY_ZOOM_NORMAL"zoom-normal" "zoom-normal"
108#define KEY_ZOOM_OUT"zoom-out" "zoom-out"
109#define KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "switch-to-tab-"
110
111#if 1
112/*
113* We don't want to enable content saving until vte supports it async.
114* So we disable this code for stable versions.
115*/
116#include "terminal-version.h"
117
118#if (TERMINAL_MINOR_VERSION(28) & 1) != 0
119#define ENABLE_SAVE
120#else
121#undef ENABLE_SAVE
122#endif
123#endif
124
125typedef struct
126{
127 const char *user_visible_name;
128 const char *gsettings_key;
129 const char *accel_path;
130 /* last values received from GSettings */
131 GdkModifierType gsettings_mask;
132 guint gsettings_keyval;
133 GClosure *closure;
134 /* have gotten a notification from gtk */
135 gboolean needs_gsettings_sync;
136 gboolean accel_path_unlocked;
137} KeyEntry;
138
139typedef struct
140{
141 KeyEntry *key_entry;
142 guint n_elements;
143 const char *user_visible_name;
144} KeyEntryList;
145
146static KeyEntry file_entries[] =
147{
148 {
149 N_("New Tab")("New Tab"),
150 KEY_NEW_TAB"new-tab", ACCEL_PATH_NEW_TAB"<Actions>/Main/" "FileNewTab", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_t0x074, NULL((void*)0), FALSE(0), TRUE(!(0))
151 },
152 {
153 N_("New Window")("New Window"),
154 KEY_NEW_WINDOW"new-window", ACCEL_PATH_NEW_WINDOW"<Actions>/Main/" "FileNewWindow", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_n0x06e, NULL((void*)0), FALSE(0), TRUE(!(0))
155 },
156 {
157 N_("New Profile")("New Profile"),
158 KEY_NEW_PROFILE"new-profile", ACCEL_PATH_NEW_PROFILE"<Actions>/Main/" "FileNewProfile", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
159 },
160#ifdef ENABLE_SAVE
161 {
162 N_("Save Contents")("Save Contents"),
163 KEY_SAVE_CONTENTS"save-contents", ACCEL_PATH_SAVE_CONTENTS"<Actions>/Main/" "FileSaveContents", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
164 },
165#endif
166 {
167 N_("Close Tab")("Close Tab"),
168 KEY_CLOSE_TAB"close-tab", ACCEL_PATH_CLOSE_TAB"<Actions>/Main/" "FileCloseTab", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_w0x077, NULL((void*)0), FALSE(0), TRUE(!(0))
169 },
170 {
171 N_("Close Window")("Close Window"),
172 KEY_CLOSE_WINDOW"close-window", ACCEL_PATH_CLOSE_WINDOW"<Actions>/Main/" "FileCloseWindow", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_q0x071, NULL((void*)0), FALSE(0), TRUE(!(0))
173 },
174};
175
176static KeyEntry edit_entries[] =
177{
178 {
179 N_("Copy")("Copy"),
180 KEY_COPY"copy", ACCEL_PATH_COPY"<Actions>/Main/" "EditCopy", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_c0x063, NULL((void*)0), FALSE(0), TRUE(!(0))
181 },
182 {
183 N_("Paste")("Paste"),
184 KEY_PASTE"paste", ACCEL_PATH_PASTE"<Actions>/Main/" "EditPaste", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_v0x076, NULL((void*)0), FALSE(0), TRUE(!(0))
185 },
186 {
187 N_("Select All")("Select All"),
188 KEY_SELECT_ALL"select-all", ACCEL_PATH_SELECT_ALL"<Actions>/Main/" "EditSelectAll", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_a0x061, NULL((void*)0), FALSE(0), TRUE(!(0))
189 }
190};
191
192static KeyEntry view_entries[] =
193{
194 {
195 N_("Hide and Show menubar")("Hide and Show menubar"),
196 KEY_TOGGLE_MENUBAR"toggle-menubar", ACCEL_PATH_TOGGLE_MENUBAR"<Actions>/Main/" "ViewMenubar", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
197 },
198 {
199 N_("Full Screen")("Full Screen"),
200 KEY_FULL_SCREEN"full-screen", ACCEL_PATH_FULL_SCREEN"<Actions>/Main/" "ViewFullscreen", 0, GDK_KEY_F110xffc8, NULL((void*)0), FALSE(0), TRUE(!(0))
201 },
202 {
203 N_("Zoom In")("Zoom In"),
204 KEY_ZOOM_IN"zoom-in", ACCEL_PATH_ZOOM_IN"<Actions>/Main/" "ViewZoomIn", GDK_CONTROL_MASK, GDK_KEY_plus0x02b, NULL((void*)0), FALSE(0), TRUE(!(0))
205 },
206 {
207 N_("Zoom Out")("Zoom Out"),
208 KEY_ZOOM_OUT"zoom-out", ACCEL_PATH_ZOOM_OUT"<Actions>/Main/" "ViewZoomOut", GDK_CONTROL_MASK, GDK_KEY_minus0x02d, NULL((void*)0), FALSE(0), TRUE(!(0))
209 },
210 {
211 N_("Normal Size")("Normal Size"),
212 KEY_ZOOM_NORMAL"zoom-normal", ACCEL_PATH_ZOOM_NORMAL"<Actions>/Main/" "ViewZoom100", GDK_CONTROL_MASK, GDK_KEY_00x030, NULL((void*)0), FALSE(0), TRUE(!(0))
213 }
214};
215
216static KeyEntry search_entries[] =
217{
218 {
219 N_("Find")("Find"),
220 KEY_SEARCH_FIND"search-find", ACCEL_PATH_SEARCH_FIND"<Actions>/Main/" "SearchFind", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_f0x066, NULL((void*)0), FALSE(0), TRUE(!(0))
221 },
222 {
223 N_("Find Next")("Find Next"),
224 KEY_SEARCH_FIND_NEXT"search-find-next", ACCEL_PATH_SEARCH_FIND_NEXT"<Actions>/Main/" "SearchFindNext", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_h0x068, NULL((void*)0), FALSE(0), TRUE(!(0))
225 },
226 {
227 N_("Find Previous")("Find Previous"),
228 KEY_SEARCH_FIND_PREVIOUS"search-find-previous", ACCEL_PATH_SEARCH_FIND_PREVIOUS"<Actions>/Main/" "SearchFindPrevious", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_g0x067, NULL((void*)0), FALSE(0), TRUE(!(0))
229 }
230};
231
232static KeyEntry terminal_entries[] =
233{
234 {
235 N_("Set Title")("Set Title"),
236 KEY_SET_TERMINAL_TITLE"set-terminal-title", ACCEL_PATH_SET_TERMINAL_TITLE"<Actions>/Main/" "TerminalSetTitle", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
237 },
238 {
239 N_("Reset")("Reset"),
240 KEY_RESET"reset", ACCEL_PATH_RESET"<Actions>/Main/" "TerminalReset", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
241 },
242 {
243 N_("Reset and Clear")("Reset and Clear"),
244 KEY_RESET_AND_CLEAR"reset-and-clear", ACCEL_PATH_RESET_AND_CLEAR"<Actions>/Main/" "TerminalResetClear", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
245 },
246 {
247 N_("Switch to Previous Profile")("Switch to Previous Profile"),
248 KEY_PREV_PROFILE"prev-profile", ACCEL_PATH_PREV_PROFILE"<Actions>/Main/" "ProfilePrevious", GDK_MOD1_MASK, GDK_KEY_Page_Up0xff55, NULL((void*)0), FALSE(0), TRUE(!(0))
249 },
250 {
251 N_("Switch to Next Profile")("Switch to Next Profile"),
252 KEY_NEXT_PROFILE"next-profile", ACCEL_PATH_NEXT_PROFILE"<Actions>/Main/" "ProfileNext", GDK_MOD1_MASK, GDK_KEY_Page_Down0xff56, NULL((void*)0), FALSE(0), TRUE(!(0))
253 },
254};
255
256static KeyEntry tabs_entries[] =
257{
258 {
259 N_("Switch to Previous Tab")("Switch to Previous Tab"),
260 KEY_PREV_TAB"prev-tab", ACCEL_PATH_PREV_TAB"<Actions>/Main/" "TabsPrevious", GDK_CONTROL_MASK, GDK_KEY_Page_Up0xff55, NULL((void*)0), FALSE(0), TRUE(!(0))
261 },
262 {
263 N_("Switch to Next Tab")("Switch to Next Tab"),
264 KEY_NEXT_TAB"next-tab", ACCEL_PATH_NEXT_TAB"<Actions>/Main/" "TabsNext", GDK_CONTROL_MASK, GDK_KEY_Page_Down0xff56, NULL((void*)0), FALSE(0), TRUE(!(0))
265 },
266 {
267 N_("Move Tab to the Left")("Move Tab to the Left"),
268 KEY_MOVE_TAB_LEFT"move-tab-left", ACCEL_PATH_MOVE_TAB_LEFT"<Actions>/Main/" "TabsMoveLeft", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_Page_Up0xff55, NULL((void*)0), FALSE(0), TRUE(!(0))
269 },
270 {
271 N_("Move Tab to the Right")("Move Tab to the Right"),
272 KEY_MOVE_TAB_RIGHT"move-tab-right", ACCEL_PATH_MOVE_TAB_RIGHT"<Actions>/Main/" "TabsMoveRight", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_Page_Down0xff56, NULL((void*)0), FALSE(0), TRUE(!(0))
273 },
274 {
275 N_("Detach Tab")("Detach Tab"),
276 KEY_DETACH_TAB"detach-tab", ACCEL_PATH_DETACH_TAB"<Actions>/Main/" "TabsDetach", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
277 },
278 {
279 N_("Switch to Tab 1")("Switch to Tab 1"),
280 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "1",
281 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "1", GDK_MOD1_MASK, GDK_KEY_10x031, NULL((void*)0), FALSE(0), TRUE(!(0))
282 },
283 {
284 N_("Switch to Tab 2")("Switch to Tab 2"),
285 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "2",
286 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "2", GDK_MOD1_MASK, GDK_KEY_20x032, NULL((void*)0), FALSE(0), TRUE(!(0))
287 },
288 {
289 N_("Switch to Tab 3")("Switch to Tab 3"),
290 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "3",
291 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "3", GDK_MOD1_MASK, GDK_KEY_30x033, NULL((void*)0), FALSE(0), TRUE(!(0))
292 },
293 {
294 N_("Switch to Tab 4")("Switch to Tab 4"),
295 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "4",
296 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "4", GDK_MOD1_MASK, GDK_KEY_40x034, NULL((void*)0), FALSE(0), TRUE(!(0))
297 },
298 {
299 N_("Switch to Tab 5")("Switch to Tab 5"),
300 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "5",
301 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "5", GDK_MOD1_MASK, GDK_KEY_50x035, NULL((void*)0), FALSE(0), TRUE(!(0))
302 },
303 {
304 N_("Switch to Tab 6")("Switch to Tab 6"),
305 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "6",
306 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "6", GDK_MOD1_MASK, GDK_KEY_60x036, NULL((void*)0), FALSE(0), TRUE(!(0))
307 },
308 {
309 N_("Switch to Tab 7")("Switch to Tab 7"),
310 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "7",
311 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "7", GDK_MOD1_MASK, GDK_KEY_70x037, NULL((void*)0), FALSE(0), TRUE(!(0))
312 },
313 {
314 N_("Switch to Tab 8")("Switch to Tab 8"),
315 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "8",
316 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "8", GDK_MOD1_MASK, GDK_KEY_80x038, NULL((void*)0), FALSE(0), TRUE(!(0))
317 },
318 {
319 N_("Switch to Tab 9")("Switch to Tab 9"),
320 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "9",
321 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "9", GDK_MOD1_MASK, GDK_KEY_90x039, NULL((void*)0), FALSE(0), TRUE(!(0))
322 },
323 {
324 N_("Switch to Tab 10")("Switch to Tab 10"),
325 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "10",
326 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "10", GDK_MOD1_MASK, GDK_KEY_00x030, NULL((void*)0), FALSE(0), TRUE(!(0))
327 },
328 {
329 N_("Switch to Tab 11")("Switch to Tab 11"),
330 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "11",
331 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "11", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
332 },
333 {
334 N_("Switch to Tab 12")("Switch to Tab 12"),
335 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "12",
336 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "12", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
337 }
338};
339
340static KeyEntry help_entries[] =
341{
342 { N_("Contents")("Contents"), KEY_HELP"help", ACCEL_PATH_HELP"<Actions>/Main/" "HelpContents", 0, GDK_KEY_F10xffbe, NULL((void*)0), FALSE(0), TRUE(!(0)) }
343};
344
345static KeyEntryList all_entries[] =
346{
347 { file_entries, G_N_ELEMENTS (file_entries)(sizeof (file_entries) / sizeof ((file_entries)[0])), N_("File")("File") },
348 { edit_entries, G_N_ELEMENTS (edit_entries)(sizeof (edit_entries) / sizeof ((edit_entries)[0])), N_("Edit")("Edit") },
349 { view_entries, G_N_ELEMENTS (view_entries)(sizeof (view_entries) / sizeof ((view_entries)[0])), N_("View")("View") },
350 { search_entries, G_N_ELEMENTS (search_entries)(sizeof (search_entries) / sizeof ((search_entries)[0])), N_("Search")("Search") },
351 { terminal_entries, G_N_ELEMENTS (terminal_entries)(sizeof (terminal_entries) / sizeof ((terminal_entries)[0])), N_("Terminal")("Terminal") },
352 { tabs_entries, G_N_ELEMENTS (tabs_entries)(sizeof (tabs_entries) / sizeof ((tabs_entries)[0])), N_("Tabs")("Tabs") },
353 { help_entries, G_N_ELEMENTS (help_entries)(sizeof (help_entries) / sizeof ((help_entries)[0])), N_("Help")("Help") }
354};
355
356enum
357{
358 ACTION_COLUMN,
359 KEYVAL_COLUMN,
360 N_COLUMNS
361};
362
363static void keys_change_notify (GSettings *settings,
364 const gchar *key,
365 gpointer user_data);
366
367static void accel_changed_callback (GtkAccelGroup *accel_group,
368 guint keyval,
369 GdkModifierType modifier,
370 GClosure *accel_closure,
371 gpointer data);
372
373static gboolean binding_from_string (const char *str,
374 guint *accelerator_key,
375 GdkModifierType *accelerator_mods);
376
377static gboolean binding_from_value (GVariant *value,
378 guint *accelerator_key,
379 GdkModifierType *accelerator_mods);
380
381static gboolean sync_idle_cb (gpointer data);
382
383static guint sync_idle_id = 0;
384static GtkAccelGroup *notification_group = NULL((void*)0);
385/* never set GSettings keys in response to receiving a GSettings notify. */
386static int inside_gsettings_notify = 0;
387static GtkWidget *edit_keys_dialog = NULL((void*)0);
388static GtkTreeStore *edit_keys_store = NULL((void*)0);
389static GHashTable *gsettings_key_to_entry;
390static GSettings *settings_keybindings;
391
392static char*
393binding_name (guint keyval,
394 GdkModifierType mask)
395{
396 if (keyval != 0)
397 return gtk_accelerator_name (keyval, mask);
398
399 return g_strdup ("disabled")g_strdup_inline ("disabled");
400}
401
402static char*
403binding_display_name (guint keyval,
404 GdkModifierType mask)
405{
406 if (keyval != 0)
407 return gtk_accelerator_get_label (keyval, mask);
408
409 return g_strdup (_("Disabled"))g_strdup_inline (gettext ("Disabled"));
410}
411
412void
413terminal_accels_init (void)
414{
415 guint i, j;
416
417 settings_keybindings = g_settings_new (CONF_KEYS_SCHEMA"org.mate.terminal" ".keybindings");
418
419 g_signal_connect (settings_keybindings,g_signal_connect_data ((settings_keybindings), ("changed"), (
((GCallback) (keys_change_notify))), (((void*)0)), ((void*)0)
, (GConnectFlags) 0)
420 "changed",g_signal_connect_data ((settings_keybindings), ("changed"), (
((GCallback) (keys_change_notify))), (((void*)0)), ((void*)0)
, (GConnectFlags) 0)
421 G_CALLBACK(keys_change_notify),g_signal_connect_data ((settings_keybindings), ("changed"), (
((GCallback) (keys_change_notify))), (((void*)0)), ((void*)0)
, (GConnectFlags) 0)
422 NULL)g_signal_connect_data ((settings_keybindings), ("changed"), (
((GCallback) (keys_change_notify))), (((void*)0)), ((void*)0)
, (GConnectFlags) 0)
;
423
424 gsettings_key_to_entry = g_hash_table_new (g_str_hash, g_str_equal);
425
426 notification_group = gtk_accel_group_new ();
427
428 for (i = 0; i < G_N_ELEMENTS (all_entries)(sizeof (all_entries) / sizeof ((all_entries)[0])); ++i)
429 {
430 for (j = 0; j < all_entries[i].n_elements; ++j)
431 {
432 KeyEntry *key_entry;
433
434 key_entry = &(all_entries[i].key_entry[j]);
435
436 g_hash_table_insert (gsettings_key_to_entry,
437 (gpointer) key_entry->gsettings_key,
438 key_entry);
439
440 key_entry->closure = g_closure_new_simple (sizeof (GClosure), key_entry);
441
442 g_closure_ref (key_entry->closure);
443 g_closure_sink (key_entry->closure);
444
445 gtk_accel_group_connect_by_path (notification_group,
446 I_(key_entry->accel_path)g_intern_static_string (key_entry->accel_path),
447 key_entry->closure);
448 keys_change_notify (settings_keybindings, key_entry->gsettings_key, NULL((void*)0));
449 }
450 }
451
452 g_signal_connect (notification_group, "accel-changed",g_signal_connect_data ((notification_group), ("accel-changed"
), (((GCallback) (accel_changed_callback))), (((void*)0)), ((
void*)0), (GConnectFlags) 0)
453 G_CALLBACK (accel_changed_callback), NULL)g_signal_connect_data ((notification_group), ("accel-changed"
), (((GCallback) (accel_changed_callback))), (((void*)0)), ((
void*)0), (GConnectFlags) 0)
;
454}
455
456void
457terminal_accels_shutdown (void)
458{
459
460 g_signal_handlers_disconnect_by_func (settings_keybindings,g_signal_handlers_disconnect_matched ((settings_keybindings),
(GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (keys_change_notify))), ((
(void*)0)))
461 G_CALLBACK(keys_change_notify),g_signal_handlers_disconnect_matched ((settings_keybindings),
(GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (keys_change_notify))), ((
(void*)0)))
462 NULL)g_signal_handlers_disconnect_matched ((settings_keybindings),
(GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (keys_change_notify))), ((
(void*)0)))
;
463 g_object_unref (settings_keybindings);
464
465 if (sync_idle_id != 0)
466 {
467 g_source_remove (sync_idle_id);
468 sync_idle_id = 0;
469
470 sync_idle_cb (NULL((void*)0));
471 }
472
473 g_hash_table_destroy (gsettings_key_to_entry);
474 gsettings_key_to_entry = NULL((void*)0);
475
476 g_object_unref (notification_group);
477 notification_group = NULL((void*)0);
478}
479
480static gboolean
481update_model_foreach (GtkTreeModel *model,
482 GtkTreePath *path,
483 GtkTreeIter *iter,
484 gpointer data)
485{
486 KeyEntry *key_entry = NULL((void*)0);
487
488 gtk_tree_model_get (model, iter,
489 KEYVAL_COLUMN, &key_entry,
490 -1);
491
492 if (key_entry == (KeyEntry *) data)
493 {
494 gtk_tree_model_row_changed (model, path, iter);
495 return TRUE(!(0));
496 }
497 return FALSE(0);
498}
499
500static void
501keys_change_notify (GSettings *settings,
502 const gchar *key,
503 gpointer user_data)
504{
505 GVariant *val;
506 KeyEntry *key_entry;
507 GdkModifierType mask;
508 guint keyval;
509
510 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr("key %s changed\n", key); } while (0)
511 "key %s changed\n",do { if (0) g_printerr("key %s changed\n", key); } while (0)
512 key)do { if (0) g_printerr("key %s changed\n", key); } while (0);
513
514 val = g_settings_get_value (settings, key);
515
516#ifdef MATE_ENABLE_DEBUG
517 _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS)if (0)
518 {
519 if (val == NULL((void*)0))
520 _terminal_debug_print (TERMINAL_DEBUG_ACCELS, " changed to be unset\n")do { if (0) g_printerr(" changed to be unset\n"); } while (0);
521 else if (!g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
522 _terminal_debug_print (TERMINAL_DEBUG_ACCELS, " changed to non-string value\n")do { if (0) g_printerr(" changed to non-string value\n"); } while
(0)
;
523 else
524 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr(" changed to \"%s\"\n", g_variant_get_string
(val, ((void*)0))); } while (0)
525 " changed to \"%s\"\n",do { if (0) g_printerr(" changed to \"%s\"\n", g_variant_get_string
(val, ((void*)0))); } while (0)
526 g_variant_get_string (val, NULL))do { if (0) g_printerr(" changed to \"%s\"\n", g_variant_get_string
(val, ((void*)0))); } while (0)
;
527 }
528#endif
529
530 key_entry = g_hash_table_lookup (gsettings_key_to_entry, key);
531 if (!key_entry)
532 {
533 /* shouldn't really happen, but let's be safe */
534 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr(" WARNING: KeyEntry for changed key not found, bailing out\n"
); } while (0)
535 " WARNING: KeyEntry for changed key not found, bailing out\n")do { if (0) g_printerr(" WARNING: KeyEntry for changed key not found, bailing out\n"
); } while (0)
;
536 return;
537 }
538
539 if (!binding_from_value (val, &keyval, &mask))
540 {
541 const char *str = g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s")) ? g_variant_get_string (val, NULL((void*)0)) : NULL((void*)0);
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
542 g_printerr ("The value \"%s\" of configuration key %s is not a valid accelerator\n",
543 str ? str : "(null)",
544 key_entry->gsettings_key);
545 return;
546 }
547 key_entry->gsettings_keyval = keyval;
548 key_entry->gsettings_mask = mask;
549
550 /* Unlock the path, so we can change its accel */
551 if (!key_entry->accel_path_unlocked)
552 gtk_accel_map_unlock_path (key_entry->accel_path);
553
554 /* sync over to GTK */
555 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr("changing path %s to %s\n", key_entry->
accel_path, binding_name (keyval, mask)); } while (0)
556 "changing path %s to %s\n",do { if (0) g_printerr("changing path %s to %s\n", key_entry->
accel_path, binding_name (keyval, mask)); } while (0)
557 key_entry->accel_path,do { if (0) g_printerr("changing path %s to %s\n", key_entry->
accel_path, binding_name (keyval, mask)); } while (0)
558 binding_name (keyval, mask))do { if (0) g_printerr("changing path %s to %s\n", key_entry->
accel_path, binding_name (keyval, mask)); } while (0)
; /* memleak */
559 inside_gsettings_notify += 1;
560 /* Note that this may return FALSE, e.g. when the entry was already set correctly. */
561 gtk_accel_map_change_entry (key_entry->accel_path,
562 keyval, mask,
563 TRUE(!(0)));
564 inside_gsettings_notify -= 1;
565
566 /* Lock the path if the GSettings key isn't writable */
567 key_entry->accel_path_unlocked = g_settings_is_writable (settings, key);
568 if (!key_entry->accel_path_unlocked)
569 gtk_accel_map_lock_path (key_entry->accel_path);
570
571 /* This seems necessary to update the tree model, since sometimes the
572 * notification on the notification_group seems not to be emitted correctly.
573 * Without this change, when trying to set an accel to e.g. Alt-T (while the main
574 * menu in the terminal windows is _Terminal with Alt-T mnemonic) only displays
575 * the accel change after a re-expose of the row.
576 * FIXME: Find out *why* the accel-changed signal is wrong here!
577 */
578 if (edit_keys_store)
579 gtk_tree_model_foreach (GTK_TREE_MODEL (edit_keys_store)((((GtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((edit_keys_store)), ((gtk_tree_model_get_type ()))))))
, update_model_foreach, key_entry);
580
581 g_variant_unref(val);
582}
583
584static void
585accel_changed_callback (GtkAccelGroup *accel_group,
586 guint keyval,
587 GdkModifierType modifier,
588 GClosure *accel_closure,
589 gpointer data)
590{
591 /* FIXME because GTK accel API is so nonsensical, we get
592 * a notify for each closure, on both the added and the removed
593 * accelerator. We just use the accel closure to find our
594 * accel entry, then update the value of that entry.
595 * We use an idle function to avoid setting the entry
596 * in GSettings when the accelerator gets removed and then
597 * setting it again when it gets added.
598 */
599 KeyEntry *key_entry;
600
601 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr("Changed accel %s closure %p\n", binding_name
(keyval, modifier), accel_closure); } while (0)
602 "Changed accel %s closure %p\n",do { if (0) g_printerr("Changed accel %s closure %p\n", binding_name
(keyval, modifier), accel_closure); } while (0)
603 binding_name (keyval, modifier), /* memleak */do { if (0) g_printerr("Changed accel %s closure %p\n", binding_name
(keyval, modifier), accel_closure); } while (0)
604 accel_closure)do { if (0) g_printerr("Changed accel %s closure %p\n", binding_name
(keyval, modifier), accel_closure); } while (0)
;
605
606 if (inside_gsettings_notify)
607 {
608 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr("Ignoring change from gtk because we're inside a GSettings notify\n"
); } while (0)
609 "Ignoring change from gtk because we're inside a GSettings notify\n")do { if (0) g_printerr("Ignoring change from gtk because we're inside a GSettings notify\n"
); } while (0)
;
610 return;
611 }
612
613 key_entry = accel_closure->data;
614 g_assert (key_entry)do { if (key_entry) ; else g_assertion_message_expr (((gchar*
) 0), "terminal-accels.c", 614, ((const char*) (__func__)), "key_entry"
); } while (0)
;
615
616 key_entry->needs_gsettings_sync = TRUE(!(0));
617
618 if (sync_idle_id == 0)
619 sync_idle_id = g_idle_add (sync_idle_cb, NULL((void*)0));
620}
621
622static gboolean
623binding_from_string (const char *str,
624 guint *accelerator_key,
625 GdkModifierType *accelerator_mods)
626{
627 if (str == NULL((void*)0) ||
628 strcmp (str, "disabled") == 0)
629 {
630 *accelerator_key = 0;
631 *accelerator_mods = 0;
632 return TRUE(!(0));
633 }
634
635 gtk_accelerator_parse (str, accelerator_key, accelerator_mods);
636 if (*accelerator_key == 0 &&
637 *accelerator_mods == 0)
638 return FALSE(0);
639
640 return TRUE(!(0));
641}
642
643static gboolean
644binding_from_value (GVariant *value,
645 guint *accelerator_key,
646 GdkModifierType *accelerator_mods)
647{
648 if (value == NULL((void*)0))
649 {
650 /* unset */
651 *accelerator_key = 0;
652 *accelerator_mods = 0;
653 return TRUE(!(0));
654 }
655
656 if (!g_variant_is_of_type (value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
657 return FALSE(0);
658
659 return binding_from_string (g_variant_get_string (value,NULL((void*)0)),
660 accelerator_key,
661 accelerator_mods);
662}
663
664static void
665add_key_entry_to_changeset (gpointer key,
666 KeyEntry *key_entry,
667 GSettings *changeset)
668{
669 GtkAccelKey gtk_key;
670
671 if (!key_entry->needs_gsettings_sync)
672 return;
673
674 key_entry->needs_gsettings_sync = FALSE(0);
675
676 if (gtk_accel_map_lookup_entry (key_entry->accel_path, &gtk_key) &&
677 (gtk_key.accel_key != key_entry->gsettings_keyval ||
678 gtk_key.accel_mods != key_entry->gsettings_mask))
679 {
680 char *accel_name;
681
682 accel_name = binding_name (gtk_key.accel_key, gtk_key.accel_mods);
683 g_settings_set_string (changeset, key_entry->gsettings_key, accel_name);
684 g_free (accel_name);
685 }
686}
687
688static gboolean
689sync_idle_cb (gpointer data)
690{
691 GSettings *changeset;
692
693 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr("GSettings sync handler\n"); } while (
0)
694 "GSettings sync handler\n")do { if (0) g_printerr("GSettings sync handler\n"); } while (
0)
;
695
696 sync_idle_id = 0;
697
698 changeset = g_settings_new (CONF_KEYS_SCHEMA"org.mate.terminal" ".keybindings");
699 g_settings_delay (changeset);
700
701 g_hash_table_foreach (gsettings_key_to_entry, (GHFunc) add_key_entry_to_changeset, changeset);
702 g_settings_apply(changeset);
703
704 g_object_unref (changeset);
705
706 return FALSE(0);
707}
708
709/* We have the same KeyEntry* in both columns;
710 * we only have two columns because we want to be able
711 * to sort by either one of them.
712 */
713
714static void
715accel_set_func (GtkTreeViewColumn *tree_column,
716 GtkCellRenderer *cell,
717 GtkTreeModel *model,
718 GtkTreeIter *iter,
719 gpointer data)
720{
721 KeyEntry *ke;
722
723 gtk_tree_model_get (model, iter,
724 KEYVAL_COLUMN, &ke,
725 -1);
726
727 if (ke == NULL((void*)0))
728 /* This is a title row */
729 g_object_set (cell,
730 "visible", FALSE(0),
731 NULL((void*)0));
732 else
733 g_object_set (cell,
734 "visible", TRUE(!(0)),
735 "sensitive", ke->accel_path_unlocked,
736 "editable", ke->accel_path_unlocked,
737 "accel-key", ke->gsettings_keyval,
738 "accel-mods", ke->gsettings_mask,
739 NULL((void*)0));
740}
741
742static int
743accel_compare_func (GtkTreeModel *model,
744 GtkTreeIter *a,
745 GtkTreeIter *b,
746 gpointer user_data)
747{
748 KeyEntry *ke_a;
749 KeyEntry *ke_b;
750 char *name_a;
751 char *name_b;
752 int result;
753
754 gtk_tree_model_get (model, a,
755 KEYVAL_COLUMN, &ke_a,
756 -1);
757 if (ke_a == NULL((void*)0))
758 {
759 gtk_tree_model_get (model, a,
760 ACTION_COLUMN, &name_a,
761 -1);
762 }
763 else
764 {
765 name_a = binding_display_name (ke_a->gsettings_keyval,
766 ke_a->gsettings_mask);
767 }
768
769 gtk_tree_model_get (model, b,
770 KEYVAL_COLUMN, &ke_b,
771 -1);
772 if (ke_b == NULL((void*)0))
773 {
774 gtk_tree_model_get (model, b,
775 ACTION_COLUMN, &name_b,
776 -1);
777 }
778 else
779 {
780 name_b = binding_display_name (ke_b->gsettings_keyval,
781 ke_b->gsettings_mask);
782 }
783
784 result = g_utf8_collate (name_a, name_b);
785
786 g_free (name_a);
787 g_free (name_b);
788
789 return result;
790}
791
792static void
793treeview_accel_changed_cb (GtkAccelGroup *accel_group,
794 guint keyval,
795 GdkModifierType modifier,
796 GClosure *accel_closure,
797 GtkTreeModel *model)
798{
799 gtk_tree_model_foreach (model, update_model_foreach, accel_closure->data);
800}
801
802static void
803accel_edited_callback (GtkCellRendererAccel *cell,
804 gchar *path_string,
805 guint keyval,
806 GdkModifierType mask,
807 guint hardware_keycode,
808 GtkTreeView *view)
809{
810 GtkTreeModel *model;
811 GtkTreePath *path;
812 GtkTreeIter iter;
813 KeyEntry *ke;
814 GtkAccelGroupEntry *entries;
815 guint n_entries;
816 char *str;
817
818 model = gtk_tree_view_get_model (view);
819
820 path = gtk_tree_path_new_from_string (path_string);
821 if (!path)
822 return;
823
824 if (!gtk_tree_model_get_iter (model, &iter, path))
825 {
826 gtk_tree_path_free (path);
827 return;
828 }
829 gtk_tree_path_free (path);
830
831 gtk_tree_model_get (model, &iter, KEYVAL_COLUMN, &ke, -1);
832
833 /* sanity check */
834 if (ke == NULL((void*)0))
835 return;
836
837 /* Check if we already have an entry using this accel */
838 entries = gtk_accel_group_query (notification_group, keyval, mask, &n_entries);
839 if (n_entries > 0)
840 {
841 if (entries[0].accel_path_quark != g_quark_from_string (ke->accel_path))
842 {
843 GtkWidget *dialog;
844 char *name;
845 KeyEntry *other_key;
846
847 name = gtk_accelerator_get_label (keyval, mask);
848 other_key = entries[0].closure->data;
849 g_assert (other_key)do { if (other_key) ; else g_assertion_message_expr (((gchar*
) 0), "terminal-accels.c", 849, ((const char*) (__func__)), "other_key"
); } while (0)
;
850
851 dialog =
852 gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)))((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((gtk_widget_get_toplevel (((((GtkWidget*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((view)), ((gtk_widget_get_type ()))))))))
), ((gtk_window_get_type ()))))))
,
853 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
854 GTK_MESSAGE_WARNING,
855 GTK_BUTTONS_OK,
856 _("The shortcut key “%s” is already bound to the “%s” action")gettext ("The shortcut key “%s” is already bound to the “%s” action"
)
,
857 name,
858
859other_key->user_visible_name ? _(other_key->user_visible_name)gettext (other_key->user_visible_name) : other_key->gsettings_key);
860 g_free (name);
861
862 g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
gtk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
863 gtk_window_present (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
);
864 }
865
866 return;
867 }
868
869 str = binding_name (keyval, mask);
870
871 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr("Edited path %s keyval %s, setting GSettings to %s\n"
, ke->accel_path, gdk_keyval_name (keyval) ? gdk_keyval_name
(keyval) : "null", str); } while (0)
872 "Edited path %s keyval %s, setting GSettings to %s\n",do { if (0) g_printerr("Edited path %s keyval %s, setting GSettings to %s\n"
, ke->accel_path, gdk_keyval_name (keyval) ? gdk_keyval_name
(keyval) : "null", str); } while (0)
873 ke->accel_path,do { if (0) g_printerr("Edited path %s keyval %s, setting GSettings to %s\n"
, ke->accel_path, gdk_keyval_name (keyval) ? gdk_keyval_name
(keyval) : "null", str); } while (0)
874 gdk_keyval_name (keyval) ? gdk_keyval_name (keyval) : "null",do { if (0) g_printerr("Edited path %s keyval %s, setting GSettings to %s\n"
, ke->accel_path, gdk_keyval_name (keyval) ? gdk_keyval_name
(keyval) : "null", str); } while (0)
875 str)do { if (0) g_printerr("Edited path %s keyval %s, setting GSettings to %s\n"
, ke->accel_path, gdk_keyval_name (keyval) ? gdk_keyval_name
(keyval) : "null", str); } while (0)
;
876#ifdef MATE_ENABLE_DEBUG
877 _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS)if (0)
878 {
879 GtkAccelKey old_key;
880
881 if (gtk_accel_map_lookup_entry (ke->accel_path, &old_key))
882 {
883 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr(" 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); } while (0)
884 " Old entry of path %s is keyval %s mask %x\n",do { if (0) g_printerr(" 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); } while (0)
885 ke->accel_path, gdk_keyval_name (old_key.accel_key), old_key.accel_mods)do { if (0) g_printerr(" 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); } while (0)
;
886 }
887 else
888 {
889 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr(" Failed to look up the old entry of path %s\n"
, ke->accel_path); } while (0)
890 " Failed to look up the old entry of path %s\n",do { if (0) g_printerr(" Failed to look up the old entry of path %s\n"
, ke->accel_path); } while (0)
891 ke->accel_path)do { if (0) g_printerr(" Failed to look up the old entry of path %s\n"
, ke->accel_path); } while (0)
;
892 }
893 }
894#endif
895
896 g_settings_set_string (settings_keybindings,
897 ke->gsettings_key,
898 str);
899 g_free (str);
900}
901
902static void
903accel_cleared_callback (GtkCellRendererAccel *cell,
904 gchar *path_string,
905 GtkTreeView *view)
906{
907 GtkTreeModel *model;
908 GtkTreePath *path;
909 GtkTreeIter iter;
910 KeyEntry *ke;
911 char *str;
912
913 model = gtk_tree_view_get_model (view);
914
915 path = gtk_tree_path_new_from_string (path_string);
916 if (!path)
917 return;
918
919 if (!gtk_tree_model_get_iter (model, &iter, path))
920 {
921 gtk_tree_path_free (path);
922 return;
923 }
924 gtk_tree_path_free (path);
925
926 gtk_tree_model_get (model, &iter, KEYVAL_COLUMN, &ke, -1);
927
928 /* sanity check */
929 if (ke == NULL((void*)0))
930 return;
931
932 ke->gsettings_keyval = 0;
933 ke->gsettings_mask = 0;
934 ke->needs_gsettings_sync = TRUE(!(0));
935
936 str = binding_name (0, 0);
937
938 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr("Cleared keybinding for GSettings %s",
ke->gsettings_key); } while (0)
939 "Cleared keybinding for GSettings %s",do { if (0) g_printerr("Cleared keybinding for GSettings %s",
ke->gsettings_key); } while (0)
940 ke->gsettings_key)do { if (0) g_printerr("Cleared keybinding for GSettings %s",
ke->gsettings_key); } while (0)
;
941
942 g_settings_set_string (settings_keybindings,
943 ke->gsettings_key,
944 str);
945 g_free (str);
946}
947
948static void
949edit_keys_dialog_destroy_cb (GtkWidget *widget,
950 gpointer user_data)
951{
952 g_signal_handlers_disconnect_by_func (notification_group, G_CALLBACK (treeview_accel_changed_cb), user_data)g_signal_handlers_disconnect_matched ((notification_group), (
GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA)
, 0, 0, ((void*)0), (((GCallback) (treeview_accel_changed_cb)
)), (user_data))
;
953 edit_keys_dialog = NULL((void*)0);
954 edit_keys_store = NULL((void*)0);
955}
956
957static void
958edit_keys_dialog_response_cb (GtkWidget *editor,
959 int response,
960 gpointer use_data)
961{
962 if (response == GTK_RESPONSE_HELP)
963 {
964 terminal_util_show_help ("mate-terminal-shortcuts", GTK_WINDOW (editor)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((editor)), ((gtk_window_get_type ()))))))
);
965 return;
966 }
967
968 gtk_widget_destroy (editor);
969}
970
971#ifdef MATE_ENABLE_DEBUG
972static void
973row_changed (GtkTreeModel *tree_model,
974 GtkTreePath *path,
975 GtkTreeIter *iter,
976 gpointer user_data)
977{
978 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr("ROW-CHANGED [%s]\n", gtk_tree_path_to_string
(path)); } while (0)
979 "ROW-CHANGED [%s]\n", gtk_tree_path_to_string (path) /* leak */)do { if (0) g_printerr("ROW-CHANGED [%s]\n", gtk_tree_path_to_string
(path)); } while (0)
;
980}
981#endif
982
983void
984terminal_edit_keys_dialog_show (GtkWindow *transient_parent)
985{
986 TerminalApp *app;
987 GtkWidget *dialog, *tree_view, *disable_mnemonics_button, *disable_menu_accel_button;
988 GtkTreeViewColumn *column;
989 GtkCellRenderer *cell_renderer;
990 GtkTreeStore *tree;
991 guint i;
992
993 if (edit_keys_dialog != NULL((void*)0))
994 goto done;
995
996 if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX"/org/mate/terminal" G_DIR_SEPARATOR_S"/" "ui/keybinding-editor.ui",
997 "keybindings-dialog", &dialog,
998 "disable-mnemonics-checkbutton", &disable_mnemonics_button,
999 "disable-menu-accel-checkbutton", &disable_menu_accel_button,
1000 "accelerators-treeview", &tree_view,
1001 NULL((void*)0)))
1002 return;
1003
1004 app = terminal_app_get ();
1005 terminal_util_bind_object_property_to_widget (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_ENABLE_MNEMONICS"enable-mnemonics",
1006 disable_mnemonics_button, 0);
1007 terminal_util_bind_object_property_to_widget (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_ENABLE_MENU_BAR_ACCEL"enable-menu-accels",
1008 disable_menu_accel_button, 0);
1009
1010 /* Column 1 */
1011 cell_renderer = gtk_cell_renderer_text_new ();
1012 column = gtk_tree_view_column_new_with_attributes (_("_Action")gettext ("_Action"),
1013 cell_renderer,
1014 "text", ACTION_COLUMN,
1015 NULL((void*)0));
1016 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
, column);
1017 gtk_tree_view_column_set_sort_column_id (column, ACTION_COLUMN);
1018
1019 /* Column 2 */
1020 cell_renderer = gtk_cell_renderer_accel_new ();
1021 g_object_set (cell_renderer,
1022 "editable", TRUE(!(0)),
1023 "accel-mode", GTK_CELL_RENDERER_ACCEL_MODE_GTK,
1024 NULL((void*)0));
1025 g_signal_connect (cell_renderer, "accel-edited",g_signal_connect_data ((cell_renderer), ("accel-edited"), (((
GCallback) (accel_edited_callback))), (tree_view), ((void*)0)
, (GConnectFlags) 0)
1026 G_CALLBACK (accel_edited_callback), tree_view)g_signal_connect_data ((cell_renderer), ("accel-edited"), (((
GCallback) (accel_edited_callback))), (tree_view), ((void*)0)
, (GConnectFlags) 0)
;
1027 g_signal_connect (cell_renderer, "accel-cleared",g_signal_connect_data ((cell_renderer), ("accel-cleared"), ((
(GCallback) (accel_cleared_callback))), (tree_view), ((void*)
0), (GConnectFlags) 0)
1028 G_CALLBACK (accel_cleared_callback), tree_view)g_signal_connect_data ((cell_renderer), ("accel-cleared"), ((
(GCallback) (accel_cleared_callback))), (tree_view), ((void*)
0), (GConnectFlags) 0)
;
1029
1030 column = gtk_tree_view_column_new ();
1031 gtk_tree_view_column_set_title (column, _("Shortcut _Key")gettext ("Shortcut _Key"));
1032 gtk_tree_view_column_pack_start (column, cell_renderer, TRUE(!(0)));
1033 gtk_tree_view_column_set_cell_data_func (column, cell_renderer, accel_set_func, NULL((void*)0), NULL((void*)0));
1034 gtk_tree_view_column_set_sort_column_id (column, KEYVAL_COLUMN);
1035 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
, column);
1036
1037 /* Add the data */
1038
1039 tree = edit_keys_store = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_POINTER((GType) ((17) << (2))));
1040
1041#ifdef MATE_ENABLE_DEBUG
1042 _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS)if (0)
1043 g_signal_connect (tree, "row-changed", G_CALLBACK (row_changed), NULL)g_signal_connect_data ((tree), ("row-changed"), (((GCallback)
(row_changed))), (((void*)0)), ((void*)0), (GConnectFlags) 0
)
;
1044#endif
1045
1046 for (i = 0; i < G_N_ELEMENTS (all_entries)(sizeof (all_entries) / sizeof ((all_entries)[0])); ++i)
1047 {
1048 GtkTreeIter parent_iter;
1049 guint j;
1050
1051 gtk_tree_store_append (tree, &parent_iter, NULL((void*)0));
1052 gtk_tree_store_set (tree, &parent_iter,
1053 ACTION_COLUMN, _(all_entries[i].user_visible_name)gettext (all_entries[i].user_visible_name),
1054 -1);
1055
1056 for (j = 0; j < all_entries[i].n_elements; ++j)
1057 {
1058 KeyEntry *key_entry = &(all_entries[i].key_entry[j]);
1059 GtkTreeIter iter;
1060
1061 gtk_tree_store_insert_with_values (tree, &iter, &parent_iter, -1,
1062 ACTION_COLUMN, _(key_entry->user_visible_name)gettext (key_entry->user_visible_name),
1063 KEYVAL_COLUMN, key_entry,
1064 -1);
1065 }
1066 }
1067
1068 gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (tree)((((GtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree)), ((gtk_tree_sortable_get_type ()))))))
,
1069 KEYVAL_COLUMN, accel_compare_func,
1070 NULL((void*)0), NULL((void*)0));
1071 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (tree)((((GtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree)), ((gtk_tree_sortable_get_type ()))))))
, ACTION_COLUMN,
1072 GTK_SORT_ASCENDING);
1073
1074 gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
, GTK_TREE_MODEL (tree)((((GtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree)), ((gtk_tree_model_get_type ()))))))
);
1075 g_object_unref (tree);
1076
1077 gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
);
1078
1079 g_signal_connect (notification_group, "accel-changed",g_signal_connect_data ((notification_group), ("accel-changed"
), (((GCallback) (treeview_accel_changed_cb))), (tree), ((void
*)0), (GConnectFlags) 0)
1080 G_CALLBACK (treeview_accel_changed_cb), tree)g_signal_connect_data ((notification_group), ("accel-changed"
), (((GCallback) (treeview_accel_changed_cb))), (tree), ((void
*)0), (GConnectFlags) 0)
;
1081
1082 edit_keys_dialog = dialog;
1083 g_signal_connect (dialog, "destroy",g_signal_connect_data ((dialog), ("destroy"), (((GCallback) (
edit_keys_dialog_destroy_cb))), (tree), ((void*)0), (GConnectFlags
) 0)
1084 G_CALLBACK (edit_keys_dialog_destroy_cb), tree)g_signal_connect_data ((dialog), ("destroy"), (((GCallback) (
edit_keys_dialog_destroy_cb))), (tree), ((void*)0), (GConnectFlags
) 0)
;
1085 g_signal_connect (dialog, "response",g_signal_connect_data ((dialog), ("response"), (((GCallback) (
edit_keys_dialog_response_cb))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
1086 G_CALLBACK (edit_keys_dialog_response_cb),g_signal_connect_data ((dialog), ("response"), (((GCallback) (
edit_keys_dialog_response_cb))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
1087 NULL)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
edit_keys_dialog_response_cb))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
1088 gtk_window_set_default_size (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
, -1, 350);
1089
1090done:
1091 gtk_window_set_transient_for (GTK_WINDOW (edit_keys_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((edit_keys_dialog)), ((gtk_window_get_type ()))))))
, transient_parent);
1092 gtk_window_present (GTK_WINDOW (edit_keys_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((edit_keys_dialog)), ((gtk_window_get_type ()))))))
);
1093}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-8ae438.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-8ae438.html new file mode 100644 index 0000000..8c0d331 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-8ae438.html @@ -0,0 +1,1773 @@ + + + +terminal-accels.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:terminal-accels.c
Warning:line 656, column 36
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name terminal-accels.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I .. -I ../src/mate-submodules/libegg -D TERMINAL_COMPILATION -D TERMINAL_RESOURCES_PATH_PREFIX="/org/mate/terminal" -D TERM_DATADIR="/usr/local/share" -D TERM_LOCALEDIR="/usr/local/share/locale" -D TERM_PKGDATADIR="/usr/local/share/mate-terminal" -D TERM_HELPDIR="/usr/local/share/help" -D SN_API_NOT_YET_FROZEN -D GDK_MULTIHEAD_SAFE -D G_DISABLE_SINGLE_INCLUDES -D PANGO_DISABLE_SINGLE_INCLUDES -D ATK_DISABLE_SINGLE_INCLUDES -D GDK_DISABLE_SINGLE_INCLUDES -D GDK_PIXBUF_DISABLE_SINGLE_INCLUDES -D GTK_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c terminal-accels.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright © 2001, 2002 Havoc Pennington, Red Hat Inc.
3 * Copyright © 2008 Christian Persch
4 * Copyright (C) 2012-2021 MATE Developers
5 *
6 * Mate-terminal is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * Mate-terminal is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <config.h>
21
22#include <string.h>
23
24#include <gdk/gdkkeysyms.h>
25
26#include "terminal-accels.h"
27#include "terminal-app.h"
28#include "terminal-debug.h"
29#include "terminal-intl.h"
30#include "terminal-profile.h"
31#include "terminal-util.h"
32
33/* NOTES
34 *
35 * There are two sources of keybindings changes, from GSettings and from
36 * the accel map (happens with in-place menu editing).
37 *
38 * When a keybinding GSettins key changes, we propagate that into the
39 * accel map.
40 * When the accel map changes, we queue a sync to GSettings.
41 *
42 * To avoid infinite loops, we short-circuit in both directions
43 * if the value is unchanged from last known.
44 *
45 * In the keybinding editor, when editing or clearing an accel, we write
46 * the change directly to GSettings and rely on the GSettings callback to
47 * actually apply the change to the accel map.
48 */
49
50#define ACCEL_PATH_ROOT"<Actions>/Main/" "<Actions>/Main/"
51#define ACCEL_PATH_NEW_TAB"<Actions>/Main/" "FileNewTab" ACCEL_PATH_ROOT"<Actions>/Main/" "FileNewTab"
52#define ACCEL_PATH_NEW_WINDOW"<Actions>/Main/" "FileNewWindow" ACCEL_PATH_ROOT"<Actions>/Main/" "FileNewWindow"
53#define ACCEL_PATH_NEW_PROFILE"<Actions>/Main/" "FileNewProfile" ACCEL_PATH_ROOT"<Actions>/Main/" "FileNewProfile"
54#define ACCEL_PATH_SAVE_CONTENTS"<Actions>/Main/" "FileSaveContents" ACCEL_PATH_ROOT"<Actions>/Main/" "FileSaveContents"
55#define ACCEL_PATH_CLOSE_TAB"<Actions>/Main/" "FileCloseTab" ACCEL_PATH_ROOT"<Actions>/Main/" "FileCloseTab"
56#define ACCEL_PATH_CLOSE_WINDOW"<Actions>/Main/" "FileCloseWindow" ACCEL_PATH_ROOT"<Actions>/Main/" "FileCloseWindow"
57#define ACCEL_PATH_COPY"<Actions>/Main/" "EditCopy" ACCEL_PATH_ROOT"<Actions>/Main/" "EditCopy"
58#define ACCEL_PATH_PASTE"<Actions>/Main/" "EditPaste" ACCEL_PATH_ROOT"<Actions>/Main/" "EditPaste"
59#define ACCEL_PATH_SELECT_ALL"<Actions>/Main/" "EditSelectAll" ACCEL_PATH_ROOT"<Actions>/Main/" "EditSelectAll"
60#define ACCEL_PATH_SEARCH_FIND"<Actions>/Main/" "SearchFind" ACCEL_PATH_ROOT"<Actions>/Main/" "SearchFind"
61#define ACCEL_PATH_SEARCH_FIND_NEXT"<Actions>/Main/" "SearchFindNext" ACCEL_PATH_ROOT"<Actions>/Main/" "SearchFindNext"
62#define ACCEL_PATH_SEARCH_FIND_PREVIOUS"<Actions>/Main/" "SearchFindPrevious" ACCEL_PATH_ROOT"<Actions>/Main/" "SearchFindPrevious"
63#define ACCEL_PATH_TOGGLE_MENUBAR"<Actions>/Main/" "ViewMenubar" ACCEL_PATH_ROOT"<Actions>/Main/" "ViewMenubar"
64#define ACCEL_PATH_FULL_SCREEN"<Actions>/Main/" "ViewFullscreen" ACCEL_PATH_ROOT"<Actions>/Main/" "ViewFullscreen"
65#define ACCEL_PATH_RESET"<Actions>/Main/" "TerminalReset" ACCEL_PATH_ROOT"<Actions>/Main/" "TerminalReset"
66#define ACCEL_PATH_RESET_AND_CLEAR"<Actions>/Main/" "TerminalResetClear" ACCEL_PATH_ROOT"<Actions>/Main/" "TerminalResetClear"
67#define ACCEL_PATH_PREV_PROFILE"<Actions>/Main/" "ProfilePrevious" ACCEL_PATH_ROOT"<Actions>/Main/" "ProfilePrevious"
68#define ACCEL_PATH_NEXT_PROFILE"<Actions>/Main/" "ProfileNext" ACCEL_PATH_ROOT"<Actions>/Main/" "ProfileNext"
69#define ACCEL_PATH_PREV_TAB"<Actions>/Main/" "TabsPrevious" ACCEL_PATH_ROOT"<Actions>/Main/" "TabsPrevious"
70#define ACCEL_PATH_NEXT_TAB"<Actions>/Main/" "TabsNext" ACCEL_PATH_ROOT"<Actions>/Main/" "TabsNext"
71#define ACCEL_PATH_SET_TERMINAL_TITLE"<Actions>/Main/" "TerminalSetTitle" ACCEL_PATH_ROOT"<Actions>/Main/" "TerminalSetTitle"
72#define ACCEL_PATH_HELP"<Actions>/Main/" "HelpContents" ACCEL_PATH_ROOT"<Actions>/Main/" "HelpContents"
73#define ACCEL_PATH_ZOOM_IN"<Actions>/Main/" "ViewZoomIn" ACCEL_PATH_ROOT"<Actions>/Main/" "ViewZoomIn"
74#define ACCEL_PATH_ZOOM_OUT"<Actions>/Main/" "ViewZoomOut" ACCEL_PATH_ROOT"<Actions>/Main/" "ViewZoomOut"
75#define ACCEL_PATH_ZOOM_NORMAL"<Actions>/Main/" "ViewZoom100" ACCEL_PATH_ROOT"<Actions>/Main/" "ViewZoom100"
76#define ACCEL_PATH_MOVE_TAB_LEFT"<Actions>/Main/" "TabsMoveLeft" ACCEL_PATH_ROOT"<Actions>/Main/" "TabsMoveLeft"
77#define ACCEL_PATH_MOVE_TAB_RIGHT"<Actions>/Main/" "TabsMoveRight" ACCEL_PATH_ROOT"<Actions>/Main/" "TabsMoveRight"
78#define ACCEL_PATH_DETACH_TAB"<Actions>/Main/" "TabsDetach" ACCEL_PATH_ROOT"<Actions>/Main/" "TabsDetach"
79#define ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" ACCEL_PATH_ROOT"<Actions>/Main/" "TabsSwitch"
80
81#define KEY_CLOSE_TAB"close-tab" "close-tab"
82#define KEY_CLOSE_WINDOW"close-window" "close-window"
83#define KEY_COPY"copy" "copy"
84#define KEY_DETACH_TAB"detach-tab" "detach-tab"
85#define KEY_FULL_SCREEN"full-screen" "full-screen"
86#define KEY_HELP"help" "help"
87#define KEY_MOVE_TAB_LEFT"move-tab-left" "move-tab-left"
88#define KEY_MOVE_TAB_RIGHT"move-tab-right" "move-tab-right"
89#define KEY_NEW_PROFILE"new-profile" "new-profile"
90#define KEY_NEW_TAB"new-tab" "new-tab"
91#define KEY_NEW_WINDOW"new-window" "new-window"
92#define KEY_NEXT_PROFILE"next-profile" "next-profile"
93#define KEY_NEXT_TAB"next-tab" "next-tab"
94#define KEY_PASTE"paste" "paste"
95#define KEY_PREV_PROFILE"prev-profile" "prev-profile"
96#define KEY_PREV_TAB"prev-tab" "prev-tab"
97#define KEY_RESET_AND_CLEAR"reset-and-clear" "reset-and-clear"
98#define KEY_RESET"reset" "reset"
99#define KEY_SEARCH_FIND"search-find" "search-find"
100#define KEY_SEARCH_FIND_NEXT"search-find-next" "search-find-next"
101#define KEY_SEARCH_FIND_PREVIOUS"search-find-previous" "search-find-previous"
102#define KEY_SELECT_ALL"select-all" "select-all"
103#define KEY_SAVE_CONTENTS"save-contents" "save-contents"
104#define KEY_SET_TERMINAL_TITLE"set-terminal-title" "set-terminal-title"
105#define KEY_TOGGLE_MENUBAR"toggle-menubar" "toggle-menubar"
106#define KEY_ZOOM_IN"zoom-in" "zoom-in"
107#define KEY_ZOOM_NORMAL"zoom-normal" "zoom-normal"
108#define KEY_ZOOM_OUT"zoom-out" "zoom-out"
109#define KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "switch-to-tab-"
110
111#if 1
112/*
113* We don't want to enable content saving until vte supports it async.
114* So we disable this code for stable versions.
115*/
116#include "terminal-version.h"
117
118#if (TERMINAL_MINOR_VERSION(28) & 1) != 0
119#define ENABLE_SAVE
120#else
121#undef ENABLE_SAVE
122#endif
123#endif
124
125typedef struct
126{
127 const char *user_visible_name;
128 const char *gsettings_key;
129 const char *accel_path;
130 /* last values received from GSettings */
131 GdkModifierType gsettings_mask;
132 guint gsettings_keyval;
133 GClosure *closure;
134 /* have gotten a notification from gtk */
135 gboolean needs_gsettings_sync;
136 gboolean accel_path_unlocked;
137} KeyEntry;
138
139typedef struct
140{
141 KeyEntry *key_entry;
142 guint n_elements;
143 const char *user_visible_name;
144} KeyEntryList;
145
146static KeyEntry file_entries[] =
147{
148 {
149 N_("New Tab")("New Tab"),
150 KEY_NEW_TAB"new-tab", ACCEL_PATH_NEW_TAB"<Actions>/Main/" "FileNewTab", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_t0x074, NULL((void*)0), FALSE(0), TRUE(!(0))
151 },
152 {
153 N_("New Window")("New Window"),
154 KEY_NEW_WINDOW"new-window", ACCEL_PATH_NEW_WINDOW"<Actions>/Main/" "FileNewWindow", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_n0x06e, NULL((void*)0), FALSE(0), TRUE(!(0))
155 },
156 {
157 N_("New Profile")("New Profile"),
158 KEY_NEW_PROFILE"new-profile", ACCEL_PATH_NEW_PROFILE"<Actions>/Main/" "FileNewProfile", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
159 },
160#ifdef ENABLE_SAVE
161 {
162 N_("Save Contents")("Save Contents"),
163 KEY_SAVE_CONTENTS"save-contents", ACCEL_PATH_SAVE_CONTENTS"<Actions>/Main/" "FileSaveContents", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
164 },
165#endif
166 {
167 N_("Close Tab")("Close Tab"),
168 KEY_CLOSE_TAB"close-tab", ACCEL_PATH_CLOSE_TAB"<Actions>/Main/" "FileCloseTab", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_w0x077, NULL((void*)0), FALSE(0), TRUE(!(0))
169 },
170 {
171 N_("Close Window")("Close Window"),
172 KEY_CLOSE_WINDOW"close-window", ACCEL_PATH_CLOSE_WINDOW"<Actions>/Main/" "FileCloseWindow", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_q0x071, NULL((void*)0), FALSE(0), TRUE(!(0))
173 },
174};
175
176static KeyEntry edit_entries[] =
177{
178 {
179 N_("Copy")("Copy"),
180 KEY_COPY"copy", ACCEL_PATH_COPY"<Actions>/Main/" "EditCopy", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_c0x063, NULL((void*)0), FALSE(0), TRUE(!(0))
181 },
182 {
183 N_("Paste")("Paste"),
184 KEY_PASTE"paste", ACCEL_PATH_PASTE"<Actions>/Main/" "EditPaste", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_v0x076, NULL((void*)0), FALSE(0), TRUE(!(0))
185 },
186 {
187 N_("Select All")("Select All"),
188 KEY_SELECT_ALL"select-all", ACCEL_PATH_SELECT_ALL"<Actions>/Main/" "EditSelectAll", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_a0x061, NULL((void*)0), FALSE(0), TRUE(!(0))
189 }
190};
191
192static KeyEntry view_entries[] =
193{
194 {
195 N_("Hide and Show menubar")("Hide and Show menubar"),
196 KEY_TOGGLE_MENUBAR"toggle-menubar", ACCEL_PATH_TOGGLE_MENUBAR"<Actions>/Main/" "ViewMenubar", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
197 },
198 {
199 N_("Full Screen")("Full Screen"),
200 KEY_FULL_SCREEN"full-screen", ACCEL_PATH_FULL_SCREEN"<Actions>/Main/" "ViewFullscreen", 0, GDK_KEY_F110xffc8, NULL((void*)0), FALSE(0), TRUE(!(0))
201 },
202 {
203 N_("Zoom In")("Zoom In"),
204 KEY_ZOOM_IN"zoom-in", ACCEL_PATH_ZOOM_IN"<Actions>/Main/" "ViewZoomIn", GDK_CONTROL_MASK, GDK_KEY_plus0x02b, NULL((void*)0), FALSE(0), TRUE(!(0))
205 },
206 {
207 N_("Zoom Out")("Zoom Out"),
208 KEY_ZOOM_OUT"zoom-out", ACCEL_PATH_ZOOM_OUT"<Actions>/Main/" "ViewZoomOut", GDK_CONTROL_MASK, GDK_KEY_minus0x02d, NULL((void*)0), FALSE(0), TRUE(!(0))
209 },
210 {
211 N_("Normal Size")("Normal Size"),
212 KEY_ZOOM_NORMAL"zoom-normal", ACCEL_PATH_ZOOM_NORMAL"<Actions>/Main/" "ViewZoom100", GDK_CONTROL_MASK, GDK_KEY_00x030, NULL((void*)0), FALSE(0), TRUE(!(0))
213 }
214};
215
216static KeyEntry search_entries[] =
217{
218 {
219 N_("Find")("Find"),
220 KEY_SEARCH_FIND"search-find", ACCEL_PATH_SEARCH_FIND"<Actions>/Main/" "SearchFind", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_f0x066, NULL((void*)0), FALSE(0), TRUE(!(0))
221 },
222 {
223 N_("Find Next")("Find Next"),
224 KEY_SEARCH_FIND_NEXT"search-find-next", ACCEL_PATH_SEARCH_FIND_NEXT"<Actions>/Main/" "SearchFindNext", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_h0x068, NULL((void*)0), FALSE(0), TRUE(!(0))
225 },
226 {
227 N_("Find Previous")("Find Previous"),
228 KEY_SEARCH_FIND_PREVIOUS"search-find-previous", ACCEL_PATH_SEARCH_FIND_PREVIOUS"<Actions>/Main/" "SearchFindPrevious", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_g0x067, NULL((void*)0), FALSE(0), TRUE(!(0))
229 }
230};
231
232static KeyEntry terminal_entries[] =
233{
234 {
235 N_("Set Title")("Set Title"),
236 KEY_SET_TERMINAL_TITLE"set-terminal-title", ACCEL_PATH_SET_TERMINAL_TITLE"<Actions>/Main/" "TerminalSetTitle", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
237 },
238 {
239 N_("Reset")("Reset"),
240 KEY_RESET"reset", ACCEL_PATH_RESET"<Actions>/Main/" "TerminalReset", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
241 },
242 {
243 N_("Reset and Clear")("Reset and Clear"),
244 KEY_RESET_AND_CLEAR"reset-and-clear", ACCEL_PATH_RESET_AND_CLEAR"<Actions>/Main/" "TerminalResetClear", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
245 },
246 {
247 N_("Switch to Previous Profile")("Switch to Previous Profile"),
248 KEY_PREV_PROFILE"prev-profile", ACCEL_PATH_PREV_PROFILE"<Actions>/Main/" "ProfilePrevious", GDK_MOD1_MASK, GDK_KEY_Page_Up0xff55, NULL((void*)0), FALSE(0), TRUE(!(0))
249 },
250 {
251 N_("Switch to Next Profile")("Switch to Next Profile"),
252 KEY_NEXT_PROFILE"next-profile", ACCEL_PATH_NEXT_PROFILE"<Actions>/Main/" "ProfileNext", GDK_MOD1_MASK, GDK_KEY_Page_Down0xff56, NULL((void*)0), FALSE(0), TRUE(!(0))
253 },
254};
255
256static KeyEntry tabs_entries[] =
257{
258 {
259 N_("Switch to Previous Tab")("Switch to Previous Tab"),
260 KEY_PREV_TAB"prev-tab", ACCEL_PATH_PREV_TAB"<Actions>/Main/" "TabsPrevious", GDK_CONTROL_MASK, GDK_KEY_Page_Up0xff55, NULL((void*)0), FALSE(0), TRUE(!(0))
261 },
262 {
263 N_("Switch to Next Tab")("Switch to Next Tab"),
264 KEY_NEXT_TAB"next-tab", ACCEL_PATH_NEXT_TAB"<Actions>/Main/" "TabsNext", GDK_CONTROL_MASK, GDK_KEY_Page_Down0xff56, NULL((void*)0), FALSE(0), TRUE(!(0))
265 },
266 {
267 N_("Move Tab to the Left")("Move Tab to the Left"),
268 KEY_MOVE_TAB_LEFT"move-tab-left", ACCEL_PATH_MOVE_TAB_LEFT"<Actions>/Main/" "TabsMoveLeft", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_Page_Up0xff55, NULL((void*)0), FALSE(0), TRUE(!(0))
269 },
270 {
271 N_("Move Tab to the Right")("Move Tab to the Right"),
272 KEY_MOVE_TAB_RIGHT"move-tab-right", ACCEL_PATH_MOVE_TAB_RIGHT"<Actions>/Main/" "TabsMoveRight", GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY_Page_Down0xff56, NULL((void*)0), FALSE(0), TRUE(!(0))
273 },
274 {
275 N_("Detach Tab")("Detach Tab"),
276 KEY_DETACH_TAB"detach-tab", ACCEL_PATH_DETACH_TAB"<Actions>/Main/" "TabsDetach", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
277 },
278 {
279 N_("Switch to Tab 1")("Switch to Tab 1"),
280 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "1",
281 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "1", GDK_MOD1_MASK, GDK_KEY_10x031, NULL((void*)0), FALSE(0), TRUE(!(0))
282 },
283 {
284 N_("Switch to Tab 2")("Switch to Tab 2"),
285 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "2",
286 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "2", GDK_MOD1_MASK, GDK_KEY_20x032, NULL((void*)0), FALSE(0), TRUE(!(0))
287 },
288 {
289 N_("Switch to Tab 3")("Switch to Tab 3"),
290 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "3",
291 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "3", GDK_MOD1_MASK, GDK_KEY_30x033, NULL((void*)0), FALSE(0), TRUE(!(0))
292 },
293 {
294 N_("Switch to Tab 4")("Switch to Tab 4"),
295 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "4",
296 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "4", GDK_MOD1_MASK, GDK_KEY_40x034, NULL((void*)0), FALSE(0), TRUE(!(0))
297 },
298 {
299 N_("Switch to Tab 5")("Switch to Tab 5"),
300 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "5",
301 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "5", GDK_MOD1_MASK, GDK_KEY_50x035, NULL((void*)0), FALSE(0), TRUE(!(0))
302 },
303 {
304 N_("Switch to Tab 6")("Switch to Tab 6"),
305 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "6",
306 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "6", GDK_MOD1_MASK, GDK_KEY_60x036, NULL((void*)0), FALSE(0), TRUE(!(0))
307 },
308 {
309 N_("Switch to Tab 7")("Switch to Tab 7"),
310 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "7",
311 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "7", GDK_MOD1_MASK, GDK_KEY_70x037, NULL((void*)0), FALSE(0), TRUE(!(0))
312 },
313 {
314 N_("Switch to Tab 8")("Switch to Tab 8"),
315 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "8",
316 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "8", GDK_MOD1_MASK, GDK_KEY_80x038, NULL((void*)0), FALSE(0), TRUE(!(0))
317 },
318 {
319 N_("Switch to Tab 9")("Switch to Tab 9"),
320 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "9",
321 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "9", GDK_MOD1_MASK, GDK_KEY_90x039, NULL((void*)0), FALSE(0), TRUE(!(0))
322 },
323 {
324 N_("Switch to Tab 10")("Switch to Tab 10"),
325 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "10",
326 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "10", GDK_MOD1_MASK, GDK_KEY_00x030, NULL((void*)0), FALSE(0), TRUE(!(0))
327 },
328 {
329 N_("Switch to Tab 11")("Switch to Tab 11"),
330 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "11",
331 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "11", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
332 },
333 {
334 N_("Switch to Tab 12")("Switch to Tab 12"),
335 KEY_SWITCH_TAB_PREFIX"switch-to-tab-" "12",
336 ACCEL_PATH_SWITCH_TAB_PREFIX"<Actions>/Main/" "TabsSwitch" "12", 0, 0, NULL((void*)0), FALSE(0), TRUE(!(0))
337 }
338};
339
340static KeyEntry help_entries[] =
341{
342 { N_("Contents")("Contents"), KEY_HELP"help", ACCEL_PATH_HELP"<Actions>/Main/" "HelpContents", 0, GDK_KEY_F10xffbe, NULL((void*)0), FALSE(0), TRUE(!(0)) }
343};
344
345static KeyEntryList all_entries[] =
346{
347 { file_entries, G_N_ELEMENTS (file_entries)(sizeof (file_entries) / sizeof ((file_entries)[0])), N_("File")("File") },
348 { edit_entries, G_N_ELEMENTS (edit_entries)(sizeof (edit_entries) / sizeof ((edit_entries)[0])), N_("Edit")("Edit") },
349 { view_entries, G_N_ELEMENTS (view_entries)(sizeof (view_entries) / sizeof ((view_entries)[0])), N_("View")("View") },
350 { search_entries, G_N_ELEMENTS (search_entries)(sizeof (search_entries) / sizeof ((search_entries)[0])), N_("Search")("Search") },
351 { terminal_entries, G_N_ELEMENTS (terminal_entries)(sizeof (terminal_entries) / sizeof ((terminal_entries)[0])), N_("Terminal")("Terminal") },
352 { tabs_entries, G_N_ELEMENTS (tabs_entries)(sizeof (tabs_entries) / sizeof ((tabs_entries)[0])), N_("Tabs")("Tabs") },
353 { help_entries, G_N_ELEMENTS (help_entries)(sizeof (help_entries) / sizeof ((help_entries)[0])), N_("Help")("Help") }
354};
355
356enum
357{
358 ACTION_COLUMN,
359 KEYVAL_COLUMN,
360 N_COLUMNS
361};
362
363static void keys_change_notify (GSettings *settings,
364 const gchar *key,
365 gpointer user_data);
366
367static void accel_changed_callback (GtkAccelGroup *accel_group,
368 guint keyval,
369 GdkModifierType modifier,
370 GClosure *accel_closure,
371 gpointer data);
372
373static gboolean binding_from_string (const char *str,
374 guint *accelerator_key,
375 GdkModifierType *accelerator_mods);
376
377static gboolean binding_from_value (GVariant *value,
378 guint *accelerator_key,
379 GdkModifierType *accelerator_mods);
380
381static gboolean sync_idle_cb (gpointer data);
382
383static guint sync_idle_id = 0;
384static GtkAccelGroup *notification_group = NULL((void*)0);
385/* never set GSettings keys in response to receiving a GSettings notify. */
386static int inside_gsettings_notify = 0;
387static GtkWidget *edit_keys_dialog = NULL((void*)0);
388static GtkTreeStore *edit_keys_store = NULL((void*)0);
389static GHashTable *gsettings_key_to_entry;
390static GSettings *settings_keybindings;
391
392static char*
393binding_name (guint keyval,
394 GdkModifierType mask)
395{
396 if (keyval != 0)
397 return gtk_accelerator_name (keyval, mask);
398
399 return g_strdup ("disabled")g_strdup_inline ("disabled");
400}
401
402static char*
403binding_display_name (guint keyval,
404 GdkModifierType mask)
405{
406 if (keyval != 0)
407 return gtk_accelerator_get_label (keyval, mask);
408
409 return g_strdup (_("Disabled"))g_strdup_inline (gettext ("Disabled"));
410}
411
412void
413terminal_accels_init (void)
414{
415 guint i, j;
416
417 settings_keybindings = g_settings_new (CONF_KEYS_SCHEMA"org.mate.terminal" ".keybindings");
418
419 g_signal_connect (settings_keybindings,g_signal_connect_data ((settings_keybindings), ("changed"), (
((GCallback) (keys_change_notify))), (((void*)0)), ((void*)0)
, (GConnectFlags) 0)
420 "changed",g_signal_connect_data ((settings_keybindings), ("changed"), (
((GCallback) (keys_change_notify))), (((void*)0)), ((void*)0)
, (GConnectFlags) 0)
421 G_CALLBACK(keys_change_notify),g_signal_connect_data ((settings_keybindings), ("changed"), (
((GCallback) (keys_change_notify))), (((void*)0)), ((void*)0)
, (GConnectFlags) 0)
422 NULL)g_signal_connect_data ((settings_keybindings), ("changed"), (
((GCallback) (keys_change_notify))), (((void*)0)), ((void*)0)
, (GConnectFlags) 0)
;
423
424 gsettings_key_to_entry = g_hash_table_new (g_str_hash, g_str_equal);
425
426 notification_group = gtk_accel_group_new ();
427
428 for (i = 0; i < G_N_ELEMENTS (all_entries)(sizeof (all_entries) / sizeof ((all_entries)[0])); ++i)
429 {
430 for (j = 0; j < all_entries[i].n_elements; ++j)
431 {
432 KeyEntry *key_entry;
433
434 key_entry = &(all_entries[i].key_entry[j]);
435
436 g_hash_table_insert (gsettings_key_to_entry,
437 (gpointer) key_entry->gsettings_key,
438 key_entry);
439
440 key_entry->closure = g_closure_new_simple (sizeof (GClosure), key_entry);
441
442 g_closure_ref (key_entry->closure);
443 g_closure_sink (key_entry->closure);
444
445 gtk_accel_group_connect_by_path (notification_group,
446 I_(key_entry->accel_path)g_intern_static_string (key_entry->accel_path),
447 key_entry->closure);
448 keys_change_notify (settings_keybindings, key_entry->gsettings_key, NULL((void*)0));
449 }
450 }
451
452 g_signal_connect (notification_group, "accel-changed",g_signal_connect_data ((notification_group), ("accel-changed"
), (((GCallback) (accel_changed_callback))), (((void*)0)), ((
void*)0), (GConnectFlags) 0)
453 G_CALLBACK (accel_changed_callback), NULL)g_signal_connect_data ((notification_group), ("accel-changed"
), (((GCallback) (accel_changed_callback))), (((void*)0)), ((
void*)0), (GConnectFlags) 0)
;
454}
455
456void
457terminal_accels_shutdown (void)
458{
459
460 g_signal_handlers_disconnect_by_func (settings_keybindings,g_signal_handlers_disconnect_matched ((settings_keybindings),
(GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (keys_change_notify))), ((
(void*)0)))
461 G_CALLBACK(keys_change_notify),g_signal_handlers_disconnect_matched ((settings_keybindings),
(GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (keys_change_notify))), ((
(void*)0)))
462 NULL)g_signal_handlers_disconnect_matched ((settings_keybindings),
(GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (keys_change_notify))), ((
(void*)0)))
;
463 g_object_unref (settings_keybindings);
464
465 if (sync_idle_id != 0)
466 {
467 g_source_remove (sync_idle_id);
468 sync_idle_id = 0;
469
470 sync_idle_cb (NULL((void*)0));
471 }
472
473 g_hash_table_destroy (gsettings_key_to_entry);
474 gsettings_key_to_entry = NULL((void*)0);
475
476 g_object_unref (notification_group);
477 notification_group = NULL((void*)0);
478}
479
480static gboolean
481update_model_foreach (GtkTreeModel *model,
482 GtkTreePath *path,
483 GtkTreeIter *iter,
484 gpointer data)
485{
486 KeyEntry *key_entry = NULL((void*)0);
487
488 gtk_tree_model_get (model, iter,
489 KEYVAL_COLUMN, &key_entry,
490 -1);
491
492 if (key_entry == (KeyEntry *) data)
493 {
494 gtk_tree_model_row_changed (model, path, iter);
495 return TRUE(!(0));
496 }
497 return FALSE(0);
498}
499
500static void
501keys_change_notify (GSettings *settings,
502 const gchar *key,
503 gpointer user_data)
504{
505 GVariant *val;
506 KeyEntry *key_entry;
507 GdkModifierType mask;
508 guint keyval;
509
510 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr("key %s changed\n", key); } while (0)
511 "key %s changed\n",do { if (0) g_printerr("key %s changed\n", key); } while (0)
512 key)do { if (0) g_printerr("key %s changed\n", key); } while (0);
513
514 val = g_settings_get_value (settings, key);
515
516#ifdef MATE_ENABLE_DEBUG
517 _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS)if (0)
518 {
519 if (val == NULL((void*)0))
520 _terminal_debug_print (TERMINAL_DEBUG_ACCELS, " changed to be unset\n")do { if (0) g_printerr(" changed to be unset\n"); } while (0);
521 else if (!g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
522 _terminal_debug_print (TERMINAL_DEBUG_ACCELS, " changed to non-string value\n")do { if (0) g_printerr(" changed to non-string value\n"); } while
(0)
;
523 else
524 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr(" changed to \"%s\"\n", g_variant_get_string
(val, ((void*)0))); } while (0)
525 " changed to \"%s\"\n",do { if (0) g_printerr(" changed to \"%s\"\n", g_variant_get_string
(val, ((void*)0))); } while (0)
526 g_variant_get_string (val, NULL))do { if (0) g_printerr(" changed to \"%s\"\n", g_variant_get_string
(val, ((void*)0))); } while (0)
;
527 }
528#endif
529
530 key_entry = g_hash_table_lookup (gsettings_key_to_entry, key);
531 if (!key_entry)
532 {
533 /* shouldn't really happen, but let's be safe */
534 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr(" WARNING: KeyEntry for changed key not found, bailing out\n"
); } while (0)
535 " WARNING: KeyEntry for changed key not found, bailing out\n")do { if (0) g_printerr(" WARNING: KeyEntry for changed key not found, bailing out\n"
); } while (0)
;
536 return;
537 }
538
539 if (!binding_from_value (val, &keyval, &mask))
540 {
541 const char *str = g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s")) ? g_variant_get_string (val, NULL((void*)0)) : NULL((void*)0);
542 g_printerr ("The value \"%s\" of configuration key %s is not a valid accelerator\n",
543 str ? str : "(null)",
544 key_entry->gsettings_key);
545 return;
546 }
547 key_entry->gsettings_keyval = keyval;
548 key_entry->gsettings_mask = mask;
549
550 /* Unlock the path, so we can change its accel */
551 if (!key_entry->accel_path_unlocked)
552 gtk_accel_map_unlock_path (key_entry->accel_path);
553
554 /* sync over to GTK */
555 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr("changing path %s to %s\n", key_entry->
accel_path, binding_name (keyval, mask)); } while (0)
556 "changing path %s to %s\n",do { if (0) g_printerr("changing path %s to %s\n", key_entry->
accel_path, binding_name (keyval, mask)); } while (0)
557 key_entry->accel_path,do { if (0) g_printerr("changing path %s to %s\n", key_entry->
accel_path, binding_name (keyval, mask)); } while (0)
558 binding_name (keyval, mask))do { if (0) g_printerr("changing path %s to %s\n", key_entry->
accel_path, binding_name (keyval, mask)); } while (0)
; /* memleak */
559 inside_gsettings_notify += 1;
560 /* Note that this may return FALSE, e.g. when the entry was already set correctly. */
561 gtk_accel_map_change_entry (key_entry->accel_path,
562 keyval, mask,
563 TRUE(!(0)));
564 inside_gsettings_notify -= 1;
565
566 /* Lock the path if the GSettings key isn't writable */
567 key_entry->accel_path_unlocked = g_settings_is_writable (settings, key);
568 if (!key_entry->accel_path_unlocked)
569 gtk_accel_map_lock_path (key_entry->accel_path);
570
571 /* This seems necessary to update the tree model, since sometimes the
572 * notification on the notification_group seems not to be emitted correctly.
573 * Without this change, when trying to set an accel to e.g. Alt-T (while the main
574 * menu in the terminal windows is _Terminal with Alt-T mnemonic) only displays
575 * the accel change after a re-expose of the row.
576 * FIXME: Find out *why* the accel-changed signal is wrong here!
577 */
578 if (edit_keys_store)
579 gtk_tree_model_foreach (GTK_TREE_MODEL (edit_keys_store)((((GtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((edit_keys_store)), ((gtk_tree_model_get_type ()))))))
, update_model_foreach, key_entry);
580
581 g_variant_unref(val);
582}
583
584static void
585accel_changed_callback (GtkAccelGroup *accel_group,
586 guint keyval,
587 GdkModifierType modifier,
588 GClosure *accel_closure,
589 gpointer data)
590{
591 /* FIXME because GTK accel API is so nonsensical, we get
592 * a notify for each closure, on both the added and the removed
593 * accelerator. We just use the accel closure to find our
594 * accel entry, then update the value of that entry.
595 * We use an idle function to avoid setting the entry
596 * in GSettings when the accelerator gets removed and then
597 * setting it again when it gets added.
598 */
599 KeyEntry *key_entry;
600
601 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr("Changed accel %s closure %p\n", binding_name
(keyval, modifier), accel_closure); } while (0)
602 "Changed accel %s closure %p\n",do { if (0) g_printerr("Changed accel %s closure %p\n", binding_name
(keyval, modifier), accel_closure); } while (0)
603 binding_name (keyval, modifier), /* memleak */do { if (0) g_printerr("Changed accel %s closure %p\n", binding_name
(keyval, modifier), accel_closure); } while (0)
604 accel_closure)do { if (0) g_printerr("Changed accel %s closure %p\n", binding_name
(keyval, modifier), accel_closure); } while (0)
;
605
606 if (inside_gsettings_notify)
607 {
608 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr("Ignoring change from gtk because we're inside a GSettings notify\n"
); } while (0)
609 "Ignoring change from gtk because we're inside a GSettings notify\n")do { if (0) g_printerr("Ignoring change from gtk because we're inside a GSettings notify\n"
); } while (0)
;
610 return;
611 }
612
613 key_entry = accel_closure->data;
614 g_assert (key_entry)do { if (key_entry) ; else g_assertion_message_expr (((gchar*
) 0), "terminal-accels.c", 614, ((const char*) (__func__)), "key_entry"
); } while (0)
;
615
616 key_entry->needs_gsettings_sync = TRUE(!(0));
617
618 if (sync_idle_id == 0)
619 sync_idle_id = g_idle_add (sync_idle_cb, NULL((void*)0));
620}
621
622static gboolean
623binding_from_string (const char *str,
624 guint *accelerator_key,
625 GdkModifierType *accelerator_mods)
626{
627 if (str == NULL((void*)0) ||
628 strcmp (str, "disabled") == 0)
629 {
630 *accelerator_key = 0;
631 *accelerator_mods = 0;
632 return TRUE(!(0));
633 }
634
635 gtk_accelerator_parse (str, accelerator_key, accelerator_mods);
636 if (*accelerator_key == 0 &&
637 *accelerator_mods == 0)
638 return FALSE(0);
639
640 return TRUE(!(0));
641}
642
643static gboolean
644binding_from_value (GVariant *value,
645 guint *accelerator_key,
646 GdkModifierType *accelerator_mods)
647{
648 if (value == NULL((void*)0))
649 {
650 /* unset */
651 *accelerator_key = 0;
652 *accelerator_mods = 0;
653 return TRUE(!(0));
654 }
655
656 if (!g_variant_is_of_type (value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
657 return FALSE(0);
658
659 return binding_from_string (g_variant_get_string (value,NULL((void*)0)),
660 accelerator_key,
661 accelerator_mods);
662}
663
664static void
665add_key_entry_to_changeset (gpointer key,
666 KeyEntry *key_entry,
667 GSettings *changeset)
668{
669 GtkAccelKey gtk_key;
670
671 if (!key_entry->needs_gsettings_sync)
672 return;
673
674 key_entry->needs_gsettings_sync = FALSE(0);
675
676 if (gtk_accel_map_lookup_entry (key_entry->accel_path, &gtk_key) &&
677 (gtk_key.accel_key != key_entry->gsettings_keyval ||
678 gtk_key.accel_mods != key_entry->gsettings_mask))
679 {
680 char *accel_name;
681
682 accel_name = binding_name (gtk_key.accel_key, gtk_key.accel_mods);
683 g_settings_set_string (changeset, key_entry->gsettings_key, accel_name);
684 g_free (accel_name);
685 }
686}
687
688static gboolean
689sync_idle_cb (gpointer data)
690{
691 GSettings *changeset;
692
693 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr("GSettings sync handler\n"); } while (
0)
694 "GSettings sync handler\n")do { if (0) g_printerr("GSettings sync handler\n"); } while (
0)
;
695
696 sync_idle_id = 0;
697
698 changeset = g_settings_new (CONF_KEYS_SCHEMA"org.mate.terminal" ".keybindings");
699 g_settings_delay (changeset);
700
701 g_hash_table_foreach (gsettings_key_to_entry, (GHFunc) add_key_entry_to_changeset, changeset);
702 g_settings_apply(changeset);
703
704 g_object_unref (changeset);
705
706 return FALSE(0);
707}
708
709/* We have the same KeyEntry* in both columns;
710 * we only have two columns because we want to be able
711 * to sort by either one of them.
712 */
713
714static void
715accel_set_func (GtkTreeViewColumn *tree_column,
716 GtkCellRenderer *cell,
717 GtkTreeModel *model,
718 GtkTreeIter *iter,
719 gpointer data)
720{
721 KeyEntry *ke;
722
723 gtk_tree_model_get (model, iter,
724 KEYVAL_COLUMN, &ke,
725 -1);
726
727 if (ke == NULL((void*)0))
728 /* This is a title row */
729 g_object_set (cell,
730 "visible", FALSE(0),
731 NULL((void*)0));
732 else
733 g_object_set (cell,
734 "visible", TRUE(!(0)),
735 "sensitive", ke->accel_path_unlocked,
736 "editable", ke->accel_path_unlocked,
737 "accel-key", ke->gsettings_keyval,
738 "accel-mods", ke->gsettings_mask,
739 NULL((void*)0));
740}
741
742static int
743accel_compare_func (GtkTreeModel *model,
744 GtkTreeIter *a,
745 GtkTreeIter *b,
746 gpointer user_data)
747{
748 KeyEntry *ke_a;
749 KeyEntry *ke_b;
750 char *name_a;
751 char *name_b;
752 int result;
753
754 gtk_tree_model_get (model, a,
755 KEYVAL_COLUMN, &ke_a,
756 -1);
757 if (ke_a == NULL((void*)0))
758 {
759 gtk_tree_model_get (model, a,
760 ACTION_COLUMN, &name_a,
761 -1);
762 }
763 else
764 {
765 name_a = binding_display_name (ke_a->gsettings_keyval,
766 ke_a->gsettings_mask);
767 }
768
769 gtk_tree_model_get (model, b,
770 KEYVAL_COLUMN, &ke_b,
771 -1);
772 if (ke_b == NULL((void*)0))
773 {
774 gtk_tree_model_get (model, b,
775 ACTION_COLUMN, &name_b,
776 -1);
777 }
778 else
779 {
780 name_b = binding_display_name (ke_b->gsettings_keyval,
781 ke_b->gsettings_mask);
782 }
783
784 result = g_utf8_collate (name_a, name_b);
785
786 g_free (name_a);
787 g_free (name_b);
788
789 return result;
790}
791
792static void
793treeview_accel_changed_cb (GtkAccelGroup *accel_group,
794 guint keyval,
795 GdkModifierType modifier,
796 GClosure *accel_closure,
797 GtkTreeModel *model)
798{
799 gtk_tree_model_foreach (model, update_model_foreach, accel_closure->data);
800}
801
802static void
803accel_edited_callback (GtkCellRendererAccel *cell,
804 gchar *path_string,
805 guint keyval,
806 GdkModifierType mask,
807 guint hardware_keycode,
808 GtkTreeView *view)
809{
810 GtkTreeModel *model;
811 GtkTreePath *path;
812 GtkTreeIter iter;
813 KeyEntry *ke;
814 GtkAccelGroupEntry *entries;
815 guint n_entries;
816 char *str;
817
818 model = gtk_tree_view_get_model (view);
819
820 path = gtk_tree_path_new_from_string (path_string);
821 if (!path)
822 return;
823
824 if (!gtk_tree_model_get_iter (model, &iter, path))
825 {
826 gtk_tree_path_free (path);
827 return;
828 }
829 gtk_tree_path_free (path);
830
831 gtk_tree_model_get (model, &iter, KEYVAL_COLUMN, &ke, -1);
832
833 /* sanity check */
834 if (ke == NULL((void*)0))
835 return;
836
837 /* Check if we already have an entry using this accel */
838 entries = gtk_accel_group_query (notification_group, keyval, mask, &n_entries);
839 if (n_entries > 0)
840 {
841 if (entries[0].accel_path_quark != g_quark_from_string (ke->accel_path))
842 {
843 GtkWidget *dialog;
844 char *name;
845 KeyEntry *other_key;
846
847 name = gtk_accelerator_get_label (keyval, mask);
848 other_key = entries[0].closure->data;
849 g_assert (other_key)do { if (other_key) ; else g_assertion_message_expr (((gchar*
) 0), "terminal-accels.c", 849, ((const char*) (__func__)), "other_key"
); } while (0)
;
850
851 dialog =
852 gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)))((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((gtk_widget_get_toplevel (((((GtkWidget*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((view)), ((gtk_widget_get_type ()))))))))
), ((gtk_window_get_type ()))))))
,
853 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
854 GTK_MESSAGE_WARNING,
855 GTK_BUTTONS_OK,
856 _("The shortcut key “%s” is already bound to the “%s” action")gettext ("The shortcut key “%s” is already bound to the “%s” action"
)
,
857 name,
858
859other_key->user_visible_name ? _(other_key->user_visible_name)gettext (other_key->user_visible_name) : other_key->gsettings_key);
860 g_free (name);
861
862 g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
gtk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
863 gtk_window_present (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
);
864 }
865
866 return;
867 }
868
869 str = binding_name (keyval, mask);
870
871 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr("Edited path %s keyval %s, setting GSettings to %s\n"
, ke->accel_path, gdk_keyval_name (keyval) ? gdk_keyval_name
(keyval) : "null", str); } while (0)
872 "Edited path %s keyval %s, setting GSettings to %s\n",do { if (0) g_printerr("Edited path %s keyval %s, setting GSettings to %s\n"
, ke->accel_path, gdk_keyval_name (keyval) ? gdk_keyval_name
(keyval) : "null", str); } while (0)
873 ke->accel_path,do { if (0) g_printerr("Edited path %s keyval %s, setting GSettings to %s\n"
, ke->accel_path, gdk_keyval_name (keyval) ? gdk_keyval_name
(keyval) : "null", str); } while (0)
874 gdk_keyval_name (keyval) ? gdk_keyval_name (keyval) : "null",do { if (0) g_printerr("Edited path %s keyval %s, setting GSettings to %s\n"
, ke->accel_path, gdk_keyval_name (keyval) ? gdk_keyval_name
(keyval) : "null", str); } while (0)
875 str)do { if (0) g_printerr("Edited path %s keyval %s, setting GSettings to %s\n"
, ke->accel_path, gdk_keyval_name (keyval) ? gdk_keyval_name
(keyval) : "null", str); } while (0)
;
876#ifdef MATE_ENABLE_DEBUG
877 _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS)if (0)
878 {
879 GtkAccelKey old_key;
880
881 if (gtk_accel_map_lookup_entry (ke->accel_path, &old_key))
882 {
883 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr(" 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); } while (0)
884 " Old entry of path %s is keyval %s mask %x\n",do { if (0) g_printerr(" 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); } while (0)
885 ke->accel_path, gdk_keyval_name (old_key.accel_key), old_key.accel_mods)do { if (0) g_printerr(" 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); } while (0)
;
886 }
887 else
888 {
889 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr(" Failed to look up the old entry of path %s\n"
, ke->accel_path); } while (0)
890 " Failed to look up the old entry of path %s\n",do { if (0) g_printerr(" Failed to look up the old entry of path %s\n"
, ke->accel_path); } while (0)
891 ke->accel_path)do { if (0) g_printerr(" Failed to look up the old entry of path %s\n"
, ke->accel_path); } while (0)
;
892 }
893 }
894#endif
895
896 g_settings_set_string (settings_keybindings,
897 ke->gsettings_key,
898 str);
899 g_free (str);
900}
901
902static void
903accel_cleared_callback (GtkCellRendererAccel *cell,
904 gchar *path_string,
905 GtkTreeView *view)
906{
907 GtkTreeModel *model;
908 GtkTreePath *path;
909 GtkTreeIter iter;
910 KeyEntry *ke;
911 char *str;
912
913 model = gtk_tree_view_get_model (view);
914
915 path = gtk_tree_path_new_from_string (path_string);
916 if (!path)
917 return;
918
919 if (!gtk_tree_model_get_iter (model, &iter, path))
920 {
921 gtk_tree_path_free (path);
922 return;
923 }
924 gtk_tree_path_free (path);
925
926 gtk_tree_model_get (model, &iter, KEYVAL_COLUMN, &ke, -1);
927
928 /* sanity check */
929 if (ke == NULL((void*)0))
930 return;
931
932 ke->gsettings_keyval = 0;
933 ke->gsettings_mask = 0;
934 ke->needs_gsettings_sync = TRUE(!(0));
935
936 str = binding_name (0, 0);
937
938 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr("Cleared keybinding for GSettings %s",
ke->gsettings_key); } while (0)
939 "Cleared keybinding for GSettings %s",do { if (0) g_printerr("Cleared keybinding for GSettings %s",
ke->gsettings_key); } while (0)
940 ke->gsettings_key)do { if (0) g_printerr("Cleared keybinding for GSettings %s",
ke->gsettings_key); } while (0)
;
941
942 g_settings_set_string (settings_keybindings,
943 ke->gsettings_key,
944 str);
945 g_free (str);
946}
947
948static void
949edit_keys_dialog_destroy_cb (GtkWidget *widget,
950 gpointer user_data)
951{
952 g_signal_handlers_disconnect_by_func (notification_group, G_CALLBACK (treeview_accel_changed_cb), user_data)g_signal_handlers_disconnect_matched ((notification_group), (
GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA)
, 0, 0, ((void*)0), (((GCallback) (treeview_accel_changed_cb)
)), (user_data))
;
953 edit_keys_dialog = NULL((void*)0);
954 edit_keys_store = NULL((void*)0);
955}
956
957static void
958edit_keys_dialog_response_cb (GtkWidget *editor,
959 int response,
960 gpointer use_data)
961{
962 if (response == GTK_RESPONSE_HELP)
963 {
964 terminal_util_show_help ("mate-terminal-shortcuts", GTK_WINDOW (editor)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((editor)), ((gtk_window_get_type ()))))))
);
965 return;
966 }
967
968 gtk_widget_destroy (editor);
969}
970
971#ifdef MATE_ENABLE_DEBUG
972static void
973row_changed (GtkTreeModel *tree_model,
974 GtkTreePath *path,
975 GtkTreeIter *iter,
976 gpointer user_data)
977{
978 _terminal_debug_print (TERMINAL_DEBUG_ACCELS,do { if (0) g_printerr("ROW-CHANGED [%s]\n", gtk_tree_path_to_string
(path)); } while (0)
979 "ROW-CHANGED [%s]\n", gtk_tree_path_to_string (path) /* leak */)do { if (0) g_printerr("ROW-CHANGED [%s]\n", gtk_tree_path_to_string
(path)); } while (0)
;
980}
981#endif
982
983void
984terminal_edit_keys_dialog_show (GtkWindow *transient_parent)
985{
986 TerminalApp *app;
987 GtkWidget *dialog, *tree_view, *disable_mnemonics_button, *disable_menu_accel_button;
988 GtkTreeViewColumn *column;
989 GtkCellRenderer *cell_renderer;
990 GtkTreeStore *tree;
991 guint i;
992
993 if (edit_keys_dialog != NULL((void*)0))
994 goto done;
995
996 if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX"/org/mate/terminal" G_DIR_SEPARATOR_S"/" "ui/keybinding-editor.ui",
997 "keybindings-dialog", &dialog,
998 "disable-mnemonics-checkbutton", &disable_mnemonics_button,
999 "disable-menu-accel-checkbutton", &disable_menu_accel_button,
1000 "accelerators-treeview", &tree_view,
1001 NULL((void*)0)))
1002 return;
1003
1004 app = terminal_app_get ();
1005 terminal_util_bind_object_property_to_widget (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_ENABLE_MNEMONICS"enable-mnemonics",
1006 disable_mnemonics_button, 0);
1007 terminal_util_bind_object_property_to_widget (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_ENABLE_MENU_BAR_ACCEL"enable-menu-accels",
1008 disable_menu_accel_button, 0);
1009
1010 /* Column 1 */
1011 cell_renderer = gtk_cell_renderer_text_new ();
1012 column = gtk_tree_view_column_new_with_attributes (_("_Action")gettext ("_Action"),
1013 cell_renderer,
1014 "text", ACTION_COLUMN,
1015 NULL((void*)0));
1016 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
, column);
1017 gtk_tree_view_column_set_sort_column_id (column, ACTION_COLUMN);
1018
1019 /* Column 2 */
1020 cell_renderer = gtk_cell_renderer_accel_new ();
1021 g_object_set (cell_renderer,
1022 "editable", TRUE(!(0)),
1023 "accel-mode", GTK_CELL_RENDERER_ACCEL_MODE_GTK,
1024 NULL((void*)0));
1025 g_signal_connect (cell_renderer, "accel-edited",g_signal_connect_data ((cell_renderer), ("accel-edited"), (((
GCallback) (accel_edited_callback))), (tree_view), ((void*)0)
, (GConnectFlags) 0)
1026 G_CALLBACK (accel_edited_callback), tree_view)g_signal_connect_data ((cell_renderer), ("accel-edited"), (((
GCallback) (accel_edited_callback))), (tree_view), ((void*)0)
, (GConnectFlags) 0)
;
1027 g_signal_connect (cell_renderer, "accel-cleared",g_signal_connect_data ((cell_renderer), ("accel-cleared"), ((
(GCallback) (accel_cleared_callback))), (tree_view), ((void*)
0), (GConnectFlags) 0)
1028 G_CALLBACK (accel_cleared_callback), tree_view)g_signal_connect_data ((cell_renderer), ("accel-cleared"), ((
(GCallback) (accel_cleared_callback))), (tree_view), ((void*)
0), (GConnectFlags) 0)
;
1029
1030 column = gtk_tree_view_column_new ();
1031 gtk_tree_view_column_set_title (column, _("Shortcut _Key")gettext ("Shortcut _Key"));
1032 gtk_tree_view_column_pack_start (column, cell_renderer, TRUE(!(0)));
1033 gtk_tree_view_column_set_cell_data_func (column, cell_renderer, accel_set_func, NULL((void*)0), NULL((void*)0));
1034 gtk_tree_view_column_set_sort_column_id (column, KEYVAL_COLUMN);
1035 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
, column);
1036
1037 /* Add the data */
1038
1039 tree = edit_keys_store = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_POINTER((GType) ((17) << (2))));
1040
1041#ifdef MATE_ENABLE_DEBUG
1042 _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS)if (0)
1043 g_signal_connect (tree, "row-changed", G_CALLBACK (row_changed), NULL)g_signal_connect_data ((tree), ("row-changed"), (((GCallback)
(row_changed))), (((void*)0)), ((void*)0), (GConnectFlags) 0
)
;
1044#endif
1045
1046 for (i = 0; i < G_N_ELEMENTS (all_entries)(sizeof (all_entries) / sizeof ((all_entries)[0])); ++i)
1047 {
1048 GtkTreeIter parent_iter;
1049 guint j;
1050
1051 gtk_tree_store_append (tree, &parent_iter, NULL((void*)0));
1052 gtk_tree_store_set (tree, &parent_iter,
1053 ACTION_COLUMN, _(all_entries[i].user_visible_name)gettext (all_entries[i].user_visible_name),
1054 -1);
1055
1056 for (j = 0; j < all_entries[i].n_elements; ++j)
1057 {
1058 KeyEntry *key_entry = &(all_entries[i].key_entry[j]);
1059 GtkTreeIter iter;
1060
1061 gtk_tree_store_insert_with_values (tree, &iter, &parent_iter, -1,
1062 ACTION_COLUMN, _(key_entry->user_visible_name)gettext (key_entry->user_visible_name),
1063 KEYVAL_COLUMN, key_entry,
1064 -1);
1065 }
1066 }
1067
1068 gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (tree)((((GtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree)), ((gtk_tree_sortable_get_type ()))))))
,
1069 KEYVAL_COLUMN, accel_compare_func,
1070 NULL((void*)0), NULL((void*)0));
1071 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (tree)((((GtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree)), ((gtk_tree_sortable_get_type ()))))))
, ACTION_COLUMN,
1072 GTK_SORT_ASCENDING);
1073
1074 gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
, GTK_TREE_MODEL (tree)((((GtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree)), ((gtk_tree_model_get_type ()))))))
);
1075 g_object_unref (tree);
1076
1077 gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
);
1078
1079 g_signal_connect (notification_group, "accel-changed",g_signal_connect_data ((notification_group), ("accel-changed"
), (((GCallback) (treeview_accel_changed_cb))), (tree), ((void
*)0), (GConnectFlags) 0)
1080 G_CALLBACK (treeview_accel_changed_cb), tree)g_signal_connect_data ((notification_group), ("accel-changed"
), (((GCallback) (treeview_accel_changed_cb))), (tree), ((void
*)0), (GConnectFlags) 0)
;
1081
1082 edit_keys_dialog = dialog;
1083 g_signal_connect (dialog, "destroy",g_signal_connect_data ((dialog), ("destroy"), (((GCallback) (
edit_keys_dialog_destroy_cb))), (tree), ((void*)0), (GConnectFlags
) 0)
1084 G_CALLBACK (edit_keys_dialog_destroy_cb), tree)g_signal_connect_data ((dialog), ("destroy"), (((GCallback) (
edit_keys_dialog_destroy_cb))), (tree), ((void*)0), (GConnectFlags
) 0)
;
1085 g_signal_connect (dialog, "response",g_signal_connect_data ((dialog), ("response"), (((GCallback) (
edit_keys_dialog_response_cb))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
1086 G_CALLBACK (edit_keys_dialog_response_cb),g_signal_connect_data ((dialog), ("response"), (((GCallback) (
edit_keys_dialog_response_cb))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
1087 NULL)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
edit_keys_dialog_response_cb))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
1088 gtk_window_set_default_size (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
, -1, 350);
1089
1090done:
1091 gtk_window_set_transient_for (GTK_WINDOW (edit_keys_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((edit_keys_dialog)), ((gtk_window_get_type ()))))))
, transient_parent);
1092 gtk_window_present (GTK_WINDOW (edit_keys_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((edit_keys_dialog)), ((gtk_window_get_type ()))))))
);
1093}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-8c30a3.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-8c30a3.html new file mode 100644 index 0000000..cb7acf2 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-8c30a3.html @@ -0,0 +1,2385 @@ + + + +terminal-profile.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:terminal-profile.c
Warning:line 649, column 46
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name terminal-profile.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I .. -I ../src/mate-submodules/libegg -D TERMINAL_COMPILATION -D TERMINAL_RESOURCES_PATH_PREFIX="/org/mate/terminal" -D TERM_DATADIR="/usr/local/share" -D TERM_LOCALEDIR="/usr/local/share/locale" -D TERM_PKGDATADIR="/usr/local/share/mate-terminal" -D TERM_HELPDIR="/usr/local/share/help" -D SN_API_NOT_YET_FROZEN -D GDK_MULTIHEAD_SAFE -D G_DISABLE_SINGLE_INCLUDES -D PANGO_DISABLE_SINGLE_INCLUDES -D ATK_DISABLE_SINGLE_INCLUDES -D GDK_DISABLE_SINGLE_INCLUDES -D GDK_PIXBUF_DISABLE_SINGLE_INCLUDES -D GTK_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c terminal-profile.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright © 2001 Havoc Pennington
3 * Copyright © 2002 Mathias Hasselmann
4 * Copyright © 2008 Christian Persch
5 * Copyright (C) 2012-2021 MATE Developers
6 *
7 * Mate-terminal is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * Mate-terminal is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <config.h>
22
23#include <string.h>
24#include <stdlib.h>
25
26#include <gtk/gtk.h>
27
28#include "terminal-app.h"
29#include "terminal-debug.h"
30#include "terminal-intl.h"
31#include "terminal-profile.h"
32#include "terminal-screen.h"
33#include "terminal-type-builtins.h"
34
35/* To add a new key, you need to:
36 *
37 * - add an entry to the enum below
38 * - add a #define with its name in terminal-profile.h
39 * - add a gobject property for it in terminal_profile_class_init
40 * - if the property's type needs special casing, add that to
41 * terminal_profile_gsettings_notify_cb and
42 * terminal_profile_gsettings_changeset_add
43 * - if necessary the default value cannot be handled via the paramspec,
44 * handle that in terminal_profile_reset_property_internal
45 */
46enum
47{
48 PROP_0,
49 PROP_ALLOW_BOLD,
50 PROP_BACKGROUND_COLOR,
51 PROP_BACKGROUND_DARKNESS,
52 PROP_BACKGROUND_IMAGE,
53 PROP_BACKGROUND_IMAGE_FILE,
54 PROP_BACKGROUND_TYPE,
55 PROP_BACKSPACE_BINDING,
56 PROP_BOLD_COLOR,
57 PROP_BOLD_COLOR_SAME_AS_FG,
58 PROP_CURSOR_BLINK_MODE,
59 PROP_CURSOR_SHAPE,
60 PROP_CUSTOM_COMMAND,
61 PROP_DEFAULT_SIZE_COLUMNS,
62 PROP_DEFAULT_SIZE_ROWS,
63 PROP_DEFAULT_SHOW_MENUBAR,
64 PROP_DELETE_BINDING,
65 PROP_EXIT_ACTION,
66 PROP_FONT,
67 PROP_FOREGROUND_COLOR,
68 PROP_LOGIN_SHELL,
69 PROP_NAME,
70 PROP_PALETTE,
71 PROP_SCROLL_BACKGROUND,
72 PROP_SCROLLBACK_LINES,
73 PROP_SCROLLBACK_UNLIMITED,
74 PROP_SCROLLBAR_POSITION,
75 PROP_SCROLL_ON_KEYSTROKE,
76 PROP_SCROLL_ON_OUTPUT,
77 PROP_SILENT_BELL,
78 PROP_TITLE,
79 PROP_TITLE_MODE,
80 PROP_USE_CUSTOM_COMMAND,
81 PROP_USE_CUSTOM_DEFAULT_SIZE,
82 PROP_USE_SKEY,
83 PROP_USE_URLS,
84 PROP_USE_SYSTEM_FONT,
85 PROP_USE_THEME_COLORS,
86 PROP_VISIBLE_NAME,
87 PROP_WORD_CHARS,
88 PROP_COPY_SELECTION,
89 LAST_PROP
90};
91
92#define KEY_ALLOW_BOLD"allow-bold" "allow-bold"
93#define KEY_BACKGROUND_COLOR"background-color" "background-color"
94#define KEY_BACKGROUND_DARKNESS"background-darkness" "background-darkness"
95#define KEY_BACKGROUND_IMAGE_FILE"background-image" "background-image"
96#define KEY_BACKGROUND_TYPE"background-type" "background-type"
97#define KEY_BACKSPACE_BINDING"backspace-binding" "backspace-binding"
98#define KEY_BOLD_COLOR"bold-color" "bold-color"
99#define KEY_BOLD_COLOR_SAME_AS_FG"bold-color-same-as-fg" "bold-color-same-as-fg"
100#define KEY_CURSOR_BLINK_MODE"cursor-blink-mode" "cursor-blink-mode"
101#define KEY_CURSOR_SHAPE"cursor-shape" "cursor-shape"
102#define KEY_CUSTOM_COMMAND"custom-command" "custom-command"
103#define KEY_DEFAULT_SHOW_MENUBAR"default-show-menubar" "default-show-menubar"
104#define KEY_DEFAULT_SIZE_COLUMNS"default-size-columns" "default-size-columns"
105#define KEY_DEFAULT_SIZE_ROWS"default-size-rows" "default-size-rows"
106#define KEY_DELETE_BINDING"delete-binding" "delete-binding"
107#define KEY_EXIT_ACTION"exit-action" "exit-action"
108#define KEY_FONT"font" "font"
109#define KEY_FOREGROUND_COLOR"foreground-color" "foreground-color"
110#define KEY_LOGIN_SHELL"login-shell" "login-shell"
111#define KEY_PALETTE"palette" "palette"
112#define KEY_SCROLL_BACKGROUND"scroll-background" "scroll-background"
113#define KEY_SCROLLBACK_LINES"scrollback-lines" "scrollback-lines"
114#define KEY_SCROLLBACK_UNLIMITED"scrollback-unlimited" "scrollback-unlimited"
115#define KEY_SCROLLBAR_POSITION"scrollbar-position" "scrollbar-position"
116#define KEY_SCROLL_ON_KEYSTROKE"scroll-on-keystroke" "scroll-on-keystroke"
117#define KEY_SCROLL_ON_OUTPUT"scroll-on-output" "scroll-on-output"
118#define KEY_SILENT_BELL"silent-bell" "silent-bell"
119#define KEY_COPY_SELECTION"copy-selection" "copy-selection"
120#define KEY_TITLE_MODE"title-mode" "title-mode"
121#define KEY_TITLE"title" "title"
122#define KEY_USE_CUSTOM_COMMAND"use-custom-command" "use-custom-command"
123#define KEY_USE_CUSTOM_DEFAULT_SIZE"use-custom-default-size" "use-custom-default-size"
124#define KEY_USE_SKEY"use-skey" "use-skey"
125#define KEY_USE_URLS"use-urls" "use-urls"
126#define KEY_USE_SYSTEM_FONT"use-system-font" "use-system-font"
127#define KEY_USE_THEME_COLORS"use-theme-colors" "use-theme-colors"
128#define KEY_VISIBLE_NAME"visible-name" "visible-name"
129#define KEY_WORD_CHARS"word-chars" "word-chars"
130
131/* Keep these in sync with the GSettings schema! */
132#define DEFAULT_ALLOW_BOLD((!(0))) (TRUE(!(0)))
133#define DEFAULT_BACKGROUND_COLOR("#FFFFDD") ("#FFFFDD")
134#define DEFAULT_BOLD_COLOR_SAME_AS_FG((!(0))) (TRUE(!(0)))
135#define DEFAULT_BACKGROUND_DARKNESS(0.5) (0.5)
136#define DEFAULT_BACKGROUND_IMAGE_FILE("") ("")
137#define DEFAULT_BACKGROUND_TYPE(TERMINAL_BACKGROUND_SOLID) (TERMINAL_BACKGROUND_SOLID)
138#define DEFAULT_BACKSPACE_BINDING(VTE_ERASE_ASCII_DELETE) (VTE_ERASE_ASCII_DELETE)
139#define DEFAULT_CURSOR_BLINK_MODE(VTE_CURSOR_BLINK_SYSTEM) (VTE_CURSOR_BLINK_SYSTEM)
140#define DEFAULT_CURSOR_SHAPE(VTE_CURSOR_SHAPE_BLOCK) (VTE_CURSOR_SHAPE_BLOCK)
141#define DEFAULT_CUSTOM_COMMAND("") ("")
142#define DEFAULT_DEFAULT_SHOW_MENUBAR((!(0))) (TRUE(!(0)))
143#define DEFAULT_DEFAULT_SIZE_COLUMNS(80) (80)
144#define DEFAULT_DEFAULT_SIZE_ROWS(24) (24)
145#define DEFAULT_DELETE_BINDING(VTE_ERASE_DELETE_SEQUENCE) (VTE_ERASE_DELETE_SEQUENCE)
146#define DEFAULT_EXIT_ACTION(TERMINAL_EXIT_CLOSE) (TERMINAL_EXIT_CLOSE)
147#define DEFAULT_FONT("Monospace 12") ("Monospace 12")
148#define DEFAULT_FOREGROUND_COLOR("#000000") ("#000000")
149#define DEFAULT_LOGIN_SHELL((0)) (FALSE(0))
150#define DEFAULT_NAME(((void*)0)) (NULL((void*)0))
151#define DEFAULT_PALETTE(terminal_palettes[0]) (terminal_palettes[TERMINAL_PALETTE_TANGO0])
152#define DEFAULT_SCROLL_BACKGROUND((!(0))) (TRUE(!(0)))
153#define DEFAULT_SCROLLBACK_LINES(512) (512)
154#define DEFAULT_SCROLLBACK_UNLIMITED((0)) (FALSE(0))
155#define DEFAULT_SCROLLBAR_POSITION(TERMINAL_SCROLLBAR_RIGHT) (TERMINAL_SCROLLBAR_RIGHT)
156#define DEFAULT_SCROLL_ON_KEYSTROKE((!(0))) (TRUE(!(0)))
157#define DEFAULT_SCROLL_ON_OUTPUT((0)) (FALSE(0))
158#define DEFAULT_SILENT_BELL((0)) (FALSE(0))
159#define DEFAULT_COPY_SELECTION((0)) (FALSE(0))
160#define DEFAULT_TITLE_MODE(TERMINAL_TITLE_REPLACE) (TERMINAL_TITLE_REPLACE)
161#define DEFAULT_TITLE(("Terminal")) (N_("Terminal")("Terminal"))
162#define DEFAULT_USE_CUSTOM_COMMAND((0)) (FALSE(0))
163#define DEFAULT_USE_CUSTOM_DEFAULT_SIZE((0)) (FALSE(0))
164#define DEFAULT_USE_SKEY((!(0))) (TRUE(!(0)))
165#define DEFAULT_USE_URLS((!(0))) (TRUE(!(0)))
166#define DEFAULT_USE_SYSTEM_FONT((!(0))) (TRUE(!(0)))
167#define DEFAULT_USE_THEME_COLORS((!(0))) (TRUE(!(0)))
168#define DEFAULT_VISIBLE_NAME(("Unnamed")) (N_("Unnamed")("Unnamed"))
169#define DEFAULT_WORD_CHARS("-A-Za-z0-9,./?%&#:_=+@~") ("-A-Za-z0-9,./?%&#:_=+@~")
170
171struct _TerminalProfilePrivate
172{
173 GValueArray *properties;
174 gboolean *locked;
175
176 GSettings *settings;
177 char *profile_dir;
178
179 GSList *dirty_pspecs;
180 guint save_idle_id;
181
182 GParamSpec *gsettings_notification_pspec;
183
184 gboolean background_load_failed;
185
186 guint forgotten : 1;
187};
188
189static const GdkRGBA terminal_palettes[TERMINAL_PALETTE_N_BUILTINS5][TERMINAL_PALETTE_SIZE16] =
190{
191 /* Tango palette */
192 {
193 { 0, 0, 0, 1 },
194 { 0.8, 0, 0, 1 },
195 { 0.305882, 0.603922, 0.0235294, 1 },
196 { 0.768627, 0.627451, 0, 1 },
197 { 0.203922, 0.396078, 0.643137, 1 },
198 { 0.458824, 0.313725, 0.482353, 1 },
199 { 0.0235294, 0.596078, 0.603922, 1 },
200 { 0.827451, 0.843137, 0.811765, 1 },
201 { 0.333333, 0.341176, 0.32549, 1 },
202 { 0.937255, 0.160784, 0.160784, 1 },
203 { 0.541176, 0.886275, 0.203922, 1 },
204 { 0.988235, 0.913725, 0.309804, 1 },
205 { 0.447059, 0.623529, 0.811765, 1 },
206 { 0.678431, 0.498039, 0.658824, 1 },
207 { 0.203922, 0.886275, 0.886275, 1 },
208 { 0.933333, 0.933333, 0.92549, 1 },
209 },
210
211 /* Linux palette */
212 {
213 { 0, 0, 0, 1 },
214 { 0.666667, 0, 0, 1 },
215 { 0, 0.666667, 0, 1 },
216 { 0.666667, 0.333333, 0, 1 },
217 { 0, 0, 0.666667, 1 },
218 { 0.666667, 0, 0.666667, 1 },
219 { 0, 0.666667, 0.666667, 1 },
220 { 0.666667, 0.666667, 0.666667, 1 },
221 { 0.333333, 0.333333, 0.333333, 1 },
222 { 1, 0.333333, 0.333333, 1 },
223 { 0.333333, 1, 0.333333, 1 },
224 { 1, 1, 0.333333, 1 },
225 { 0.333333, 0.333333, 1, 1 },
226 { 1, 0.333333, 1, 1 },
227 { 0.333333, 1, 1, 1 },
228 { 1, 1, 1, 1 },
229 },
230
231 /* XTerm palette */
232 {
233 { 0, 0, 0, 1 },
234 { 0.803922, 0, 0, 1 },
235 { 0, 0.803922, 0, 1 },
236 { 0.803922, 0.803922, 0, 1 },
237 { 0.117647, 0.564706, 1, 1 },
238 { 0.803922, 0, 0.803922, 1 },
239 { 0, 0.803922, 0.803922, 1 },
240 { 0.898039, 0.898039, 0.898039, 1 },
241 { 0.298039, 0.298039, 0.298039, 1 },
242 { 1, 0, 0, 1 },
243 { 0, 1, 0, 1 },
244 { 1, 1, 0, 1 },
245 { 0.27451, 0.509804, 0.705882, 1 },
246 { 1, 0, 1, 1 },
247 { 0, 1, 1, 1 },
248 { 1, 1, 1, 1 },
249 },
250
251 /* RXVT palette */
252 {
253 { 0, 0, 0, 1 },
254 { 0.803922, 0, 0, 1 },
255 { 0, 0.803922, 0, 1 },
256 { 0.803922, 0.803922, 0, 1 },
257 { 0, 0, 0.803922, 1 },
258 { 0.803922, 0, 0.803922, 1 },
259 { 0, 0.803922, 0.803922, 1 },
260 { 0.980392, 0.921569, 0.843137, 1 },
261 { 0.25098, 0.25098, 0.25098, 1 },
262 { 1, 0, 0, 1 },
263 { 0, 1, 0, 1 },
264 { 1, 1, 0, 1 },
265 { 0, 0, 1, 1 },
266 { 1, 0, 1, 1 },
267 { 0, 1, 1, 1 },
268 { 1, 1, 1, 1 },
269 },
270
271 /* Solarized palette (1.0.0beta2): http://ethanschoonover.com/solarized */
272 {
273 { 0.02745, 0.211764, 0.258823, 1 },
274 { 0.862745, 0.196078, 0.184313, 1 },
275 { 0.521568, 0.6, 0, 1 },
276 { 0.709803, 0.537254, 0, 1 },
277 { 0.149019, 0.545098, 0.823529, 1 },
278 { 0.82745, 0.211764, 0.509803, 1 },
279 { 0.164705, 0.631372, 0.596078, 1 },
280 { 0.933333, 0.909803, 0.835294, 1 },
281 { 0, 0.168627, 0.211764, 1 },
282 { 0.796078, 0.294117, 0.086274, 1 },
283 { 0.345098, 0.431372, 0.458823, 1 },
284 { 0.396078, 0.482352, 0.513725, 1 },
285 { 0.513725, 0.580392, 0.588235, 1 },
286 { 0.423529, 0.443137, 0.768627, 1 },
287 { 0.57647, 0.631372, 0.631372, 1 },
288 { 0.992156, 0.964705, 0.890196, 1 },
289 },
290};
291
292enum
293{
294 FORGOTTEN,
295 LAST_SIGNAL
296};
297
298static void terminal_profile_finalize (GObject *object);
299static void terminal_profile_set_property (GObject *object,
300 guint prop_id,
301 const GValue *value,
302 GParamSpec *pspec);
303static void ensure_pixbuf_property (TerminalProfile *profile,
304 guint path_prop_id,
305 guint pixbuf_prop_id,
306 gboolean *load_failed);
307
308static guint signals[LAST_SIGNAL] = { 0 };
309static GQuark gsettings_key_quark;
310
311G_DEFINE_TYPE_WITH_PRIVATE (TerminalProfile, terminal_profile, G_TYPE_OBJECT)static void terminal_profile_init (TerminalProfile *self); static
void terminal_profile_class_init (TerminalProfileClass *klass
); static GType terminal_profile_get_type_once (void); static
gpointer terminal_profile_parent_class = ((void*)0); static gint
TerminalProfile_private_offset; static void terminal_profile_class_intern_init
(gpointer klass) { terminal_profile_parent_class = g_type_class_peek_parent
(klass); if (TerminalProfile_private_offset != 0) g_type_class_adjust_private_offset
(klass, &TerminalProfile_private_offset); terminal_profile_class_init
((TerminalProfileClass*) klass); } __attribute__ ((__unused__
)) static inline gpointer terminal_profile_get_instance_private
(TerminalProfile *self) { return (((gpointer) ((guint8*) (self
) + (glong) (TerminalProfile_private_offset)))); } GType terminal_profile_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ _Static_assert (sizeof *(&static_g_define_type_id) ==
sizeof (gpointer), "Expression evaluates to false"); (void) (
0 ? (gpointer) *(&static_g_define_type_id) : ((void*)0));
(!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = terminal_profile_get_type_once
(); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } __attribute__ ((__noinline__)) static GType terminal_profile_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
(((GType) ((20) << (2))), g_intern_static_string ("TerminalProfile"
), sizeof (TerminalProfileClass), (GClassInitFunc)(void (*)(void
)) terminal_profile_class_intern_init, sizeof (TerminalProfile
), (GInstanceInitFunc)(void (*)(void)) terminal_profile_init,
(GTypeFlags) 0); { {{ TerminalProfile_private_offset = g_type_add_instance_private
(g_define_type_id, sizeof (TerminalProfilePrivate)); };} } return
g_define_type_id; }
;
312
313/* gdk_rgba_equal is too strict! */
314static gboolean
315rgba_equal (const GdkRGBA *a,
316 const GdkRGBA *b)
317{
318 gdouble dr, dg, db, da;
319
320 dr = a->red - b->red;
321 dg = a->green - b->green;
322 db = a->blue - b->blue;
323 da = a->alpha - b->alpha;
324
325 return (dr * dr + dg * dg + db * db + da * da) < 1e-4;
326}
327
328static gboolean
329palette_cmp (const GdkRGBA *ca,
330 const GdkRGBA *cb)
331{
332 guint i;
333
334 for (i = 0; i < TERMINAL_PALETTE_SIZE16; ++i)
335 if (!rgba_equal (&ca[i], &cb[i]))
336 return FALSE(0);
337
338 return TRUE(!(0));
339}
340
341static GParamSpec *
342get_pspec_from_name (TerminalProfile *profile,
343 const char *prop_name)
344{
345 TerminalProfileClass *klass = TERMINAL_PROFILE_GET_CLASS (profile)((((TerminalProfileClass*) (((GTypeInstance*) ((profile)))->
g_class))))
;
346 GParamSpec *pspec;
347
348 pspec = g_object_class_find_property (G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
, prop_name);
349 if (pspec &&
350 pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
351 pspec = NULL((void*)0);
352
353 return pspec;
354}
355
356static const GValue *
357get_prop_value_from_prop_name (TerminalProfile *profile,
358 const char *prop_name)
359{
360 TerminalProfilePrivate *priv = profile->priv;
361 GParamSpec *pspec;
362
363 pspec = get_pspec_from_name (profile, prop_name);
364 if (!pspec)
365 return NULL((void*)0);
366
367 if (G_UNLIKELY (pspec->param_id == PROP_BACKGROUND_IMAGE)(pspec->param_id == PROP_BACKGROUND_IMAGE))
368 ensure_pixbuf_property (profile, PROP_BACKGROUND_IMAGE_FILE, PROP_BACKGROUND_IMAGE, &priv->background_load_failed);
369
370 return g_value_array_get_nth (priv->properties, pspec->param_id);
371}
372
373static void
374set_value_from_palette (GValue *ret_value,
375 const GdkRGBA *colors,
376 guint n_colors)
377{
378 GValueArray *array;
379 guint i, max_n_colors;
380
381 max_n_colors = MAX (n_colors, TERMINAL_PALETTE_SIZE)(((n_colors) > (16)) ? (n_colors) : (16));
382 array = g_value_array_new (max_n_colors);
383 for (i = 0; i < max_n_colors; ++i)
384 g_value_array_append (array, NULL((void*)0));
385
386 for (i = 0; i < n_colors; ++i)
387 {
388 GValue *value = g_value_array_get_nth (array, i);
389
390 g_value_init (value, GDK_TYPE_RGBA(gdk_rgba_get_type ()));
391 g_value_set_boxed (value, &colors[i]);
392 }
393
394 /* If we haven't enough colours yet, fill up with the default palette */
395 for (i = n_colors; i < TERMINAL_PALETTE_SIZE16; ++i)
396 {
397 GValue *value = g_value_array_get_nth (array, i);
398
399 g_value_init (value, GDK_TYPE_RGBA(gdk_rgba_get_type ()));
400 g_value_set_boxed (value, &DEFAULT_PALETTE(terminal_palettes[0])[i]);
401 }
402
403 g_value_take_boxed (ret_value, array);
404}
405
406static int
407values_equal (GParamSpec *pspec,
408 const GValue *va,
409 const GValue *vb)
410{
411 /* g_param_values_cmp isn't good enough for some types, since e.g.
412 * it compares colours and font descriptions by pointer value, not
413 * with the correct compare functions. Providing extra
414 * PangoParamSpecFontDescription and GdkParamSpecColor wouldn't
415 * have fixed this either, since it's unclear how to _order_ them.
416 * Luckily we only need to check them for equality here.
417 */
418
419 if (g_param_values_cmp (pspec, va, vb) == 0)
420 return TRUE(!(0));
421
422 if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
423 return rgba_equal (g_value_get_boxed (va), g_value_get_boxed (vb));
424
425 if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
426 return pango_font_description_equal (g_value_get_boxed (va), g_value_get_boxed (vb));
427
428 if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
429 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
430 {
431 GValueArray *ara, *arb;
432 guint i;
433
434 ara = g_value_get_boxed (va);
435 arb = g_value_get_boxed (vb);
436
437 if (!ara || !arb || ara->n_values != arb->n_values)
438 return FALSE(0);
439
440 for (i = 0; i < ara->n_values; ++i)
441 if (!rgba_equal (g_value_get_boxed (g_value_array_get_nth (ara, i)),
442 g_value_get_boxed (g_value_array_get_nth (arb, i))))
443 return FALSE(0);
444
445 return TRUE(!(0));
446 }
447
448 return FALSE(0);
449}
450
451static void
452ensure_pixbuf_property (TerminalProfile *profile,
453 guint path_prop_id,
454 guint pixbuf_prop_id,
455 gboolean *load_failed)
456{
457 TerminalProfilePrivate *priv = profile->priv;
458 GValue *path_value, *pixbuf_value;
459 GdkPixbuf *pixbuf;
460 const char *path_utf8;
461 char *path;
462 GError *error = NULL((void*)0);
463
464 pixbuf_value = g_value_array_get_nth (priv->properties, pixbuf_prop_id);
465
466 pixbuf = g_value_get_object (pixbuf_value);
467 if (pixbuf)
468 return;
469
470 if (*load_failed)
471 return;
472
473 path_value = g_value_array_get_nth (priv->properties, path_prop_id);
474 path_utf8 = g_value_get_string (path_value);
475 if (!path_utf8 || !path_utf8[0])
476 goto failed;
477
478 path = g_filename_from_utf8 (path_utf8, -1, NULL((void*)0), NULL((void*)0), NULL((void*)0));
479 if (!path)
480 goto failed;
481
482 pixbuf = gdk_pixbuf_new_from_file (path, &error);
483 if (!pixbuf)
484 {
485 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
486 "Failed to load image \"%s\": %s\n",do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
487 path, error->message)do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
;
488
489 g_error_free (error);
490 g_free (path);
491 goto failed;
492 }
493
494 g_value_take_object (pixbuf_value, pixbuf);
495 g_free (path);
496 return;
497
498failed:
499 *load_failed = TRUE(!(0));
500}
501
502static void
503terminal_profile_reset_property_internal (TerminalProfile *profile,
504 GParamSpec *pspec,
505 gboolean notify)
506{
507 TerminalProfilePrivate *priv = profile->priv;
508 GValue value_ = { 0, };
509 GValue *value;
510
511 if (notify)
512 {
513 value = &value_;
514 g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
515 }
516 else
517 value = g_value_array_get_nth (priv->properties, pspec->param_id);
518 g_assert (value != NULL)do { if (value != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 518, ((const char*) (__func__
)), "value != NULL"); } while (0)
;
519
520 /* A few properties don't have defaults via the param spec; set them explicitly */
521 switch (pspec->param_id)
522 {
523 case PROP_FOREGROUND_COLOR:
524 case PROP_BOLD_COLOR:
525 {
526 GdkRGBA color;
527
528 if (!gdk_rgba_parse (&color, DEFAULT_FOREGROUND_COLOR("#000000")))
529 return;
530 color.alpha = 1.0;
531 g_value_set_boxed (value, &color);
532 break;
533 }
534 case PROP_BACKGROUND_COLOR:
535 {
536 GdkRGBA color;
537
538 if (!gdk_rgba_parse (&color, DEFAULT_BACKGROUND_COLOR("#FFFFDD")))
539 return;
540 color.alpha = 1.0;
541 g_value_set_boxed (value, &color);
542 break;
543 }
544 case PROP_FONT:
545 g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_FONT("Monospace 12")));
546 break;
547
548 case PROP_PALETTE:
549 set_value_from_palette (value, DEFAULT_PALETTE(terminal_palettes[0]), TERMINAL_PALETTE_SIZE16);
550 break;
551
552 default:
553 g_param_value_set_default (pspec, value);
554 break;
555 }
556
557 if (notify)
558 {
559 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, pspec->name, value);
560 g_value_unset (value);
561 }
562}
563
564static void
565terminal_profile_gsettings_notify_cb (GSettings *settings,
566 gchar *key,
567 gpointer user_data)
568{
569 TerminalProfile *profile = TERMINAL_PROFILE (user_data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_profile_get_type ()))))))
;
570 TerminalProfilePrivate *priv = profile->priv;
571 TerminalProfileClass *klass;
572 GVariant *settings_value;
573 GParamSpec *pspec;
574 GValue value = { 0, };
575 gboolean equal;
576 gboolean force_set = FALSE(0);
577
578 if (!key) return;
579
580 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
581 "GSettings notification for key %s [%s]\n",do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
582 key,do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
583 g_settings_is_writable (settings, key) ? "writable" : "LOCKED")do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
;
584
585 klass = TERMINAL_PROFILE_GET_CLASS (profile)((((TerminalProfileClass*) (((GTypeInstance*) ((profile)))->
g_class))))
;
586 pspec = g_hash_table_lookup (klass->gsettings_keys, key);
587 if (!pspec)
588 return; /* ignore unknown keys, for future extensibility */
589
590 priv->locked[pspec->param_id] = !g_settings_is_writable (settings, key);
591
592 settings_value = g_settings_get_value (settings, key);
593 if (!settings_value)
594 return;
595
596 g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
597
598 if (G_IS_PARAM_SPEC_BOOLEAN (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[2])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
599 {
600 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_BOOLEAN((const GVariantType *) "b")))
601 goto out;
602
603 g_value_set_boolean (&value, g_variant_get_boolean (settings_value));
604 }
605 else if (G_IS_PARAM_SPEC_STRING (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[14])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
606 {
607 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
608 goto out;
609
610 g_value_set_string (&value, g_variant_get_string (settings_value, NULL((void*)0)));
611 }
612 else if (G_IS_PARAM_SPEC_ENUM (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[10])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
613 {
614
615 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
616 goto out;
617
618 g_value_set_enum (&value, g_settings_get_enum (settings, key));
619 }
620 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
621 {
622 GdkRGBA color;
623
624 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
625 goto out;
626
627 if (!gdk_rgba_parse (&color, g_variant_get_string (settings_value, NULL((void*)0))))
628 goto out;
629
630 g_value_set_boxed (&value, &color);
631 }
632 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
633 {
634 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
635 goto out;
636
637 g_value_take_boxed (&value, pango_font_description_from_string (g_variant_get_string (settings_value, NULL((void*)0))));
638 }
639 else if (G_IS_PARAM_SPEC_DOUBLE (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[13])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
640 {
641 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_DOUBLE((const GVariantType *) "d")))
642 goto out;
643
644 g_value_set_double (&value, g_variant_get_double (settings_value));
645 }
646 else if (G_IS_PARAM_SPEC_INT (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[3])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
647 {
648 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT16((const GVariantType *) "n")) &&
649 !g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT32((const GVariantType *) "i")) &&
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
650 !g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT64((const GVariantType *) "x")))
651 goto out;
652
653 g_value_set_int (&value, g_settings_get_int(settings, key));
654 }
655 else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
656 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
657 {
658 char **color_strings;
659 GdkRGBA *colors;
660 int n_colors, i;
661
662 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
663 goto out;
664
665 color_strings = g_strsplit (g_variant_get_string (settings_value, NULL((void*)0)), ":", -1);
666 if (!color_strings)
667 goto out;
668
669 n_colors = g_strv_length (color_strings);
670 colors = g_new0 (GdkRGBA, n_colors)((GdkRGBA *) g_malloc0_n ((n_colors), sizeof (GdkRGBA)));
671 for (i = 0; i < n_colors; ++i)
672 {
673 if (!gdk_rgba_parse (&colors[i], color_strings[i]))
674 continue; /* ignore errors */
675 }
676 g_strfreev (color_strings);
677
678 /* We continue even with a palette size != TERMINAL_PALETTE_SIZE,
679 * so we can change the palette size in future versions without
680 * causing too many issues.
681 */
682 set_value_from_palette (&value, colors, n_colors);
683 g_free (colors);
684 }
685 else
686 {
687 g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
), pspec->name);
688 goto out;
689 }
690
691 if (g_param_value_validate (pspec, &value))
692 {
693 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
694 "Invalid value in GSettings for key %s was changed to comply with pspec %s\n",do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
695 key, pspec->name)do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
;
696
697 force_set = TRUE(!(0));
698 }
699
700 /* Only set the property if the value is different than our current value,
701 * so we don't go into an infinite loop.
702 */
703 equal = values_equal (pspec, &value, g_value_array_get_nth (priv->properties, pspec->param_id));
704#ifdef MATE_ENABLE_DEBUG
705 _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_PROFILE)if (0)
706 {
707 if (!equal)
708 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("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)); } while (0)
709 "Setting property %s to a different value\n"do { if (0) g_printerr("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)); } while (0)
710 " now: %s\n"do { if (0) g_printerr("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)); } while (0)
711 " new: %s\n",do { if (0) g_printerr("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)); } while (0)
712 pspec->name,do { if (0) g_printerr("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)); } while (0)
713 g_strdup_value_contents (g_value_array_get_nth (priv->properties, pspec->param_id)),do { if (0) g_printerr("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)); } while (0)
714 g_strdup_value_contents (&value))do { if (0) g_printerr("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)); } while (0)
;
715 }
716#endif
717
718 if (!equal || force_set)
719 {
720 priv->gsettings_notification_pspec = pspec;
721 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, pspec->name, &value);
722 priv->gsettings_notification_pspec = NULL((void*)0);
723 }
724
725out:
726 /* FIXME: if we arrive here through goto in the error cases,
727 * should we maybe reset the property to its default value?
728 */
729
730 g_value_unset (&value);
731 g_variant_unref (settings_value);
732}
733
734static void
735terminal_profile_gsettings_changeset_add (TerminalProfile *profile,
736 GSettings *changeset,
737 GParamSpec *pspec)
738{
739 TerminalProfilePrivate *priv = profile->priv;
740 char *key;
741 const GValue *value;
742
743 /* FIXME: do this? */
744#if 0
745 if (priv->locked[pspec->param_id])
746 return;
747
748 if (!g_settings_is_writable (priv->settings, gsettings_key, NULL((void*)0)))
749 return;
750#endif
751
752 key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
753 if (!key)
754 return;
755
756 value = g_value_array_get_nth (priv->properties, pspec->param_id);
757
758 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
759 "Adding pspec %s with value %s to the GSettings changeset\n",do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
760 pspec->name, g_strdup_value_contents (value))do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
;
761
762 if (G_IS_PARAM_SPEC_BOOLEAN (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[2])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
763 g_settings_set_boolean (changeset, key, g_value_get_boolean (value));
764 else if (G_IS_PARAM_SPEC_STRING (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[14])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
765 {
766 const char *str;
767
768 str = g_value_get_string (value);
769 g_settings_set_string (changeset, key, str ? str : "");
770 }
771 else if (G_IS_PARAM_SPEC_ENUM (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[10])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
772 {
773 const GEnumValue *eval;
774
775 eval = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)((((GParamSpecEnum*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), ((g_param_spec_types[10]))))))
->enum_class, g_value_get_enum (value));
776
777 g_settings_set_enum (changeset, key, eval->value);
778 }
779 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
780 {
781 GdkRGBA *color;
782 char str[16];
783
784 color = g_value_get_boxed (value);
785 if (!color)
786 goto cleanup;
787
788 g_snprintf (str, sizeof (str),
789 "#%04X%04X%04X",
790 (guint) (color->red * 65535),
791 (guint) (color->green * 65535),
792 (guint) (color->blue * 65535));
793
794 g_settings_set_string (changeset, key, str);
795 }
796 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
797 {
798 PangoFontDescription *font_desc;
799 char *font;
800
801 font_desc = g_value_get_boxed (value);
802 if (!font_desc)
803 goto cleanup;
804
805 font = pango_font_description_to_string (font_desc);
806 g_settings_set_string (changeset, key, font);
807 g_free (font);
808 }
809 else if (G_IS_PARAM_SPEC_DOUBLE (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[13])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
810 g_settings_set_double (changeset, key, g_value_get_double (value));
811 else if (G_IS_PARAM_SPEC_INT (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[3])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
812 g_settings_set_int (changeset, key, g_value_get_int (value));
813 else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
814 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
815 {
816 GValueArray *array;
817 GString *string;
818 guint n_colors, i;
819
820 /* We need to do this ourselves, because the gtk_color_selection_palette_to_string
821 * does not carry all the bytes, and xterm's palette is messed up...
822 */
823
824 array = g_value_get_boxed (value);
825 if (!array)
826 goto cleanup;
827
828 n_colors = array->n_values;
829 string = g_string_sized_new (n_colors * (1 /* # */ + 3 * 4) + n_colors /* : separators and terminating \0 */);
830 for (i = 0; i < n_colors; ++i)
831 {
832 GdkRGBA *color;
833
834 if (i > 0)
835 g_string_append_c (string, ':')g_string_append_c_inline (string, ':');
836
837 color = g_value_get_boxed (g_value_array_get_nth (array, i));
838 if (!color)
839 continue;
840
841 g_string_append_printf (string,
842 "#%04X%04X%04X",
843 (guint) (color->red * 65535),
844 (guint) (color->green * 65535),
845 (guint) (color->blue * 65535));
846 }
847
848 g_settings_set_string (changeset, key, string->str);
849 g_string_free (string, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) (
(string), ((!(0)))) : g_string_free_and_steal (string)) : (g_string_free
) ((string), ((!(0)))))
;
850 }
851 else
852 g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
), pspec->name);
853
854cleanup:
855 return;
856}
857
858static void
859terminal_profile_save (TerminalProfile *profile)
860{
861 TerminalProfilePrivate *priv = profile->priv;
862 GSettings *changeset;
863 GSList *l;
864 gchar *concat;
865
866 priv->save_idle_id = 0;
867 concat = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", priv->profile_dir,"/", NULL((void*)0));
868 changeset = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
869 g_free (concat);
870 g_settings_delay (changeset);
871
872 for (l = priv->dirty_pspecs; l != NULL((void*)0); l = l->next)
873 {
874 GParamSpec *pspec = (GParamSpec *) l->data;
875
876 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
877 continue;
878
879 if ((pspec->flags & G_PARAM_WRITABLE) == 0)
880 continue;
881
882 terminal_profile_gsettings_changeset_add (profile, changeset, pspec);
883 }
884
885 g_slist_free (priv->dirty_pspecs);
886 priv->dirty_pspecs = NULL((void*)0);
887
888 g_settings_apply (changeset);
889 g_object_unref (changeset);
890}
891
892static gboolean
893terminal_profile_save_idle_cb (TerminalProfile *profile)
894{
895 terminal_profile_save (profile);
896
897 /* don't run again */
898 return FALSE(0);
899}
900
901static void
902terminal_profile_schedule_save (TerminalProfile *profile,
903 GParamSpec *pspec)
904{
905 TerminalProfilePrivate *priv = profile->priv;
906
907 g_assert (pspec != NULL)do { if (pspec != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 907, ((const char*) (__func__
)), "pspec != NULL"); } while (0)
;
908
909 if (!g_slist_find (priv->dirty_pspecs, pspec))
910 priv->dirty_pspecs = g_slist_prepend (priv->dirty_pspecs, pspec);
911
912 if (priv->save_idle_id != 0)
913 return;
914
915 priv->save_idle_id = g_idle_add ((GSourceFunc) terminal_profile_save_idle_cb, profile);
916}
917
918static void
919terminal_profile_init (TerminalProfile *profile)
920{
921 TerminalProfilePrivate *priv;
922 GObjectClass *object_class;
923 GParamSpec **pspecs;
924 guint n_pspecs, i;
925
926 priv = profile->priv = terminal_profile_get_instance_private (profile);
927
928 priv->gsettings_notification_pspec = NULL((void*)0);
929 priv->locked = g_new0 (gboolean, LAST_PROP)((gboolean *) g_malloc0_n ((LAST_PROP), sizeof (gboolean)));
930
931 priv->properties = g_value_array_new (LAST_PROP);
932 for (i = 0; i < LAST_PROP; ++i)
933 g_value_array_append (priv->properties, NULL((void*)0));
934
935 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
936 for (i = 0; i < n_pspecs; ++i)
937 {
938 GParamSpec *pspec = pspecs[i];
939 GValue *value;
940
941 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
942 continue;
943
944 g_assert (pspec->param_id < LAST_PROP)do { if (pspec->param_id < LAST_PROP) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 944, ((const char*) (__func__
)), "pspec->param_id < LAST_PROP"); } while (0)
;
945 value = g_value_array_get_nth (priv->properties, pspec->param_id);
946 g_value_init (value, pspec->value_type);
947 g_param_value_set_default (pspec, value);
948 }
949
950 g_free (pspecs);
951
952 /* A few properties don't have defaults via the param spec; set them explicitly */
953 object_class = G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
;
954 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_FOREGROUND_COLOR"foreground-color"), FALSE(0));
955 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_BOLD_COLOR"bold-color"), FALSE(0));
956 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_BACKGROUND_COLOR"background-color"), FALSE(0));
957 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_FONT"font"), FALSE(0));
958 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_PALETTE"palette"), FALSE(0));
959}
960
961static GObject *
962terminal_profile_constructor (GType type,
963 guint n_construct_properties,
964 GObjectConstructParam *construct_params)
965{
966 GObject *object;
967 TerminalProfile *profile;
968 TerminalProfilePrivate *priv;
969 const char *name;
970 GParamSpec **pspecs;
971 guint n_pspecs, i;
972 gchar *concat;
973
974 object = G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->constructor
975 (type, n_construct_properties, construct_params);
976
977 profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
978 priv = profile->priv;
979
980 name = g_value_get_string (g_value_array_get_nth (priv->properties, PROP_NAME));
981 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-profile.c", 981, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
982
983 concat = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", name, "/", NULL((void*)0));
984 priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
985 g_assert (priv->settings != NULL)do { if (priv->settings != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 985, ((const char*) (__func__
)), "priv->settings != NULL"); } while (0)
;
986 g_free (concat);
987 concat = g_strconcat("changed::", priv->profile_dir, "/", NULL((void*)0));
988 g_signal_connect (priv->settings,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
989 concat,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
990 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
991 profile)g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
;
992
993 g_free (concat);
994
995 /* Now load those properties from GSettings that were not set as construction params */
996 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
997 for (i = 0; i < n_pspecs; ++i)
998 {
999 GParamSpec *pspec = pspecs[i];
1000 guint j;
1001 gboolean is_construct = FALSE(0);
1002 char *key;
1003
1004 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
1005 continue;
1006
1007 if ((pspec->flags & G_PARAM_WRITABLE) == 0 ||
1008 (pspec->flags & G_PARAM_CONSTRUCT_ONLY) != 0)
1009 continue;
1010
1011 for (j = 0; j < n_construct_properties; ++j)
1012 if (pspec == construct_params[j].pspec)
1013 {
1014 is_construct = TRUE(!(0));
1015 break;
1016 }
1017
1018 if (is_construct)
1019 continue;
1020
1021 key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
1022 if (!key)
1023 continue;
1024
1025 terminal_profile_gsettings_notify_cb (priv->settings, key, profile);
1026 }
1027
1028 g_free (pspecs);
1029
1030 return object;
1031}
1032
1033static void
1034terminal_profile_finalize (GObject *object)
1035{
1036 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1037 TerminalProfilePrivate *priv = profile->priv;
1038
1039 g_signal_handlers_disconnect_by_func (priv->settings,g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1040 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1041 profile)g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
;
1042
1043 if (priv->save_idle_id)
1044 {
1045 g_source_remove (priv->save_idle_id);
1046
1047 /* Save now */
1048 terminal_profile_save (profile);
1049 }
1050
1051 _terminal_profile_forget (profile);
1052
1053 g_object_unref (priv->settings);
1054
1055 g_free (priv->profile_dir);
1056 g_free (priv->locked);
1057 g_value_array_free (priv->properties);
1058
1059 G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->finalize (object);
1060}
1061
1062static void
1063terminal_profile_get_property (GObject *object,
1064 guint prop_id,
1065 GValue *value,
1066 GParamSpec *pspec)
1067{
1068 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1069 TerminalProfilePrivate *priv = profile->priv;
1070
1071 if (prop_id == 0 || prop_id >= LAST_PROP)
1072 {
1073 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-profile.c", 1073, ("property"), _glib__property_id
, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance
*) (_glib__pspec))->g_class))->g_type)))), (g_type_name
((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1074 return;
1075 }
1076
1077 /* Note: When adding things here, do the same in get_prop_value_from_prop_name! */
1078 switch (prop_id)
1079 {
1080 case PROP_BACKGROUND_IMAGE:
1081 ensure_pixbuf_property (profile, PROP_BACKGROUND_IMAGE_FILE, PROP_BACKGROUND_IMAGE, &priv->background_load_failed);
1082 break;
1083 default:
1084 break;
1085 }
1086
1087 g_value_copy (g_value_array_get_nth (priv->properties, prop_id), value);
1088}
1089
1090static void
1091terminal_profile_set_property (GObject *object,
1092 guint prop_id,
1093 const GValue *value,
1094 GParamSpec *pspec)
1095{
1096 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1097 TerminalProfilePrivate *priv = profile->priv;
1098 GValue *prop_value;
1099
1100 if (prop_id == 0 || prop_id >= LAST_PROP)
1101 {
1102 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-profile.c", 1102, ("property"), _glib__property_id
, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance
*) (_glib__pspec))->g_class))->g_type)))), (g_type_name
((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1103 return;
1104 }
1105
1106 prop_value = g_value_array_get_nth (priv->properties, prop_id);
1107
1108 /* Preprocessing */
1109 switch (prop_id)
1110 {
1111#if 0
1112 case PROP_FONT:
1113 {
1114 PangoFontDescription *font_desc, *new_font_desc;
1115
1116 font_desc = g_value_get_boxed (prop_value);
1117 new_font_desc = g_value_get_boxed (value);
1118
1119 if (font_desc && new_font_desc)
1120 {
1121 /* Merge in case the new string isn't complete enough to load a font */
1122 pango_font_description_merge (font_desc, new_font_desc, TRUE(!(0)));
1123 pango_font_description_free (new_font_desc);
1124 break;
1125 }
1126
1127 /* fall-through */
1128 }
1129#endif
1130 default:
1131 g_value_copy (value, prop_value);
1132 break;
1133 }
1134
1135 /* Postprocessing */
1136 switch (prop_id)
1137 {
1138 case PROP_NAME:
1139 {
1140 const char *name = g_value_get_string (value);
1141
1142 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-profile.c", 1142, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
1143 priv->profile_dir = g_strdup (name)g_strdup_inline (name);
1144 if (priv->settings != NULL((void*)0)) {
1145 gchar *concat;
1146 g_signal_handlers_disconnect_by_func (priv->settings,g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1147 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1148 profile)g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
;
1149 g_object_unref (priv->settings);
1150 concat= g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", priv->profile_dir, "/", NULL((void*)0));
1151 priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
1152 g_free (concat);
1153 concat = g_strconcat("changed::", priv->profile_dir, "/", NULL((void*)0));
1154 g_signal_connect (priv->settings,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1155 concat,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1156 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1157 profile)g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
;
1158 g_free (concat);
1159 }
1160 break;
1161 }
1162
1163 case PROP_BACKGROUND_IMAGE_FILE:
1164 /* Clear the cached image */
1165 g_value_set_object (g_value_array_get_nth (priv->properties, PROP_BACKGROUND_IMAGE), NULL((void*)0));
1166 priv->background_load_failed = FALSE(0);
1167 g_object_notify (object, TERMINAL_PROFILE_BACKGROUND_IMAGE"background-image");
1168 break;
1169
1170 default:
1171 break;
1172 }
1173}
1174
1175static void
1176terminal_profile_notify (GObject *object,
1177 GParamSpec *pspec)
1178{
1179 TerminalProfilePrivate *priv = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
->priv;
1180 void (* notify) (GObject *, GParamSpec *) = G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->notify;
1181
1182 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
1183 "Property notification for prop %s\n",do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
1184 pspec->name)do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
;
1185
1186 if (notify)
1187 notify (object, pspec);
1188
1189 if (pspec->owner_type == TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) &&
1190 (pspec->flags & G_PARAM_WRITABLE) &&
1191 g_param_spec_get_qdata (pspec, gsettings_key_quark) != NULL((void*)0) &&
1192 pspec != priv->gsettings_notification_pspec)
1193 terminal_profile_schedule_save (TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
, pspec);
1194}
1195
1196static void
1197terminal_profile_class_init (TerminalProfileClass *klass)
1198{
1199 GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
;
1200
1201 gsettings_key_quark = g_quark_from_static_string ("GT::GSettingsKey");
1202
1203 object_class->constructor = terminal_profile_constructor;
1204 object_class->finalize = terminal_profile_finalize;
1205 object_class->get_property = terminal_profile_get_property;
1206 object_class->set_property = terminal_profile_set_property;
1207 object_class->notify = terminal_profile_notify;
1208
1209 signals[FORGOTTEN] =
1210 g_signal_new ("forgotten",
1211 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1212 G_SIGNAL_RUN_LAST,
1213 G_STRUCT_OFFSET (TerminalProfileClass, forgotten)((glong) __builtin_offsetof(TerminalProfileClass, forgotten)),
1214 NULL((void*)0), NULL((void*)0),
1215 g_cclosure_marshal_VOID__VOID,
1216 G_TYPE_NONE((GType) ((1) << (2))), 0);
1217
1218 /* gsettings_key -> pspec hash */
1219 klass->gsettings_keys = g_hash_table_new (g_str_hash, g_str_equal);
1220
1221#define TERMINAL_PROFILE_PSPEC_STATIC(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
1222
1223#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);
}
\
1224{\
1225 GParamSpec *pspec = propSpec;\
1226 g_object_class_install_property (object_class, propId, pspec);\
1227 g_param_spec_set_qdata (pspec, gsettings_key_quark, (gpointer) propGSettings);\
1228 g_hash_table_insert (klass->gsettings_keys, (gpointer) propGSettings, pspec);\
1229}
1230
1231#define TERMINAL_PROFILE_PROPERTY_OUTER(propId, propSpec){ GParamSpec *pspec = propSpec; g_object_class_install_property
(object_class, propId, pspec);}
\
1232{\
1233 GParamSpec *pspec = propSpec;\
1234 g_object_class_install_property (object_class, propId, pspec);\
1235}
1236
1237#define TERMINAL_PROFILE_PROPERTY_BOOLEAN(prop, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1238 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1239 g_param_spec_boolean (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1240 propDefault,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1241 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1242 propGSettings){ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1243
1244#define TERMINAL_PROFILE_PROPERTY_BOXED(prop, propType, propGSettings){ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1245 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1246 g_param_spec_boxed (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1247 propType,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1248 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1249 propGSettings){ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1250
1251#define TERMINAL_PROFILE_PROPERTY_DOUBLE(prop, propMin, propMax, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1252 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1253 g_param_spec_double (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1254 propMin, propMax, propDefault,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1255 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1256 propGSettings){ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1257
1258#define TERMINAL_PROFILE_PROPERTY_ENUM(prop, propType, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1259 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1260 g_param_spec_enum (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1261 propType, propDefault,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1262 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1263 propGSettings){ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1264
1265#define TERMINAL_PROFILE_PROPERTY_INT(prop, propMin, propMax, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1266 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1267 g_param_spec_int (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1268 propMin, propMax, propDefault,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1269 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1270 propGSettings){ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1271
1272 /* these are all read-only */
1273#define TERMINAL_PROFILE_PROPERTY_OBJECT(prop, propType){ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec);}
\
1274 TERMINAL_PROFILE_PROPERTY_OUTER (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1275 g_param_spec_object (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1276 propType,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1277 G_PARAM_READABLE | TERMINAL_PROFILE_PSPEC_STATIC)){ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1278
1279#define TERMINAL_PROFILE_PROPERTY_STRING(prop, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1280 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1281 g_param_spec_string (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1282 propDefault,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1283 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1284 propGSettings){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1285
1286#define TERMINAL_PROFILE_PROPERTY_STRING_CO(prop, propDefault){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec);}
\
1287 TERMINAL_PROFILE_PROPERTY_OUTER (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1288 g_param_spec_string (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1289 propDefault,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1290 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | TERMINAL_PROFILE_PSPEC_STATIC)){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1291
1292#define TERMINAL_PROFILE_PROPERTY_VALUE_ARRAY_BOXED(prop, propElementName, propElementType, propGSettings){ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1293 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1294 g_param_spec_value_array (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1295 g_param_spec_boxed (propElementName, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1296 propElementType, \{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1297 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1298 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1299 propGSettings){ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1300
1301 TERMINAL_PROFILE_PROPERTY_BOOLEAN (ALLOW_BOLD, DEFAULT_ALLOW_BOLD, KEY_ALLOW_BOLD){ GParamSpec *pspec = g_param_spec_boolean ("allow-bold", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_ALLOW_BOLD, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "allow-bold"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "allow-bold", pspec);}
;
1302 TERMINAL_PROFILE_PROPERTY_BOOLEAN (BOLD_COLOR_SAME_AS_FG, DEFAULT_BOLD_COLOR_SAME_AS_FG, KEY_BOLD_COLOR_SAME_AS_FG){ GParamSpec *pspec = g_param_spec_boolean ("bold-color-same-as-fg"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BOLD_COLOR_SAME_AS_FG, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "bold-color-same-as-fg"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "bold-color-same-as-fg"
, pspec);}
;
1303 TERMINAL_PROFILE_PROPERTY_BOOLEAN (DEFAULT_SHOW_MENUBAR, DEFAULT_DEFAULT_SHOW_MENUBAR, KEY_DEFAULT_SHOW_MENUBAR){ GParamSpec *pspec = g_param_spec_boolean ("default-show-menubar"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_DEFAULT_SHOW_MENUBAR, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "default-show-menubar"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "default-show-menubar"
, pspec);}
;
1304 TERMINAL_PROFILE_PROPERTY_BOOLEAN (LOGIN_SHELL, DEFAULT_LOGIN_SHELL, KEY_LOGIN_SHELL){ GParamSpec *pspec = g_param_spec_boolean ("login-shell", ((
void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_LOGIN_SHELL, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "login-shell"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "login-shell", pspec);
}
;
1305 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_BACKGROUND, DEFAULT_SCROLL_BACKGROUND, KEY_SCROLL_BACKGROUND){ GParamSpec *pspec = g_param_spec_boolean ("scroll-background"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_BACKGROUND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-background")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-background"
, pspec);}
;
1306 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLLBACK_UNLIMITED, DEFAULT_SCROLLBACK_UNLIMITED, KEY_SCROLLBACK_UNLIMITED){ GParamSpec *pspec = g_param_spec_boolean ("scrollback-unlimited"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLLBACK_UNLIMITED, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scrollback-unlimited"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scrollback-unlimited"
, pspec);}
;
1307 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_KEYSTROKE, DEFAULT_SCROLL_ON_KEYSTROKE, KEY_SCROLL_ON_KEYSTROKE){ GParamSpec *pspec = g_param_spec_boolean ("scroll-on-keystroke"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_ON_KEYSTROKE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-on-keystroke"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-on-keystroke"
, pspec);}
;
1308 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_OUTPUT, DEFAULT_SCROLL_ON_OUTPUT, KEY_SCROLL_ON_OUTPUT){ GParamSpec *pspec = g_param_spec_boolean ("scroll-on-output"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_ON_OUTPUT, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-on-output");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-on-output"
, pspec);}
;
1309 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SILENT_BELL, DEFAULT_SILENT_BELL, KEY_SILENT_BELL){ GParamSpec *pspec = g_param_spec_boolean ("silent-bell", ((
void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SILENT_BELL, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "silent-bell"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "silent-bell", pspec);
}
;
1310 TERMINAL_PROFILE_PROPERTY_BOOLEAN (COPY_SELECTION, DEFAULT_COPY_SELECTION, KEY_COPY_SELECTION){ GParamSpec *pspec = g_param_spec_boolean ("copy-selection",
((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_COPY_SELECTION, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "copy-selection"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "copy-selection", pspec
);}
;
1311 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_COMMAND, DEFAULT_USE_CUSTOM_COMMAND, KEY_USE_CUSTOM_COMMAND){ GParamSpec *pspec = g_param_spec_boolean ("use-custom-command"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_CUSTOM_COMMAND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-custom-command"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-custom-command"
, pspec);}
;
1312 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_DEFAULT_SIZE, DEFAULT_USE_CUSTOM_DEFAULT_SIZE, KEY_USE_CUSTOM_DEFAULT_SIZE){ GParamSpec *pspec = g_param_spec_boolean ("use-custom-default-size"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_CUSTOM_DEFAULT_SIZE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-custom-default-size"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-custom-default-size"
, pspec);}
;
1313 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SKEY, DEFAULT_USE_SKEY, KEY_USE_SKEY){ GParamSpec *pspec = g_param_spec_boolean ("use-skey", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_SKEY, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-skey"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-skey", pspec);}
;
1314 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_URLS, DEFAULT_USE_URLS, KEY_USE_URLS){ GParamSpec *pspec = g_param_spec_boolean ("use-urls", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_URLS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-urls"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-urls", pspec);}
;
1315 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SYSTEM_FONT, DEFAULT_USE_SYSTEM_FONT, KEY_USE_SYSTEM_FONT){ GParamSpec *pspec = g_param_spec_boolean ("use-system-font"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_SYSTEM_FONT, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-system-font"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-system-font", pspec
);}
;
1316 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_THEME_COLORS, DEFAULT_USE_THEME_COLORS, KEY_USE_THEME_COLORS){ GParamSpec *pspec = g_param_spec_boolean ("use-theme-colors"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_THEME_COLORS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-theme-colors");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-theme-colors"
, pspec);}
;
1317
1318 TERMINAL_PROFILE_PROPERTY_BOXED (BACKGROUND_COLOR, GDK_TYPE_RGBA, KEY_BACKGROUND_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("background-color",
((void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "background-color"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "background-color", pspec);}
;
1319 TERMINAL_PROFILE_PROPERTY_BOXED (BOLD_COLOR, GDK_TYPE_RGBA, KEY_BOLD_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("bold-color", ((void
*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BOLD_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "bold-color"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "bold-color", pspec);}
;
1320 TERMINAL_PROFILE_PROPERTY_BOXED (FONT, PANGO_TYPE_FONT_DESCRIPTION, KEY_FONT){ GParamSpec *pspec = g_param_spec_boxed ("font", ((void*)0),
((void*)0), (pango_font_description_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_FONT,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) "font"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "font", pspec);}
;
1321 TERMINAL_PROFILE_PROPERTY_BOXED (FOREGROUND_COLOR, GDK_TYPE_RGBA, KEY_FOREGROUND_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("foreground-color",
((void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_FOREGROUND_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "foreground-color"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "foreground-color", pspec);}
;
1322
1323 /* 0.0 = normal bg, 1.0 = all black bg, 0.5 = half darkened */
1324 TERMINAL_PROFILE_PROPERTY_DOUBLE (BACKGROUND_DARKNESS, 0.0, 1.0, DEFAULT_BACKGROUND_DARKNESS, KEY_BACKGROUND_DARKNESS){ GParamSpec *pspec = g_param_spec_double ("background-darkness"
, ((void*)0), ((void*)0), 0.0, 1.0, (0.5), G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_DARKNESS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "background-darkness"); g_hash_table_insert (klass
->gsettings_keys, (gpointer) "background-darkness", pspec)
;}
;
1325
1326 TERMINAL_PROFILE_PROPERTY_ENUM (BACKGROUND_TYPE, TERMINAL_TYPE_BACKGROUND_TYPE, DEFAULT_BACKGROUND_TYPE, KEY_BACKGROUND_TYPE){ GParamSpec *pspec = g_param_spec_enum ("background-type", (
(void*)0), ((void*)0), (terminal_background_type_get_type ())
, (TERMINAL_BACKGROUND_SOLID), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BACKGROUND_TYPE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "background-type"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "background-type", pspec
);}
;
1327 TERMINAL_PROFILE_PROPERTY_ENUM (BACKSPACE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_BACKSPACE_BINDING, KEY_BACKSPACE_BINDING){ GParamSpec *pspec = g_param_spec_enum ("backspace-binding",
((void*)0), ((void*)0), (vte_erase_binding_get_type ()), (VTE_ERASE_ASCII_DELETE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_BACKSPACE_BINDING, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) "backspace-binding"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "backspace-binding", pspec
);}
;
1328 TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_BLINK_MODE, VTE_TYPE_CURSOR_BLINK_MODE, DEFAULT_CURSOR_BLINK_MODE, KEY_CURSOR_BLINK_MODE){ GParamSpec *pspec = g_param_spec_enum ("cursor-blink-mode",
((void*)0), ((void*)0), (vte_cursor_blink_mode_get_type ()),
(VTE_CURSOR_BLINK_SYSTEM), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_CURSOR_BLINK_MODE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "cursor-blink-mode")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "cursor-blink-mode"
, pspec);}
;
1329 TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_SHAPE, VTE_TYPE_CURSOR_SHAPE, DEFAULT_CURSOR_SHAPE, KEY_CURSOR_SHAPE){ GParamSpec *pspec = g_param_spec_enum ("cursor-shape", ((void
*)0), ((void*)0), (vte_cursor_shape_get_type ()), (VTE_CURSOR_SHAPE_BLOCK
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_CURSOR_SHAPE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "cursor-shape"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "cursor-shape", pspec);}
;
1330 TERMINAL_PROFILE_PROPERTY_ENUM (DELETE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_DELETE_BINDING, KEY_DELETE_BINDING){ GParamSpec *pspec = g_param_spec_enum ("delete-binding", ((
void*)0), ((void*)0), (vte_erase_binding_get_type ()), (VTE_ERASE_DELETE_SEQUENCE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_DELETE_BINDING, pspec); g_param_spec_set_qdata (pspec,
gsettings_key_quark, (gpointer) "delete-binding"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "delete-binding", pspec
);}
;
1331 TERMINAL_PROFILE_PROPERTY_ENUM (EXIT_ACTION, TERMINAL_TYPE_EXIT_ACTION, DEFAULT_EXIT_ACTION, KEY_EXIT_ACTION){ GParamSpec *pspec = g_param_spec_enum ("exit-action", ((void
*)0), ((void*)0), (terminal_exit_action_get_type ()), (TERMINAL_EXIT_CLOSE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_EXIT_ACTION, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "exit-action"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "exit-action", pspec);}
;
1332 TERMINAL_PROFILE_PROPERTY_ENUM (SCROLLBAR_POSITION, TERMINAL_TYPE_SCROLLBAR_POSITION, DEFAULT_SCROLLBAR_POSITION, KEY_SCROLLBAR_POSITION){ GParamSpec *pspec = g_param_spec_enum ("scrollbar-position"
, ((void*)0), ((void*)0), (terminal_scrollbar_position_get_type
()), (TERMINAL_SCROLLBAR_RIGHT), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLLBAR_POSITION, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scrollbar-position"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scrollbar-position"
, pspec);}
;
1333 TERMINAL_PROFILE_PROPERTY_ENUM (TITLE_MODE, TERMINAL_TYPE_TITLE_MODE, DEFAULT_TITLE_MODE, KEY_TITLE_MODE){ GParamSpec *pspec = g_param_spec_enum ("title-mode", ((void
*)0), ((void*)0), (terminal_title_mode_get_type ()), (TERMINAL_TITLE_REPLACE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_TITLE_MODE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "title-mode"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "title-mode", pspec);}
;
1334
1335 TERMINAL_PROFILE_PROPERTY_INT (DEFAULT_SIZE_COLUMNS, 1, 1024, DEFAULT_DEFAULT_SIZE_COLUMNS, KEY_DEFAULT_SIZE_COLUMNS){ GParamSpec *pspec = g_param_spec_int ("default-size-columns"
, ((void*)0), ((void*)0), 1, 1024, (80), G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_DEFAULT_SIZE_COLUMNS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "default-size-columns"); g_hash_table_insert (klass
->gsettings_keys, (gpointer) "default-size-columns", pspec
);}
;
1336 TERMINAL_PROFILE_PROPERTY_INT (DEFAULT_SIZE_ROWS, 1, 1024, DEFAULT_DEFAULT_SIZE_ROWS, KEY_DEFAULT_SIZE_ROWS){ GParamSpec *pspec = g_param_spec_int ("default-size-rows", (
(void*)0), ((void*)0), 1, 1024, (24), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_DEFAULT_SIZE_ROWS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "default-size-rows")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "default-size-rows"
, pspec);}
;
1337 TERMINAL_PROFILE_PROPERTY_INT (SCROLLBACK_LINES, 1, G_MAXINT, DEFAULT_SCROLLBACK_LINES, KEY_SCROLLBACK_LINES){ GParamSpec *pspec = g_param_spec_int ("scrollback-lines", (
(void*)0), ((void*)0), 1, 2147483647, (512), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_SCROLLBACK_LINES
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "scrollback-lines"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "scrollback-lines", pspec);}
;
1338
1339 TERMINAL_PROFILE_PROPERTY_OBJECT (BACKGROUND_IMAGE, GDK_TYPE_PIXBUF){ GParamSpec *pspec = g_param_spec_object ("background-image"
, ((void*)0), ((void*)0), (gdk_pixbuf_get_type ()), G_PARAM_READABLE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_IMAGE
, pspec);}
;
1340
1341 TERMINAL_PROFILE_PROPERTY_STRING_CO (NAME, DEFAULT_NAME){ GParamSpec *pspec = g_param_spec_string ("name", ((void*)0)
, ((void*)0), (((void*)0)), G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_NAME,
pspec);}
;
1342
1343 TERMINAL_PROFILE_PROPERTY_STRING (BACKGROUND_IMAGE_FILE, DEFAULT_BACKGROUND_IMAGE_FILE, KEY_BACKGROUND_IMAGE_FILE){ GParamSpec *pspec = g_param_spec_string ("background-image-file"
, ((void*)0), ((void*)0), (""), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BACKGROUND_IMAGE_FILE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "background-image");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "background-image"
, pspec);}
;
1344 TERMINAL_PROFILE_PROPERTY_STRING (CUSTOM_COMMAND, DEFAULT_CUSTOM_COMMAND, KEY_CUSTOM_COMMAND){ GParamSpec *pspec = g_param_spec_string ("custom-command", (
(void*)0), ((void*)0), (""), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_CUSTOM_COMMAND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "custom-command"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "custom-command", pspec
);}
;
1345 TERMINAL_PROFILE_PROPERTY_STRING (TITLE, _(DEFAULT_TITLE), KEY_TITLE){ GParamSpec *pspec = g_param_spec_string ("title", ((void*)0
), ((void*)0), gettext ((("Terminal"))), G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_TITLE
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "title"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "title", pspec);}
;
1346 TERMINAL_PROFILE_PROPERTY_STRING (VISIBLE_NAME, _(DEFAULT_VISIBLE_NAME), KEY_VISIBLE_NAME){ GParamSpec *pspec = g_param_spec_string ("visible-name", ((
void*)0), ((void*)0), gettext ((("Unnamed"))), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_VISIBLE_NAME
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "visible-name"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "visible-name", pspec);}
;
1347 TERMINAL_PROFILE_PROPERTY_STRING (WORD_CHARS, DEFAULT_WORD_CHARS, KEY_WORD_CHARS){ GParamSpec *pspec = g_param_spec_string ("word-chars", ((void
*)0), ((void*)0), ("-A-Za-z0-9,./?%&#:_=+@~"), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_WORD_CHARS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "word-chars"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "word-chars", pspec);}
;
1348
1349 TERMINAL_PROFILE_PROPERTY_VALUE_ARRAY_BOXED (PALETTE, "palette-color", GDK_TYPE_RGBA, KEY_PALETTE){ GParamSpec *pspec = g_param_spec_value_array ("palette", ((
void*)0), ((void*)0), g_param_spec_boxed ("palette-color", ((
void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_PALETTE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "palette"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "palette", pspec);}
;
1350}
1351
1352/* Semi-Public API */
1353
1354TerminalProfile*
1355_terminal_profile_new (const char *name)
1356{
1357 return g_object_new (TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()),
1358 "name", name,
1359 NULL((void*)0));
1360}
1361
1362void
1363_terminal_profile_forget (TerminalProfile *profile)
1364{
1365 TerminalProfilePrivate *priv = profile->priv;
1366
1367 if (!priv->forgotten)
1368 {
1369 priv->forgotten = TRUE(!(0));
1370
1371 g_signal_emit (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, signals[FORGOTTEN], 0);
1372 }
1373}
1374
1375gboolean
1376_terminal_profile_get_forgotten (TerminalProfile *profile)
1377{
1378 return profile->priv->forgotten;
1379}
1380
1381TerminalProfile *
1382_terminal_profile_clone (TerminalProfile *base_profile,
1383 const char *visible_name)
1384{
1385 TerminalApp *app = terminal_app_get ();
1386 GObject *base_object = G_OBJECT (base_profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((base_profile)), (((GType) ((20) << (2))))))))
;
1387 TerminalProfilePrivate *new_priv;
1388 char profile_name[32];
1389 GParameter *params;
1390 GParamSpec **pspecs;
1391 guint n_pspecs, i, n_params, profile_num;
1392 TerminalProfile *new_profile;
1393
1394 g_object_ref (base_profile)((__typeof__ (base_profile)) (g_object_ref) (base_profile));
1395
1396 profile_num = 0;
1397 do
1398 {
1399 g_snprintf (profile_name, sizeof (profile_name), "profile%u", profile_num++);
1400 }
1401 while (terminal_app_get_profile_by_name (app, profile_name) != NULL((void*)0));
1402
1403 /* Now we have an unused profile name */
1404 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (base_profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((base_profile
)))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
1405
1406 params = g_newa (GParameter, n_pspecs)((GParameter*) __builtin_alloca (sizeof (GParameter) * (gsize
) (n_pspecs)))
;
1407 n_params = 0;
1408
1409 for (i = 0; i < n_pspecs; ++i)
1410 {
1411 GParamSpec *pspec = pspecs[i];
1412 GValue *value;
1413
1414 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) ||
1415 (pspec->flags & G_PARAM_WRITABLE) == 0)
1416 continue;
1417
1418 params[n_params].name = pspec->name;
1419
1420 value = &params[n_params].value;
1421 G_VALUE_TYPE (value)(((GValue*) (value))->g_type) = 0;
1422 g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
1423
1424 if (pspec->name == I_(TERMINAL_PROFILE_NAME)g_intern_static_string ("name"))
1425 g_value_set_static_string (value, profile_name);
1426 else if (pspec->name == I_(TERMINAL_PROFILE_VISIBLE_NAME)g_intern_static_string ("visible-name"))
1427 g_value_set_static_string (value, visible_name);
1428 else
1429 g_object_get_property (base_object, pspec->name, value);
1430
1431 ++n_params;
1432 }
1433
1434 new_profile = g_object_newv (TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()), n_params, params);
1435
1436 g_object_unref (base_profile);
1437
1438 for (i = 0; i < n_params; ++i)
1439 g_value_unset (&params[i].value);
1440
1441 /* Flush the new profile to GSettings */
1442 new_priv = new_profile->priv;
1443
1444 g_slist_free (new_priv->dirty_pspecs);
1445 new_priv->dirty_pspecs = NULL((void*)0);
1446 if (new_priv->save_idle_id != 0)
1447 {
1448 g_source_remove (new_priv->save_idle_id);
1449 new_priv->save_idle_id = 0;
1450 }
1451
1452 for (i = 0; i < n_pspecs; ++i)
1453 {
1454 GParamSpec *pspec = pspecs[i];
1455
1456 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) ||
1457 (pspec->flags & G_PARAM_WRITABLE) == 0)
1458 continue;
1459
1460 new_priv->dirty_pspecs = g_slist_prepend (new_priv->dirty_pspecs, pspec);
1461 }
1462 g_free (pspecs);
1463
1464 terminal_profile_save (new_profile);
1465
1466 return new_profile;
1467}
1468
1469/* Public API */
1470
1471gboolean
1472terminal_profile_get_property_boolean (TerminalProfile *profile,
1473 const char *prop_name)
1474{
1475 const GValue *value;
1476
1477 value = get_prop_value_from_prop_name (profile, prop_name);
1478 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_BOOLEAN (value), FALSE)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((5) << (2)))); gboolean __r; if (!__val) __r = (0); else
if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_BOOLEAN (value)"
); return ((0)); } } while (0)
;
1479 if (!value || !G_VALUE_HOLDS_BOOLEAN (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((5) << (2)))); gboolean __r;
if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1480 return FALSE(0);
1481
1482 return g_value_get_boolean (value);
1483}
1484
1485gconstpointer
1486terminal_profile_get_property_boxed (TerminalProfile *profile,
1487 const char *prop_name)
1488{
1489 const GValue *value;
1490
1491 value = get_prop_value_from_prop_name (profile, prop_name);
1492 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_BOXED (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((18) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_BOXED (value)"
); return (((void*)0)); } } while (0)
;
1493 if (!value || !G_VALUE_HOLDS_BOXED (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((18) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1494 return NULL((void*)0);
1495
1496 return g_value_get_boxed (value);
1497}
1498
1499double
1500terminal_profile_get_property_double (TerminalProfile *profile,
1501 const char *prop_name)
1502{
1503 const GValue *value;
1504
1505 value = get_prop_value_from_prop_name (profile, prop_name);
1506 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_DOUBLE (value), 0.0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((15) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_DOUBLE (value)"
); return (0.0); } } while (0)
;
1507 if (!value || !G_VALUE_HOLDS_DOUBLE (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((15) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1508 return 0.0;
1509
1510 return g_value_get_double (value);
1511}
1512
1513int
1514terminal_profile_get_property_enum (TerminalProfile *profile,
1515 const char *prop_name)
1516{
1517 const GValue *value;
1518
1519 value = get_prop_value_from_prop_name (profile, prop_name);
1520 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_ENUM (value), 0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((12) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_ENUM (value)"
); return (0); } } while (0)
;
1521 if (!value || !G_VALUE_HOLDS_ENUM (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((12) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1522 return 0;
1523
1524 return g_value_get_enum (value);
1525}
1526
1527int
1528terminal_profile_get_property_int (TerminalProfile *profile,
1529 const char *prop_name)
1530{
1531 const GValue *value;
1532
1533 value = get_prop_value_from_prop_name (profile, prop_name);
1534 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_INT (value), 0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((6) << (2)))); gboolean __r; if (!__val) __r = (0); else
if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_INT (value)"
); return (0); } } while (0)
;
1535 if (!value || !G_VALUE_HOLDS_INT (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((6) << (2)))); gboolean __r;
if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1536 return 0;
1537
1538 return g_value_get_int (value);
1539}
1540
1541gpointer
1542terminal_profile_get_property_object (TerminalProfile *profile,
1543 const char *prop_name)
1544{
1545 const GValue *value;
1546
1547 value = get_prop_value_from_prop_name (profile, prop_name);
1548 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_OBJECT (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((20) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_OBJECT (value)"
); return (((void*)0)); } } while (0)
;
1549 if (!value || !G_VALUE_HOLDS_OBJECT (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((20) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1550 return NULL((void*)0);
1551
1552 return g_value_get_object (value);
1553}
1554
1555const char*
1556terminal_profile_get_property_string (TerminalProfile *profile,
1557 const char *prop_name)
1558{
1559 const GValue *value;
1560
1561 value = get_prop_value_from_prop_name (profile, prop_name);
1562 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_STRING (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((16) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_STRING (value)"
); return (((void*)0)); } } while (0)
;
1563 if (!value || !G_VALUE_HOLDS_STRING (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((16) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1564 return NULL((void*)0);
1565
1566 return g_value_get_string (value);
1567}
1568
1569gboolean
1570terminal_profile_property_locked (TerminalProfile *profile,
1571 const char *prop_name)
1572{
1573 TerminalProfilePrivate *priv = profile->priv;
1574 GParamSpec *pspec;
1575
1576 pspec = get_pspec_from_name (profile, prop_name);
1577 g_return_val_if_fail (pspec != NULL, FALSE)do { if ((pspec != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "pspec != NULL");
return ((0)); } } while (0)
;
1578 if (!pspec)
1579 return FALSE(0);
1580
1581 return priv->locked[pspec->param_id];
1582}
1583
1584void
1585terminal_profile_reset_property (TerminalProfile *profile,
1586 const char *prop_name)
1587{
1588 GParamSpec *pspec;
1589
1590 pspec = get_pspec_from_name (profile, prop_name);
1591 g_return_if_fail (pspec != NULL)do { if ((pspec != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "pspec != NULL");
return; } } while (0)
;
1592 if (!pspec ||
1593 (pspec->flags & G_PARAM_WRITABLE) == 0)
1594 return;
1595
1596 terminal_profile_reset_property_internal (profile, pspec, TRUE(!(0)));
1597}
1598
1599gboolean
1600terminal_profile_get_palette (TerminalProfile *profile,
1601 GdkRGBA *colors,
1602 guint *n_colors)
1603{
1604 TerminalProfilePrivate *priv;
1605 GValueArray *array;
1606 guint i, n;
1607
1608 g_return_val_if_fail (TERMINAL_IS_PROFILE (profile), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((profile)); GType __t = ((terminal_profile_get_type ()));
gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class
&& __inst->g_class->g_type == __t) __r = (!(0)
); else __r = g_type_check_instance_is_a (__inst, __t); __r; }
)))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "TERMINAL_IS_PROFILE (profile)"); return
((0)); } } while (0)
;
1609 g_return_val_if_fail (colors != NULL && n_colors != NULL, FALSE)do { if ((colors != ((void*)0) && n_colors != ((void*
)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "colors != NULL && n_colors != NULL"
); return ((0)); } } while (0)
;
1610
1611 priv = profile->priv;
1612 array = g_value_get_boxed (g_value_array_get_nth (priv->properties, PROP_PALETTE));
1613 if (!array)
1614 return FALSE(0);
1615
1616 n = MIN (array->n_values, *n_colors)(((array->n_values) < (*n_colors)) ? (array->n_values
) : (*n_colors))
;
1617 for (i = 0; i < n; ++i)
1618 {
1619 GdkRGBA *color = g_value_get_boxed (g_value_array_get_nth (array, i));
1620 if (!color)
1621 continue; /* shouldn't happen!! */
1622
1623 colors[i] = *color;
1624 }
1625
1626 *n_colors = n;
1627 return TRUE(!(0));
1628}
1629
1630gboolean
1631terminal_profile_get_palette_is_builtin (TerminalProfile *profile,
1632 guint *n)
1633{
1634 GdkRGBA colors[TERMINAL_PALETTE_SIZE16];
1635 guint n_colors;
1636 guint i;
1637
1638 n_colors = G_N_ELEMENTS (colors)(sizeof (colors) / sizeof ((colors)[0]));
1639 if (!terminal_profile_get_palette (profile, colors, &n_colors) ||
1640 n_colors != TERMINAL_PALETTE_SIZE16)
1641 return FALSE(0);
1642
1643 for (i = 0; i < TERMINAL_PALETTE_N_BUILTINS5; ++i)
1644 if (palette_cmp (colors, terminal_palettes[i]))
1645 {
1646 *n = i;
1647 return TRUE(!(0));
1648 }
1649
1650 return FALSE(0);
1651}
1652
1653void
1654terminal_profile_set_palette_builtin (TerminalProfile *profile,
1655 guint n)
1656{
1657 GValue value = { 0, };
1658
1659 g_return_if_fail (n < TERMINAL_PALETTE_N_BUILTINS)do { if ((n < 5)) { } else { g_return_if_fail_warning (((gchar
*) 0), ((const char*) (__func__)), "n < TERMINAL_PALETTE_N_BUILTINS"
); return; } } while (0)
;
1660
1661 g_value_init (&value, G_TYPE_VALUE_ARRAY(g_value_array_get_type ()) GCC warning "Deprecated pre-processor symbol: replace with \"(g_array_get_type ())\""
+
);
1662 set_value_from_palette (&value, terminal_palettes[n], TERMINAL_PALETTE_SIZE16);
1663 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, TERMINAL_PROFILE_PALETTE"palette", &value);
1664 g_value_unset (&value);
1665}
1666
1667gboolean
1668terminal_profile_modify_palette_entry (TerminalProfile *profile,
1669 guint i,
1670 const GdkRGBA *color)
1671{
1672 TerminalProfilePrivate *priv = profile->priv;
1673 GValueArray *array;
1674 GValue *value;
1675 GdkRGBA *old_color;
1676
1677 array = g_value_get_boxed (g_value_array_get_nth (priv->properties, PROP_PALETTE));
1678 if (!array ||
1679 i >= array->n_values)
1680 return FALSE(0);
1681
1682 value = g_value_array_get_nth (array, i);
1683 old_color = g_value_get_boxed (value);
1684 if (!old_color ||
1685 !rgba_equal (old_color, color))
1686 {
1687 g_value_set_boxed (value, color);
1688 g_object_notify (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, TERMINAL_PROFILE_PALETTE"palette");
1689 }
1690
1691 return TRUE(!(0));
1692}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-8c7a76.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-8c7a76.html new file mode 100644 index 0000000..8e6155c --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-8c7a76.html @@ -0,0 +1,1021 @@ + + + +md4.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:skey/md4.c
Warning:line 276, column 2
Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name md4.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src/skey -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I ../.. -I ./.. -D G_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -D PIC -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src/skey -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c md4.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright (C) 2001 Nikos Mavroyanopoulos
3 * Copyright (C) 2012-2021 MATE Developers
4 *
5 * This library is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Library General Public License as published
7 * by the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21/*
22 * The algorithm is due to Ron Rivest. This code is based on code
23 * written by Colin Plumb in 1993.
24 */
25
26#include <string.h>
27#include <stdlib.h>
28#include "config.h"
29#include "skey.h"
30#include "skeyutil.h"
31#include "md4.h"
32
33#ifndef WORDS_BIGENDIAN
34#define byteReverse(buf, len) /* Nothing */
35#else
36static void byteReverse(unsigned char *buf, unsigned longs);
37
38/*
39 * Note: this code is harmless on little-endian machines.
40 */
41static void byteReverse(unsigned char *buf, unsigned longs)
42{
43 guint32 t;
44 do
45 {
46 t = (guint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
47 ((unsigned) buf[1] << 8 | buf[0]);
48 *(guint32 *) buf = t;
49 buf += 4;
50 }
51 while (--longs);
52}
53#endif
54
55#define rotl32(x,n)(((x) << ((guint32)(n))) | ((x) >> (32 - (guint32
)(n))))
(((x) << ((guint32)(n))) | ((x) >> (32 - (guint32)(n))))
56
57/*
58 * Start MD4 accumulation. Set bit count to 0 and buffer to mysterious
59 * initialization constants.
60 */
61void MD4Init(MD4_CTX *ctx)
62{
63 ctx->buf[0] = 0x67452301;
64 ctx->buf[1] = 0xefcdab89;
65 ctx->buf[2] = 0x98badcfe;
66 ctx->buf[3] = 0x10325476;
67
68 ctx->bits[0] = 0;
69 ctx->bits[1] = 0;
70}
71
72/*
73 * Update context to reflect the concatenation of another buffer full
74 * of bytes.
75 */
76void MD4Update(MD4_CTX *ctx, unsigned char const *buf,
77 unsigned len)
78{
79 register guint32 t;
80
81 /* Update bitcount */
82
83 t = ctx->bits[0];
84 if ((ctx->bits[0] = t + ((guint32) len << 3)) < t)
85 ctx->bits[1]++; /* Carry from low to high */
86 ctx->bits[1] += len >> 29;
87
88 t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
89
90 /* Handle any leading odd-sized chunks */
91
92 if (t)
93 {
94 unsigned char *p = (unsigned char *) ctx->in + t;
95
96 t = 64 - t;
97 if (len < t)
98 {
99 memcpy(p, buf, len);
100 return;
101 }
102 memcpy(p, buf, t);
103 byteReverse(ctx->in, 16);
104 MD4Transform(ctx->buf, (guint32 *) ctx->in);
105 buf += t;
106 len -= t;
107 }
108 /* Process data in 64-byte chunks */
109
110 while (len >= 64)
111 {
112 memcpy(ctx->in, buf, 64);
113 byteReverse(ctx->in, 16);
114 MD4Transform(ctx->buf, (guint32 *) ctx->in);
115 buf += 64;
116 len -= 64;
117 }
118
119 /* Handle any remaining bytes of data. */
120
121 memcpy(ctx->in, buf, len);
122}
123
124/*
125 * Final wrapup - pad to 64-byte boundary with the bit pattern
126 * 1 0* (64-bit count of bits processed, MSB-first)
127 */
128void MD4Final(unsigned char* digest, MD4_CTX *ctx)
129{
130 unsigned int count;
131 unsigned char *p;
132
133 /* Compute number of bytes mod 64 */
134 count = (ctx->bits[0] >> 3) & 0x3F;
135
136 /* Set the first char of padding to 0x80. This is safe since there is
137 always at least one byte free */
138 p = ctx->in + count;
139 *p++ = 0x80;
140
141 /* Bytes of padding needed to make 64 bytes */
142 count = 64 - 1 - count;
143
144 /* Pad out to 56 mod 64 */
145 if (count < 8)
146 {
147 /* Two lots of padding: Pad the first block to 64 bytes */
148 memset(p, 0, count);
149 byteReverse(ctx->in, 16);
150 MD4Transform(ctx->buf, (guint32 *) ctx->in);
151
152 /* Now fill the next block with 56 bytes */
153 memset(ctx->in, 0, 56);
154 }
155 else
156 {
157 /* Pad block to 56 bytes */
158 memset(p, 0, count - 8);
159 }
160 byteReverse(ctx->in, 14);
161
162 /* Append length in bits and transform */
163 ((guint32 *) ctx->in)[14] = ctx->bits[0];
164 ((guint32 *) ctx->in)[15] = ctx->bits[1];
165
166 MD4Transform(ctx->buf, (guint32 *) ctx->in);
167 byteReverse((unsigned char *) ctx->buf, 4);
168
169 if (digest!=NULL((void*)0))
170 memcpy(digest, ctx->buf, 16);
171 memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
172}
173
174/* The three core functions */
175
176#define F(x, y, z)(((x) & (y)) | ((~x) & (z))) (((x) & (y)) | ((~x) & (z)))
177#define G(x, y, z)(((x) & (y)) | ((x) & (z)) | ((y) & (z))) (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
178#define H(x, y, z)((x) ^ (y) ^ (z)) ((x) ^ (y) ^ (z))
179
180#define FF(a, b, c, d, x, s){ (a) += ((((b)) & ((c))) | ((~(b)) & ((d)))) + (x); (
a) = ((((a)) << ((guint32)((s)))) | (((a)) >> (32
- (guint32)((s))))); }
{ \
181 (a) += F ((b), (c), (d))((((b)) & ((c))) | ((~(b)) & ((d)))) + (x); \
182 (a) = rotl32 ((a), (s))((((a)) << ((guint32)((s)))) | (((a)) >> (32 - (guint32
)((s)))))
; \
183 }
184#define GG(a, b, c, d, x, s){ (a) += ((((b)) & ((c))) | (((b)) & ((d))) | (((c)) &
((d)))) + (x) + (guint32)0x5a827999; (a) = ((((a)) << (
(guint32)((s)))) | (((a)) >> (32 - (guint32)((s))))); }
{ \
185 (a) += G ((b), (c), (d))((((b)) & ((c))) | (((b)) & ((d))) | (((c)) & ((d
))))
+ (x) + (guint32)0x5a827999; \
186 (a) = rotl32 ((a), (s))((((a)) << ((guint32)((s)))) | (((a)) >> (32 - (guint32
)((s)))))
; \
187 }
188#define HH(a, b, c, d, x, s){ (a) += (((b)) ^ ((c)) ^ ((d))) + (x) + (guint32)0x6ed9eba1;
(a) = ((((a)) << ((guint32)((s)))) | (((a)) >> (
32 - (guint32)((s))))); }
{ \
189 (a) += H ((b), (c), (d))(((b)) ^ ((c)) ^ ((d))) + (x) + (guint32)0x6ed9eba1; \
190 (a) = rotl32 ((a), (s))((((a)) << ((guint32)((s)))) | (((a)) >> (32 - (guint32
)((s)))))
; \
191 }
192
193/*
194 * The core of the MD4 algorithm
195 */
196void MD4Transform(guint32 buf[4], guint32 const in[16])
197{
198 register guint32 a, b, c, d;
199
200 a = buf[0];
201 b = buf[1];
202 c = buf[2];
203 d = buf[3];
204
205 FF(a, b, c, d, in[0], 3){ (a) += ((((b)) & ((c))) | ((~(b)) & ((d)))) + (in[0
]); (a) = ((((a)) << ((guint32)((3)))) | (((a)) >>
(32 - (guint32)((3))))); }
; /* 1 */
206 FF(d, a, b, c, in[1], 7){ (d) += ((((a)) & ((b))) | ((~(a)) & ((c)))) + (in[1
]); (d) = ((((d)) << ((guint32)((7)))) | (((d)) >>
(32 - (guint32)((7))))); }
; /* 2 */
207 FF(c, d, a, b, in[2], 11){ (c) += ((((d)) & ((a))) | ((~(d)) & ((b)))) + (in[2
]); (c) = ((((c)) << ((guint32)((11)))) | (((c)) >>
(32 - (guint32)((11))))); }
; /* 3 */
208 FF(b, c, d, a, in[3], 19){ (b) += ((((c)) & ((d))) | ((~(c)) & ((a)))) + (in[3
]); (b) = ((((b)) << ((guint32)((19)))) | (((b)) >>
(32 - (guint32)((19))))); }
; /* 4 */
209 FF(a, b, c, d, in[4], 3){ (a) += ((((b)) & ((c))) | ((~(b)) & ((d)))) + (in[4
]); (a) = ((((a)) << ((guint32)((3)))) | (((a)) >>
(32 - (guint32)((3))))); }
; /* 5 */
210 FF(d, a, b, c, in[5], 7){ (d) += ((((a)) & ((b))) | ((~(a)) & ((c)))) + (in[5
]); (d) = ((((d)) << ((guint32)((7)))) | (((d)) >>
(32 - (guint32)((7))))); }
; /* 6 */
211 FF(c, d, a, b, in[6], 11){ (c) += ((((d)) & ((a))) | ((~(d)) & ((b)))) + (in[6
]); (c) = ((((c)) << ((guint32)((11)))) | (((c)) >>
(32 - (guint32)((11))))); }
; /* 7 */
212 FF(b, c, d, a, in[7], 19){ (b) += ((((c)) & ((d))) | ((~(c)) & ((a)))) + (in[7
]); (b) = ((((b)) << ((guint32)((19)))) | (((b)) >>
(32 - (guint32)((19))))); }
; /* 8 */
213 FF(a, b, c, d, in[8], 3){ (a) += ((((b)) & ((c))) | ((~(b)) & ((d)))) + (in[8
]); (a) = ((((a)) << ((guint32)((3)))) | (((a)) >>
(32 - (guint32)((3))))); }
; /* 9 */
214 FF(d, a, b, c, in[9], 7){ (d) += ((((a)) & ((b))) | ((~(a)) & ((c)))) + (in[9
]); (d) = ((((d)) << ((guint32)((7)))) | (((d)) >>
(32 - (guint32)((7))))); }
; /* 10 */
215 FF(c, d, a, b, in[10], 11){ (c) += ((((d)) & ((a))) | ((~(d)) & ((b)))) + (in[10
]); (c) = ((((c)) << ((guint32)((11)))) | (((c)) >>
(32 - (guint32)((11))))); }
; /* 11 */
216 FF(b, c, d, a, in[11], 19){ (b) += ((((c)) & ((d))) | ((~(c)) & ((a)))) + (in[11
]); (b) = ((((b)) << ((guint32)((19)))) | (((b)) >>
(32 - (guint32)((19))))); }
; /* 12 */
217 FF(a, b, c, d, in[12], 3){ (a) += ((((b)) & ((c))) | ((~(b)) & ((d)))) + (in[12
]); (a) = ((((a)) << ((guint32)((3)))) | (((a)) >>
(32 - (guint32)((3))))); }
; /* 13 */
218 FF(d, a, b, c, in[13], 7){ (d) += ((((a)) & ((b))) | ((~(a)) & ((c)))) + (in[13
]); (d) = ((((d)) << ((guint32)((7)))) | (((d)) >>
(32 - (guint32)((7))))); }
; /* 14 */
219 FF(c, d, a, b, in[14], 11){ (c) += ((((d)) & ((a))) | ((~(d)) & ((b)))) + (in[14
]); (c) = ((((c)) << ((guint32)((11)))) | (((c)) >>
(32 - (guint32)((11))))); }
; /* 15 */
220 FF(b, c, d, a, in[15], 19){ (b) += ((((c)) & ((d))) | ((~(c)) & ((a)))) + (in[15
]); (b) = ((((b)) << ((guint32)((19)))) | (((b)) >>
(32 - (guint32)((19))))); }
; /* 16 */
221
222 GG(a, b, c, d, in[0], 3){ (a) += ((((b)) & ((c))) | (((b)) & ((d))) | (((c)) &
((d)))) + (in[0]) + (guint32)0x5a827999; (a) = ((((a)) <<
((guint32)((3)))) | (((a)) >> (32 - (guint32)((3)))));
}
; /* 17 */
223 GG(d, a, b, c, in[4], 5){ (d) += ((((a)) & ((b))) | (((a)) & ((c))) | (((b)) &
((c)))) + (in[4]) + (guint32)0x5a827999; (d) = ((((d)) <<
((guint32)((5)))) | (((d)) >> (32 - (guint32)((5)))));
}
; /* 18 */
224 GG(c, d, a, b, in[8], 9){ (c) += ((((d)) & ((a))) | (((d)) & ((b))) | (((a)) &
((b)))) + (in[8]) + (guint32)0x5a827999; (c) = ((((c)) <<
((guint32)((9)))) | (((c)) >> (32 - (guint32)((9)))));
}
; /* 19 */
225 GG(b, c, d, a, in[12], 13){ (b) += ((((c)) & ((d))) | (((c)) & ((a))) | (((d)) &
((a)))) + (in[12]) + (guint32)0x5a827999; (b) = ((((b)) <<
((guint32)((13)))) | (((b)) >> (32 - (guint32)((13))))
); }
; /* 20 */
226 GG(a, b, c, d, in[1], 3){ (a) += ((((b)) & ((c))) | (((b)) & ((d))) | (((c)) &
((d)))) + (in[1]) + (guint32)0x5a827999; (a) = ((((a)) <<
((guint32)((3)))) | (((a)) >> (32 - (guint32)((3)))));
}
; /* 21 */
227 GG(d, a, b, c, in[5], 5){ (d) += ((((a)) & ((b))) | (((a)) & ((c))) | (((b)) &
((c)))) + (in[5]) + (guint32)0x5a827999; (d) = ((((d)) <<
((guint32)((5)))) | (((d)) >> (32 - (guint32)((5)))));
}
; /* 22 */
228 GG(c, d, a, b, in[9], 9){ (c) += ((((d)) & ((a))) | (((d)) & ((b))) | (((a)) &
((b)))) + (in[9]) + (guint32)0x5a827999; (c) = ((((c)) <<
((guint32)((9)))) | (((c)) >> (32 - (guint32)((9)))));
}
; /* 23 */
229 GG(b, c, d, a, in[13], 13){ (b) += ((((c)) & ((d))) | (((c)) & ((a))) | (((d)) &
((a)))) + (in[13]) + (guint32)0x5a827999; (b) = ((((b)) <<
((guint32)((13)))) | (((b)) >> (32 - (guint32)((13))))
); }
; /* 24 */
230 GG(a, b, c, d, in[2], 3){ (a) += ((((b)) & ((c))) | (((b)) & ((d))) | (((c)) &
((d)))) + (in[2]) + (guint32)0x5a827999; (a) = ((((a)) <<
((guint32)((3)))) | (((a)) >> (32 - (guint32)((3)))));
}
; /* 25 */
231 GG(d, a, b, c, in[6], 5){ (d) += ((((a)) & ((b))) | (((a)) & ((c))) | (((b)) &
((c)))) + (in[6]) + (guint32)0x5a827999; (d) = ((((d)) <<
((guint32)((5)))) | (((d)) >> (32 - (guint32)((5)))));
}
; /* 26 */
232 GG(c, d, a, b, in[10], 9){ (c) += ((((d)) & ((a))) | (((d)) & ((b))) | (((a)) &
((b)))) + (in[10]) + (guint32)0x5a827999; (c) = ((((c)) <<
((guint32)((9)))) | (((c)) >> (32 - (guint32)((9)))));
}
; /* 27 */
233 GG(b, c, d, a, in[14], 13){ (b) += ((((c)) & ((d))) | (((c)) & ((a))) | (((d)) &
((a)))) + (in[14]) + (guint32)0x5a827999; (b) = ((((b)) <<
((guint32)((13)))) | (((b)) >> (32 - (guint32)((13))))
); }
; /* 28 */
234 GG(a, b, c, d, in[3], 3){ (a) += ((((b)) & ((c))) | (((b)) & ((d))) | (((c)) &
((d)))) + (in[3]) + (guint32)0x5a827999; (a) = ((((a)) <<
((guint32)((3)))) | (((a)) >> (32 - (guint32)((3)))));
}
; /* 29 */
235 GG(d, a, b, c, in[7], 5){ (d) += ((((a)) & ((b))) | (((a)) & ((c))) | (((b)) &
((c)))) + (in[7]) + (guint32)0x5a827999; (d) = ((((d)) <<
((guint32)((5)))) | (((d)) >> (32 - (guint32)((5)))));
}
; /* 30 */
236 GG(c, d, a, b, in[11], 9){ (c) += ((((d)) & ((a))) | (((d)) & ((b))) | (((a)) &
((b)))) + (in[11]) + (guint32)0x5a827999; (c) = ((((c)) <<
((guint32)((9)))) | (((c)) >> (32 - (guint32)((9)))));
}
; /* 31 */
237 GG(b, c, d, a, in[15], 13){ (b) += ((((c)) & ((d))) | (((c)) & ((a))) | (((d)) &
((a)))) + (in[15]) + (guint32)0x5a827999; (b) = ((((b)) <<
((guint32)((13)))) | (((b)) >> (32 - (guint32)((13))))
); }
; /* 32 */
238
239 HH(a, b, c, d, in[0], 3){ (a) += (((b)) ^ ((c)) ^ ((d))) + (in[0]) + (guint32)0x6ed9eba1
; (a) = ((((a)) << ((guint32)((3)))) | (((a)) >> (
32 - (guint32)((3))))); }
; /* 33 */
240 HH(d, a, b, c, in[8], 9){ (d) += (((a)) ^ ((b)) ^ ((c))) + (in[8]) + (guint32)0x6ed9eba1
; (d) = ((((d)) << ((guint32)((9)))) | (((d)) >> (
32 - (guint32)((9))))); }
; /* 34 */
241 HH(c, d, a, b, in[4], 11){ (c) += (((d)) ^ ((a)) ^ ((b))) + (in[4]) + (guint32)0x6ed9eba1
; (c) = ((((c)) << ((guint32)((11)))) | (((c)) >>
(32 - (guint32)((11))))); }
; /* 35 */
242 HH(b, c, d, a, in[12], 15){ (b) += (((c)) ^ ((d)) ^ ((a))) + (in[12]) + (guint32)0x6ed9eba1
; (b) = ((((b)) << ((guint32)((15)))) | (((b)) >>
(32 - (guint32)((15))))); }
; /* 36 */
243 HH(a, b, c, d, in[2], 3){ (a) += (((b)) ^ ((c)) ^ ((d))) + (in[2]) + (guint32)0x6ed9eba1
; (a) = ((((a)) << ((guint32)((3)))) | (((a)) >> (
32 - (guint32)((3))))); }
; /* 37 */
244 HH(d, a, b, c, in[10], 9){ (d) += (((a)) ^ ((b)) ^ ((c))) + (in[10]) + (guint32)0x6ed9eba1
; (d) = ((((d)) << ((guint32)((9)))) | (((d)) >> (
32 - (guint32)((9))))); }
; /* 38 */
245 HH(c, d, a, b, in[6], 11){ (c) += (((d)) ^ ((a)) ^ ((b))) + (in[6]) + (guint32)0x6ed9eba1
; (c) = ((((c)) << ((guint32)((11)))) | (((c)) >>
(32 - (guint32)((11))))); }
; /* 39 */
246 HH(b, c, d, a, in[14], 15){ (b) += (((c)) ^ ((d)) ^ ((a))) + (in[14]) + (guint32)0x6ed9eba1
; (b) = ((((b)) << ((guint32)((15)))) | (((b)) >>
(32 - (guint32)((15))))); }
; /* 40 */
247 HH(a, b, c, d, in[1], 3){ (a) += (((b)) ^ ((c)) ^ ((d))) + (in[1]) + (guint32)0x6ed9eba1
; (a) = ((((a)) << ((guint32)((3)))) | (((a)) >> (
32 - (guint32)((3))))); }
; /* 41 */
248 HH(d, a, b, c, in[9], 9){ (d) += (((a)) ^ ((b)) ^ ((c))) + (in[9]) + (guint32)0x6ed9eba1
; (d) = ((((d)) << ((guint32)((9)))) | (((d)) >> (
32 - (guint32)((9))))); }
; /* 42 */
249 HH(c, d, a, b, in[5], 11){ (c) += (((d)) ^ ((a)) ^ ((b))) + (in[5]) + (guint32)0x6ed9eba1
; (c) = ((((c)) << ((guint32)((11)))) | (((c)) >>
(32 - (guint32)((11))))); }
; /* 43 */
250 HH(b, c, d, a, in[13], 15){ (b) += (((c)) ^ ((d)) ^ ((a))) + (in[13]) + (guint32)0x6ed9eba1
; (b) = ((((b)) << ((guint32)((15)))) | (((b)) >>
(32 - (guint32)((15))))); }
; /* 44 */
251 HH(a, b, c, d, in[3], 3){ (a) += (((b)) ^ ((c)) ^ ((d))) + (in[3]) + (guint32)0x6ed9eba1
; (a) = ((((a)) << ((guint32)((3)))) | (((a)) >> (
32 - (guint32)((3))))); }
; /* 45 */
252 HH(d, a, b, c, in[11], 9){ (d) += (((a)) ^ ((b)) ^ ((c))) + (in[11]) + (guint32)0x6ed9eba1
; (d) = ((((d)) << ((guint32)((9)))) | (((d)) >> (
32 - (guint32)((9))))); }
; /* 46 */
253 HH(c, d, a, b, in[7], 11){ (c) += (((d)) ^ ((a)) ^ ((b))) + (in[7]) + (guint32)0x6ed9eba1
; (c) = ((((c)) << ((guint32)((11)))) | (((c)) >>
(32 - (guint32)((11))))); }
; /* 47 */
254 HH(b, c, d, a, in[15], 15){ (b) += (((c)) ^ ((d)) ^ ((a))) + (in[15]) + (guint32)0x6ed9eba1
; (b) = ((((b)) << ((guint32)((15)))) | (((b)) >>
(32 - (guint32)((15))))); }
; /* 48 */
255
256 buf[0] += a;
257 buf[1] += b;
258 buf[2] += c;
259 buf[3] += d;
260}
261
262int MD4Keycrunch( char *result, const char *seed, const char *passphrase)
263{
264 int len;
265 char *buf;
266 MD4_CTX md;
267 guint32 results[4];
268
269 len = strlen(seed) + strlen(passphrase);
270 buf = (char *)malloc(len+1);
271 if (buf == NULL((void*)0))
272 return -1;
273
274 strcpy(buf, seed);
275 skey_lowcase(buf);
276 strcat(buf, passphrase);
Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
277 skey_sevenbit(buf);
278
279 MD4Init(&md);
280 MD4Update(&md, (unsigned char *)buf, len);
281 MD4Final((unsigned char *)results, &md);
282 free(buf);
283
284 results[0] ^= results[2];
285 results[1] ^= results[3];
286 memcpy((void *)result, (void *)results, SKEY_SIZE8);
287
288 return 0;
289}
290
291void MD4SKey(char *x)
292{
293 MD4_CTX md;
294 guint32 results[4];
295
296 MD4Init(&md);
297 MD4Update(&md, (unsigned char *)x, SKEY_SIZE8);
298 MD4Final((unsigned char *)results, &md);
299
300 results[0] ^= results[2];
301 results[1] ^= results[3];
302
303 memcpy((void *)x, (void *)results, SKEY_SIZE8);
304}
305
306#ifdef MD4_MAIN
307
308#include <stdio.h>
309#include <unistd.h>
310#include <stdlib.h>
311
312int main(int argc, char *argv[])
313{
314 MD4_CTX *md4;
315 unsigned char digest[16];
316 unsigned char data[1024];
317 int i, r;
318
319 memset(digest, 0, 16);
320 printf("MD4 digest algorithm. End with Ctrl-D:\n");
321
322 md4 = (MD4_CTX *)malloc(sizeof(MD4_CTX));
323 MD4Init(md4);
324 do
325 {
326 r = read(0, data, sizeof data);
327 MD4Update(md4, data, r);
328 }
329 while (r);
330
331 MD4Final(digest, md4);
332 printf("MD4 Digest is: ");
333 for (i = 0; i < 16; i++)
334 printf("%02X", digest[i]);
335
336 printf("\n");
337 free(md4);
338 return 0;
339}
340
341#endif
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-959831.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-959831.html new file mode 100644 index 0000000..d540d98 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-959831.html @@ -0,0 +1,747 @@ + + + +md5.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:skey/md5.c
Warning:line 27, column 2
Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name md5.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src/skey -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I ../.. -I ./.. -D G_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -D PIC -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src/skey -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c md5.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1#include <config.h>
2#include <stdlib.h>
3
4#include <string.h>
5#include <glib.h>
6
7#include "skey.h"
8#include "skeyutil.h"
9#include "md5.h"
10
11int MD5Keycrunch(char *result, const char *seed, const char *passhrase)
12{
13 char *buf;
14 gsize len;
15 GChecksum *checksum;
16 guint8 digest[16];
17 gsize digest_len = sizeof (digest);
18 guint32 *results;
19
20 len = strlen(seed) + strlen(passhrase);
21 buf = (char *)g_try_malloc(len+1);
22 if (buf == NULL((void*)0))
23 return -1;
24
25 strcpy(buf, seed);
26 skey_lowcase(buf);
27 strcat(buf, passhrase);
Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
28 skey_sevenbit(buf);
29
30 checksum = g_checksum_new (G_CHECKSUM_MD5);
31 g_checksum_update (checksum, (const guchar *) buf, len);
32 g_free(buf);
33
34 g_checksum_get_digest (checksum, digest, &digest_len);
35 g_assert (digest_len == 16)do { if (digest_len == 16) ; else g_assertion_message_expr ((
(gchar*) 0), "md5.c", 35, ((const char*) (__func__)), "digest_len == 16"
); } while (0)
;
36
37 results = (guint32 *) digest;
38 results[0] ^= results[2];
39 results[1] ^= results[3];
40
41 memcpy((void *)result, (void *)results, SKEY_SIZE8);
42
43 g_checksum_free (checksum);
44
45 return 0;
46}
47
48void MD5SKey(char *x)
49{
50 GChecksum *checksum;
51 guint8 digest[16];
52 gsize digest_len = sizeof (digest);
53 guint32 *results;
54
55 checksum = g_checksum_new (G_CHECKSUM_MD5);
56 g_checksum_update (checksum, (const guchar *) x, SKEY_SIZE8);
57 g_checksum_get_digest (checksum, digest, &digest_len);
58 g_assert (digest_len == 16)do { if (digest_len == 16) ; else g_assertion_message_expr ((
(gchar*) 0), "md5.c", 58, ((const char*) (__func__)), "digest_len == 16"
); } while (0)
;
59
60 results = (guint32 *) digest;
61 results[0] ^= results[2];
62 results[1] ^= results[3];
63
64 memcpy((void *)x, (void *)results, SKEY_SIZE8);
65
66 g_checksum_free (checksum);
67}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-a2885e.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-a2885e.html new file mode 100644 index 0000000..5e0608d --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-a2885e.html @@ -0,0 +1,789 @@ + + + +sha1.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:skey/sha1.c
Warning:line 51, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name sha1.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src/skey -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I ../.. -I ./.. -D G_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -D PIC -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src/skey -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c sha1.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1#include <config.h>
2
3#include <string.h>
4#include <stdlib.h>
5#include <arpa/inet.h>
6
7#include <glib.h>
8
9#include "skey.h"
10#include "skeyutil.h"
11#include "sha1.h"
12
13#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]); }
{ \
14 x[0] = htonl(x[0]); \
15 x[1] = htonl(x[1]); \
16 x[2] = htonl(x[2]); \
17 x[3] = htonl(x[3]); \
18 x[4] = htonl(x[4]); }
19
20#ifdef WORDS_BIGENDIAN
21/*
22 * Note: this code is harmless on little-endian machines.
23 */
24static void byteReverse(unsigned char *buf, unsigned longs)
25{
26 guint32 t;
27 do
28 {
29 t = (guint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
30 ((unsigned) buf[1] << 8 | buf[0]);
31 *(guint32 *) buf = t;
32 buf += 4;
33 }
34 while (--longs);
35}
36#endif
37
38int SHA1Keycrunch(char *result, const char *seed, const char *passphrase)
39{
40 char *buf;
41 gsize len;
42 GChecksum *checksum;
43 guint8 digest[20];
44 gsize digest_len = sizeof (digest);
45 guint32 *results;
46
47 len = strlen(seed) + strlen(passphrase);
48 if ((buf = (char *)g_try_malloc(len+1)) == NULL((void*)0))
49 return -1;
50
51 strcpy(buf, seed);
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
52 skey_lowcase(buf);
53 strcat(buf, passphrase);
54 skey_sevenbit(buf);
55
56 checksum = g_checksum_new (G_CHECKSUM_SHA1);
57 g_checksum_update (checksum, (const guchar *) buf, len);
58 g_free(buf);
59
60 g_checksum_get_digest (checksum, digest, &digest_len);
61 g_assert (digest_len == 20)do { if (digest_len == 20) ; else g_assertion_message_expr ((
(gchar*) 0), "sha1.c", 61, ((const char*) (__func__)), "digest_len == 20"
); } while (0)
;
62
63 results = (guint32 *) digest;
64
65#ifndef WORDS_BIGENDIAN
66 HTONDIGEST(results){ results[0] = htonl(results[0]); results[1] = htonl(results[
1]); results[2] = htonl(results[2]); results[3] = htonl(results
[3]); results[4] = htonl(results[4]); }
;
67#else
68 byteReverse((unsigned char *)digest, 5);
69#endif
70
71 results = (guint32 *) digest;
72 results[0] ^= results[2];
73 results[1] ^= results[3];
74 results[0] ^= results[4];
75
76 memcpy((void *)result, (void *)results, SKEY_SIZE8);
77
78 g_checksum_free (checksum);
79
80 return 0;
81}
82
83void SHA1SKey(char *x)
84{
85 GChecksum *checksum;
86 guint8 digest[20];
87 gsize digest_len = sizeof (digest);
88 guint32 *results;
89
90 checksum = g_checksum_new (G_CHECKSUM_SHA1);
91 g_checksum_update (checksum, (const guchar *) x, SKEY_SIZE8);
92 g_checksum_get_digest (checksum, digest, &digest_len);
93 g_assert (digest_len == 20)do { if (digest_len == 20) ; else g_assertion_message_expr ((
(gchar*) 0), "sha1.c", 93, ((const char*) (__func__)), "digest_len == 20"
); } while (0)
;
94
95 results = (guint32 *) digest;
96#ifndef WORDS_BIGENDIAN
97 HTONDIGEST(results){ results[0] = htonl(results[0]); results[1] = htonl(results[
1]); results[2] = htonl(results[2]); results[3] = htonl(results
[3]); results[4] = htonl(results[4]); }
;
98#else
99 byteReverse((unsigned char *)digest, 5);
100#endif
101
102 results[0] ^= results[2];
103 results[1] ^= results[3];
104 results[0] ^= results[4];
105
106 memcpy((void *)x, (void *)results, SKEY_SIZE8);
107
108 g_checksum_free (checksum);
109}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-b430a1.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-b430a1.html new file mode 100644 index 0000000..bded1e3 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-b430a1.html @@ -0,0 +1,747 @@ + + + +md5.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:skey/md5.c
Warning:line 25, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name md5.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src/skey -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I ../.. -I ./.. -D G_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -D PIC -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src/skey -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c md5.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1#include <config.h>
2#include <stdlib.h>
3
4#include <string.h>
5#include <glib.h>
6
7#include "skey.h"
8#include "skeyutil.h"
9#include "md5.h"
10
11int MD5Keycrunch(char *result, const char *seed, const char *passhrase)
12{
13 char *buf;
14 gsize len;
15 GChecksum *checksum;
16 guint8 digest[16];
17 gsize digest_len = sizeof (digest);
18 guint32 *results;
19
20 len = strlen(seed) + strlen(passhrase);
21 buf = (char *)g_try_malloc(len+1);
22 if (buf == NULL((void*)0))
23 return -1;
24
25 strcpy(buf, seed);
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
26 skey_lowcase(buf);
27 strcat(buf, passhrase);
28 skey_sevenbit(buf);
29
30 checksum = g_checksum_new (G_CHECKSUM_MD5);
31 g_checksum_update (checksum, (const guchar *) buf, len);
32 g_free(buf);
33
34 g_checksum_get_digest (checksum, digest, &digest_len);
35 g_assert (digest_len == 16)do { if (digest_len == 16) ; else g_assertion_message_expr ((
(gchar*) 0), "md5.c", 35, ((const char*) (__func__)), "digest_len == 16"
); } while (0)
;
36
37 results = (guint32 *) digest;
38 results[0] ^= results[2];
39 results[1] ^= results[3];
40
41 memcpy((void *)result, (void *)results, SKEY_SIZE8);
42
43 g_checksum_free (checksum);
44
45 return 0;
46}
47
48void MD5SKey(char *x)
49{
50 GChecksum *checksum;
51 guint8 digest[16];
52 gsize digest_len = sizeof (digest);
53 guint32 *results;
54
55 checksum = g_checksum_new (G_CHECKSUM_MD5);
56 g_checksum_update (checksum, (const guchar *) x, SKEY_SIZE8);
57 g_checksum_get_digest (checksum, digest, &digest_len);
58 g_assert (digest_len == 16)do { if (digest_len == 16) ; else g_assertion_message_expr ((
(gchar*) 0), "md5.c", 58, ((const char*) (__func__)), "digest_len == 16"
); } while (0)
;
59
60 results = (guint32 *) digest;
61 results[0] ^= results[2];
62 results[1] ^= results[3];
63
64 memcpy((void *)x, (void *)results, SKEY_SIZE8);
65
66 g_checksum_free (checksum);
67}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-b8f564.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-b8f564.html new file mode 100644 index 0000000..e036cb0 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-b8f564.html @@ -0,0 +1,2089 @@ + + + +eggsmclient-xsmp.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:mate-submodules/libegg/eggsmclient-xsmp.c
Warning:line 1199, column 18
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name eggsmclient-xsmp.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src/mate-submodules/libegg -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I ../../.. -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/at-spi2-atk/2.0 -I /usr/include/cloudproviders -I /usr/include/blkid -I /usr/include/at-spi-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/libmount -I /usr/include/pixman-1 -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/sysprof-6 -I /usr/include/libpng16 -D EGG_SM_CLIENT_BACKEND_XSMP -D G_LOG_DOMAIN="EggSMClient" -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/at-spi2-atk/2.0 -I /usr/include/cloudproviders -I /usr/include/blkid -I /usr/include/at-spi-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/libmount -I /usr/include/pixman-1 -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/sysprof-6 -I /usr/include/libpng16 -D PIC -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src/mate-submodules/libegg -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c eggsmclient-xsmp.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright (C) 2007 Novell, Inc.
3 *
4 * Inspired by various other pieces of code including GsmClient (C)
5 * 2001 Havoc Pennington, MateClient (C) 1998 Carsten Schaar, and twm
6 * session code (C) 1998 The Open Group.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 */
23
24#include "config.h"
25
26#include "eggsmclient.h"
27#include "eggsmclient-private.h"
28
29#include "eggdesktopfile.h"
30
31#include <errno(*__errno_location ()).h>
32#include <fcntl.h>
33#include <stdlib.h>
34#include <string.h>
35#include <unistd.h>
36#include <X11/SM/SMlib.h>
37
38#include <gtk/gtk.h>
39#include <gdk/gdk.h>
40
41#ifdef GDK_WINDOWING_X11
42#include <gdk/gdkx.h>
43#endif
44
45#define EGG_TYPE_SM_CLIENT_XSMP(egg_sm_client_xsmp_get_type ()) (egg_sm_client_xsmp_get_type ())
46#define EGG_SM_CLIENT_XSMP(obj)((((EggSMClientXSMP*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((obj)), ((egg_sm_client_xsmp_get_type ()))))))
(G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMP)(((EggSMClientXSMP*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((obj)), ((egg_sm_client_xsmp_get_type ())))))
)
47#define EGG_SM_CLIENT_XSMP_CLASS(klass)((((EggSMClientXSMPClass*) (void *) g_type_check_class_cast (
(GTypeClass*) ((klass)), ((egg_sm_client_xsmp_get_type ()))))
))
(G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMPClass)(((EggSMClientXSMPClass*) (void *) g_type_check_class_cast ((
GTypeClass*) ((klass)), ((egg_sm_client_xsmp_get_type ())))))
)
48#define EGG_IS_SM_CLIENT_XSMP(obj)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(obj)); GType __t = ((egg_sm_client_xsmp_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_SM_CLIENT_XSMP)((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(obj)); GType __t = ((egg_sm_client_xsmp_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))
)
49#define EGG_IS_SM_CLIENT_XSMP_CLASS(klass)(((__extension__ ({ GTypeClass *__class = (GTypeClass*) ((klass
)); GType __t = ((egg_sm_client_xsmp_get_type ())); gboolean __r
; if (!__class) __r = (0); else if (__class->g_type == __t
) __r = (!(0)); else __r = g_type_check_class_is_a (__class, __t
); __r; }))))
(G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_SM_CLIENT_XSMP)((__extension__ ({ GTypeClass *__class = (GTypeClass*) ((klass
)); GType __t = ((egg_sm_client_xsmp_get_type ())); gboolean __r
; if (!__class) __r = (0); else if (__class->g_type == __t
) __r = (!(0)); else __r = g_type_check_class_is_a (__class, __t
); __r; })))
)
50#define EGG_SM_CLIENT_XSMP_GET_CLASS(obj)((((EggSMClientXSMPClass*) (((GTypeInstance*) ((obj)))->g_class
))))
(G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMPClass)(((EggSMClientXSMPClass*) (((GTypeInstance*) ((obj)))->g_class
)))
)
51
52typedef struct _EggSMClientXSMP EggSMClientXSMP;
53typedef struct _EggSMClientXSMPClass EggSMClientXSMPClass;
54
55/* These mostly correspond to the similarly-named states in section
56 * 9.1 of the XSMP spec. Some of the states there aren't represented
57 * here, because we don't need them. SHUTDOWN_CANCELLED is slightly
58 * different from the spec; we use it when the client is IDLE after a
59 * ShutdownCancelled message, but the application is still interacting
60 * and doesn't know the shutdown has been cancelled yet.
61 */
62typedef enum
63{
64 XSMP_STATE_IDLE,
65 XSMP_STATE_SAVE_YOURSELF,
66 XSMP_STATE_INTERACT_REQUEST,
67 XSMP_STATE_INTERACT,
68 XSMP_STATE_SAVE_YOURSELF_DONE,
69 XSMP_STATE_SHUTDOWN_CANCELLED,
70 XSMP_STATE_CONNECTION_CLOSED
71} EggSMClientXSMPState;
72
73static const char *state_names[] =
74{
75 "idle",
76 "save-yourself",
77 "interact-request",
78 "interact",
79 "save-yourself-done",
80 "shutdown-cancelled",
81 "connection-closed"
82};
83
84#define EGG_SM_CLIENT_XSMP_STATE(xsmp)(state_names[(xsmp)->state]) (state_names[(xsmp)->state])
85
86struct _EggSMClientXSMP
87{
88 EggSMClient parent;
89
90 SmcConn connection;
91 char *client_id;
92
93 EggSMClientXSMPState state;
94 char **restart_command;
95 gboolean set_restart_command;
96 int restart_style;
97 char **discard_command;
98 gboolean set_discard_command;
99
100 guint idle;
101
102 /* Current SaveYourself state */
103 guint expecting_initial_save_yourself : 1;
104 guint need_save_state : 1;
105 guint need_quit_requested : 1;
106 guint interact_errors : 1;
107 guint shutting_down : 1;
108
109 /* Todo list */
110 guint waiting_to_set_initial_properties : 1;
111 guint waiting_to_emit_quit : 1;
112 guint waiting_to_emit_quit_cancelled : 1;
113 guint waiting_to_save_myself : 1;
114
115};
116
117struct _EggSMClientXSMPClass
118{
119 EggSMClientClass parent_class;
120
121};
122
123static void sm_client_xsmp_startup (EggSMClient *client,
124 const char *client_id);
125static void sm_client_xsmp_set_restart_command (EggSMClient *client,
126 int argc,
127 const char **argv);
128static void sm_client_xsmp_set_discard_command (EggSMClient *client,
129 int argc,
130 const char **argv);
131static void sm_client_xsmp_will_quit (EggSMClient *client,
132 gboolean will_quit);
133static gboolean sm_client_xsmp_end_session (EggSMClient *client,
134 EggSMClientEndStyle style,
135 gboolean request_confirmation);
136
137static void xsmp_save_yourself (SmcConn smc_conn,
138 SmPointer client_data,
139 int save_style,
140 Boolint shutdown,
141 int interact_style,
142 Boolint fast);
143static void xsmp_die (SmcConn smc_conn,
144 SmPointer client_data);
145static void xsmp_save_complete (SmcConn smc_conn,
146 SmPointer client_data);
147static void xsmp_shutdown_cancelled (SmcConn smc_conn,
148 SmPointer client_data);
149static void xsmp_interact (SmcConn smc_conn,
150 SmPointer client_data);
151
152static SmProp *array_prop (const char *name,
153 ...);
154static SmProp *ptrarray_prop (const char *name,
155 GPtrArray *values);
156static SmProp *string_prop (const char *name,
157 const char *value);
158static SmProp *card8_prop (const char *name,
159 unsigned char value);
160
161static void set_properties (EggSMClientXSMP *xsmp, ...);
162static void delete_properties (EggSMClientXSMP *xsmp, ...);
163
164static GPtrArray *generate_command (char **restart_command,
165 const char *client_id,
166 const char *state_file);
167
168static void save_state (EggSMClientXSMP *xsmp);
169static void do_save_yourself (EggSMClientXSMP *xsmp);
170static void update_pending_events (EggSMClientXSMP *xsmp);
171
172static void ice_init (void);
173static gboolean process_ice_messages (IceConn ice_conn);
174static void smc_error_handler (SmcConn smc_conn,
175 Boolint swap,
176 int offending_minor_opcode,
177 unsigned long offending_sequence,
178 int error_class,
179 int severity,
180 SmPointer values);
181
182G_DEFINE_TYPE (EggSMClientXSMP, egg_sm_client_xsmp, EGG_TYPE_SM_CLIENT)static void egg_sm_client_xsmp_init (EggSMClientXSMP *self); static
void egg_sm_client_xsmp_class_init (EggSMClientXSMPClass *klass
); static GType egg_sm_client_xsmp_get_type_once (void); static
gpointer egg_sm_client_xsmp_parent_class = ((void*)0); static
gint EggSMClientXSMP_private_offset; static void egg_sm_client_xsmp_class_intern_init
(gpointer klass) { egg_sm_client_xsmp_parent_class = g_type_class_peek_parent
(klass); if (EggSMClientXSMP_private_offset != 0) g_type_class_adjust_private_offset
(klass, &EggSMClientXSMP_private_offset); egg_sm_client_xsmp_class_init
((EggSMClientXSMPClass*) klass); } __attribute__ ((__unused__
)) static inline gpointer egg_sm_client_xsmp_get_instance_private
(EggSMClientXSMP *self) { return (((gpointer) ((guint8*) (self
) + (glong) (EggSMClientXSMP_private_offset)))); } GType egg_sm_client_xsmp_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ _Static_assert (sizeof *(&static_g_define_type_id) ==
sizeof (gpointer), "Expression evaluates to false"); (void) (
0 ? (gpointer) *(&static_g_define_type_id) : ((void*)0));
(!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = egg_sm_client_xsmp_get_type_once
(); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } __attribute__ ((__noinline__)) static GType egg_sm_client_xsmp_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((egg_sm_client_get_type ()), g_intern_static_string ("EggSMClientXSMP"
), sizeof (EggSMClientXSMPClass), (GClassInitFunc)(void (*)(void
)) egg_sm_client_xsmp_class_intern_init, sizeof (EggSMClientXSMP
), (GInstanceInitFunc)(void (*)(void)) egg_sm_client_xsmp_init
, (GTypeFlags) 0); { {{};} } return g_define_type_id; }
183
184static void
185egg_sm_client_xsmp_init (EggSMClientXSMP *xsmp)
186{
187 xsmp->state = XSMP_STATE_CONNECTION_CLOSED;
188 xsmp->connection = NULL((void*)0);
189 xsmp->restart_style = SmRestartIfRunning0;
190}
191
192static void
193egg_sm_client_xsmp_class_init (EggSMClientXSMPClass *klass)
194{
195 EggSMClientClass *sm_client_class = EGG_SM_CLIENT_CLASS (klass);
196
197 sm_client_class->startup = sm_client_xsmp_startup;
198 sm_client_class->set_restart_command = sm_client_xsmp_set_restart_command;
199 sm_client_class->set_discard_command = sm_client_xsmp_set_discard_command;
200 sm_client_class->will_quit = sm_client_xsmp_will_quit;
201 sm_client_class->end_session = sm_client_xsmp_end_session;
202}
203
204EggSMClient *
205egg_sm_client_xsmp_new (void)
206{
207 if (!g_getenv ("SESSION_MANAGER"))
208 return NULL((void*)0);
209
210 return g_object_new (EGG_TYPE_SM_CLIENT_XSMP(egg_sm_client_xsmp_get_type ()), NULL((void*)0));
211}
212
213static gboolean
214sm_client_xsmp_set_initial_properties (gpointer user_data)
215{
216 EggSMClientXSMP *xsmp = user_data;
217 EggDesktopFile *desktop_file;
218 GPtrArray *clone, *restart;
219 char pid_str[64];
220
221 if (xsmp->idle)
222 {
223 g_source_remove (xsmp->idle);
224 xsmp->idle = 0;
225 }
226 xsmp->waiting_to_set_initial_properties = FALSE(0);
227
228 if (egg_sm_client_get_mode () == EGG_SM_CLIENT_MODE_NO_RESTART)
229 xsmp->restart_style = SmRestartNever3;
230
231 /* Parse info out of desktop file */
232 desktop_file = egg_get_desktop_file ();
233 if (desktop_file)
234 {
235 GError *err = NULL((void*)0);
236 char **argv;
237 int argc;
238
239 if (xsmp->restart_style == SmRestartIfRunning0)
240 {
241 if (egg_desktop_file_get_boolean (desktop_file,
242 "X-MATE-AutoRestart", NULL((void*)0)))
243 xsmp->restart_style = SmRestartImmediately2;
244 }
245
246 if (!xsmp->set_restart_command)
247 {
248 char *cmdline;
249
250 cmdline = egg_desktop_file_parse_exec (desktop_file, NULL((void*)0), &err);
251 if (cmdline && g_shell_parse_argv (cmdline, &argc, &argv, &err))
252 {
253 egg_sm_client_set_restart_command (EGG_SM_CLIENT (xsmp),
254 argc, (const char **)argv);
255 g_strfreev (argv);
256 }
257 else
258 {
259 g_warning ("Could not parse Exec line in desktop file: %s",
260 err->message);
261 g_error_free (err);
262 }
263 g_free (cmdline);
264 }
265 }
266
267 if (!xsmp->set_restart_command)
268 xsmp->restart_command = g_strsplit (g_get_prgname (), " ", -1);
269
270 clone = generate_command (xsmp->restart_command, NULL((void*)0), NULL((void*)0));
271 restart = generate_command (xsmp->restart_command, xsmp->client_id, NULL((void*)0));
272
273 g_debug ("Setting initial properties");
274
275 /* Program, CloneCommand, RestartCommand, and UserID are required.
276 * ProcessID isn't required, but the SM may be able to do something
277 * useful with it.
278 */
279 g_snprintf (pid_str, sizeof (pid_str), "%lu", (gulong) getpid ());
280 set_properties (xsmp,
281 string_prop (SmProgram"Program", g_get_prgname ()),
282 ptrarray_prop (SmCloneCommand"CloneCommand", clone),
283 ptrarray_prop (SmRestartCommand"RestartCommand", restart),
284 string_prop (SmUserID"UserID", g_get_user_name ()),
285 string_prop (SmProcessID"ProcessID", pid_str),
286 card8_prop (SmRestartStyleHint"RestartStyleHint", xsmp->restart_style),
287 NULL((void*)0));
288 g_ptr_array_free (clone, TRUE(!(0)));
289 g_ptr_array_free (restart, TRUE(!(0)));
290
291 if (desktop_file)
292 {
293 set_properties (xsmp,
294 string_prop ("_GSM_DesktopFile", egg_desktop_file_get_source (desktop_file)),
295 NULL((void*)0));
296 }
297
298 update_pending_events (xsmp);
299 return FALSE(0);
300}
301
302/* This gets called from two different places: xsmp_die() (when the
303 * server asks us to disconnect) and process_ice_messages() (when the
304 * server disconnects unexpectedly).
305 */
306static void
307sm_client_xsmp_disconnect (EggSMClientXSMP *xsmp)
308{
309 SmcConn connection;
310
311 if (!xsmp->connection)
312 return;
313
314 g_debug ("Disconnecting");
315
316 connection = xsmp->connection;
317 xsmp->connection = NULL((void*)0);
318 SmcCloseConnection (connection, 0, NULL((void*)0));
319 xsmp->state = XSMP_STATE_CONNECTION_CLOSED;
320
321 xsmp->waiting_to_save_myself = FALSE(0);
322 update_pending_events (xsmp);
323}
324
325static void
326sm_client_xsmp_startup (EggSMClient *client,
327 const char *client_id)
328{
329 EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
330 SmcCallbacks callbacks;
331 char *ret_client_id;
332 char error_string_ret[256];
333
334 xsmp->client_id = g_strdup (client_id)g_strdup_inline (client_id);
335
336 ice_init ();
337 SmcSetErrorHandler (smc_error_handler);
338
339 callbacks.save_yourself.callback = xsmp_save_yourself;
340 callbacks.die.callback = xsmp_die;
341 callbacks.save_complete.callback = xsmp_save_complete;
342 callbacks.shutdown_cancelled.callback = xsmp_shutdown_cancelled;
343
344 callbacks.save_yourself.client_data = xsmp;
345 callbacks.die.client_data = xsmp;
346 callbacks.save_complete.client_data = xsmp;
347 callbacks.shutdown_cancelled.client_data = xsmp;
348
349 client_id = NULL((void*)0);
350 error_string_ret[0] = '\0';
351 xsmp->connection =
352 SmcOpenConnection (NULL((void*)0), xsmp, SmProtoMajor1, SmProtoMinor0,
353 SmcSaveYourselfProcMask(1L << 0) | SmcDieProcMask(1L << 1) |
354 SmcSaveCompleteProcMask(1L << 2) |
355 SmcShutdownCancelledProcMask(1L << 3),
356 &callbacks,
357 xsmp->client_id, &ret_client_id,
358 sizeof (error_string_ret), error_string_ret);
359
360 if (!xsmp->connection)
361 {
362 g_warning ("Failed to connect to the session manager: %s\n",
363 error_string_ret[0] ?
364 error_string_ret : "no error message given");
365 xsmp->state = XSMP_STATE_CONNECTION_CLOSED;
366 return;
367 }
368
369 /* We expect a pointless initial SaveYourself if either (a) we
370 * didn't have an initial client ID, or (b) we DID have an initial
371 * client ID, but the server rejected it and gave us a new one.
372 */
373 if (!xsmp->client_id ||
374 (ret_client_id && strcmp (xsmp->client_id, ret_client_id) != 0))
375 xsmp->expecting_initial_save_yourself = TRUE(!(0));
376
377 if (ret_client_id)
378 {
379 g_free (xsmp->client_id);
380 xsmp->client_id = g_strdup (ret_client_id)g_strdup_inline (ret_client_id);
381 free (ret_client_id);
382
383#ifdef GDK_WINDOWING_X11
384 if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(gdk_display_get_default ())); GType __t = ((gdk_x11_display_get_type
())); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; }))))
)
385 gdk_x11_set_sm_client_id (xsmp->client_id);
386#endif
387
388 g_debug ("Got client ID \"%s\"", xsmp->client_id);
389 }
390
391 xsmp->state = XSMP_STATE_IDLE;
392
393 /* Do not set the initial properties until we reach the main loop,
394 * so that the application has a chance to call
395 * egg_set_desktop_file(). (This may also help the session manager
396 * have a better idea of when the application is fully up and
397 * running.)
398 */
399 xsmp->waiting_to_set_initial_properties = TRUE(!(0));
400 xsmp->idle = g_idle_add (sm_client_xsmp_set_initial_properties, client);
401}
402
403static void
404sm_client_xsmp_set_restart_command (EggSMClient *client,
405 int argc,
406 const char **argv)
407{
408 EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
409 int i;
410
411 g_strfreev (xsmp->restart_command);
412
413 xsmp->restart_command = g_new (char *, argc + 1)((char * *) g_malloc_n ((argc + 1), sizeof (char *)));
414 for (i = 0; i < argc; i++)
415 xsmp->restart_command[i] = g_strdup (argv[i])g_strdup_inline (argv[i]);
416 xsmp->restart_command[i] = NULL((void*)0);
417
418 xsmp->set_restart_command = TRUE(!(0));
419}
420
421static void
422sm_client_xsmp_set_discard_command (EggSMClient *client,
423 int argc,
424 const char **argv)
425{
426 EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
427 int i;
428
429 g_strfreev (xsmp->discard_command);
430
431 xsmp->discard_command = g_new (char *, argc + 1)((char * *) g_malloc_n ((argc + 1), sizeof (char *)));
432 for (i = 0; i < argc; i++)
433 xsmp->discard_command[i] = g_strdup (argv[i])g_strdup_inline (argv[i]);
434 xsmp->discard_command[i] = NULL((void*)0);
435
436 xsmp->set_discard_command = TRUE(!(0));
437}
438
439static void
440sm_client_xsmp_will_quit (EggSMClient *client,
441 gboolean will_quit)
442{
443 EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
444
445 if (xsmp->state == XSMP_STATE_CONNECTION_CLOSED)
446 {
447 /* The session manager has already exited! Schedule a quit
448 * signal.
449 */
450 xsmp->waiting_to_emit_quit = TRUE(!(0));
451 update_pending_events (xsmp);
452 return;
453 }
454 else if (xsmp->state == XSMP_STATE_SHUTDOWN_CANCELLED)
455 {
456 /* We received a ShutdownCancelled message while the application
457 * was interacting; Schedule a quit_cancelled signal.
458 */
459 xsmp->waiting_to_emit_quit_cancelled = TRUE(!(0));
460 update_pending_events (xsmp);
461 return;
462 }
463
464 g_return_if_fail (xsmp->state == XSMP_STATE_INTERACT)do { if ((xsmp->state == XSMP_STATE_INTERACT)) { } else { g_return_if_fail_warning
("EggSMClient", ((const char*) (__func__)), "xsmp->state == XSMP_STATE_INTERACT"
); return; } } while (0)
;
465
466 g_debug ("Sending InteractDone(%s)", will_quit ? "False" : "True");
467 SmcInteractDone (xsmp->connection, !will_quit);
468
469 if (will_quit && xsmp->need_save_state)
470 save_state (xsmp);
471
472 g_debug ("Sending SaveYourselfDone(%s)", will_quit ? "True" : "False");
473 SmcSaveYourselfDone (xsmp->connection, will_quit);
474 xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE;
475}
476
477static gboolean
478sm_client_xsmp_end_session (EggSMClient *client,
479 EggSMClientEndStyle style,
480 gboolean request_confirmation)
481{
482 EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
483 int save_type;
484
485 /* To end the session via XSMP, we have to send a
486 * SaveYourselfRequest. We aren't allowed to do that if anything
487 * else is going on, but we don't want to expose this fact to the
488 * application. So we do our best to patch things up here...
489 *
490 * In the worst case, this method might block for some length of
491 * time in process_ice_messages, but the only time that code path is
492 * honestly likely to get hit is if the application tries to end the
493 * session as the very first thing it does, in which case it
494 * probably won't actually block anyway. It's not worth gunking up
495 * the API to try to deal nicely with the other 0.01% of cases where
496 * this happens.
497 */
498
499 while (xsmp->state != XSMP_STATE_IDLE ||
500 xsmp->expecting_initial_save_yourself)
501 {
502 /* If we're already shutting down, we don't need to do anything. */
503 if (xsmp->shutting_down)
504 return TRUE(!(0));
505
506 switch (xsmp->state)
507 {
508 case XSMP_STATE_CONNECTION_CLOSED:
509 return FALSE(0);
510
511 case XSMP_STATE_SAVE_YOURSELF:
512 /* Trying to log out from the save_state callback? Whatever.
513 * Abort the save_state.
514 */
515 SmcSaveYourselfDone (xsmp->connection, FALSE(0));
516 xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE;
517 break;
518
519 case XSMP_STATE_INTERACT_REQUEST:
520 case XSMP_STATE_INTERACT:
521 case XSMP_STATE_SHUTDOWN_CANCELLED:
522 /* Already in a shutdown-related state, just ignore
523 * the new shutdown request...
524 */
525 return TRUE(!(0));
526
527 case XSMP_STATE_IDLE:
528 if (xsmp->waiting_to_set_initial_properties)
529 sm_client_xsmp_set_initial_properties (xsmp);
530
531 if (!xsmp->expecting_initial_save_yourself)
532 break;
533 /* else fall through */
534
535 case XSMP_STATE_SAVE_YOURSELF_DONE:
536 /* We need to wait for some response from the server.*/
537 process_ice_messages (SmcGetIceConnection (xsmp->connection));
538 break;
539
540 default:
541 /* Hm... shouldn't happen */
542 return FALSE(0);
543 }
544 }
545
546 /* xfce4-session will do the wrong thing if we pass SmSaveGlobal and
547 * the user chooses to save the session. But mate-session will do
548 * the wrong thing if we pass SmSaveBoth and the user chooses NOT to
549 * save the session... Sigh.
550 */
551 if (!strcmp (SmcVendor (xsmp->connection), "xfce4-session"))
552 save_type = SmSaveBoth2;
553 else
554 save_type = SmSaveGlobal0;
555
556 g_debug ("Sending SaveYourselfRequest(SmSaveGlobal, Shutdown, SmInteractStyleAny, %sFast)", request_confirmation ? "!" : "");
557 SmcRequestSaveYourself (xsmp->connection,
558 save_type,
559 True1, /* shutdown */
560 SmInteractStyleAny2,
561 !request_confirmation, /* fast */
562 True1 /* global */);
563 return TRUE(!(0));
564}
565
566static gboolean
567idle_do_pending_events (gpointer data)
568{
569 EggSMClientXSMP *xsmp = data;
570 EggSMClient *client = data;
571
572 xsmp->idle = 0;
573
574 if (xsmp->waiting_to_emit_quit)
575 {
576 xsmp->waiting_to_emit_quit = FALSE(0);
577 egg_sm_client_quit (client);
578 goto out;
579 }
580
581 if (xsmp->waiting_to_emit_quit_cancelled)
582 {
583 xsmp->waiting_to_emit_quit_cancelled = FALSE(0);
584 egg_sm_client_quit_cancelled (client);
585 xsmp->state = XSMP_STATE_IDLE;
586 }
587
588 if (xsmp->waiting_to_save_myself)
589 {
590 xsmp->waiting_to_save_myself = FALSE(0);
591 do_save_yourself (xsmp);
592 }
593
594out:
595 return FALSE(0);
596}
597
598static void
599update_pending_events (EggSMClientXSMP *xsmp)
600{
601 gboolean want_idle =
602 xsmp->waiting_to_emit_quit ||
603 xsmp->waiting_to_emit_quit_cancelled ||
604 xsmp->waiting_to_save_myself;
605
606 if (want_idle)
607 {
608 if (xsmp->idle == 0)
609 xsmp->idle = g_idle_add (idle_do_pending_events, xsmp);
610 }
611 else
612 {
613 if (xsmp->idle != 0)
614 g_source_remove (xsmp->idle);
615 xsmp->idle = 0;
616 }
617}
618
619static void
620fix_broken_state (EggSMClientXSMP *xsmp, const char *message,
621 gboolean send_interact_done,
622 gboolean send_save_yourself_done)
623{
624 g_warning ("Received XSMP %s message in state %s: client or server error",
625 message, EGG_SM_CLIENT_XSMP_STATE (xsmp)(state_names[(xsmp)->state]));
626
627 /* Forget any pending SaveYourself plans we had */
628 xsmp->waiting_to_save_myself = FALSE(0);
629 update_pending_events (xsmp);
630
631 if (send_interact_done)
632 SmcInteractDone (xsmp->connection, False0);
633 if (send_save_yourself_done)
634 SmcSaveYourselfDone (xsmp->connection, True1);
635
636 xsmp->state = send_save_yourself_done ? XSMP_STATE_SAVE_YOURSELF_DONE : XSMP_STATE_IDLE;
637}
638
639/* SM callbacks */
640
641static void
642xsmp_save_yourself (SmcConn smc_conn,
643 SmPointer client_data,
644 int save_type,
645 Boolint shutdown,
646 int interact_style,
647 Boolint fast)
648{
649 EggSMClientXSMP *xsmp = client_data;
650 gboolean wants_quit_requested;
651
652 g_debug ("Received SaveYourself(%s, %s, %s, %s) in state %s",
653 save_type == SmSaveLocal1 ? "SmSaveLocal" :
654 save_type == SmSaveGlobal0 ? "SmSaveGlobal" : "SmSaveBoth",
655 shutdown ? "Shutdown" : "!Shutdown",
656 interact_style == SmInteractStyleAny2 ? "SmInteractStyleAny" :
657 interact_style == SmInteractStyleErrors1 ? "SmInteractStyleErrors" :
658 "SmInteractStyleNone", fast ? "Fast" : "!Fast",
659 EGG_SM_CLIENT_XSMP_STATE (xsmp)(state_names[(xsmp)->state]));
660
661 if (xsmp->state != XSMP_STATE_IDLE &&
662 xsmp->state != XSMP_STATE_SHUTDOWN_CANCELLED)
663 {
664 fix_broken_state (xsmp, "SaveYourself", FALSE(0), TRUE(!(0)));
665 return;
666 }
667
668 if (xsmp->waiting_to_set_initial_properties)
669 sm_client_xsmp_set_initial_properties (xsmp);
670
671 /* If this is the initial SaveYourself, ignore it; we've already set
672 * properties and there's no reason to actually save state too.
673 */
674 if (xsmp->expecting_initial_save_yourself)
675 {
676 xsmp->expecting_initial_save_yourself = FALSE(0);
677
678 if (save_type == SmSaveLocal1 &&
679 interact_style == SmInteractStyleNone0 &&
680 !shutdown && !fast)
681 {
682 g_debug ("Sending SaveYourselfDone(True) for initial SaveYourself");
683 SmcSaveYourselfDone (xsmp->connection, True1);
684 /* As explained in the comment at the end of
685 * do_save_yourself(), SAVE_YOURSELF_DONE is the correct
686 * state here, not IDLE.
687 */
688 xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE;
689 return;
690 }
691 else
692 g_warning ("First SaveYourself was not the expected one!");
693 }
694
695 /* Even ignoring the "fast" flag completely, there are still 18
696 * different combinations of save_type, shutdown and interact_style.
697 * We interpret them as follows:
698 *
699 * Type Shutdown Interact Interpretation
700 * G F A/E/N do nothing (1)
701 * G T N do nothing (1)*
702 * G T A/E quit_requested (2)
703 * L/B F A/E/N save_state (3)
704 * L/B T N save_state (3)*
705 * L/B T A/E quit_requested, then save_state (4)
706 *
707 * 1. Do nothing, because the SM asked us to do something
708 * uninteresting (save open files, but then don't quit
709 * afterward) or rude (save open files without asking the user
710 * for confirmation).
711 *
712 * 2. Request interaction and then emit ::quit_requested. This
713 * perhaps isn't quite correct for the SmInteractStyleErrors
714 * case, but we don't care.
715 *
716 * 3. Emit ::save_state. The SmSaveBoth SaveYourselfs in these
717 * rows essentially get demoted to SmSaveLocal, because their
718 * Global halves correspond to "do nothing".
719 *
720 * 4. Request interaction, emit ::quit_requested, and then emit
721 * ::save_state after interacting. This is the SmSaveBoth
722 * equivalent of #2, but we also promote SmSaveLocal shutdown
723 * SaveYourselfs to SmSaveBoth here, because we want to give
724 * the user a chance to save open files before quitting.
725 *
726 * (* It would be nice if we could do something useful when the
727 * session manager sends a SaveYourself with shutdown True and
728 * SmInteractStyleNone. But we can't, so we just pretend it didn't
729 * even tell us it was shutting down. The docs for ::quit mention
730 * that it might not always be preceded by ::quit_requested.)
731 */
732
733 /* As an optimization, we don't actually request interaction and
734 * emit ::quit_requested if the application isn't listening to the
735 * signal.
736 */
737 wants_quit_requested = g_signal_has_handler_pending (xsmp, g_signal_lookup ("quit_requested", EGG_TYPE_SM_CLIENT(egg_sm_client_get_type ())), 0, FALSE(0));
738
739 xsmp->need_save_state = (save_type != SmSaveGlobal0);
740 xsmp->need_quit_requested = (shutdown && wants_quit_requested &&
741 interact_style != SmInteractStyleNone0);
742 xsmp->interact_errors = (interact_style == SmInteractStyleErrors1);
743
744 xsmp->shutting_down = shutdown;
745
746 do_save_yourself (xsmp);
747}
748
749static void
750do_save_yourself (EggSMClientXSMP *xsmp)
751{
752 if (xsmp->state == XSMP_STATE_SHUTDOWN_CANCELLED)
753 {
754 /* The SM cancelled a previous SaveYourself, but we haven't yet
755 * had a chance to tell the application, so we can't start
756 * processing this SaveYourself yet.
757 */
758 xsmp->waiting_to_save_myself = TRUE(!(0));
759 update_pending_events (xsmp);
760 return;
761 }
762
763 if (xsmp->need_quit_requested)
764 {
765 xsmp->state = XSMP_STATE_INTERACT_REQUEST;
766
767 g_debug ("Sending InteractRequest(%s)",
768 xsmp->interact_errors ? "Error" : "Normal");
769 SmcInteractRequest (xsmp->connection,
770 xsmp->interact_errors ? SmDialogError0 : SmDialogNormal1,
771 xsmp_interact,
772 xsmp);
773 return;
774 }
775
776 if (xsmp->need_save_state)
777 {
778 save_state (xsmp);
779
780 /* Though unlikely, the client could have been disconnected
781 * while the application was saving its state.
782 */
783 if (!xsmp->connection)
784 return;
785 }
786
787 g_debug ("Sending SaveYourselfDone(True)");
788 SmcSaveYourselfDone (xsmp->connection, True1);
789
790 /* The client state diagram in the XSMP spec says that after a
791 * non-shutdown SaveYourself, we go directly back to "idle". But
792 * everything else in both the XSMP spec and the libSM docs
793 * disagrees.
794 */
795 xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE;
796}
797
798static void
799save_state (EggSMClientXSMP *xsmp)
800{
801 GKeyFile *state_file;
802 char *state_file_path, *data;
803 EggDesktopFile *desktop_file;
804 GPtrArray *restart, *discard;
805 int offset, fd;
806
807 /* We set xsmp->state before emitting save_state, but our caller is
808 * responsible for setting it back afterward.
809 */
810 xsmp->state = XSMP_STATE_SAVE_YOURSELF;
811
812 state_file = egg_sm_client_save_state ((EggSMClient *)xsmp);
813 if (!state_file)
814 {
815 restart = generate_command (xsmp->restart_command, xsmp->client_id, NULL((void*)0));
816 set_properties (xsmp,
817 ptrarray_prop (SmRestartCommand"RestartCommand", restart),
818 NULL((void*)0));
819 g_ptr_array_free (restart, TRUE(!(0)));
820
821 if (xsmp->set_discard_command)
822 {
823 discard = generate_command (xsmp->discard_command, NULL((void*)0), NULL((void*)0));
824 set_properties (xsmp,
825 ptrarray_prop (SmDiscardCommand"DiscardCommand", discard),
826 NULL((void*)0));
827 g_ptr_array_free (discard, TRUE(!(0)));
828 }
829 else
830 delete_properties (xsmp, SmDiscardCommand"DiscardCommand", NULL((void*)0));
831
832 return;
833 }
834
835 desktop_file = egg_get_desktop_file ();
836 if (desktop_file)
837 {
838 GKeyFile *merged_file;
839 char *desktop_file_path;
840
841 merged_file = g_key_file_new ();
842 desktop_file_path =
843 g_filename_from_uri (egg_desktop_file_get_source (desktop_file),
844 NULL((void*)0), NULL((void*)0));
845 if (desktop_file_path &&
846 g_key_file_load_from_file (merged_file, desktop_file_path,
847 G_KEY_FILE_KEEP_COMMENTS |
848 G_KEY_FILE_KEEP_TRANSLATIONS, NULL((void*)0)))
849 {
850 guint g, k, i;
851 char **groups, **keys, *value, *exec;
852
853 groups = g_key_file_get_groups (state_file, NULL((void*)0));
854 for (g = 0; groups[g]; g++)
855 {
856 keys = g_key_file_get_keys (state_file, groups[g], NULL((void*)0), NULL((void*)0));
857 for (k = 0; keys[k]; k++)
858 {
859 value = g_key_file_get_value (state_file, groups[g],
860 keys[k], NULL((void*)0));
861 if (value)
862 {
863 g_key_file_set_value (merged_file, groups[g],
864 keys[k], value);
865 g_free (value);
866 }
867 }
868 g_strfreev (keys);
869 }
870 g_strfreev (groups);
871
872 g_key_file_free (state_file);
873 state_file = merged_file;
874
875 /* Update Exec key using "--sm-client-state-file %k" */
876 restart = generate_command (xsmp->restart_command,
877 NULL((void*)0), "%k");
878 for (i = 0; i < restart->len; i++)
879 restart->pdata[i] = g_shell_quote (restart->pdata[i]);
880 g_ptr_array_add (restart, NULL((void*)0));
881 exec = g_strjoinv (" ", (char **)restart->pdata);
882 g_strfreev ((char **)restart->pdata);
883 g_ptr_array_free (restart, FALSE(0));
884
885 g_key_file_set_string (state_file, EGG_DESKTOP_FILE_GROUP"Desktop Entry",
886 EGG_DESKTOP_FILE_KEY_EXEC"Exec",
887 exec);
888 g_free (exec);
889 }
890 else
891 desktop_file = NULL((void*)0);
892
893 g_free (desktop_file_path);
894 }
895
896 /* Now write state_file to disk. (We can't use mktemp(), because
897 * that requires the filename to end with "XXXXXX", and we want
898 * it to end with ".desktop".)
899 */
900
901 data = g_key_file_to_data (state_file, NULL((void*)0), NULL((void*)0));
902 g_key_file_free (state_file);
903
904 offset = 0;
905 while (1)
906 {
907 state_file_path = g_strdup_printf ("%s%csession-state%c%s-%ld.%s",
908 g_get_user_config_dir (),
909 G_DIR_SEPARATOR'/', G_DIR_SEPARATOR'/',
910 g_get_prgname (),
911 (long)time (NULL((void*)0)) + offset,
912 desktop_file ? "desktop" : "state");
913
914 fd = open (state_file_path, O_WRONLY01 | O_CREAT0100 | O_EXCL0200, 0644);
915 if (fd == -1)
916 {
917 if (errno(*__errno_location ()) == EEXIST17)
918 {
919 offset++;
920 g_free (state_file_path);
921 continue;
922 }
923 else if (errno(*__errno_location ()) == ENOTDIR20 || errno(*__errno_location ()) == ENOENT2)
924 {
925 char *sep = strrchr (state_file_path, G_DIR_SEPARATOR'/');
926
927 *sep = '\0';
928 if (g_mkdir_with_parents (state_file_path, 0755) != 0)
929 {
930 g_warning ("Could not create directory '%s'",
931 state_file_path);
932 g_free (state_file_path);
933 state_file_path = NULL((void*)0);
934 break;
935 }
936
937 continue;
938 }
939
940 g_warning ("Could not create file '%s': %s",
941 state_file_path, g_strerror (errno(*__errno_location ())));
942 g_free (state_file_path);
943 state_file_path = NULL((void*)0);
944 break;
945 }
946
947 close (fd);
948 g_file_set_contents (state_file_path, data, -1, NULL((void*)0));
949 break;
950 }
951 g_free (data);
952
953 restart = generate_command (xsmp->restart_command, xsmp->client_id,
954 state_file_path);
955 set_properties (xsmp,
956 ptrarray_prop (SmRestartCommand"RestartCommand", restart),
957 NULL((void*)0));
958 g_ptr_array_free (restart, TRUE(!(0)));
959
960 if (state_file_path)
961 {
962 set_properties (xsmp,
963 array_prop (SmDiscardCommand"DiscardCommand",
964 "/bin/rm", "-rf", state_file_path,
965 NULL((void*)0)),
966 NULL((void*)0));
967 g_free (state_file_path);
968 }
969}
970
971static void
972xsmp_interact (SmcConn smc_conn,
973 SmPointer client_data)
974{
975 EggSMClientXSMP *xsmp = client_data;
976 EggSMClient *client = client_data;
977
978 g_debug ("Received Interact message in state %s",
979 EGG_SM_CLIENT_XSMP_STATE (xsmp)(state_names[(xsmp)->state]));
980
981 if (xsmp->state != XSMP_STATE_INTERACT_REQUEST)
982 {
983 fix_broken_state (xsmp, "Interact", TRUE(!(0)), TRUE(!(0)));
984 return;
985 }
986
987 xsmp->state = XSMP_STATE_INTERACT;
988 egg_sm_client_quit_requested (client);
989}
990
991static void
992xsmp_die (SmcConn smc_conn,
993 SmPointer client_data)
994{
995 EggSMClientXSMP *xsmp = client_data;
996 EggSMClient *client = client_data;
997
998 g_debug ("Received Die message in state %s",
999 EGG_SM_CLIENT_XSMP_STATE (xsmp)(state_names[(xsmp)->state]));
1000
1001 sm_client_xsmp_disconnect (xsmp);
1002 egg_sm_client_quit (client);
1003}
1004
1005static void
1006xsmp_save_complete (SmcConn smc_conn,
1007 SmPointer client_data)
1008{
1009 EggSMClientXSMP *xsmp = client_data;
1010
1011 g_debug ("Received SaveComplete message in state %s",
1012 EGG_SM_CLIENT_XSMP_STATE (xsmp)(state_names[(xsmp)->state]));
1013
1014 if (xsmp->state == XSMP_STATE_SAVE_YOURSELF_DONE)
1015 xsmp->state = XSMP_STATE_IDLE;
1016 else
1017 fix_broken_state (xsmp, "SaveComplete", FALSE(0), FALSE(0));
1018}
1019
1020static void
1021xsmp_shutdown_cancelled (SmcConn smc_conn,
1022 SmPointer client_data)
1023{
1024 EggSMClientXSMP *xsmp = client_data;
1025 EggSMClient *client = client_data;
1026
1027 g_debug ("Received ShutdownCancelled message in state %s",
1028 EGG_SM_CLIENT_XSMP_STATE (xsmp)(state_names[(xsmp)->state]));
1029
1030 xsmp->shutting_down = FALSE(0);
1031
1032 if (xsmp->state == XSMP_STATE_SAVE_YOURSELF_DONE)
1033 {
1034 /* We've finished interacting and now the SM has agreed to
1035 * cancel the shutdown.
1036 */
1037 xsmp->state = XSMP_STATE_IDLE;
1038 egg_sm_client_quit_cancelled (client);
1039 }
1040 else if (xsmp->state == XSMP_STATE_SHUTDOWN_CANCELLED)
1041 {
1042 /* Hm... ok, so we got a shutdown SaveYourself, which got
1043 * cancelled, but the application was still interacting, so we
1044 * didn't tell it yet, and then *another* SaveYourself arrived,
1045 * which we must still be waiting to tell the app about, except
1046 * that now that SaveYourself has been cancelled too! Dizzy yet?
1047 */
1048 xsmp->waiting_to_save_myself = FALSE(0);
1049 update_pending_events (xsmp);
1050 }
1051 else
1052 {
1053 g_debug ("Sending SaveYourselfDone(False)");
1054 SmcSaveYourselfDone (xsmp->connection, False0);
1055
1056 if (xsmp->state == XSMP_STATE_INTERACT)
1057 {
1058 /* The application is currently interacting, so we can't
1059 * tell it about the cancellation yet; we will wait until
1060 * after it calls egg_sm_client_will_quit().
1061 */
1062 xsmp->state = XSMP_STATE_SHUTDOWN_CANCELLED;
1063 }
1064 else
1065 {
1066 /* The shutdown was cancelled before the application got a
1067 * chance to interact.
1068 */
1069 xsmp->state = XSMP_STATE_IDLE;
1070 }
1071 }
1072}
1073
1074/* Utilities */
1075
1076/* Create a restart/clone/Exec command based on @restart_command.
1077 * If @client_id is non-%NULL, add "--sm-client-id @client_id".
1078 * If @state_file is non-%NULL, add "--sm-client-state-file @state_file".
1079 *
1080 * None of the input strings are g_strdup()ed; the caller must keep
1081 * them around until it is done with the returned GPtrArray, and must
1082 * then free the array, but not its contents.
1083 */
1084static GPtrArray *
1085generate_command (char **restart_command, const char *client_id,
1086 const char *state_file)
1087{
1088 GPtrArray *cmd;
1089 int i;
1090
1091 cmd = g_ptr_array_new ();
1092 g_ptr_array_add (cmd, restart_command[0]);
1093
1094 if (client_id)
1095 {
1096 g_ptr_array_add (cmd, (char *)"--sm-client-id");
1097 g_ptr_array_add (cmd, (char *)client_id);
1098 }
1099
1100 if (state_file)
1101 {
1102 g_ptr_array_add (cmd, (char *)"--sm-client-state-file");
1103 g_ptr_array_add (cmd, (char *)state_file);
1104 }
1105
1106 for (i = 1; restart_command[i]; i++)
1107 g_ptr_array_add (cmd, restart_command[i]);
1108
1109 return cmd;
1110}
1111
1112/* Takes a NULL-terminated list of SmProp * values, created by
1113 * array_prop, ptrarray_prop, string_prop, card8_prop, sets them, and
1114 * frees them.
1115 */
1116static void
1117set_properties (EggSMClientXSMP *xsmp, ...)
1118{
1119 GPtrArray *props;
1120 SmProp *prop;
1121 va_list ap;
1122 guint i;
1123
1124 props = g_ptr_array_new ();
1125
1126 va_start (ap, xsmp)__builtin_va_start(ap, xsmp);
1127 while ((prop = va_arg (ap, SmProp *)__builtin_va_arg(ap, SmProp *)))
1128 g_ptr_array_add (props, prop);
1129 va_end (ap)__builtin_va_end(ap);
1130
1131 if (xsmp->connection)
1132 {
1133 SmcSetProperties (xsmp->connection, props->len,
1134 (SmProp **)props->pdata);
1135 }
1136
1137 for (i = 0; i < props->len; i++)
1138 {
1139 prop = props->pdata[i];
1140 g_free (prop->vals);
1141 g_free (prop);
1142 }
1143 g_ptr_array_free (props, TRUE(!(0)));
1144}
1145
1146/* Takes a NULL-terminated list of property names and deletes them. */
1147static void
1148delete_properties (EggSMClientXSMP *xsmp, ...)
1149{
1150 GPtrArray *props;
1151 char *prop;
1152 va_list ap;
1153
1154 if (!xsmp->connection)
1155 return;
1156
1157 props = g_ptr_array_new ();
1158
1159 va_start (ap, xsmp)__builtin_va_start(ap, xsmp);
1160 while ((prop = va_arg (ap, char *)__builtin_va_arg(ap, char *)))
1161 g_ptr_array_add (props, prop);
1162 va_end (ap)__builtin_va_end(ap);
1163
1164 SmcDeleteProperties (xsmp->connection, props->len,
1165 (char **)props->pdata);
1166
1167 g_ptr_array_free (props, TRUE(!(0)));
1168}
1169
1170/* Takes an array of strings and creates a LISTofARRAY8 property. The
1171 * strings are neither dupped nor freed; they need to remain valid
1172 * until you're done with the SmProp.
1173 */
1174static SmProp *
1175array_prop (const char *name, ...)
1176{
1177 SmProp *prop;
1178 SmPropValue pv;
1179 GArray *vals;
1180 char *value;
1181 va_list ap;
1182
1183 prop = g_new (SmProp, 1)((SmProp *) g_malloc_n ((1), sizeof (SmProp)));
1184 prop->name = (char *)name;
1185 prop->type = (char *)SmLISTofARRAY8"LISTofARRAY8";
1186
1187 vals = g_array_new (FALSE(0), FALSE(0), sizeof (SmPropValue));
1188
1189 va_start (ap, name)__builtin_va_start(ap, name);
1190 while ((value = va_arg (ap, char *)__builtin_va_arg(ap, char *)))
1191 {
1192 pv.length = strlen (value);
1193 pv.value = value;
1194 g_array_append_val (vals, pv)g_array_append_vals (vals, &(pv), 1);
1195 }
1196 va_end (ap)__builtin_va_end(ap);
1197
1198 prop->num_vals = vals->len;
1199 prop->vals = (SmPropValue *)vals->data;
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
1200
1201 g_array_free (vals, FALSE(0));
1202
1203 return prop;
1204}
1205
1206/* Takes a GPtrArray of strings and creates a LISTofARRAY8 property.
1207 * The array contents are neither dupped nor freed; they need to
1208 * remain valid until you're done with the SmProp.
1209 */
1210static SmProp *
1211ptrarray_prop (const char *name, GPtrArray *values)
1212{
1213 SmProp *prop;
1214 SmPropValue pv;
1215 GArray *vals;
1216 guint i;
1217
1218 prop = g_new (SmProp, 1)((SmProp *) g_malloc_n ((1), sizeof (SmProp)));
1219 prop->name = (char *)name;
1220 prop->type = (char *)SmLISTofARRAY8"LISTofARRAY8";
1221
1222 vals = g_array_new (FALSE(0), FALSE(0), sizeof (SmPropValue));
1223
1224 for (i = 0; i < values->len; i++)
1225 {
1226 pv.length = strlen (values->pdata[i]);
1227 pv.value = values->pdata[i];
1228 g_array_append_val (vals, pv)g_array_append_vals (vals, &(pv), 1);
1229 }
1230
1231 prop->num_vals = vals->len;
1232 prop->vals = (SmPropValue *)vals->data;
1233
1234 g_array_free (vals, FALSE(0));
1235
1236 return prop;
1237}
1238
1239/* Takes a string and creates an ARRAY8 property. The string is
1240 * neither dupped nor freed; it needs to remain valid until you're
1241 * done with the SmProp.
1242 */
1243static SmProp *
1244string_prop (const char *name, const char *value)
1245{
1246 SmProp *prop;
1247
1248 prop = g_new (SmProp, 1)((SmProp *) g_malloc_n ((1), sizeof (SmProp)));
1249 prop->name = (char *)name;
1250 prop->type = (char *)SmARRAY8"ARRAY8";
1251
1252 prop->num_vals = 1;
1253 prop->vals = g_new (SmPropValue, 1)((SmPropValue *) g_malloc_n ((1), sizeof (SmPropValue)));
1254
1255 prop->vals[0].length = strlen (value);
1256 prop->vals[0].value = (char *)value;
1257
1258 return prop;
1259}
1260
1261/* Takes a char and creates a CARD8 property. */
1262static SmProp *
1263card8_prop (const char *name, unsigned char value)
1264{
1265 SmProp *prop;
1266 char *card8val;
1267
1268 /* To avoid having to allocate and free prop->vals[0], we cheat and
1269 * make vals a 2-element-long array and then use the second element
1270 * to store value.
1271 */
1272
1273 prop = g_new (SmProp, 1)((SmProp *) g_malloc_n ((1), sizeof (SmProp)));
1274 prop->name = (char *)name;
1275 prop->type = (char *)SmCARD8"CARD8";
1276
1277 prop->num_vals = 1;
1278 prop->vals = g_new (SmPropValue, 2)((SmPropValue *) g_malloc_n ((2), sizeof (SmPropValue)));
1279 card8val = (char *)(&prop->vals[1]);
1280 card8val[0] = value;
1281
1282 prop->vals[0].length = 1;
1283 prop->vals[0].value = card8val;
1284
1285 return prop;
1286}
1287
1288/* ICE code. This makes no effort to play nice with anyone else trying
1289 * to use libICE. Fortunately, no one uses libICE for anything other
1290 * than SM. (DCOP uses ICE, but it has its own private copy of
1291 * libICE.)
1292 *
1293 * When this moves to gtk, it will need to be cleverer, to avoid
1294 * tripping over old apps that use MateClient or that use libSM
1295 * directly.
1296 */
1297
1298#include <X11/ICE/ICElib.h>
1299#include <fcntl.h>
1300
1301static void ice_error_handler (IceConn ice_conn,
1302 Boolint swap,
1303 int offending_minor_opcode,
1304 unsigned long offending_sequence,
1305 int error_class,
1306 int severity,
1307 IcePointer values);
1308static void ice_io_error_handler (IceConn ice_conn);
1309static void ice_connection_watch (IceConn ice_conn,
1310 IcePointer client_data,
1311 Boolint opening,
1312 IcePointer *watch_data);
1313
1314static void
1315ice_init (void)
1316{
1317 IceSetIOErrorHandler (ice_io_error_handler);
1318 IceSetErrorHandler (ice_error_handler);
1319 IceAddConnectionWatch (ice_connection_watch, NULL((void*)0));
1320}
1321
1322static gboolean
1323process_ice_messages (IceConn ice_conn)
1324{
1325 IceProcessMessagesStatus status;
1326 status = IceProcessMessages (ice_conn, NULL((void*)0), NULL((void*)0));
1327
1328 switch (status)
1329 {
1330 case IceProcessMessagesSuccess:
1331 return TRUE(!(0));
1332
1333 case IceProcessMessagesIOError:
1334 sm_client_xsmp_disconnect (IceGetConnectionContext (ice_conn));
1335 return FALSE(0);
1336
1337 case IceProcessMessagesConnectionClosed:
1338 return FALSE(0);
1339
1340 default:
1341 g_assert_not_reached ()do { g_assertion_message_expr ("EggSMClient", "eggsmclient-xsmp.c"
, 1341, ((const char*) (__func__)), ((void*)0)); } while (0)
;
1342 }
1343}
1344
1345static gboolean
1346ice_iochannel_watch (GIOChannel *channel,
1347 GIOCondition condition,
1348 gpointer client_data)
1349{
1350 return process_ice_messages (client_data);
1351}
1352
1353static void
1354ice_connection_watch (IceConn ice_conn,
1355 IcePointer client_data,
1356 Boolint opening,
1357 IcePointer *watch_data)
1358{
1359 guint watch_id;
1360
1361 if (opening)
1362 {
1363 GIOChannel *channel;
1364 int fd = IceConnectionNumber (ice_conn);
1365
1366 fcntl (fd, F_SETFD2, fcntl (fd, F_GETFD1, 0) | FD_CLOEXEC1);
1367 channel = g_io_channel_unix_new (fd);
1368 watch_id = g_io_add_watch (channel, G_IO_IN | G_IO_ERR,
1369 ice_iochannel_watch, ice_conn);
1370 g_io_channel_unref (channel);
1371
1372 *watch_data = GUINT_TO_POINTER (watch_id)((gpointer) (gulong) (watch_id));
1373 }
1374 else
1375 {
1376 watch_id = GPOINTER_TO_UINT (*watch_data)((guint) (gulong) (*watch_data));
1377 g_source_remove (watch_id);
1378 }
1379}
1380
1381static void
1382ice_error_handler (IceConn ice_conn,
1383 Boolint swap,
1384 int offending_minor_opcode,
1385 unsigned long offending_sequence,
1386 int error_class,
1387 int severity,
1388 IcePointer values)
1389{
1390 /* Do nothing */
1391}
1392
1393static void
1394ice_io_error_handler (IceConn ice_conn)
1395{
1396 /* Do nothing */
1397}
1398
1399static void
1400smc_error_handler (SmcConn smc_conn,
1401 Boolint swap,
1402 int offending_minor_opcode,
1403 unsigned long offending_sequence,
1404 int error_class,
1405 int severity,
1406 SmPointer values)
1407{
1408 /* Do nothing */
1409}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-c21a0f.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-c21a0f.html new file mode 100644 index 0000000..1d6178d --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-c21a0f.html @@ -0,0 +1,2385 @@ + + + +terminal-profile.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:terminal-profile.c
Warning:line 1579, column 10
This statement is never executed
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name terminal-profile.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I .. -I ../src/mate-submodules/libegg -D TERMINAL_COMPILATION -D TERMINAL_RESOURCES_PATH_PREFIX="/org/mate/terminal" -D TERM_DATADIR="/usr/local/share" -D TERM_LOCALEDIR="/usr/local/share/locale" -D TERM_PKGDATADIR="/usr/local/share/mate-terminal" -D TERM_HELPDIR="/usr/local/share/help" -D SN_API_NOT_YET_FROZEN -D GDK_MULTIHEAD_SAFE -D G_DISABLE_SINGLE_INCLUDES -D PANGO_DISABLE_SINGLE_INCLUDES -D ATK_DISABLE_SINGLE_INCLUDES -D GDK_DISABLE_SINGLE_INCLUDES -D GDK_PIXBUF_DISABLE_SINGLE_INCLUDES -D GTK_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c terminal-profile.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright © 2001 Havoc Pennington
3 * Copyright © 2002 Mathias Hasselmann
4 * Copyright © 2008 Christian Persch
5 * Copyright (C) 2012-2021 MATE Developers
6 *
7 * Mate-terminal is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * Mate-terminal is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <config.h>
22
23#include <string.h>
24#include <stdlib.h>
25
26#include <gtk/gtk.h>
27
28#include "terminal-app.h"
29#include "terminal-debug.h"
30#include "terminal-intl.h"
31#include "terminal-profile.h"
32#include "terminal-screen.h"
33#include "terminal-type-builtins.h"
34
35/* To add a new key, you need to:
36 *
37 * - add an entry to the enum below
38 * - add a #define with its name in terminal-profile.h
39 * - add a gobject property for it in terminal_profile_class_init
40 * - if the property's type needs special casing, add that to
41 * terminal_profile_gsettings_notify_cb and
42 * terminal_profile_gsettings_changeset_add
43 * - if necessary the default value cannot be handled via the paramspec,
44 * handle that in terminal_profile_reset_property_internal
45 */
46enum
47{
48 PROP_0,
49 PROP_ALLOW_BOLD,
50 PROP_BACKGROUND_COLOR,
51 PROP_BACKGROUND_DARKNESS,
52 PROP_BACKGROUND_IMAGE,
53 PROP_BACKGROUND_IMAGE_FILE,
54 PROP_BACKGROUND_TYPE,
55 PROP_BACKSPACE_BINDING,
56 PROP_BOLD_COLOR,
57 PROP_BOLD_COLOR_SAME_AS_FG,
58 PROP_CURSOR_BLINK_MODE,
59 PROP_CURSOR_SHAPE,
60 PROP_CUSTOM_COMMAND,
61 PROP_DEFAULT_SIZE_COLUMNS,
62 PROP_DEFAULT_SIZE_ROWS,
63 PROP_DEFAULT_SHOW_MENUBAR,
64 PROP_DELETE_BINDING,
65 PROP_EXIT_ACTION,
66 PROP_FONT,
67 PROP_FOREGROUND_COLOR,
68 PROP_LOGIN_SHELL,
69 PROP_NAME,
70 PROP_PALETTE,
71 PROP_SCROLL_BACKGROUND,
72 PROP_SCROLLBACK_LINES,
73 PROP_SCROLLBACK_UNLIMITED,
74 PROP_SCROLLBAR_POSITION,
75 PROP_SCROLL_ON_KEYSTROKE,
76 PROP_SCROLL_ON_OUTPUT,
77 PROP_SILENT_BELL,
78 PROP_TITLE,
79 PROP_TITLE_MODE,
80 PROP_USE_CUSTOM_COMMAND,
81 PROP_USE_CUSTOM_DEFAULT_SIZE,
82 PROP_USE_SKEY,
83 PROP_USE_URLS,
84 PROP_USE_SYSTEM_FONT,
85 PROP_USE_THEME_COLORS,
86 PROP_VISIBLE_NAME,
87 PROP_WORD_CHARS,
88 PROP_COPY_SELECTION,
89 LAST_PROP
90};
91
92#define KEY_ALLOW_BOLD"allow-bold" "allow-bold"
93#define KEY_BACKGROUND_COLOR"background-color" "background-color"
94#define KEY_BACKGROUND_DARKNESS"background-darkness" "background-darkness"
95#define KEY_BACKGROUND_IMAGE_FILE"background-image" "background-image"
96#define KEY_BACKGROUND_TYPE"background-type" "background-type"
97#define KEY_BACKSPACE_BINDING"backspace-binding" "backspace-binding"
98#define KEY_BOLD_COLOR"bold-color" "bold-color"
99#define KEY_BOLD_COLOR_SAME_AS_FG"bold-color-same-as-fg" "bold-color-same-as-fg"
100#define KEY_CURSOR_BLINK_MODE"cursor-blink-mode" "cursor-blink-mode"
101#define KEY_CURSOR_SHAPE"cursor-shape" "cursor-shape"
102#define KEY_CUSTOM_COMMAND"custom-command" "custom-command"
103#define KEY_DEFAULT_SHOW_MENUBAR"default-show-menubar" "default-show-menubar"
104#define KEY_DEFAULT_SIZE_COLUMNS"default-size-columns" "default-size-columns"
105#define KEY_DEFAULT_SIZE_ROWS"default-size-rows" "default-size-rows"
106#define KEY_DELETE_BINDING"delete-binding" "delete-binding"
107#define KEY_EXIT_ACTION"exit-action" "exit-action"
108#define KEY_FONT"font" "font"
109#define KEY_FOREGROUND_COLOR"foreground-color" "foreground-color"
110#define KEY_LOGIN_SHELL"login-shell" "login-shell"
111#define KEY_PALETTE"palette" "palette"
112#define KEY_SCROLL_BACKGROUND"scroll-background" "scroll-background"
113#define KEY_SCROLLBACK_LINES"scrollback-lines" "scrollback-lines"
114#define KEY_SCROLLBACK_UNLIMITED"scrollback-unlimited" "scrollback-unlimited"
115#define KEY_SCROLLBAR_POSITION"scrollbar-position" "scrollbar-position"
116#define KEY_SCROLL_ON_KEYSTROKE"scroll-on-keystroke" "scroll-on-keystroke"
117#define KEY_SCROLL_ON_OUTPUT"scroll-on-output" "scroll-on-output"
118#define KEY_SILENT_BELL"silent-bell" "silent-bell"
119#define KEY_COPY_SELECTION"copy-selection" "copy-selection"
120#define KEY_TITLE_MODE"title-mode" "title-mode"
121#define KEY_TITLE"title" "title"
122#define KEY_USE_CUSTOM_COMMAND"use-custom-command" "use-custom-command"
123#define KEY_USE_CUSTOM_DEFAULT_SIZE"use-custom-default-size" "use-custom-default-size"
124#define KEY_USE_SKEY"use-skey" "use-skey"
125#define KEY_USE_URLS"use-urls" "use-urls"
126#define KEY_USE_SYSTEM_FONT"use-system-font" "use-system-font"
127#define KEY_USE_THEME_COLORS"use-theme-colors" "use-theme-colors"
128#define KEY_VISIBLE_NAME"visible-name" "visible-name"
129#define KEY_WORD_CHARS"word-chars" "word-chars"
130
131/* Keep these in sync with the GSettings schema! */
132#define DEFAULT_ALLOW_BOLD((!(0))) (TRUE(!(0)))
133#define DEFAULT_BACKGROUND_COLOR("#FFFFDD") ("#FFFFDD")
134#define DEFAULT_BOLD_COLOR_SAME_AS_FG((!(0))) (TRUE(!(0)))
135#define DEFAULT_BACKGROUND_DARKNESS(0.5) (0.5)
136#define DEFAULT_BACKGROUND_IMAGE_FILE("") ("")
137#define DEFAULT_BACKGROUND_TYPE(TERMINAL_BACKGROUND_SOLID) (TERMINAL_BACKGROUND_SOLID)
138#define DEFAULT_BACKSPACE_BINDING(VTE_ERASE_ASCII_DELETE) (VTE_ERASE_ASCII_DELETE)
139#define DEFAULT_CURSOR_BLINK_MODE(VTE_CURSOR_BLINK_SYSTEM) (VTE_CURSOR_BLINK_SYSTEM)
140#define DEFAULT_CURSOR_SHAPE(VTE_CURSOR_SHAPE_BLOCK) (VTE_CURSOR_SHAPE_BLOCK)
141#define DEFAULT_CUSTOM_COMMAND("") ("")
142#define DEFAULT_DEFAULT_SHOW_MENUBAR((!(0))) (TRUE(!(0)))
143#define DEFAULT_DEFAULT_SIZE_COLUMNS(80) (80)
144#define DEFAULT_DEFAULT_SIZE_ROWS(24) (24)
145#define DEFAULT_DELETE_BINDING(VTE_ERASE_DELETE_SEQUENCE) (VTE_ERASE_DELETE_SEQUENCE)
146#define DEFAULT_EXIT_ACTION(TERMINAL_EXIT_CLOSE) (TERMINAL_EXIT_CLOSE)
147#define DEFAULT_FONT("Monospace 12") ("Monospace 12")
148#define DEFAULT_FOREGROUND_COLOR("#000000") ("#000000")
149#define DEFAULT_LOGIN_SHELL((0)) (FALSE(0))
150#define DEFAULT_NAME(((void*)0)) (NULL((void*)0))
151#define DEFAULT_PALETTE(terminal_palettes[0]) (terminal_palettes[TERMINAL_PALETTE_TANGO0])
152#define DEFAULT_SCROLL_BACKGROUND((!(0))) (TRUE(!(0)))
153#define DEFAULT_SCROLLBACK_LINES(512) (512)
154#define DEFAULT_SCROLLBACK_UNLIMITED((0)) (FALSE(0))
155#define DEFAULT_SCROLLBAR_POSITION(TERMINAL_SCROLLBAR_RIGHT) (TERMINAL_SCROLLBAR_RIGHT)
156#define DEFAULT_SCROLL_ON_KEYSTROKE((!(0))) (TRUE(!(0)))
157#define DEFAULT_SCROLL_ON_OUTPUT((0)) (FALSE(0))
158#define DEFAULT_SILENT_BELL((0)) (FALSE(0))
159#define DEFAULT_COPY_SELECTION((0)) (FALSE(0))
160#define DEFAULT_TITLE_MODE(TERMINAL_TITLE_REPLACE) (TERMINAL_TITLE_REPLACE)
161#define DEFAULT_TITLE(("Terminal")) (N_("Terminal")("Terminal"))
162#define DEFAULT_USE_CUSTOM_COMMAND((0)) (FALSE(0))
163#define DEFAULT_USE_CUSTOM_DEFAULT_SIZE((0)) (FALSE(0))
164#define DEFAULT_USE_SKEY((!(0))) (TRUE(!(0)))
165#define DEFAULT_USE_URLS((!(0))) (TRUE(!(0)))
166#define DEFAULT_USE_SYSTEM_FONT((!(0))) (TRUE(!(0)))
167#define DEFAULT_USE_THEME_COLORS((!(0))) (TRUE(!(0)))
168#define DEFAULT_VISIBLE_NAME(("Unnamed")) (N_("Unnamed")("Unnamed"))
169#define DEFAULT_WORD_CHARS("-A-Za-z0-9,./?%&#:_=+@~") ("-A-Za-z0-9,./?%&#:_=+@~")
170
171struct _TerminalProfilePrivate
172{
173 GValueArray *properties;
174 gboolean *locked;
175
176 GSettings *settings;
177 char *profile_dir;
178
179 GSList *dirty_pspecs;
180 guint save_idle_id;
181
182 GParamSpec *gsettings_notification_pspec;
183
184 gboolean background_load_failed;
185
186 guint forgotten : 1;
187};
188
189static const GdkRGBA terminal_palettes[TERMINAL_PALETTE_N_BUILTINS5][TERMINAL_PALETTE_SIZE16] =
190{
191 /* Tango palette */
192 {
193 { 0, 0, 0, 1 },
194 { 0.8, 0, 0, 1 },
195 { 0.305882, 0.603922, 0.0235294, 1 },
196 { 0.768627, 0.627451, 0, 1 },
197 { 0.203922, 0.396078, 0.643137, 1 },
198 { 0.458824, 0.313725, 0.482353, 1 },
199 { 0.0235294, 0.596078, 0.603922, 1 },
200 { 0.827451, 0.843137, 0.811765, 1 },
201 { 0.333333, 0.341176, 0.32549, 1 },
202 { 0.937255, 0.160784, 0.160784, 1 },
203 { 0.541176, 0.886275, 0.203922, 1 },
204 { 0.988235, 0.913725, 0.309804, 1 },
205 { 0.447059, 0.623529, 0.811765, 1 },
206 { 0.678431, 0.498039, 0.658824, 1 },
207 { 0.203922, 0.886275, 0.886275, 1 },
208 { 0.933333, 0.933333, 0.92549, 1 },
209 },
210
211 /* Linux palette */
212 {
213 { 0, 0, 0, 1 },
214 { 0.666667, 0, 0, 1 },
215 { 0, 0.666667, 0, 1 },
216 { 0.666667, 0.333333, 0, 1 },
217 { 0, 0, 0.666667, 1 },
218 { 0.666667, 0, 0.666667, 1 },
219 { 0, 0.666667, 0.666667, 1 },
220 { 0.666667, 0.666667, 0.666667, 1 },
221 { 0.333333, 0.333333, 0.333333, 1 },
222 { 1, 0.333333, 0.333333, 1 },
223 { 0.333333, 1, 0.333333, 1 },
224 { 1, 1, 0.333333, 1 },
225 { 0.333333, 0.333333, 1, 1 },
226 { 1, 0.333333, 1, 1 },
227 { 0.333333, 1, 1, 1 },
228 { 1, 1, 1, 1 },
229 },
230
231 /* XTerm palette */
232 {
233 { 0, 0, 0, 1 },
234 { 0.803922, 0, 0, 1 },
235 { 0, 0.803922, 0, 1 },
236 { 0.803922, 0.803922, 0, 1 },
237 { 0.117647, 0.564706, 1, 1 },
238 { 0.803922, 0, 0.803922, 1 },
239 { 0, 0.803922, 0.803922, 1 },
240 { 0.898039, 0.898039, 0.898039, 1 },
241 { 0.298039, 0.298039, 0.298039, 1 },
242 { 1, 0, 0, 1 },
243 { 0, 1, 0, 1 },
244 { 1, 1, 0, 1 },
245 { 0.27451, 0.509804, 0.705882, 1 },
246 { 1, 0, 1, 1 },
247 { 0, 1, 1, 1 },
248 { 1, 1, 1, 1 },
249 },
250
251 /* RXVT palette */
252 {
253 { 0, 0, 0, 1 },
254 { 0.803922, 0, 0, 1 },
255 { 0, 0.803922, 0, 1 },
256 { 0.803922, 0.803922, 0, 1 },
257 { 0, 0, 0.803922, 1 },
258 { 0.803922, 0, 0.803922, 1 },
259 { 0, 0.803922, 0.803922, 1 },
260 { 0.980392, 0.921569, 0.843137, 1 },
261 { 0.25098, 0.25098, 0.25098, 1 },
262 { 1, 0, 0, 1 },
263 { 0, 1, 0, 1 },
264 { 1, 1, 0, 1 },
265 { 0, 0, 1, 1 },
266 { 1, 0, 1, 1 },
267 { 0, 1, 1, 1 },
268 { 1, 1, 1, 1 },
269 },
270
271 /* Solarized palette (1.0.0beta2): http://ethanschoonover.com/solarized */
272 {
273 { 0.02745, 0.211764, 0.258823, 1 },
274 { 0.862745, 0.196078, 0.184313, 1 },
275 { 0.521568, 0.6, 0, 1 },
276 { 0.709803, 0.537254, 0, 1 },
277 { 0.149019, 0.545098, 0.823529, 1 },
278 { 0.82745, 0.211764, 0.509803, 1 },
279 { 0.164705, 0.631372, 0.596078, 1 },
280 { 0.933333, 0.909803, 0.835294, 1 },
281 { 0, 0.168627, 0.211764, 1 },
282 { 0.796078, 0.294117, 0.086274, 1 },
283 { 0.345098, 0.431372, 0.458823, 1 },
284 { 0.396078, 0.482352, 0.513725, 1 },
285 { 0.513725, 0.580392, 0.588235, 1 },
286 { 0.423529, 0.443137, 0.768627, 1 },
287 { 0.57647, 0.631372, 0.631372, 1 },
288 { 0.992156, 0.964705, 0.890196, 1 },
289 },
290};
291
292enum
293{
294 FORGOTTEN,
295 LAST_SIGNAL
296};
297
298static void terminal_profile_finalize (GObject *object);
299static void terminal_profile_set_property (GObject *object,
300 guint prop_id,
301 const GValue *value,
302 GParamSpec *pspec);
303static void ensure_pixbuf_property (TerminalProfile *profile,
304 guint path_prop_id,
305 guint pixbuf_prop_id,
306 gboolean *load_failed);
307
308static guint signals[LAST_SIGNAL] = { 0 };
309static GQuark gsettings_key_quark;
310
311G_DEFINE_TYPE_WITH_PRIVATE (TerminalProfile, terminal_profile, G_TYPE_OBJECT)static void terminal_profile_init (TerminalProfile *self); static
void terminal_profile_class_init (TerminalProfileClass *klass
); static GType terminal_profile_get_type_once (void); static
gpointer terminal_profile_parent_class = ((void*)0); static gint
TerminalProfile_private_offset; static void terminal_profile_class_intern_init
(gpointer klass) { terminal_profile_parent_class = g_type_class_peek_parent
(klass); if (TerminalProfile_private_offset != 0) g_type_class_adjust_private_offset
(klass, &TerminalProfile_private_offset); terminal_profile_class_init
((TerminalProfileClass*) klass); } __attribute__ ((__unused__
)) static inline gpointer terminal_profile_get_instance_private
(TerminalProfile *self) { return (((gpointer) ((guint8*) (self
) + (glong) (TerminalProfile_private_offset)))); } GType terminal_profile_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ _Static_assert (sizeof *(&static_g_define_type_id) ==
sizeof (gpointer), "Expression evaluates to false"); (void) (
0 ? (gpointer) *(&static_g_define_type_id) : ((void*)0));
(!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = terminal_profile_get_type_once
(); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } __attribute__ ((__noinline__)) static GType terminal_profile_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
(((GType) ((20) << (2))), g_intern_static_string ("TerminalProfile"
), sizeof (TerminalProfileClass), (GClassInitFunc)(void (*)(void
)) terminal_profile_class_intern_init, sizeof (TerminalProfile
), (GInstanceInitFunc)(void (*)(void)) terminal_profile_init,
(GTypeFlags) 0); { {{ TerminalProfile_private_offset = g_type_add_instance_private
(g_define_type_id, sizeof (TerminalProfilePrivate)); };} } return
g_define_type_id; }
;
312
313/* gdk_rgba_equal is too strict! */
314static gboolean
315rgba_equal (const GdkRGBA *a,
316 const GdkRGBA *b)
317{
318 gdouble dr, dg, db, da;
319
320 dr = a->red - b->red;
321 dg = a->green - b->green;
322 db = a->blue - b->blue;
323 da = a->alpha - b->alpha;
324
325 return (dr * dr + dg * dg + db * db + da * da) < 1e-4;
326}
327
328static gboolean
329palette_cmp (const GdkRGBA *ca,
330 const GdkRGBA *cb)
331{
332 guint i;
333
334 for (i = 0; i < TERMINAL_PALETTE_SIZE16; ++i)
335 if (!rgba_equal (&ca[i], &cb[i]))
336 return FALSE(0);
337
338 return TRUE(!(0));
339}
340
341static GParamSpec *
342get_pspec_from_name (TerminalProfile *profile,
343 const char *prop_name)
344{
345 TerminalProfileClass *klass = TERMINAL_PROFILE_GET_CLASS (profile)((((TerminalProfileClass*) (((GTypeInstance*) ((profile)))->
g_class))))
;
346 GParamSpec *pspec;
347
348 pspec = g_object_class_find_property (G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
, prop_name);
349 if (pspec &&
350 pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
351 pspec = NULL((void*)0);
352
353 return pspec;
354}
355
356static const GValue *
357get_prop_value_from_prop_name (TerminalProfile *profile,
358 const char *prop_name)
359{
360 TerminalProfilePrivate *priv = profile->priv;
361 GParamSpec *pspec;
362
363 pspec = get_pspec_from_name (profile, prop_name);
364 if (!pspec)
365 return NULL((void*)0);
366
367 if (G_UNLIKELY (pspec->param_id == PROP_BACKGROUND_IMAGE)(pspec->param_id == PROP_BACKGROUND_IMAGE))
368 ensure_pixbuf_property (profile, PROP_BACKGROUND_IMAGE_FILE, PROP_BACKGROUND_IMAGE, &priv->background_load_failed);
369
370 return g_value_array_get_nth (priv->properties, pspec->param_id);
371}
372
373static void
374set_value_from_palette (GValue *ret_value,
375 const GdkRGBA *colors,
376 guint n_colors)
377{
378 GValueArray *array;
379 guint i, max_n_colors;
380
381 max_n_colors = MAX (n_colors, TERMINAL_PALETTE_SIZE)(((n_colors) > (16)) ? (n_colors) : (16));
382 array = g_value_array_new (max_n_colors);
383 for (i = 0; i < max_n_colors; ++i)
384 g_value_array_append (array, NULL((void*)0));
385
386 for (i = 0; i < n_colors; ++i)
387 {
388 GValue *value = g_value_array_get_nth (array, i);
389
390 g_value_init (value, GDK_TYPE_RGBA(gdk_rgba_get_type ()));
391 g_value_set_boxed (value, &colors[i]);
392 }
393
394 /* If we haven't enough colours yet, fill up with the default palette */
395 for (i = n_colors; i < TERMINAL_PALETTE_SIZE16; ++i)
396 {
397 GValue *value = g_value_array_get_nth (array, i);
398
399 g_value_init (value, GDK_TYPE_RGBA(gdk_rgba_get_type ()));
400 g_value_set_boxed (value, &DEFAULT_PALETTE(terminal_palettes[0])[i]);
401 }
402
403 g_value_take_boxed (ret_value, array);
404}
405
406static int
407values_equal (GParamSpec *pspec,
408 const GValue *va,
409 const GValue *vb)
410{
411 /* g_param_values_cmp isn't good enough for some types, since e.g.
412 * it compares colours and font descriptions by pointer value, not
413 * with the correct compare functions. Providing extra
414 * PangoParamSpecFontDescription and GdkParamSpecColor wouldn't
415 * have fixed this either, since it's unclear how to _order_ them.
416 * Luckily we only need to check them for equality here.
417 */
418
419 if (g_param_values_cmp (pspec, va, vb) == 0)
420 return TRUE(!(0));
421
422 if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
423 return rgba_equal (g_value_get_boxed (va), g_value_get_boxed (vb));
424
425 if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
426 return pango_font_description_equal (g_value_get_boxed (va), g_value_get_boxed (vb));
427
428 if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
429 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
430 {
431 GValueArray *ara, *arb;
432 guint i;
433
434 ara = g_value_get_boxed (va);
435 arb = g_value_get_boxed (vb);
436
437 if (!ara || !arb || ara->n_values != arb->n_values)
438 return FALSE(0);
439
440 for (i = 0; i < ara->n_values; ++i)
441 if (!rgba_equal (g_value_get_boxed (g_value_array_get_nth (ara, i)),
442 g_value_get_boxed (g_value_array_get_nth (arb, i))))
443 return FALSE(0);
444
445 return TRUE(!(0));
446 }
447
448 return FALSE(0);
449}
450
451static void
452ensure_pixbuf_property (TerminalProfile *profile,
453 guint path_prop_id,
454 guint pixbuf_prop_id,
455 gboolean *load_failed)
456{
457 TerminalProfilePrivate *priv = profile->priv;
458 GValue *path_value, *pixbuf_value;
459 GdkPixbuf *pixbuf;
460 const char *path_utf8;
461 char *path;
462 GError *error = NULL((void*)0);
463
464 pixbuf_value = g_value_array_get_nth (priv->properties, pixbuf_prop_id);
465
466 pixbuf = g_value_get_object (pixbuf_value);
467 if (pixbuf)
468 return;
469
470 if (*load_failed)
471 return;
472
473 path_value = g_value_array_get_nth (priv->properties, path_prop_id);
474 path_utf8 = g_value_get_string (path_value);
475 if (!path_utf8 || !path_utf8[0])
476 goto failed;
477
478 path = g_filename_from_utf8 (path_utf8, -1, NULL((void*)0), NULL((void*)0), NULL((void*)0));
479 if (!path)
480 goto failed;
481
482 pixbuf = gdk_pixbuf_new_from_file (path, &error);
483 if (!pixbuf)
484 {
485 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
486 "Failed to load image \"%s\": %s\n",do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
487 path, error->message)do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
;
488
489 g_error_free (error);
490 g_free (path);
491 goto failed;
492 }
493
494 g_value_take_object (pixbuf_value, pixbuf);
495 g_free (path);
496 return;
497
498failed:
499 *load_failed = TRUE(!(0));
500}
501
502static void
503terminal_profile_reset_property_internal (TerminalProfile *profile,
504 GParamSpec *pspec,
505 gboolean notify)
506{
507 TerminalProfilePrivate *priv = profile->priv;
508 GValue value_ = { 0, };
509 GValue *value;
510
511 if (notify)
512 {
513 value = &value_;
514 g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
515 }
516 else
517 value = g_value_array_get_nth (priv->properties, pspec->param_id);
518 g_assert (value != NULL)do { if (value != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 518, ((const char*) (__func__
)), "value != NULL"); } while (0)
;
519
520 /* A few properties don't have defaults via the param spec; set them explicitly */
521 switch (pspec->param_id)
522 {
523 case PROP_FOREGROUND_COLOR:
524 case PROP_BOLD_COLOR:
525 {
526 GdkRGBA color;
527
528 if (!gdk_rgba_parse (&color, DEFAULT_FOREGROUND_COLOR("#000000")))
529 return;
530 color.alpha = 1.0;
531 g_value_set_boxed (value, &color);
532 break;
533 }
534 case PROP_BACKGROUND_COLOR:
535 {
536 GdkRGBA color;
537
538 if (!gdk_rgba_parse (&color, DEFAULT_BACKGROUND_COLOR("#FFFFDD")))
539 return;
540 color.alpha = 1.0;
541 g_value_set_boxed (value, &color);
542 break;
543 }
544 case PROP_FONT:
545 g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_FONT("Monospace 12")));
546 break;
547
548 case PROP_PALETTE:
549 set_value_from_palette (value, DEFAULT_PALETTE(terminal_palettes[0]), TERMINAL_PALETTE_SIZE16);
550 break;
551
552 default:
553 g_param_value_set_default (pspec, value);
554 break;
555 }
556
557 if (notify)
558 {
559 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, pspec->name, value);
560 g_value_unset (value);
561 }
562}
563
564static void
565terminal_profile_gsettings_notify_cb (GSettings *settings,
566 gchar *key,
567 gpointer user_data)
568{
569 TerminalProfile *profile = TERMINAL_PROFILE (user_data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_profile_get_type ()))))))
;
570 TerminalProfilePrivate *priv = profile->priv;
571 TerminalProfileClass *klass;
572 GVariant *settings_value;
573 GParamSpec *pspec;
574 GValue value = { 0, };
575 gboolean equal;
576 gboolean force_set = FALSE(0);
577
578 if (!key) return;
579
580 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
581 "GSettings notification for key %s [%s]\n",do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
582 key,do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
583 g_settings_is_writable (settings, key) ? "writable" : "LOCKED")do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
;
584
585 klass = TERMINAL_PROFILE_GET_CLASS (profile)((((TerminalProfileClass*) (((GTypeInstance*) ((profile)))->
g_class))))
;
586 pspec = g_hash_table_lookup (klass->gsettings_keys, key);
587 if (!pspec)
588 return; /* ignore unknown keys, for future extensibility */
589
590 priv->locked[pspec->param_id] = !g_settings_is_writable (settings, key);
591
592 settings_value = g_settings_get_value (settings, key);
593 if (!settings_value)
594 return;
595
596 g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
597
598 if (G_IS_PARAM_SPEC_BOOLEAN (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[2])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
599 {
600 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_BOOLEAN((const GVariantType *) "b")))
601 goto out;
602
603 g_value_set_boolean (&value, g_variant_get_boolean (settings_value));
604 }
605 else if (G_IS_PARAM_SPEC_STRING (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[14])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
606 {
607 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
608 goto out;
609
610 g_value_set_string (&value, g_variant_get_string (settings_value, NULL((void*)0)));
611 }
612 else if (G_IS_PARAM_SPEC_ENUM (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[10])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
613 {
614
615 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
616 goto out;
617
618 g_value_set_enum (&value, g_settings_get_enum (settings, key));
619 }
620 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
621 {
622 GdkRGBA color;
623
624 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
625 goto out;
626
627 if (!gdk_rgba_parse (&color, g_variant_get_string (settings_value, NULL((void*)0))))
628 goto out;
629
630 g_value_set_boxed (&value, &color);
631 }
632 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
633 {
634 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
635 goto out;
636
637 g_value_take_boxed (&value, pango_font_description_from_string (g_variant_get_string (settings_value, NULL((void*)0))));
638 }
639 else if (G_IS_PARAM_SPEC_DOUBLE (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[13])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
640 {
641 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_DOUBLE((const GVariantType *) "d")))
642 goto out;
643
644 g_value_set_double (&value, g_variant_get_double (settings_value));
645 }
646 else if (G_IS_PARAM_SPEC_INT (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[3])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
647 {
648 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT16((const GVariantType *) "n")) &&
649 !g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT32((const GVariantType *) "i")) &&
650 !g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT64((const GVariantType *) "x")))
651 goto out;
652
653 g_value_set_int (&value, g_settings_get_int(settings, key));
654 }
655 else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
656 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
657 {
658 char **color_strings;
659 GdkRGBA *colors;
660 int n_colors, i;
661
662 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
663 goto out;
664
665 color_strings = g_strsplit (g_variant_get_string (settings_value, NULL((void*)0)), ":", -1);
666 if (!color_strings)
667 goto out;
668
669 n_colors = g_strv_length (color_strings);
670 colors = g_new0 (GdkRGBA, n_colors)((GdkRGBA *) g_malloc0_n ((n_colors), sizeof (GdkRGBA)));
671 for (i = 0; i < n_colors; ++i)
672 {
673 if (!gdk_rgba_parse (&colors[i], color_strings[i]))
674 continue; /* ignore errors */
675 }
676 g_strfreev (color_strings);
677
678 /* We continue even with a palette size != TERMINAL_PALETTE_SIZE,
679 * so we can change the palette size in future versions without
680 * causing too many issues.
681 */
682 set_value_from_palette (&value, colors, n_colors);
683 g_free (colors);
684 }
685 else
686 {
687 g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
), pspec->name);
688 goto out;
689 }
690
691 if (g_param_value_validate (pspec, &value))
692 {
693 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
694 "Invalid value in GSettings for key %s was changed to comply with pspec %s\n",do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
695 key, pspec->name)do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
;
696
697 force_set = TRUE(!(0));
698 }
699
700 /* Only set the property if the value is different than our current value,
701 * so we don't go into an infinite loop.
702 */
703 equal = values_equal (pspec, &value, g_value_array_get_nth (priv->properties, pspec->param_id));
704#ifdef MATE_ENABLE_DEBUG
705 _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_PROFILE)if (0)
706 {
707 if (!equal)
708 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("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)); } while (0)
709 "Setting property %s to a different value\n"do { if (0) g_printerr("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)); } while (0)
710 " now: %s\n"do { if (0) g_printerr("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)); } while (0)
711 " new: %s\n",do { if (0) g_printerr("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)); } while (0)
712 pspec->name,do { if (0) g_printerr("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)); } while (0)
713 g_strdup_value_contents (g_value_array_get_nth (priv->properties, pspec->param_id)),do { if (0) g_printerr("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)); } while (0)
714 g_strdup_value_contents (&value))do { if (0) g_printerr("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)); } while (0)
;
715 }
716#endif
717
718 if (!equal || force_set)
719 {
720 priv->gsettings_notification_pspec = pspec;
721 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, pspec->name, &value);
722 priv->gsettings_notification_pspec = NULL((void*)0);
723 }
724
725out:
726 /* FIXME: if we arrive here through goto in the error cases,
727 * should we maybe reset the property to its default value?
728 */
729
730 g_value_unset (&value);
731 g_variant_unref (settings_value);
732}
733
734static void
735terminal_profile_gsettings_changeset_add (TerminalProfile *profile,
736 GSettings *changeset,
737 GParamSpec *pspec)
738{
739 TerminalProfilePrivate *priv = profile->priv;
740 char *key;
741 const GValue *value;
742
743 /* FIXME: do this? */
744#if 0
745 if (priv->locked[pspec->param_id])
746 return;
747
748 if (!g_settings_is_writable (priv->settings, gsettings_key, NULL((void*)0)))
749 return;
750#endif
751
752 key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
753 if (!key)
754 return;
755
756 value = g_value_array_get_nth (priv->properties, pspec->param_id);
757
758 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
759 "Adding pspec %s with value %s to the GSettings changeset\n",do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
760 pspec->name, g_strdup_value_contents (value))do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
;
761
762 if (G_IS_PARAM_SPEC_BOOLEAN (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[2])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
763 g_settings_set_boolean (changeset, key, g_value_get_boolean (value));
764 else if (G_IS_PARAM_SPEC_STRING (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[14])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
765 {
766 const char *str;
767
768 str = g_value_get_string (value);
769 g_settings_set_string (changeset, key, str ? str : "");
770 }
771 else if (G_IS_PARAM_SPEC_ENUM (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[10])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
772 {
773 const GEnumValue *eval;
774
775 eval = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)((((GParamSpecEnum*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), ((g_param_spec_types[10]))))))
->enum_class, g_value_get_enum (value));
776
777 g_settings_set_enum (changeset, key, eval->value);
778 }
779 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
780 {
781 GdkRGBA *color;
782 char str[16];
783
784 color = g_value_get_boxed (value);
785 if (!color)
786 goto cleanup;
787
788 g_snprintf (str, sizeof (str),
789 "#%04X%04X%04X",
790 (guint) (color->red * 65535),
791 (guint) (color->green * 65535),
792 (guint) (color->blue * 65535));
793
794 g_settings_set_string (changeset, key, str);
795 }
796 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
797 {
798 PangoFontDescription *font_desc;
799 char *font;
800
801 font_desc = g_value_get_boxed (value);
802 if (!font_desc)
803 goto cleanup;
804
805 font = pango_font_description_to_string (font_desc);
806 g_settings_set_string (changeset, key, font);
807 g_free (font);
808 }
809 else if (G_IS_PARAM_SPEC_DOUBLE (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[13])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
810 g_settings_set_double (changeset, key, g_value_get_double (value));
811 else if (G_IS_PARAM_SPEC_INT (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[3])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
812 g_settings_set_int (changeset, key, g_value_get_int (value));
813 else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
814 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
815 {
816 GValueArray *array;
817 GString *string;
818 guint n_colors, i;
819
820 /* We need to do this ourselves, because the gtk_color_selection_palette_to_string
821 * does not carry all the bytes, and xterm's palette is messed up...
822 */
823
824 array = g_value_get_boxed (value);
825 if (!array)
826 goto cleanup;
827
828 n_colors = array->n_values;
829 string = g_string_sized_new (n_colors * (1 /* # */ + 3 * 4) + n_colors /* : separators and terminating \0 */);
830 for (i = 0; i < n_colors; ++i)
831 {
832 GdkRGBA *color;
833
834 if (i > 0)
835 g_string_append_c (string, ':')g_string_append_c_inline (string, ':');
836
837 color = g_value_get_boxed (g_value_array_get_nth (array, i));
838 if (!color)
839 continue;
840
841 g_string_append_printf (string,
842 "#%04X%04X%04X",
843 (guint) (color->red * 65535),
844 (guint) (color->green * 65535),
845 (guint) (color->blue * 65535));
846 }
847
848 g_settings_set_string (changeset, key, string->str);
849 g_string_free (string, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) (
(string), ((!(0)))) : g_string_free_and_steal (string)) : (g_string_free
) ((string), ((!(0)))))
;
850 }
851 else
852 g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
), pspec->name);
853
854cleanup:
855 return;
856}
857
858static void
859terminal_profile_save (TerminalProfile *profile)
860{
861 TerminalProfilePrivate *priv = profile->priv;
862 GSettings *changeset;
863 GSList *l;
864 gchar *concat;
865
866 priv->save_idle_id = 0;
867 concat = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", priv->profile_dir,"/", NULL((void*)0));
868 changeset = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
869 g_free (concat);
870 g_settings_delay (changeset);
871
872 for (l = priv->dirty_pspecs; l != NULL((void*)0); l = l->next)
873 {
874 GParamSpec *pspec = (GParamSpec *) l->data;
875
876 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
877 continue;
878
879 if ((pspec->flags & G_PARAM_WRITABLE) == 0)
880 continue;
881
882 terminal_profile_gsettings_changeset_add (profile, changeset, pspec);
883 }
884
885 g_slist_free (priv->dirty_pspecs);
886 priv->dirty_pspecs = NULL((void*)0);
887
888 g_settings_apply (changeset);
889 g_object_unref (changeset);
890}
891
892static gboolean
893terminal_profile_save_idle_cb (TerminalProfile *profile)
894{
895 terminal_profile_save (profile);
896
897 /* don't run again */
898 return FALSE(0);
899}
900
901static void
902terminal_profile_schedule_save (TerminalProfile *profile,
903 GParamSpec *pspec)
904{
905 TerminalProfilePrivate *priv = profile->priv;
906
907 g_assert (pspec != NULL)do { if (pspec != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 907, ((const char*) (__func__
)), "pspec != NULL"); } while (0)
;
908
909 if (!g_slist_find (priv->dirty_pspecs, pspec))
910 priv->dirty_pspecs = g_slist_prepend (priv->dirty_pspecs, pspec);
911
912 if (priv->save_idle_id != 0)
913 return;
914
915 priv->save_idle_id = g_idle_add ((GSourceFunc) terminal_profile_save_idle_cb, profile);
916}
917
918static void
919terminal_profile_init (TerminalProfile *profile)
920{
921 TerminalProfilePrivate *priv;
922 GObjectClass *object_class;
923 GParamSpec **pspecs;
924 guint n_pspecs, i;
925
926 priv = profile->priv = terminal_profile_get_instance_private (profile);
927
928 priv->gsettings_notification_pspec = NULL((void*)0);
929 priv->locked = g_new0 (gboolean, LAST_PROP)((gboolean *) g_malloc0_n ((LAST_PROP), sizeof (gboolean)));
930
931 priv->properties = g_value_array_new (LAST_PROP);
932 for (i = 0; i < LAST_PROP; ++i)
933 g_value_array_append (priv->properties, NULL((void*)0));
934
935 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
936 for (i = 0; i < n_pspecs; ++i)
937 {
938 GParamSpec *pspec = pspecs[i];
939 GValue *value;
940
941 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
942 continue;
943
944 g_assert (pspec->param_id < LAST_PROP)do { if (pspec->param_id < LAST_PROP) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 944, ((const char*) (__func__
)), "pspec->param_id < LAST_PROP"); } while (0)
;
945 value = g_value_array_get_nth (priv->properties, pspec->param_id);
946 g_value_init (value, pspec->value_type);
947 g_param_value_set_default (pspec, value);
948 }
949
950 g_free (pspecs);
951
952 /* A few properties don't have defaults via the param spec; set them explicitly */
953 object_class = G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
;
954 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_FOREGROUND_COLOR"foreground-color"), FALSE(0));
955 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_BOLD_COLOR"bold-color"), FALSE(0));
956 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_BACKGROUND_COLOR"background-color"), FALSE(0));
957 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_FONT"font"), FALSE(0));
958 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_PALETTE"palette"), FALSE(0));
959}
960
961static GObject *
962terminal_profile_constructor (GType type,
963 guint n_construct_properties,
964 GObjectConstructParam *construct_params)
965{
966 GObject *object;
967 TerminalProfile *profile;
968 TerminalProfilePrivate *priv;
969 const char *name;
970 GParamSpec **pspecs;
971 guint n_pspecs, i;
972 gchar *concat;
973
974 object = G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->constructor
975 (type, n_construct_properties, construct_params);
976
977 profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
978 priv = profile->priv;
979
980 name = g_value_get_string (g_value_array_get_nth (priv->properties, PROP_NAME));
981 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-profile.c", 981, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
982
983 concat = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", name, "/", NULL((void*)0));
984 priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
985 g_assert (priv->settings != NULL)do { if (priv->settings != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 985, ((const char*) (__func__
)), "priv->settings != NULL"); } while (0)
;
986 g_free (concat);
987 concat = g_strconcat("changed::", priv->profile_dir, "/", NULL((void*)0));
988 g_signal_connect (priv->settings,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
989 concat,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
990 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
991 profile)g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
;
992
993 g_free (concat);
994
995 /* Now load those properties from GSettings that were not set as construction params */
996 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
997 for (i = 0; i < n_pspecs; ++i)
998 {
999 GParamSpec *pspec = pspecs[i];
1000 guint j;
1001 gboolean is_construct = FALSE(0);
1002 char *key;
1003
1004 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
1005 continue;
1006
1007 if ((pspec->flags & G_PARAM_WRITABLE) == 0 ||
1008 (pspec->flags & G_PARAM_CONSTRUCT_ONLY) != 0)
1009 continue;
1010
1011 for (j = 0; j < n_construct_properties; ++j)
1012 if (pspec == construct_params[j].pspec)
1013 {
1014 is_construct = TRUE(!(0));
1015 break;
1016 }
1017
1018 if (is_construct)
1019 continue;
1020
1021 key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
1022 if (!key)
1023 continue;
1024
1025 terminal_profile_gsettings_notify_cb (priv->settings, key, profile);
1026 }
1027
1028 g_free (pspecs);
1029
1030 return object;
1031}
1032
1033static void
1034terminal_profile_finalize (GObject *object)
1035{
1036 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1037 TerminalProfilePrivate *priv = profile->priv;
1038
1039 g_signal_handlers_disconnect_by_func (priv->settings,g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1040 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1041 profile)g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
;
1042
1043 if (priv->save_idle_id)
1044 {
1045 g_source_remove (priv->save_idle_id);
1046
1047 /* Save now */
1048 terminal_profile_save (profile);
1049 }
1050
1051 _terminal_profile_forget (profile);
1052
1053 g_object_unref (priv->settings);
1054
1055 g_free (priv->profile_dir);
1056 g_free (priv->locked);
1057 g_value_array_free (priv->properties);
1058
1059 G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->finalize (object);
1060}
1061
1062static void
1063terminal_profile_get_property (GObject *object,
1064 guint prop_id,
1065 GValue *value,
1066 GParamSpec *pspec)
1067{
1068 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1069 TerminalProfilePrivate *priv = profile->priv;
1070
1071 if (prop_id == 0 || prop_id >= LAST_PROP)
1072 {
1073 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-profile.c", 1073, ("property"), _glib__property_id
, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance
*) (_glib__pspec))->g_class))->g_type)))), (g_type_name
((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1074 return;
1075 }
1076
1077 /* Note: When adding things here, do the same in get_prop_value_from_prop_name! */
1078 switch (prop_id)
1079 {
1080 case PROP_BACKGROUND_IMAGE:
1081 ensure_pixbuf_property (profile, PROP_BACKGROUND_IMAGE_FILE, PROP_BACKGROUND_IMAGE, &priv->background_load_failed);
1082 break;
1083 default:
1084 break;
1085 }
1086
1087 g_value_copy (g_value_array_get_nth (priv->properties, prop_id), value);
1088}
1089
1090static void
1091terminal_profile_set_property (GObject *object,
1092 guint prop_id,
1093 const GValue *value,
1094 GParamSpec *pspec)
1095{
1096 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1097 TerminalProfilePrivate *priv = profile->priv;
1098 GValue *prop_value;
1099
1100 if (prop_id == 0 || prop_id >= LAST_PROP)
1101 {
1102 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-profile.c", 1102, ("property"), _glib__property_id
, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance
*) (_glib__pspec))->g_class))->g_type)))), (g_type_name
((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1103 return;
1104 }
1105
1106 prop_value = g_value_array_get_nth (priv->properties, prop_id);
1107
1108 /* Preprocessing */
1109 switch (prop_id)
1110 {
1111#if 0
1112 case PROP_FONT:
1113 {
1114 PangoFontDescription *font_desc, *new_font_desc;
1115
1116 font_desc = g_value_get_boxed (prop_value);
1117 new_font_desc = g_value_get_boxed (value);
1118
1119 if (font_desc && new_font_desc)
1120 {
1121 /* Merge in case the new string isn't complete enough to load a font */
1122 pango_font_description_merge (font_desc, new_font_desc, TRUE(!(0)));
1123 pango_font_description_free (new_font_desc);
1124 break;
1125 }
1126
1127 /* fall-through */
1128 }
1129#endif
1130 default:
1131 g_value_copy (value, prop_value);
1132 break;
1133 }
1134
1135 /* Postprocessing */
1136 switch (prop_id)
1137 {
1138 case PROP_NAME:
1139 {
1140 const char *name = g_value_get_string (value);
1141
1142 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-profile.c", 1142, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
1143 priv->profile_dir = g_strdup (name)g_strdup_inline (name);
1144 if (priv->settings != NULL((void*)0)) {
1145 gchar *concat;
1146 g_signal_handlers_disconnect_by_func (priv->settings,g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1147 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1148 profile)g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
;
1149 g_object_unref (priv->settings);
1150 concat= g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", priv->profile_dir, "/", NULL((void*)0));
1151 priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
1152 g_free (concat);
1153 concat = g_strconcat("changed::", priv->profile_dir, "/", NULL((void*)0));
1154 g_signal_connect (priv->settings,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1155 concat,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1156 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1157 profile)g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
;
1158 g_free (concat);
1159 }
1160 break;
1161 }
1162
1163 case PROP_BACKGROUND_IMAGE_FILE:
1164 /* Clear the cached image */
1165 g_value_set_object (g_value_array_get_nth (priv->properties, PROP_BACKGROUND_IMAGE), NULL((void*)0));
1166 priv->background_load_failed = FALSE(0);
1167 g_object_notify (object, TERMINAL_PROFILE_BACKGROUND_IMAGE"background-image");
1168 break;
1169
1170 default:
1171 break;
1172 }
1173}
1174
1175static void
1176terminal_profile_notify (GObject *object,
1177 GParamSpec *pspec)
1178{
1179 TerminalProfilePrivate *priv = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
->priv;
1180 void (* notify) (GObject *, GParamSpec *) = G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->notify;
1181
1182 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
1183 "Property notification for prop %s\n",do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
1184 pspec->name)do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
;
1185
1186 if (notify)
1187 notify (object, pspec);
1188
1189 if (pspec->owner_type == TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) &&
1190 (pspec->flags & G_PARAM_WRITABLE) &&
1191 g_param_spec_get_qdata (pspec, gsettings_key_quark) != NULL((void*)0) &&
1192 pspec != priv->gsettings_notification_pspec)
1193 terminal_profile_schedule_save (TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
, pspec);
1194}
1195
1196static void
1197terminal_profile_class_init (TerminalProfileClass *klass)
1198{
1199 GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
;
1200
1201 gsettings_key_quark = g_quark_from_static_string ("GT::GSettingsKey");
1202
1203 object_class->constructor = terminal_profile_constructor;
1204 object_class->finalize = terminal_profile_finalize;
1205 object_class->get_property = terminal_profile_get_property;
1206 object_class->set_property = terminal_profile_set_property;
1207 object_class->notify = terminal_profile_notify;
1208
1209 signals[FORGOTTEN] =
1210 g_signal_new ("forgotten",
1211 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1212 G_SIGNAL_RUN_LAST,
1213 G_STRUCT_OFFSET (TerminalProfileClass, forgotten)((glong) __builtin_offsetof(TerminalProfileClass, forgotten)),
1214 NULL((void*)0), NULL((void*)0),
1215 g_cclosure_marshal_VOID__VOID,
1216 G_TYPE_NONE((GType) ((1) << (2))), 0);
1217
1218 /* gsettings_key -> pspec hash */
1219 klass->gsettings_keys = g_hash_table_new (g_str_hash, g_str_equal);
1220
1221#define TERMINAL_PROFILE_PSPEC_STATIC(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
1222
1223#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);
}
\
1224{\
1225 GParamSpec *pspec = propSpec;\
1226 g_object_class_install_property (object_class, propId, pspec);\
1227 g_param_spec_set_qdata (pspec, gsettings_key_quark, (gpointer) propGSettings);\
1228 g_hash_table_insert (klass->gsettings_keys, (gpointer) propGSettings, pspec);\
1229}
1230
1231#define TERMINAL_PROFILE_PROPERTY_OUTER(propId, propSpec){ GParamSpec *pspec = propSpec; g_object_class_install_property
(object_class, propId, pspec);}
\
1232{\
1233 GParamSpec *pspec = propSpec;\
1234 g_object_class_install_property (object_class, propId, pspec);\
1235}
1236
1237#define TERMINAL_PROFILE_PROPERTY_BOOLEAN(prop, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1238 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1239 g_param_spec_boolean (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1240 propDefault,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1241 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1242 propGSettings){ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1243
1244#define TERMINAL_PROFILE_PROPERTY_BOXED(prop, propType, propGSettings){ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1245 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1246 g_param_spec_boxed (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1247 propType,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1248 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1249 propGSettings){ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1250
1251#define TERMINAL_PROFILE_PROPERTY_DOUBLE(prop, propMin, propMax, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1252 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1253 g_param_spec_double (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1254 propMin, propMax, propDefault,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1255 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1256 propGSettings){ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1257
1258#define TERMINAL_PROFILE_PROPERTY_ENUM(prop, propType, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1259 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1260 g_param_spec_enum (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1261 propType, propDefault,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1262 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1263 propGSettings){ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1264
1265#define TERMINAL_PROFILE_PROPERTY_INT(prop, propMin, propMax, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1266 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1267 g_param_spec_int (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1268 propMin, propMax, propDefault,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1269 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1270 propGSettings){ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1271
1272 /* these are all read-only */
1273#define TERMINAL_PROFILE_PROPERTY_OBJECT(prop, propType){ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec);}
\
1274 TERMINAL_PROFILE_PROPERTY_OUTER (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1275 g_param_spec_object (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1276 propType,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1277 G_PARAM_READABLE | TERMINAL_PROFILE_PSPEC_STATIC)){ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1278
1279#define TERMINAL_PROFILE_PROPERTY_STRING(prop, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1280 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1281 g_param_spec_string (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1282 propDefault,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1283 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1284 propGSettings){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1285
1286#define TERMINAL_PROFILE_PROPERTY_STRING_CO(prop, propDefault){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec);}
\
1287 TERMINAL_PROFILE_PROPERTY_OUTER (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1288 g_param_spec_string (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1289 propDefault,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1290 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | TERMINAL_PROFILE_PSPEC_STATIC)){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1291
1292#define TERMINAL_PROFILE_PROPERTY_VALUE_ARRAY_BOXED(prop, propElementName, propElementType, propGSettings){ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1293 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1294 g_param_spec_value_array (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1295 g_param_spec_boxed (propElementName, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1296 propElementType, \{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1297 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1298 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1299 propGSettings){ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1300
1301 TERMINAL_PROFILE_PROPERTY_BOOLEAN (ALLOW_BOLD, DEFAULT_ALLOW_BOLD, KEY_ALLOW_BOLD){ GParamSpec *pspec = g_param_spec_boolean ("allow-bold", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_ALLOW_BOLD, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "allow-bold"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "allow-bold", pspec);}
;
1302 TERMINAL_PROFILE_PROPERTY_BOOLEAN (BOLD_COLOR_SAME_AS_FG, DEFAULT_BOLD_COLOR_SAME_AS_FG, KEY_BOLD_COLOR_SAME_AS_FG){ GParamSpec *pspec = g_param_spec_boolean ("bold-color-same-as-fg"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BOLD_COLOR_SAME_AS_FG, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "bold-color-same-as-fg"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "bold-color-same-as-fg"
, pspec);}
;
1303 TERMINAL_PROFILE_PROPERTY_BOOLEAN (DEFAULT_SHOW_MENUBAR, DEFAULT_DEFAULT_SHOW_MENUBAR, KEY_DEFAULT_SHOW_MENUBAR){ GParamSpec *pspec = g_param_spec_boolean ("default-show-menubar"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_DEFAULT_SHOW_MENUBAR, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "default-show-menubar"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "default-show-menubar"
, pspec);}
;
1304 TERMINAL_PROFILE_PROPERTY_BOOLEAN (LOGIN_SHELL, DEFAULT_LOGIN_SHELL, KEY_LOGIN_SHELL){ GParamSpec *pspec = g_param_spec_boolean ("login-shell", ((
void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_LOGIN_SHELL, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "login-shell"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "login-shell", pspec);
}
;
1305 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_BACKGROUND, DEFAULT_SCROLL_BACKGROUND, KEY_SCROLL_BACKGROUND){ GParamSpec *pspec = g_param_spec_boolean ("scroll-background"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_BACKGROUND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-background")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-background"
, pspec);}
;
1306 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLLBACK_UNLIMITED, DEFAULT_SCROLLBACK_UNLIMITED, KEY_SCROLLBACK_UNLIMITED){ GParamSpec *pspec = g_param_spec_boolean ("scrollback-unlimited"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLLBACK_UNLIMITED, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scrollback-unlimited"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scrollback-unlimited"
, pspec);}
;
1307 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_KEYSTROKE, DEFAULT_SCROLL_ON_KEYSTROKE, KEY_SCROLL_ON_KEYSTROKE){ GParamSpec *pspec = g_param_spec_boolean ("scroll-on-keystroke"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_ON_KEYSTROKE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-on-keystroke"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-on-keystroke"
, pspec);}
;
1308 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_OUTPUT, DEFAULT_SCROLL_ON_OUTPUT, KEY_SCROLL_ON_OUTPUT){ GParamSpec *pspec = g_param_spec_boolean ("scroll-on-output"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_ON_OUTPUT, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-on-output");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-on-output"
, pspec);}
;
1309 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SILENT_BELL, DEFAULT_SILENT_BELL, KEY_SILENT_BELL){ GParamSpec *pspec = g_param_spec_boolean ("silent-bell", ((
void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SILENT_BELL, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "silent-bell"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "silent-bell", pspec);
}
;
1310 TERMINAL_PROFILE_PROPERTY_BOOLEAN (COPY_SELECTION, DEFAULT_COPY_SELECTION, KEY_COPY_SELECTION){ GParamSpec *pspec = g_param_spec_boolean ("copy-selection",
((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_COPY_SELECTION, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "copy-selection"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "copy-selection", pspec
);}
;
1311 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_COMMAND, DEFAULT_USE_CUSTOM_COMMAND, KEY_USE_CUSTOM_COMMAND){ GParamSpec *pspec = g_param_spec_boolean ("use-custom-command"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_CUSTOM_COMMAND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-custom-command"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-custom-command"
, pspec);}
;
1312 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_DEFAULT_SIZE, DEFAULT_USE_CUSTOM_DEFAULT_SIZE, KEY_USE_CUSTOM_DEFAULT_SIZE){ GParamSpec *pspec = g_param_spec_boolean ("use-custom-default-size"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_CUSTOM_DEFAULT_SIZE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-custom-default-size"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-custom-default-size"
, pspec);}
;
1313 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SKEY, DEFAULT_USE_SKEY, KEY_USE_SKEY){ GParamSpec *pspec = g_param_spec_boolean ("use-skey", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_SKEY, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-skey"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-skey", pspec);}
;
1314 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_URLS, DEFAULT_USE_URLS, KEY_USE_URLS){ GParamSpec *pspec = g_param_spec_boolean ("use-urls", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_URLS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-urls"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-urls", pspec);}
;
1315 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SYSTEM_FONT, DEFAULT_USE_SYSTEM_FONT, KEY_USE_SYSTEM_FONT){ GParamSpec *pspec = g_param_spec_boolean ("use-system-font"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_SYSTEM_FONT, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-system-font"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-system-font", pspec
);}
;
1316 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_THEME_COLORS, DEFAULT_USE_THEME_COLORS, KEY_USE_THEME_COLORS){ GParamSpec *pspec = g_param_spec_boolean ("use-theme-colors"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_THEME_COLORS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-theme-colors");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-theme-colors"
, pspec);}
;
1317
1318 TERMINAL_PROFILE_PROPERTY_BOXED (BACKGROUND_COLOR, GDK_TYPE_RGBA, KEY_BACKGROUND_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("background-color",
((void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "background-color"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "background-color", pspec);}
;
1319 TERMINAL_PROFILE_PROPERTY_BOXED (BOLD_COLOR, GDK_TYPE_RGBA, KEY_BOLD_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("bold-color", ((void
*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BOLD_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "bold-color"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "bold-color", pspec);}
;
1320 TERMINAL_PROFILE_PROPERTY_BOXED (FONT, PANGO_TYPE_FONT_DESCRIPTION, KEY_FONT){ GParamSpec *pspec = g_param_spec_boxed ("font", ((void*)0),
((void*)0), (pango_font_description_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_FONT,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) "font"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "font", pspec);}
;
1321 TERMINAL_PROFILE_PROPERTY_BOXED (FOREGROUND_COLOR, GDK_TYPE_RGBA, KEY_FOREGROUND_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("foreground-color",
((void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_FOREGROUND_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "foreground-color"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "foreground-color", pspec);}
;
1322
1323 /* 0.0 = normal bg, 1.0 = all black bg, 0.5 = half darkened */
1324 TERMINAL_PROFILE_PROPERTY_DOUBLE (BACKGROUND_DARKNESS, 0.0, 1.0, DEFAULT_BACKGROUND_DARKNESS, KEY_BACKGROUND_DARKNESS){ GParamSpec *pspec = g_param_spec_double ("background-darkness"
, ((void*)0), ((void*)0), 0.0, 1.0, (0.5), G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_DARKNESS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "background-darkness"); g_hash_table_insert (klass
->gsettings_keys, (gpointer) "background-darkness", pspec)
;}
;
1325
1326 TERMINAL_PROFILE_PROPERTY_ENUM (BACKGROUND_TYPE, TERMINAL_TYPE_BACKGROUND_TYPE, DEFAULT_BACKGROUND_TYPE, KEY_BACKGROUND_TYPE){ GParamSpec *pspec = g_param_spec_enum ("background-type", (
(void*)0), ((void*)0), (terminal_background_type_get_type ())
, (TERMINAL_BACKGROUND_SOLID), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BACKGROUND_TYPE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "background-type"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "background-type", pspec
);}
;
1327 TERMINAL_PROFILE_PROPERTY_ENUM (BACKSPACE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_BACKSPACE_BINDING, KEY_BACKSPACE_BINDING){ GParamSpec *pspec = g_param_spec_enum ("backspace-binding",
((void*)0), ((void*)0), (vte_erase_binding_get_type ()), (VTE_ERASE_ASCII_DELETE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_BACKSPACE_BINDING, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) "backspace-binding"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "backspace-binding", pspec
);}
;
1328 TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_BLINK_MODE, VTE_TYPE_CURSOR_BLINK_MODE, DEFAULT_CURSOR_BLINK_MODE, KEY_CURSOR_BLINK_MODE){ GParamSpec *pspec = g_param_spec_enum ("cursor-blink-mode",
((void*)0), ((void*)0), (vte_cursor_blink_mode_get_type ()),
(VTE_CURSOR_BLINK_SYSTEM), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_CURSOR_BLINK_MODE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "cursor-blink-mode")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "cursor-blink-mode"
, pspec);}
;
1329 TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_SHAPE, VTE_TYPE_CURSOR_SHAPE, DEFAULT_CURSOR_SHAPE, KEY_CURSOR_SHAPE){ GParamSpec *pspec = g_param_spec_enum ("cursor-shape", ((void
*)0), ((void*)0), (vte_cursor_shape_get_type ()), (VTE_CURSOR_SHAPE_BLOCK
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_CURSOR_SHAPE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "cursor-shape"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "cursor-shape", pspec);}
;
1330 TERMINAL_PROFILE_PROPERTY_ENUM (DELETE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_DELETE_BINDING, KEY_DELETE_BINDING){ GParamSpec *pspec = g_param_spec_enum ("delete-binding", ((
void*)0), ((void*)0), (vte_erase_binding_get_type ()), (VTE_ERASE_DELETE_SEQUENCE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_DELETE_BINDING, pspec); g_param_spec_set_qdata (pspec,
gsettings_key_quark, (gpointer) "delete-binding"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "delete-binding", pspec
);}
;
1331 TERMINAL_PROFILE_PROPERTY_ENUM (EXIT_ACTION, TERMINAL_TYPE_EXIT_ACTION, DEFAULT_EXIT_ACTION, KEY_EXIT_ACTION){ GParamSpec *pspec = g_param_spec_enum ("exit-action", ((void
*)0), ((void*)0), (terminal_exit_action_get_type ()), (TERMINAL_EXIT_CLOSE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_EXIT_ACTION, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "exit-action"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "exit-action", pspec);}
;
1332 TERMINAL_PROFILE_PROPERTY_ENUM (SCROLLBAR_POSITION, TERMINAL_TYPE_SCROLLBAR_POSITION, DEFAULT_SCROLLBAR_POSITION, KEY_SCROLLBAR_POSITION){ GParamSpec *pspec = g_param_spec_enum ("scrollbar-position"
, ((void*)0), ((void*)0), (terminal_scrollbar_position_get_type
()), (TERMINAL_SCROLLBAR_RIGHT), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLLBAR_POSITION, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scrollbar-position"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scrollbar-position"
, pspec);}
;
1333 TERMINAL_PROFILE_PROPERTY_ENUM (TITLE_MODE, TERMINAL_TYPE_TITLE_MODE, DEFAULT_TITLE_MODE, KEY_TITLE_MODE){ GParamSpec *pspec = g_param_spec_enum ("title-mode", ((void
*)0), ((void*)0), (terminal_title_mode_get_type ()), (TERMINAL_TITLE_REPLACE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_TITLE_MODE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "title-mode"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "title-mode", pspec);}
;
1334
1335 TERMINAL_PROFILE_PROPERTY_INT (DEFAULT_SIZE_COLUMNS, 1, 1024, DEFAULT_DEFAULT_SIZE_COLUMNS, KEY_DEFAULT_SIZE_COLUMNS){ GParamSpec *pspec = g_param_spec_int ("default-size-columns"
, ((void*)0), ((void*)0), 1, 1024, (80), G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_DEFAULT_SIZE_COLUMNS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "default-size-columns"); g_hash_table_insert (klass
->gsettings_keys, (gpointer) "default-size-columns", pspec
);}
;
1336 TERMINAL_PROFILE_PROPERTY_INT (DEFAULT_SIZE_ROWS, 1, 1024, DEFAULT_DEFAULT_SIZE_ROWS, KEY_DEFAULT_SIZE_ROWS){ GParamSpec *pspec = g_param_spec_int ("default-size-rows", (
(void*)0), ((void*)0), 1, 1024, (24), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_DEFAULT_SIZE_ROWS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "default-size-rows")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "default-size-rows"
, pspec);}
;
1337 TERMINAL_PROFILE_PROPERTY_INT (SCROLLBACK_LINES, 1, G_MAXINT, DEFAULT_SCROLLBACK_LINES, KEY_SCROLLBACK_LINES){ GParamSpec *pspec = g_param_spec_int ("scrollback-lines", (
(void*)0), ((void*)0), 1, 2147483647, (512), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_SCROLLBACK_LINES
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "scrollback-lines"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "scrollback-lines", pspec);}
;
1338
1339 TERMINAL_PROFILE_PROPERTY_OBJECT (BACKGROUND_IMAGE, GDK_TYPE_PIXBUF){ GParamSpec *pspec = g_param_spec_object ("background-image"
, ((void*)0), ((void*)0), (gdk_pixbuf_get_type ()), G_PARAM_READABLE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_IMAGE
, pspec);}
;
1340
1341 TERMINAL_PROFILE_PROPERTY_STRING_CO (NAME, DEFAULT_NAME){ GParamSpec *pspec = g_param_spec_string ("name", ((void*)0)
, ((void*)0), (((void*)0)), G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_NAME,
pspec);}
;
1342
1343 TERMINAL_PROFILE_PROPERTY_STRING (BACKGROUND_IMAGE_FILE, DEFAULT_BACKGROUND_IMAGE_FILE, KEY_BACKGROUND_IMAGE_FILE){ GParamSpec *pspec = g_param_spec_string ("background-image-file"
, ((void*)0), ((void*)0), (""), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BACKGROUND_IMAGE_FILE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "background-image");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "background-image"
, pspec);}
;
1344 TERMINAL_PROFILE_PROPERTY_STRING (CUSTOM_COMMAND, DEFAULT_CUSTOM_COMMAND, KEY_CUSTOM_COMMAND){ GParamSpec *pspec = g_param_spec_string ("custom-command", (
(void*)0), ((void*)0), (""), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_CUSTOM_COMMAND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "custom-command"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "custom-command", pspec
);}
;
1345 TERMINAL_PROFILE_PROPERTY_STRING (TITLE, _(DEFAULT_TITLE), KEY_TITLE){ GParamSpec *pspec = g_param_spec_string ("title", ((void*)0
), ((void*)0), gettext ((("Terminal"))), G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_TITLE
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "title"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "title", pspec);}
;
1346 TERMINAL_PROFILE_PROPERTY_STRING (VISIBLE_NAME, _(DEFAULT_VISIBLE_NAME), KEY_VISIBLE_NAME){ GParamSpec *pspec = g_param_spec_string ("visible-name", ((
void*)0), ((void*)0), gettext ((("Unnamed"))), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_VISIBLE_NAME
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "visible-name"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "visible-name", pspec);}
;
1347 TERMINAL_PROFILE_PROPERTY_STRING (WORD_CHARS, DEFAULT_WORD_CHARS, KEY_WORD_CHARS){ GParamSpec *pspec = g_param_spec_string ("word-chars", ((void
*)0), ((void*)0), ("-A-Za-z0-9,./?%&#:_=+@~"), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_WORD_CHARS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "word-chars"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "word-chars", pspec);}
;
1348
1349 TERMINAL_PROFILE_PROPERTY_VALUE_ARRAY_BOXED (PALETTE, "palette-color", GDK_TYPE_RGBA, KEY_PALETTE){ GParamSpec *pspec = g_param_spec_value_array ("palette", ((
void*)0), ((void*)0), g_param_spec_boxed ("palette-color", ((
void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_PALETTE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "palette"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "palette", pspec);}
;
1350}
1351
1352/* Semi-Public API */
1353
1354TerminalProfile*
1355_terminal_profile_new (const char *name)
1356{
1357 return g_object_new (TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()),
1358 "name", name,
1359 NULL((void*)0));
1360}
1361
1362void
1363_terminal_profile_forget (TerminalProfile *profile)
1364{
1365 TerminalProfilePrivate *priv = profile->priv;
1366
1367 if (!priv->forgotten)
1368 {
1369 priv->forgotten = TRUE(!(0));
1370
1371 g_signal_emit (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, signals[FORGOTTEN], 0);
1372 }
1373}
1374
1375gboolean
1376_terminal_profile_get_forgotten (TerminalProfile *profile)
1377{
1378 return profile->priv->forgotten;
1379}
1380
1381TerminalProfile *
1382_terminal_profile_clone (TerminalProfile *base_profile,
1383 const char *visible_name)
1384{
1385 TerminalApp *app = terminal_app_get ();
1386 GObject *base_object = G_OBJECT (base_profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((base_profile)), (((GType) ((20) << (2))))))))
;
1387 TerminalProfilePrivate *new_priv;
1388 char profile_name[32];
1389 GParameter *params;
1390 GParamSpec **pspecs;
1391 guint n_pspecs, i, n_params, profile_num;
1392 TerminalProfile *new_profile;
1393
1394 g_object_ref (base_profile)((__typeof__ (base_profile)) (g_object_ref) (base_profile));
1395
1396 profile_num = 0;
1397 do
1398 {
1399 g_snprintf (profile_name, sizeof (profile_name), "profile%u", profile_num++);
1400 }
1401 while (terminal_app_get_profile_by_name (app, profile_name) != NULL((void*)0));
1402
1403 /* Now we have an unused profile name */
1404 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (base_profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((base_profile
)))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
1405
1406 params = g_newa (GParameter, n_pspecs)((GParameter*) __builtin_alloca (sizeof (GParameter) * (gsize
) (n_pspecs)))
;
1407 n_params = 0;
1408
1409 for (i = 0; i < n_pspecs; ++i)
1410 {
1411 GParamSpec *pspec = pspecs[i];
1412 GValue *value;
1413
1414 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) ||
1415 (pspec->flags & G_PARAM_WRITABLE) == 0)
1416 continue;
1417
1418 params[n_params].name = pspec->name;
1419
1420 value = &params[n_params].value;
1421 G_VALUE_TYPE (value)(((GValue*) (value))->g_type) = 0;
1422 g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
1423
1424 if (pspec->name == I_(TERMINAL_PROFILE_NAME)g_intern_static_string ("name"))
1425 g_value_set_static_string (value, profile_name);
1426 else if (pspec->name == I_(TERMINAL_PROFILE_VISIBLE_NAME)g_intern_static_string ("visible-name"))
1427 g_value_set_static_string (value, visible_name);
1428 else
1429 g_object_get_property (base_object, pspec->name, value);
1430
1431 ++n_params;
1432 }
1433
1434 new_profile = g_object_newv (TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()), n_params, params);
1435
1436 g_object_unref (base_profile);
1437
1438 for (i = 0; i < n_params; ++i)
1439 g_value_unset (&params[i].value);
1440
1441 /* Flush the new profile to GSettings */
1442 new_priv = new_profile->priv;
1443
1444 g_slist_free (new_priv->dirty_pspecs);
1445 new_priv->dirty_pspecs = NULL((void*)0);
1446 if (new_priv->save_idle_id != 0)
1447 {
1448 g_source_remove (new_priv->save_idle_id);
1449 new_priv->save_idle_id = 0;
1450 }
1451
1452 for (i = 0; i < n_pspecs; ++i)
1453 {
1454 GParamSpec *pspec = pspecs[i];
1455
1456 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) ||
1457 (pspec->flags & G_PARAM_WRITABLE) == 0)
1458 continue;
1459
1460 new_priv->dirty_pspecs = g_slist_prepend (new_priv->dirty_pspecs, pspec);
1461 }
1462 g_free (pspecs);
1463
1464 terminal_profile_save (new_profile);
1465
1466 return new_profile;
1467}
1468
1469/* Public API */
1470
1471gboolean
1472terminal_profile_get_property_boolean (TerminalProfile *profile,
1473 const char *prop_name)
1474{
1475 const GValue *value;
1476
1477 value = get_prop_value_from_prop_name (profile, prop_name);
1478 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_BOOLEAN (value), FALSE)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((5) << (2)))); gboolean __r; if (!__val) __r = (0); else
if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_BOOLEAN (value)"
); return ((0)); } } while (0)
;
1479 if (!value || !G_VALUE_HOLDS_BOOLEAN (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((5) << (2)))); gboolean __r;
if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1480 return FALSE(0);
1481
1482 return g_value_get_boolean (value);
1483}
1484
1485gconstpointer
1486terminal_profile_get_property_boxed (TerminalProfile *profile,
1487 const char *prop_name)
1488{
1489 const GValue *value;
1490
1491 value = get_prop_value_from_prop_name (profile, prop_name);
1492 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_BOXED (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((18) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_BOXED (value)"
); return (((void*)0)); } } while (0)
;
1493 if (!value || !G_VALUE_HOLDS_BOXED (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((18) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1494 return NULL((void*)0);
1495
1496 return g_value_get_boxed (value);
1497}
1498
1499double
1500terminal_profile_get_property_double (TerminalProfile *profile,
1501 const char *prop_name)
1502{
1503 const GValue *value;
1504
1505 value = get_prop_value_from_prop_name (profile, prop_name);
1506 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_DOUBLE (value), 0.0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((15) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_DOUBLE (value)"
); return (0.0); } } while (0)
;
1507 if (!value || !G_VALUE_HOLDS_DOUBLE (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((15) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1508 return 0.0;
1509
1510 return g_value_get_double (value);
1511}
1512
1513int
1514terminal_profile_get_property_enum (TerminalProfile *profile,
1515 const char *prop_name)
1516{
1517 const GValue *value;
1518
1519 value = get_prop_value_from_prop_name (profile, prop_name);
1520 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_ENUM (value), 0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((12) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_ENUM (value)"
); return (0); } } while (0)
;
1521 if (!value || !G_VALUE_HOLDS_ENUM (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((12) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1522 return 0;
1523
1524 return g_value_get_enum (value);
1525}
1526
1527int
1528terminal_profile_get_property_int (TerminalProfile *profile,
1529 const char *prop_name)
1530{
1531 const GValue *value;
1532
1533 value = get_prop_value_from_prop_name (profile, prop_name);
1534 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_INT (value), 0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((6) << (2)))); gboolean __r; if (!__val) __r = (0); else
if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_INT (value)"
); return (0); } } while (0)
;
1535 if (!value || !G_VALUE_HOLDS_INT (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((6) << (2)))); gboolean __r;
if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1536 return 0;
1537
1538 return g_value_get_int (value);
1539}
1540
1541gpointer
1542terminal_profile_get_property_object (TerminalProfile *profile,
1543 const char *prop_name)
1544{
1545 const GValue *value;
1546
1547 value = get_prop_value_from_prop_name (profile, prop_name);
1548 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_OBJECT (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((20) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_OBJECT (value)"
); return (((void*)0)); } } while (0)
;
1549 if (!value || !G_VALUE_HOLDS_OBJECT (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((20) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1550 return NULL((void*)0);
1551
1552 return g_value_get_object (value);
1553}
1554
1555const char*
1556terminal_profile_get_property_string (TerminalProfile *profile,
1557 const char *prop_name)
1558{
1559 const GValue *value;
1560
1561 value = get_prop_value_from_prop_name (profile, prop_name);
1562 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_STRING (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((16) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_STRING (value)"
); return (((void*)0)); } } while (0)
;
1563 if (!value || !G_VALUE_HOLDS_STRING (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((16) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1564 return NULL((void*)0);
1565
1566 return g_value_get_string (value);
1567}
1568
1569gboolean
1570terminal_profile_property_locked (TerminalProfile *profile,
1571 const char *prop_name)
1572{
1573 TerminalProfilePrivate *priv = profile->priv;
1574 GParamSpec *pspec;
1575
1576 pspec = get_pspec_from_name (profile, prop_name);
1577 g_return_val_if_fail (pspec != NULL, FALSE)do { if ((pspec != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "pspec != NULL");
return ((0)); } } while (0)
;
1578 if (!pspec)
1579 return FALSE(0);
This statement is never executed
1580
1581 return priv->locked[pspec->param_id];
1582}
1583
1584void
1585terminal_profile_reset_property (TerminalProfile *profile,
1586 const char *prop_name)
1587{
1588 GParamSpec *pspec;
1589
1590 pspec = get_pspec_from_name (profile, prop_name);
1591 g_return_if_fail (pspec != NULL)do { if ((pspec != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "pspec != NULL");
return; } } while (0)
;
1592 if (!pspec ||
1593 (pspec->flags & G_PARAM_WRITABLE) == 0)
1594 return;
1595
1596 terminal_profile_reset_property_internal (profile, pspec, TRUE(!(0)));
1597}
1598
1599gboolean
1600terminal_profile_get_palette (TerminalProfile *profile,
1601 GdkRGBA *colors,
1602 guint *n_colors)
1603{
1604 TerminalProfilePrivate *priv;
1605 GValueArray *array;
1606 guint i, n;
1607
1608 g_return_val_if_fail (TERMINAL_IS_PROFILE (profile), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((profile)); GType __t = ((terminal_profile_get_type ()));
gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class
&& __inst->g_class->g_type == __t) __r = (!(0)
); else __r = g_type_check_instance_is_a (__inst, __t); __r; }
)))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "TERMINAL_IS_PROFILE (profile)"); return
((0)); } } while (0)
;
1609 g_return_val_if_fail (colors != NULL && n_colors != NULL, FALSE)do { if ((colors != ((void*)0) && n_colors != ((void*
)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "colors != NULL && n_colors != NULL"
); return ((0)); } } while (0)
;
1610
1611 priv = profile->priv;
1612 array = g_value_get_boxed (g_value_array_get_nth (priv->properties, PROP_PALETTE));
1613 if (!array)
1614 return FALSE(0);
1615
1616 n = MIN (array->n_values, *n_colors)(((array->n_values) < (*n_colors)) ? (array->n_values
) : (*n_colors))
;
1617 for (i = 0; i < n; ++i)
1618 {
1619 GdkRGBA *color = g_value_get_boxed (g_value_array_get_nth (array, i));
1620 if (!color)
1621 continue; /* shouldn't happen!! */
1622
1623 colors[i] = *color;
1624 }
1625
1626 *n_colors = n;
1627 return TRUE(!(0));
1628}
1629
1630gboolean
1631terminal_profile_get_palette_is_builtin (TerminalProfile *profile,
1632 guint *n)
1633{
1634 GdkRGBA colors[TERMINAL_PALETTE_SIZE16];
1635 guint n_colors;
1636 guint i;
1637
1638 n_colors = G_N_ELEMENTS (colors)(sizeof (colors) / sizeof ((colors)[0]));
1639 if (!terminal_profile_get_palette (profile, colors, &n_colors) ||
1640 n_colors != TERMINAL_PALETTE_SIZE16)
1641 return FALSE(0);
1642
1643 for (i = 0; i < TERMINAL_PALETTE_N_BUILTINS5; ++i)
1644 if (palette_cmp (colors, terminal_palettes[i]))
1645 {
1646 *n = i;
1647 return TRUE(!(0));
1648 }
1649
1650 return FALSE(0);
1651}
1652
1653void
1654terminal_profile_set_palette_builtin (TerminalProfile *profile,
1655 guint n)
1656{
1657 GValue value = { 0, };
1658
1659 g_return_if_fail (n < TERMINAL_PALETTE_N_BUILTINS)do { if ((n < 5)) { } else { g_return_if_fail_warning (((gchar
*) 0), ((const char*) (__func__)), "n < TERMINAL_PALETTE_N_BUILTINS"
); return; } } while (0)
;
1660
1661 g_value_init (&value, G_TYPE_VALUE_ARRAY(g_value_array_get_type ()) GCC warning "Deprecated pre-processor symbol: replace with \"(g_array_get_type ())\""
+
);
1662 set_value_from_palette (&value, terminal_palettes[n], TERMINAL_PALETTE_SIZE16);
1663 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, TERMINAL_PROFILE_PALETTE"palette", &value);
1664 g_value_unset (&value);
1665}
1666
1667gboolean
1668terminal_profile_modify_palette_entry (TerminalProfile *profile,
1669 guint i,
1670 const GdkRGBA *color)
1671{
1672 TerminalProfilePrivate *priv = profile->priv;
1673 GValueArray *array;
1674 GValue *value;
1675 GdkRGBA *old_color;
1676
1677 array = g_value_get_boxed (g_value_array_get_nth (priv->properties, PROP_PALETTE));
1678 if (!array ||
1679 i >= array->n_values)
1680 return FALSE(0);
1681
1682 value = g_value_array_get_nth (array, i);
1683 old_color = g_value_get_boxed (value);
1684 if (!old_color ||
1685 !rgba_equal (old_color, color))
1686 {
1687 g_value_set_boxed (value, color);
1688 g_object_notify (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, TERMINAL_PROFILE_PALETTE"palette");
1689 }
1690
1691 return TRUE(!(0));
1692}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-cbf846.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-cbf846.html new file mode 100644 index 0000000..c0a9021 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-cbf846.html @@ -0,0 +1,1021 @@ + + + +md4.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:skey/md4.c
Warning:line 274, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name md4.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src/skey -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I ../.. -I ./.. -D G_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -D PIC -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src/skey -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c md4.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright (C) 2001 Nikos Mavroyanopoulos
3 * Copyright (C) 2012-2021 MATE Developers
4 *
5 * This library is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Library General Public License as published
7 * by the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21/*
22 * The algorithm is due to Ron Rivest. This code is based on code
23 * written by Colin Plumb in 1993.
24 */
25
26#include <string.h>
27#include <stdlib.h>
28#include "config.h"
29#include "skey.h"
30#include "skeyutil.h"
31#include "md4.h"
32
33#ifndef WORDS_BIGENDIAN
34#define byteReverse(buf, len) /* Nothing */
35#else
36static void byteReverse(unsigned char *buf, unsigned longs);
37
38/*
39 * Note: this code is harmless on little-endian machines.
40 */
41static void byteReverse(unsigned char *buf, unsigned longs)
42{
43 guint32 t;
44 do
45 {
46 t = (guint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
47 ((unsigned) buf[1] << 8 | buf[0]);
48 *(guint32 *) buf = t;
49 buf += 4;
50 }
51 while (--longs);
52}
53#endif
54
55#define rotl32(x,n)(((x) << ((guint32)(n))) | ((x) >> (32 - (guint32
)(n))))
(((x) << ((guint32)(n))) | ((x) >> (32 - (guint32)(n))))
56
57/*
58 * Start MD4 accumulation. Set bit count to 0 and buffer to mysterious
59 * initialization constants.
60 */
61void MD4Init(MD4_CTX *ctx)
62{
63 ctx->buf[0] = 0x67452301;
64 ctx->buf[1] = 0xefcdab89;
65 ctx->buf[2] = 0x98badcfe;
66 ctx->buf[3] = 0x10325476;
67
68 ctx->bits[0] = 0;
69 ctx->bits[1] = 0;
70}
71
72/*
73 * Update context to reflect the concatenation of another buffer full
74 * of bytes.
75 */
76void MD4Update(MD4_CTX *ctx, unsigned char const *buf,
77 unsigned len)
78{
79 register guint32 t;
80
81 /* Update bitcount */
82
83 t = ctx->bits[0];
84 if ((ctx->bits[0] = t + ((guint32) len << 3)) < t)
85 ctx->bits[1]++; /* Carry from low to high */
86 ctx->bits[1] += len >> 29;
87
88 t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
89
90 /* Handle any leading odd-sized chunks */
91
92 if (t)
93 {
94 unsigned char *p = (unsigned char *) ctx->in + t;
95
96 t = 64 - t;
97 if (len < t)
98 {
99 memcpy(p, buf, len);
100 return;
101 }
102 memcpy(p, buf, t);
103 byteReverse(ctx->in, 16);
104 MD4Transform(ctx->buf, (guint32 *) ctx->in);
105 buf += t;
106 len -= t;
107 }
108 /* Process data in 64-byte chunks */
109
110 while (len >= 64)
111 {
112 memcpy(ctx->in, buf, 64);
113 byteReverse(ctx->in, 16);
114 MD4Transform(ctx->buf, (guint32 *) ctx->in);
115 buf += 64;
116 len -= 64;
117 }
118
119 /* Handle any remaining bytes of data. */
120
121 memcpy(ctx->in, buf, len);
122}
123
124/*
125 * Final wrapup - pad to 64-byte boundary with the bit pattern
126 * 1 0* (64-bit count of bits processed, MSB-first)
127 */
128void MD4Final(unsigned char* digest, MD4_CTX *ctx)
129{
130 unsigned int count;
131 unsigned char *p;
132
133 /* Compute number of bytes mod 64 */
134 count = (ctx->bits[0] >> 3) & 0x3F;
135
136 /* Set the first char of padding to 0x80. This is safe since there is
137 always at least one byte free */
138 p = ctx->in + count;
139 *p++ = 0x80;
140
141 /* Bytes of padding needed to make 64 bytes */
142 count = 64 - 1 - count;
143
144 /* Pad out to 56 mod 64 */
145 if (count < 8)
146 {
147 /* Two lots of padding: Pad the first block to 64 bytes */
148 memset(p, 0, count);
149 byteReverse(ctx->in, 16);
150 MD4Transform(ctx->buf, (guint32 *) ctx->in);
151
152 /* Now fill the next block with 56 bytes */
153 memset(ctx->in, 0, 56);
154 }
155 else
156 {
157 /* Pad block to 56 bytes */
158 memset(p, 0, count - 8);
159 }
160 byteReverse(ctx->in, 14);
161
162 /* Append length in bits and transform */
163 ((guint32 *) ctx->in)[14] = ctx->bits[0];
164 ((guint32 *) ctx->in)[15] = ctx->bits[1];
165
166 MD4Transform(ctx->buf, (guint32 *) ctx->in);
167 byteReverse((unsigned char *) ctx->buf, 4);
168
169 if (digest!=NULL((void*)0))
170 memcpy(digest, ctx->buf, 16);
171 memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
172}
173
174/* The three core functions */
175
176#define F(x, y, z)(((x) & (y)) | ((~x) & (z))) (((x) & (y)) | ((~x) & (z)))
177#define G(x, y, z)(((x) & (y)) | ((x) & (z)) | ((y) & (z))) (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
178#define H(x, y, z)((x) ^ (y) ^ (z)) ((x) ^ (y) ^ (z))
179
180#define FF(a, b, c, d, x, s){ (a) += ((((b)) & ((c))) | ((~(b)) & ((d)))) + (x); (
a) = ((((a)) << ((guint32)((s)))) | (((a)) >> (32
- (guint32)((s))))); }
{ \
181 (a) += F ((b), (c), (d))((((b)) & ((c))) | ((~(b)) & ((d)))) + (x); \
182 (a) = rotl32 ((a), (s))((((a)) << ((guint32)((s)))) | (((a)) >> (32 - (guint32
)((s)))))
; \
183 }
184#define GG(a, b, c, d, x, s){ (a) += ((((b)) & ((c))) | (((b)) & ((d))) | (((c)) &
((d)))) + (x) + (guint32)0x5a827999; (a) = ((((a)) << (
(guint32)((s)))) | (((a)) >> (32 - (guint32)((s))))); }
{ \
185 (a) += G ((b), (c), (d))((((b)) & ((c))) | (((b)) & ((d))) | (((c)) & ((d
))))
+ (x) + (guint32)0x5a827999; \
186 (a) = rotl32 ((a), (s))((((a)) << ((guint32)((s)))) | (((a)) >> (32 - (guint32
)((s)))))
; \
187 }
188#define HH(a, b, c, d, x, s){ (a) += (((b)) ^ ((c)) ^ ((d))) + (x) + (guint32)0x6ed9eba1;
(a) = ((((a)) << ((guint32)((s)))) | (((a)) >> (
32 - (guint32)((s))))); }
{ \
189 (a) += H ((b), (c), (d))(((b)) ^ ((c)) ^ ((d))) + (x) + (guint32)0x6ed9eba1; \
190 (a) = rotl32 ((a), (s))((((a)) << ((guint32)((s)))) | (((a)) >> (32 - (guint32
)((s)))))
; \
191 }
192
193/*
194 * The core of the MD4 algorithm
195 */
196void MD4Transform(guint32 buf[4], guint32 const in[16])
197{
198 register guint32 a, b, c, d;
199
200 a = buf[0];
201 b = buf[1];
202 c = buf[2];
203 d = buf[3];
204
205 FF(a, b, c, d, in[0], 3){ (a) += ((((b)) & ((c))) | ((~(b)) & ((d)))) + (in[0
]); (a) = ((((a)) << ((guint32)((3)))) | (((a)) >>
(32 - (guint32)((3))))); }
; /* 1 */
206 FF(d, a, b, c, in[1], 7){ (d) += ((((a)) & ((b))) | ((~(a)) & ((c)))) + (in[1
]); (d) = ((((d)) << ((guint32)((7)))) | (((d)) >>
(32 - (guint32)((7))))); }
; /* 2 */
207 FF(c, d, a, b, in[2], 11){ (c) += ((((d)) & ((a))) | ((~(d)) & ((b)))) + (in[2
]); (c) = ((((c)) << ((guint32)((11)))) | (((c)) >>
(32 - (guint32)((11))))); }
; /* 3 */
208 FF(b, c, d, a, in[3], 19){ (b) += ((((c)) & ((d))) | ((~(c)) & ((a)))) + (in[3
]); (b) = ((((b)) << ((guint32)((19)))) | (((b)) >>
(32 - (guint32)((19))))); }
; /* 4 */
209 FF(a, b, c, d, in[4], 3){ (a) += ((((b)) & ((c))) | ((~(b)) & ((d)))) + (in[4
]); (a) = ((((a)) << ((guint32)((3)))) | (((a)) >>
(32 - (guint32)((3))))); }
; /* 5 */
210 FF(d, a, b, c, in[5], 7){ (d) += ((((a)) & ((b))) | ((~(a)) & ((c)))) + (in[5
]); (d) = ((((d)) << ((guint32)((7)))) | (((d)) >>
(32 - (guint32)((7))))); }
; /* 6 */
211 FF(c, d, a, b, in[6], 11){ (c) += ((((d)) & ((a))) | ((~(d)) & ((b)))) + (in[6
]); (c) = ((((c)) << ((guint32)((11)))) | (((c)) >>
(32 - (guint32)((11))))); }
; /* 7 */
212 FF(b, c, d, a, in[7], 19){ (b) += ((((c)) & ((d))) | ((~(c)) & ((a)))) + (in[7
]); (b) = ((((b)) << ((guint32)((19)))) | (((b)) >>
(32 - (guint32)((19))))); }
; /* 8 */
213 FF(a, b, c, d, in[8], 3){ (a) += ((((b)) & ((c))) | ((~(b)) & ((d)))) + (in[8
]); (a) = ((((a)) << ((guint32)((3)))) | (((a)) >>
(32 - (guint32)((3))))); }
; /* 9 */
214 FF(d, a, b, c, in[9], 7){ (d) += ((((a)) & ((b))) | ((~(a)) & ((c)))) + (in[9
]); (d) = ((((d)) << ((guint32)((7)))) | (((d)) >>
(32 - (guint32)((7))))); }
; /* 10 */
215 FF(c, d, a, b, in[10], 11){ (c) += ((((d)) & ((a))) | ((~(d)) & ((b)))) + (in[10
]); (c) = ((((c)) << ((guint32)((11)))) | (((c)) >>
(32 - (guint32)((11))))); }
; /* 11 */
216 FF(b, c, d, a, in[11], 19){ (b) += ((((c)) & ((d))) | ((~(c)) & ((a)))) + (in[11
]); (b) = ((((b)) << ((guint32)((19)))) | (((b)) >>
(32 - (guint32)((19))))); }
; /* 12 */
217 FF(a, b, c, d, in[12], 3){ (a) += ((((b)) & ((c))) | ((~(b)) & ((d)))) + (in[12
]); (a) = ((((a)) << ((guint32)((3)))) | (((a)) >>
(32 - (guint32)((3))))); }
; /* 13 */
218 FF(d, a, b, c, in[13], 7){ (d) += ((((a)) & ((b))) | ((~(a)) & ((c)))) + (in[13
]); (d) = ((((d)) << ((guint32)((7)))) | (((d)) >>
(32 - (guint32)((7))))); }
; /* 14 */
219 FF(c, d, a, b, in[14], 11){ (c) += ((((d)) & ((a))) | ((~(d)) & ((b)))) + (in[14
]); (c) = ((((c)) << ((guint32)((11)))) | (((c)) >>
(32 - (guint32)((11))))); }
; /* 15 */
220 FF(b, c, d, a, in[15], 19){ (b) += ((((c)) & ((d))) | ((~(c)) & ((a)))) + (in[15
]); (b) = ((((b)) << ((guint32)((19)))) | (((b)) >>
(32 - (guint32)((19))))); }
; /* 16 */
221
222 GG(a, b, c, d, in[0], 3){ (a) += ((((b)) & ((c))) | (((b)) & ((d))) | (((c)) &
((d)))) + (in[0]) + (guint32)0x5a827999; (a) = ((((a)) <<
((guint32)((3)))) | (((a)) >> (32 - (guint32)((3)))));
}
; /* 17 */
223 GG(d, a, b, c, in[4], 5){ (d) += ((((a)) & ((b))) | (((a)) & ((c))) | (((b)) &
((c)))) + (in[4]) + (guint32)0x5a827999; (d) = ((((d)) <<
((guint32)((5)))) | (((d)) >> (32 - (guint32)((5)))));
}
; /* 18 */
224 GG(c, d, a, b, in[8], 9){ (c) += ((((d)) & ((a))) | (((d)) & ((b))) | (((a)) &
((b)))) + (in[8]) + (guint32)0x5a827999; (c) = ((((c)) <<
((guint32)((9)))) | (((c)) >> (32 - (guint32)((9)))));
}
; /* 19 */
225 GG(b, c, d, a, in[12], 13){ (b) += ((((c)) & ((d))) | (((c)) & ((a))) | (((d)) &
((a)))) + (in[12]) + (guint32)0x5a827999; (b) = ((((b)) <<
((guint32)((13)))) | (((b)) >> (32 - (guint32)((13))))
); }
; /* 20 */
226 GG(a, b, c, d, in[1], 3){ (a) += ((((b)) & ((c))) | (((b)) & ((d))) | (((c)) &
((d)))) + (in[1]) + (guint32)0x5a827999; (a) = ((((a)) <<
((guint32)((3)))) | (((a)) >> (32 - (guint32)((3)))));
}
; /* 21 */
227 GG(d, a, b, c, in[5], 5){ (d) += ((((a)) & ((b))) | (((a)) & ((c))) | (((b)) &
((c)))) + (in[5]) + (guint32)0x5a827999; (d) = ((((d)) <<
((guint32)((5)))) | (((d)) >> (32 - (guint32)((5)))));
}
; /* 22 */
228 GG(c, d, a, b, in[9], 9){ (c) += ((((d)) & ((a))) | (((d)) & ((b))) | (((a)) &
((b)))) + (in[9]) + (guint32)0x5a827999; (c) = ((((c)) <<
((guint32)((9)))) | (((c)) >> (32 - (guint32)((9)))));
}
; /* 23 */
229 GG(b, c, d, a, in[13], 13){ (b) += ((((c)) & ((d))) | (((c)) & ((a))) | (((d)) &
((a)))) + (in[13]) + (guint32)0x5a827999; (b) = ((((b)) <<
((guint32)((13)))) | (((b)) >> (32 - (guint32)((13))))
); }
; /* 24 */
230 GG(a, b, c, d, in[2], 3){ (a) += ((((b)) & ((c))) | (((b)) & ((d))) | (((c)) &
((d)))) + (in[2]) + (guint32)0x5a827999; (a) = ((((a)) <<
((guint32)((3)))) | (((a)) >> (32 - (guint32)((3)))));
}
; /* 25 */
231 GG(d, a, b, c, in[6], 5){ (d) += ((((a)) & ((b))) | (((a)) & ((c))) | (((b)) &
((c)))) + (in[6]) + (guint32)0x5a827999; (d) = ((((d)) <<
((guint32)((5)))) | (((d)) >> (32 - (guint32)((5)))));
}
; /* 26 */
232 GG(c, d, a, b, in[10], 9){ (c) += ((((d)) & ((a))) | (((d)) & ((b))) | (((a)) &
((b)))) + (in[10]) + (guint32)0x5a827999; (c) = ((((c)) <<
((guint32)((9)))) | (((c)) >> (32 - (guint32)((9)))));
}
; /* 27 */
233 GG(b, c, d, a, in[14], 13){ (b) += ((((c)) & ((d))) | (((c)) & ((a))) | (((d)) &
((a)))) + (in[14]) + (guint32)0x5a827999; (b) = ((((b)) <<
((guint32)((13)))) | (((b)) >> (32 - (guint32)((13))))
); }
; /* 28 */
234 GG(a, b, c, d, in[3], 3){ (a) += ((((b)) & ((c))) | (((b)) & ((d))) | (((c)) &
((d)))) + (in[3]) + (guint32)0x5a827999; (a) = ((((a)) <<
((guint32)((3)))) | (((a)) >> (32 - (guint32)((3)))));
}
; /* 29 */
235 GG(d, a, b, c, in[7], 5){ (d) += ((((a)) & ((b))) | (((a)) & ((c))) | (((b)) &
((c)))) + (in[7]) + (guint32)0x5a827999; (d) = ((((d)) <<
((guint32)((5)))) | (((d)) >> (32 - (guint32)((5)))));
}
; /* 30 */
236 GG(c, d, a, b, in[11], 9){ (c) += ((((d)) & ((a))) | (((d)) & ((b))) | (((a)) &
((b)))) + (in[11]) + (guint32)0x5a827999; (c) = ((((c)) <<
((guint32)((9)))) | (((c)) >> (32 - (guint32)((9)))));
}
; /* 31 */
237 GG(b, c, d, a, in[15], 13){ (b) += ((((c)) & ((d))) | (((c)) & ((a))) | (((d)) &
((a)))) + (in[15]) + (guint32)0x5a827999; (b) = ((((b)) <<
((guint32)((13)))) | (((b)) >> (32 - (guint32)((13))))
); }
; /* 32 */
238
239 HH(a, b, c, d, in[0], 3){ (a) += (((b)) ^ ((c)) ^ ((d))) + (in[0]) + (guint32)0x6ed9eba1
; (a) = ((((a)) << ((guint32)((3)))) | (((a)) >> (
32 - (guint32)((3))))); }
; /* 33 */
240 HH(d, a, b, c, in[8], 9){ (d) += (((a)) ^ ((b)) ^ ((c))) + (in[8]) + (guint32)0x6ed9eba1
; (d) = ((((d)) << ((guint32)((9)))) | (((d)) >> (
32 - (guint32)((9))))); }
; /* 34 */
241 HH(c, d, a, b, in[4], 11){ (c) += (((d)) ^ ((a)) ^ ((b))) + (in[4]) + (guint32)0x6ed9eba1
; (c) = ((((c)) << ((guint32)((11)))) | (((c)) >>
(32 - (guint32)((11))))); }
; /* 35 */
242 HH(b, c, d, a, in[12], 15){ (b) += (((c)) ^ ((d)) ^ ((a))) + (in[12]) + (guint32)0x6ed9eba1
; (b) = ((((b)) << ((guint32)((15)))) | (((b)) >>
(32 - (guint32)((15))))); }
; /* 36 */
243 HH(a, b, c, d, in[2], 3){ (a) += (((b)) ^ ((c)) ^ ((d))) + (in[2]) + (guint32)0x6ed9eba1
; (a) = ((((a)) << ((guint32)((3)))) | (((a)) >> (
32 - (guint32)((3))))); }
; /* 37 */
244 HH(d, a, b, c, in[10], 9){ (d) += (((a)) ^ ((b)) ^ ((c))) + (in[10]) + (guint32)0x6ed9eba1
; (d) = ((((d)) << ((guint32)((9)))) | (((d)) >> (
32 - (guint32)((9))))); }
; /* 38 */
245 HH(c, d, a, b, in[6], 11){ (c) += (((d)) ^ ((a)) ^ ((b))) + (in[6]) + (guint32)0x6ed9eba1
; (c) = ((((c)) << ((guint32)((11)))) | (((c)) >>
(32 - (guint32)((11))))); }
; /* 39 */
246 HH(b, c, d, a, in[14], 15){ (b) += (((c)) ^ ((d)) ^ ((a))) + (in[14]) + (guint32)0x6ed9eba1
; (b) = ((((b)) << ((guint32)((15)))) | (((b)) >>
(32 - (guint32)((15))))); }
; /* 40 */
247 HH(a, b, c, d, in[1], 3){ (a) += (((b)) ^ ((c)) ^ ((d))) + (in[1]) + (guint32)0x6ed9eba1
; (a) = ((((a)) << ((guint32)((3)))) | (((a)) >> (
32 - (guint32)((3))))); }
; /* 41 */
248 HH(d, a, b, c, in[9], 9){ (d) += (((a)) ^ ((b)) ^ ((c))) + (in[9]) + (guint32)0x6ed9eba1
; (d) = ((((d)) << ((guint32)((9)))) | (((d)) >> (
32 - (guint32)((9))))); }
; /* 42 */
249 HH(c, d, a, b, in[5], 11){ (c) += (((d)) ^ ((a)) ^ ((b))) + (in[5]) + (guint32)0x6ed9eba1
; (c) = ((((c)) << ((guint32)((11)))) | (((c)) >>
(32 - (guint32)((11))))); }
; /* 43 */
250 HH(b, c, d, a, in[13], 15){ (b) += (((c)) ^ ((d)) ^ ((a))) + (in[13]) + (guint32)0x6ed9eba1
; (b) = ((((b)) << ((guint32)((15)))) | (((b)) >>
(32 - (guint32)((15))))); }
; /* 44 */
251 HH(a, b, c, d, in[3], 3){ (a) += (((b)) ^ ((c)) ^ ((d))) + (in[3]) + (guint32)0x6ed9eba1
; (a) = ((((a)) << ((guint32)((3)))) | (((a)) >> (
32 - (guint32)((3))))); }
; /* 45 */
252 HH(d, a, b, c, in[11], 9){ (d) += (((a)) ^ ((b)) ^ ((c))) + (in[11]) + (guint32)0x6ed9eba1
; (d) = ((((d)) << ((guint32)((9)))) | (((d)) >> (
32 - (guint32)((9))))); }
; /* 46 */
253 HH(c, d, a, b, in[7], 11){ (c) += (((d)) ^ ((a)) ^ ((b))) + (in[7]) + (guint32)0x6ed9eba1
; (c) = ((((c)) << ((guint32)((11)))) | (((c)) >>
(32 - (guint32)((11))))); }
; /* 47 */
254 HH(b, c, d, a, in[15], 15){ (b) += (((c)) ^ ((d)) ^ ((a))) + (in[15]) + (guint32)0x6ed9eba1
; (b) = ((((b)) << ((guint32)((15)))) | (((b)) >>
(32 - (guint32)((15))))); }
; /* 48 */
255
256 buf[0] += a;
257 buf[1] += b;
258 buf[2] += c;
259 buf[3] += d;
260}
261
262int MD4Keycrunch( char *result, const char *seed, const char *passphrase)
263{
264 int len;
265 char *buf;
266 MD4_CTX md;
267 guint32 results[4];
268
269 len = strlen(seed) + strlen(passphrase);
270 buf = (char *)malloc(len+1);
271 if (buf == NULL((void*)0))
272 return -1;
273
274 strcpy(buf, seed);
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
275 skey_lowcase(buf);
276 strcat(buf, passphrase);
277 skey_sevenbit(buf);
278
279 MD4Init(&md);
280 MD4Update(&md, (unsigned char *)buf, len);
281 MD4Final((unsigned char *)results, &md);
282 free(buf);
283
284 results[0] ^= results[2];
285 results[1] ^= results[3];
286 memcpy((void *)result, (void *)results, SKEY_SIZE8);
287
288 return 0;
289}
290
291void MD4SKey(char *x)
292{
293 MD4_CTX md;
294 guint32 results[4];
295
296 MD4Init(&md);
297 MD4Update(&md, (unsigned char *)x, SKEY_SIZE8);
298 MD4Final((unsigned char *)results, &md);
299
300 results[0] ^= results[2];
301 results[1] ^= results[3];
302
303 memcpy((void *)x, (void *)results, SKEY_SIZE8);
304}
305
306#ifdef MD4_MAIN
307
308#include <stdio.h>
309#include <unistd.h>
310#include <stdlib.h>
311
312int main(int argc, char *argv[])
313{
314 MD4_CTX *md4;
315 unsigned char digest[16];
316 unsigned char data[1024];
317 int i, r;
318
319 memset(digest, 0, 16);
320 printf("MD4 digest algorithm. End with Ctrl-D:\n");
321
322 md4 = (MD4_CTX *)malloc(sizeof(MD4_CTX));
323 MD4Init(md4);
324 do
325 {
326 r = read(0, data, sizeof data);
327 MD4Update(md4, data, r);
328 }
329 while (r);
330
331 MD4Final(digest, md4);
332 printf("MD4 Digest is: ");
333 for (i = 0; i < 16; i++)
334 printf("%02X", digest[i]);
335
336 printf("\n");
337 free(md4);
338 return 0;
339}
340
341#endif
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-cf3974.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-cf3974.html new file mode 100644 index 0000000..ad6bdf6 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-cf3974.html @@ -0,0 +1,2089 @@ + + + +eggsmclient-xsmp.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:mate-submodules/libegg/eggsmclient-xsmp.c
Warning:line 1232, column 18
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name eggsmclient-xsmp.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src/mate-submodules/libegg -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I ../../.. -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/at-spi2-atk/2.0 -I /usr/include/cloudproviders -I /usr/include/blkid -I /usr/include/at-spi-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/libmount -I /usr/include/pixman-1 -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/sysprof-6 -I /usr/include/libpng16 -D EGG_SM_CLIENT_BACKEND_XSMP -D G_LOG_DOMAIN="EggSMClient" -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/at-spi2-atk/2.0 -I /usr/include/cloudproviders -I /usr/include/blkid -I /usr/include/at-spi-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/libmount -I /usr/include/pixman-1 -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/sysprof-6 -I /usr/include/libpng16 -D PIC -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src/mate-submodules/libegg -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c eggsmclient-xsmp.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright (C) 2007 Novell, Inc.
3 *
4 * Inspired by various other pieces of code including GsmClient (C)
5 * 2001 Havoc Pennington, MateClient (C) 1998 Carsten Schaar, and twm
6 * session code (C) 1998 The Open Group.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 */
23
24#include "config.h"
25
26#include "eggsmclient.h"
27#include "eggsmclient-private.h"
28
29#include "eggdesktopfile.h"
30
31#include <errno(*__errno_location ()).h>
32#include <fcntl.h>
33#include <stdlib.h>
34#include <string.h>
35#include <unistd.h>
36#include <X11/SM/SMlib.h>
37
38#include <gtk/gtk.h>
39#include <gdk/gdk.h>
40
41#ifdef GDK_WINDOWING_X11
42#include <gdk/gdkx.h>
43#endif
44
45#define EGG_TYPE_SM_CLIENT_XSMP(egg_sm_client_xsmp_get_type ()) (egg_sm_client_xsmp_get_type ())
46#define EGG_SM_CLIENT_XSMP(obj)((((EggSMClientXSMP*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((obj)), ((egg_sm_client_xsmp_get_type ()))))))
(G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMP)(((EggSMClientXSMP*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((obj)), ((egg_sm_client_xsmp_get_type ())))))
)
47#define EGG_SM_CLIENT_XSMP_CLASS(klass)((((EggSMClientXSMPClass*) (void *) g_type_check_class_cast (
(GTypeClass*) ((klass)), ((egg_sm_client_xsmp_get_type ()))))
))
(G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMPClass)(((EggSMClientXSMPClass*) (void *) g_type_check_class_cast ((
GTypeClass*) ((klass)), ((egg_sm_client_xsmp_get_type ())))))
)
48#define EGG_IS_SM_CLIENT_XSMP(obj)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(obj)); GType __t = ((egg_sm_client_xsmp_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_SM_CLIENT_XSMP)((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(obj)); GType __t = ((egg_sm_client_xsmp_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))
)
49#define EGG_IS_SM_CLIENT_XSMP_CLASS(klass)(((__extension__ ({ GTypeClass *__class = (GTypeClass*) ((klass
)); GType __t = ((egg_sm_client_xsmp_get_type ())); gboolean __r
; if (!__class) __r = (0); else if (__class->g_type == __t
) __r = (!(0)); else __r = g_type_check_class_is_a (__class, __t
); __r; }))))
(G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_SM_CLIENT_XSMP)((__extension__ ({ GTypeClass *__class = (GTypeClass*) ((klass
)); GType __t = ((egg_sm_client_xsmp_get_type ())); gboolean __r
; if (!__class) __r = (0); else if (__class->g_type == __t
) __r = (!(0)); else __r = g_type_check_class_is_a (__class, __t
); __r; })))
)
50#define EGG_SM_CLIENT_XSMP_GET_CLASS(obj)((((EggSMClientXSMPClass*) (((GTypeInstance*) ((obj)))->g_class
))))
(G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMPClass)(((EggSMClientXSMPClass*) (((GTypeInstance*) ((obj)))->g_class
)))
)
51
52typedef struct _EggSMClientXSMP EggSMClientXSMP;
53typedef struct _EggSMClientXSMPClass EggSMClientXSMPClass;
54
55/* These mostly correspond to the similarly-named states in section
56 * 9.1 of the XSMP spec. Some of the states there aren't represented
57 * here, because we don't need them. SHUTDOWN_CANCELLED is slightly
58 * different from the spec; we use it when the client is IDLE after a
59 * ShutdownCancelled message, but the application is still interacting
60 * and doesn't know the shutdown has been cancelled yet.
61 */
62typedef enum
63{
64 XSMP_STATE_IDLE,
65 XSMP_STATE_SAVE_YOURSELF,
66 XSMP_STATE_INTERACT_REQUEST,
67 XSMP_STATE_INTERACT,
68 XSMP_STATE_SAVE_YOURSELF_DONE,
69 XSMP_STATE_SHUTDOWN_CANCELLED,
70 XSMP_STATE_CONNECTION_CLOSED
71} EggSMClientXSMPState;
72
73static const char *state_names[] =
74{
75 "idle",
76 "save-yourself",
77 "interact-request",
78 "interact",
79 "save-yourself-done",
80 "shutdown-cancelled",
81 "connection-closed"
82};
83
84#define EGG_SM_CLIENT_XSMP_STATE(xsmp)(state_names[(xsmp)->state]) (state_names[(xsmp)->state])
85
86struct _EggSMClientXSMP
87{
88 EggSMClient parent;
89
90 SmcConn connection;
91 char *client_id;
92
93 EggSMClientXSMPState state;
94 char **restart_command;
95 gboolean set_restart_command;
96 int restart_style;
97 char **discard_command;
98 gboolean set_discard_command;
99
100 guint idle;
101
102 /* Current SaveYourself state */
103 guint expecting_initial_save_yourself : 1;
104 guint need_save_state : 1;
105 guint need_quit_requested : 1;
106 guint interact_errors : 1;
107 guint shutting_down : 1;
108
109 /* Todo list */
110 guint waiting_to_set_initial_properties : 1;
111 guint waiting_to_emit_quit : 1;
112 guint waiting_to_emit_quit_cancelled : 1;
113 guint waiting_to_save_myself : 1;
114
115};
116
117struct _EggSMClientXSMPClass
118{
119 EggSMClientClass parent_class;
120
121};
122
123static void sm_client_xsmp_startup (EggSMClient *client,
124 const char *client_id);
125static void sm_client_xsmp_set_restart_command (EggSMClient *client,
126 int argc,
127 const char **argv);
128static void sm_client_xsmp_set_discard_command (EggSMClient *client,
129 int argc,
130 const char **argv);
131static void sm_client_xsmp_will_quit (EggSMClient *client,
132 gboolean will_quit);
133static gboolean sm_client_xsmp_end_session (EggSMClient *client,
134 EggSMClientEndStyle style,
135 gboolean request_confirmation);
136
137static void xsmp_save_yourself (SmcConn smc_conn,
138 SmPointer client_data,
139 int save_style,
140 Boolint shutdown,
141 int interact_style,
142 Boolint fast);
143static void xsmp_die (SmcConn smc_conn,
144 SmPointer client_data);
145static void xsmp_save_complete (SmcConn smc_conn,
146 SmPointer client_data);
147static void xsmp_shutdown_cancelled (SmcConn smc_conn,
148 SmPointer client_data);
149static void xsmp_interact (SmcConn smc_conn,
150 SmPointer client_data);
151
152static SmProp *array_prop (const char *name,
153 ...);
154static SmProp *ptrarray_prop (const char *name,
155 GPtrArray *values);
156static SmProp *string_prop (const char *name,
157 const char *value);
158static SmProp *card8_prop (const char *name,
159 unsigned char value);
160
161static void set_properties (EggSMClientXSMP *xsmp, ...);
162static void delete_properties (EggSMClientXSMP *xsmp, ...);
163
164static GPtrArray *generate_command (char **restart_command,
165 const char *client_id,
166 const char *state_file);
167
168static void save_state (EggSMClientXSMP *xsmp);
169static void do_save_yourself (EggSMClientXSMP *xsmp);
170static void update_pending_events (EggSMClientXSMP *xsmp);
171
172static void ice_init (void);
173static gboolean process_ice_messages (IceConn ice_conn);
174static void smc_error_handler (SmcConn smc_conn,
175 Boolint swap,
176 int offending_minor_opcode,
177 unsigned long offending_sequence,
178 int error_class,
179 int severity,
180 SmPointer values);
181
182G_DEFINE_TYPE (EggSMClientXSMP, egg_sm_client_xsmp, EGG_TYPE_SM_CLIENT)static void egg_sm_client_xsmp_init (EggSMClientXSMP *self); static
void egg_sm_client_xsmp_class_init (EggSMClientXSMPClass *klass
); static GType egg_sm_client_xsmp_get_type_once (void); static
gpointer egg_sm_client_xsmp_parent_class = ((void*)0); static
gint EggSMClientXSMP_private_offset; static void egg_sm_client_xsmp_class_intern_init
(gpointer klass) { egg_sm_client_xsmp_parent_class = g_type_class_peek_parent
(klass); if (EggSMClientXSMP_private_offset != 0) g_type_class_adjust_private_offset
(klass, &EggSMClientXSMP_private_offset); egg_sm_client_xsmp_class_init
((EggSMClientXSMPClass*) klass); } __attribute__ ((__unused__
)) static inline gpointer egg_sm_client_xsmp_get_instance_private
(EggSMClientXSMP *self) { return (((gpointer) ((guint8*) (self
) + (glong) (EggSMClientXSMP_private_offset)))); } GType egg_sm_client_xsmp_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ _Static_assert (sizeof *(&static_g_define_type_id) ==
sizeof (gpointer), "Expression evaluates to false"); (void) (
0 ? (gpointer) *(&static_g_define_type_id) : ((void*)0));
(!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = egg_sm_client_xsmp_get_type_once
(); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } __attribute__ ((__noinline__)) static GType egg_sm_client_xsmp_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((egg_sm_client_get_type ()), g_intern_static_string ("EggSMClientXSMP"
), sizeof (EggSMClientXSMPClass), (GClassInitFunc)(void (*)(void
)) egg_sm_client_xsmp_class_intern_init, sizeof (EggSMClientXSMP
), (GInstanceInitFunc)(void (*)(void)) egg_sm_client_xsmp_init
, (GTypeFlags) 0); { {{};} } return g_define_type_id; }
183
184static void
185egg_sm_client_xsmp_init (EggSMClientXSMP *xsmp)
186{
187 xsmp->state = XSMP_STATE_CONNECTION_CLOSED;
188 xsmp->connection = NULL((void*)0);
189 xsmp->restart_style = SmRestartIfRunning0;
190}
191
192static void
193egg_sm_client_xsmp_class_init (EggSMClientXSMPClass *klass)
194{
195 EggSMClientClass *sm_client_class = EGG_SM_CLIENT_CLASS (klass);
196
197 sm_client_class->startup = sm_client_xsmp_startup;
198 sm_client_class->set_restart_command = sm_client_xsmp_set_restart_command;
199 sm_client_class->set_discard_command = sm_client_xsmp_set_discard_command;
200 sm_client_class->will_quit = sm_client_xsmp_will_quit;
201 sm_client_class->end_session = sm_client_xsmp_end_session;
202}
203
204EggSMClient *
205egg_sm_client_xsmp_new (void)
206{
207 if (!g_getenv ("SESSION_MANAGER"))
208 return NULL((void*)0);
209
210 return g_object_new (EGG_TYPE_SM_CLIENT_XSMP(egg_sm_client_xsmp_get_type ()), NULL((void*)0));
211}
212
213static gboolean
214sm_client_xsmp_set_initial_properties (gpointer user_data)
215{
216 EggSMClientXSMP *xsmp = user_data;
217 EggDesktopFile *desktop_file;
218 GPtrArray *clone, *restart;
219 char pid_str[64];
220
221 if (xsmp->idle)
222 {
223 g_source_remove (xsmp->idle);
224 xsmp->idle = 0;
225 }
226 xsmp->waiting_to_set_initial_properties = FALSE(0);
227
228 if (egg_sm_client_get_mode () == EGG_SM_CLIENT_MODE_NO_RESTART)
229 xsmp->restart_style = SmRestartNever3;
230
231 /* Parse info out of desktop file */
232 desktop_file = egg_get_desktop_file ();
233 if (desktop_file)
234 {
235 GError *err = NULL((void*)0);
236 char **argv;
237 int argc;
238
239 if (xsmp->restart_style == SmRestartIfRunning0)
240 {
241 if (egg_desktop_file_get_boolean (desktop_file,
242 "X-MATE-AutoRestart", NULL((void*)0)))
243 xsmp->restart_style = SmRestartImmediately2;
244 }
245
246 if (!xsmp->set_restart_command)
247 {
248 char *cmdline;
249
250 cmdline = egg_desktop_file_parse_exec (desktop_file, NULL((void*)0), &err);
251 if (cmdline && g_shell_parse_argv (cmdline, &argc, &argv, &err))
252 {
253 egg_sm_client_set_restart_command (EGG_SM_CLIENT (xsmp),
254 argc, (const char **)argv);
255 g_strfreev (argv);
256 }
257 else
258 {
259 g_warning ("Could not parse Exec line in desktop file: %s",
260 err->message);
261 g_error_free (err);
262 }
263 g_free (cmdline);
264 }
265 }
266
267 if (!xsmp->set_restart_command)
268 xsmp->restart_command = g_strsplit (g_get_prgname (), " ", -1);
269
270 clone = generate_command (xsmp->restart_command, NULL((void*)0), NULL((void*)0));
271 restart = generate_command (xsmp->restart_command, xsmp->client_id, NULL((void*)0));
272
273 g_debug ("Setting initial properties");
274
275 /* Program, CloneCommand, RestartCommand, and UserID are required.
276 * ProcessID isn't required, but the SM may be able to do something
277 * useful with it.
278 */
279 g_snprintf (pid_str, sizeof (pid_str), "%lu", (gulong) getpid ());
280 set_properties (xsmp,
281 string_prop (SmProgram"Program", g_get_prgname ()),
282 ptrarray_prop (SmCloneCommand"CloneCommand", clone),
283 ptrarray_prop (SmRestartCommand"RestartCommand", restart),
284 string_prop (SmUserID"UserID", g_get_user_name ()),
285 string_prop (SmProcessID"ProcessID", pid_str),
286 card8_prop (SmRestartStyleHint"RestartStyleHint", xsmp->restart_style),
287 NULL((void*)0));
288 g_ptr_array_free (clone, TRUE(!(0)));
289 g_ptr_array_free (restart, TRUE(!(0)));
290
291 if (desktop_file)
292 {
293 set_properties (xsmp,
294 string_prop ("_GSM_DesktopFile", egg_desktop_file_get_source (desktop_file)),
295 NULL((void*)0));
296 }
297
298 update_pending_events (xsmp);
299 return FALSE(0);
300}
301
302/* This gets called from two different places: xsmp_die() (when the
303 * server asks us to disconnect) and process_ice_messages() (when the
304 * server disconnects unexpectedly).
305 */
306static void
307sm_client_xsmp_disconnect (EggSMClientXSMP *xsmp)
308{
309 SmcConn connection;
310
311 if (!xsmp->connection)
312 return;
313
314 g_debug ("Disconnecting");
315
316 connection = xsmp->connection;
317 xsmp->connection = NULL((void*)0);
318 SmcCloseConnection (connection, 0, NULL((void*)0));
319 xsmp->state = XSMP_STATE_CONNECTION_CLOSED;
320
321 xsmp->waiting_to_save_myself = FALSE(0);
322 update_pending_events (xsmp);
323}
324
325static void
326sm_client_xsmp_startup (EggSMClient *client,
327 const char *client_id)
328{
329 EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
330 SmcCallbacks callbacks;
331 char *ret_client_id;
332 char error_string_ret[256];
333
334 xsmp->client_id = g_strdup (client_id)g_strdup_inline (client_id);
335
336 ice_init ();
337 SmcSetErrorHandler (smc_error_handler);
338
339 callbacks.save_yourself.callback = xsmp_save_yourself;
340 callbacks.die.callback = xsmp_die;
341 callbacks.save_complete.callback = xsmp_save_complete;
342 callbacks.shutdown_cancelled.callback = xsmp_shutdown_cancelled;
343
344 callbacks.save_yourself.client_data = xsmp;
345 callbacks.die.client_data = xsmp;
346 callbacks.save_complete.client_data = xsmp;
347 callbacks.shutdown_cancelled.client_data = xsmp;
348
349 client_id = NULL((void*)0);
350 error_string_ret[0] = '\0';
351 xsmp->connection =
352 SmcOpenConnection (NULL((void*)0), xsmp, SmProtoMajor1, SmProtoMinor0,
353 SmcSaveYourselfProcMask(1L << 0) | SmcDieProcMask(1L << 1) |
354 SmcSaveCompleteProcMask(1L << 2) |
355 SmcShutdownCancelledProcMask(1L << 3),
356 &callbacks,
357 xsmp->client_id, &ret_client_id,
358 sizeof (error_string_ret), error_string_ret);
359
360 if (!xsmp->connection)
361 {
362 g_warning ("Failed to connect to the session manager: %s\n",
363 error_string_ret[0] ?
364 error_string_ret : "no error message given");
365 xsmp->state = XSMP_STATE_CONNECTION_CLOSED;
366 return;
367 }
368
369 /* We expect a pointless initial SaveYourself if either (a) we
370 * didn't have an initial client ID, or (b) we DID have an initial
371 * client ID, but the server rejected it and gave us a new one.
372 */
373 if (!xsmp->client_id ||
374 (ret_client_id && strcmp (xsmp->client_id, ret_client_id) != 0))
375 xsmp->expecting_initial_save_yourself = TRUE(!(0));
376
377 if (ret_client_id)
378 {
379 g_free (xsmp->client_id);
380 xsmp->client_id = g_strdup (ret_client_id)g_strdup_inline (ret_client_id);
381 free (ret_client_id);
382
383#ifdef GDK_WINDOWING_X11
384 if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(gdk_display_get_default ())); GType __t = ((gdk_x11_display_get_type
())); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; }))))
)
385 gdk_x11_set_sm_client_id (xsmp->client_id);
386#endif
387
388 g_debug ("Got client ID \"%s\"", xsmp->client_id);
389 }
390
391 xsmp->state = XSMP_STATE_IDLE;
392
393 /* Do not set the initial properties until we reach the main loop,
394 * so that the application has a chance to call
395 * egg_set_desktop_file(). (This may also help the session manager
396 * have a better idea of when the application is fully up and
397 * running.)
398 */
399 xsmp->waiting_to_set_initial_properties = TRUE(!(0));
400 xsmp->idle = g_idle_add (sm_client_xsmp_set_initial_properties, client);
401}
402
403static void
404sm_client_xsmp_set_restart_command (EggSMClient *client,
405 int argc,
406 const char **argv)
407{
408 EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
409 int i;
410
411 g_strfreev (xsmp->restart_command);
412
413 xsmp->restart_command = g_new (char *, argc + 1)((char * *) g_malloc_n ((argc + 1), sizeof (char *)));
414 for (i = 0; i < argc; i++)
415 xsmp->restart_command[i] = g_strdup (argv[i])g_strdup_inline (argv[i]);
416 xsmp->restart_command[i] = NULL((void*)0);
417
418 xsmp->set_restart_command = TRUE(!(0));
419}
420
421static void
422sm_client_xsmp_set_discard_command (EggSMClient *client,
423 int argc,
424 const char **argv)
425{
426 EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
427 int i;
428
429 g_strfreev (xsmp->discard_command);
430
431 xsmp->discard_command = g_new (char *, argc + 1)((char * *) g_malloc_n ((argc + 1), sizeof (char *)));
432 for (i = 0; i < argc; i++)
433 xsmp->discard_command[i] = g_strdup (argv[i])g_strdup_inline (argv[i]);
434 xsmp->discard_command[i] = NULL((void*)0);
435
436 xsmp->set_discard_command = TRUE(!(0));
437}
438
439static void
440sm_client_xsmp_will_quit (EggSMClient *client,
441 gboolean will_quit)
442{
443 EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
444
445 if (xsmp->state == XSMP_STATE_CONNECTION_CLOSED)
446 {
447 /* The session manager has already exited! Schedule a quit
448 * signal.
449 */
450 xsmp->waiting_to_emit_quit = TRUE(!(0));
451 update_pending_events (xsmp);
452 return;
453 }
454 else if (xsmp->state == XSMP_STATE_SHUTDOWN_CANCELLED)
455 {
456 /* We received a ShutdownCancelled message while the application
457 * was interacting; Schedule a quit_cancelled signal.
458 */
459 xsmp->waiting_to_emit_quit_cancelled = TRUE(!(0));
460 update_pending_events (xsmp);
461 return;
462 }
463
464 g_return_if_fail (xsmp->state == XSMP_STATE_INTERACT)do { if ((xsmp->state == XSMP_STATE_INTERACT)) { } else { g_return_if_fail_warning
("EggSMClient", ((const char*) (__func__)), "xsmp->state == XSMP_STATE_INTERACT"
); return; } } while (0)
;
465
466 g_debug ("Sending InteractDone(%s)", will_quit ? "False" : "True");
467 SmcInteractDone (xsmp->connection, !will_quit);
468
469 if (will_quit && xsmp->need_save_state)
470 save_state (xsmp);
471
472 g_debug ("Sending SaveYourselfDone(%s)", will_quit ? "True" : "False");
473 SmcSaveYourselfDone (xsmp->connection, will_quit);
474 xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE;
475}
476
477static gboolean
478sm_client_xsmp_end_session (EggSMClient *client,
479 EggSMClientEndStyle style,
480 gboolean request_confirmation)
481{
482 EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
483 int save_type;
484
485 /* To end the session via XSMP, we have to send a
486 * SaveYourselfRequest. We aren't allowed to do that if anything
487 * else is going on, but we don't want to expose this fact to the
488 * application. So we do our best to patch things up here...
489 *
490 * In the worst case, this method might block for some length of
491 * time in process_ice_messages, but the only time that code path is
492 * honestly likely to get hit is if the application tries to end the
493 * session as the very first thing it does, in which case it
494 * probably won't actually block anyway. It's not worth gunking up
495 * the API to try to deal nicely with the other 0.01% of cases where
496 * this happens.
497 */
498
499 while (xsmp->state != XSMP_STATE_IDLE ||
500 xsmp->expecting_initial_save_yourself)
501 {
502 /* If we're already shutting down, we don't need to do anything. */
503 if (xsmp->shutting_down)
504 return TRUE(!(0));
505
506 switch (xsmp->state)
507 {
508 case XSMP_STATE_CONNECTION_CLOSED:
509 return FALSE(0);
510
511 case XSMP_STATE_SAVE_YOURSELF:
512 /* Trying to log out from the save_state callback? Whatever.
513 * Abort the save_state.
514 */
515 SmcSaveYourselfDone (xsmp->connection, FALSE(0));
516 xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE;
517 break;
518
519 case XSMP_STATE_INTERACT_REQUEST:
520 case XSMP_STATE_INTERACT:
521 case XSMP_STATE_SHUTDOWN_CANCELLED:
522 /* Already in a shutdown-related state, just ignore
523 * the new shutdown request...
524 */
525 return TRUE(!(0));
526
527 case XSMP_STATE_IDLE:
528 if (xsmp->waiting_to_set_initial_properties)
529 sm_client_xsmp_set_initial_properties (xsmp);
530
531 if (!xsmp->expecting_initial_save_yourself)
532 break;
533 /* else fall through */
534
535 case XSMP_STATE_SAVE_YOURSELF_DONE:
536 /* We need to wait for some response from the server.*/
537 process_ice_messages (SmcGetIceConnection (xsmp->connection));
538 break;
539
540 default:
541 /* Hm... shouldn't happen */
542 return FALSE(0);
543 }
544 }
545
546 /* xfce4-session will do the wrong thing if we pass SmSaveGlobal and
547 * the user chooses to save the session. But mate-session will do
548 * the wrong thing if we pass SmSaveBoth and the user chooses NOT to
549 * save the session... Sigh.
550 */
551 if (!strcmp (SmcVendor (xsmp->connection), "xfce4-session"))
552 save_type = SmSaveBoth2;
553 else
554 save_type = SmSaveGlobal0;
555
556 g_debug ("Sending SaveYourselfRequest(SmSaveGlobal, Shutdown, SmInteractStyleAny, %sFast)", request_confirmation ? "!" : "");
557 SmcRequestSaveYourself (xsmp->connection,
558 save_type,
559 True1, /* shutdown */
560 SmInteractStyleAny2,
561 !request_confirmation, /* fast */
562 True1 /* global */);
563 return TRUE(!(0));
564}
565
566static gboolean
567idle_do_pending_events (gpointer data)
568{
569 EggSMClientXSMP *xsmp = data;
570 EggSMClient *client = data;
571
572 xsmp->idle = 0;
573
574 if (xsmp->waiting_to_emit_quit)
575 {
576 xsmp->waiting_to_emit_quit = FALSE(0);
577 egg_sm_client_quit (client);
578 goto out;
579 }
580
581 if (xsmp->waiting_to_emit_quit_cancelled)
582 {
583 xsmp->waiting_to_emit_quit_cancelled = FALSE(0);
584 egg_sm_client_quit_cancelled (client);
585 xsmp->state = XSMP_STATE_IDLE;
586 }
587
588 if (xsmp->waiting_to_save_myself)
589 {
590 xsmp->waiting_to_save_myself = FALSE(0);
591 do_save_yourself (xsmp);
592 }
593
594out:
595 return FALSE(0);
596}
597
598static void
599update_pending_events (EggSMClientXSMP *xsmp)
600{
601 gboolean want_idle =
602 xsmp->waiting_to_emit_quit ||
603 xsmp->waiting_to_emit_quit_cancelled ||
604 xsmp->waiting_to_save_myself;
605
606 if (want_idle)
607 {
608 if (xsmp->idle == 0)
609 xsmp->idle = g_idle_add (idle_do_pending_events, xsmp);
610 }
611 else
612 {
613 if (xsmp->idle != 0)
614 g_source_remove (xsmp->idle);
615 xsmp->idle = 0;
616 }
617}
618
619static void
620fix_broken_state (EggSMClientXSMP *xsmp, const char *message,
621 gboolean send_interact_done,
622 gboolean send_save_yourself_done)
623{
624 g_warning ("Received XSMP %s message in state %s: client or server error",
625 message, EGG_SM_CLIENT_XSMP_STATE (xsmp)(state_names[(xsmp)->state]));
626
627 /* Forget any pending SaveYourself plans we had */
628 xsmp->waiting_to_save_myself = FALSE(0);
629 update_pending_events (xsmp);
630
631 if (send_interact_done)
632 SmcInteractDone (xsmp->connection, False0);
633 if (send_save_yourself_done)
634 SmcSaveYourselfDone (xsmp->connection, True1);
635
636 xsmp->state = send_save_yourself_done ? XSMP_STATE_SAVE_YOURSELF_DONE : XSMP_STATE_IDLE;
637}
638
639/* SM callbacks */
640
641static void
642xsmp_save_yourself (SmcConn smc_conn,
643 SmPointer client_data,
644 int save_type,
645 Boolint shutdown,
646 int interact_style,
647 Boolint fast)
648{
649 EggSMClientXSMP *xsmp = client_data;
650 gboolean wants_quit_requested;
651
652 g_debug ("Received SaveYourself(%s, %s, %s, %s) in state %s",
653 save_type == SmSaveLocal1 ? "SmSaveLocal" :
654 save_type == SmSaveGlobal0 ? "SmSaveGlobal" : "SmSaveBoth",
655 shutdown ? "Shutdown" : "!Shutdown",
656 interact_style == SmInteractStyleAny2 ? "SmInteractStyleAny" :
657 interact_style == SmInteractStyleErrors1 ? "SmInteractStyleErrors" :
658 "SmInteractStyleNone", fast ? "Fast" : "!Fast",
659 EGG_SM_CLIENT_XSMP_STATE (xsmp)(state_names[(xsmp)->state]));
660
661 if (xsmp->state != XSMP_STATE_IDLE &&
662 xsmp->state != XSMP_STATE_SHUTDOWN_CANCELLED)
663 {
664 fix_broken_state (xsmp, "SaveYourself", FALSE(0), TRUE(!(0)));
665 return;
666 }
667
668 if (xsmp->waiting_to_set_initial_properties)
669 sm_client_xsmp_set_initial_properties (xsmp);
670
671 /* If this is the initial SaveYourself, ignore it; we've already set
672 * properties and there's no reason to actually save state too.
673 */
674 if (xsmp->expecting_initial_save_yourself)
675 {
676 xsmp->expecting_initial_save_yourself = FALSE(0);
677
678 if (save_type == SmSaveLocal1 &&
679 interact_style == SmInteractStyleNone0 &&
680 !shutdown && !fast)
681 {
682 g_debug ("Sending SaveYourselfDone(True) for initial SaveYourself");
683 SmcSaveYourselfDone (xsmp->connection, True1);
684 /* As explained in the comment at the end of
685 * do_save_yourself(), SAVE_YOURSELF_DONE is the correct
686 * state here, not IDLE.
687 */
688 xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE;
689 return;
690 }
691 else
692 g_warning ("First SaveYourself was not the expected one!");
693 }
694
695 /* Even ignoring the "fast" flag completely, there are still 18
696 * different combinations of save_type, shutdown and interact_style.
697 * We interpret them as follows:
698 *
699 * Type Shutdown Interact Interpretation
700 * G F A/E/N do nothing (1)
701 * G T N do nothing (1)*
702 * G T A/E quit_requested (2)
703 * L/B F A/E/N save_state (3)
704 * L/B T N save_state (3)*
705 * L/B T A/E quit_requested, then save_state (4)
706 *
707 * 1. Do nothing, because the SM asked us to do something
708 * uninteresting (save open files, but then don't quit
709 * afterward) or rude (save open files without asking the user
710 * for confirmation).
711 *
712 * 2. Request interaction and then emit ::quit_requested. This
713 * perhaps isn't quite correct for the SmInteractStyleErrors
714 * case, but we don't care.
715 *
716 * 3. Emit ::save_state. The SmSaveBoth SaveYourselfs in these
717 * rows essentially get demoted to SmSaveLocal, because their
718 * Global halves correspond to "do nothing".
719 *
720 * 4. Request interaction, emit ::quit_requested, and then emit
721 * ::save_state after interacting. This is the SmSaveBoth
722 * equivalent of #2, but we also promote SmSaveLocal shutdown
723 * SaveYourselfs to SmSaveBoth here, because we want to give
724 * the user a chance to save open files before quitting.
725 *
726 * (* It would be nice if we could do something useful when the
727 * session manager sends a SaveYourself with shutdown True and
728 * SmInteractStyleNone. But we can't, so we just pretend it didn't
729 * even tell us it was shutting down. The docs for ::quit mention
730 * that it might not always be preceded by ::quit_requested.)
731 */
732
733 /* As an optimization, we don't actually request interaction and
734 * emit ::quit_requested if the application isn't listening to the
735 * signal.
736 */
737 wants_quit_requested = g_signal_has_handler_pending (xsmp, g_signal_lookup ("quit_requested", EGG_TYPE_SM_CLIENT(egg_sm_client_get_type ())), 0, FALSE(0));
738
739 xsmp->need_save_state = (save_type != SmSaveGlobal0);
740 xsmp->need_quit_requested = (shutdown && wants_quit_requested &&
741 interact_style != SmInteractStyleNone0);
742 xsmp->interact_errors = (interact_style == SmInteractStyleErrors1);
743
744 xsmp->shutting_down = shutdown;
745
746 do_save_yourself (xsmp);
747}
748
749static void
750do_save_yourself (EggSMClientXSMP *xsmp)
751{
752 if (xsmp->state == XSMP_STATE_SHUTDOWN_CANCELLED)
753 {
754 /* The SM cancelled a previous SaveYourself, but we haven't yet
755 * had a chance to tell the application, so we can't start
756 * processing this SaveYourself yet.
757 */
758 xsmp->waiting_to_save_myself = TRUE(!(0));
759 update_pending_events (xsmp);
760 return;
761 }
762
763 if (xsmp->need_quit_requested)
764 {
765 xsmp->state = XSMP_STATE_INTERACT_REQUEST;
766
767 g_debug ("Sending InteractRequest(%s)",
768 xsmp->interact_errors ? "Error" : "Normal");
769 SmcInteractRequest (xsmp->connection,
770 xsmp->interact_errors ? SmDialogError0 : SmDialogNormal1,
771 xsmp_interact,
772 xsmp);
773 return;
774 }
775
776 if (xsmp->need_save_state)
777 {
778 save_state (xsmp);
779
780 /* Though unlikely, the client could have been disconnected
781 * while the application was saving its state.
782 */
783 if (!xsmp->connection)
784 return;
785 }
786
787 g_debug ("Sending SaveYourselfDone(True)");
788 SmcSaveYourselfDone (xsmp->connection, True1);
789
790 /* The client state diagram in the XSMP spec says that after a
791 * non-shutdown SaveYourself, we go directly back to "idle". But
792 * everything else in both the XSMP spec and the libSM docs
793 * disagrees.
794 */
795 xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE;
796}
797
798static void
799save_state (EggSMClientXSMP *xsmp)
800{
801 GKeyFile *state_file;
802 char *state_file_path, *data;
803 EggDesktopFile *desktop_file;
804 GPtrArray *restart, *discard;
805 int offset, fd;
806
807 /* We set xsmp->state before emitting save_state, but our caller is
808 * responsible for setting it back afterward.
809 */
810 xsmp->state = XSMP_STATE_SAVE_YOURSELF;
811
812 state_file = egg_sm_client_save_state ((EggSMClient *)xsmp);
813 if (!state_file)
814 {
815 restart = generate_command (xsmp->restart_command, xsmp->client_id, NULL((void*)0));
816 set_properties (xsmp,
817 ptrarray_prop (SmRestartCommand"RestartCommand", restart),
818 NULL((void*)0));
819 g_ptr_array_free (restart, TRUE(!(0)));
820
821 if (xsmp->set_discard_command)
822 {
823 discard = generate_command (xsmp->discard_command, NULL((void*)0), NULL((void*)0));
824 set_properties (xsmp,
825 ptrarray_prop (SmDiscardCommand"DiscardCommand", discard),
826 NULL((void*)0));
827 g_ptr_array_free (discard, TRUE(!(0)));
828 }
829 else
830 delete_properties (xsmp, SmDiscardCommand"DiscardCommand", NULL((void*)0));
831
832 return;
833 }
834
835 desktop_file = egg_get_desktop_file ();
836 if (desktop_file)
837 {
838 GKeyFile *merged_file;
839 char *desktop_file_path;
840
841 merged_file = g_key_file_new ();
842 desktop_file_path =
843 g_filename_from_uri (egg_desktop_file_get_source (desktop_file),
844 NULL((void*)0), NULL((void*)0));
845 if (desktop_file_path &&
846 g_key_file_load_from_file (merged_file, desktop_file_path,
847 G_KEY_FILE_KEEP_COMMENTS |
848 G_KEY_FILE_KEEP_TRANSLATIONS, NULL((void*)0)))
849 {
850 guint g, k, i;
851 char **groups, **keys, *value, *exec;
852
853 groups = g_key_file_get_groups (state_file, NULL((void*)0));
854 for (g = 0; groups[g]; g++)
855 {
856 keys = g_key_file_get_keys (state_file, groups[g], NULL((void*)0), NULL((void*)0));
857 for (k = 0; keys[k]; k++)
858 {
859 value = g_key_file_get_value (state_file, groups[g],
860 keys[k], NULL((void*)0));
861 if (value)
862 {
863 g_key_file_set_value (merged_file, groups[g],
864 keys[k], value);
865 g_free (value);
866 }
867 }
868 g_strfreev (keys);
869 }
870 g_strfreev (groups);
871
872 g_key_file_free (state_file);
873 state_file = merged_file;
874
875 /* Update Exec key using "--sm-client-state-file %k" */
876 restart = generate_command (xsmp->restart_command,
877 NULL((void*)0), "%k");
878 for (i = 0; i < restart->len; i++)
879 restart->pdata[i] = g_shell_quote (restart->pdata[i]);
880 g_ptr_array_add (restart, NULL((void*)0));
881 exec = g_strjoinv (" ", (char **)restart->pdata);
882 g_strfreev ((char **)restart->pdata);
883 g_ptr_array_free (restart, FALSE(0));
884
885 g_key_file_set_string (state_file, EGG_DESKTOP_FILE_GROUP"Desktop Entry",
886 EGG_DESKTOP_FILE_KEY_EXEC"Exec",
887 exec);
888 g_free (exec);
889 }
890 else
891 desktop_file = NULL((void*)0);
892
893 g_free (desktop_file_path);
894 }
895
896 /* Now write state_file to disk. (We can't use mktemp(), because
897 * that requires the filename to end with "XXXXXX", and we want
898 * it to end with ".desktop".)
899 */
900
901 data = g_key_file_to_data (state_file, NULL((void*)0), NULL((void*)0));
902 g_key_file_free (state_file);
903
904 offset = 0;
905 while (1)
906 {
907 state_file_path = g_strdup_printf ("%s%csession-state%c%s-%ld.%s",
908 g_get_user_config_dir (),
909 G_DIR_SEPARATOR'/', G_DIR_SEPARATOR'/',
910 g_get_prgname (),
911 (long)time (NULL((void*)0)) + offset,
912 desktop_file ? "desktop" : "state");
913
914 fd = open (state_file_path, O_WRONLY01 | O_CREAT0100 | O_EXCL0200, 0644);
915 if (fd == -1)
916 {
917 if (errno(*__errno_location ()) == EEXIST17)
918 {
919 offset++;
920 g_free (state_file_path);
921 continue;
922 }
923 else if (errno(*__errno_location ()) == ENOTDIR20 || errno(*__errno_location ()) == ENOENT2)
924 {
925 char *sep = strrchr (state_file_path, G_DIR_SEPARATOR'/');
926
927 *sep = '\0';
928 if (g_mkdir_with_parents (state_file_path, 0755) != 0)
929 {
930 g_warning ("Could not create directory '%s'",
931 state_file_path);
932 g_free (state_file_path);
933 state_file_path = NULL((void*)0);
934 break;
935 }
936
937 continue;
938 }
939
940 g_warning ("Could not create file '%s': %s",
941 state_file_path, g_strerror (errno(*__errno_location ())));
942 g_free (state_file_path);
943 state_file_path = NULL((void*)0);
944 break;
945 }
946
947 close (fd);
948 g_file_set_contents (state_file_path, data, -1, NULL((void*)0));
949 break;
950 }
951 g_free (data);
952
953 restart = generate_command (xsmp->restart_command, xsmp->client_id,
954 state_file_path);
955 set_properties (xsmp,
956 ptrarray_prop (SmRestartCommand"RestartCommand", restart),
957 NULL((void*)0));
958 g_ptr_array_free (restart, TRUE(!(0)));
959
960 if (state_file_path)
961 {
962 set_properties (xsmp,
963 array_prop (SmDiscardCommand"DiscardCommand",
964 "/bin/rm", "-rf", state_file_path,
965 NULL((void*)0)),
966 NULL((void*)0));
967 g_free (state_file_path);
968 }
969}
970
971static void
972xsmp_interact (SmcConn smc_conn,
973 SmPointer client_data)
974{
975 EggSMClientXSMP *xsmp = client_data;
976 EggSMClient *client = client_data;
977
978 g_debug ("Received Interact message in state %s",
979 EGG_SM_CLIENT_XSMP_STATE (xsmp)(state_names[(xsmp)->state]));
980
981 if (xsmp->state != XSMP_STATE_INTERACT_REQUEST)
982 {
983 fix_broken_state (xsmp, "Interact", TRUE(!(0)), TRUE(!(0)));
984 return;
985 }
986
987 xsmp->state = XSMP_STATE_INTERACT;
988 egg_sm_client_quit_requested (client);
989}
990
991static void
992xsmp_die (SmcConn smc_conn,
993 SmPointer client_data)
994{
995 EggSMClientXSMP *xsmp = client_data;
996 EggSMClient *client = client_data;
997
998 g_debug ("Received Die message in state %s",
999 EGG_SM_CLIENT_XSMP_STATE (xsmp)(state_names[(xsmp)->state]));
1000
1001 sm_client_xsmp_disconnect (xsmp);
1002 egg_sm_client_quit (client);
1003}
1004
1005static void
1006xsmp_save_complete (SmcConn smc_conn,
1007 SmPointer client_data)
1008{
1009 EggSMClientXSMP *xsmp = client_data;
1010
1011 g_debug ("Received SaveComplete message in state %s",
1012 EGG_SM_CLIENT_XSMP_STATE (xsmp)(state_names[(xsmp)->state]));
1013
1014 if (xsmp->state == XSMP_STATE_SAVE_YOURSELF_DONE)
1015 xsmp->state = XSMP_STATE_IDLE;
1016 else
1017 fix_broken_state (xsmp, "SaveComplete", FALSE(0), FALSE(0));
1018}
1019
1020static void
1021xsmp_shutdown_cancelled (SmcConn smc_conn,
1022 SmPointer client_data)
1023{
1024 EggSMClientXSMP *xsmp = client_data;
1025 EggSMClient *client = client_data;
1026
1027 g_debug ("Received ShutdownCancelled message in state %s",
1028 EGG_SM_CLIENT_XSMP_STATE (xsmp)(state_names[(xsmp)->state]));
1029
1030 xsmp->shutting_down = FALSE(0);
1031
1032 if (xsmp->state == XSMP_STATE_SAVE_YOURSELF_DONE)
1033 {
1034 /* We've finished interacting and now the SM has agreed to
1035 * cancel the shutdown.
1036 */
1037 xsmp->state = XSMP_STATE_IDLE;
1038 egg_sm_client_quit_cancelled (client);
1039 }
1040 else if (xsmp->state == XSMP_STATE_SHUTDOWN_CANCELLED)
1041 {
1042 /* Hm... ok, so we got a shutdown SaveYourself, which got
1043 * cancelled, but the application was still interacting, so we
1044 * didn't tell it yet, and then *another* SaveYourself arrived,
1045 * which we must still be waiting to tell the app about, except
1046 * that now that SaveYourself has been cancelled too! Dizzy yet?
1047 */
1048 xsmp->waiting_to_save_myself = FALSE(0);
1049 update_pending_events (xsmp);
1050 }
1051 else
1052 {
1053 g_debug ("Sending SaveYourselfDone(False)");
1054 SmcSaveYourselfDone (xsmp->connection, False0);
1055
1056 if (xsmp->state == XSMP_STATE_INTERACT)
1057 {
1058 /* The application is currently interacting, so we can't
1059 * tell it about the cancellation yet; we will wait until
1060 * after it calls egg_sm_client_will_quit().
1061 */
1062 xsmp->state = XSMP_STATE_SHUTDOWN_CANCELLED;
1063 }
1064 else
1065 {
1066 /* The shutdown was cancelled before the application got a
1067 * chance to interact.
1068 */
1069 xsmp->state = XSMP_STATE_IDLE;
1070 }
1071 }
1072}
1073
1074/* Utilities */
1075
1076/* Create a restart/clone/Exec command based on @restart_command.
1077 * If @client_id is non-%NULL, add "--sm-client-id @client_id".
1078 * If @state_file is non-%NULL, add "--sm-client-state-file @state_file".
1079 *
1080 * None of the input strings are g_strdup()ed; the caller must keep
1081 * them around until it is done with the returned GPtrArray, and must
1082 * then free the array, but not its contents.
1083 */
1084static GPtrArray *
1085generate_command (char **restart_command, const char *client_id,
1086 const char *state_file)
1087{
1088 GPtrArray *cmd;
1089 int i;
1090
1091 cmd = g_ptr_array_new ();
1092 g_ptr_array_add (cmd, restart_command[0]);
1093
1094 if (client_id)
1095 {
1096 g_ptr_array_add (cmd, (char *)"--sm-client-id");
1097 g_ptr_array_add (cmd, (char *)client_id);
1098 }
1099
1100 if (state_file)
1101 {
1102 g_ptr_array_add (cmd, (char *)"--sm-client-state-file");
1103 g_ptr_array_add (cmd, (char *)state_file);
1104 }
1105
1106 for (i = 1; restart_command[i]; i++)
1107 g_ptr_array_add (cmd, restart_command[i]);
1108
1109 return cmd;
1110}
1111
1112/* Takes a NULL-terminated list of SmProp * values, created by
1113 * array_prop, ptrarray_prop, string_prop, card8_prop, sets them, and
1114 * frees them.
1115 */
1116static void
1117set_properties (EggSMClientXSMP *xsmp, ...)
1118{
1119 GPtrArray *props;
1120 SmProp *prop;
1121 va_list ap;
1122 guint i;
1123
1124 props = g_ptr_array_new ();
1125
1126 va_start (ap, xsmp)__builtin_va_start(ap, xsmp);
1127 while ((prop = va_arg (ap, SmProp *)__builtin_va_arg(ap, SmProp *)))
1128 g_ptr_array_add (props, prop);
1129 va_end (ap)__builtin_va_end(ap);
1130
1131 if (xsmp->connection)
1132 {
1133 SmcSetProperties (xsmp->connection, props->len,
1134 (SmProp **)props->pdata);
1135 }
1136
1137 for (i = 0; i < props->len; i++)
1138 {
1139 prop = props->pdata[i];
1140 g_free (prop->vals);
1141 g_free (prop);
1142 }
1143 g_ptr_array_free (props, TRUE(!(0)));
1144}
1145
1146/* Takes a NULL-terminated list of property names and deletes them. */
1147static void
1148delete_properties (EggSMClientXSMP *xsmp, ...)
1149{
1150 GPtrArray *props;
1151 char *prop;
1152 va_list ap;
1153
1154 if (!xsmp->connection)
1155 return;
1156
1157 props = g_ptr_array_new ();
1158
1159 va_start (ap, xsmp)__builtin_va_start(ap, xsmp);
1160 while ((prop = va_arg (ap, char *)__builtin_va_arg(ap, char *)))
1161 g_ptr_array_add (props, prop);
1162 va_end (ap)__builtin_va_end(ap);
1163
1164 SmcDeleteProperties (xsmp->connection, props->len,
1165 (char **)props->pdata);
1166
1167 g_ptr_array_free (props, TRUE(!(0)));
1168}
1169
1170/* Takes an array of strings and creates a LISTofARRAY8 property. The
1171 * strings are neither dupped nor freed; they need to remain valid
1172 * until you're done with the SmProp.
1173 */
1174static SmProp *
1175array_prop (const char *name, ...)
1176{
1177 SmProp *prop;
1178 SmPropValue pv;
1179 GArray *vals;
1180 char *value;
1181 va_list ap;
1182
1183 prop = g_new (SmProp, 1)((SmProp *) g_malloc_n ((1), sizeof (SmProp)));
1184 prop->name = (char *)name;
1185 prop->type = (char *)SmLISTofARRAY8"LISTofARRAY8";
1186
1187 vals = g_array_new (FALSE(0), FALSE(0), sizeof (SmPropValue));
1188
1189 va_start (ap, name)__builtin_va_start(ap, name);
1190 while ((value = va_arg (ap, char *)__builtin_va_arg(ap, char *)))
1191 {
1192 pv.length = strlen (value);
1193 pv.value = value;
1194 g_array_append_val (vals, pv)g_array_append_vals (vals, &(pv), 1);
1195 }
1196 va_end (ap)__builtin_va_end(ap);
1197
1198 prop->num_vals = vals->len;
1199 prop->vals = (SmPropValue *)vals->data;
1200
1201 g_array_free (vals, FALSE(0));
1202
1203 return prop;
1204}
1205
1206/* Takes a GPtrArray of strings and creates a LISTofARRAY8 property.
1207 * The array contents are neither dupped nor freed; they need to
1208 * remain valid until you're done with the SmProp.
1209 */
1210static SmProp *
1211ptrarray_prop (const char *name, GPtrArray *values)
1212{
1213 SmProp *prop;
1214 SmPropValue pv;
1215 GArray *vals;
1216 guint i;
1217
1218 prop = g_new (SmProp, 1)((SmProp *) g_malloc_n ((1), sizeof (SmProp)));
1219 prop->name = (char *)name;
1220 prop->type = (char *)SmLISTofARRAY8"LISTofARRAY8";
1221
1222 vals = g_array_new (FALSE(0), FALSE(0), sizeof (SmPropValue));
1223
1224 for (i = 0; i < values->len; i++)
1225 {
1226 pv.length = strlen (values->pdata[i]);
1227 pv.value = values->pdata[i];
1228 g_array_append_val (vals, pv)g_array_append_vals (vals, &(pv), 1);
1229 }
1230
1231 prop->num_vals = vals->len;
1232 prop->vals = (SmPropValue *)vals->data;
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
1233
1234 g_array_free (vals, FALSE(0));
1235
1236 return prop;
1237}
1238
1239/* Takes a string and creates an ARRAY8 property. The string is
1240 * neither dupped nor freed; it needs to remain valid until you're
1241 * done with the SmProp.
1242 */
1243static SmProp *
1244string_prop (const char *name, const char *value)
1245{
1246 SmProp *prop;
1247
1248 prop = g_new (SmProp, 1)((SmProp *) g_malloc_n ((1), sizeof (SmProp)));
1249 prop->name = (char *)name;
1250 prop->type = (char *)SmARRAY8"ARRAY8";
1251
1252 prop->num_vals = 1;
1253 prop->vals = g_new (SmPropValue, 1)((SmPropValue *) g_malloc_n ((1), sizeof (SmPropValue)));
1254
1255 prop->vals[0].length = strlen (value);
1256 prop->vals[0].value = (char *)value;
1257
1258 return prop;
1259}
1260
1261/* Takes a char and creates a CARD8 property. */
1262static SmProp *
1263card8_prop (const char *name, unsigned char value)
1264{
1265 SmProp *prop;
1266 char *card8val;
1267
1268 /* To avoid having to allocate and free prop->vals[0], we cheat and
1269 * make vals a 2-element-long array and then use the second element
1270 * to store value.
1271 */
1272
1273 prop = g_new (SmProp, 1)((SmProp *) g_malloc_n ((1), sizeof (SmProp)));
1274 prop->name = (char *)name;
1275 prop->type = (char *)SmCARD8"CARD8";
1276
1277 prop->num_vals = 1;
1278 prop->vals = g_new (SmPropValue, 2)((SmPropValue *) g_malloc_n ((2), sizeof (SmPropValue)));
1279 card8val = (char *)(&prop->vals[1]);
1280 card8val[0] = value;
1281
1282 prop->vals[0].length = 1;
1283 prop->vals[0].value = card8val;
1284
1285 return prop;
1286}
1287
1288/* ICE code. This makes no effort to play nice with anyone else trying
1289 * to use libICE. Fortunately, no one uses libICE for anything other
1290 * than SM. (DCOP uses ICE, but it has its own private copy of
1291 * libICE.)
1292 *
1293 * When this moves to gtk, it will need to be cleverer, to avoid
1294 * tripping over old apps that use MateClient or that use libSM
1295 * directly.
1296 */
1297
1298#include <X11/ICE/ICElib.h>
1299#include <fcntl.h>
1300
1301static void ice_error_handler (IceConn ice_conn,
1302 Boolint swap,
1303 int offending_minor_opcode,
1304 unsigned long offending_sequence,
1305 int error_class,
1306 int severity,
1307 IcePointer values);
1308static void ice_io_error_handler (IceConn ice_conn);
1309static void ice_connection_watch (IceConn ice_conn,
1310 IcePointer client_data,
1311 Boolint opening,
1312 IcePointer *watch_data);
1313
1314static void
1315ice_init (void)
1316{
1317 IceSetIOErrorHandler (ice_io_error_handler);
1318 IceSetErrorHandler (ice_error_handler);
1319 IceAddConnectionWatch (ice_connection_watch, NULL((void*)0));
1320}
1321
1322static gboolean
1323process_ice_messages (IceConn ice_conn)
1324{
1325 IceProcessMessagesStatus status;
1326 status = IceProcessMessages (ice_conn, NULL((void*)0), NULL((void*)0));
1327
1328 switch (status)
1329 {
1330 case IceProcessMessagesSuccess:
1331 return TRUE(!(0));
1332
1333 case IceProcessMessagesIOError:
1334 sm_client_xsmp_disconnect (IceGetConnectionContext (ice_conn));
1335 return FALSE(0);
1336
1337 case IceProcessMessagesConnectionClosed:
1338 return FALSE(0);
1339
1340 default:
1341 g_assert_not_reached ()do { g_assertion_message_expr ("EggSMClient", "eggsmclient-xsmp.c"
, 1341, ((const char*) (__func__)), ((void*)0)); } while (0)
;
1342 }
1343}
1344
1345static gboolean
1346ice_iochannel_watch (GIOChannel *channel,
1347 GIOCondition condition,
1348 gpointer client_data)
1349{
1350 return process_ice_messages (client_data);
1351}
1352
1353static void
1354ice_connection_watch (IceConn ice_conn,
1355 IcePointer client_data,
1356 Boolint opening,
1357 IcePointer *watch_data)
1358{
1359 guint watch_id;
1360
1361 if (opening)
1362 {
1363 GIOChannel *channel;
1364 int fd = IceConnectionNumber (ice_conn);
1365
1366 fcntl (fd, F_SETFD2, fcntl (fd, F_GETFD1, 0) | FD_CLOEXEC1);
1367 channel = g_io_channel_unix_new (fd);
1368 watch_id = g_io_add_watch (channel, G_IO_IN | G_IO_ERR,
1369 ice_iochannel_watch, ice_conn);
1370 g_io_channel_unref (channel);
1371
1372 *watch_data = GUINT_TO_POINTER (watch_id)((gpointer) (gulong) (watch_id));
1373 }
1374 else
1375 {
1376 watch_id = GPOINTER_TO_UINT (*watch_data)((guint) (gulong) (*watch_data));
1377 g_source_remove (watch_id);
1378 }
1379}
1380
1381static void
1382ice_error_handler (IceConn ice_conn,
1383 Boolint swap,
1384 int offending_minor_opcode,
1385 unsigned long offending_sequence,
1386 int error_class,
1387 int severity,
1388 IcePointer values)
1389{
1390 /* Do nothing */
1391}
1392
1393static void
1394ice_io_error_handler (IceConn ice_conn)
1395{
1396 /* Do nothing */
1397}
1398
1399static void
1400smc_error_handler (SmcConn smc_conn,
1401 Boolint swap,
1402 int offending_minor_opcode,
1403 unsigned long offending_sequence,
1404 int error_class,
1405 int severity,
1406 SmPointer values)
1407{
1408 /* Do nothing */
1409}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-d040d4.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-d040d4.html new file mode 100644 index 0000000..1790949 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-d040d4.html @@ -0,0 +1,2840 @@ + + + +terminal-app.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:terminal-app.c
Warning:line 999, column 37
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name terminal-app.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I .. -I ../src/mate-submodules/libegg -D TERMINAL_COMPILATION -D TERMINAL_RESOURCES_PATH_PREFIX="/org/mate/terminal" -D TERM_DATADIR="/usr/local/share" -D TERM_LOCALEDIR="/usr/local/share/locale" -D TERM_PKGDATADIR="/usr/local/share/mate-terminal" -D TERM_HELPDIR="/usr/local/share/help" -D SN_API_NOT_YET_FROZEN -D GDK_MULTIHEAD_SAFE -D G_DISABLE_SINGLE_INCLUDES -D PANGO_DISABLE_SINGLE_INCLUDES -D ATK_DISABLE_SINGLE_INCLUDES -D GDK_DISABLE_SINGLE_INCLUDES -D GDK_PIXBUF_DISABLE_SINGLE_INCLUDES -D GTK_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c terminal-app.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright © 2001, 2002 Havoc Pennington
3 * Copyright © 2002 Red Hat, Inc.
4 * Copyright © 2002 Sun Microsystems
5 * Copyright © 2003 Mariano Suarez-Alvarez
6 * Copyright © 2008 Christian Persch
7 * Copyright (C) 2012-2021 MATE Developers
8 *
9 * Mate-terminal is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * Mate-terminal is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#include <config.h>
24
25#include <errno(*__errno_location ()).h>
26
27#include <glib.h>
28#include <dconf.h>
29
30#include "terminal-intl.h"
31
32#include "terminal-debug.h"
33#include "terminal-app.h"
34#include "terminal-accels.h"
35#include "terminal-screen.h"
36#include "terminal-screen-container.h"
37#include "terminal-window.h"
38#include "terminal-util.h"
39#include "profile-editor.h"
40#include "terminal-encoding.h"
41#include <string.h>
42#include <stdlib.h>
43
44#ifdef HAVE_SMCLIENT1
45#include "eggsmclient.h"
46#include "eggdesktopfile.h"
47#endif /* HAVE_SMCLIENT */
48
49#define FALLBACK_PROFILE_ID"default" "default"
50
51/* Settings storage works as follows:
52 * /apps/mate-terminal/global/
53 * /apps/mate-terminal/profiles/Foo/
54 *
55 * It's somewhat tricky to manage the profiles/ dir since we need to track
56 * the list of profiles, but GSettings doesn't have a concept of notifying that
57 * a directory has appeared or disappeared.
58 *
59 * Session state is stored entirely in the RestartCommand command line.
60 *
61 * The number one rule: all stored information is EITHER per-session,
62 * per-profile, or set from a command line option. THERE CAN BE NO
63 * OVERLAP. The UI and implementation totally break if you overlap
64 * these categories. See mate-terminal 1.x for why.
65 *
66 * Don't use this code as an example of how to use GSettings - it's hugely
67 * overcomplicated due to the profiles stuff. Most apps should not
68 * have to do scary things of this nature, and should not have
69 * a profiles feature.
70 *
71 */
72
73GSettings *settings_global;
74
75struct _TerminalAppClass
76{
77 GObjectClass parent_class;
78
79 void (* quit) (TerminalApp *app);
80 void (* profile_list_changed) (TerminalApp *app);
81 void (* encoding_list_changed) (TerminalApp *app);
82};
83
84struct _TerminalApp
85{
86 GObject parent_instance;
87
88 GList *windows;
89 GtkWidget *new_profile_dialog;
90 GtkWidget *manage_profiles_dialog;
91 GtkWidget *manage_profiles_list;
92 GtkWidget *manage_profiles_new_button;
93 GtkWidget *manage_profiles_edit_button;
94 GtkWidget *manage_profiles_delete_button;
95 GtkWidget *manage_profiles_default_menu;
96
97 GSettings *settings_font;
98
99 GHashTable *profiles;
100 char* default_profile_id;
101 TerminalProfile *default_profile;
102 gboolean default_profile_locked;
103
104 GHashTable *encodings;
105 gboolean encodings_locked;
106
107 PangoFontDescription *system_font_desc;
108 gboolean enable_mnemonics;
109 gboolean enable_menu_accels;
110};
111
112enum
113{
114 PROP_0,
115 PROP_DEFAULT_PROFILE,
116 PROP_ENABLE_MENU_BAR_ACCEL,
117 PROP_ENABLE_MNEMONICS,
118 PROP_SYSTEM_FONT,
119};
120
121enum
122{
123 QUIT,
124 PROFILE_LIST_CHANGED,
125 ENCODING_LIST_CHANGED,
126 LAST_SIGNAL
127};
128
129static guint signals[LAST_SIGNAL] = { 0 };
130
131enum
132{
133 COL_PROFILE,
134 NUM_COLUMNS
135};
136
137enum
138{
139 SOURCE_DEFAULT = 0,
140 SOURCE_SESSION = 1
141};
142
143static TerminalApp *global_app = NULL((void*)0);
144
145#define MONOSPACE_FONT_SCHEMA"org.mate.interface" "org.mate.interface"
146#define MONOSPACE_FONT_KEY"monospace-font-name" "monospace-font-name"
147#define DEFAULT_MONOSPACE_FONT("Monospace 10") ("Monospace 10")
148
149#define ENABLE_MNEMONICS_KEY"use-mnemonics" "use-mnemonics"
150#define DEFAULT_ENABLE_MNEMONICS((!(0))) (TRUE(!(0)))
151
152#define ENABLE_MENU_BAR_ACCEL_KEY"use-menu-accelerators" "use-menu-accelerators"
153#define DEFAULT_ENABLE_MENU_BAR_ACCEL((!(0))) (TRUE(!(0)))
154
155#define PROFILE_LIST_KEY"profile-list" "profile-list"
156#define DEFAULT_PROFILE_KEY"default-profile" "default-profile"
157
158#define ENCODING_LIST_KEY"active-encodings" "active-encodings"
159
160/* two following functions were copied from libmate-desktop to get rid
161 * of dependency on it
162 *
163 * FIXME: I suspect there's no need for excessive copies, we might use
164 * existing profile list to form GVariant's and write them to GSettings
165 */
166static gboolean
167gsettings_append_strv (GSettings *settings,
168 const gchar *key,
169 const gchar *value)
170{
171 gchar **old;
172 gchar **new;
173 gint size;
174 gboolean retval;
175
176 old = g_settings_get_strv (settings, key);
177
178 for (size = 0; old[size] != NULL((void*)0); size++);
179
180 size += 1; /* appended value */
181 size += 1; /* NULL */
182
183 new = g_realloc_n (old, size, sizeof (gchar *));
184
185 new[size - 2] = g_strdup (value)g_strdup_inline (value);
186 new[size - 1] = NULL((void*)0);
187
188 retval = g_settings_set_strv (settings, key,
189 (const gchar **) new);
190
191 g_strfreev (new);
192
193 return retval;
194}
195
196static gboolean
197gsettings_remove_all_from_strv (GSettings *settings,
198 const gchar *key,
199 const gchar *value)
200{
201 GArray *array;
202 gchar **old;
203 gint i;
204 gboolean retval;
205
206 old = g_settings_get_strv (settings, key);
207 array = g_array_new (TRUE(!(0)), TRUE(!(0)), sizeof (gchar *));
208
209 for (i = 0; old[i] != NULL((void*)0); i++) {
210 if (g_strcmp0 (old[i], value) != 0)
211 array = g_array_append_val (array, old[i])g_array_append_vals (array, &(old[i]), 1);
212 }
213
214 retval = g_settings_set_strv (settings, key,
215 (const gchar **) array->data);
216
217 g_strfreev (old);
218 g_array_free (array, TRUE(!(0)));
219
220 return retval;
221}
222
223/* Helper functions */
224
225static GdkScreen*
226terminal_app_get_screen_by_display_name (const char *display_name)
227{
228 GdkDisplay *display = NULL((void*)0);
229 GdkScreen *screen = NULL((void*)0);
230
231 if (display_name == NULL((void*)0))
232 display = gdk_display_get_default ();
233 else
234 {
235 GSList *displays, *l;
236 const char *period;
237
238 period = strrchr (display_name, '.');
239 displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
240 for (l = displays; l != NULL((void*)0); l = l->next)
241 {
242 GdkDisplay *disp = l->data;
243
244 /* compare without the screen number part, if present */
245 if ((period && strncmp (gdk_display_get_name (disp), display_name, period - display_name) == 0) ||
246 (period == NULL((void*)0) && strcmp (gdk_display_get_name (disp), display_name) == 0))
247 {
248 display = disp;
249 break;
250 }
251 }
252 g_slist_free (displays);
253
254 if (display == NULL((void*)0))
255 display = gdk_display_open (display_name); /* FIXME we never close displays */
256 }
257
258 if (display == NULL((void*)0))
259 return NULL((void*)0);
260 else
261 screen = gdk_display_get_default_screen (display);
262
263 return screen;
264}
265
266static int
267terminal_app_get_workspace_for_window (TerminalWindow *window)
268{
269 int ret = -1;
270 guchar *data = NULL((void*)0);
271 GdkAtom atom;
272 GdkAtom cardinal_atom;
273
274 atom = gdk_atom_intern_static_string ("_NET_WM_DESKTOP");
275 cardinal_atom = gdk_atom_intern_static_string ("CARDINAL");
276
277 gdk_property_get (gtk_widget_get_window(GTK_WIDGET(window)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_widget_get_type ()))))))
),
278 atom, cardinal_atom, 0, 8, FALSE(0),
279 NULL((void*)0), NULL((void*)0), NULL((void*)0), &data);
280
281 if (data)
282 ret = *(int *)data;
283
284 g_free (data);
285 return ret;
286}
287
288/* Menubar mnemonics settings handling */
289
290static int
291profiles_alphabetic_cmp (gconstpointer pa,
292 gconstpointer pb)
293{
294 TerminalProfile *a = (TerminalProfile *) pa;
295 TerminalProfile *b = (TerminalProfile *) pb;
296 int result;
297
298 result = g_utf8_collate (terminal_profile_get_property_string (a, TERMINAL_PROFILE_VISIBLE_NAME"visible-name"),
299 terminal_profile_get_property_string (b, TERMINAL_PROFILE_VISIBLE_NAME"visible-name"));
300 if (result == 0)
301 result = strcmp (terminal_profile_get_property_string (a, TERMINAL_PROFILE_NAME"name"),
302 terminal_profile_get_property_string (b, TERMINAL_PROFILE_NAME"name"));
303
304 return result;
305}
306
307typedef struct
308{
309 TerminalProfile *result;
310 const char *target;
311} LookupInfo;
312
313static void
314profiles_lookup_by_visible_name_foreach (gpointer key,
315 gpointer value,
316 gpointer data)
317{
318 LookupInfo *info = data;
319 const char *name;
320
321 name = terminal_profile_get_property_string (value, TERMINAL_PROFILE_VISIBLE_NAME"visible-name");
322 if (name && strcmp (info->target, name) == 0)
323 info->result = value;
324}
325
326static void
327terminal_window_destroyed (TerminalWindow *window,
328 TerminalApp *app)
329{
330 app->windows = g_list_remove (app->windows, window);
331
332 if (app->windows == NULL((void*)0))
333 g_signal_emit (app, signals[QUIT], 0);
334}
335
336static TerminalProfile *
337terminal_app_create_profile (TerminalApp *app,
338 const char *name)
339{
340 TerminalProfile *profile;
341
342 g_assert (terminal_app_get_profile_by_name (app, name) == NULL)do { if (terminal_app_get_profile_by_name (app, name) == ((void
*)0)) ; else g_assertion_message_expr (((gchar*) 0), "terminal-app.c"
, 342, ((const char*) (__func__)), "terminal_app_get_profile_by_name (app, name) == NULL"
); } while (0)
;
343
344 profile = _terminal_profile_new (name);
345
346 g_hash_table_insert (app->profiles,
347 g_strdup (terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME))g_strdup_inline (terminal_profile_get_property_string (profile
, "name"))
,
348 profile /* adopts the refcount */);
349
350 if (app->default_profile == NULL((void*)0) &&
351 app->default_profile_id != NULL((void*)0) &&
352 strcmp (app->default_profile_id,
353 terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name")) == 0)
354 {
355 /* We are the default profile */
356 app->default_profile = profile;
357 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
358 }
359
360 return profile;
361}
362
363static void
364terminal_app_delete_profile (TerminalProfile *profile)
365{
366 const char *profile_name;
367 char *profile_dir;
368 GError *error = NULL((void*)0);
369
370 profile_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name");
371 profile_dir = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", profile_name, "/", NULL((void*)0));
372
373 gsettings_remove_all_from_strv (settings_global, PROFILE_LIST_KEY"profile-list", profile_name);
374
375 /* And remove the profile directory */
376 DConfClient *client = dconf_client_new ();
377 if (!dconf_client_write_sync (client, profile_dir, NULL((void*)0), NULL((void*)0), NULL((void*)0), &error))
378 {
379 g_warning ("Failed to recursively unset %s: %s\n", profile_dir, error->message);
380 g_error_free (error);
381 }
382
383 g_object_unref (client);
384 g_free (profile_dir);
385}
386
387static void
388terminal_app_profile_cell_data_func (GtkTreeViewColumn *tree_column,
389 GtkCellRenderer *cell,
390 GtkTreeModel *tree_model,
391 GtkTreeIter *iter,
392 gpointer data)
393{
394 TerminalProfile *profile;
395 GValue value = { 0, };
396
397 gtk_tree_model_get (tree_model, iter, (int) COL_PROFILE, &profile, (int) -1);
398
399 g_value_init (&value, G_TYPE_STRING((GType) ((16) << (2))));
400 g_object_get_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, "visible-name", &value);
401 g_object_set_property (G_OBJECT (cell)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cell)), (((GType) ((20) << (2))))))))
, "text", &value);
402 g_value_unset (&value);
403}
404
405static int
406terminal_app_profile_sort_func (GtkTreeModel *model,
407 GtkTreeIter *a,
408 GtkTreeIter *b,
409 gpointer user_data)
410{
411 TerminalProfile *profile_a, *profile_b;
412 int retval;
413
414 gtk_tree_model_get (model, a, (int) COL_PROFILE, &profile_a, (int) -1);
415 gtk_tree_model_get (model, b, (int) COL_PROFILE, &profile_b, (int) -1);
416
417 retval = profiles_alphabetic_cmp (profile_a, profile_b);
418
419 g_object_unref (profile_a);
420 g_object_unref (profile_b);
421
422 return retval;
423}
424
425static /* ref */ GtkTreeModel *
426terminal_app_get_profile_liststore (TerminalApp *app,
427 TerminalProfile *selected_profile,
428 GtkTreeIter *selected_profile_iter,
429 gboolean *selected_profile_iter_set)
430{
431 GtkListStore *store;
432 GtkTreeIter iter;
433 GList *profiles, *l;
434
435 store = gtk_list_store_new (NUM_COLUMNS, TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()));
436
437 *selected_profile_iter_set = FALSE(0);
438
439 if (selected_profile &&
440 _terminal_profile_get_forgotten (selected_profile))
441 selected_profile = NULL((void*)0);
442
443 profiles = terminal_app_get_profile_list (app);
444
445 for (l = profiles; l != NULL((void*)0); l = l->next)
446 {
447 TerminalProfile *profile = TERMINAL_PROFILE (l->data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((terminal_profile_get_type ()))))))
;
448
449 gtk_list_store_insert_with_values (store, &iter, 0,
450 (int) COL_PROFILE, profile,
451 (int) -1);
452
453 if (selected_profile_iter && profile == selected_profile)
454 {
455 *selected_profile_iter = iter;
456 *selected_profile_iter_set = TRUE(!(0));
457 }
458 }
459 g_list_free (profiles);
460
461 /* Now turn on sorting */
462 gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (store)((((GtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((gtk_tree_sortable_get_type ()))))))
,
463 COL_PROFILE,
464 terminal_app_profile_sort_func,
465 NULL((void*)0), NULL((void*)0));
466 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store)((((GtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((gtk_tree_sortable_get_type ()))))))
,
467 COL_PROFILE, GTK_SORT_ASCENDING);
468
469 return GTK_TREE_MODEL (store)((((GtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((gtk_tree_model_get_type ()))))))
;
470}
471
472static /* ref */ TerminalProfile*
473profile_combo_box_get_selected (GtkWidget *widget)
474{
475 GtkComboBox *combo = GTK_COMBO_BOX (widget)((((GtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_combo_box_get_type ()))))))
;
476 TerminalProfile *profile = NULL((void*)0);
477 GtkTreeIter iter;
478
479 if (gtk_combo_box_get_active_iter (combo, &iter))
480 gtk_tree_model_get (gtk_combo_box_get_model (combo), &iter,
481 (int) COL_PROFILE, &profile, (int) -1);
482
483 return profile;
484}
485
486static void
487profile_combo_box_refill (TerminalApp *app,
488 GtkWidget *widget)
489{
490 GtkComboBox *combo = GTK_COMBO_BOX (widget)((((GtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_combo_box_get_type ()))))))
;
491 GtkTreeIter iter;
492 gboolean iter_set;
493 TerminalProfile *selected_profile;
494 GtkTreeModel *model;
495
496 selected_profile = profile_combo_box_get_selected (widget);
497 if (!selected_profile)
498 {
499 selected_profile = terminal_app_get_default_profile (app);
500 if (selected_profile)
501 g_object_ref (selected_profile)((__typeof__ (selected_profile)) (g_object_ref) (selected_profile
))
;
502 }
503
504 model = terminal_app_get_profile_liststore (app,
505 selected_profile,
506 &iter,
507 &iter_set);
508 gtk_combo_box_set_model (combo, model);
509 g_object_unref (model);
510
511 if (iter_set)
512 gtk_combo_box_set_active_iter (combo, &iter);
513
514 if (selected_profile)
515 g_object_unref (selected_profile);
516}
517
518static GtkWidget*
519profile_combo_box_new (TerminalApp *app)
520{
521 GtkWidget *combo;
522 GtkCellRenderer *renderer;
523
524 combo = gtk_combo_box_new ();
525 terminal_util_set_atk_name_description (combo, NULL((void*)0), _("Click button to choose profile")gettext ("Click button to choose profile"));
526
527 renderer = gtk_cell_renderer_text_new ();
528 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((gtk_cell_layout_get_type ()))))))
, renderer, TRUE(!(0)));
529 gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((gtk_cell_layout_get_type ()))))))
, renderer,
530 (GtkCellLayoutDataFunc) terminal_app_profile_cell_data_func,
531 NULL((void*)0), NULL((void*)0));
532
533 profile_combo_box_refill (app, combo);
534 g_signal_connect (app, "profile-list-changed",g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_combo_box_refill))), (combo), ((void*)0), (GConnectFlags
) 0)
535 G_CALLBACK (profile_combo_box_refill), combo)g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_combo_box_refill))), (combo), ((void*)0), (GConnectFlags
) 0)
;
536
537 gtk_widget_show (combo);
538 return combo;
539}
540
541static void
542profile_combo_box_changed_cb (GtkWidget *widget,
543 TerminalApp *app)
544{
545 TerminalProfile *profile;
546
547 profile = profile_combo_box_get_selected (widget);
548 if (!profile)
549 return;
550
551 g_settings_set_string (settings_global, DEFAULT_PROFILE_KEY"default-profile",
552 terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name"));
553
554 /* Even though the GSettings change notification does this, it happens too late.
555 * In some cases, the default profile changes twice in quick succession,
556 * and update_default_profile must be called in sync with those changes.
557 */
558 app->default_profile = profile;
559
560 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
561
562 g_object_unref (profile);
563}
564
565static void
566profile_list_treeview_refill (TerminalApp *app,
567 GtkWidget *widget)
568{
569 GtkTreeView *tree_view = GTK_TREE_VIEW (widget)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_tree_view_get_type ()))))))
;
570 GtkTreeIter iter;
571 gboolean iter_set;
572 GtkTreeSelection *selection;
573 GtkTreeModel *model;
574 TerminalProfile *selected_profile = NULL((void*)0);
575
576 model = gtk_tree_view_get_model (tree_view);
577
578 selection = gtk_tree_view_get_selection (tree_view);
579 if (gtk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
580 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
581
582 model = terminal_app_get_profile_liststore (terminal_app_get (),
583 selected_profile,
584 &iter,
585 &iter_set);
586 gtk_tree_view_set_model (tree_view, model);
587 g_object_unref (model);
588
589 if (!iter_set)
590 iter_set = gtk_tree_model_get_iter_first (model, &iter);
591
592 if (iter_set)
593 gtk_tree_selection_select_iter (selection, &iter);
594
595 if (selected_profile)
596 g_object_unref (selected_profile);
597}
598
599static GtkWidget*
600profile_list_treeview_create (TerminalApp *app)
601{
602 GtkWidget *tree_view;
603 GtkTreeSelection *selection;
604 GtkCellRenderer *renderer;
605 GtkTreeViewColumn *column;
606
607 tree_view = gtk_tree_view_new ();
608 terminal_util_set_atk_name_description (tree_view, _("Profile list")gettext ("Profile list"), NULL((void*)0));
609 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
, FALSE(0));
610
611 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
);
612 gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection)((((GtkTreeSelection*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((selection)), ((gtk_tree_selection_get_type (
)))))))
,
613 GTK_SELECTION_BROWSE);
614
615 column = gtk_tree_view_column_new ();
616 renderer = gtk_cell_renderer_text_new ();
617 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (column)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((column)), ((gtk_cell_layout_get_type ()))))))
, renderer, TRUE(!(0)));
618 gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (column)((((GtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((column)), ((gtk_cell_layout_get_type ()))))))
, renderer,
619 (GtkCellLayoutDataFunc) terminal_app_profile_cell_data_func,
620 NULL((void*)0), NULL((void*)0));
621 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((gtk_tree_view_get_type ()))))))
,
622 GTK_TREE_VIEW_COLUMN (column)((((GtkTreeViewColumn*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((column)), ((gtk_tree_view_column_get_type (
)))))))
);
623
624 return tree_view;
625}
626
627static void
628profile_list_delete_confirm_response_cb (GtkWidget *dialog,
629 int response)
630{
631 TerminalProfile *profile;
632
633 profile = TERMINAL_PROFILE (g_object_get_data (G_OBJECT (dialog), "profile"))((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_get_data (((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((dialog)), (((GType) ((20) << (2)))
))))), "profile"))), ((terminal_profile_get_type ()))))))
;
634 g_assert (profile != NULL)do { if (profile != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 634, ((const char*) (__func__
)), "profile != NULL"); } while (0)
;
635
636 if (response == GTK_RESPONSE_ACCEPT)
637 terminal_app_delete_profile (profile);
638
639 gtk_widget_destroy (dialog);
640}
641
642static void
643mate_dialog_add_button (GtkDialog *dialog,
644 const gchar *button_text,
645 const gchar *icon_name,
646 gint response_id)
647{
648 GtkWidget *button;
649
650 button = gtk_button_new_with_mnemonic (button_text);
651 gtk_button_set_image (GTK_BUTTON (button)((((GtkButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_button_get_type ()))))))
, gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON));
652
653 gtk_button_set_use_underline (GTK_BUTTON (button)((((GtkButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_button_get_type ()))))))
, TRUE(!(0)));
654 gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button");
655 gtk_widget_set_can_default (button, TRUE(!(0)));
656 gtk_widget_show (button);
657 gtk_dialog_add_action_widget (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
, button, response_id);
658}
659
660static void
661profile_list_delete_button_clicked_cb (GtkWidget *button,
662 GtkWidget *widget)
663{
664 GtkTreeView *tree_view = GTK_TREE_VIEW (widget)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_tree_view_get_type ()))))))
;
665 GtkTreeSelection *selection;
666 GtkWidget *dialog;
667 GtkTreeIter iter;
668 GtkTreeModel *model;
669 TerminalProfile *selected_profile;
670 GtkWidget *transient_parent;
671
672 model = gtk_tree_view_get_model (tree_view);
673 selection = gtk_tree_view_get_selection (tree_view);
674
675 if (!gtk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
676 return;
677
678 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
679
680 transient_parent = gtk_widget_get_toplevel (widget);
681 dialog = gtk_message_dialog_new (GTK_WINDOW (transient_parent)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((transient_parent)), ((gtk_window_get_type ()))))))
,
682 GTK_DIALOG_DESTROY_WITH_PARENT,
683 GTK_MESSAGE_QUESTION,
684 GTK_BUTTONS_NONE,
685 _("Delete profile “%s”?")gettext ("Delete profile “%s”?"),
686 terminal_profile_get_property_string (selected_profile, TERMINAL_PROFILE_VISIBLE_NAME"visible-name"));
687
688 mate_dialog_add_button (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
,
689 _("_Cancel")gettext ("_Cancel"),
690 "process-stop",
691 GTK_RESPONSE_REJECT);
692
693 mate_dialog_add_button (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
,
694 _("_Delete")gettext ("_Delete"),
695 "edit-delete",
696 GTK_RESPONSE_ACCEPT);
697
698 gtk_dialog_set_default_response (GTK_DIALOG (dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_dialog_get_type ()))))))
,
699 GTK_RESPONSE_ACCEPT);
700
701 gtk_window_set_title (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
, _("Delete Profile")gettext ("Delete Profile"));
702 gtk_window_set_resizable (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
, FALSE(0));
703
704 /* Transfer refcount of |selected_profile|, so no unref below */
705 g_object_set_data_full (G_OBJECT (dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), (((GType) ((20) << (2))))))))
, "profile", selected_profile, g_object_unref);
706
707 g_signal_connect (dialog, "response",g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_delete_confirm_response_cb))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
708 G_CALLBACK (profile_list_delete_confirm_response_cb),g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_delete_confirm_response_cb))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
709 NULL)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_delete_confirm_response_cb))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
;
710
711 gtk_window_present (GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
);
712}
713
714static void
715profile_list_new_button_clicked_cb (GtkWidget *button,
716 gpointer data)
717{
718 TerminalApp *app;
719
720 app = terminal_app_get ();
721 terminal_app_new_profile (app, NULL((void*)0), GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
);
722}
723
724static void
725profile_list_edit_button_clicked_cb (GtkWidget *button,
726 GtkWidget *widget)
727{
728 GtkTreeView *tree_view = GTK_TREE_VIEW (widget)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((gtk_tree_view_get_type ()))))))
;
729 GtkTreeSelection *selection;
730 GtkTreeIter iter;
731 GtkTreeModel *model;
732 TerminalProfile *selected_profile;
733 TerminalApp *app;
734
735 app = terminal_app_get ();
736
737 model = gtk_tree_view_get_model (tree_view);
738 selection = gtk_tree_view_get_selection (tree_view);
739
740 if (!gtk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
741 return;
742
743 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
744
745 terminal_app_edit_profile (app, selected_profile,
746 GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
,
747 NULL((void*)0));
748 g_object_unref (selected_profile);
749}
750
751static void
752profile_list_row_activated_cb (GtkTreeView *tree_view,
753 GtkTreePath *path,
754 GtkTreeViewColumn *column,
755 gpointer data)
756{
757 GtkTreeIter iter;
758 GtkTreeModel *model;
759 TerminalProfile *selected_profile;
760 TerminalApp *app;
761
762 app = terminal_app_get ();
763
764 model = gtk_tree_view_get_model (tree_view);
765
766 if (!gtk_tree_model_get_iter (model, &iter, path))
767 return;
768
769 gtk_tree_model_get (model, &iter, (int) COL_PROFILE, &selected_profile, (int) -1);
770
771 terminal_app_edit_profile (app, selected_profile,
772 GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
,
773 NULL((void*)0));
774 g_object_unref (selected_profile);
775}
776
777static GList*
778find_profile_link (GList *profiles,
779 const char *name)
780{
781 GList *l;
782
783 for (l = profiles; l != NULL((void*)0); l = l->next)
784 {
785 const char *profile_name;
786
787 profile_name = terminal_profile_get_property_string (TERMINAL_PROFILE (l->data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((terminal_profile_get_type ()))))))
, TERMINAL_PROFILE_NAME"name");
788 if (profile_name && strcmp (profile_name, name) == 0)
789 break;
790 }
791
792 return l;
793}
794
795static void
796terminal_app_profile_list_notify_cb (GSettings *settings,
797 const gchar *key,
798 gpointer user_data)
799{
800 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
801 GObject *object = G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
;
802 GVariant *val;
803 const gchar **value_list;
804 int i;
805 GList *profiles_to_delete, *l;
806 gboolean need_new_default;
807 TerminalProfile *fallback;
808 guint count;
809
810 g_object_freeze_notify (object);
811
812 profiles_to_delete = terminal_app_get_profile_list (app);
813
814 val = g_settings_get_value (settings, key);
815 if (val == NULL((void*)0) ||
816 (!g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY((const GVariantType *) "as")) &&
817 !g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s"))))
818 goto ensure_one_profile;
819
820 value_list = g_variant_get_strv (val, NULL((void*)0));
821 if (value_list == NULL((void*)0))
822 goto ensure_one_profile;
823
824 /* Add any new ones */
825 for (i = 0; value_list[i] != NULL((void*)0); ++i)
826 {
827 const char *profile_name = value_list[i];
828 GList *link;
829
830 if (!profile_name)
831 continue;
832
833 link = find_profile_link (profiles_to_delete, profile_name);
834 if (link)
835 /* make profiles_to_delete point to profiles we didn't find in the list */
836 profiles_to_delete = g_list_delete_link (profiles_to_delete, link);
837 else
838 terminal_app_create_profile (app, profile_name);
839 }
840
841 g_free (value_list);
842
843ensure_one_profile:
844
845 if (val != NULL((void*)0))
846 g_variant_unref (val);
847
848 fallback = NULL((void*)0);
849 count = g_hash_table_size (app->profiles);
850 if (count == 0 || count <= g_list_length (profiles_to_delete))
851 {
852 /* We are going to run out, so create the fallback
853 * to be sure we always have one. Must be done
854 * here before we emit "forgotten" signals so that
855 * screens have a profile to fall back to.
856 *
857 * If the profile with the FALLBACK_ID already exists,
858 * we aren't allowed to delete it, unless at least one
859 * other profile will still exist. And if you delete
860 * all profiles, the FALLBACK_ID profile returns as
861 * the living dead.
862 */
863 fallback = terminal_app_get_profile_by_name (app, FALLBACK_PROFILE_ID"default");
864 if (fallback == NULL((void*)0))
865 fallback = terminal_app_create_profile (app, FALLBACK_PROFILE_ID"default");
866 g_assert (fallback != NULL)do { if (fallback != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 866, ((const char*) (__func__
)), "fallback != NULL"); } while (0)
;
867 }
868
869 /* Forget no-longer-existing profiles */
870 need_new_default = FALSE(0);
871 for (l = profiles_to_delete; l != NULL((void*)0); l = l->next)
872 {
873 TerminalProfile *profile = TERMINAL_PROFILE (l->data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((terminal_profile_get_type ()))))))
;
874 const char *name;
875
876 name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME"name");
877 if (strcmp (name, FALLBACK_PROFILE_ID"default") == 0)
878 continue;
879
880 if (profile == app->default_profile)
881 {
882 app->default_profile = NULL((void*)0);
883 need_new_default = TRUE(!(0));
884 }
885
886 _terminal_profile_forget (profile);
887 g_hash_table_remove (app->profiles, name);
888
889 /* |profile| possibly isn't dead yet since the profiles dialogue's tree model holds a ref too... */
890 }
891 g_list_free (profiles_to_delete);
892
893 if (need_new_default)
894 {
895 TerminalProfile *new_default;
896 TerminalProfile **new_default_ptr = &new_default;
897
898 new_default = terminal_app_get_profile_by_name (app, FALLBACK_PROFILE_ID"default");
899 if (new_default == NULL((void*)0))
900 {
901 GHashTableIter iter;
902
903 g_hash_table_iter_init (&iter, app->profiles);
904 if (!g_hash_table_iter_next (&iter, NULL((void*)0), (gpointer *) new_default_ptr))
905 /* shouldn't really happen ever, but just to be safe */
906 new_default = terminal_app_create_profile (app, FALLBACK_PROFILE_ID"default");
907 }
908 g_assert (new_default != NULL)do { if (new_default != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 908, ((const char*) (__func__
)), "new_default != NULL"); } while (0)
;
909
910 app->default_profile = new_default;
911
912 g_object_notify (object, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
913 }
914
915 g_assert (g_hash_table_size (app->profiles) > 0)do { if (g_hash_table_size (app->profiles) > 0) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 915, ((const char*) (__func__
)), "g_hash_table_size (app->profiles) > 0"); } while (
0)
;
916
917 g_signal_emit (app, signals[PROFILE_LIST_CHANGED], 0);
918
919 g_object_thaw_notify (object);
920}
921
922static void
923terminal_app_default_profile_notify_cb (GSettings *settings,
924 const gchar *key,
925 gpointer user_data)
926{
927 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
928 GVariant *val;
929 const char *name = NULL((void*)0);
930
931 app->default_profile_locked = !g_settings_is_writable (settings, key);
932
933 val = g_settings_get_value (settings, key);
934 if (val != NULL((void*)0) &&
935 g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
936 name = g_variant_get_string (val, NULL((void*)0));
937 if (!name || !name[0])
938 name = FALLBACK_PROFILE_ID"default";
939 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-app.c", 939, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
940
941 g_free (app->default_profile_id);
942 app->default_profile_id = g_strdup (name)g_strdup_inline (name);
943
944 app->default_profile = terminal_app_get_profile_by_name (app, name);
945
946 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_DEFAULT_PROFILE"default-profile");
947 g_variant_unref (val);
948}
949
950static int
951compare_encodings (TerminalEncoding *a,
952 TerminalEncoding *b)
953{
954 return g_utf8_collate (a->name, b->name);
955}
956
957static void
958encoding_mark_active (gpointer key,
959 gpointer value,
960 gpointer data)
961{
962 TerminalEncoding *encoding = (TerminalEncoding *) value;
963 guint active = GPOINTER_TO_UINT (data)((guint) (gulong) (data));
964
965 encoding->is_active = active;
966}
967
968static void
969terminal_app_encoding_list_notify_cb (GSettings *settings,
970 const gchar *key,
971 gpointer user_data)
972{
973 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
974 GVariant *val;
975 const gchar **strings;
976 int i;
977 TerminalEncoding *encoding;
978 const char *charset;
979
980 app->encodings_locked = !g_settings_is_writable (settings, key);
981
982 /* Mark all as non-active, then re-enable the active ones */
983 g_hash_table_foreach (app->encodings, (GHFunc) encoding_mark_active, GUINT_TO_POINTER (FALSE)((gpointer) (gulong) ((0))));
984
985 /* First add the locale's charset */
986 encoding = g_hash_table_lookup (app->encodings, "current");
987 g_assert (encoding)do { if (encoding) ; else g_assertion_message_expr (((gchar*)
0), "terminal-app.c", 987, ((const char*) (__func__)), "encoding"
); } while (0)
;
988 if (terminal_encoding_is_valid (encoding))
989 encoding->is_active = TRUE(!(0));
990
991 /* Also always make UTF-8 available */
992 encoding = g_hash_table_lookup (app->encodings, "UTF-8");
993 g_assert (encoding)do { if (encoding) ; else g_assertion_message_expr (((gchar*)
0), "terminal-app.c", 993, ((const char*) (__func__)), "encoding"
); } while (0)
;
994 if (terminal_encoding_is_valid (encoding))
995 encoding->is_active = TRUE(!(0));
996
997 val = g_settings_get_value (settings, key);
998 if (val != NULL((void*)0) &&
999 g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY((const GVariantType *) "as")))
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
1000 strings = g_variant_get_strv (val, NULL((void*)0));
1001 else
1002 strings = NULL((void*)0);
1003
1004 if (strings != NULL((void*)0))
1005 {
1006 for (i = 0; strings[i] != NULL((void*)0); ++i)
1007 {
1008 charset = strings[i];
1009 if (!charset)
1010 continue;
1011
1012 encoding = terminal_app_ensure_encoding (app, charset);
1013 if (!terminal_encoding_is_valid (encoding))
1014 continue;
1015
1016 encoding->is_active = TRUE(!(0));
1017 }
1018
1019 g_free (strings);
1020 }
1021
1022 g_signal_emit (app, signals[ENCODING_LIST_CHANGED], 0);
1023
1024 if (val != NULL((void*)0))
1025 g_variant_unref (val);
1026}
1027
1028static void
1029terminal_app_system_font_notify_cb (GSettings *settings,
1030 const gchar *key,
1031 gpointer user_data)
1032{
1033 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
1034 GVariant *val;
1035 const char *font = NULL((void*)0);
1036 PangoFontDescription *font_desc;
1037
1038 if (strcmp (key, MONOSPACE_FONT_KEY"monospace-font-name") != 0)
1039 return;
1040
1041 val = g_settings_get_value (settings, key);
1042 if (val &&
1043 g_variant_is_of_type (val, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
1044 font = g_variant_get_string (val, NULL((void*)0));
1045 if (!font)
1046 font = DEFAULT_MONOSPACE_FONT("Monospace 10");
1047 g_assert (font != NULL)do { if (font != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-app.c", 1047, ((const char*) (__func__
)), "font != NULL"); } while (0)
;
1048
1049 if (font && (strlen (font) == 0)) /* empty string */
1050 font = DEFAULT_MONOSPACE_FONT("Monospace 10");
1051
1052 font_desc = pango_font_description_from_string (font);
1053 if (app->system_font_desc &&
1054 pango_font_description_equal (app->system_font_desc, font_desc))
1055 {
1056 pango_font_description_free (font_desc);
1057 return;
1058 }
1059
1060 if (app->system_font_desc)
1061 pango_font_description_free (app->system_font_desc);
1062
1063 app->system_font_desc = font_desc;
1064
1065 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_SYSTEM_FONT"system-font");
1066 g_variant_unref (val);
1067}
1068
1069static void
1070terminal_app_enable_mnemonics_notify_cb (GSettings *settings,
1071 const gchar *key,
1072 gpointer user_data)
1073{
1074 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
1075 gboolean enable;
1076
1077 enable = g_settings_get_boolean (settings, key);
1078 if (enable == app->enable_mnemonics)
1079 return;
1080
1081 app->enable_mnemonics = enable;
1082 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_ENABLE_MNEMONICS"enable-mnemonics");
1083}
1084
1085static void
1086terminal_app_enable_menu_accels_notify_cb (GSettings *settings,
1087 const gchar *key,
1088 gpointer user_data)
1089{
1090 TerminalApp *app = TERMINAL_APP (user_data)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_app_get_type ()))))))
;
1091 gboolean enable;
1092
1093 enable = g_settings_get_boolean (settings, key);
1094 if (enable == app->enable_menu_accels)
1095 return;
1096
1097 app->enable_menu_accels = enable;
1098 g_object_notify (G_OBJECT (app)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app)), (((GType) ((20) << (2))))))))
, TERMINAL_APP_ENABLE_MENU_BAR_ACCEL"enable-menu-accels");
1099}
1100
1101static void
1102new_profile_response_cb (GtkWidget *new_profile_dialog,
1103 int response_id,
1104 TerminalApp *app)
1105{
1106 if (response_id == GTK_RESPONSE_ACCEPT)
1107 {
1108 GtkWidget *name_entry;
1109 char *name;
1110 const char *new_profile_name;
1111 GtkWidget *base_option_menu;
1112 TerminalProfile *base_profile = NULL((void*)0);
1113 TerminalProfile *new_profile;
1114 GList *profiles;
1115 GList *tmp;
1116 GtkWindow *transient_parent;
1117 GtkWidget *confirm_dialog;
1118 gint retval;
1119
1120 base_option_menu = g_object_get_data (G_OBJECT (new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), (((GType) ((20) << (2)))))))
)
, "base_option_menu");
1121 base_profile = profile_combo_box_get_selected (base_option_menu);
1122 if (!base_profile)
1123 base_profile = terminal_app_get_default_profile (app);
1124 if (!base_profile)
1125 return; /* shouldn't happen ever though */
1126
1127 name_entry = g_object_get_data (G_OBJECT (new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), (((GType) ((20) << (2)))))))
)
, "name_entry");
1128 name = gtk_editable_get_chars (GTK_EDITABLE (name_entry)((((GtkEditable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((name_entry)), ((gtk_editable_get_type ()))))))
, 0, -1);
1129 g_strstrip (name)g_strchomp (g_strchug (name)); /* name will be non empty after stripping */
1130
1131 profiles = terminal_app_get_profile_list (app);
1132 for (tmp = profiles; tmp != NULL((void*)0); tmp = tmp->next)
1133 {
1134 TerminalProfile *profile = tmp->data;
1135 const char *visible_name;
1136
1137 visible_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_VISIBLE_NAME"visible-name");
1138
1139 if (visible_name && strcmp (name, visible_name) == 0)
1140 break;
1141 }
1142 if (tmp)
1143 {
1144 confirm_dialog = gtk_message_dialog_new (GTK_WINDOW (new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), ((gtk_window_get_type ()))))))
,
1145 GTK_DIALOG_DESTROY_WITH_PARENT,
1146 GTK_MESSAGE_QUESTION,
1147 GTK_BUTTONS_YES_NO,
1148 _("You already have a profile called “%s”. Do you want to create another profile with the same name?")gettext ("You already have a profile called “%s”. Do you want to create another profile with the same name?"
)
, name);
1149 /* Alternative button order was set automatically by GtkMessageDialog */
1150 retval = gtk_dialog_run (GTK_DIALOG (confirm_dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((confirm_dialog)), ((gtk_dialog_get_type ()))))))
);
1151 gtk_widget_destroy (confirm_dialog);
1152 if (retval == GTK_RESPONSE_NO)
1153 goto cleanup;
1154 }
1155 g_list_free (profiles);
1156
1157 transient_parent = gtk_window_get_transient_for (GTK_WINDOW (new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), ((gtk_window_get_type ()))))))
);
1158
1159 new_profile = _terminal_profile_clone (base_profile, name);
1160 new_profile_name = terminal_profile_get_property_string (new_profile, TERMINAL_PROFILE_NAME"name");
1161 g_hash_table_insert (app->profiles,
1162 g_strdup (new_profile_name)g_strdup_inline (new_profile_name),
1163 new_profile /* adopts the refcount */);
1164
1165 /* And now save the new profile name to GSettings */
1166 gsettings_append_strv (settings_global,
1167 PROFILE_LIST_KEY"profile-list",
1168 new_profile_name);
1169
1170 terminal_profile_edit (new_profile, transient_parent, NULL((void*)0));
1171
1172cleanup:
1173 g_free (name);
1174 }
1175
1176 gtk_widget_destroy (new_profile_dialog);
1177}
1178
1179static void
1180new_profile_dialog_destroy_cb (GtkWidget *new_profile_dialog,
1181 TerminalApp *app)
1182{
1183 GtkWidget *combo;
1184
1185 combo = g_object_get_data (G_OBJECT (new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_profile_dialog)), (((GType) ((20) << (2)))))))
)
, "base_option_menu");
1186 g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_combo_box_refill), combo)g_signal_handlers_disconnect_matched ((app), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (profile_combo_box_refill))), (combo))
;
1187
1188 app->new_profile_dialog = NULL((void*)0);
1189}
1190
1191static void
1192new_profile_name_entry_changed_cb (GtkEntry *entry,
1193 GtkDialog *dialog)
1194{
1195 const char *name;
1196
1197 name = gtk_entry_get_text (entry);
1198
1199 /* make the create button sensitive only if something other than space has been set */
1200 while (*name != '\0' && g_ascii_isspace (*name)((g_ascii_table[(guchar) (*name)] & G_ASCII_SPACE) != 0))
1201 ++name;
1202
1203 gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_ACCEPT, name[0] != '\0');
1204}
1205
1206void
1207terminal_app_new_profile (TerminalApp *app,
1208 TerminalProfile *default_base_profile,
1209 GtkWindow *transient_parent)
1210{
1211 if (app->new_profile_dialog == NULL((void*)0))
1212 {
1213 GtkWidget *create_button, *grid, *name_label, *name_entry, *base_label, *combo;
1214
1215 if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX"/org/mate/terminal" G_DIR_SEPARATOR_S"/" "ui/profile-new-dialog.ui",
1216 "new-profile-dialog", &app->new_profile_dialog,
1217 "new-profile-create-button", &create_button,
1218 "new-profile-grid", &grid,
1219 "new-profile-name-label", &name_label,
1220 "new-profile-name-entry", &name_entry,
1221 "new-profile-base-label", &base_label,
1222 NULL((void*)0)))
1223 return;
1224
1225 g_signal_connect (G_OBJECT (app->new_profile_dialog), "response", G_CALLBACK (new_profile_response_cb), app)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((app->new_profile_dialog)), (((GType) (
(20) << (2))))))))), ("response"), (((GCallback) (new_profile_response_cb
))), (app), ((void*)0), (GConnectFlags) 0)
;
1226 g_signal_connect (app->new_profile_dialog, "destroy", G_CALLBACK (new_profile_dialog_destroy_cb), app)g_signal_connect_data ((app->new_profile_dialog), ("destroy"
), (((GCallback) (new_profile_dialog_destroy_cb))), (app), ((
void*)0), (GConnectFlags) 0)
;
1227
1228 g_object_set_data (G_OBJECT (app->new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), (((GType) ((20) << (
2))))))))
, "create_button", create_button);
1229 gtk_widget_set_sensitive (create_button, FALSE(0));
1230
1231 /* the name entry */
1232 g_object_set_data (G_OBJECT (app->new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), (((GType) ((20) << (
2))))))))
, "name_entry", name_entry);
1233 g_signal_connect (name_entry, "changed", G_CALLBACK (new_profile_name_entry_changed_cb), app->new_profile_dialog)g_signal_connect_data ((name_entry), ("changed"), (((GCallback
) (new_profile_name_entry_changed_cb))), (app->new_profile_dialog
), ((void*)0), (GConnectFlags) 0)
;
1234 gtk_entry_set_activates_default (GTK_ENTRY (name_entry)((((GtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((name_entry)), ((gtk_entry_get_type ()))))))
, TRUE(!(0)));
1235 gtk_widget_grab_focus (name_entry);
1236
1237 gtk_label_set_mnemonic_widget (GTK_LABEL (name_label)((((GtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((name_label)), ((gtk_label_get_type ()))))))
, name_entry);
1238
1239 /* the base profile option menu */
1240 combo = profile_combo_box_new (app);
1241 gtk_grid_attach (GTK_GRID (grid)((((GtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((gtk_grid_get_type ()))))))
, combo, 2, 1, 1, 1);
1242 g_object_set_data (G_OBJECT (app->new_profile_dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), (((GType) ((20) << (
2))))))))
, "base_option_menu", combo);
1243 terminal_util_set_atk_name_description (combo, NULL((void*)0), _("Choose base profile")gettext ("Choose base profile"));
1244
1245 gtk_label_set_mnemonic_widget (GTK_LABEL (base_label)((((GtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((base_label)), ((gtk_label_get_type ()))))))
, combo);
1246
1247 gtk_dialog_set_default_response (GTK_DIALOG (app->new_profile_dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_dialog_get_type ()))
))))
, GTK_RESPONSE_ACCEPT);
1248 gtk_dialog_set_response_sensitive (GTK_DIALOG (app->new_profile_dialog)((((GtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_dialog_get_type ()))
))))
, GTK_RESPONSE_ACCEPT, FALSE(0));
1249 }
1250
1251 gtk_window_set_transient_for (GTK_WINDOW (app->new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_window_get_type ()))
))))
,
1252 transient_parent);
1253
1254 gtk_window_present (GTK_WINDOW (app->new_profile_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->new_profile_dialog)), ((gtk_window_get_type ()))
))))
);
1255}
1256
1257static void
1258profile_list_selection_changed_cb (GtkTreeSelection *selection,
1259 TerminalApp *app)
1260{
1261 gboolean selected;
1262
1263 selected = gtk_tree_selection_get_selected (selection, NULL((void*)0), NULL((void*)0));
1264
1265 gtk_widget_set_sensitive (app->manage_profiles_edit_button, selected);
1266 gtk_widget_set_sensitive (app->manage_profiles_delete_button,
1267 selected &&
1268 g_hash_table_size (app->profiles) > 1);
1269}
1270
1271static void
1272profile_list_response_cb (GtkWidget *dialog,
1273 int id,
1274 TerminalApp *app)
1275{
1276 g_assert (app->manage_profiles_dialog == dialog)do { if (app->manage_profiles_dialog == dialog) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1276, ((const char*) (__func__
)), "app->manage_profiles_dialog == dialog"); } while (0)
;
1277
1278 if (id == GTK_RESPONSE_HELP)
1279 {
1280 terminal_util_show_help ("mate-terminal-manage-profiles", GTK_WINDOW (dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_window_get_type ()))))))
);
1281 return;
1282 }
1283
1284 gtk_widget_destroy (dialog);
1285}
1286
1287static void
1288profile_list_destroyed_cb (GtkWidget *manage_profiles_dialog,
1289 TerminalApp *app)
1290{
1291 g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_list_treeview_refill), app->manage_profiles_list)g_signal_handlers_disconnect_matched ((app), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (profile_list_treeview_refill))), (app->
manage_profiles_list))
;
1292 g_signal_handlers_disconnect_by_func (app, G_CALLBACK (profile_combo_box_refill), app->manage_profiles_default_menu)g_signal_handlers_disconnect_matched ((app), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (profile_combo_box_refill))), (app->manage_profiles_default_menu
))
;
1293
1294 app->manage_profiles_dialog = NULL((void*)0);
1295 app->manage_profiles_list = NULL((void*)0);
1296 app->manage_profiles_new_button = NULL((void*)0);
1297 app->manage_profiles_edit_button = NULL((void*)0);
1298 app->manage_profiles_delete_button = NULL((void*)0);
1299 app->manage_profiles_default_menu = NULL((void*)0);
1300}
1301
1302void
1303terminal_app_manage_profiles (TerminalApp *app,
1304 GtkWindow *transient_parent)
1305{
1306 GObject *dialog;
1307 GObject *tree_view_container, *new_button, *edit_button, *remove_button;
1308 GObject *default_hbox, *default_label;
1309 GtkTreeSelection *selection;
1310
1311 if (app->manage_profiles_dialog)
1312 {
1313 gtk_window_set_transient_for (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
, transient_parent);
1314 gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
);
1315 return;
1316 }
1317
1318 if (!terminal_util_load_builder_resource (TERMINAL_RESOURCES_PATH_PREFIX"/org/mate/terminal" G_DIR_SEPARATOR_S"/" "ui/profile-manager.ui",
1319 "profile-manager", &dialog,
1320 "profiles-treeview-container", &tree_view_container,
1321 "new-profile-button", &new_button,
1322 "edit-profile-button", &edit_button,
1323 "delete-profile-button", &remove_button,
1324 "default-profile-hbox", &default_hbox,
1325 "default-profile-label", &default_label,
1326 NULL((void*)0)))
1327 return;
1328
1329 app->manage_profiles_dialog = GTK_WIDGET (dialog)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((gtk_widget_get_type ()))))))
;
1330 app->manage_profiles_new_button = GTK_WIDGET (new_button)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((new_button)), ((gtk_widget_get_type ()))))))
;
1331 app->manage_profiles_edit_button = GTK_WIDGET (edit_button)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((edit_button)), ((gtk_widget_get_type ()))))))
;
1332 app->manage_profiles_delete_button = GTK_WIDGET (remove_button)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((remove_button)), ((gtk_widget_get_type ()))))))
;
1333
1334 g_signal_connect (dialog, "response", G_CALLBACK (profile_list_response_cb), app)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
profile_list_response_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1335 g_signal_connect (dialog, "destroy", G_CALLBACK (profile_list_destroyed_cb), app)g_signal_connect_data ((dialog), ("destroy"), (((GCallback) (
profile_list_destroyed_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1336
1337 app->manage_profiles_list = profile_list_treeview_create (app);
1338
1339 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (app->manage_profiles_list)((((GtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_list)), ((gtk_tree_view_get_type
()))))))
);
1340 g_signal_connect (selection, "changed", G_CALLBACK (profile_list_selection_changed_cb), app)g_signal_connect_data ((selection), ("changed"), (((GCallback
) (profile_list_selection_changed_cb))), (app), ((void*)0), (
GConnectFlags) 0)
;
1341
1342 profile_list_treeview_refill (app, app->manage_profiles_list);
1343 g_signal_connect (app, "profile-list-changed",g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_list_treeview_refill))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1344 G_CALLBACK (profile_list_treeview_refill), app->manage_profiles_list)g_signal_connect_data ((app), ("profile-list-changed"), (((GCallback
) (profile_list_treeview_refill))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1345
1346 g_signal_connect (app->manage_profiles_list, "row-activated",g_signal_connect_data ((app->manage_profiles_list), ("row-activated"
), (((GCallback) (profile_list_row_activated_cb))), (app), ((
void*)0), (GConnectFlags) 0)
1347 G_CALLBACK (profile_list_row_activated_cb), app)g_signal_connect_data ((app->manage_profiles_list), ("row-activated"
), (((GCallback) (profile_list_row_activated_cb))), (app), ((
void*)0), (GConnectFlags) 0)
;
1348
1349 gtk_container_add (GTK_CONTAINER (tree_view_container)((((GtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view_container)), ((gtk_container_get_type ()))))))
, app->manage_profiles_list);
1350 gtk_widget_show (app->manage_profiles_list);
1351
1352 g_signal_connect (new_button, "clicked",g_signal_connect_data ((new_button), ("clicked"), (((GCallback
) (profile_list_new_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1353 G_CALLBACK (profile_list_new_button_clicked_cb),g_signal_connect_data ((new_button), ("clicked"), (((GCallback
) (profile_list_new_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1354 app->manage_profiles_list)g_signal_connect_data ((new_button), ("clicked"), (((GCallback
) (profile_list_new_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1355 g_signal_connect (edit_button, "clicked",g_signal_connect_data ((edit_button), ("clicked"), (((GCallback
) (profile_list_edit_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1356 G_CALLBACK (profile_list_edit_button_clicked_cb),g_signal_connect_data ((edit_button), ("clicked"), (((GCallback
) (profile_list_edit_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1357 app->manage_profiles_list)g_signal_connect_data ((edit_button), ("clicked"), (((GCallback
) (profile_list_edit_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1358 g_signal_connect (remove_button, "clicked",g_signal_connect_data ((remove_button), ("clicked"), (((GCallback
) (profile_list_delete_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1359 G_CALLBACK (profile_list_delete_button_clicked_cb),g_signal_connect_data ((remove_button), ("clicked"), (((GCallback
) (profile_list_delete_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
1360 app->manage_profiles_list)g_signal_connect_data ((remove_button), ("clicked"), (((GCallback
) (profile_list_delete_button_clicked_cb))), (app->manage_profiles_list
), ((void*)0), (GConnectFlags) 0)
;
1361
1362 app->manage_profiles_default_menu = profile_combo_box_new (app);
1363 g_signal_connect (app->manage_profiles_default_menu, "changed",g_signal_connect_data ((app->manage_profiles_default_menu)
, ("changed"), (((GCallback) (profile_combo_box_changed_cb)))
, (app), ((void*)0), (GConnectFlags) 0)
1364 G_CALLBACK (profile_combo_box_changed_cb), app)g_signal_connect_data ((app->manage_profiles_default_menu)
, ("changed"), (((GCallback) (profile_combo_box_changed_cb)))
, (app), ((void*)0), (GConnectFlags) 0)
;
1365
1366 gtk_box_pack_start (GTK_BOX (default_hbox)((((GtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((default_hbox)), ((gtk_box_get_type ()))))))
, app->manage_profiles_default_menu, FALSE(0), FALSE(0), 0);
1367 gtk_widget_show (app->manage_profiles_default_menu);
1368
1369 gtk_label_set_mnemonic_widget (GTK_LABEL (default_label)((((GtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((default_label)), ((gtk_label_get_type ()))))))
, app->manage_profiles_default_menu);
1370
1371 gtk_widget_grab_focus (app->manage_profiles_list);
1372
1373 gtk_window_set_transient_for (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
,
1374 transient_parent);
1375
1376 gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((app->manage_profiles_dialog)), ((gtk_window_get_type (
)))))))
);
1377}
1378
1379#ifdef HAVE_SMCLIENT1
1380static void
1381terminal_app_save_state_cb (EggSMClient *client,
1382 GKeyFile *key_file,
1383 TerminalApp *app)
1384{
1385 terminal_app_save_config (app, key_file);
1386}
1387
1388static void
1389terminal_app_client_quit_cb (EggSMClient *client,
1390 TerminalApp *app)
1391{
1392 g_signal_emit (app, signals[QUIT], 0);
1393}
1394#endif /* HAVE_SMCLIENT */
1395
1396/* Class implementation */
1397
1398G_DEFINE_TYPE (TerminalApp, terminal_app, G_TYPE_OBJECT)static void terminal_app_init (TerminalApp *self); static void
terminal_app_class_init (TerminalAppClass *klass); static GType
terminal_app_get_type_once (void); static gpointer terminal_app_parent_class
= ((void*)0); static gint TerminalApp_private_offset; static
void terminal_app_class_intern_init (gpointer klass) { terminal_app_parent_class
= g_type_class_peek_parent (klass); if (TerminalApp_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &TerminalApp_private_offset
); terminal_app_class_init ((TerminalAppClass*) klass); } __attribute__
((__unused__)) static inline gpointer terminal_app_get_instance_private
(TerminalApp *self) { return (((gpointer) ((guint8*) (self) +
(glong) (TerminalApp_private_offset)))); } GType terminal_app_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ _Static_assert (sizeof *(&static_g_define_type_id) ==
sizeof (gpointer), "Expression evaluates to false"); (void) (
0 ? (gpointer) *(&static_g_define_type_id) : ((void*)0));
(!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = terminal_app_get_type_once
(); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } __attribute__ ((__noinline__)) static GType terminal_app_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
(((GType) ((20) << (2))), g_intern_static_string ("TerminalApp"
), sizeof (TerminalAppClass), (GClassInitFunc)(void (*)(void)
) terminal_app_class_intern_init, sizeof (TerminalApp), (GInstanceInitFunc
)(void (*)(void)) terminal_app_init, (GTypeFlags) 0); { {{};}
} return g_define_type_id; }
1399
1400static void
1401terminal_app_init (TerminalApp *app)
1402{
1403 global_app = app;
1404
1405 gtk_window_set_default_icon_name (MATE_TERMINAL_ICON_NAME"utilities-terminal");
1406
1407 /* Initialise defaults */
1408 app->enable_mnemonics = DEFAULT_ENABLE_MNEMONICS((!(0)));
1409 app->enable_menu_accels = DEFAULT_ENABLE_MENU_BAR_ACCEL((!(0)));
1410
1411 app->profiles = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
1412
1413 app->encodings = terminal_encodings_get_builtins ();
1414
1415 settings_global = g_settings_new (CONF_GLOBAL_SCHEMA"org.mate.terminal" ".global");
1416 app->settings_font = g_settings_new (MONOSPACE_FONT_SCHEMA"org.mate.interface");
1417
1418 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1419 "changed::" PROFILE_LIST_KEY,g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1420 G_CALLBACK(terminal_app_profile_list_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1421 app)g_signal_connect_data ((settings_global), ("changed::" "profile-list"
), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
;
1422
1423 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
1424 "changed::" DEFAULT_PROFILE_KEY,g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
1425 G_CALLBACK(terminal_app_default_profile_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
1426 app)g_signal_connect_data ((settings_global), ("changed::" "default-profile"
), (((GCallback) (terminal_app_default_profile_notify_cb))), (
app), ((void*)0), (GConnectFlags) 0)
;
1427
1428 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1429 "changed::" ENCODING_LIST_KEY,g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1430 G_CALLBACK(terminal_app_encoding_list_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1431 app)g_signal_connect_data ((settings_global), ("changed::" "active-encodings"
), (((GCallback) (terminal_app_encoding_list_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
;
1432
1433 g_signal_connect (app->settings_font,g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1434 "changed::" MONOSPACE_FONT_KEY,g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1435 G_CALLBACK(terminal_app_system_font_notify_cb),g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
1436 app)g_signal_connect_data ((app->settings_font), ("changed::" "monospace-font-name"
), (((GCallback) (terminal_app_system_font_notify_cb))), (app
), ((void*)0), (GConnectFlags) 0)
;
1437
1438 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
1439 "changed::" ENABLE_MNEMONICS_KEY,g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
1440 G_CALLBACK(terminal_app_enable_mnemonics_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
1441 app)g_signal_connect_data ((settings_global), ("changed::" "use-mnemonics"
), (((GCallback) (terminal_app_enable_mnemonics_notify_cb))),
(app), ((void*)0), (GConnectFlags) 0)
;
1442
1443 g_signal_connect (settings_global,g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
1444 "changed::" ENABLE_MENU_BAR_ACCEL_KEY,g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
1445 G_CALLBACK(terminal_app_enable_menu_accels_notify_cb),g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
1446 app)g_signal_connect_data ((settings_global), ("changed::" "use-menu-accelerators"
), (((GCallback) (terminal_app_enable_menu_accels_notify_cb))
), (app), ((void*)0), (GConnectFlags) 0)
;
1447
1448 /* Load the settings */
1449 terminal_app_profile_list_notify_cb (settings_global,
1450 PROFILE_LIST_KEY"profile-list",
1451 app);
1452 terminal_app_default_profile_notify_cb (settings_global,
1453 DEFAULT_PROFILE_KEY"default-profile",
1454 app);
1455 terminal_app_encoding_list_notify_cb (settings_global,
1456 ENCODING_LIST_KEY"active-encodings",
1457 app);
1458 terminal_app_system_font_notify_cb (app->settings_font,
1459 MONOSPACE_FONT_KEY"monospace-font-name",
1460 app);
1461 terminal_app_enable_menu_accels_notify_cb (settings_global,
1462 ENABLE_MENU_BAR_ACCEL_KEY"use-menu-accelerators",
1463 app);
1464 terminal_app_enable_mnemonics_notify_cb (settings_global,
1465 ENABLE_MNEMONICS_KEY"use-mnemonics",
1466 app);
1467
1468 /* Ensure we have valid settings */
1469 g_assert (app->default_profile_id != NULL)do { if (app->default_profile_id != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1469, ((const char*) (__func__
)), "app->default_profile_id != NULL"); } while (0)
;
1470 g_assert (app->system_font_desc != NULL)do { if (app->system_font_desc != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1470, ((const char*) (__func__
)), "app->system_font_desc != NULL"); } while (0)
;
1471
1472 terminal_accels_init ();
1473
1474#ifdef HAVE_SMCLIENT1
1475 EggSMClient *sm_client;
1476 char *desktop_file;
1477
1478 desktop_file = g_build_filename (TERM_DATADIR"/usr/local/share",
1479 "applications",
1480 PACKAGE"mate-terminal" ".desktop",
1481 NULL((void*)0));
1482 egg_set_desktop_file_without_defaults (desktop_file);
1483 g_free (desktop_file);
1484
1485 sm_client = egg_sm_client_get ();
1486 g_signal_connect (sm_client, "save-state",g_signal_connect_data ((sm_client), ("save-state"), (((GCallback
) (terminal_app_save_state_cb))), (app), ((void*)0), (GConnectFlags
) 0)
1487 G_CALLBACK (terminal_app_save_state_cb), app)g_signal_connect_data ((sm_client), ("save-state"), (((GCallback
) (terminal_app_save_state_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1488 g_signal_connect (sm_client, "quit",g_signal_connect_data ((sm_client), ("quit"), (((GCallback) (
terminal_app_client_quit_cb))), (app), ((void*)0), (GConnectFlags
) 0)
1489 G_CALLBACK (terminal_app_client_quit_cb), app)g_signal_connect_data ((sm_client), ("quit"), (((GCallback) (
terminal_app_client_quit_cb))), (app), ((void*)0), (GConnectFlags
) 0)
;
1490#endif /* HAVE_SMCLIENT */
1491}
1492
1493static void
1494terminal_app_finalize (GObject *object)
1495{
1496 TerminalApp *app = TERMINAL_APP (object)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_app_get_type ()))))))
;
1497
1498#ifdef HAVE_SMCLIENT1
1499 EggSMClient *sm_client;
1500
1501 sm_client = egg_sm_client_get ();
1502 g_signal_handlers_disconnect_matched (sm_client, G_SIGNAL_MATCH_DATA,
1503 0, 0, NULL((void*)0), NULL((void*)0), app);
1504#endif /* HAVE_SMCLIENT */
1505
1506 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
))
1507 G_CALLBACK(terminal_app_profile_list_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
))
1508 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_profile_list_notify_cb))), (app
))
;
1509 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_default_profile_notify_cb))),
(app))
1510 G_CALLBACK(terminal_app_default_profile_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_default_profile_notify_cb))),
(app))
1511 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_default_profile_notify_cb))),
(app))
;
1512 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_encoding_list_notify_cb))), (
app))
1513 G_CALLBACK(terminal_app_encoding_list_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_encoding_list_notify_cb))), (
app))
1514 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_encoding_list_notify_cb))), (
app))
;
1515 g_signal_handlers_disconnect_by_func (app->settings_font,g_signal_handlers_disconnect_matched ((app->settings_font)
, (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (terminal_app_system_font_notify_cb
))), (app))
1516 G_CALLBACK(terminal_app_system_font_notify_cb),g_signal_handlers_disconnect_matched ((app->settings_font)
, (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (terminal_app_system_font_notify_cb
))), (app))
1517 app)g_signal_handlers_disconnect_matched ((app->settings_font)
, (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (terminal_app_system_font_notify_cb
))), (app))
;
1518 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_menu_accels_notify_cb)
)), (app))
1519 G_CALLBACK(terminal_app_enable_menu_accels_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_menu_accels_notify_cb)
)), (app))
1520 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_menu_accels_notify_cb)
)), (app))
;
1521 g_signal_handlers_disconnect_by_func (settings_global,g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_mnemonics_notify_cb)))
, (app))
1522 G_CALLBACK(terminal_app_enable_mnemonics_notify_cb),g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_mnemonics_notify_cb)))
, (app))
1523 app)g_signal_handlers_disconnect_matched ((settings_global), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_app_enable_mnemonics_notify_cb)))
, (app))
;
1524
1525 g_object_unref (settings_global);
1526 g_object_unref (app->settings_font);
1527
1528 g_free (app->default_profile_id);
1529
1530 g_hash_table_destroy (app->profiles);
1531
1532 g_hash_table_destroy (app->encodings);
1533
1534 pango_font_description_free (app->system_font_desc);
1535
1536 terminal_accels_shutdown ();
1537
1538 G_OBJECT_CLASS (terminal_app_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_app_parent_class)), (((GType) ((20) << (2
))))))))
->finalize (object);
1539
1540 global_app = NULL((void*)0);
1541}
1542
1543static void
1544terminal_app_get_property (GObject *object,
1545 guint prop_id,
1546 GValue *value,
1547 GParamSpec *pspec)
1548{
1549 TerminalApp *app = TERMINAL_APP (object)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_app_get_type ()))))))
;
1550
1551 switch (prop_id)
1552 {
1553 case PROP_SYSTEM_FONT:
1554 if (app->system_font_desc)
1555 g_value_set_boxed (value, app->system_font_desc);
1556 else
1557 g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_MONOSPACE_FONT("Monospace 10")));
1558 break;
1559 case PROP_ENABLE_MENU_BAR_ACCEL:
1560 g_value_set_boolean (value, app->enable_menu_accels);
1561 break;
1562 case PROP_ENABLE_MNEMONICS:
1563 g_value_set_boolean (value, app->enable_mnemonics);
1564 break;
1565 case PROP_DEFAULT_PROFILE:
1566 g_value_set_object (value, app->default_profile);
1567 break;
1568 default:
1569 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-app.c", 1569, ("property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1570 break;
1571 }
1572}
1573
1574static void
1575terminal_app_set_property (GObject *object,
1576 guint prop_id,
1577 const GValue *value,
1578 GParamSpec *pspec)
1579{
1580 TerminalApp *app = TERMINAL_APP (object)((((TerminalApp*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_app_get_type ()))))))
;
1581
1582 switch (prop_id)
1583 {
1584 case PROP_ENABLE_MENU_BAR_ACCEL:
1585 app->enable_menu_accels = g_value_get_boolean (value);
1586 g_settings_set_boolean (settings_global, ENABLE_MENU_BAR_ACCEL_KEY"use-menu-accelerators", app->enable_menu_accels);
1587 break;
1588 case PROP_ENABLE_MNEMONICS:
1589 app->enable_mnemonics = g_value_get_boolean (value);
1590 g_settings_set_boolean (settings_global, ENABLE_MNEMONICS_KEY"use-mnemonics", app->enable_mnemonics);
1591 break;
1592 case PROP_DEFAULT_PROFILE:
1593 case PROP_SYSTEM_FONT:
1594 /* not writable */
1595 default:
1596 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-app.c", 1596, ("property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1597 break;
1598 }
1599}
1600
1601static void
1602terminal_app_real_quit (TerminalApp *app)
1603{
1604 gtk_main_quit();
1605}
1606
1607static void
1608terminal_app_class_init (TerminalAppClass *klass)
1609{
1610 GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
;
1611
1612 object_class->finalize = terminal_app_finalize;
1613 object_class->get_property = terminal_app_get_property;
1614 object_class->set_property = terminal_app_set_property;
1615
1616 klass->quit = terminal_app_real_quit;
1617
1618 signals[QUIT] =
1619 g_signal_new (I_("quit")g_intern_static_string ("quit"),
1620 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1621 G_SIGNAL_RUN_LAST,
1622 G_STRUCT_OFFSET (TerminalAppClass, quit)((glong) __builtin_offsetof(TerminalAppClass, quit)),
1623 NULL((void*)0), NULL((void*)0),
1624 g_cclosure_marshal_VOID__VOID,
1625 G_TYPE_NONE((GType) ((1) << (2))), 0);
1626
1627 signals[PROFILE_LIST_CHANGED] =
1628 g_signal_new (I_("profile-list-changed")g_intern_static_string ("profile-list-changed"),
1629 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1630 G_SIGNAL_RUN_LAST,
1631 G_STRUCT_OFFSET (TerminalAppClass, profile_list_changed)((glong) __builtin_offsetof(TerminalAppClass, profile_list_changed
))
,
1632 NULL((void*)0), NULL((void*)0),
1633 g_cclosure_marshal_VOID__VOID,
1634 G_TYPE_NONE((GType) ((1) << (2))), 0);
1635
1636 signals[ENCODING_LIST_CHANGED] =
1637 g_signal_new (I_("encoding-list-changed")g_intern_static_string ("encoding-list-changed"),
1638 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1639 G_SIGNAL_RUN_LAST,
1640 G_STRUCT_OFFSET (TerminalAppClass, profile_list_changed)((glong) __builtin_offsetof(TerminalAppClass, profile_list_changed
))
,
1641 NULL((void*)0), NULL((void*)0),
1642 g_cclosure_marshal_VOID__VOID,
1643 G_TYPE_NONE((GType) ((1) << (2))), 0);
1644
1645 g_object_class_install_property
1646 (object_class,
1647 PROP_ENABLE_MENU_BAR_ACCEL,
1648 g_param_spec_boolean (TERMINAL_APP_ENABLE_MENU_BAR_ACCEL"enable-menu-accels", NULL((void*)0), NULL((void*)0),
1649 DEFAULT_ENABLE_MENU_BAR_ACCEL((!(0))),
1650 G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1651
1652 g_object_class_install_property
1653 (object_class,
1654 PROP_ENABLE_MNEMONICS,
1655 g_param_spec_boolean (TERMINAL_APP_ENABLE_MNEMONICS"enable-mnemonics", NULL((void*)0), NULL((void*)0),
1656 DEFAULT_ENABLE_MNEMONICS((!(0))),
1657 G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1658
1659 g_object_class_install_property
1660 (object_class,
1661 PROP_SYSTEM_FONT,
1662 g_param_spec_boxed (TERMINAL_APP_SYSTEM_FONT"system-font", NULL((void*)0), NULL((void*)0),
1663 PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()),
1664 G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1665
1666 g_object_class_install_property
1667 (object_class,
1668 PROP_DEFAULT_PROFILE,
1669 g_param_spec_object (TERMINAL_APP_DEFAULT_PROFILE"default-profile", NULL((void*)0), NULL((void*)0),
1670 TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()),
1671 G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
1672}
1673
1674/* Public API */
1675
1676TerminalApp*
1677terminal_app_get (void)
1678{
1679 if (global_app == NULL((void*)0))
1680 {
1681 g_object_new (TERMINAL_TYPE_APP(terminal_app_get_type ()), NULL((void*)0));
1682 g_assert (global_app != NULL)do { if (global_app != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1682, ((const char*) (__func__
)), "global_app != NULL"); } while (0)
;
1683 }
1684
1685 return global_app;
1686}
1687
1688void
1689terminal_app_shutdown (void)
1690{
1691 if (global_app == NULL((void*)0))
1692 return;
1693
1694 g_object_unref (global_app);
1695 g_assert (global_app == NULL)do { if (global_app == ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1695, ((const char*) (__func__
)), "global_app == NULL"); } while (0)
;
1696}
1697
1698/**
1699 * terminal_app_handle_options:
1700 * @app:
1701 * @options: a #TerminalOptions
1702 * @allow_resume: whether to merge the terminal configuration from the
1703 * saved session on resume
1704 * @error: a #GError to fill in
1705 *
1706 * Processes @options. It loads or saves the terminal configuration, or
1707 * opens the specified windows and tabs.
1708 *
1709 * Returns: %TRUE if @options could be successfully handled, or %FALSE on
1710 * error
1711 */
1712gboolean
1713terminal_app_handle_options (TerminalApp *app,
1714 TerminalOptions *options,
1715 gboolean allow_resume,
1716 GError **error)
1717{
1718 GList *lw;
1719 GdkScreen *gdk_screen;
1720
1721 gdk_screen = terminal_app_get_screen_by_display_name (options->display_name);
1722
1723 if (options->save_config)
1724 {
1725 if (options->remote_arguments)
1726 return terminal_app_save_config_file (app, options->config_file, error);
1727
1728 g_set_error_literal (error, TERMINAL_OPTION_ERROR(g_quark_from_static_string ("terminal-option-error")), TERMINAL_OPTION_ERROR_NOT_IN_FACTORY,
1729 "Cannot use \"--save-config\" when starting the factory process");
1730 return FALSE(0);
1731 }
1732
1733 if (options->load_config)
1734 {
1735 GKeyFile *key_file;
1736 gboolean result;
1737
1738 key_file = g_key_file_new ();
1739 result = g_key_file_load_from_file (key_file, options->config_file, 0, error) &&
1740 terminal_options_merge_config (options, key_file, SOURCE_DEFAULT, error);
1741 g_key_file_free (key_file);
1742
1743 if (!result)
1744 return FALSE(0);
1745
1746 /* fall-through on success */
1747 }
1748
1749#ifdef HAVE_SMCLIENT1
1750 EggSMClient *sm_client;
1751
1752 sm_client = egg_sm_client_get ();
1753
1754 if (allow_resume && egg_sm_client_is_resumed (sm_client))
1755 {
1756 GKeyFile *key_file;
1757
1758 key_file = egg_sm_client_get_state_file (sm_client);
1759 if (key_file != NULL((void*)0) &&
1760 !terminal_options_merge_config (options, key_file, SOURCE_SESSION, error))
1761 return FALSE(0);
1762 }
1763#endif /* HAVE_SMCLIENT */
1764
1765 /* Make sure we open at least one window */
1766 terminal_options_ensure_window (options);
1767
1768 if (options->startup_id != NULL((void*)0))
1769 _terminal_debug_print (TERMINAL_DEBUG_FACTORY,do { if (0) g_printerr("Startup ID is '%s'\n", options->startup_id
); } while (0)
1770 "Startup ID is '%s'\n",do { if (0) g_printerr("Startup ID is '%s'\n", options->startup_id
); } while (0)
1771 options->startup_id)do { if (0) g_printerr("Startup ID is '%s'\n", options->startup_id
); } while (0)
;
1772
1773 for (lw = options->initial_windows; lw != NULL((void*)0); lw = lw->next)
1774 {
1775 InitialWindow *iw = lw->data;
1776 TerminalWindow *window = NULL((void*)0);
1777 GList *lt;
1778
1779 g_assert (iw->tabs)do { if (iw->tabs) ; else g_assertion_message_expr (((gchar
*) 0), "terminal-app.c", 1779, ((const char*) (__func__)), "iw->tabs"
); } while (0)
;
1780
1781 if ( lw == options->initial_windows && ((InitialTab *)iw->tabs->data)->attach_window )
1782 window = terminal_app_get_current_window(app, gdk_screen, options->initial_workspace);
1783
1784 if (!window)
1785 {
1786 /* Create & setup new window */
1787 window = terminal_app_new_window (app, gdk_screen);
1788
1789 /* Restored windows shouldn't demand attention; see bug #586308. */
1790 if (iw->source_tag == SOURCE_SESSION)
1791 terminal_window_set_is_restored (window);
1792
1793 if (options->startup_id != NULL((void*)0))
1794 gtk_window_set_startup_id (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
, options->startup_id);
1795
1796 /* Overwrite the default, unique window role set in terminal_window_init */
1797 if (iw->role)
1798 gtk_window_set_role (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
, iw->role);
1799
1800 if (iw->force_menubar_state)
1801 terminal_window_set_menubar_visible (window, iw->menubar_state);
1802
1803 if (iw->start_fullscreen)
1804 gtk_window_fullscreen (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
);
1805 if (iw->start_maximized)
1806 gtk_window_maximize (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
);
1807 }
1808
1809 /* Now add the tabs */
1810 for (lt = iw->tabs; lt != NULL((void*)0); lt = lt->next)
1811 {
1812 InitialTab *it = lt->data;
1813 TerminalProfile *profile = NULL((void*)0);
1814 TerminalScreen *screen;
1815 const char *profile_name;
1816 gboolean profile_is_id;
1817
1818 if (it->profile)
1819 {
1820 profile_name = it->profile;
1821 profile_is_id = it->profile_is_id;
1822 }
1823 else
1824 {
1825 profile_name = options->default_profile;
1826 profile_is_id = options->default_profile_is_id;
1827 }
1828
1829 if (profile_name)
1830 {
1831 if (profile_is_id)
1832 profile = terminal_app_get_profile_by_name (app, profile_name);
1833 else
1834 profile = terminal_app_get_profile_by_visible_name (app, profile_name);
1835
1836 if (profile == NULL((void*)0))
1837 g_printerr (_("No such profile \"%s\", using default profile\n")gettext ("No such profile \"%s\", using default profile\n"), it->profile);
1838 }
1839 if (profile == NULL((void*)0))
1840 profile = terminal_app_get_profile_for_new_term (app);
1841 g_assert (profile)do { if (profile) ; else g_assertion_message_expr (((gchar*) 0
), "terminal-app.c", 1841, ((const char*) (__func__)), "profile"
); } while (0)
;
1842
1843 screen = terminal_app_new_terminal (app, window, profile,
1844 it->exec_argv ? it->exec_argv : options->exec_argv,
1845 it->title ? it->title : options->default_title,
1846 it->working_dir ? it->working_dir : options->default_working_dir,
1847 options->env,
1848 it->zoom_set ? it->zoom : options->zoom);
1849
1850 if (it->active)
1851 terminal_window_switch_screen (window, screen);
1852 }
1853
1854 if (iw->geometry)
1855 {
1856 _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,do { if (0) g_printerr("[window %p] applying geometry %s\n", window
, iw->geometry); } while (0)
1857 "[window %p] applying geometry %s\n",do { if (0) g_printerr("[window %p] applying geometry %s\n", window
, iw->geometry); } while (0)
1858 window, iw->geometry)do { if (0) g_printerr("[window %p] applying geometry %s\n", window
, iw->geometry); } while (0)
;
1859
1860 if (!terminal_window_update_size_set_geometry (window,
1861 terminal_window_get_active (window),
1862 FALSE(0),
1863 iw->geometry))
1864 g_printerr (_("Invalid geometry string \"%s\"\n")gettext ("Invalid geometry string \"%s\"\n"), iw->geometry);
1865 }
1866
1867 gtk_window_present (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
);
1868 }
1869
1870 return TRUE(!(0));
1871}
1872
1873TerminalWindow *
1874terminal_app_new_window (TerminalApp *app,
1875 GdkScreen *screen)
1876{
1877 TerminalWindow *window;
1878
1879 window = terminal_window_new ();
1880
1881 app->windows = g_list_append (app->windows, window);
1882 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
terminal_window_destroyed))), (app), ((void*)0), (GConnectFlags
) 0)
1883 G_CALLBACK (terminal_window_destroyed), app)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
terminal_window_destroyed))), (app), ((void*)0), (GConnectFlags
) 0)
;
1884
1885 if (screen)
1886 gtk_window_set_screen (GTK_WINDOW (window)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((gtk_window_get_type ()))))))
, screen);
1887
1888 return window;
1889}
1890
1891TerminalScreen *
1892terminal_app_new_terminal (TerminalApp *app,
1893 TerminalWindow *window,
1894 TerminalProfile *profile,
1895 char **override_command,
1896 const char *title,
1897 const char *working_dir,
1898 char **child_env,
1899 double zoom)
1900{
1901 TerminalScreen *screen;
1902
1903 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
1904 g_return_val_if_fail (TERMINAL_IS_WINDOW (window), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((terminal_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_WINDOW (window)"); return (((void
*)0)); } } while (0)
;
1905
1906 screen = terminal_screen_new (profile, override_command, title,
1907 working_dir, child_env, zoom);
1908
1909 terminal_window_add_screen (window, screen, -1);
1910 terminal_window_switch_screen (window, screen);
1911 gtk_widget_grab_focus (GTK_WIDGET (screen)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((screen)), ((gtk_widget_get_type ()))))))
);
1912
1913 return screen;
1914}
1915
1916void
1917terminal_app_edit_profile (TerminalApp *app,
1918 TerminalProfile *profile,
1919 GtkWindow *transient_parent,
1920 const char *widget_name)
1921{
1922 terminal_profile_edit (profile, transient_parent, widget_name);
1923}
1924
1925void
1926terminal_app_edit_keybindings (TerminalApp *app,
1927 GtkWindow *transient_parent)
1928{
1929 terminal_edit_keys_dialog_show (transient_parent);
1930}
1931
1932void
1933terminal_app_edit_encodings (TerminalApp *app,
1934 GtkWindow *transient_parent)
1935{
1936 terminal_encoding_dialog_show (transient_parent);
1937}
1938
1939/*
1940* Get the window in the given screen and workspace. If nothing is found,
1941* a NULL is returned.
1942*/
1943TerminalWindow *
1944terminal_app_get_current_window (TerminalApp *app,
1945 GdkScreen *from_screen,
1946 int workspace)
1947{
1948 GList *res = NULL((void*)0);
1949 TerminalWindow *ret = NULL((void*)0);
1950
1951 if (app->windows == NULL((void*)0))
1952 return NULL((void*)0);
1953
1954 res = g_list_last (app->windows);
1955
1956 g_assert (from_screen != NULL)do { if (from_screen != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-app.c", 1956, ((const char*) (__func__
)), "from_screen != NULL"); } while (0)
;
1957
1958 while (res)
1959 {
1960 int win_workspace;
1961 if (gtk_window_get_screen(GTK_WINDOW(res->data)((((GtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((res->data)), ((gtk_window_get_type ()))))))
) != from_screen)
1962 continue;
1963
1964 win_workspace = terminal_app_get_workspace_for_window(res->data);
1965
1966 /* Same workspace or if the window is set to show up on all workspaces */
1967 if (win_workspace == workspace || win_workspace == -1)
1968 ret = terminal_window_get_latest_focused (ret, TERMINAL_WINDOW(res->data)((((TerminalWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((res->data)), ((terminal_window_get_type ()))))))
);
1969
1970 res = g_list_previous (res)((res) ? (((GList *)(res))->prev) : ((void*)0));
1971 }
1972
1973 return ret;
1974}
1975
1976/**
1977 * terminal_profile_get_list:
1978 *
1979 * Returns: a #GList containing all #TerminalProfile objects.
1980 * The content of the list is owned by the backend and
1981 * should not be modified or freed. Use g_list_free() when done
1982 * using the list.
1983 */
1984GList*
1985terminal_app_get_profile_list (TerminalApp *app)
1986{
1987 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
1988
1989 return g_list_sort (g_hash_table_get_values (app->profiles), profiles_alphabetic_cmp);
1990}
1991
1992TerminalProfile*
1993terminal_app_get_profile_by_name (TerminalApp *app,
1994 const char *name)
1995{
1996 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
1997 g_return_val_if_fail (name != NULL, NULL)do { if ((name != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "name != NULL"); return
(((void*)0)); } } while (0)
;
1998
1999 return g_hash_table_lookup (app->profiles, name);
2000}
2001
2002TerminalProfile*
2003terminal_app_get_profile_by_visible_name (TerminalApp *app,
2004 const char *name)
2005{
2006 LookupInfo info;
2007
2008 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
2009 g_return_val_if_fail (name != NULL, NULL)do { if ((name != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "name != NULL"); return
(((void*)0)); } } while (0)
;
2010
2011 info.result = NULL((void*)0);
2012 info.target = name;
2013
2014 g_hash_table_foreach (app->profiles,
2015 profiles_lookup_by_visible_name_foreach,
2016 &info);
2017 return info.result;
2018}
2019
2020TerminalProfile*
2021terminal_app_get_default_profile (TerminalApp *app)
2022{
2023 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
2024
2025 return app->default_profile;
2026}
2027
2028TerminalProfile*
2029terminal_app_get_profile_for_new_term (TerminalApp *app)
2030{
2031 GHashTableIter iter;
2032 TerminalProfile *profile = NULL((void*)0);
2033 TerminalProfile **profileptr = &profile;
2034
2035 g_return_val_if_fail (TERMINAL_IS_APP (app), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((app)); GType __t = ((terminal_app_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "TERMINAL_IS_APP (app)"); return (((void*)0));
} } while (0)
;
2036
2037 if (app->default_profile)
2038 return app->default_profile;
2039
2040 g_hash_table_iter_init (&iter, app->profiles);
2041 if (g_hash_table_iter_next (&iter, NULL((void*)0), (gpointer *) profileptr))
2042 return profile;
2043
2044 return NULL((void*)0);
2045}
2046
2047GHashTable *
2048terminal_app_get_encodings (TerminalApp *app)
2049{
2050 return app->encodings;
2051}
2052
2053/**
2054 * terminal_app_ensure_encoding:
2055 * @app:
2056 * @charset:
2057 *
2058 * Ensures there's a #TerminalEncoding for @charset available.
2059 */
2060TerminalEncoding *
2061terminal_app_ensure_encoding (TerminalApp *app,
2062 const char *charset)
2063{
2064 TerminalEncoding *encoding;
2065
2066 encoding = g_hash_table_lookup (app->encodings, charset);
2067 if (encoding == NULL((void*)0))
2068 {
2069 encoding = terminal_encoding_new (charset,
2070 _("User Defined")gettext ("User Defined"),
2071 TRUE(!(0)),
2072 TRUE(!(0)) /* scary! */);
2073 g_hash_table_insert (app->encodings,
2074 (gpointer) terminal_encoding_get_id (encoding),
2075 encoding);
2076 }
2077
2078 return encoding;
2079}
2080
2081/**
2082 * terminal_app_get_active_encodings:
2083 *
2084 * Returns: a newly allocated list of newly referenced #TerminalEncoding objects.
2085 */
2086GSList*
2087terminal_app_get_active_encodings (TerminalApp *app)
2088{
2089 GSList *list = NULL((void*)0);
2090 GHashTableIter iter;
2091 gpointer key, value;
2092
2093 g_hash_table_iter_init (&iter, app->encodings);
2094 while (g_hash_table_iter_next (&iter, &key, &value))
2095 {
2096 TerminalEncoding *encoding = (TerminalEncoding *) value;
2097
2098 if (!encoding->is_active)
2099 continue;
2100
2101 list = g_slist_prepend (list, terminal_encoding_ref (encoding));
2102 }
2103
2104 return g_slist_sort (list, (GCompareFunc) compare_encodings);
2105}
2106
2107void
2108terminal_app_save_config (TerminalApp *app,
2109 GKeyFile *key_file)
2110{
2111 GList *lw;
2112 guint n = 0;
2113 GPtrArray *window_names_array;
2114 char **window_names;
2115 gsize len;
2116
2117 g_key_file_set_comment (key_file, NULL((void*)0), NULL((void*)0), "Written by " PACKAGE_STRING"mate-terminal 1.28.0", NULL((void*)0));
2118
2119 g_key_file_set_integer (key_file, TERMINAL_CONFIG_GROUP"MATE Terminal Configuration", TERMINAL_CONFIG_PROP_VERSION"Version", TERMINAL_CONFIG_VERSION(1));
2120 g_key_file_set_integer (key_file, TERMINAL_CONFIG_GROUP"MATE Terminal Configuration", TERMINAL_CONFIG_PROP_COMPAT_VERSION"CompatVersion", TERMINAL_CONFIG_COMPAT_VERSION(1));
2121
2122 window_names_array = g_ptr_array_sized_new (g_list_length (app->windows) + 1);
2123
2124 for (lw = app->windows; lw != NULL((void*)0); lw = lw->next)
2125 {
2126 TerminalWindow *window = TERMINAL_WINDOW (lw->data)((((TerminalWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((lw->data)), ((terminal_window_get_type ()))))))
;
2127 char *group;
2128
2129 group = g_strdup_printf ("Window%u", n++);
2130 g_ptr_array_add (window_names_array, group);
2131
2132 terminal_window_save_state (window, key_file, group);
2133 }
2134
2135 len = window_names_array->len;
2136 g_ptr_array_add (window_names_array, NULL((void*)0));
2137 window_names = (char **) g_ptr_array_free (window_names_array, FALSE(0));
2138 g_key_file_set_string_list (key_file, TERMINAL_CONFIG_GROUP"MATE Terminal Configuration", TERMINAL_CONFIG_PROP_WINDOWS"Windows", (const char * const *) window_names, len);
2139 g_strfreev (window_names);
2140}
2141
2142gboolean
2143terminal_app_save_config_file (TerminalApp *app,
2144 const char *file_name,
2145 GError **error)
2146{
2147 GKeyFile *key_file;
2148 char *data;
2149 gsize len;
2150 gboolean result;
2151
2152 key_file = g_key_file_new ();
2153 terminal_app_save_config (app, key_file);
2154
2155 data = g_key_file_to_data (key_file, &len, NULL((void*)0));
2156 result = g_file_set_contents (file_name, data, len, error);
2157 g_free (data);
2158
2159 return result;
2160}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-d2e905.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-d2e905.html new file mode 100644 index 0000000..eb7acc8 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-d2e905.html @@ -0,0 +1,2385 @@ + + + +terminal-profile.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:terminal-profile.c
Warning:line 648, column 46
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name terminal-profile.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I .. -I ../src/mate-submodules/libegg -D TERMINAL_COMPILATION -D TERMINAL_RESOURCES_PATH_PREFIX="/org/mate/terminal" -D TERM_DATADIR="/usr/local/share" -D TERM_LOCALEDIR="/usr/local/share/locale" -D TERM_PKGDATADIR="/usr/local/share/mate-terminal" -D TERM_HELPDIR="/usr/local/share/help" -D SN_API_NOT_YET_FROZEN -D GDK_MULTIHEAD_SAFE -D G_DISABLE_SINGLE_INCLUDES -D PANGO_DISABLE_SINGLE_INCLUDES -D ATK_DISABLE_SINGLE_INCLUDES -D GDK_DISABLE_SINGLE_INCLUDES -D GDK_PIXBUF_DISABLE_SINGLE_INCLUDES -D GTK_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c terminal-profile.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * Copyright © 2001 Havoc Pennington
3 * Copyright © 2002 Mathias Hasselmann
4 * Copyright © 2008 Christian Persch
5 * Copyright (C) 2012-2021 MATE Developers
6 *
7 * Mate-terminal is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * Mate-terminal is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <config.h>
22
23#include <string.h>
24#include <stdlib.h>
25
26#include <gtk/gtk.h>
27
28#include "terminal-app.h"
29#include "terminal-debug.h"
30#include "terminal-intl.h"
31#include "terminal-profile.h"
32#include "terminal-screen.h"
33#include "terminal-type-builtins.h"
34
35/* To add a new key, you need to:
36 *
37 * - add an entry to the enum below
38 * - add a #define with its name in terminal-profile.h
39 * - add a gobject property for it in terminal_profile_class_init
40 * - if the property's type needs special casing, add that to
41 * terminal_profile_gsettings_notify_cb and
42 * terminal_profile_gsettings_changeset_add
43 * - if necessary the default value cannot be handled via the paramspec,
44 * handle that in terminal_profile_reset_property_internal
45 */
46enum
47{
48 PROP_0,
49 PROP_ALLOW_BOLD,
50 PROP_BACKGROUND_COLOR,
51 PROP_BACKGROUND_DARKNESS,
52 PROP_BACKGROUND_IMAGE,
53 PROP_BACKGROUND_IMAGE_FILE,
54 PROP_BACKGROUND_TYPE,
55 PROP_BACKSPACE_BINDING,
56 PROP_BOLD_COLOR,
57 PROP_BOLD_COLOR_SAME_AS_FG,
58 PROP_CURSOR_BLINK_MODE,
59 PROP_CURSOR_SHAPE,
60 PROP_CUSTOM_COMMAND,
61 PROP_DEFAULT_SIZE_COLUMNS,
62 PROP_DEFAULT_SIZE_ROWS,
63 PROP_DEFAULT_SHOW_MENUBAR,
64 PROP_DELETE_BINDING,
65 PROP_EXIT_ACTION,
66 PROP_FONT,
67 PROP_FOREGROUND_COLOR,
68 PROP_LOGIN_SHELL,
69 PROP_NAME,
70 PROP_PALETTE,
71 PROP_SCROLL_BACKGROUND,
72 PROP_SCROLLBACK_LINES,
73 PROP_SCROLLBACK_UNLIMITED,
74 PROP_SCROLLBAR_POSITION,
75 PROP_SCROLL_ON_KEYSTROKE,
76 PROP_SCROLL_ON_OUTPUT,
77 PROP_SILENT_BELL,
78 PROP_TITLE,
79 PROP_TITLE_MODE,
80 PROP_USE_CUSTOM_COMMAND,
81 PROP_USE_CUSTOM_DEFAULT_SIZE,
82 PROP_USE_SKEY,
83 PROP_USE_URLS,
84 PROP_USE_SYSTEM_FONT,
85 PROP_USE_THEME_COLORS,
86 PROP_VISIBLE_NAME,
87 PROP_WORD_CHARS,
88 PROP_COPY_SELECTION,
89 LAST_PROP
90};
91
92#define KEY_ALLOW_BOLD"allow-bold" "allow-bold"
93#define KEY_BACKGROUND_COLOR"background-color" "background-color"
94#define KEY_BACKGROUND_DARKNESS"background-darkness" "background-darkness"
95#define KEY_BACKGROUND_IMAGE_FILE"background-image" "background-image"
96#define KEY_BACKGROUND_TYPE"background-type" "background-type"
97#define KEY_BACKSPACE_BINDING"backspace-binding" "backspace-binding"
98#define KEY_BOLD_COLOR"bold-color" "bold-color"
99#define KEY_BOLD_COLOR_SAME_AS_FG"bold-color-same-as-fg" "bold-color-same-as-fg"
100#define KEY_CURSOR_BLINK_MODE"cursor-blink-mode" "cursor-blink-mode"
101#define KEY_CURSOR_SHAPE"cursor-shape" "cursor-shape"
102#define KEY_CUSTOM_COMMAND"custom-command" "custom-command"
103#define KEY_DEFAULT_SHOW_MENUBAR"default-show-menubar" "default-show-menubar"
104#define KEY_DEFAULT_SIZE_COLUMNS"default-size-columns" "default-size-columns"
105#define KEY_DEFAULT_SIZE_ROWS"default-size-rows" "default-size-rows"
106#define KEY_DELETE_BINDING"delete-binding" "delete-binding"
107#define KEY_EXIT_ACTION"exit-action" "exit-action"
108#define KEY_FONT"font" "font"
109#define KEY_FOREGROUND_COLOR"foreground-color" "foreground-color"
110#define KEY_LOGIN_SHELL"login-shell" "login-shell"
111#define KEY_PALETTE"palette" "palette"
112#define KEY_SCROLL_BACKGROUND"scroll-background" "scroll-background"
113#define KEY_SCROLLBACK_LINES"scrollback-lines" "scrollback-lines"
114#define KEY_SCROLLBACK_UNLIMITED"scrollback-unlimited" "scrollback-unlimited"
115#define KEY_SCROLLBAR_POSITION"scrollbar-position" "scrollbar-position"
116#define KEY_SCROLL_ON_KEYSTROKE"scroll-on-keystroke" "scroll-on-keystroke"
117#define KEY_SCROLL_ON_OUTPUT"scroll-on-output" "scroll-on-output"
118#define KEY_SILENT_BELL"silent-bell" "silent-bell"
119#define KEY_COPY_SELECTION"copy-selection" "copy-selection"
120#define KEY_TITLE_MODE"title-mode" "title-mode"
121#define KEY_TITLE"title" "title"
122#define KEY_USE_CUSTOM_COMMAND"use-custom-command" "use-custom-command"
123#define KEY_USE_CUSTOM_DEFAULT_SIZE"use-custom-default-size" "use-custom-default-size"
124#define KEY_USE_SKEY"use-skey" "use-skey"
125#define KEY_USE_URLS"use-urls" "use-urls"
126#define KEY_USE_SYSTEM_FONT"use-system-font" "use-system-font"
127#define KEY_USE_THEME_COLORS"use-theme-colors" "use-theme-colors"
128#define KEY_VISIBLE_NAME"visible-name" "visible-name"
129#define KEY_WORD_CHARS"word-chars" "word-chars"
130
131/* Keep these in sync with the GSettings schema! */
132#define DEFAULT_ALLOW_BOLD((!(0))) (TRUE(!(0)))
133#define DEFAULT_BACKGROUND_COLOR("#FFFFDD") ("#FFFFDD")
134#define DEFAULT_BOLD_COLOR_SAME_AS_FG((!(0))) (TRUE(!(0)))
135#define DEFAULT_BACKGROUND_DARKNESS(0.5) (0.5)
136#define DEFAULT_BACKGROUND_IMAGE_FILE("") ("")
137#define DEFAULT_BACKGROUND_TYPE(TERMINAL_BACKGROUND_SOLID) (TERMINAL_BACKGROUND_SOLID)
138#define DEFAULT_BACKSPACE_BINDING(VTE_ERASE_ASCII_DELETE) (VTE_ERASE_ASCII_DELETE)
139#define DEFAULT_CURSOR_BLINK_MODE(VTE_CURSOR_BLINK_SYSTEM) (VTE_CURSOR_BLINK_SYSTEM)
140#define DEFAULT_CURSOR_SHAPE(VTE_CURSOR_SHAPE_BLOCK) (VTE_CURSOR_SHAPE_BLOCK)
141#define DEFAULT_CUSTOM_COMMAND("") ("")
142#define DEFAULT_DEFAULT_SHOW_MENUBAR((!(0))) (TRUE(!(0)))
143#define DEFAULT_DEFAULT_SIZE_COLUMNS(80) (80)
144#define DEFAULT_DEFAULT_SIZE_ROWS(24) (24)
145#define DEFAULT_DELETE_BINDING(VTE_ERASE_DELETE_SEQUENCE) (VTE_ERASE_DELETE_SEQUENCE)
146#define DEFAULT_EXIT_ACTION(TERMINAL_EXIT_CLOSE) (TERMINAL_EXIT_CLOSE)
147#define DEFAULT_FONT("Monospace 12") ("Monospace 12")
148#define DEFAULT_FOREGROUND_COLOR("#000000") ("#000000")
149#define DEFAULT_LOGIN_SHELL((0)) (FALSE(0))
150#define DEFAULT_NAME(((void*)0)) (NULL((void*)0))
151#define DEFAULT_PALETTE(terminal_palettes[0]) (terminal_palettes[TERMINAL_PALETTE_TANGO0])
152#define DEFAULT_SCROLL_BACKGROUND((!(0))) (TRUE(!(0)))
153#define DEFAULT_SCROLLBACK_LINES(512) (512)
154#define DEFAULT_SCROLLBACK_UNLIMITED((0)) (FALSE(0))
155#define DEFAULT_SCROLLBAR_POSITION(TERMINAL_SCROLLBAR_RIGHT) (TERMINAL_SCROLLBAR_RIGHT)
156#define DEFAULT_SCROLL_ON_KEYSTROKE((!(0))) (TRUE(!(0)))
157#define DEFAULT_SCROLL_ON_OUTPUT((0)) (FALSE(0))
158#define DEFAULT_SILENT_BELL((0)) (FALSE(0))
159#define DEFAULT_COPY_SELECTION((0)) (FALSE(0))
160#define DEFAULT_TITLE_MODE(TERMINAL_TITLE_REPLACE) (TERMINAL_TITLE_REPLACE)
161#define DEFAULT_TITLE(("Terminal")) (N_("Terminal")("Terminal"))
162#define DEFAULT_USE_CUSTOM_COMMAND((0)) (FALSE(0))
163#define DEFAULT_USE_CUSTOM_DEFAULT_SIZE((0)) (FALSE(0))
164#define DEFAULT_USE_SKEY((!(0))) (TRUE(!(0)))
165#define DEFAULT_USE_URLS((!(0))) (TRUE(!(0)))
166#define DEFAULT_USE_SYSTEM_FONT((!(0))) (TRUE(!(0)))
167#define DEFAULT_USE_THEME_COLORS((!(0))) (TRUE(!(0)))
168#define DEFAULT_VISIBLE_NAME(("Unnamed")) (N_("Unnamed")("Unnamed"))
169#define DEFAULT_WORD_CHARS("-A-Za-z0-9,./?%&#:_=+@~") ("-A-Za-z0-9,./?%&#:_=+@~")
170
171struct _TerminalProfilePrivate
172{
173 GValueArray *properties;
174 gboolean *locked;
175
176 GSettings *settings;
177 char *profile_dir;
178
179 GSList *dirty_pspecs;
180 guint save_idle_id;
181
182 GParamSpec *gsettings_notification_pspec;
183
184 gboolean background_load_failed;
185
186 guint forgotten : 1;
187};
188
189static const GdkRGBA terminal_palettes[TERMINAL_PALETTE_N_BUILTINS5][TERMINAL_PALETTE_SIZE16] =
190{
191 /* Tango palette */
192 {
193 { 0, 0, 0, 1 },
194 { 0.8, 0, 0, 1 },
195 { 0.305882, 0.603922, 0.0235294, 1 },
196 { 0.768627, 0.627451, 0, 1 },
197 { 0.203922, 0.396078, 0.643137, 1 },
198 { 0.458824, 0.313725, 0.482353, 1 },
199 { 0.0235294, 0.596078, 0.603922, 1 },
200 { 0.827451, 0.843137, 0.811765, 1 },
201 { 0.333333, 0.341176, 0.32549, 1 },
202 { 0.937255, 0.160784, 0.160784, 1 },
203 { 0.541176, 0.886275, 0.203922, 1 },
204 { 0.988235, 0.913725, 0.309804, 1 },
205 { 0.447059, 0.623529, 0.811765, 1 },
206 { 0.678431, 0.498039, 0.658824, 1 },
207 { 0.203922, 0.886275, 0.886275, 1 },
208 { 0.933333, 0.933333, 0.92549, 1 },
209 },
210
211 /* Linux palette */
212 {
213 { 0, 0, 0, 1 },
214 { 0.666667, 0, 0, 1 },
215 { 0, 0.666667, 0, 1 },
216 { 0.666667, 0.333333, 0, 1 },
217 { 0, 0, 0.666667, 1 },
218 { 0.666667, 0, 0.666667, 1 },
219 { 0, 0.666667, 0.666667, 1 },
220 { 0.666667, 0.666667, 0.666667, 1 },
221 { 0.333333, 0.333333, 0.333333, 1 },
222 { 1, 0.333333, 0.333333, 1 },
223 { 0.333333, 1, 0.333333, 1 },
224 { 1, 1, 0.333333, 1 },
225 { 0.333333, 0.333333, 1, 1 },
226 { 1, 0.333333, 1, 1 },
227 { 0.333333, 1, 1, 1 },
228 { 1, 1, 1, 1 },
229 },
230
231 /* XTerm palette */
232 {
233 { 0, 0, 0, 1 },
234 { 0.803922, 0, 0, 1 },
235 { 0, 0.803922, 0, 1 },
236 { 0.803922, 0.803922, 0, 1 },
237 { 0.117647, 0.564706, 1, 1 },
238 { 0.803922, 0, 0.803922, 1 },
239 { 0, 0.803922, 0.803922, 1 },
240 { 0.898039, 0.898039, 0.898039, 1 },
241 { 0.298039, 0.298039, 0.298039, 1 },
242 { 1, 0, 0, 1 },
243 { 0, 1, 0, 1 },
244 { 1, 1, 0, 1 },
245 { 0.27451, 0.509804, 0.705882, 1 },
246 { 1, 0, 1, 1 },
247 { 0, 1, 1, 1 },
248 { 1, 1, 1, 1 },
249 },
250
251 /* RXVT palette */
252 {
253 { 0, 0, 0, 1 },
254 { 0.803922, 0, 0, 1 },
255 { 0, 0.803922, 0, 1 },
256 { 0.803922, 0.803922, 0, 1 },
257 { 0, 0, 0.803922, 1 },
258 { 0.803922, 0, 0.803922, 1 },
259 { 0, 0.803922, 0.803922, 1 },
260 { 0.980392, 0.921569, 0.843137, 1 },
261 { 0.25098, 0.25098, 0.25098, 1 },
262 { 1, 0, 0, 1 },
263 { 0, 1, 0, 1 },
264 { 1, 1, 0, 1 },
265 { 0, 0, 1, 1 },
266 { 1, 0, 1, 1 },
267 { 0, 1, 1, 1 },
268 { 1, 1, 1, 1 },
269 },
270
271 /* Solarized palette (1.0.0beta2): http://ethanschoonover.com/solarized */
272 {
273 { 0.02745, 0.211764, 0.258823, 1 },
274 { 0.862745, 0.196078, 0.184313, 1 },
275 { 0.521568, 0.6, 0, 1 },
276 { 0.709803, 0.537254, 0, 1 },
277 { 0.149019, 0.545098, 0.823529, 1 },
278 { 0.82745, 0.211764, 0.509803, 1 },
279 { 0.164705, 0.631372, 0.596078, 1 },
280 { 0.933333, 0.909803, 0.835294, 1 },
281 { 0, 0.168627, 0.211764, 1 },
282 { 0.796078, 0.294117, 0.086274, 1 },
283 { 0.345098, 0.431372, 0.458823, 1 },
284 { 0.396078, 0.482352, 0.513725, 1 },
285 { 0.513725, 0.580392, 0.588235, 1 },
286 { 0.423529, 0.443137, 0.768627, 1 },
287 { 0.57647, 0.631372, 0.631372, 1 },
288 { 0.992156, 0.964705, 0.890196, 1 },
289 },
290};
291
292enum
293{
294 FORGOTTEN,
295 LAST_SIGNAL
296};
297
298static void terminal_profile_finalize (GObject *object);
299static void terminal_profile_set_property (GObject *object,
300 guint prop_id,
301 const GValue *value,
302 GParamSpec *pspec);
303static void ensure_pixbuf_property (TerminalProfile *profile,
304 guint path_prop_id,
305 guint pixbuf_prop_id,
306 gboolean *load_failed);
307
308static guint signals[LAST_SIGNAL] = { 0 };
309static GQuark gsettings_key_quark;
310
311G_DEFINE_TYPE_WITH_PRIVATE (TerminalProfile, terminal_profile, G_TYPE_OBJECT)static void terminal_profile_init (TerminalProfile *self); static
void terminal_profile_class_init (TerminalProfileClass *klass
); static GType terminal_profile_get_type_once (void); static
gpointer terminal_profile_parent_class = ((void*)0); static gint
TerminalProfile_private_offset; static void terminal_profile_class_intern_init
(gpointer klass) { terminal_profile_parent_class = g_type_class_peek_parent
(klass); if (TerminalProfile_private_offset != 0) g_type_class_adjust_private_offset
(klass, &TerminalProfile_private_offset); terminal_profile_class_init
((TerminalProfileClass*) klass); } __attribute__ ((__unused__
)) static inline gpointer terminal_profile_get_instance_private
(TerminalProfile *self) { return (((gpointer) ((guint8*) (self
) + (glong) (TerminalProfile_private_offset)))); } GType terminal_profile_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ _Static_assert (sizeof *(&static_g_define_type_id) ==
sizeof (gpointer), "Expression evaluates to false"); (void) (
0 ? (gpointer) *(&static_g_define_type_id) : ((void*)0));
(!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = terminal_profile_get_type_once
(); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } __attribute__ ((__noinline__)) static GType terminal_profile_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
(((GType) ((20) << (2))), g_intern_static_string ("TerminalProfile"
), sizeof (TerminalProfileClass), (GClassInitFunc)(void (*)(void
)) terminal_profile_class_intern_init, sizeof (TerminalProfile
), (GInstanceInitFunc)(void (*)(void)) terminal_profile_init,
(GTypeFlags) 0); { {{ TerminalProfile_private_offset = g_type_add_instance_private
(g_define_type_id, sizeof (TerminalProfilePrivate)); };} } return
g_define_type_id; }
;
312
313/* gdk_rgba_equal is too strict! */
314static gboolean
315rgba_equal (const GdkRGBA *a,
316 const GdkRGBA *b)
317{
318 gdouble dr, dg, db, da;
319
320 dr = a->red - b->red;
321 dg = a->green - b->green;
322 db = a->blue - b->blue;
323 da = a->alpha - b->alpha;
324
325 return (dr * dr + dg * dg + db * db + da * da) < 1e-4;
326}
327
328static gboolean
329palette_cmp (const GdkRGBA *ca,
330 const GdkRGBA *cb)
331{
332 guint i;
333
334 for (i = 0; i < TERMINAL_PALETTE_SIZE16; ++i)
335 if (!rgba_equal (&ca[i], &cb[i]))
336 return FALSE(0);
337
338 return TRUE(!(0));
339}
340
341static GParamSpec *
342get_pspec_from_name (TerminalProfile *profile,
343 const char *prop_name)
344{
345 TerminalProfileClass *klass = TERMINAL_PROFILE_GET_CLASS (profile)((((TerminalProfileClass*) (((GTypeInstance*) ((profile)))->
g_class))))
;
346 GParamSpec *pspec;
347
348 pspec = g_object_class_find_property (G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
, prop_name);
349 if (pspec &&
350 pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
351 pspec = NULL((void*)0);
352
353 return pspec;
354}
355
356static const GValue *
357get_prop_value_from_prop_name (TerminalProfile *profile,
358 const char *prop_name)
359{
360 TerminalProfilePrivate *priv = profile->priv;
361 GParamSpec *pspec;
362
363 pspec = get_pspec_from_name (profile, prop_name);
364 if (!pspec)
365 return NULL((void*)0);
366
367 if (G_UNLIKELY (pspec->param_id == PROP_BACKGROUND_IMAGE)(pspec->param_id == PROP_BACKGROUND_IMAGE))
368 ensure_pixbuf_property (profile, PROP_BACKGROUND_IMAGE_FILE, PROP_BACKGROUND_IMAGE, &priv->background_load_failed);
369
370 return g_value_array_get_nth (priv->properties, pspec->param_id);
371}
372
373static void
374set_value_from_palette (GValue *ret_value,
375 const GdkRGBA *colors,
376 guint n_colors)
377{
378 GValueArray *array;
379 guint i, max_n_colors;
380
381 max_n_colors = MAX (n_colors, TERMINAL_PALETTE_SIZE)(((n_colors) > (16)) ? (n_colors) : (16));
382 array = g_value_array_new (max_n_colors);
383 for (i = 0; i < max_n_colors; ++i)
384 g_value_array_append (array, NULL((void*)0));
385
386 for (i = 0; i < n_colors; ++i)
387 {
388 GValue *value = g_value_array_get_nth (array, i);
389
390 g_value_init (value, GDK_TYPE_RGBA(gdk_rgba_get_type ()));
391 g_value_set_boxed (value, &colors[i]);
392 }
393
394 /* If we haven't enough colours yet, fill up with the default palette */
395 for (i = n_colors; i < TERMINAL_PALETTE_SIZE16; ++i)
396 {
397 GValue *value = g_value_array_get_nth (array, i);
398
399 g_value_init (value, GDK_TYPE_RGBA(gdk_rgba_get_type ()));
400 g_value_set_boxed (value, &DEFAULT_PALETTE(terminal_palettes[0])[i]);
401 }
402
403 g_value_take_boxed (ret_value, array);
404}
405
406static int
407values_equal (GParamSpec *pspec,
408 const GValue *va,
409 const GValue *vb)
410{
411 /* g_param_values_cmp isn't good enough for some types, since e.g.
412 * it compares colours and font descriptions by pointer value, not
413 * with the correct compare functions. Providing extra
414 * PangoParamSpecFontDescription and GdkParamSpecColor wouldn't
415 * have fixed this either, since it's unclear how to _order_ them.
416 * Luckily we only need to check them for equality here.
417 */
418
419 if (g_param_values_cmp (pspec, va, vb) == 0)
420 return TRUE(!(0));
421
422 if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
423 return rgba_equal (g_value_get_boxed (va), g_value_get_boxed (vb));
424
425 if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
426 return pango_font_description_equal (g_value_get_boxed (va), g_value_get_boxed (vb));
427
428 if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
429 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
430 {
431 GValueArray *ara, *arb;
432 guint i;
433
434 ara = g_value_get_boxed (va);
435 arb = g_value_get_boxed (vb);
436
437 if (!ara || !arb || ara->n_values != arb->n_values)
438 return FALSE(0);
439
440 for (i = 0; i < ara->n_values; ++i)
441 if (!rgba_equal (g_value_get_boxed (g_value_array_get_nth (ara, i)),
442 g_value_get_boxed (g_value_array_get_nth (arb, i))))
443 return FALSE(0);
444
445 return TRUE(!(0));
446 }
447
448 return FALSE(0);
449}
450
451static void
452ensure_pixbuf_property (TerminalProfile *profile,
453 guint path_prop_id,
454 guint pixbuf_prop_id,
455 gboolean *load_failed)
456{
457 TerminalProfilePrivate *priv = profile->priv;
458 GValue *path_value, *pixbuf_value;
459 GdkPixbuf *pixbuf;
460 const char *path_utf8;
461 char *path;
462 GError *error = NULL((void*)0);
463
464 pixbuf_value = g_value_array_get_nth (priv->properties, pixbuf_prop_id);
465
466 pixbuf = g_value_get_object (pixbuf_value);
467 if (pixbuf)
468 return;
469
470 if (*load_failed)
471 return;
472
473 path_value = g_value_array_get_nth (priv->properties, path_prop_id);
474 path_utf8 = g_value_get_string (path_value);
475 if (!path_utf8 || !path_utf8[0])
476 goto failed;
477
478 path = g_filename_from_utf8 (path_utf8, -1, NULL((void*)0), NULL((void*)0), NULL((void*)0));
479 if (!path)
480 goto failed;
481
482 pixbuf = gdk_pixbuf_new_from_file (path, &error);
483 if (!pixbuf)
484 {
485 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
486 "Failed to load image \"%s\": %s\n",do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
487 path, error->message)do { if (0) g_printerr("Failed to load image \"%s\": %s\n", path
, error->message); } while (0)
;
488
489 g_error_free (error);
490 g_free (path);
491 goto failed;
492 }
493
494 g_value_take_object (pixbuf_value, pixbuf);
495 g_free (path);
496 return;
497
498failed:
499 *load_failed = TRUE(!(0));
500}
501
502static void
503terminal_profile_reset_property_internal (TerminalProfile *profile,
504 GParamSpec *pspec,
505 gboolean notify)
506{
507 TerminalProfilePrivate *priv = profile->priv;
508 GValue value_ = { 0, };
509 GValue *value;
510
511 if (notify)
512 {
513 value = &value_;
514 g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
515 }
516 else
517 value = g_value_array_get_nth (priv->properties, pspec->param_id);
518 g_assert (value != NULL)do { if (value != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 518, ((const char*) (__func__
)), "value != NULL"); } while (0)
;
519
520 /* A few properties don't have defaults via the param spec; set them explicitly */
521 switch (pspec->param_id)
522 {
523 case PROP_FOREGROUND_COLOR:
524 case PROP_BOLD_COLOR:
525 {
526 GdkRGBA color;
527
528 if (!gdk_rgba_parse (&color, DEFAULT_FOREGROUND_COLOR("#000000")))
529 return;
530 color.alpha = 1.0;
531 g_value_set_boxed (value, &color);
532 break;
533 }
534 case PROP_BACKGROUND_COLOR:
535 {
536 GdkRGBA color;
537
538 if (!gdk_rgba_parse (&color, DEFAULT_BACKGROUND_COLOR("#FFFFDD")))
539 return;
540 color.alpha = 1.0;
541 g_value_set_boxed (value, &color);
542 break;
543 }
544 case PROP_FONT:
545 g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_FONT("Monospace 12")));
546 break;
547
548 case PROP_PALETTE:
549 set_value_from_palette (value, DEFAULT_PALETTE(terminal_palettes[0]), TERMINAL_PALETTE_SIZE16);
550 break;
551
552 default:
553 g_param_value_set_default (pspec, value);
554 break;
555 }
556
557 if (notify)
558 {
559 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, pspec->name, value);
560 g_value_unset (value);
561 }
562}
563
564static void
565terminal_profile_gsettings_notify_cb (GSettings *settings,
566 gchar *key,
567 gpointer user_data)
568{
569 TerminalProfile *profile = TERMINAL_PROFILE (user_data)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((terminal_profile_get_type ()))))))
;
570 TerminalProfilePrivate *priv = profile->priv;
571 TerminalProfileClass *klass;
572 GVariant *settings_value;
573 GParamSpec *pspec;
574 GValue value = { 0, };
575 gboolean equal;
576 gboolean force_set = FALSE(0);
577
578 if (!key) return;
579
580 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
581 "GSettings notification for key %s [%s]\n",do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
582 key,do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
583 g_settings_is_writable (settings, key) ? "writable" : "LOCKED")do { if (0) g_printerr("GSettings notification for key %s [%s]\n"
, key, g_settings_is_writable (settings, key) ? "writable" : "LOCKED"
); } while (0)
;
584
585 klass = TERMINAL_PROFILE_GET_CLASS (profile)((((TerminalProfileClass*) (((GTypeInstance*) ((profile)))->
g_class))))
;
586 pspec = g_hash_table_lookup (klass->gsettings_keys, key);
587 if (!pspec)
588 return; /* ignore unknown keys, for future extensibility */
589
590 priv->locked[pspec->param_id] = !g_settings_is_writable (settings, key);
591
592 settings_value = g_settings_get_value (settings, key);
593 if (!settings_value)
594 return;
595
596 g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
597
598 if (G_IS_PARAM_SPEC_BOOLEAN (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[2])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
599 {
600 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_BOOLEAN((const GVariantType *) "b")))
601 goto out;
602
603 g_value_set_boolean (&value, g_variant_get_boolean (settings_value));
604 }
605 else if (G_IS_PARAM_SPEC_STRING (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[14])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
606 {
607 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
608 goto out;
609
610 g_value_set_string (&value, g_variant_get_string (settings_value, NULL((void*)0)));
611 }
612 else if (G_IS_PARAM_SPEC_ENUM (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[10])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
613 {
614
615 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
616 goto out;
617
618 g_value_set_enum (&value, g_settings_get_enum (settings, key));
619 }
620 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
621 {
622 GdkRGBA color;
623
624 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
625 goto out;
626
627 if (!gdk_rgba_parse (&color, g_variant_get_string (settings_value, NULL((void*)0))))
628 goto out;
629
630 g_value_set_boxed (&value, &color);
631 }
632 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
633 {
634 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
635 goto out;
636
637 g_value_take_boxed (&value, pango_font_description_from_string (g_variant_get_string (settings_value, NULL((void*)0))));
638 }
639 else if (G_IS_PARAM_SPEC_DOUBLE (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[13])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
640 {
641 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_DOUBLE((const GVariantType *) "d")))
642 goto out;
643
644 g_value_set_double (&value, g_variant_get_double (settings_value));
645 }
646 else if (G_IS_PARAM_SPEC_INT (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[3])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
647 {
648 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT16((const GVariantType *) "n")) &&
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
649 !g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT32((const GVariantType *) "i")) &&
650 !g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT64((const GVariantType *) "x")))
651 goto out;
652
653 g_value_set_int (&value, g_settings_get_int(settings, key));
654 }
655 else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
656 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
657 {
658 char **color_strings;
659 GdkRGBA *colors;
660 int n_colors, i;
661
662 if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING((const GVariantType *) "s")))
663 goto out;
664
665 color_strings = g_strsplit (g_variant_get_string (settings_value, NULL((void*)0)), ":", -1);
666 if (!color_strings)
667 goto out;
668
669 n_colors = g_strv_length (color_strings);
670 colors = g_new0 (GdkRGBA, n_colors)((GdkRGBA *) g_malloc0_n ((n_colors), sizeof (GdkRGBA)));
671 for (i = 0; i < n_colors; ++i)
672 {
673 if (!gdk_rgba_parse (&colors[i], color_strings[i]))
674 continue; /* ignore errors */
675 }
676 g_strfreev (color_strings);
677
678 /* We continue even with a palette size != TERMINAL_PALETTE_SIZE,
679 * so we can change the palette size in future versions without
680 * causing too many issues.
681 */
682 set_value_from_palette (&value, colors, n_colors);
683 g_free (colors);
684 }
685 else
686 {
687 g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
), pspec->name);
688 goto out;
689 }
690
691 if (g_param_value_validate (pspec, &value))
692 {
693 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
694 "Invalid value in GSettings for key %s was changed to comply with pspec %s\n",do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
695 key, pspec->name)do { if (0) g_printerr("Invalid value in GSettings for key %s was changed to comply with pspec %s\n"
, key, pspec->name); } while (0)
;
696
697 force_set = TRUE(!(0));
698 }
699
700 /* Only set the property if the value is different than our current value,
701 * so we don't go into an infinite loop.
702 */
703 equal = values_equal (pspec, &value, g_value_array_get_nth (priv->properties, pspec->param_id));
704#ifdef MATE_ENABLE_DEBUG
705 _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_PROFILE)if (0)
706 {
707 if (!equal)
708 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("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)); } while (0)
709 "Setting property %s to a different value\n"do { if (0) g_printerr("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)); } while (0)
710 " now: %s\n"do { if (0) g_printerr("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)); } while (0)
711 " new: %s\n",do { if (0) g_printerr("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)); } while (0)
712 pspec->name,do { if (0) g_printerr("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)); } while (0)
713 g_strdup_value_contents (g_value_array_get_nth (priv->properties, pspec->param_id)),do { if (0) g_printerr("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)); } while (0)
714 g_strdup_value_contents (&value))do { if (0) g_printerr("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)); } while (0)
;
715 }
716#endif
717
718 if (!equal || force_set)
719 {
720 priv->gsettings_notification_pspec = pspec;
721 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, pspec->name, &value);
722 priv->gsettings_notification_pspec = NULL((void*)0);
723 }
724
725out:
726 /* FIXME: if we arrive here through goto in the error cases,
727 * should we maybe reset the property to its default value?
728 */
729
730 g_value_unset (&value);
731 g_variant_unref (settings_value);
732}
733
734static void
735terminal_profile_gsettings_changeset_add (TerminalProfile *profile,
736 GSettings *changeset,
737 GParamSpec *pspec)
738{
739 TerminalProfilePrivate *priv = profile->priv;
740 char *key;
741 const GValue *value;
742
743 /* FIXME: do this? */
744#if 0
745 if (priv->locked[pspec->param_id])
746 return;
747
748 if (!g_settings_is_writable (priv->settings, gsettings_key, NULL((void*)0)))
749 return;
750#endif
751
752 key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
753 if (!key)
754 return;
755
756 value = g_value_array_get_nth (priv->properties, pspec->param_id);
757
758 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
759 "Adding pspec %s with value %s to the GSettings changeset\n",do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
760 pspec->name, g_strdup_value_contents (value))do { if (0) g_printerr("Adding pspec %s with value %s to the GSettings changeset\n"
, pspec->name, g_strdup_value_contents (value)); } while (
0)
;
761
762 if (G_IS_PARAM_SPEC_BOOLEAN (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[2])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
763 g_settings_set_boolean (changeset, key, g_value_get_boolean (value));
764 else if (G_IS_PARAM_SPEC_STRING (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[14])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
765 {
766 const char *str;
767
768 str = g_value_get_string (value);
769 g_settings_set_string (changeset, key, str ? str : "");
770 }
771 else if (G_IS_PARAM_SPEC_ENUM (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[10])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
772 {
773 const GEnumValue *eval;
774
775 eval = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)((((GParamSpecEnum*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), ((g_param_spec_types[10]))))))
->enum_class, g_value_get_enum (value));
776
777 g_settings_set_enum (changeset, key, eval->value);
778 }
779 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
780 {
781 GdkRGBA *color;
782 char str[16];
783
784 color = g_value_get_boxed (value);
785 if (!color)
786 goto cleanup;
787
788 g_snprintf (str, sizeof (str),
789 "#%04X%04X%04X",
790 (guint) (color->red * 65535),
791 (guint) (color->green * 65535),
792 (guint) (color->blue * 65535));
793
794 g_settings_set_string (changeset, key, str);
795 }
796 else if (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
== PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()))
797 {
798 PangoFontDescription *font_desc;
799 char *font;
800
801 font_desc = g_value_get_boxed (value);
802 if (!font_desc)
803 goto cleanup;
804
805 font = pango_font_description_to_string (font_desc);
806 g_settings_set_string (changeset, key, font);
807 g_free (font);
808 }
809 else if (G_IS_PARAM_SPEC_DOUBLE (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[13])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
810 g_settings_set_double (changeset, key, g_value_get_double (value));
811 else if (G_IS_PARAM_SPEC_INT (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[3])); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
812 g_settings_set_int (changeset, key, g_value_get_int (value));
813 else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(pspec)); GType __t = ((g_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
+); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))) GCC warning "Deprecated pre-processor symbol" +
&&
814 G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((GParamSpecValueArray*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pspec)), ((g_param_spec_types[18]) GCC warning
"Deprecated pre-processor symbol" +))))) GCC warning "Deprecated pre-processor symbol"
+->element_spec)), (((GType) ((19) << (2))))))))->
value_type)
== GDK_TYPE_RGBA(gdk_rgba_get_type ()))
815 {
816 GValueArray *array;
817 GString *string;
818 guint n_colors, i;
819
820 /* We need to do this ourselves, because the gtk_color_selection_palette_to_string
821 * does not carry all the bytes, and xterm's palette is messed up...
822 */
823
824 array = g_value_get_boxed (value);
825 if (!array)
826 goto cleanup;
827
828 n_colors = array->n_values;
829 string = g_string_sized_new (n_colors * (1 /* # */ + 3 * 4) + n_colors /* : separators and terminating \0 */);
830 for (i = 0; i < n_colors; ++i)
831 {
832 GdkRGBA *color;
833
834 if (i > 0)
835 g_string_append_c (string, ':')g_string_append_c_inline (string, ':');
836
837 color = g_value_get_boxed (g_value_array_get_nth (array, i));
838 if (!color)
839 continue;
840
841 g_string_append_printf (string,
842 "#%04X%04X%04X",
843 (guint) (color->red * 65535),
844 (guint) (color->green * 65535),
845 (guint) (color->blue * 65535));
846 }
847
848 g_settings_set_string (changeset, key, string->str);
849 g_string_free (string, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) (
(string), ((!(0)))) : g_string_free_and_steal (string)) : (g_string_free
) ((string), ((!(0)))))
;
850 }
851 else
852 g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
), pspec->name);
853
854cleanup:
855 return;
856}
857
858static void
859terminal_profile_save (TerminalProfile *profile)
860{
861 TerminalProfilePrivate *priv = profile->priv;
862 GSettings *changeset;
863 GSList *l;
864 gchar *concat;
865
866 priv->save_idle_id = 0;
867 concat = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", priv->profile_dir,"/", NULL((void*)0));
868 changeset = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
869 g_free (concat);
870 g_settings_delay (changeset);
871
872 for (l = priv->dirty_pspecs; l != NULL((void*)0); l = l->next)
873 {
874 GParamSpec *pspec = (GParamSpec *) l->data;
875
876 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
877 continue;
878
879 if ((pspec->flags & G_PARAM_WRITABLE) == 0)
880 continue;
881
882 terminal_profile_gsettings_changeset_add (profile, changeset, pspec);
883 }
884
885 g_slist_free (priv->dirty_pspecs);
886 priv->dirty_pspecs = NULL((void*)0);
887
888 g_settings_apply (changeset);
889 g_object_unref (changeset);
890}
891
892static gboolean
893terminal_profile_save_idle_cb (TerminalProfile *profile)
894{
895 terminal_profile_save (profile);
896
897 /* don't run again */
898 return FALSE(0);
899}
900
901static void
902terminal_profile_schedule_save (TerminalProfile *profile,
903 GParamSpec *pspec)
904{
905 TerminalProfilePrivate *priv = profile->priv;
906
907 g_assert (pspec != NULL)do { if (pspec != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 907, ((const char*) (__func__
)), "pspec != NULL"); } while (0)
;
908
909 if (!g_slist_find (priv->dirty_pspecs, pspec))
910 priv->dirty_pspecs = g_slist_prepend (priv->dirty_pspecs, pspec);
911
912 if (priv->save_idle_id != 0)
913 return;
914
915 priv->save_idle_id = g_idle_add ((GSourceFunc) terminal_profile_save_idle_cb, profile);
916}
917
918static void
919terminal_profile_init (TerminalProfile *profile)
920{
921 TerminalProfilePrivate *priv;
922 GObjectClass *object_class;
923 GParamSpec **pspecs;
924 guint n_pspecs, i;
925
926 priv = profile->priv = terminal_profile_get_instance_private (profile);
927
928 priv->gsettings_notification_pspec = NULL((void*)0);
929 priv->locked = g_new0 (gboolean, LAST_PROP)((gboolean *) g_malloc0_n ((LAST_PROP), sizeof (gboolean)));
930
931 priv->properties = g_value_array_new (LAST_PROP);
932 for (i = 0; i < LAST_PROP; ++i)
933 g_value_array_append (priv->properties, NULL((void*)0));
934
935 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
936 for (i = 0; i < n_pspecs; ++i)
937 {
938 GParamSpec *pspec = pspecs[i];
939 GValue *value;
940
941 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
942 continue;
943
944 g_assert (pspec->param_id < LAST_PROP)do { if (pspec->param_id < LAST_PROP) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 944, ((const char*) (__func__
)), "pspec->param_id < LAST_PROP"); } while (0)
;
945 value = g_value_array_get_nth (priv->properties, pspec->param_id);
946 g_value_init (value, pspec->value_type);
947 g_param_value_set_default (pspec, value);
948 }
949
950 g_free (pspecs);
951
952 /* A few properties don't have defaults via the param spec; set them explicitly */
953 object_class = G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
;
954 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_FOREGROUND_COLOR"foreground-color"), FALSE(0));
955 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_BOLD_COLOR"bold-color"), FALSE(0));
956 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_BACKGROUND_COLOR"background-color"), FALSE(0));
957 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_FONT"font"), FALSE(0));
958 terminal_profile_reset_property_internal (profile, g_object_class_find_property (object_class, TERMINAL_PROFILE_PALETTE"palette"), FALSE(0));
959}
960
961static GObject *
962terminal_profile_constructor (GType type,
963 guint n_construct_properties,
964 GObjectConstructParam *construct_params)
965{
966 GObject *object;
967 TerminalProfile *profile;
968 TerminalProfilePrivate *priv;
969 const char *name;
970 GParamSpec **pspecs;
971 guint n_pspecs, i;
972 gchar *concat;
973
974 object = G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->constructor
975 (type, n_construct_properties, construct_params);
976
977 profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
978 priv = profile->priv;
979
980 name = g_value_get_string (g_value_array_get_nth (priv->properties, PROP_NAME));
981 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-profile.c", 981, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
982
983 concat = g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", name, "/", NULL((void*)0));
984 priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
985 g_assert (priv->settings != NULL)do { if (priv->settings != ((void*)0)) ; else g_assertion_message_expr
(((gchar*) 0), "terminal-profile.c", 985, ((const char*) (__func__
)), "priv->settings != NULL"); } while (0)
;
986 g_free (concat);
987 concat = g_strconcat("changed::", priv->profile_dir, "/", NULL((void*)0));
988 g_signal_connect (priv->settings,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
989 concat,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
990 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
991 profile)g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
;
992
993 g_free (concat);
994
995 /* Now load those properties from GSettings that were not set as construction params */
996 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((profile)
))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
997 for (i = 0; i < n_pspecs; ++i)
998 {
999 GParamSpec *pspec = pspecs[i];
1000 guint j;
1001 gboolean is_construct = FALSE(0);
1002 char *key;
1003
1004 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()))
1005 continue;
1006
1007 if ((pspec->flags & G_PARAM_WRITABLE) == 0 ||
1008 (pspec->flags & G_PARAM_CONSTRUCT_ONLY) != 0)
1009 continue;
1010
1011 for (j = 0; j < n_construct_properties; ++j)
1012 if (pspec == construct_params[j].pspec)
1013 {
1014 is_construct = TRUE(!(0));
1015 break;
1016 }
1017
1018 if (is_construct)
1019 continue;
1020
1021 key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
1022 if (!key)
1023 continue;
1024
1025 terminal_profile_gsettings_notify_cb (priv->settings, key, profile);
1026 }
1027
1028 g_free (pspecs);
1029
1030 return object;
1031}
1032
1033static void
1034terminal_profile_finalize (GObject *object)
1035{
1036 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1037 TerminalProfilePrivate *priv = profile->priv;
1038
1039 g_signal_handlers_disconnect_by_func (priv->settings,g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1040 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1041 profile)g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
;
1042
1043 if (priv->save_idle_id)
1044 {
1045 g_source_remove (priv->save_idle_id);
1046
1047 /* Save now */
1048 terminal_profile_save (profile);
1049 }
1050
1051 _terminal_profile_forget (profile);
1052
1053 g_object_unref (priv->settings);
1054
1055 g_free (priv->profile_dir);
1056 g_free (priv->locked);
1057 g_value_array_free (priv->properties);
1058
1059 G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->finalize (object);
1060}
1061
1062static void
1063terminal_profile_get_property (GObject *object,
1064 guint prop_id,
1065 GValue *value,
1066 GParamSpec *pspec)
1067{
1068 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1069 TerminalProfilePrivate *priv = profile->priv;
1070
1071 if (prop_id == 0 || prop_id >= LAST_PROP)
1072 {
1073 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-profile.c", 1073, ("property"), _glib__property_id
, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance
*) (_glib__pspec))->g_class))->g_type)))), (g_type_name
((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1074 return;
1075 }
1076
1077 /* Note: When adding things here, do the same in get_prop_value_from_prop_name! */
1078 switch (prop_id)
1079 {
1080 case PROP_BACKGROUND_IMAGE:
1081 ensure_pixbuf_property (profile, PROP_BACKGROUND_IMAGE_FILE, PROP_BACKGROUND_IMAGE, &priv->background_load_failed);
1082 break;
1083 default:
1084 break;
1085 }
1086
1087 g_value_copy (g_value_array_get_nth (priv->properties, prop_id), value);
1088}
1089
1090static void
1091terminal_profile_set_property (GObject *object,
1092 guint prop_id,
1093 const GValue *value,
1094 GParamSpec *pspec)
1095{
1096 TerminalProfile *profile = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
;
1097 TerminalProfilePrivate *priv = profile->priv;
1098 GValue *prop_value;
1099
1100 if (prop_id == 0 || prop_id >= LAST_PROP)
1101 {
1102 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "terminal-profile.c", 1102, ("property"), _glib__property_id
, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance
*) (_glib__pspec))->g_class))->g_type)))), (g_type_name
((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
1103 return;
1104 }
1105
1106 prop_value = g_value_array_get_nth (priv->properties, prop_id);
1107
1108 /* Preprocessing */
1109 switch (prop_id)
1110 {
1111#if 0
1112 case PROP_FONT:
1113 {
1114 PangoFontDescription *font_desc, *new_font_desc;
1115
1116 font_desc = g_value_get_boxed (prop_value);
1117 new_font_desc = g_value_get_boxed (value);
1118
1119 if (font_desc && new_font_desc)
1120 {
1121 /* Merge in case the new string isn't complete enough to load a font */
1122 pango_font_description_merge (font_desc, new_font_desc, TRUE(!(0)));
1123 pango_font_description_free (new_font_desc);
1124 break;
1125 }
1126
1127 /* fall-through */
1128 }
1129#endif
1130 default:
1131 g_value_copy (value, prop_value);
1132 break;
1133 }
1134
1135 /* Postprocessing */
1136 switch (prop_id)
1137 {
1138 case PROP_NAME:
1139 {
1140 const char *name = g_value_get_string (value);
1141
1142 g_assert (name != NULL)do { if (name != ((void*)0)) ; else g_assertion_message_expr (
((gchar*) 0), "terminal-profile.c", 1142, ((const char*) (__func__
)), "name != NULL"); } while (0)
;
1143 priv->profile_dir = g_strdup (name)g_strdup_inline (name);
1144 if (priv->settings != NULL((void*)0)) {
1145 gchar *concat;
1146 g_signal_handlers_disconnect_by_func (priv->settings,g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1147 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
1148 profile)g_signal_handlers_disconnect_matched ((priv->settings), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (terminal_profile_gsettings_notify_cb))), (
profile))
;
1149 g_object_unref (priv->settings);
1150 concat= g_strconcat (CONF_PROFILE_PREFIX"/org/mate/terminal/profiles/", priv->profile_dir, "/", NULL((void*)0));
1151 priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA"org.mate.terminal" ".profile", concat);
1152 g_free (concat);
1153 concat = g_strconcat("changed::", priv->profile_dir, "/", NULL((void*)0));
1154 g_signal_connect (priv->settings,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1155 concat,g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1156 G_CALLBACK(terminal_profile_gsettings_notify_cb),g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
1157 profile)g_signal_connect_data ((priv->settings), (concat), (((GCallback
) (terminal_profile_gsettings_notify_cb))), (profile), ((void
*)0), (GConnectFlags) 0)
;
1158 g_free (concat);
1159 }
1160 break;
1161 }
1162
1163 case PROP_BACKGROUND_IMAGE_FILE:
1164 /* Clear the cached image */
1165 g_value_set_object (g_value_array_get_nth (priv->properties, PROP_BACKGROUND_IMAGE), NULL((void*)0));
1166 priv->background_load_failed = FALSE(0);
1167 g_object_notify (object, TERMINAL_PROFILE_BACKGROUND_IMAGE"background-image");
1168 break;
1169
1170 default:
1171 break;
1172 }
1173}
1174
1175static void
1176terminal_profile_notify (GObject *object,
1177 GParamSpec *pspec)
1178{
1179 TerminalProfilePrivate *priv = TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
->priv;
1180 void (* notify) (GObject *, GParamSpec *) = G_OBJECT_CLASS (terminal_profile_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((terminal_profile_parent_class)), (((GType) ((20) <<
(2))))))))
->notify;
1181
1182 _terminal_debug_print (TERMINAL_DEBUG_PROFILE,do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
1183 "Property notification for prop %s\n",do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
1184 pspec->name)do { if (0) g_printerr("Property notification for prop %s\n",
pspec->name); } while (0)
;
1185
1186 if (notify)
1187 notify (object, pspec);
1188
1189 if (pspec->owner_type == TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) &&
1190 (pspec->flags & G_PARAM_WRITABLE) &&
1191 g_param_spec_get_qdata (pspec, gsettings_key_quark) != NULL((void*)0) &&
1192 pspec != priv->gsettings_notification_pspec)
1193 terminal_profile_schedule_save (TERMINAL_PROFILE (object)((((TerminalProfile*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((terminal_profile_get_type ()))))))
, pspec);
1194}
1195
1196static void
1197terminal_profile_class_init (TerminalProfileClass *klass)
1198{
1199 GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
;
1200
1201 gsettings_key_quark = g_quark_from_static_string ("GT::GSettingsKey");
1202
1203 object_class->constructor = terminal_profile_constructor;
1204 object_class->finalize = terminal_profile_finalize;
1205 object_class->get_property = terminal_profile_get_property;
1206 object_class->set_property = terminal_profile_set_property;
1207 object_class->notify = terminal_profile_notify;
1208
1209 signals[FORGOTTEN] =
1210 g_signal_new ("forgotten",
1211 G_OBJECT_CLASS_TYPE (object_class)((((GTypeClass*) (object_class))->g_type)),
1212 G_SIGNAL_RUN_LAST,
1213 G_STRUCT_OFFSET (TerminalProfileClass, forgotten)((glong) __builtin_offsetof(TerminalProfileClass, forgotten)),
1214 NULL((void*)0), NULL((void*)0),
1215 g_cclosure_marshal_VOID__VOID,
1216 G_TYPE_NONE((GType) ((1) << (2))), 0);
1217
1218 /* gsettings_key -> pspec hash */
1219 klass->gsettings_keys = g_hash_table_new (g_str_hash, g_str_equal);
1220
1221#define TERMINAL_PROFILE_PSPEC_STATIC(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
1222
1223#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);
}
\
1224{\
1225 GParamSpec *pspec = propSpec;\
1226 g_object_class_install_property (object_class, propId, pspec);\
1227 g_param_spec_set_qdata (pspec, gsettings_key_quark, (gpointer) propGSettings);\
1228 g_hash_table_insert (klass->gsettings_keys, (gpointer) propGSettings, pspec);\
1229}
1230
1231#define TERMINAL_PROFILE_PROPERTY_OUTER(propId, propSpec){ GParamSpec *pspec = propSpec; g_object_class_install_property
(object_class, propId, pspec);}
\
1232{\
1233 GParamSpec *pspec = propSpec;\
1234 g_object_class_install_property (object_class, propId, pspec);\
1235}
1236
1237#define TERMINAL_PROFILE_PROPERTY_BOOLEAN(prop, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1238 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1239 g_param_spec_boolean (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1240 propDefault,\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1241 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1242 propGSettings){ GParamSpec *pspec = g_param_spec_boolean (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1243
1244#define TERMINAL_PROFILE_PROPERTY_BOXED(prop, propType, propGSettings){ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1245 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1246 g_param_spec_boxed (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1247 propType,\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1248 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1249 propGSettings){ GParamSpec *pspec = g_param_spec_boxed (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1250
1251#define TERMINAL_PROFILE_PROPERTY_DOUBLE(prop, propMin, propMax, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1252 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1253 g_param_spec_double (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1254 propMin, propMax, propDefault,\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1255 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1256 propGSettings){ GParamSpec *pspec = g_param_spec_double (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1257
1258#define TERMINAL_PROFILE_PROPERTY_ENUM(prop, propType, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1259 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1260 g_param_spec_enum (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1261 propType, propDefault,\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1262 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1263 propGSettings){ GParamSpec *pspec = g_param_spec_enum (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propType, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1264
1265#define TERMINAL_PROFILE_PROPERTY_INT(prop, propMin, propMax, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1266 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1267 g_param_spec_int (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1268 propMin, propMax, propDefault,\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1269 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1270 propGSettings){ GParamSpec *pspec = g_param_spec_int (TERMINAL_PROFILE_##prop
, ((void*)0), ((void*)0), propMin, propMax, propDefault, G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1271
1272 /* these are all read-only */
1273#define TERMINAL_PROFILE_PROPERTY_OBJECT(prop, propType){ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec);}
\
1274 TERMINAL_PROFILE_PROPERTY_OUTER (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1275 g_param_spec_object (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1276 propType,\{ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1277 G_PARAM_READABLE | TERMINAL_PROFILE_PSPEC_STATIC)){ GParamSpec *pspec = g_param_spec_object (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propType, G_PARAM_READABLE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_##prop, pspec);}
1278
1279#define TERMINAL_PROFILE_PROPERTY_STRING(prop, propDefault, propGSettings){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_prop, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) propGSettings); g_hash_table_insert
(klass->gsettings_keys, (gpointer) propGSettings, pspec);
}
\
1280 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1281 g_param_spec_string (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1282 propDefault,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1283 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1284 propGSettings){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_##prop
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1285
1286#define TERMINAL_PROFILE_PROPERTY_STRING_CO(prop, propDefault){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_prop,
pspec);}
\
1287 TERMINAL_PROFILE_PROPERTY_OUTER (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1288 g_param_spec_string (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1289 propDefault,\{ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1290 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | TERMINAL_PROFILE_PSPEC_STATIC)){ GParamSpec *pspec = g_param_spec_string (TERMINAL_PROFILE_##
prop, ((void*)0), ((void*)0), propDefault, G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec);}
1291
1292#define TERMINAL_PROFILE_PROPERTY_VALUE_ARRAY_BOXED(prop, propElementName, propElementType, propGSettings){ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_prop
, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
\
1293 TERMINAL_PROFILE_PROPERTY (PROP_##prop,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1294 g_param_spec_value_array (TERMINAL_PROFILE_##prop, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1295 g_param_spec_boxed (propElementName, NULL, NULL,\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1296 propElementType, \{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1297 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1298 G_PARAM_READWRITE | TERMINAL_PROFILE_PSPEC_STATIC),\{ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1299 propGSettings){ GParamSpec *pspec = g_param_spec_value_array (TERMINAL_PROFILE_
##prop, ((void*)0), ((void*)0), g_param_spec_boxed (propElementName
, ((void*)0), ((void*)0), propElementType, G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_##prop, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) propGSettings); g_hash_table_insert (klass->gsettings_keys
, (gpointer) propGSettings, pspec);}
1300
1301 TERMINAL_PROFILE_PROPERTY_BOOLEAN (ALLOW_BOLD, DEFAULT_ALLOW_BOLD, KEY_ALLOW_BOLD){ GParamSpec *pspec = g_param_spec_boolean ("allow-bold", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_ALLOW_BOLD, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "allow-bold"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "allow-bold", pspec);}
;
1302 TERMINAL_PROFILE_PROPERTY_BOOLEAN (BOLD_COLOR_SAME_AS_FG, DEFAULT_BOLD_COLOR_SAME_AS_FG, KEY_BOLD_COLOR_SAME_AS_FG){ GParamSpec *pspec = g_param_spec_boolean ("bold-color-same-as-fg"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BOLD_COLOR_SAME_AS_FG, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "bold-color-same-as-fg"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "bold-color-same-as-fg"
, pspec);}
;
1303 TERMINAL_PROFILE_PROPERTY_BOOLEAN (DEFAULT_SHOW_MENUBAR, DEFAULT_DEFAULT_SHOW_MENUBAR, KEY_DEFAULT_SHOW_MENUBAR){ GParamSpec *pspec = g_param_spec_boolean ("default-show-menubar"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_DEFAULT_SHOW_MENUBAR, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "default-show-menubar"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "default-show-menubar"
, pspec);}
;
1304 TERMINAL_PROFILE_PROPERTY_BOOLEAN (LOGIN_SHELL, DEFAULT_LOGIN_SHELL, KEY_LOGIN_SHELL){ GParamSpec *pspec = g_param_spec_boolean ("login-shell", ((
void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_LOGIN_SHELL, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "login-shell"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "login-shell", pspec);
}
;
1305 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_BACKGROUND, DEFAULT_SCROLL_BACKGROUND, KEY_SCROLL_BACKGROUND){ GParamSpec *pspec = g_param_spec_boolean ("scroll-background"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_BACKGROUND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-background")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-background"
, pspec);}
;
1306 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLLBACK_UNLIMITED, DEFAULT_SCROLLBACK_UNLIMITED, KEY_SCROLLBACK_UNLIMITED){ GParamSpec *pspec = g_param_spec_boolean ("scrollback-unlimited"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLLBACK_UNLIMITED, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scrollback-unlimited"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scrollback-unlimited"
, pspec);}
;
1307 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_KEYSTROKE, DEFAULT_SCROLL_ON_KEYSTROKE, KEY_SCROLL_ON_KEYSTROKE){ GParamSpec *pspec = g_param_spec_boolean ("scroll-on-keystroke"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_ON_KEYSTROKE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-on-keystroke"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-on-keystroke"
, pspec);}
;
1308 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_OUTPUT, DEFAULT_SCROLL_ON_OUTPUT, KEY_SCROLL_ON_OUTPUT){ GParamSpec *pspec = g_param_spec_boolean ("scroll-on-output"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLL_ON_OUTPUT, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scroll-on-output");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "scroll-on-output"
, pspec);}
;
1309 TERMINAL_PROFILE_PROPERTY_BOOLEAN (SILENT_BELL, DEFAULT_SILENT_BELL, KEY_SILENT_BELL){ GParamSpec *pspec = g_param_spec_boolean ("silent-bell", ((
void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SILENT_BELL, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "silent-bell"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "silent-bell", pspec);
}
;
1310 TERMINAL_PROFILE_PROPERTY_BOOLEAN (COPY_SELECTION, DEFAULT_COPY_SELECTION, KEY_COPY_SELECTION){ GParamSpec *pspec = g_param_spec_boolean ("copy-selection",
((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_COPY_SELECTION, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "copy-selection"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "copy-selection", pspec
);}
;
1311 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_COMMAND, DEFAULT_USE_CUSTOM_COMMAND, KEY_USE_CUSTOM_COMMAND){ GParamSpec *pspec = g_param_spec_boolean ("use-custom-command"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_CUSTOM_COMMAND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-custom-command"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-custom-command"
, pspec);}
;
1312 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_DEFAULT_SIZE, DEFAULT_USE_CUSTOM_DEFAULT_SIZE, KEY_USE_CUSTOM_DEFAULT_SIZE){ GParamSpec *pspec = g_param_spec_boolean ("use-custom-default-size"
, ((void*)0), ((void*)0), ((0)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_CUSTOM_DEFAULT_SIZE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-custom-default-size"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-custom-default-size"
, pspec);}
;
1313 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SKEY, DEFAULT_USE_SKEY, KEY_USE_SKEY){ GParamSpec *pspec = g_param_spec_boolean ("use-skey", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_SKEY, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-skey"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-skey", pspec);}
;
1314 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_URLS, DEFAULT_USE_URLS, KEY_USE_URLS){ GParamSpec *pspec = g_param_spec_boolean ("use-urls", ((void
*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_URLS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-urls"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-urls", pspec);}
;
1315 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SYSTEM_FONT, DEFAULT_USE_SYSTEM_FONT, KEY_USE_SYSTEM_FONT){ GParamSpec *pspec = g_param_spec_boolean ("use-system-font"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_SYSTEM_FONT, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-system-font"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "use-system-font", pspec
);}
;
1316 TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_THEME_COLORS, DEFAULT_USE_THEME_COLORS, KEY_USE_THEME_COLORS){ GParamSpec *pspec = g_param_spec_boolean ("use-theme-colors"
, ((void*)0), ((void*)0), ((!(0))), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_USE_THEME_COLORS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "use-theme-colors");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "use-theme-colors"
, pspec);}
;
1317
1318 TERMINAL_PROFILE_PROPERTY_BOXED (BACKGROUND_COLOR, GDK_TYPE_RGBA, KEY_BACKGROUND_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("background-color",
((void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "background-color"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "background-color", pspec);}
;
1319 TERMINAL_PROFILE_PROPERTY_BOXED (BOLD_COLOR, GDK_TYPE_RGBA, KEY_BOLD_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("bold-color", ((void
*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BOLD_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "bold-color"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "bold-color", pspec);}
;
1320 TERMINAL_PROFILE_PROPERTY_BOXED (FONT, PANGO_TYPE_FONT_DESCRIPTION, KEY_FONT){ GParamSpec *pspec = g_param_spec_boxed ("font", ((void*)0),
((void*)0), (pango_font_description_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_FONT,
pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark, (
gpointer) "font"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "font", pspec);}
;
1321 TERMINAL_PROFILE_PROPERTY_BOXED (FOREGROUND_COLOR, GDK_TYPE_RGBA, KEY_FOREGROUND_COLOR){ GParamSpec *pspec = g_param_spec_boxed ("foreground-color",
((void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_FOREGROUND_COLOR
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "foreground-color"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "foreground-color", pspec);}
;
1322
1323 /* 0.0 = normal bg, 1.0 = all black bg, 0.5 = half darkened */
1324 TERMINAL_PROFILE_PROPERTY_DOUBLE (BACKGROUND_DARKNESS, 0.0, 1.0, DEFAULT_BACKGROUND_DARKNESS, KEY_BACKGROUND_DARKNESS){ GParamSpec *pspec = g_param_spec_double ("background-darkness"
, ((void*)0), ((void*)0), 0.0, 1.0, (0.5), G_PARAM_READWRITE |
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_DARKNESS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "background-darkness"); g_hash_table_insert (klass
->gsettings_keys, (gpointer) "background-darkness", pspec)
;}
;
1325
1326 TERMINAL_PROFILE_PROPERTY_ENUM (BACKGROUND_TYPE, TERMINAL_TYPE_BACKGROUND_TYPE, DEFAULT_BACKGROUND_TYPE, KEY_BACKGROUND_TYPE){ GParamSpec *pspec = g_param_spec_enum ("background-type", (
(void*)0), ((void*)0), (terminal_background_type_get_type ())
, (TERMINAL_BACKGROUND_SOLID), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BACKGROUND_TYPE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "background-type"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "background-type", pspec
);}
;
1327 TERMINAL_PROFILE_PROPERTY_ENUM (BACKSPACE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_BACKSPACE_BINDING, KEY_BACKSPACE_BINDING){ GParamSpec *pspec = g_param_spec_enum ("backspace-binding",
((void*)0), ((void*)0), (vte_erase_binding_get_type ()), (VTE_ERASE_ASCII_DELETE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_BACKSPACE_BINDING, pspec); g_param_spec_set_qdata (pspec
, gsettings_key_quark, (gpointer) "backspace-binding"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "backspace-binding", pspec
);}
;
1328 TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_BLINK_MODE, VTE_TYPE_CURSOR_BLINK_MODE, DEFAULT_CURSOR_BLINK_MODE, KEY_CURSOR_BLINK_MODE){ GParamSpec *pspec = g_param_spec_enum ("cursor-blink-mode",
((void*)0), ((void*)0), (vte_cursor_blink_mode_get_type ()),
(VTE_CURSOR_BLINK_SYSTEM), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_CURSOR_BLINK_MODE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "cursor-blink-mode")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "cursor-blink-mode"
, pspec);}
;
1329 TERMINAL_PROFILE_PROPERTY_ENUM (CURSOR_SHAPE, VTE_TYPE_CURSOR_SHAPE, DEFAULT_CURSOR_SHAPE, KEY_CURSOR_SHAPE){ GParamSpec *pspec = g_param_spec_enum ("cursor-shape", ((void
*)0), ((void*)0), (vte_cursor_shape_get_type ()), (VTE_CURSOR_SHAPE_BLOCK
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_CURSOR_SHAPE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "cursor-shape"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "cursor-shape", pspec);}
;
1330 TERMINAL_PROFILE_PROPERTY_ENUM (DELETE_BINDING, VTE_TYPE_ERASE_BINDING, DEFAULT_DELETE_BINDING, KEY_DELETE_BINDING){ GParamSpec *pspec = g_param_spec_enum ("delete-binding", ((
void*)0), ((void*)0), (vte_erase_binding_get_type ()), (VTE_ERASE_DELETE_SEQUENCE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_DELETE_BINDING, pspec); g_param_spec_set_qdata (pspec,
gsettings_key_quark, (gpointer) "delete-binding"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "delete-binding", pspec
);}
;
1331 TERMINAL_PROFILE_PROPERTY_ENUM (EXIT_ACTION, TERMINAL_TYPE_EXIT_ACTION, DEFAULT_EXIT_ACTION, KEY_EXIT_ACTION){ GParamSpec *pspec = g_param_spec_enum ("exit-action", ((void
*)0), ((void*)0), (terminal_exit_action_get_type ()), (TERMINAL_EXIT_CLOSE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_EXIT_ACTION, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "exit-action"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "exit-action", pspec);}
;
1332 TERMINAL_PROFILE_PROPERTY_ENUM (SCROLLBAR_POSITION, TERMINAL_TYPE_SCROLLBAR_POSITION, DEFAULT_SCROLLBAR_POSITION, KEY_SCROLLBAR_POSITION){ GParamSpec *pspec = g_param_spec_enum ("scrollbar-position"
, ((void*)0), ((void*)0), (terminal_scrollbar_position_get_type
()), (TERMINAL_SCROLLBAR_RIGHT), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_SCROLLBAR_POSITION, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "scrollbar-position"
); g_hash_table_insert (klass->gsettings_keys, (gpointer) "scrollbar-position"
, pspec);}
;
1333 TERMINAL_PROFILE_PROPERTY_ENUM (TITLE_MODE, TERMINAL_TYPE_TITLE_MODE, DEFAULT_TITLE_MODE, KEY_TITLE_MODE){ GParamSpec *pspec = g_param_spec_enum ("title-mode", ((void
*)0), ((void*)0), (terminal_title_mode_get_type ()), (TERMINAL_TITLE_REPLACE
), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_TITLE_MODE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "title-mode"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "title-mode", pspec);}
;
1334
1335 TERMINAL_PROFILE_PROPERTY_INT (DEFAULT_SIZE_COLUMNS, 1, 1024, DEFAULT_DEFAULT_SIZE_COLUMNS, KEY_DEFAULT_SIZE_COLUMNS){ GParamSpec *pspec = g_param_spec_int ("default-size-columns"
, ((void*)0), ((void*)0), 1, 1024, (80), G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_DEFAULT_SIZE_COLUMNS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "default-size-columns"); g_hash_table_insert (klass
->gsettings_keys, (gpointer) "default-size-columns", pspec
);}
;
1336 TERMINAL_PROFILE_PROPERTY_INT (DEFAULT_SIZE_ROWS, 1, 1024, DEFAULT_DEFAULT_SIZE_ROWS, KEY_DEFAULT_SIZE_ROWS){ GParamSpec *pspec = g_param_spec_int ("default-size-rows", (
(void*)0), ((void*)0), 1, 1024, (24), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_DEFAULT_SIZE_ROWS, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "default-size-rows")
; g_hash_table_insert (klass->gsettings_keys, (gpointer) "default-size-rows"
, pspec);}
;
1337 TERMINAL_PROFILE_PROPERTY_INT (SCROLLBACK_LINES, 1, G_MAXINT, DEFAULT_SCROLLBACK_LINES, KEY_SCROLLBACK_LINES){ GParamSpec *pspec = g_param_spec_int ("scrollback-lines", (
(void*)0), ((void*)0), 1, 2147483647, (512), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_SCROLLBACK_LINES
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "scrollback-lines"); g_hash_table_insert (klass->
gsettings_keys, (gpointer) "scrollback-lines", pspec);}
;
1338
1339 TERMINAL_PROFILE_PROPERTY_OBJECT (BACKGROUND_IMAGE, GDK_TYPE_PIXBUF){ GParamSpec *pspec = g_param_spec_object ("background-image"
, ((void*)0), ((void*)0), (gdk_pixbuf_get_type ()), G_PARAM_READABLE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_BACKGROUND_IMAGE
, pspec);}
;
1340
1341 TERMINAL_PROFILE_PROPERTY_STRING_CO (NAME, DEFAULT_NAME){ GParamSpec *pspec = g_param_spec_string ("name", ((void*)0)
, ((void*)0), (((void*)0)), G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_NAME,
pspec);}
;
1342
1343 TERMINAL_PROFILE_PROPERTY_STRING (BACKGROUND_IMAGE_FILE, DEFAULT_BACKGROUND_IMAGE_FILE, KEY_BACKGROUND_IMAGE_FILE){ GParamSpec *pspec = g_param_spec_string ("background-image-file"
, ((void*)0), ((void*)0), (""), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_BACKGROUND_IMAGE_FILE, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "background-image");
g_hash_table_insert (klass->gsettings_keys, (gpointer) "background-image"
, pspec);}
;
1344 TERMINAL_PROFILE_PROPERTY_STRING (CUSTOM_COMMAND, DEFAULT_CUSTOM_COMMAND, KEY_CUSTOM_COMMAND){ GParamSpec *pspec = g_param_spec_string ("custom-command", (
(void*)0), ((void*)0), (""), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property
(object_class, PROP_CUSTOM_COMMAND, pspec); g_param_spec_set_qdata
(pspec, gsettings_key_quark, (gpointer) "custom-command"); g_hash_table_insert
(klass->gsettings_keys, (gpointer) "custom-command", pspec
);}
;
1345 TERMINAL_PROFILE_PROPERTY_STRING (TITLE, _(DEFAULT_TITLE), KEY_TITLE){ GParamSpec *pspec = g_param_spec_string ("title", ((void*)0
), ((void*)0), gettext ((("Terminal"))), G_PARAM_READWRITE | (
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_TITLE
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "title"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "title", pspec);}
;
1346 TERMINAL_PROFILE_PROPERTY_STRING (VISIBLE_NAME, _(DEFAULT_VISIBLE_NAME), KEY_VISIBLE_NAME){ GParamSpec *pspec = g_param_spec_string ("visible-name", ((
void*)0), ((void*)0), gettext ((("Unnamed"))), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_VISIBLE_NAME
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "visible-name"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "visible-name", pspec);}
;
1347 TERMINAL_PROFILE_PROPERTY_STRING (WORD_CHARS, DEFAULT_WORD_CHARS, KEY_WORD_CHARS){ GParamSpec *pspec = g_param_spec_string ("word-chars", ((void
*)0), ((void*)0), ("-A-Za-z0-9,./?%&#:_=+@~"), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)); g_object_class_install_property (object_class, PROP_WORD_CHARS
, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark,
(gpointer) "word-chars"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "word-chars", pspec);}
;
1348
1349 TERMINAL_PROFILE_PROPERTY_VALUE_ARRAY_BOXED (PALETTE, "palette-color", GDK_TYPE_RGBA, KEY_PALETTE){ GParamSpec *pspec = g_param_spec_value_array ("palette", ((
void*)0), ((void*)0), g_param_spec_boxed ("palette-color", ((
void*)0), ((void*)0), (gdk_rgba_get_type ()), G_PARAM_READWRITE
| (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)), G_PARAM_READWRITE | (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class
, PROP_PALETTE, pspec); g_param_spec_set_qdata (pspec, gsettings_key_quark
, (gpointer) "palette"); g_hash_table_insert (klass->gsettings_keys
, (gpointer) "palette", pspec);}
;
1350}
1351
1352/* Semi-Public API */
1353
1354TerminalProfile*
1355_terminal_profile_new (const char *name)
1356{
1357 return g_object_new (TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()),
1358 "name", name,
1359 NULL((void*)0));
1360}
1361
1362void
1363_terminal_profile_forget (TerminalProfile *profile)
1364{
1365 TerminalProfilePrivate *priv = profile->priv;
1366
1367 if (!priv->forgotten)
1368 {
1369 priv->forgotten = TRUE(!(0));
1370
1371 g_signal_emit (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, signals[FORGOTTEN], 0);
1372 }
1373}
1374
1375gboolean
1376_terminal_profile_get_forgotten (TerminalProfile *profile)
1377{
1378 return profile->priv->forgotten;
1379}
1380
1381TerminalProfile *
1382_terminal_profile_clone (TerminalProfile *base_profile,
1383 const char *visible_name)
1384{
1385 TerminalApp *app = terminal_app_get ();
1386 GObject *base_object = G_OBJECT (base_profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((base_profile)), (((GType) ((20) << (2))))))))
;
1387 TerminalProfilePrivate *new_priv;
1388 char profile_name[32];
1389 GParameter *params;
1390 GParamSpec **pspecs;
1391 guint n_pspecs, i, n_params, profile_num;
1392 TerminalProfile *new_profile;
1393
1394 g_object_ref (base_profile)((__typeof__ (base_profile)) (g_object_ref) (base_profile));
1395
1396 profile_num = 0;
1397 do
1398 {
1399 g_snprintf (profile_name, sizeof (profile_name), "profile%u", profile_num++);
1400 }
1401 while (terminal_app_get_profile_by_name (app, profile_name) != NULL((void*)0));
1402
1403 /* Now we have an unused profile name */
1404 pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (base_profile))((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((((((TerminalProfileClass*) (((GTypeInstance*) ((base_profile
)))->g_class)))))), (((GType) ((20) << (2))))))))
, &n_pspecs);
1405
1406 params = g_newa (GParameter, n_pspecs)((GParameter*) __builtin_alloca (sizeof (GParameter) * (gsize
) (n_pspecs)))
;
1407 n_params = 0;
1408
1409 for (i = 0; i < n_pspecs; ++i)
1410 {
1411 GParamSpec *pspec = pspecs[i];
1412 GValue *value;
1413
1414 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) ||
1415 (pspec->flags & G_PARAM_WRITABLE) == 0)
1416 continue;
1417
1418 params[n_params].name = pspec->name;
1419
1420 value = &params[n_params].value;
1421 G_VALUE_TYPE (value)(((GValue*) (value))->g_type) = 0;
1422 g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec)(((((GParamSpec*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pspec)), (((GType) ((19) << (2))))))))->value_type
)
);
1423
1424 if (pspec->name == I_(TERMINAL_PROFILE_NAME)g_intern_static_string ("name"))
1425 g_value_set_static_string (value, profile_name);
1426 else if (pspec->name == I_(TERMINAL_PROFILE_VISIBLE_NAME)g_intern_static_string ("visible-name"))
1427 g_value_set_static_string (value, visible_name);
1428 else
1429 g_object_get_property (base_object, pspec->name, value);
1430
1431 ++n_params;
1432 }
1433
1434 new_profile = g_object_newv (TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()), n_params, params);
1435
1436 g_object_unref (base_profile);
1437
1438 for (i = 0; i < n_params; ++i)
1439 g_value_unset (&params[i].value);
1440
1441 /* Flush the new profile to GSettings */
1442 new_priv = new_profile->priv;
1443
1444 g_slist_free (new_priv->dirty_pspecs);
1445 new_priv->dirty_pspecs = NULL((void*)0);
1446 if (new_priv->save_idle_id != 0)
1447 {
1448 g_source_remove (new_priv->save_idle_id);
1449 new_priv->save_idle_id = 0;
1450 }
1451
1452 for (i = 0; i < n_pspecs; ++i)
1453 {
1454 GParamSpec *pspec = pspecs[i];
1455
1456 if (pspec->owner_type != TERMINAL_TYPE_PROFILE(terminal_profile_get_type ()) ||
1457 (pspec->flags & G_PARAM_WRITABLE) == 0)
1458 continue;
1459
1460 new_priv->dirty_pspecs = g_slist_prepend (new_priv->dirty_pspecs, pspec);
1461 }
1462 g_free (pspecs);
1463
1464 terminal_profile_save (new_profile);
1465
1466 return new_profile;
1467}
1468
1469/* Public API */
1470
1471gboolean
1472terminal_profile_get_property_boolean (TerminalProfile *profile,
1473 const char *prop_name)
1474{
1475 const GValue *value;
1476
1477 value = get_prop_value_from_prop_name (profile, prop_name);
1478 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_BOOLEAN (value), FALSE)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((5) << (2)))); gboolean __r; if (!__val) __r = (0); else
if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_BOOLEAN (value)"
); return ((0)); } } while (0)
;
1479 if (!value || !G_VALUE_HOLDS_BOOLEAN (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((5) << (2)))); gboolean __r;
if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1480 return FALSE(0);
1481
1482 return g_value_get_boolean (value);
1483}
1484
1485gconstpointer
1486terminal_profile_get_property_boxed (TerminalProfile *profile,
1487 const char *prop_name)
1488{
1489 const GValue *value;
1490
1491 value = get_prop_value_from_prop_name (profile, prop_name);
1492 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_BOXED (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((18) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_BOXED (value)"
); return (((void*)0)); } } while (0)
;
1493 if (!value || !G_VALUE_HOLDS_BOXED (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((18) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1494 return NULL((void*)0);
1495
1496 return g_value_get_boxed (value);
1497}
1498
1499double
1500terminal_profile_get_property_double (TerminalProfile *profile,
1501 const char *prop_name)
1502{
1503 const GValue *value;
1504
1505 value = get_prop_value_from_prop_name (profile, prop_name);
1506 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_DOUBLE (value), 0.0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((15) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_DOUBLE (value)"
); return (0.0); } } while (0)
;
1507 if (!value || !G_VALUE_HOLDS_DOUBLE (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((15) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1508 return 0.0;
1509
1510 return g_value_get_double (value);
1511}
1512
1513int
1514terminal_profile_get_property_enum (TerminalProfile *profile,
1515 const char *prop_name)
1516{
1517 const GValue *value;
1518
1519 value = get_prop_value_from_prop_name (profile, prop_name);
1520 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_ENUM (value), 0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((12) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_ENUM (value)"
); return (0); } } while (0)
;
1521 if (!value || !G_VALUE_HOLDS_ENUM (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((12) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1522 return 0;
1523
1524 return g_value_get_enum (value);
1525}
1526
1527int
1528terminal_profile_get_property_int (TerminalProfile *profile,
1529 const char *prop_name)
1530{
1531 const GValue *value;
1532
1533 value = get_prop_value_from_prop_name (profile, prop_name);
1534 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_INT (value), 0)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((6) << (2)))); gboolean __r; if (!__val) __r = (0); else
if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_INT (value)"
); return (0); } } while (0)
;
1535 if (!value || !G_VALUE_HOLDS_INT (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((6) << (2)))); gboolean __r;
if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1536 return 0;
1537
1538 return g_value_get_int (value);
1539}
1540
1541gpointer
1542terminal_profile_get_property_object (TerminalProfile *profile,
1543 const char *prop_name)
1544{
1545 const GValue *value;
1546
1547 value = get_prop_value_from_prop_name (profile, prop_name);
1548 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_OBJECT (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((20) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_OBJECT (value)"
); return (((void*)0)); } } while (0)
;
1549 if (!value || !G_VALUE_HOLDS_OBJECT (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((20) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1550 return NULL((void*)0);
1551
1552 return g_value_get_object (value);
1553}
1554
1555const char*
1556terminal_profile_get_property_string (TerminalProfile *profile,
1557 const char *prop_name)
1558{
1559 const GValue *value;
1560
1561 value = get_prop_value_from_prop_name (profile, prop_name);
1562 g_return_val_if_fail (value != NULL && G_VALUE_HOLDS_STRING (value), NULL)do { if ((value != ((void*)0) && (((__extension__ ({ const
GValue *__val = (const GValue*) ((value)); GType __t = (((GType
) ((16) << (2)))); gboolean __r; if (!__val) __r = (0);
else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds
(__val, __t); __r; })))))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "value != NULL && G_VALUE_HOLDS_STRING (value)"
); return (((void*)0)); } } while (0)
;
1563 if (!value || !G_VALUE_HOLDS_STRING (value)(((__extension__ ({ const GValue *__val = (const GValue*) ((value
)); GType __t = (((GType) ((16) << (2)))); gboolean __r
; if (!__val) __r = (0); else if (__val->g_type == __t) __r
= (!(0)); else __r = g_type_check_value_holds (__val, __t); __r
; }))))
)
1564 return NULL((void*)0);
1565
1566 return g_value_get_string (value);
1567}
1568
1569gboolean
1570terminal_profile_property_locked (TerminalProfile *profile,
1571 const char *prop_name)
1572{
1573 TerminalProfilePrivate *priv = profile->priv;
1574 GParamSpec *pspec;
1575
1576 pspec = get_pspec_from_name (profile, prop_name);
1577 g_return_val_if_fail (pspec != NULL, FALSE)do { if ((pspec != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "pspec != NULL");
return ((0)); } } while (0)
;
1578 if (!pspec)
1579 return FALSE(0);
1580
1581 return priv->locked[pspec->param_id];
1582}
1583
1584void
1585terminal_profile_reset_property (TerminalProfile *profile,
1586 const char *prop_name)
1587{
1588 GParamSpec *pspec;
1589
1590 pspec = get_pspec_from_name (profile, prop_name);
1591 g_return_if_fail (pspec != NULL)do { if ((pspec != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "pspec != NULL");
return; } } while (0)
;
1592 if (!pspec ||
1593 (pspec->flags & G_PARAM_WRITABLE) == 0)
1594 return;
1595
1596 terminal_profile_reset_property_internal (profile, pspec, TRUE(!(0)));
1597}
1598
1599gboolean
1600terminal_profile_get_palette (TerminalProfile *profile,
1601 GdkRGBA *colors,
1602 guint *n_colors)
1603{
1604 TerminalProfilePrivate *priv;
1605 GValueArray *array;
1606 guint i, n;
1607
1608 g_return_val_if_fail (TERMINAL_IS_PROFILE (profile), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((profile)); GType __t = ((terminal_profile_get_type ()));
gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class
&& __inst->g_class->g_type == __t) __r = (!(0)
); else __r = g_type_check_instance_is_a (__inst, __t); __r; }
)))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "TERMINAL_IS_PROFILE (profile)"); return
((0)); } } while (0)
;
1609 g_return_val_if_fail (colors != NULL && n_colors != NULL, FALSE)do { if ((colors != ((void*)0) && n_colors != ((void*
)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "colors != NULL && n_colors != NULL"
); return ((0)); } } while (0)
;
1610
1611 priv = profile->priv;
1612 array = g_value_get_boxed (g_value_array_get_nth (priv->properties, PROP_PALETTE));
1613 if (!array)
1614 return FALSE(0);
1615
1616 n = MIN (array->n_values, *n_colors)(((array->n_values) < (*n_colors)) ? (array->n_values
) : (*n_colors))
;
1617 for (i = 0; i < n; ++i)
1618 {
1619 GdkRGBA *color = g_value_get_boxed (g_value_array_get_nth (array, i));
1620 if (!color)
1621 continue; /* shouldn't happen!! */
1622
1623 colors[i] = *color;
1624 }
1625
1626 *n_colors = n;
1627 return TRUE(!(0));
1628}
1629
1630gboolean
1631terminal_profile_get_palette_is_builtin (TerminalProfile *profile,
1632 guint *n)
1633{
1634 GdkRGBA colors[TERMINAL_PALETTE_SIZE16];
1635 guint n_colors;
1636 guint i;
1637
1638 n_colors = G_N_ELEMENTS (colors)(sizeof (colors) / sizeof ((colors)[0]));
1639 if (!terminal_profile_get_palette (profile, colors, &n_colors) ||
1640 n_colors != TERMINAL_PALETTE_SIZE16)
1641 return FALSE(0);
1642
1643 for (i = 0; i < TERMINAL_PALETTE_N_BUILTINS5; ++i)
1644 if (palette_cmp (colors, terminal_palettes[i]))
1645 {
1646 *n = i;
1647 return TRUE(!(0));
1648 }
1649
1650 return FALSE(0);
1651}
1652
1653void
1654terminal_profile_set_palette_builtin (TerminalProfile *profile,
1655 guint n)
1656{
1657 GValue value = { 0, };
1658
1659 g_return_if_fail (n < TERMINAL_PALETTE_N_BUILTINS)do { if ((n < 5)) { } else { g_return_if_fail_warning (((gchar
*) 0), ((const char*) (__func__)), "n < TERMINAL_PALETTE_N_BUILTINS"
); return; } } while (0)
;
1660
1661 g_value_init (&value, G_TYPE_VALUE_ARRAY(g_value_array_get_type ()) GCC warning "Deprecated pre-processor symbol: replace with \"(g_array_get_type ())\""
+
);
1662 set_value_from_palette (&value, terminal_palettes[n], TERMINAL_PALETTE_SIZE16);
1663 g_object_set_property (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, TERMINAL_PROFILE_PALETTE"palette", &value);
1664 g_value_unset (&value);
1665}
1666
1667gboolean
1668terminal_profile_modify_palette_entry (TerminalProfile *profile,
1669 guint i,
1670 const GdkRGBA *color)
1671{
1672 TerminalProfilePrivate *priv = profile->priv;
1673 GValueArray *array;
1674 GValue *value;
1675 GdkRGBA *old_color;
1676
1677 array = g_value_get_boxed (g_value_array_get_nth (priv->properties, PROP_PALETTE));
1678 if (!array ||
1679 i >= array->n_values)
1680 return FALSE(0);
1681
1682 value = g_value_array_get_nth (array, i);
1683 old_color = g_value_get_boxed (value);
1684 if (!old_color ||
1685 !rgba_equal (old_color, color))
1686 {
1687 g_value_set_boxed (value, color);
1688 g_object_notify (G_OBJECT (profile)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((profile)), (((GType) ((20) << (2))))))))
, TERMINAL_PROFILE_PALETTE"palette");
1689 }
1690
1691 return TRUE(!(0));
1692}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-e22eee.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-e22eee.html new file mode 100644 index 0000000..1ea5736 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-e22eee.html @@ -0,0 +1,983 @@ + + + +btoe.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:skey/btoe.c
Warning:line 263, column 2
Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name btoe.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src/skey -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I ../.. -I ./.. -D G_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -D PIC -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src/skey -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c btoe.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * This code is imported from Bollcore's S/KEY + some simple glib adaptations
3 * (See rfc2289 and rfc1760)
4 */
5
6#include <config.h>
7#include <stdio.h>
8#include <string.h>
9#include <unistd.h>
10#include <glib.h>
11
12#include "skey.h"
13#include "btoe.h"
14
15static guint32 extract (char *s, int start, int length);
16
17/* Dictionary for integer-word translations */
18static const char Wp[2048][4] = { "A", "ABE", "ACE", "ACT", "AD", "ADA", "ADD",
19 "AGO", "AID", "AIM", "AIR", "ALL", "ALP", "AM", "AMY", "AN", "ANA",
20 "AND", "ANN", "ANT", "ANY", "APE", "APS", "APT", "ARC", "ARE", "ARK",
21 "ARM", "ART", "AS", "ASH", "ASK", "AT", "ATE", "AUG", "AUK", "AVE",
22 "AWE", "AWK", "AWL", "AWN", "AX", "AYE", "BAD", "BAG", "BAH", "BAM",
23 "BAN", "BAR", "BAT", "BAY", "BE", "BED", "BEE", "BEG", "BEN", "BET",
24 "BEY", "BIB", "BID", "BIG", "BIN", "BIT", "BOB", "BOG", "BON", "BOO",
25 "BOP", "BOW", "BOY", "BUB", "BUD", "BUG", "BUM", "BUN", "BUS", "BUT",
26 "BUY", "BY", "BYE", "CAB", "CAL", "CAM", "CAN", "CAP", "CAR", "CAT",
27 "CAW", "COD", "COG", "COL", "CON", "COO", "COP", "COT", "COW", "COY",
28 "CRY", "CUB", "CUE", "CUP", "CUR", "CUT", "DAB", "DAD", "DAM", "DAN",
29 "DAR", "DAY", "DEE", "DEL", "DEN", "DES", "DEW", "DID", "DIE", "DIG",
30 "DIN", "DIP", "DO", "DOE", "DOG", "DON", "DOT", "DOW", "DRY", "DUB",
31 "DUD", "DUE", "DUG", "DUN", "EAR", "EAT", "ED", "EEL", "EGG", "EGO",
32 "ELI", "ELK", "ELM", "ELY", "EM", "END", "EST", "ETC", "EVA", "EVE",
33 "EWE", "EYE", "FAD", "FAN", "FAR", "FAT", "FAY", "FED", "FEE", "FEW",
34 "FIB", "FIG", "FIN", "FIR", "FIT", "FLO", "FLY", "FOE", "FOG", "FOR",
35 "FRY", "FUM", "FUN", "FUR", "GAB", "GAD", "GAG", "GAL", "GAM", "GAP",
36 "GAS", "GAY", "GEE", "GEL", "GEM", "GET", "GIG", "GIL", "GIN", "GO",
37 "GOT", "GUM", "GUN", "GUS", "GUT", "GUY", "GYM", "GYP", "HA", "HAD",
38 "HAL", "HAM", "HAN", "HAP", "HAS", "HAT", "HAW", "HAY", "HE", "HEM",
39 "HEN", "HER", "HEW", "HEY", "HI", "HID", "HIM", "HIP", "HIS", "HIT",
40 "HO", "HOB", "HOC", "HOE", "HOG", "HOP", "HOT", "HOW", "HUB", "HUE",
41 "HUG", "HUH", "HUM", "HUT", "I", "ICY", "IDA", "IF", "IKE", "ILL",
42 "INK", "INN", "IO", "ION", "IQ", "IRA", "IRE", "IRK", "IS", "IT", "ITS",
43 "IVY", "JAB", "JAG", "JAM", "JAN", "JAR", "JAW", "JAY", "JET", "JIG",
44 "JIM", "JO", "JOB", "JOE", "JOG", "JOT", "JOY", "JUG", "JUT", "KAY",
45 "KEG", "KEN", "KEY", "KID", "KIM", "KIN", "KIT", "LA", "LAB", "LAC",
46 "LAD", "LAG", "LAM", "LAP", "LAW", "LAY", "LEA", "LED", "LEE", "LEG",
47 "LEN", "LEO", "LET", "LEW", "LID", "LIE", "LIN", "LIP", "LIT", "LO",
48 "LOB", "LOG", "LOP", "LOS", "LOT", "LOU", "LOW", "LOY", "LUG", "LYE",
49 "MA", "MAC", "MAD", "MAE", "MAN", "MAO", "MAP", "MAT", "MAW", "MAY",
50 "ME", "MEG", "MEL", "MEN", "MET", "MEW", "MID", "MIN", "MIT", "MOB",
51 "MOD", "MOE", "MOO", "MOP", "MOS", "MOT", "MOW", "MUD", "MUG", "MUM",
52 "MY", "NAB", "NAG", "NAN", "NAP", "NAT", "NAY", "NE", "NED", "NEE",
53 "NET", "NEW", "NIB", "NIL", "NIP", "NIT", "NO", "NOB", "NOD", "NON",
54 "NOR", "NOT", "NOV", "NOW", "NU", "NUN", "NUT", "O", "OAF", "OAK",
55 "OAR", "OAT", "ODD", "ODE", "OF", "OFF", "OFT", "OH", "OIL", "OK",
56 "OLD", "ON", "ONE", "OR", "ORB", "ORE", "ORR", "OS", "OTT", "OUR",
57 "OUT", "OVA", "OW", "OWE", "OWL", "OWN", "OX", "PA", "PAD", "PAL",
58 "PAM", "PAN", "PAP", "PAR", "PAT", "PAW", "PAY", "PEA", "PEG", "PEN",
59 "PEP", "PER", "PET", "PEW", "PHI", "PI", "PIE", "PIN", "PIT", "PLY",
60 "PO", "POD", "POE", "POP", "POT", "POW", "PRO", "PRY", "PUB", "PUG",
61 "PUN", "PUP", "PUT", "QUO", "RAG", "RAM", "RAN", "RAP", "RAT", "RAW",
62 "RAY", "REB", "RED", "REP", "RET", "RIB", "RID", "RIG", "RIM", "RIO",
63 "RIP", "ROB", "ROD", "ROE", "RON", "ROT", "ROW", "ROY", "RUB", "RUE",
64 "RUG", "RUM", "RUN", "RYE", "SAC", "SAD", "SAG", "SAL", "SAM", "SAN",
65 "SAP", "SAT", "SAW", "SAY", "SEA", "SEC", "SEE", "SEN", "SET", "SEW",
66 "SHE", "SHY", "SIN", "SIP", "SIR", "SIS", "SIT", "SKI", "SKY", "SLY",
67 "SO", "SOB", "SOD", "SON", "SOP", "SOW", "SOY", "SPA", "SPY", "SUB",
68 "SUD", "SUE", "SUM", "SUN", "SUP", "TAB", "TAD", "TAG", "TAN", "TAP",
69 "TAR", "TEA", "TED", "TEE", "TEN", "THE", "THY", "TIC", "TIE", "TIM",
70 "TIN", "TIP", "TO", "TOE", "TOG", "TOM", "TON", "TOO", "TOP", "TOW",
71 "TOY", "TRY", "TUB", "TUG", "TUM", "TUN", "TWO", "UN", "UP", "US",
72 "USE", "VAN", "VAT", "VET", "VIE", "WAD", "WAG", "WAR", "WAS", "WAY",
73 "WE", "WEB", "WED", "WEE", "WET", "WHO", "WHY", "WIN", "WIT", "WOK",
74 "WON", "WOO", "WOW", "WRY", "WU", "YAM", "YAP", "YAW", "YE", "YEA",
75 "YES", "YET", "YOU", "ABED", "ABEL", "ABET", "ABLE", "ABUT", "ACHE",
76 "ACID", "ACME", "ACRE", "ACTA", "ACTS", "ADAM", "ADDS", "ADEN", "AFAR",
77 "AFRO", "AGEE", "AHEM", "AHOY", "AIDA", "AIDE", "AIDS", "AIRY", "AJAR",
78 "AKIN", "ALAN", "ALEC", "ALGA", "ALIA", "ALLY", "ALMA", "ALOE", "ALSO",
79 "ALTO", "ALUM", "ALVA", "AMEN", "AMES", "AMID", "AMMO", "AMOK", "AMOS",
80 "AMRA", "ANDY", "ANEW", "ANNA", "ANNE", "ANTE", "ANTI", "AQUA", "ARAB",
81 "ARCH", "AREA", "ARGO", "ARID", "ARMY", "ARTS", "ARTY", "ASIA", "ASKS",
82 "ATOM", "AUNT", "AURA", "AUTO", "AVER", "AVID", "AVIS", "AVON", "AVOW",
83 "AWAY", "AWRY", "BABE", "BABY", "BACH", "BACK", "BADE", "BAIL", "BAIT",
84 "BAKE", "BALD", "BALE", "BALI", "BALK", "BALL", "BALM", "BAND", "BANE",
85 "BANG", "BANK", "BARB", "BARD", "BARE", "BARK", "BARN", "BARR", "BASE",
86 "BASH", "BASK", "BASS", "BATE", "BATH", "BAWD", "BAWL", "BEAD", "BEAK",
87 "BEAM", "BEAN", "BEAR", "BEAT", "BEAU", "BECK", "BEEF", "BEEN", "BEER",
88 "BEET", "BELA", "BELL", "BELT", "BEND", "BENT", "BERG", "BERN", "BERT",
89 "BESS", "BEST", "BETA", "BETH", "BHOY", "BIAS", "BIDE", "BIEN", "BILE",
90 "BILK", "BILL", "BIND", "BING", "BIRD", "BITE", "BITS", "BLAB", "BLAT",
91 "BLED", "BLEW", "BLOB", "BLOC", "BLOT", "BLOW", "BLUE", "BLUM", "BLUR",
92 "BOAR", "BOAT", "BOCA", "BOCK", "BODE", "BODY", "BOGY", "BOHR", "BOIL",
93 "BOLD", "BOLO", "BOLT", "BOMB", "BONA", "BOND", "BONE", "BONG", "BONN",
94 "BONY", "BOOK", "BOOM", "BOON", "BOOT", "BORE", "BORG", "BORN", "BOSE",
95 "BOSS", "BOTH", "BOUT", "BOWL", "BOYD", "BRAD", "BRAE", "BRAG", "BRAN",
96 "BRAY", "BRED", "BREW", "BRIG", "BRIM", "BROW", "BUCK", "BUDD", "BUFF",
97 "BULB", "BULK", "BULL", "BUNK", "BUNT", "BUOY", "BURG", "BURL", "BURN",
98 "BURR", "BURT", "BURY", "BUSH", "BUSS", "BUST", "BUSY", "BYTE", "CADY",
99 "CAFE", "CAGE", "CAIN", "CAKE", "CALF", "CALL", "CALM", "CAME", "CANE",
100 "CANT", "CARD", "CARE", "CARL", "CARR", "CART", "CASE", "CASH", "CASK",
101 "CAST", "CAVE", "CEIL", "CELL", "CENT", "CERN", "CHAD", "CHAR", "CHAT",
102 "CHAW", "CHEF", "CHEN", "CHEW", "CHIC", "CHIN", "CHOU", "CHOW", "CHUB",
103 "CHUG", "CHUM", "CITE", "CITY", "CLAD", "CLAM", "CLAN", "CLAW", "CLAY",
104 "CLOD", "CLOG", "CLOT", "CLUB", "CLUE", "COAL", "COAT", "COCA", "COCK",
105 "COCO", "CODA", "CODE", "CODY", "COED", "COIL", "COIN", "COKE", "COLA",
106 "COLD", "COLT", "COMA", "COMB", "COME", "COOK", "COOL", "COON", "COOT",
107 "CORD", "CORE", "CORK", "CORN", "COST", "COVE", "COWL", "CRAB", "CRAG",
108 "CRAM", "CRAY", "CREW", "CRIB", "CROW", "CRUD", "CUBA", "CUBE", "CUFF",
109 "CULL", "CULT", "CUNY", "CURB", "CURD", "CURE", "CURL", "CURT", "CUTS",
110 "DADE", "DALE", "DAME", "DANA", "DANE", "DANG", "DANK", "DARE", "DARK",
111 "DARN", "DART", "DASH", "DATA", "DATE", "DAVE", "DAVY", "DAWN", "DAYS",
112 "DEAD", "DEAF", "DEAL", "DEAN", "DEAR", "DEBT", "DECK", "DEED", "DEEM",
113 "DEER", "DEFT", "DEFY", "DELL", "DENT", "DENY", "DESK", "DIAL", "DICE",
114 "DIED", "DIET", "DIME", "DINE", "DING", "DINT", "DIRE", "DIRT", "DISC",
115 "DISH", "DISK", "DIVE", "DOCK", "DOES", "DOLE", "DOLL", "DOLT", "DOME",
116 "DONE", "DOOM", "DOOR", "DORA", "DOSE", "DOTE", "DOUG", "DOUR", "DOVE",
117 "DOWN", "DRAB", "DRAG", "DRAM", "DRAW", "DREW", "DRUB", "DRUG", "DRUM",
118 "DUAL", "DUCK", "DUCT", "DUEL", "DUET", "DUKE", "DULL", "DUMB", "DUNE",
119 "DUNK", "DUSK", "DUST", "DUTY", "EACH", "EARL", "EARN", "EASE", "EAST",
120 "EASY", "EBEN", "ECHO", "EDDY", "EDEN", "EDGE", "EDGY", "EDIT", "EDNA",
121 "EGAN", "ELAN", "ELBA", "ELLA", "ELSE", "EMIL", "EMIT", "EMMA", "ENDS",
122 "ERIC", "EROS", "EVEN", "EVER", "EVIL", "EYED", "FACE", "FACT", "FADE",
123 "FAIL", "FAIN", "FAIR", "FAKE", "FALL", "FAME", "FANG", "FARM", "FAST",
124 "FATE", "FAWN", "FEAR", "FEAT", "FEED", "FEEL", "FEET", "FELL", "FELT",
125 "FEND", "FERN", "FEST", "FEUD", "FIEF", "FIGS", "FILE", "FILL", "FILM",
126 "FIND", "FINE", "FINK", "FIRE", "FIRM", "FISH", "FISK", "FIST", "FITS",
127 "FIVE", "FLAG", "FLAK", "FLAM", "FLAT", "FLAW", "FLEA", "FLED", "FLEW",
128 "FLIT", "FLOC", "FLOG", "FLOW", "FLUB", "FLUE", "FOAL", "FOAM", "FOGY",
129 "FOIL", "FOLD", "FOLK", "FOND", "FONT", "FOOD", "FOOL", "FOOT", "FORD",
130 "FORE", "FORK", "FORM", "FORT", "FOSS", "FOUL", "FOUR", "FOWL", "FRAU",
131 "FRAY", "FRED", "FREE", "FRET", "FREY", "FROG", "FROM", "FUEL", "FULL",
132 "FUME", "FUND", "FUNK", "FURY", "FUSE", "FUSS", "GAFF", "GAGE", "GAIL",
133 "GAIN", "GAIT", "GALA", "GALE", "GALL", "GALT", "GAME", "GANG", "GARB",
134 "GARY", "GASH", "GATE", "GAUL", "GAUR", "GAVE", "GAWK", "GEAR", "GELD",
135 "GENE", "GENT", "GERM", "GETS", "GIBE", "GIFT", "GILD", "GILL", "GILT",
136 "GINA", "GIRD", "GIRL", "GIST", "GIVE", "GLAD", "GLEE", "GLEN", "GLIB",
137 "GLOB", "GLOM", "GLOW", "GLUE", "GLUM", "GLUT", "GOAD", "GOAL", "GOAT",
138 "GOER", "GOES", "GOLD", "GOLF", "GONE", "GONG", "GOOD", "GOOF", "GORE",
139 "GORY", "GOSH", "GOUT", "GOWN", "GRAB", "GRAD", "GRAY", "GREG", "GREW",
140 "GREY", "GRID", "GRIM", "GRIN", "GRIT", "GROW", "GRUB", "GULF", "GULL",
141 "GUNK", "GURU", "GUSH", "GUST", "GWEN", "GWYN", "HAAG", "HAAS", "HACK",
142 "HAIL", "HAIR", "HALE", "HALF", "HALL", "HALO", "HALT", "HAND", "HANG",
143 "HANK", "HANS", "HARD", "HARK", "HARM", "HART", "HASH", "HAST", "HATE",
144 "HATH", "HAUL", "HAVE", "HAWK", "HAYS", "HEAD", "HEAL", "HEAR", "HEAT",
145 "HEBE", "HECK", "HEED", "HEEL", "HEFT", "HELD", "HELL", "HELM", "HERB",
146 "HERD", "HERE", "HERO", "HERS", "HESS", "HEWN", "HICK", "HIDE", "HIGH",
147 "HIKE", "HILL", "HILT", "HIND", "HINT", "HIRE", "HISS", "HIVE", "HOBO",
148 "HOCK", "HOFF", "HOLD", "HOLE", "HOLM", "HOLT", "HOME", "HONE", "HONK",
149 "HOOD", "HOOF", "HOOK", "HOOT", "HORN", "HOSE", "HOST", "HOUR", "HOVE",
150 "HOWE", "HOWL", "HOYT", "HUCK", "HUED", "HUFF", "HUGE", "HUGH", "HUGO",
151 "HULK", "HULL", "HUNK", "HUNT", "HURD", "HURL", "HURT", "HUSH", "HYDE",
152 "HYMN", "IBIS", "ICON", "IDEA", "IDLE", "IFFY", "INCA", "INCH", "INTO",
153 "IONS", "IOTA", "IOWA", "IRIS", "IRMA", "IRON", "ISLE", "ITCH", "ITEM",
154 "IVAN", "JACK", "JADE", "JAIL", "JAKE", "JANE", "JAVA", "JEAN", "JEFF",
155 "JERK", "JESS", "JEST", "JIBE", "JILL", "JILT", "JIVE", "JOAN", "JOBS",
156 "JOCK", "JOEL", "JOEY", "JOHN", "JOIN", "JOKE", "JOLT", "JOVE", "JUDD",
157 "JUDE", "JUDO", "JUDY", "JUJU", "JUKE", "JULY", "JUNE", "JUNK", "JUNO",
158 "JURY", "JUST", "JUTE", "KAHN", "KALE", "KANE", "KANT", "KARL", "KATE",
159 "KEEL", "KEEN", "KENO", "KENT", "KERN", "KERR", "KEYS", "KICK", "KILL",
160 "KIND", "KING", "KIRK", "KISS", "KITE", "KLAN", "KNEE", "KNEW", "KNIT",
161 "KNOB", "KNOT", "KNOW", "KOCH", "KONG", "KUDO", "KURD", "KURT", "KYLE",
162 "LACE", "LACK", "LACY", "LADY", "LAID", "LAIN", "LAIR", "LAKE", "LAMB",
163 "LAME", "LAND", "LANE", "LANG", "LARD", "LARK", "LASS", "LAST", "LATE",
164 "LAUD", "LAVA", "LAWN", "LAWS", "LAYS", "LEAD", "LEAF", "LEAK", "LEAN",
165 "LEAR", "LEEK", "LEER", "LEFT", "LEND", "LENS", "LENT", "LEON", "LESK",
166 "LESS", "LEST", "LETS", "LIAR", "LICE", "LICK", "LIED", "LIEN", "LIES",
167 "LIEU", "LIFE", "LIFT", "LIKE", "LILA", "LILT", "LILY", "LIMA", "LIMB",
168 "LIME", "LIND", "LINE", "LINK", "LINT", "LION", "LISA", "LIST", "LIVE",
169 "LOAD", "LOAF", "LOAM", "LOAN", "LOCK", "LOFT", "LOGE", "LOIS", "LOLA",
170 "LONE", "LONG", "LOOK", "LOON", "LOOT", "LORD", "LORE", "LOSE", "LOSS",
171 "LOST", "LOUD", "LOVE", "LOWE", "LUCK", "LUCY", "LUGE", "LUKE", "LULU",
172 "LUND", "LUNG", "LURA", "LURE", "LURK", "LUSH", "LUST", "LYLE", "LYNN",
173 "LYON", "LYRA", "MACE", "MADE", "MAGI", "MAID", "MAIL", "MAIN", "MAKE",
174 "MALE", "MALI", "MALL", "MALT", "MANA", "MANN", "MANY", "MARC", "MARE",
175 "MARK", "MARS", "MART", "MARY", "MASH", "MASK", "MASS", "MAST", "MATE",
176 "MATH", "MAUL", "MAYO", "MEAD", "MEAL", "MEAN", "MEAT", "MEEK", "MEET",
177 "MELD", "MELT", "MEMO", "MEND", "MENU", "MERT", "MESH", "MESS", "MICE",
178 "MIKE", "MILD", "MILE", "MILK", "MILL", "MILT", "MIMI", "MIND", "MINE",
179 "MINI", "MINK", "MINT", "MIRE", "MISS", "MIST", "MITE", "MITT", "MOAN",
180 "MOAT", "MOCK", "MODE", "MOLD", "MOLE", "MOLL", "MOLT", "MONA", "MONK",
181 "MONT", "MOOD", "MOON", "MOOR", "MOOT", "MORE", "MORN", "MORT", "MOSS",
182 "MOST", "MOTH", "MOVE", "MUCH", "MUCK", "MUDD", "MUFF", "MULE", "MULL",
183 "MURK", "MUSH", "MUST", "MUTE", "MUTT", "MYRA", "MYTH", "NAGY", "NAIL",
184 "NAIR", "NAME", "NARY", "NASH", "NAVE", "NAVY", "NEAL", "NEAR", "NEAT",
185 "NECK", "NEED", "NEIL", "NELL", "NEON", "NERO", "NESS", "NEST", "NEWS",
186 "NEWT", "NIBS", "NICE", "NICK", "NILE", "NINA", "NINE", "NOAH", "NODE",
187 "NOEL", "NOLL", "NONE", "NOOK", "NOON", "NORM", "NOSE", "NOTE", "NOUN",
188 "NOVA", "NUDE", "NULL", "NUMB", "OATH", "OBEY", "OBOE", "ODIN", "OHIO",
189 "OILY", "OINT", "OKAY", "OLAF", "OLDY", "OLGA", "OLIN", "OMAN", "OMEN",
190 "OMIT", "ONCE", "ONES", "ONLY", "ONTO", "ONUS", "ORAL", "ORGY", "OSLO",
191 "OTIS", "OTTO", "OUCH", "OUST", "OUTS", "OVAL", "OVEN", "OVER", "OWLY",
192 "OWNS", "QUAD", "QUIT", "QUOD", "RACE", "RACK", "RACY", "RAFT", "RAGE",
193 "RAID", "RAIL", "RAIN", "RAKE", "RANK", "RANT", "RARE", "RASH", "RATE",
194 "RAVE", "RAYS", "READ", "REAL", "REAM", "REAR", "RECK", "REED", "REEF",
195 "REEK", "REEL", "REID", "REIN", "RENA", "REND", "RENT", "REST", "RICE",
196 "RICH", "RICK", "RIDE", "RIFT", "RILL", "RIME", "RING", "RINK", "RISE",
197 "RISK", "RITE", "ROAD", "ROAM", "ROAR", "ROBE", "ROCK", "RODE", "ROIL",
198 "ROLL", "ROME", "ROOD", "ROOF", "ROOK", "ROOM", "ROOT", "ROSA", "ROSE",
199 "ROSS", "ROSY", "ROTH", "ROUT", "ROVE", "ROWE", "ROWS", "RUBE", "RUBY",
200 "RUDE", "RUDY", "RUIN", "RULE", "RUNG", "RUNS", "RUNT", "RUSE", "RUSH",
201 "RUSK", "RUSS", "RUST", "RUTH", "SACK", "SAFE", "SAGE", "SAID", "SAIL",
202 "SALE", "SALK", "SALT", "SAME", "SAND", "SANE", "SANG", "SANK", "SARA",
203 "SAUL", "SAVE", "SAYS", "SCAN", "SCAR", "SCAT", "SCOT", "SEAL", "SEAM",
204 "SEAR", "SEAT", "SEED", "SEEK", "SEEM", "SEEN", "SEES", "SELF", "SELL",
205 "SEND", "SENT", "SETS", "SEWN", "SHAG", "SHAM", "SHAW", "SHAY", "SHED",
206 "SHIM", "SHIN", "SHOD", "SHOE", "SHOT", "SHOW", "SHUN", "SHUT", "SICK",
207 "SIDE", "SIFT", "SIGH", "SIGN", "SILK", "SILL", "SILO", "SILT", "SINE",
208 "SING", "SINK", "SIRE", "SITE", "SITS", "SITU", "SKAT", "SKEW", "SKID",
209 "SKIM", "SKIN", "SKIT", "SLAB", "SLAM", "SLAT", "SLAY", "SLED", "SLEW",
210 "SLID", "SLIM", "SLIT", "SLOB", "SLOG", "SLOT", "SLOW", "SLUG", "SLUM",
211 "SLUR", "SMOG", "SMUG", "SNAG", "SNOB", "SNOW", "SNUB", "SNUG", "SOAK",
212 "SOAR", "SOCK", "SODA", "SOFA", "SOFT", "SOIL", "SOLD", "SOME", "SONG",
213 "SOON", "SOOT", "SORE", "SORT", "SOUL", "SOUR", "SOWN", "STAB", "STAG",
214 "STAN", "STAR", "STAY", "STEM", "STEW", "STIR", "STOW", "STUB", "STUN",
215 "SUCH", "SUDS", "SUIT", "SULK", "SUMS", "SUNG", "SUNK", "SURE", "SURF",
216 "SWAB", "SWAG", "SWAM", "SWAN", "SWAT", "SWAY", "SWIM", "SWUM", "TACK",
217 "TACT", "TAIL", "TAKE", "TALE", "TALK", "TALL", "TANK", "TASK", "TATE",
218 "TAUT", "TEAL", "TEAM", "TEAR", "TECH", "TEEM", "TEEN", "TEET", "TELL",
219 "TEND", "TENT", "TERM", "TERN", "TESS", "TEST", "THAN", "THAT", "THEE",
220 "THEM", "THEN", "THEY", "THIN", "THIS", "THUD", "THUG", "TICK", "TIDE",
221 "TIDY", "TIED", "TIER", "TILE", "TILL", "TILT", "TIME", "TINA", "TINE",
222 "TINT", "TINY", "TIRE", "TOAD", "TOGO", "TOIL", "TOLD", "TOLL", "TONE",
223 "TONG", "TONY", "TOOK", "TOOL", "TOOT", "TORE", "TORN", "TOTE", "TOUR",
224 "TOUT", "TOWN", "TRAG", "TRAM", "TRAY", "TREE", "TREK", "TRIG", "TRIM",
225 "TRIO", "TROD", "TROT", "TROY", "TRUE", "TUBA", "TUBE", "TUCK", "TUFT",
226 "TUNA", "TUNE", "TUNG", "TURF", "TURN", "TUSK", "TWIG", "TWIN", "TWIT",
227 "ULAN", "UNIT", "URGE", "USED", "USER", "USES", "UTAH", "VAIL", "VAIN",
228 "VALE", "VARY", "VASE", "VAST", "VEAL", "VEDA", "VEIL", "VEIN", "VEND",
229 "VENT", "VERB", "VERY", "VETO", "VICE", "VIEW", "VINE", "VISE", "VOID",
230 "VOLT", "VOTE", "WACK", "WADE", "WAGE", "WAIL", "WAIT", "WAKE", "WALE",
231 "WALK", "WALL", "WALT", "WAND", "WANE", "WANG", "WANT", "WARD", "WARM",
232 "WARN", "WART", "WASH", "WAST", "WATS", "WATT", "WAVE", "WAVY", "WAYS",
233 "WEAK", "WEAL", "WEAN", "WEAR", "WEED", "WEEK", "WEIR", "WELD", "WELL",
234 "WELT", "WENT", "WERE", "WERT", "WEST", "WHAM", "WHAT", "WHEE", "WHEN",
235 "WHET", "WHOA", "WHOM", "WICK", "WIFE", "WILD", "WILL", "WIND", "WINE",
236 "WING", "WINK", "WINO", "WIRE", "WISE", "WISH", "WITH", "WOLF", "WONT",
237 "WOOD", "WOOL", "WORD", "WORE", "WORK", "WORM", "WORN", "WOVE", "WRIT",
238 "WYNN", "YALE", "YANG", "YANK", "YARD", "YARN", "YAWL", "YAWN", "YEAH",
239 "YEAR", "YELL", "YOGA", "YOKE"
240 };
241
242/*
243 * Encode 8 bytes in 'c' as a string of English words.
244 * Returns a pointer to a static buffer
245 */
246
247char *btoe(unsigned char *md)
248{
249 char cp[9]; /* 64 + 2 = 66 bits */
250 int p, i;
251 static int buf[BUFSIZ8192];
252 char *engout = (char *)buf;
253
254 memcpy(cp, md, SKEY_SIZE8);
255 /* compute parity */
256 for(p = 0, i = 0; i < 64; i += 2)
257 p += extract(cp, i, 2);
258 cp[8] = (char)p << 6;
259 /* now 66 bits */
260
261 engout[0] = '\0';
262 strncat(engout, &Wp[extract(cp, 0, 11)][0], 4);
263 strcat (engout," ");
Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
264 strncat(engout, &Wp[extract(cp, 11, 11)][0], 4);
265 strcat (engout," ");
266 strncat(engout, &Wp[extract(cp, 22, 11)][0], 4);
267 strcat (engout," ");
268 strncat(engout, &Wp[extract(cp, 33, 11)][0], 4);
269 strcat (engout," ");
270 strncat(engout, &Wp[extract(cp, 44, 11)][0], 4);
271 strcat (engout," ");
272 strncat(engout, &Wp[extract(cp, 55, 11)][0], 4);
273 return (engout);
274
275}
276
277/*
278 * Extract 'length' bits from the char array 's'
279 * starting with bit 'start'
280 */
281
282static guint32 extract(char *s, int start, int length)
283{
284 guint8 cl;
285 guint8 cc;
286 guint8 cr;
287 guint32 x;
288
289 /* 66 = 11 x 6 */
290
291 g_assert(length >= 0)do { if (length >= 0) ; else g_assertion_message_expr (((gchar
*) 0), "btoe.c", 291, ((const char*) (__func__)), "length >= 0"
); } while (0)
;
292 g_assert(length <= 11)do { if (length <= 11) ; else g_assertion_message_expr (((
gchar*) 0), "btoe.c", 292, ((const char*) (__func__)), "length <= 11"
); } while (0)
;
293 g_assert(start >= 0)do { if (start >= 0) ; else g_assertion_message_expr (((gchar
*) 0), "btoe.c", 293, ((const char*) (__func__)), "start >= 0"
); } while (0)
;
294 g_assert(start + length <= 66)do { if (start + length <= 66) ; else g_assertion_message_expr
(((gchar*) 0), "btoe.c", 294, ((const char*) (__func__)), "start + length <= 66"
); } while (0)
;
295
296 cl = s[start/8];
297 cc = s[start/8 + 1];
298 cr = s[start/8 + 2];
299 x = (guint32) ((((cl << 8) | cc) << 8) | cr); /* 24 bits */
300 x = x >> (24 - (length + (start % 8))); /* cut tail */
301 x = (x & (0xffff >> (16 - length))); /* cut head */
302 return(x); /* length */
303}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-eb3cb1.html b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-eb3cb1.html new file mode 100644 index 0000000..43ebe65 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/report-eb3cb1.html @@ -0,0 +1,5495 @@ + + + +terminal-window.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:terminal-window.c
Warning:line 3718, column 9
Branch condition evaluates to a garbage value
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

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

Bug Summary

+ + + + +
File:skey/sha1.c
Warning:line 53, column 2
Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name sha1.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src/skey -resource-dir /usr/bin/../lib/clang/17 -D HAVE_CONFIG_H -I . -I ../.. -I ./.. -D G_DISABLE_SINGLE_INCLUDES -I /usr/include/dconf -I /usr/include/vte-2.91 -I /usr/include/pango-1.0 -I /usr/include/gtk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/cairo -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/atk-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/cloudproviders -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/pixman-1 -I /usr/include/libmount -I /usr/include/libxml2 -I /usr/include/fribidi -I /usr/include/libpng16 -I /usr/include/sysprof-6 -D PIC -internal-isystem /usr/bin/../lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/src/skey -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-22-160956-4994-1 -x c sha1.c +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1#include <config.h>
2
3#include <string.h>
4#include <stdlib.h>
5#include <arpa/inet.h>
6
7#include <glib.h>
8
9#include "skey.h"
10#include "skeyutil.h"
11#include "sha1.h"
12
13#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]); }
{ \
14 x[0] = htonl(x[0]); \
15 x[1] = htonl(x[1]); \
16 x[2] = htonl(x[2]); \
17 x[3] = htonl(x[3]); \
18 x[4] = htonl(x[4]); }
19
20#ifdef WORDS_BIGENDIAN
21/*
22 * Note: this code is harmless on little-endian machines.
23 */
24static void byteReverse(unsigned char *buf, unsigned longs)
25{
26 guint32 t;
27 do
28 {
29 t = (guint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
30 ((unsigned) buf[1] << 8 | buf[0]);
31 *(guint32 *) buf = t;
32 buf += 4;
33 }
34 while (--longs);
35}
36#endif
37
38int SHA1Keycrunch(char *result, const char *seed, const char *passphrase)
39{
40 char *buf;
41 gsize len;
42 GChecksum *checksum;
43 guint8 digest[20];
44 gsize digest_len = sizeof (digest);
45 guint32 *results;
46
47 len = strlen(seed) + strlen(passphrase);
48 if ((buf = (char *)g_try_malloc(len+1)) == NULL((void*)0))
49 return -1;
50
51 strcpy(buf, seed);
52 skey_lowcase(buf);
53 strcat(buf, passphrase);
Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
54 skey_sevenbit(buf);
55
56 checksum = g_checksum_new (G_CHECKSUM_SHA1);
57 g_checksum_update (checksum, (const guchar *) buf, len);
58 g_free(buf);
59
60 g_checksum_get_digest (checksum, digest, &digest_len);
61 g_assert (digest_len == 20)do { if (digest_len == 20) ; else g_assertion_message_expr ((
(gchar*) 0), "sha1.c", 61, ((const char*) (__func__)), "digest_len == 20"
); } while (0)
;
62
63 results = (guint32 *) digest;
64
65#ifndef WORDS_BIGENDIAN
66 HTONDIGEST(results){ results[0] = htonl(results[0]); results[1] = htonl(results[
1]); results[2] = htonl(results[2]); results[3] = htonl(results
[3]); results[4] = htonl(results[4]); }
;
67#else
68 byteReverse((unsigned char *)digest, 5);
69#endif
70
71 results = (guint32 *) digest;
72 results[0] ^= results[2];
73 results[1] ^= results[3];
74 results[0] ^= results[4];
75
76 memcpy((void *)result, (void *)results, SKEY_SIZE8);
77
78 g_checksum_free (checksum);
79
80 return 0;
81}
82
83void SHA1SKey(char *x)
84{
85 GChecksum *checksum;
86 guint8 digest[20];
87 gsize digest_len = sizeof (digest);
88 guint32 *results;
89
90 checksum = g_checksum_new (G_CHECKSUM_SHA1);
91 g_checksum_update (checksum, (const guchar *) x, SKEY_SIZE8);
92 g_checksum_get_digest (checksum, digest, &digest_len);
93 g_assert (digest_len == 20)do { if (digest_len == 20) ; else g_assertion_message_expr ((
(gchar*) 0), "sha1.c", 93, ((const char*) (__func__)), "digest_len == 20"
); } while (0)
;
94
95 results = (guint32 *) digest;
96#ifndef WORDS_BIGENDIAN
97 HTONDIGEST(results){ results[0] = htonl(results[0]); results[1] = htonl(results[
1]); results[2] = htonl(results[2]); results[3] = htonl(results
[3]); results[4] = htonl(results[4]); }
;
98#else
99 byteReverse((unsigned char *)digest, 5);
100#endif
101
102 results[0] ^= results[2];
103 results[1] ^= results[3];
104 results[0] ^= results[4];
105
106 memcpy((void *)x, (void *)results, SKEY_SIZE8);
107
108 g_checksum_free (checksum);
109}
diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/scanview.css b/2024-02-22-160956-4994-1@6043b1f90c7e_master/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/scanview.css @@ -0,0 +1,62 @@ +body { color:#000000; background-color:#ffffff } +body { font-family: Helvetica, sans-serif; font-size:9pt } +h1 { font-size: 14pt; } +h2 { font-size: 12pt; } +table { font-size:9pt } +table { border-spacing: 0px; border: 1px solid black } +th, table thead { + background-color:#eee; color:#666666; + font-weight: bold; cursor: default; + text-align:center; + font-weight: bold; font-family: Verdana; + white-space:nowrap; +} +.W { font-size:0px } +th, td { padding:5px; padding-left:8px; text-align:left } +td.SUMM_DESC { padding-left:12px } +td.DESC { white-space:pre } +td.Q { text-align:right } +td { text-align:left } +tbody.scrollContent { overflow:auto } + +table.form_group { + background-color: #ccc; + border: 1px solid #333; + padding: 2px; +} + +table.form_inner_group { + background-color: #ccc; + border: 1px solid #333; + padding: 0px; +} + +table.form { + background-color: #999; + border: 1px solid #333; + padding: 2px; +} + +td.form_label { + text-align: right; + vertical-align: top; +} +/* For one line entires */ +td.form_clabel { + text-align: right; + vertical-align: center; +} +td.form_value { + text-align: left; + vertical-align: top; +} +td.form_submit { + text-align: right; + vertical-align: top; +} + +h1.SubmitFail { + color: #f00; +} +h1.SubmitOk { +} diff --git a/2024-02-22-160956-4994-1@6043b1f90c7e_master/sorttable.js b/2024-02-22-160956-4994-1@6043b1f90c7e_master/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2024-02-22-160956-4994-1@6043b1f90c7e_master/sorttable.js @@ -0,0 +1,492 @@ +/* + SortTable + version 2 + 7th April 2007 + Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ + + Instructions: + Download this file + Add to your HTML + Add class="sortable" to any table you'd like to make sortable + Click on the headers to sort + + Thanks to many, many people for contributions and suggestions. + Licenced as X11: http://www.kryogenix.org/code/browser/licence.html + This basically means: do what you want with it. +*/ + + +var stIsIE = /*@cc_on!@*/false; + +sorttable = { + init: function() { + // quit if this function has already been called + if (arguments.callee.done) return; + // flag this function so we don't do the same thing twice + arguments.callee.done = true; + // kill the timer + if (_timer) clearInterval(_timer); + + if (!document.createElement || !document.getElementsByTagName) return; + + sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; + + forEach(document.getElementsByTagName('table'), function(table) { + if (table.className.search(/\bsortable\b/) != -1) { + sorttable.makeSortable(table); + } + }); + + }, + + makeSortable: function(table) { + if (table.getElementsByTagName('thead').length == 0) { + // table doesn't have a tHead. Since it should have, create one and + // put the first table row in it. + the = document.createElement('thead'); + the.appendChild(table.rows[0]); + table.insertBefore(the,table.firstChild); + } + // Safari doesn't support table.tHead, sigh + if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; + + if (table.tHead.rows.length != 1) return; // can't cope with two header rows + + // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as + // "total" rows, for example). This is B&R, since what you're supposed + // to do is put them in a tfoot. So, if there are sortbottom rows, + // for backward compatibility, move them to tfoot (creating it if needed). + sortbottomrows = []; + for (var i=0; i5' : ' ▴'; + this.appendChild(sortrevind); + return; + } + if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { + // if we're already sorted by this column in reverse, just + // re-reverse the table, which is quicker + sorttable.reverse(this.sorttable_tbody); + this.className = this.className.replace('sorttable_sorted_reverse', + 'sorttable_sorted'); + this.removeChild(document.getElementById('sorttable_sortrevind')); + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + return; + } + + // remove sorttable_sorted classes + theadrow = this.parentNode; + forEach(theadrow.childNodes, function(cell) { + if (cell.nodeType == 1) { // an element + cell.className = cell.className.replace('sorttable_sorted_reverse',''); + cell.className = cell.className.replace('sorttable_sorted',''); + } + }); + sortfwdind = document.getElementById('sorttable_sortfwdind'); + if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } + sortrevind = document.getElementById('sorttable_sortrevind'); + if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } + + this.className += ' sorttable_sorted'; + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + + // build an array to sort. This is a Schwartzian transform thing, + // i.e., we "decorate" each row with the actual sort key, + // sort based on the sort keys, and then put the rows back in order + // which is a lot faster because you only do getInnerText once per row + row_array = []; + col = this.sorttable_columnindex; + rows = this.sorttable_tbody.rows; + for (var j=0; j 12) { + // definitely dd/mm + return sorttable.sort_ddmm; + } else if (second > 12) { + return sorttable.sort_mmdd; + } else { + // looks like a date, but we can't tell which, so assume + // that it's dd/mm (English imperialism!) and keep looking + sortfn = sorttable.sort_ddmm; + } + } + } + } + return sortfn; + }, + + getInnerText: function(node) { + // gets the text we want to use for sorting for a cell. + // strips leading and trailing whitespace. + // this is *not* a generic getInnerText function; it's special to sorttable. + // for example, you can override the cell text with a customkey attribute. + // it also gets .value for fields. + + hasInputs = (typeof node.getElementsByTagName == 'function') && + node.getElementsByTagName('input').length; + + if (node.getAttribute("sorttable_customkey") != null) { + return node.getAttribute("sorttable_customkey"); + } + else if (typeof node.textContent != 'undefined' && !hasInputs) { + return node.textContent.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.innerText != 'undefined' && !hasInputs) { + return node.innerText.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.text != 'undefined' && !hasInputs) { + return node.text.replace(/^\s+|\s+$/g, ''); + } + else { + switch (node.nodeType) { + case 3: + if (node.nodeName.toLowerCase() == 'input') { + return node.value.replace(/^\s+|\s+$/g, ''); + } + case 4: + return node.nodeValue.replace(/^\s+|\s+$/g, ''); + break; + case 1: + case 11: + var innerText = ''; + for (var i = 0; i < node.childNodes.length; i++) { + innerText += sorttable.getInnerText(node.childNodes[i]); + } + return innerText.replace(/^\s+|\s+$/g, ''); + break; + default: + return ''; + } + } + }, + + reverse: function(tbody) { + // reverse the rows in a tbody + newrows = []; + for (var i=0; i=0; i--) { + tbody.appendChild(newrows[i]); + } + delete newrows; + }, + + /* sort functions + each sort function takes two parameters, a and b + you are comparing a[0] and b[0] */ + sort_numeric: function(a,b) { + aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); + if (isNaN(aa)) aa = 0; + bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); + if (isNaN(bb)) bb = 0; + return aa-bb; + }, + sort_alpha: function(a,b) { + if (a[0]==b[0]) return 0; + if (a[0] 0 ) { + var q = list[i]; list[i] = list[i+1]; list[i+1] = q; + swap = true; + } + } // for + t--; + + if (!swap) break; + + for(var i = t; i > b; --i) { + if ( comp_func(list[i], list[i-1]) < 0 ) { + var q = list[i]; list[i] = list[i-1]; list[i-1] = q; + swap = true; + } + } // for + b++; + + } // while(swap) + } +} + +/* ****************************************************************** + Supporting functions: bundled here to avoid depending on a library + ****************************************************************** */ + +// Dean Edwards/Matthias Miller/John Resig + +/* for Mozilla/Opera9 */ +if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", sorttable.init, false); +} + +/* for Internet Explorer */ +/*@cc_on @*/ +/*@if (@_win32) + document.write("