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