1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 2000 Red Hat, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #define PANGO_ENABLE_BACKEND /* for pango_fc_font_map_cache_clear() */
25 #include "gtkmodules.h"
26 #include "gtksettings.h"
29 #include "gtkwidget.h"
30 #include "gtkprivate.h"
33 #ifdef GDK_WINDOWING_X11
35 #include <pango/pangofc-fontmap.h>
38 #ifdef GDK_WINDOWING_QUARTZ
39 #define DEFAULT_KEY_THEME "Mac"
41 #define DEFAULT_KEY_THEME NULL
44 #define DEFAULT_TIMEOUT_INITIAL 200
45 #define DEFAULT_TIMEOUT_REPEAT 20
46 #define DEFAULT_TIMEOUT_EXPAND 500
48 typedef struct _GtkSettingsValuePrivate GtkSettingsValuePrivate;
52 GTK_SETTINGS_SOURCE_DEFAULT,
53 GTK_SETTINGS_SOURCE_RC_FILE,
54 GTK_SETTINGS_SOURCE_XSETTING,
55 GTK_SETTINGS_SOURCE_APPLICATION
58 struct _GtkSettingsValuePrivate
60 GtkSettingsValue public;
61 GtkSettingsSource source;
64 struct _GtkSettingsPropertyValue
67 GtkSettingsSource source;
72 PROP_DOUBLE_CLICK_TIME,
73 PROP_DOUBLE_CLICK_DISTANCE,
75 PROP_CURSOR_BLINK_TIME,
76 PROP_CURSOR_BLINK_TIMEOUT,
80 PROP_FALLBACK_ICON_THEME,
83 PROP_DND_DRAG_THRESHOLD,
87 #ifdef GDK_WINDOWING_X11
93 PROP_CURSOR_THEME_NAME,
94 PROP_CURSOR_THEME_SIZE,
96 PROP_ALTERNATIVE_BUTTON_ORDER,
97 PROP_ALTERNATIVE_SORT_ARROWS,
98 PROP_SHOW_INPUT_METHOD_MENU,
99 PROP_SHOW_UNICODE_MENU,
100 PROP_TIMEOUT_INITIAL,
104 PROP_ENABLE_ANIMATIONS,
105 PROP_TOUCHSCREEN_MODE,
106 PROP_TOOLTIP_TIMEOUT,
107 PROP_TOOLTIP_BROWSE_TIMEOUT,
108 PROP_TOOLTIP_BROWSE_MODE_TIMEOUT,
109 PROP_KEYNAV_CURSOR_ONLY,
110 PROP_KEYNAV_WRAP_AROUND,
113 PROP_FILE_CHOOSER_BACKEND,
115 PROP_PRINT_PREVIEW_COMMAND,
116 PROP_ENABLE_MNEMONICS,
118 PROP_RECENT_FILES_LIMIT,
120 PROP_RECENT_FILES_MAX_AGE,
121 PROP_FONTCONFIG_TIMESTAMP,
122 PROP_SOUND_THEME_NAME,
123 PROP_ENABLE_INPUT_FEEDBACK_SOUNDS,
124 PROP_ENABLE_EVENT_SOUNDS,
125 PROP_ENABLE_TOOLTIPS,
127 PROP_TOOLBAR_ICON_SIZE,
132 /* --- prototypes --- */
133 static void gtk_settings_finalize (GObject *object);
134 static void gtk_settings_get_property (GObject *object,
138 static void gtk_settings_set_property (GObject *object,
142 static void gtk_settings_notify (GObject *object,
144 static guint settings_install_property_parser (GtkSettingsClass *class,
146 GtkRcPropertyParser parser);
147 static void settings_update_double_click (GtkSettings *settings);
148 static void settings_update_modules (GtkSettings *settings);
150 #ifdef GDK_WINDOWING_X11
151 static void settings_update_cursor_theme (GtkSettings *settings);
152 static void settings_update_resolution (GtkSettings *settings);
153 static void settings_update_font_options (GtkSettings *settings);
154 static gboolean settings_update_fontconfig (GtkSettings *settings);
156 static void settings_update_color_scheme (GtkSettings *settings);
158 static void merge_color_scheme (GtkSettings *settings,
160 GtkSettingsSource source);
161 static gchar *get_color_scheme (GtkSettings *settings);
162 static GHashTable *get_color_hash (GtkSettings *settings);
165 /* --- variables --- */
166 static GQuark quark_property_parser = 0;
167 static GSList *object_list = NULL;
168 static guint class_n_properties = 0;
171 G_DEFINE_TYPE (GtkSettings, gtk_settings, G_TYPE_OBJECT)
173 /* --- functions --- */
175 gtk_settings_init (GtkSettings *settings)
177 GParamSpec **pspecs, **p;
180 g_datalist_init (&settings->queued_settings);
181 object_list = g_slist_prepend (object_list, settings);
183 /* build up property array for all yet existing properties and queue
184 * notification for them (at least notification for internal properties
185 * will instantly be caught)
187 pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (settings), NULL);
188 for (p = pspecs; *p; p++)
189 if ((*p)->owner_type == G_OBJECT_TYPE (settings))
191 settings->property_values = g_new0 (GtkSettingsPropertyValue, i);
193 g_object_freeze_notify (G_OBJECT (settings));
194 for (p = pspecs; *p; p++)
196 GParamSpec *pspec = *p;
198 if (pspec->owner_type != G_OBJECT_TYPE (settings))
200 g_value_init (&settings->property_values[i].value, G_PARAM_SPEC_VALUE_TYPE (pspec));
201 g_param_value_set_default (pspec, &settings->property_values[i].value);
202 g_object_notify (G_OBJECT (settings), pspec->name);
203 settings->property_values[i].source = GTK_SETTINGS_SOURCE_DEFAULT;
206 g_object_thaw_notify (G_OBJECT (settings));
211 gtk_settings_class_init (GtkSettingsClass *class)
213 GObjectClass *gobject_class = G_OBJECT_CLASS (class);
216 gobject_class->finalize = gtk_settings_finalize;
217 gobject_class->get_property = gtk_settings_get_property;
218 gobject_class->set_property = gtk_settings_set_property;
219 gobject_class->notify = gtk_settings_notify;
221 quark_property_parser = g_quark_from_static_string ("gtk-rc-property-parser");
222 result = settings_install_property_parser (class,
223 g_param_spec_int ("gtk-double-click-time",
224 P_("Double Click Time"),
225 P_("Maximum time allowed between two clicks for them to be considered a double click (in milliseconds)"),
227 GTK_PARAM_READWRITE),
229 g_assert (result == PROP_DOUBLE_CLICK_TIME);
230 result = settings_install_property_parser (class,
231 g_param_spec_int ("gtk-double-click-distance",
232 P_("Double Click Distance"),
233 P_("Maximum distance allowed between two clicks for them to be considered a double click (in pixels)"),
235 GTK_PARAM_READWRITE),
237 g_assert (result == PROP_DOUBLE_CLICK_DISTANCE);
240 * GtkSettings:gtk-cursor-blink:
242 * Whether the cursor should blink.
244 * Also see the #GtkSettings:gtk-cursor-blink-timeout setting,
245 * which allows more flexible control over cursor blinking.
247 result = settings_install_property_parser (class,
248 g_param_spec_boolean ("gtk-cursor-blink",
250 P_("Whether the cursor should blink"),
252 GTK_PARAM_READWRITE),
254 g_assert (result == PROP_CURSOR_BLINK);
255 result = settings_install_property_parser (class,
256 g_param_spec_int ("gtk-cursor-blink-time",
257 P_("Cursor Blink Time"),
258 P_("Length of the cursor blink cycle, in milliseconds"),
260 GTK_PARAM_READWRITE),
262 g_assert (result == PROP_CURSOR_BLINK_TIME);
265 * GtkSettings:gtk-cursor-blink-timeout:
267 * Time after which the cursor stops blinking, in seconds.
268 * The timer is reset after each user interaction.
270 * Setting this to zero has the same effect as setting
271 * #GtkSettings:gtk-cursor-blink to %FALSE.
275 result = settings_install_property_parser (class,
276 g_param_spec_int ("gtk-cursor-blink-timeout",
277 P_("Cursor Blink Timeout"),
278 P_("Time after which the cursor stops blinking, in seconds"),
279 1, G_MAXINT, G_MAXINT,
280 GTK_PARAM_READWRITE),
282 g_assert (result == PROP_CURSOR_BLINK_TIMEOUT);
283 result = settings_install_property_parser (class,
284 g_param_spec_boolean ("gtk-split-cursor",
286 P_("Whether two cursors should be displayed for mixed left-to-right and right-to-left text"),
288 GTK_PARAM_READWRITE),
290 g_assert (result == PROP_SPLIT_CURSOR);
291 result = settings_install_property_parser (class,
292 g_param_spec_string ("gtk-theme-name",
294 P_("Name of theme RC file to load"),
296 GTK_PARAM_READWRITE),
298 g_assert (result == PROP_THEME_NAME);
300 result = settings_install_property_parser (class,
301 g_param_spec_string ("gtk-icon-theme-name",
302 P_("Icon Theme Name"),
303 P_("Name of icon theme to use"),
305 GTK_PARAM_READWRITE),
307 g_assert (result == PROP_ICON_THEME_NAME);
309 result = settings_install_property_parser (class,
310 g_param_spec_string ("gtk-fallback-icon-theme",
311 P_("Fallback Icon Theme Name"),
312 P_("Name of a icon theme to fall back to"),
314 GTK_PARAM_READWRITE),
316 g_assert (result == PROP_FALLBACK_ICON_THEME);
318 result = settings_install_property_parser (class,
319 g_param_spec_string ("gtk-key-theme-name",
320 P_("Key Theme Name"),
321 P_("Name of key theme RC file to load"),
323 GTK_PARAM_READWRITE),
325 g_assert (result == PROP_KEY_THEME_NAME);
327 result = settings_install_property_parser (class,
328 g_param_spec_string ("gtk-menu-bar-accel",
329 P_("Menu bar accelerator"),
330 P_("Keybinding to activate the menu bar"),
332 GTK_PARAM_READWRITE),
334 g_assert (result == PROP_MENU_BAR_ACCEL);
336 result = settings_install_property_parser (class,
337 g_param_spec_int ("gtk-dnd-drag-threshold",
338 P_("Drag threshold"),
339 P_("Number of pixels the cursor can move before dragging"),
341 GTK_PARAM_READWRITE),
343 g_assert (result == PROP_DND_DRAG_THRESHOLD);
345 result = settings_install_property_parser (class,
346 g_param_spec_string ("gtk-font-name",
348 P_("Name of default font to use"),
350 GTK_PARAM_READWRITE),
352 g_assert (result == PROP_FONT_NAME);
355 * GtkSettings:gtk-icon-sizes:
357 * A list of icon sizes. The list is separated by colons, and
360 * <replaceable>size-name</replaceable> = <replaceable>width</replaceable> , <replaceable>height</replaceable>
362 * E.g. "gtk-menu=16,16:gtk-button=20,20:gtk-dialog=48,48".
363 * GTK+ itself use the following named icon sizes: gtk-menu,
364 * gtk-button, gtk-small-toolbar, gtk-large-toolbar, gtk-dnd,
365 * gtk-dialog. Applications can register their own named icon
366 * sizes with gtk_icon_size_register().
368 result = settings_install_property_parser (class,
369 g_param_spec_string ("gtk-icon-sizes",
371 P_("List of icon sizes (gtk-menu=16,16:gtk-button=20,20..."),
373 GTK_PARAM_READWRITE),
375 g_assert (result == PROP_ICON_SIZES);
377 result = settings_install_property_parser (class,
378 g_param_spec_string ("gtk-modules",
380 P_("List of currently active GTK modules"),
382 GTK_PARAM_READWRITE),
384 g_assert (result == PROP_MODULES);
386 #ifdef GDK_WINDOWING_X11
387 result = settings_install_property_parser (class,
388 g_param_spec_int ("gtk-xft-antialias",
390 P_("Whether to antialias Xft fonts; 0=no, 1=yes, -1=default"),
392 GTK_PARAM_READWRITE),
395 g_assert (result == PROP_XFT_ANTIALIAS);
397 result = settings_install_property_parser (class,
398 g_param_spec_int ("gtk-xft-hinting",
400 P_("Whether to hint Xft fonts; 0=no, 1=yes, -1=default"),
402 GTK_PARAM_READWRITE),
405 g_assert (result == PROP_XFT_HINTING);
407 result = settings_install_property_parser (class,
408 g_param_spec_string ("gtk-xft-hintstyle",
409 P_("Xft Hint Style"),
410 P_("What degree of hinting to use; hintnone, hintslight, hintmedium, or hintfull"),
412 GTK_PARAM_READWRITE),
415 g_assert (result == PROP_XFT_HINTSTYLE);
417 result = settings_install_property_parser (class,
418 g_param_spec_string ("gtk-xft-rgba",
420 P_("Type of subpixel antialiasing; none, rgb, bgr, vrgb, vbgr"),
422 GTK_PARAM_READWRITE),
425 g_assert (result == PROP_XFT_RGBA);
427 result = settings_install_property_parser (class,
428 g_param_spec_int ("gtk-xft-dpi",
430 P_("Resolution for Xft, in 1024 * dots/inch. -1 to use default value"),
432 GTK_PARAM_READWRITE),
435 g_assert (result == PROP_XFT_DPI);
437 result = settings_install_property_parser (class,
438 g_param_spec_string ("gtk-cursor-theme-name",
439 P_("Cursor theme name"),
440 P_("Name of the cursor theme to use, or NULL to use the default theme"),
442 GTK_PARAM_READWRITE),
444 g_assert (result == PROP_CURSOR_THEME_NAME);
446 result = settings_install_property_parser (class,
447 g_param_spec_int ("gtk-cursor-theme-size",
448 P_("Cursor theme size"),
449 P_("Size to use for cursors, or 0 to use the default size"),
451 GTK_PARAM_READWRITE),
454 g_assert (result == PROP_CURSOR_THEME_SIZE);
456 #endif /* GDK_WINDOWING_X11 */
457 result = settings_install_property_parser (class,
458 g_param_spec_boolean ("gtk-alternative-button-order",
459 P_("Alternative button order"),
460 P_("Whether buttons in dialogs should use the alternative button order"),
462 GTK_PARAM_READWRITE),
464 g_assert (result == PROP_ALTERNATIVE_BUTTON_ORDER);
467 * GtkSettings:gtk-alternative-sort-arrows:
469 * Controls the direction of the sort indicators in sorted list and tree
470 * views. By default an arrow pointing down means the column is sorted
471 * in ascending order. When set to %TRUE, this order will be inverted.
475 result = settings_install_property_parser (class,
476 g_param_spec_boolean ("gtk-alternative-sort-arrows",
477 P_("Alternative sort indicator direction"),
478 P_("Whether the direction of the sort indicators in list and tree views is inverted compared to the default (where down means ascending)"),
480 GTK_PARAM_READWRITE),
482 g_assert (result == PROP_ALTERNATIVE_SORT_ARROWS);
484 result = settings_install_property_parser (class,
485 g_param_spec_boolean ("gtk-show-input-method-menu",
486 P_("Show the 'Input Methods' menu"),
487 P_("Whether the context menus of entries and text views should offer to change the input method"),
489 GTK_PARAM_READWRITE),
491 g_assert (result == PROP_SHOW_INPUT_METHOD_MENU);
493 result = settings_install_property_parser (class,
494 g_param_spec_boolean ("gtk-show-unicode-menu",
495 P_("Show the 'Insert Unicode Control Character' menu"),
496 P_("Whether the context menus of entries and text views should offer to insert control characters"),
498 GTK_PARAM_READWRITE),
500 g_assert (result == PROP_SHOW_UNICODE_MENU);
502 result = settings_install_property_parser (class,
503 g_param_spec_int ("gtk-timeout-initial",
505 P_("Starting value for timeouts, when button is pressed"),
506 0, G_MAXINT, DEFAULT_TIMEOUT_INITIAL,
507 GTK_PARAM_READWRITE),
510 g_assert (result == PROP_TIMEOUT_INITIAL);
512 result = settings_install_property_parser (class,
513 g_param_spec_int ("gtk-timeout-repeat",
514 P_("Repeat timeout"),
515 P_("Repeat value for timeouts, when button is pressed"),
516 0, G_MAXINT, DEFAULT_TIMEOUT_REPEAT,
517 GTK_PARAM_READWRITE),
520 g_assert (result == PROP_TIMEOUT_REPEAT);
522 result = settings_install_property_parser (class,
523 g_param_spec_int ("gtk-timeout-expand",
524 P_("Expand timeout"),
525 P_("Expand value for timeouts, when a widget is expanding a new region"),
526 0, G_MAXINT, DEFAULT_TIMEOUT_EXPAND,
527 GTK_PARAM_READWRITE),
530 g_assert (result == PROP_TIMEOUT_EXPAND);
533 * GtkSettings:gtk-color-scheme:
535 * A palette of named colors for use in themes. The format of the string is
541 * Color names must be acceptable as identifiers in the
542 * <link linkend="gtk-Resource-Files">gtkrc</link> syntax, and
543 * color specifications must be in the format accepted by
546 * Note that due to the way the color tables from different sources are
547 * merged, color specifications will be converted to hexadecimal form
548 * when getting this property.
550 * Starting with GTK+ 2.12, the entries can alternatively be separated
551 * by ';' instead of newlines:
553 * name1: color1; name2: color2; ...
558 result = settings_install_property_parser (class,
559 g_param_spec_string ("gtk-color-scheme",
561 P_("A palette of named colors for use in themes"),
563 GTK_PARAM_READWRITE),
566 g_assert (result == PROP_COLOR_SCHEME);
568 result = settings_install_property_parser (class,
569 g_param_spec_boolean ("gtk-enable-animations",
570 P_("Enable Animations"),
571 P_("Whether to enable toolkit-wide animations."),
573 GTK_PARAM_READWRITE),
576 g_assert (result == PROP_ENABLE_ANIMATIONS);
579 * GtkSettings:gtk-touchscreen-mode:
581 * When %TRUE, there are no motion notify events delivered on this screen,
582 * and widgets can't use the pointer hovering them for any essential
587 result = settings_install_property_parser (class,
588 g_param_spec_boolean ("gtk-touchscreen-mode",
589 P_("Enable Touchscreen Mode"),
590 P_("When TRUE, there are no motion notify events delivered on this screen"),
592 GTK_PARAM_READWRITE),
595 g_assert (result == PROP_TOUCHSCREEN_MODE);
598 * GtkSettings:gtk-tooltip-timeout:
600 * Time, in milliseconds, after which a tooltip could appear if the
601 * cursor is hovering on top of a widget.
605 result = settings_install_property_parser (class,
606 g_param_spec_int ("gtk-tooltip-timeout",
607 P_("Tooltip timeout"),
608 P_("Timeout before tooltip is shown"),
611 GTK_PARAM_READWRITE),
614 g_assert (result == PROP_TOOLTIP_TIMEOUT);
617 * GtkSettings:gtk-tooltip-browse-timeout:
619 * Controls the time after which tooltips will appear when
620 * browse mode is enabled, in milliseconds.
622 * Browse mode is enabled when the mouse pointer moves off an object
623 * where a tooltip was currently being displayed. If the mouse pointer
624 * hits another object before the browse mode timeout expires (see
625 * #GtkSettings:gtk-tooltip-browse-mode-timeout), it will take the
626 * amount of milliseconds specified by this setting to popup the tooltip
627 * for the new object.
631 result = settings_install_property_parser (class,
632 g_param_spec_int ("gtk-tooltip-browse-timeout",
633 P_("Tooltip browse timeout"),
634 P_("Timeout before tooltip is shown when browse mode is enabled"),
637 GTK_PARAM_READWRITE),
640 g_assert (result == PROP_TOOLTIP_BROWSE_TIMEOUT);
643 * GtkSettings:gtk-tooltip-browse-mode-timeout:
645 * Amount of time, in milliseconds, after which the browse mode
648 * See #GtkSettings:gtk-tooltip-browse-timeout for more information
653 result = settings_install_property_parser (class,
654 g_param_spec_int ("gtk-tooltip-browse-mode-timeout",
655 P_("Tooltip browse mode timeout"),
656 P_("Timeout after which browse mode is disabled"),
659 GTK_PARAM_READWRITE),
662 g_assert (result == PROP_TOOLTIP_BROWSE_MODE_TIMEOUT);
665 * GtkSettings:gtk-keynav-cursor-only:
667 * When %TRUE, keyboard navigation should be able to reach all widgets
668 * by using the cursor keys only. Tab, Shift etc. keys can't be expected
669 * to be present on the used input device.
673 result = settings_install_property_parser (class,
674 g_param_spec_boolean ("gtk-keynav-cursor-only",
675 P_("Keynav Cursor Only"),
676 P_("When TRUE, there are only cursor keys available to navigate widgets"),
678 GTK_PARAM_READWRITE),
681 g_assert (result == PROP_KEYNAV_CURSOR_ONLY);
684 * GtkSettings:gtk-keynav-wrap-around:
686 * When %TRUE, some widgets will wrap around when doing keyboard
687 * navigation, such as menus, menubars and notebooks.
691 result = settings_install_property_parser (class,
692 g_param_spec_boolean ("gtk-keynav-wrap-around",
693 P_("Keynav Wrap Around"),
694 P_("Whether to wrap around when keyboard-navigating widgets"),
696 GTK_PARAM_READWRITE),
699 g_assert (result == PROP_KEYNAV_WRAP_AROUND);
702 * GtkSettings:gtk-error-bell:
704 * When %TRUE, keyboard navigation and other input-related errors
705 * will cause a beep. Since the error bell is implemented using
706 * gdk_window_beep(), the windowing system may offer ways to
707 * configure the error bell in many ways, such as flashing the
708 * window or similar visual effects.
712 result = settings_install_property_parser (class,
713 g_param_spec_boolean ("gtk-error-bell",
715 P_("When TRUE, keyboard navigation and other errors will cause a beep"),
717 GTK_PARAM_READWRITE),
720 g_assert (result == PROP_ERROR_BELL);
723 * GtkSettings:color-hash:
725 * Holds a hash table representation of the #GtkSettings:gtk-color-scheme
726 * setting, mapping color names to #GdkColor<!-- -->s.
730 result = settings_install_property_parser (class,
731 g_param_spec_boxed ("color-hash",
733 P_("A hash table representation of the color scheme."),
737 g_assert (result == PROP_COLOR_HASH);
739 result = settings_install_property_parser (class,
740 g_param_spec_string ("gtk-file-chooser-backend",
741 P_("Default file chooser backend"),
742 P_("Name of the GtkFileChooser backend to use by default"),
744 GTK_PARAM_READWRITE),
746 g_assert (result == PROP_FILE_CHOOSER_BACKEND);
749 * GtkSettings:gtk-print-backends:
751 * A comma-separated list of print backends to use in the print
752 * dialog. Available print backends depend on the GTK+ installation,
753 * and may include "file", "cups", "lpr" or "papi".
757 result = settings_install_property_parser (class,
758 g_param_spec_string ("gtk-print-backends",
759 P_("Default print backend"),
760 P_("List of the GtkPrintBackend backends to use by default"),
762 GTK_PARAM_READWRITE),
764 g_assert (result == PROP_PRINT_BACKENDS);
767 * GtkSettings:gtk-print-preview-command:
769 * A command to run for displaying the print preview. The command
770 * should contain a %f placeholder, which will get replaced by
771 * the path to the pdf file. The command may also contain a %s
772 * placeholder, which will get replaced by the path to a file
773 * containing the print settings in the format produced by
774 * gtk_print_settings_to_file().
776 * The preview application is responsible for removing the pdf file
777 * and the print settings file when it is done.
781 result = settings_install_property_parser (class,
782 g_param_spec_string ("gtk-print-preview-command",
783 P_("Default command to run when displaying a print preview"),
784 P_("Command to run when displaying a print preview"),
785 GTK_PRINT_PREVIEW_COMMAND,
786 GTK_PARAM_READWRITE),
788 g_assert (result == PROP_PRINT_PREVIEW_COMMAND);
791 * GtkSettings:gtk-enable-mnemonics:
793 * Whether labels and menu items should have visible mnemonics which
798 result = settings_install_property_parser (class,
799 g_param_spec_boolean ("gtk-enable-mnemonics",
800 P_("Enable Mnemonics"),
801 P_("Whether labels should have mnemonics"),
803 GTK_PARAM_READWRITE),
805 g_assert (result == PROP_ENABLE_MNEMONICS);
808 * GtkSettings:gtk-enable-accels:
810 * Whether menu items should have visible accelerators which can be
815 result = settings_install_property_parser (class,
816 g_param_spec_boolean ("gtk-enable-accels",
817 P_("Enable Accelerators"),
818 P_("Whether menu items should have accelerators"),
820 GTK_PARAM_READWRITE),
822 g_assert (result == PROP_ENABLE_ACCELS);
825 * GtkSettings:gtk-recent-files-limit:
827 * The number of recently used files that should be displayed by default by
828 * #GtkRecentChooser implementations and by the #GtkFileChooser. A value of
829 * -1 means every recently used file stored.
833 result = settings_install_property_parser (class,
834 g_param_spec_int ("gtk-recent-files-limit",
835 P_("Recent Files Limit"),
836 P_("Number of recently used files"),
839 GTK_PARAM_READWRITE),
841 g_assert (result == PROP_RECENT_FILES_LIMIT);
844 * GtkSettings:gtk-im-module:
846 * Which IM (input method) module should be used by default. This is the
847 * input method that will be used if the user has not explicitly chosen
848 * another input method from the IM context menu.
850 * See #GtkIMContext and see the #GtkSettings:gtk-show-input-method-menu property.
852 result = settings_install_property_parser (class,
853 g_param_spec_string ("gtk-im-module",
854 P_("Default IM module"),
855 P_("Which IM module should be used by default"),
857 GTK_PARAM_READWRITE),
859 g_assert (result == PROP_IM_MODULE);
862 * GtkSettings:gtk-recent-files-max-age:
864 * The maximum age, in days, of the items inside the recently used
865 * resources list. Items older than this setting will be excised
866 * from the list. If set to 0, the list will always be empty; if
867 * set to -1, no item will be removed.
871 result = settings_install_property_parser (class,
872 g_param_spec_int ("gtk-recent-files-max-age",
873 P_("Recent Files Max Age"),
874 P_("Maximum age of recently used files, in days"),
877 GTK_PARAM_READWRITE),
879 g_assert (result == PROP_RECENT_FILES_MAX_AGE);
881 result = settings_install_property_parser (class,
882 g_param_spec_uint ("gtk-fontconfig-timestamp",
883 P_("Fontconfig configuration timestamp"),
884 P_("Timestamp of current fontconfig configuration"),
886 GTK_PARAM_READWRITE),
889 g_assert (result == PROP_FONTCONFIG_TIMESTAMP);
892 * GtkSettings:gtk-sound-theme-name:
894 * The XDG sound theme to use for event sounds.
896 * See the <ulink url="http://www.freedesktop.org/wiki/Specifications/sound-theme-spec">Sound Theme spec</ulink>
897 * for more information on event sounds and sound themes.
899 * GTK+ itself does not support event sounds, you have to use a loadable
900 * module like the one that comes with libcanberra.
904 result = settings_install_property_parser (class,
905 g_param_spec_string ("gtk-sound-theme-name",
906 P_("Sound Theme Name"),
907 P_("XDG sound theme name"),
909 GTK_PARAM_READWRITE),
911 g_assert (result == PROP_SOUND_THEME_NAME);
914 * GtkSettings:gtk-enable-input-feedback-sounds:
916 * Whether to play event sounds as feedback to user input.
918 * See the <ulink url="http://www.freedesktop.org/wiki/Specifications/sound-theme-spec">Sound Theme spec</ulink>
919 * for more information on event sounds and sound themes.
921 * GTK+ itself does not support event sounds, you have to use a loadable
922 * module like the one that comes with libcanberra.
926 result = settings_install_property_parser (class,
927 g_param_spec_boolean ("gtk-enable-input-feedback-sounds",
928 /* Translators: this means sounds that are played as feedback to user input */
929 P_("Audible Input Feedback"),
930 P_("Whether to play event sounds as feedback to user input"),
932 GTK_PARAM_READWRITE),
934 g_assert (result == PROP_ENABLE_INPUT_FEEDBACK_SOUNDS);
937 * GtkSettings:gtk-enable-event-sounds:
939 * Whether to play any event sounds at all.
941 * See the <ulink url="http://www.freedesktop.org/wiki/Specifications/sound-theme-spec">Sound Theme spec</ulink>
942 * for more information on event sounds and sound themes.
944 * GTK+ itself does not support event sounds, you have to use a loadable
945 * module like the one that comes with libcanberra.
949 result = settings_install_property_parser (class,
950 g_param_spec_boolean ("gtk-enable-event-sounds",
951 P_("Enable Event Sounds"),
952 P_("Whether to play any event sounds at all"),
954 GTK_PARAM_READWRITE),
956 g_assert (result == PROP_ENABLE_EVENT_SOUNDS);
959 * GtkSettings:gtk-enable-tooltips:
961 * Whether tooltips should be shown on widgets.
965 result = settings_install_property_parser (class,
966 g_param_spec_boolean ("gtk-enable-tooltips",
967 P_("Enable Tooltips"),
968 P_("Whether tooltips should be shown on widgets"),
970 GTK_PARAM_READWRITE),
972 g_assert (result == PROP_ENABLE_TOOLTIPS);
975 * GtkSettings:toolbar-style:
977 * The size of icons in default toolbars.
979 result = settings_install_property_parser (class,
980 g_param_spec_enum ("gtk-toolbar-style",
982 P_("Whether default toolbars have text only, text and icons, icons only, etc."),
983 GTK_TYPE_TOOLBAR_STYLE,
985 GTK_PARAM_READWRITE),
986 gtk_rc_property_parse_enum);
987 g_assert (result == PROP_TOOLBAR_STYLE);
990 * GtkSettings:toolbar-icon-size:
992 * The size of icons in default toolbars.
994 result = settings_install_property_parser (class,
995 g_param_spec_enum ("gtk-toolbar-icon-size",
996 P_("Toolbar Icon Size"),
997 P_("The size of icons in default toolbars."),
999 GTK_ICON_SIZE_LARGE_TOOLBAR,
1000 GTK_PARAM_READWRITE),
1001 gtk_rc_property_parse_enum);
1002 g_assert (result == PROP_TOOLBAR_ICON_SIZE);
1005 * GtkSettings:gtk-auto-mnemonics:
1007 * Whether mnemonics should be automatically shown and hidden when the user
1008 * presses the mnemonic activator.
1012 result = settings_install_property_parser (class,
1013 g_param_spec_boolean ("gtk-auto-mnemonics",
1014 P_("Auto Mnemonics"),
1015 P_("Whether mnemonics should be automatically shown and hidden when the user presses the mnemonic activator."),
1017 GTK_PARAM_READWRITE),
1019 g_assert (result == PROP_AUTO_MNEMONICS);
1023 gtk_settings_finalize (GObject *object)
1025 GtkSettings *settings = GTK_SETTINGS (object);
1028 object_list = g_slist_remove (object_list, settings);
1030 _gtk_rc_context_destroy (settings);
1032 for (i = 0; i < class_n_properties; i++)
1033 g_value_unset (&settings->property_values[i].value);
1034 g_free (settings->property_values);
1036 g_datalist_clear (&settings->queued_settings);
1038 G_OBJECT_CLASS (gtk_settings_parent_class)->finalize (object);
1042 * gtk_settings_get_for_screen:
1043 * @screen : a #GdkScreen.
1045 * Gets the #GtkSettings object for @screen, creating it if necessary.
1047 * Return value: a #GtkSettings object.
1052 gtk_settings_get_for_screen (GdkScreen *screen)
1054 GtkSettings *settings;
1056 g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
1058 settings = g_object_get_data (G_OBJECT (screen), "gtk-settings");
1061 settings = g_object_new (GTK_TYPE_SETTINGS, NULL);
1062 settings->screen = screen;
1063 g_object_set_data_full (G_OBJECT (screen), I_("gtk-settings"),
1064 settings, g_object_unref);
1066 gtk_rc_reparse_all_for_settings (settings, TRUE);
1067 settings_update_double_click (settings);
1068 #ifdef GDK_WINDOWING_X11
1069 settings_update_cursor_theme (settings);
1070 settings_update_resolution (settings);
1071 settings_update_font_options (settings);
1073 settings_update_color_scheme (settings);
1080 * gtk_settings_get_default:
1082 * Gets the #GtkSettings object for the default GDK screen, creating
1083 * it if necessary. See gtk_settings_get_for_screen().
1085 * Return value: (transfer none): a #GtkSettings object. If there is no default
1086 * screen, then returns %NULL.
1089 gtk_settings_get_default (void)
1091 GdkScreen *screen = gdk_screen_get_default ();
1094 return gtk_settings_get_for_screen (screen);
1100 gtk_settings_set_property (GObject *object,
1102 const GValue *value,
1105 GtkSettings *settings = GTK_SETTINGS (object);
1107 g_value_copy (value, &settings->property_values[property_id - 1].value);
1108 settings->property_values[property_id - 1].source = GTK_SETTINGS_SOURCE_APPLICATION;
1110 if (pspec->param_id == PROP_COLOR_SCHEME)
1111 merge_color_scheme (settings, value, GTK_SETTINGS_SOURCE_APPLICATION);
1115 gtk_settings_get_property (GObject *object,
1120 GtkSettings *settings = GTK_SETTINGS (object);
1121 GType value_type = G_VALUE_TYPE (value);
1122 GType fundamental_type = G_TYPE_FUNDAMENTAL (value_type);
1124 /* handle internal properties */
1125 switch (property_id)
1127 case PROP_COLOR_HASH:
1128 g_value_set_boxed (value, get_color_hash (settings));
1130 case PROP_COLOR_SCHEME:
1131 g_value_take_string (value, get_color_scheme (settings));
1136 /* For enums and strings, we need to get the value as a string,
1137 * not as an int, since we support using names/nicks as the setting
1140 if ((g_value_type_transformable (G_TYPE_INT, value_type) &&
1141 !(fundamental_type == G_TYPE_ENUM || fundamental_type == G_TYPE_FLAGS)) ||
1142 g_value_type_transformable (G_TYPE_STRING, G_VALUE_TYPE (value)) ||
1143 g_value_type_transformable (GDK_TYPE_COLOR, G_VALUE_TYPE (value)))
1145 if (settings->property_values[property_id - 1].source == GTK_SETTINGS_SOURCE_APPLICATION ||
1146 !gdk_screen_get_setting (settings->screen, pspec->name, value))
1147 g_value_copy (&settings->property_values[property_id - 1].value, value);
1149 g_param_value_validate (pspec, value);
1153 GValue val = { 0, };
1155 /* Try to get xsetting as a string and parse it. */
1157 g_value_init (&val, G_TYPE_STRING);
1159 if (settings->property_values[property_id - 1].source == GTK_SETTINGS_SOURCE_APPLICATION ||
1160 !gdk_screen_get_setting (settings->screen, pspec->name, &val))
1162 g_value_copy (&settings->property_values[property_id - 1].value, value);
1166 GValue tmp_value = { 0, };
1167 GValue gstring_value = { 0, };
1168 GtkRcPropertyParser parser = (GtkRcPropertyParser) g_param_spec_get_qdata (pspec, quark_property_parser);
1170 g_value_init (&gstring_value, G_TYPE_GSTRING);
1171 g_value_take_boxed (&gstring_value,
1172 g_string_new (g_value_get_string (&val)));
1174 g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
1176 if (parser && _gtk_settings_parse_convert (parser, &gstring_value,
1179 g_value_copy (&tmp_value, value);
1180 g_param_value_validate (pspec, value);
1184 g_value_copy (&settings->property_values[property_id - 1].value, value);
1187 g_value_unset (&gstring_value);
1188 g_value_unset (&tmp_value);
1191 g_value_unset (&val);
1196 gtk_settings_notify (GObject *object,
1199 GtkSettings *settings = GTK_SETTINGS (object);
1200 guint property_id = pspec->param_id;
1202 if (settings->screen == NULL) /* initialization */
1205 switch (property_id)
1208 settings_update_modules (settings);
1210 case PROP_DOUBLE_CLICK_TIME:
1211 case PROP_DOUBLE_CLICK_DISTANCE:
1212 settings_update_double_click (settings);
1214 case PROP_COLOR_SCHEME:
1215 settings_update_color_scheme (settings);
1217 #ifdef GDK_WINDOWING_X11
1219 settings_update_resolution (settings);
1220 /* This is a hack because with gtk_rc_reset_styles() doesn't get
1221 * widgets with gtk_widget_style_set(), and also causes more
1222 * recomputation than necessary.
1224 gtk_rc_reset_styles (GTK_SETTINGS (object));
1226 case PROP_XFT_ANTIALIAS:
1227 case PROP_XFT_HINTING:
1228 case PROP_XFT_HINTSTYLE:
1230 settings_update_font_options (settings);
1231 gtk_rc_reset_styles (GTK_SETTINGS (object));
1233 case PROP_FONTCONFIG_TIMESTAMP:
1234 if (settings_update_fontconfig (settings))
1235 gtk_rc_reset_styles (GTK_SETTINGS (object));
1237 case PROP_CURSOR_THEME_NAME:
1238 case PROP_CURSOR_THEME_SIZE:
1239 settings_update_cursor_theme (settings);
1241 #endif /* GDK_WINDOWING_X11 */
1246 _gtk_settings_parse_convert (GtkRcPropertyParser parser,
1247 const GValue *src_value,
1251 gboolean success = FALSE;
1253 g_return_val_if_fail (G_VALUE_HOLDS (dest_value, G_PARAM_SPEC_VALUE_TYPE (pspec)), FALSE);
1258 gboolean free_gstring = TRUE;
1260 if (G_VALUE_HOLDS (src_value, G_TYPE_GSTRING))
1262 gstring = g_value_get_boxed (src_value);
1263 free_gstring = FALSE;
1265 else if (G_VALUE_HOLDS_LONG (src_value))
1267 gstring = g_string_new (NULL);
1268 g_string_append_printf (gstring, "%ld", g_value_get_long (src_value));
1270 else if (G_VALUE_HOLDS_DOUBLE (src_value))
1272 gstring = g_string_new (NULL);
1273 g_string_append_printf (gstring, "%f", g_value_get_double (src_value));
1275 else if (G_VALUE_HOLDS_STRING (src_value))
1277 gchar *tstr = g_strescape (g_value_get_string (src_value), NULL);
1279 gstring = g_string_new ("\"");
1280 g_string_append (gstring, tstr);
1281 g_string_append_c (gstring, '\"');
1286 g_return_val_if_fail (G_VALUE_HOLDS (src_value, G_TYPE_GSTRING), FALSE);
1287 gstring = NULL; /* silence compiler */
1290 success = (parser (pspec, gstring, dest_value) &&
1291 !g_param_value_validate (pspec, dest_value));
1294 g_string_free (gstring, TRUE);
1296 else if (G_VALUE_HOLDS (src_value, G_TYPE_GSTRING))
1298 if (G_VALUE_HOLDS (dest_value, G_TYPE_STRING))
1300 GString *gstring = g_value_get_boxed (src_value);
1302 g_value_set_string (dest_value, gstring ? gstring->str : NULL);
1303 success = !g_param_value_validate (pspec, dest_value);
1306 else if (g_value_type_transformable (G_VALUE_TYPE (src_value), G_VALUE_TYPE (dest_value)))
1307 success = g_param_value_convert (pspec, src_value, dest_value, TRUE);
1313 apply_queued_setting (GtkSettings *data,
1315 GtkSettingsValuePrivate *qvalue)
1317 GValue tmp_value = { 0, };
1318 GtkRcPropertyParser parser = (GtkRcPropertyParser) g_param_spec_get_qdata (pspec, quark_property_parser);
1320 g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
1321 if (_gtk_settings_parse_convert (parser, &qvalue->public.value,
1324 if (pspec->param_id == PROP_COLOR_SCHEME)
1325 merge_color_scheme (data, &tmp_value, qvalue->source);
1327 if (data->property_values[pspec->param_id - 1].source <= qvalue->source)
1329 g_value_copy (&tmp_value, &data->property_values[pspec->param_id - 1].value);
1330 data->property_values[pspec->param_id - 1].source = qvalue->source;
1331 g_object_notify (G_OBJECT (data), g_param_spec_get_name (pspec));
1337 gchar *debug = g_strdup_value_contents (&qvalue->public.value);
1339 g_message ("%s: failed to retrieve property `%s' of type `%s' from rc file value \"%s\" of type `%s'",
1340 qvalue->public.origin ? qvalue->public.origin : "(for origin information, set GTK_DEBUG)",
1342 g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
1344 G_VALUE_TYPE_NAME (&tmp_value));
1347 g_value_unset (&tmp_value);
1351 settings_install_property_parser (GtkSettingsClass *class,
1353 GtkRcPropertyParser parser)
1355 GSList *node, *next;
1357 switch (G_TYPE_FUNDAMENTAL (G_PARAM_SPEC_VALUE_TYPE (pspec)))
1359 case G_TYPE_BOOLEAN:
1372 if (strcmp (g_param_spec_get_name (pspec), "color-hash") == 0)
1380 g_warning (G_STRLOC ": parser needs to be specified for property \"%s\" of type `%s'",
1381 pspec->name, g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
1385 if (g_object_class_find_property (G_OBJECT_CLASS (class), pspec->name))
1387 g_warning (G_STRLOC ": an rc-data property \"%s\" already exists",
1392 for (node = object_list; node; node = node->next)
1393 g_object_freeze_notify (node->data);
1395 g_object_class_install_property (G_OBJECT_CLASS (class), ++class_n_properties, pspec);
1396 g_param_spec_set_qdata (pspec, quark_property_parser, (gpointer) parser);
1398 for (node = object_list; node; node = node->next)
1400 GtkSettings *settings = node->data;
1401 GtkSettingsValuePrivate *qvalue;
1403 settings->property_values = g_renew (GtkSettingsPropertyValue, settings->property_values, class_n_properties);
1404 settings->property_values[class_n_properties - 1].value.g_type = 0;
1405 g_value_init (&settings->property_values[class_n_properties - 1].value, G_PARAM_SPEC_VALUE_TYPE (pspec));
1406 g_param_value_set_default (pspec, &settings->property_values[class_n_properties - 1].value);
1407 settings->property_values[class_n_properties - 1].source = GTK_SETTINGS_SOURCE_DEFAULT;
1408 g_object_notify (G_OBJECT (settings), pspec->name);
1410 qvalue = g_datalist_get_data (&settings->queued_settings, pspec->name);
1412 apply_queued_setting (settings, pspec, qvalue);
1415 for (node = object_list; node; node = next)
1418 g_object_thaw_notify (node->data);
1421 return class_n_properties;
1425 _gtk_rc_property_parser_from_type (GType type)
1427 if (type == GDK_TYPE_COLOR)
1428 return gtk_rc_property_parse_color;
1429 else if (type == GTK_TYPE_REQUISITION)
1430 return gtk_rc_property_parse_requisition;
1431 else if (type == GTK_TYPE_BORDER)
1432 return gtk_rc_property_parse_border;
1433 else if (G_TYPE_FUNDAMENTAL (type) == G_TYPE_ENUM && G_TYPE_IS_DERIVED (type))
1434 return gtk_rc_property_parse_enum;
1435 else if (G_TYPE_FUNDAMENTAL (type) == G_TYPE_FLAGS && G_TYPE_IS_DERIVED (type))
1436 return gtk_rc_property_parse_flags;
1442 gtk_settings_install_property (GParamSpec *pspec)
1444 static GtkSettingsClass *klass = NULL;
1446 GtkRcPropertyParser parser;
1448 g_return_if_fail (G_IS_PARAM_SPEC (pspec));
1451 klass = g_type_class_ref (GTK_TYPE_SETTINGS);
1453 parser = _gtk_rc_property_parser_from_type (G_PARAM_SPEC_VALUE_TYPE (pspec));
1455 settings_install_property_parser (klass, pspec, parser);
1459 gtk_settings_install_property_parser (GParamSpec *pspec,
1460 GtkRcPropertyParser parser)
1462 static GtkSettingsClass *klass = NULL;
1464 g_return_if_fail (G_IS_PARAM_SPEC (pspec));
1465 g_return_if_fail (parser != NULL);
1468 klass = g_type_class_ref (GTK_TYPE_SETTINGS);
1470 settings_install_property_parser (klass, pspec, parser);
1474 free_value (gpointer data)
1476 GtkSettingsValuePrivate *qvalue = data;
1478 g_value_unset (&qvalue->public.value);
1479 g_free (qvalue->public.origin);
1480 g_slice_free (GtkSettingsValuePrivate, qvalue);
1484 gtk_settings_set_property_value_internal (GtkSettings *settings,
1485 const gchar *prop_name,
1486 const GtkSettingsValue *new_value,
1487 GtkSettingsSource source)
1489 GtkSettingsValuePrivate *qvalue;
1494 if (!G_VALUE_HOLDS_LONG (&new_value->value) &&
1495 !G_VALUE_HOLDS_DOUBLE (&new_value->value) &&
1496 !G_VALUE_HOLDS_STRING (&new_value->value) &&
1497 !G_VALUE_HOLDS (&new_value->value, G_TYPE_GSTRING))
1499 g_warning (G_STRLOC ": value type invalid");
1503 name = g_strdup (prop_name);
1504 g_strcanon (name, G_CSET_DIGITS "-" G_CSET_a_2_z G_CSET_A_2_Z, '-');
1505 name_quark = g_quark_from_string (name);
1508 qvalue = g_datalist_id_get_data (&settings->queued_settings, name_quark);
1511 qvalue = g_slice_new0 (GtkSettingsValuePrivate);
1512 g_datalist_id_set_data_full (&settings->queued_settings, name_quark, qvalue, free_value);
1516 g_free (qvalue->public.origin);
1517 g_value_unset (&qvalue->public.value);
1519 qvalue->public.origin = g_strdup (new_value->origin);
1520 g_value_init (&qvalue->public.value, G_VALUE_TYPE (&new_value->value));
1521 g_value_copy (&new_value->value, &qvalue->public.value);
1522 qvalue->source = source;
1523 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (settings), g_quark_to_string (name_quark));
1525 apply_queued_setting (settings, pspec, qvalue);
1529 gtk_settings_set_property_value (GtkSettings *settings,
1530 const gchar *prop_name,
1531 const GtkSettingsValue *new_value)
1533 g_return_if_fail (GTK_SETTINGS (settings));
1534 g_return_if_fail (prop_name != NULL);
1535 g_return_if_fail (new_value != NULL);
1537 gtk_settings_set_property_value_internal (settings, prop_name, new_value,
1538 GTK_SETTINGS_SOURCE_APPLICATION);
1542 _gtk_settings_set_property_value_from_rc (GtkSettings *settings,
1543 const gchar *prop_name,
1544 const GtkSettingsValue *new_value)
1546 g_return_if_fail (GTK_SETTINGS (settings));
1547 g_return_if_fail (prop_name != NULL);
1548 g_return_if_fail (new_value != NULL);
1550 gtk_settings_set_property_value_internal (settings, prop_name, new_value,
1551 GTK_SETTINGS_SOURCE_RC_FILE);
1555 gtk_settings_set_string_property (GtkSettings *settings,
1557 const gchar *v_string,
1558 const gchar *origin)
1560 GtkSettingsValue svalue = { NULL, { 0, }, };
1562 g_return_if_fail (GTK_SETTINGS (settings));
1563 g_return_if_fail (name != NULL);
1564 g_return_if_fail (v_string != NULL);
1566 svalue.origin = (gchar*) origin;
1567 g_value_init (&svalue.value, G_TYPE_STRING);
1568 g_value_set_static_string (&svalue.value, v_string);
1569 gtk_settings_set_property_value (settings, name, &svalue);
1570 g_value_unset (&svalue.value);
1574 gtk_settings_set_long_property (GtkSettings *settings,
1577 const gchar *origin)
1579 GtkSettingsValue svalue = { NULL, { 0, }, };
1581 g_return_if_fail (GTK_SETTINGS (settings));
1582 g_return_if_fail (name != NULL);
1584 svalue.origin = (gchar*) origin;
1585 g_value_init (&svalue.value, G_TYPE_LONG);
1586 g_value_set_long (&svalue.value, v_long);
1587 gtk_settings_set_property_value (settings, name, &svalue);
1588 g_value_unset (&svalue.value);
1592 gtk_settings_set_double_property (GtkSettings *settings,
1595 const gchar *origin)
1597 GtkSettingsValue svalue = { NULL, { 0, }, };
1599 g_return_if_fail (GTK_SETTINGS (settings));
1600 g_return_if_fail (name != NULL);
1602 svalue.origin = (gchar*) origin;
1603 g_value_init (&svalue.value, G_TYPE_DOUBLE);
1604 g_value_set_double (&svalue.value, v_double);
1605 gtk_settings_set_property_value (settings, name, &svalue);
1606 g_value_unset (&svalue.value);
1610 * gtk_rc_property_parse_color:
1611 * @pspec: a #GParamSpec
1612 * @gstring: the #GString to be parsed
1613 * @property_value: a #GValue which must hold #GdkColor values.
1615 * A #GtkRcPropertyParser for use with gtk_settings_install_property_parser()
1616 * or gtk_widget_class_install_style_property_parser() which parses a
1617 * color given either by its name or in the form
1618 * <literal>{ red, green, blue }</literal> where %red, %green and
1619 * %blue are integers between 0 and 65535 or floating-point numbers
1622 * Return value: %TRUE if @gstring could be parsed and @property_value
1623 * has been set to the resulting #GdkColor.
1626 gtk_rc_property_parse_color (const GParamSpec *pspec,
1627 const GString *gstring,
1628 GValue *property_value)
1630 GdkColor color = { 0, 0, 0, 0, };
1634 g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
1635 g_return_val_if_fail (G_VALUE_HOLDS (property_value, GDK_TYPE_COLOR), FALSE);
1637 scanner = gtk_rc_scanner_new ();
1638 g_scanner_input_text (scanner, gstring->str, gstring->len);
1639 if (gtk_rc_parse_color (scanner, &color) == G_TOKEN_NONE &&
1640 g_scanner_get_next_token (scanner) == G_TOKEN_EOF)
1642 g_value_set_boxed (property_value, &color);
1647 g_scanner_destroy (scanner);
1653 * gtk_rc_property_parse_enum:
1654 * @pspec: a #GParamSpec
1655 * @gstring: the #GString to be parsed
1656 * @property_value: a #GValue which must hold enum values.
1658 * A #GtkRcPropertyParser for use with gtk_settings_install_property_parser()
1659 * or gtk_widget_class_install_style_property_parser() which parses a single
1660 * enumeration value.
1662 * The enumeration value can be specified by its name, its nickname or
1663 * its numeric value. For consistency with flags parsing, the value
1664 * may be surrounded by parentheses.
1666 * Return value: %TRUE if @gstring could be parsed and @property_value
1667 * has been set to the resulting #GEnumValue.
1670 gtk_rc_property_parse_enum (const GParamSpec *pspec,
1671 const GString *gstring,
1672 GValue *property_value)
1674 gboolean need_closing_brace = FALSE, success = FALSE;
1676 GEnumValue *enum_value = NULL;
1678 g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
1679 g_return_val_if_fail (G_VALUE_HOLDS_ENUM (property_value), FALSE);
1681 scanner = gtk_rc_scanner_new ();
1682 g_scanner_input_text (scanner, gstring->str, gstring->len);
1684 /* we just want to parse _one_ value, but for consistency with flags parsing
1685 * we support optional parenthesis
1687 g_scanner_get_next_token (scanner);
1688 if (scanner->token == '(')
1690 need_closing_brace = TRUE;
1691 g_scanner_get_next_token (scanner);
1693 if (scanner->token == G_TOKEN_IDENTIFIER)
1695 GEnumClass *class = G_PARAM_SPEC_ENUM (pspec)->enum_class;
1697 enum_value = g_enum_get_value_by_name (class, scanner->value.v_identifier);
1699 enum_value = g_enum_get_value_by_nick (class, scanner->value.v_identifier);
1702 g_value_set_enum (property_value, enum_value->value);
1706 else if (scanner->token == G_TOKEN_INT)
1708 g_value_set_enum (property_value, scanner->value.v_int);
1711 if (need_closing_brace && g_scanner_get_next_token (scanner) != ')')
1713 if (g_scanner_get_next_token (scanner) != G_TOKEN_EOF)
1716 g_scanner_destroy (scanner);
1722 parse_flags_value (GScanner *scanner,
1726 g_scanner_get_next_token (scanner);
1727 if (scanner->token == G_TOKEN_IDENTIFIER)
1729 GFlagsValue *flags_value;
1731 flags_value = g_flags_get_value_by_name (class, scanner->value.v_identifier);
1733 flags_value = g_flags_get_value_by_nick (class, scanner->value.v_identifier);
1736 *number |= flags_value->value;
1737 return G_TOKEN_NONE;
1740 else if (scanner->token == G_TOKEN_INT)
1742 *number |= scanner->value.v_int;
1743 return G_TOKEN_NONE;
1745 return G_TOKEN_IDENTIFIER;
1749 * gtk_rc_property_parse_flags:
1750 * @pspec: a #GParamSpec
1751 * @gstring: the #GString to be parsed
1752 * @property_value: a #GValue which must hold flags values.
1754 * A #GtkRcPropertyParser for use with gtk_settings_install_property_parser()
1755 * or gtk_widget_class_install_style_property_parser() which parses flags.
1757 * Flags can be specified by their name, their nickname or
1758 * numerically. Multiple flags can be specified in the form
1759 * <literal>"( flag1 | flag2 | ... )"</literal>.
1761 * Return value: %TRUE if @gstring could be parsed and @property_value
1762 * has been set to the resulting flags value.
1765 gtk_rc_property_parse_flags (const GParamSpec *pspec,
1766 const GString *gstring,
1767 GValue *property_value)
1770 gboolean success = FALSE;
1773 g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
1774 g_return_val_if_fail (G_VALUE_HOLDS_FLAGS (property_value), FALSE);
1776 class = G_PARAM_SPEC_FLAGS (pspec)->flags_class;
1777 scanner = gtk_rc_scanner_new ();
1778 g_scanner_input_text (scanner, gstring->str, gstring->len);
1780 /* parse either a single flags value or a "\( ... [ \| ... ] \)" compound */
1781 if (g_scanner_peek_next_token (scanner) == G_TOKEN_IDENTIFIER ||
1782 scanner->next_token == G_TOKEN_INT)
1784 guint token, flags_value = 0;
1786 token = parse_flags_value (scanner, class, &flags_value);
1788 if (token == G_TOKEN_NONE && g_scanner_peek_next_token (scanner) == G_TOKEN_EOF)
1791 g_value_set_flags (property_value, flags_value);
1795 else if (g_scanner_get_next_token (scanner) == '(')
1797 guint token, flags_value = 0;
1799 /* parse first value */
1800 token = parse_flags_value (scanner, class, &flags_value);
1802 /* parse nth values, preceeded by '|' */
1803 while (token == G_TOKEN_NONE && g_scanner_get_next_token (scanner) == '|')
1804 token = parse_flags_value (scanner, class, &flags_value);
1806 /* done, last token must have closed expression */
1807 if (token == G_TOKEN_NONE && scanner->token == ')' &&
1808 g_scanner_peek_next_token (scanner) == G_TOKEN_EOF)
1810 g_value_set_flags (property_value, flags_value);
1814 g_scanner_destroy (scanner);
1820 get_braced_int (GScanner *scanner,
1827 g_scanner_get_next_token (scanner);
1828 if (scanner->token != '{')
1832 g_scanner_get_next_token (scanner);
1833 if (scanner->token != G_TOKEN_INT)
1836 *value = scanner->value.v_int;
1840 g_scanner_get_next_token (scanner);
1841 if (scanner->token != '}')
1846 g_scanner_get_next_token (scanner);
1847 if (scanner->token != ',')
1855 * gtk_rc_property_parse_requisition:
1856 * @pspec: a #GParamSpec
1857 * @gstring: the #GString to be parsed
1858 * @property_value: a #GValue which must hold boxed values.
1860 * A #GtkRcPropertyParser for use with gtk_settings_install_property_parser()
1861 * or gtk_widget_class_install_style_property_parser() which parses a
1862 * requisition in the form
1863 * <literal>"{ width, height }"</literal> for integers %width and %height.
1865 * Return value: %TRUE if @gstring could be parsed and @property_value
1866 * has been set to the resulting #GtkRequisition.
1869 gtk_rc_property_parse_requisition (const GParamSpec *pspec,
1870 const GString *gstring,
1871 GValue *property_value)
1873 GtkRequisition requisition;
1875 gboolean success = FALSE;
1877 g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
1878 g_return_val_if_fail (G_VALUE_HOLDS_BOXED (property_value), FALSE);
1880 scanner = gtk_rc_scanner_new ();
1881 g_scanner_input_text (scanner, gstring->str, gstring->len);
1883 if (get_braced_int (scanner, TRUE, FALSE, &requisition.width) &&
1884 get_braced_int (scanner, FALSE, TRUE, &requisition.height))
1886 g_value_set_boxed (property_value, &requisition);
1890 g_scanner_destroy (scanner);
1896 * gtk_rc_property_parse_border:
1897 * @pspec: a #GParamSpec
1898 * @gstring: the #GString to be parsed
1899 * @property_value: a #GValue which must hold boxed values.
1901 * A #GtkRcPropertyParser for use with gtk_settings_install_property_parser()
1902 * or gtk_widget_class_install_style_property_parser() which parses
1903 * borders in the form
1904 * <literal>"{ left, right, top, bottom }"</literal> for integers
1905 * %left, %right, %top and %bottom.
1907 * Return value: %TRUE if @gstring could be parsed and @property_value
1908 * has been set to the resulting #GtkBorder.
1911 gtk_rc_property_parse_border (const GParamSpec *pspec,
1912 const GString *gstring,
1913 GValue *property_value)
1917 gboolean success = FALSE;
1919 g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
1920 g_return_val_if_fail (G_VALUE_HOLDS_BOXED (property_value), FALSE);
1922 scanner = gtk_rc_scanner_new ();
1923 g_scanner_input_text (scanner, gstring->str, gstring->len);
1925 if (get_braced_int (scanner, TRUE, FALSE, &border.left) &&
1926 get_braced_int (scanner, FALSE, FALSE, &border.right) &&
1927 get_braced_int (scanner, FALSE, FALSE, &border.top) &&
1928 get_braced_int (scanner, FALSE, TRUE, &border.bottom))
1930 g_value_set_boxed (property_value, &border);
1934 g_scanner_destroy (scanner);
1940 _gtk_settings_handle_event (GdkEventSetting *event)
1942 GtkSettings *settings;
1946 settings = gtk_settings_get_for_screen (gdk_drawable_get_screen (event->window));
1947 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (settings), event->name);
1951 property_id = pspec->param_id;
1953 if (property_id == PROP_COLOR_SCHEME)
1955 GValue value = { 0, };
1957 g_value_init (&value, G_TYPE_STRING);
1958 if (!gdk_screen_get_setting (settings->screen, pspec->name, &value))
1959 g_value_set_static_string (&value, "");
1960 merge_color_scheme (settings, &value, GTK_SETTINGS_SOURCE_XSETTING);
1961 g_value_unset (&value);
1963 g_object_notify (G_OBJECT (settings), pspec->name);
1968 reset_rc_values_foreach (GQuark key_id,
1972 GtkSettingsValuePrivate *qvalue = data;
1973 GSList **to_reset = user_data;
1975 if (qvalue->source == GTK_SETTINGS_SOURCE_RC_FILE)
1976 *to_reset = g_slist_prepend (*to_reset, GUINT_TO_POINTER (key_id));
1980 _gtk_settings_reset_rc_values (GtkSettings *settings)
1982 GSList *to_reset = NULL;
1984 GParamSpec **pspecs, **p;
1987 /* Remove any queued settings
1989 g_datalist_foreach (&settings->queued_settings,
1990 reset_rc_values_foreach,
1993 for (tmp_list = to_reset; tmp_list; tmp_list = tmp_list->next)
1995 GQuark key_id = GPOINTER_TO_UINT (tmp_list->data);
1996 g_datalist_id_remove_data (&settings->queued_settings, key_id);
1999 g_slist_free (to_reset);
2001 /* Now reset the active settings
2003 pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (settings), NULL);
2006 g_object_freeze_notify (G_OBJECT (settings));
2007 for (p = pspecs; *p; p++)
2009 if (settings->property_values[i].source == GTK_SETTINGS_SOURCE_RC_FILE)
2011 GParamSpec *pspec = *p;
2013 g_param_value_set_default (pspec, &settings->property_values[i].value);
2014 g_object_notify (G_OBJECT (settings), pspec->name);
2018 g_object_thaw_notify (G_OBJECT (settings));
2023 settings_update_double_click (GtkSettings *settings)
2025 if (gdk_screen_get_number (settings->screen) == 0)
2027 GdkDisplay *display = gdk_screen_get_display (settings->screen);
2028 gint double_click_time;
2029 gint double_click_distance;
2031 g_object_get (settings,
2032 "gtk-double-click-time", &double_click_time,
2033 "gtk-double-click-distance", &double_click_distance,
2036 gdk_display_set_double_click_time (display, double_click_time);
2037 gdk_display_set_double_click_distance (display, double_click_distance);
2042 settings_update_modules (GtkSettings *settings)
2046 g_object_get (settings,
2047 "gtk-modules", &modules,
2050 _gtk_modules_settings_changed (settings, modules);
2055 #ifdef GDK_WINDOWING_X11
2057 settings_update_cursor_theme (GtkSettings *settings)
2059 GdkDisplay *display = gdk_screen_get_display (settings->screen);
2060 gchar *theme = NULL;
2063 g_object_get (settings,
2064 "gtk-cursor-theme-name", &theme,
2065 "gtk-cursor-theme-size", &size,
2068 gdk_x11_display_set_cursor_theme (display, theme, size);
2074 settings_update_font_options (GtkSettings *settings)
2077 gchar *hint_style_str;
2078 cairo_hint_style_t hint_style = CAIRO_HINT_STYLE_NONE;
2080 cairo_antialias_t antialias_mode = CAIRO_ANTIALIAS_GRAY;
2082 cairo_subpixel_order_t subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
2083 cairo_font_options_t *options;
2085 g_object_get (settings,
2086 "gtk-xft-antialias", &antialias,
2087 "gtk-xft-hinting", &hinting,
2088 "gtk-xft-hintstyle", &hint_style_str,
2089 "gtk-xft-rgba", &rgba_str,
2092 options = cairo_font_options_create ();
2094 cairo_font_options_set_hint_metrics (options, CAIRO_HINT_METRICS_ON);
2096 if (hinting >= 0 && !hinting)
2098 hint_style = CAIRO_HINT_STYLE_NONE;
2100 else if (hint_style_str)
2102 if (strcmp (hint_style_str, "hintnone") == 0)
2103 hint_style = CAIRO_HINT_STYLE_NONE;
2104 else if (strcmp (hint_style_str, "hintslight") == 0)
2105 hint_style = CAIRO_HINT_STYLE_SLIGHT;
2106 else if (strcmp (hint_style_str, "hintmedium") == 0)
2107 hint_style = CAIRO_HINT_STYLE_MEDIUM;
2108 else if (strcmp (hint_style_str, "hintfull") == 0)
2109 hint_style = CAIRO_HINT_STYLE_FULL;
2112 g_free (hint_style_str);
2114 cairo_font_options_set_hint_style (options, hint_style);
2118 if (strcmp (rgba_str, "rgb") == 0)
2119 subpixel_order = CAIRO_SUBPIXEL_ORDER_RGB;
2120 else if (strcmp (rgba_str, "bgr") == 0)
2121 subpixel_order = CAIRO_SUBPIXEL_ORDER_BGR;
2122 else if (strcmp (rgba_str, "vrgb") == 0)
2123 subpixel_order = CAIRO_SUBPIXEL_ORDER_VRGB;
2124 else if (strcmp (rgba_str, "vbgr") == 0)
2125 subpixel_order = CAIRO_SUBPIXEL_ORDER_VBGR;
2130 cairo_font_options_set_subpixel_order (options, subpixel_order);
2132 if (antialias >= 0 && !antialias)
2133 antialias_mode = CAIRO_ANTIALIAS_NONE;
2134 else if (subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT)
2135 antialias_mode = CAIRO_ANTIALIAS_SUBPIXEL;
2136 else if (antialias >= 0)
2137 antialias_mode = CAIRO_ANTIALIAS_GRAY;
2139 cairo_font_options_set_antialias (options, antialias_mode);
2141 gdk_screen_set_font_options (settings->screen, options);
2143 cairo_font_options_destroy (options);
2146 #ifdef GDK_WINDOWING_X11
2148 settings_update_fontconfig (GtkSettings *settings)
2150 static guint last_update_timestamp;
2151 static gboolean last_update_needed;
2155 g_object_get (settings,
2156 "gtk-fontconfig-timestamp", ×tamp,
2159 /* if timestamp is the same as last_update_timestamp, we already have
2160 * updated fontconig on this timestamp (another screen requested it perhaps?),
2161 * just return the cached result.*/
2163 if (timestamp != last_update_timestamp)
2165 PangoFontMap *fontmap = pango_cairo_font_map_get_default ();
2166 gboolean update_needed = FALSE;
2169 if (PANGO_IS_FC_FONT_MAP (fontmap) && !FcConfigUptoDate (NULL))
2171 pango_fc_font_map_cache_clear (PANGO_FC_FONT_MAP (fontmap));
2172 if (FcInitReinitialize ())
2173 update_needed = TRUE;
2176 last_update_timestamp = timestamp;
2177 last_update_needed = update_needed;
2180 return last_update_needed;
2182 #endif /* GDK_WINDOWING_X11 */
2185 settings_update_resolution (GtkSettings *settings)
2190 g_object_get (settings,
2191 "gtk-xft-dpi", &dpi_int,
2195 dpi = dpi_int / 1024.;
2199 gdk_screen_set_resolution (settings->screen, dpi);
2204 GHashTable *color_hash;
2205 GHashTable *tables[GTK_SETTINGS_SOURCE_APPLICATION + 1];
2206 gchar *lastentry[GTK_SETTINGS_SOURCE_APPLICATION + 1];
2210 color_scheme_data_free (ColorSchemeData *data)
2214 g_hash_table_unref (data->color_hash);
2216 for (i = 0; i <= GTK_SETTINGS_SOURCE_APPLICATION; i++)
2218 if (data->tables[i])
2219 g_hash_table_unref (data->tables[i]);
2220 g_free (data->lastentry[i]);
2223 g_slice_free (ColorSchemeData, data);
2227 settings_update_color_scheme (GtkSettings *settings)
2229 if (!g_object_get_data (G_OBJECT (settings), "gtk-color-scheme"))
2231 ColorSchemeData *data;
2232 GValue value = { 0, };
2234 data = g_slice_new0 (ColorSchemeData);
2235 data->color_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
2236 (GDestroyNotify) gdk_color_free);
2237 g_object_set_data_full (G_OBJECT (settings), "gtk-color-scheme",
2238 data, (GDestroyNotify) color_scheme_data_free);
2240 g_value_init (&value, G_TYPE_STRING);
2241 if (gdk_screen_get_setting (settings->screen, "gtk-color-scheme", &value))
2243 merge_color_scheme (settings, &value, GTK_SETTINGS_SOURCE_XSETTING);
2244 g_value_unset (&value);
2250 add_color_to_hash (gchar *name,
2256 old = g_hash_table_lookup (target, name);
2257 if (!old || !gdk_color_equal (old, color))
2259 g_hash_table_insert (target, g_strdup (name), gdk_color_copy (color));
2268 add_colors_to_hash_from_string (GHashTable *hash,
2269 const gchar *colors)
2271 gchar *s, *p, *name;
2273 gboolean changed = FALSE;
2276 copy = g_strdup (colors);
2281 p = strchr (s, ':');
2296 if (*s == '\n' || *s == ';')
2305 if (gdk_color_parse (p, &color))
2306 changed |= add_color_to_hash (name, &color, hash);
2315 update_color_hash (ColorSchemeData *data,
2317 GtkSettingsSource source)
2319 gboolean changed = FALSE;
2321 GHashTable *old_hash;
2322 GHashTableIter iter;
2326 if ((str == NULL || *str == '\0') &&
2327 (data->lastentry[source] == NULL || data->lastentry[source][0] == '\0'))
2330 if (str && data->lastentry[source] && strcmp (str, data->lastentry[source]) == 0)
2333 /* For the RC_FILE source we merge the values rather than over-writing
2334 * them, since multiple rc files might define independent sets of colors
2336 if ((source != GTK_SETTINGS_SOURCE_RC_FILE) &&
2337 data->tables[source] && g_hash_table_size (data->tables[source]) > 0)
2339 g_hash_table_unref (data->tables[source]);
2340 data->tables[source] = NULL;
2341 changed = TRUE; /* We can't rely on the code below since str might be "" */
2344 if (data->tables[source] == NULL)
2345 data->tables[source] = g_hash_table_new_full (g_str_hash, g_str_equal,
2347 (GDestroyNotify) gdk_color_free);
2349 g_free (data->lastentry[source]);
2350 data->lastentry[source] = g_strdup (str);
2352 changed |= add_colors_to_hash_from_string (data->tables[source], str);
2357 /* Rebuild the merged hash table. */
2358 if (data->color_hash)
2360 old_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
2361 (GDestroyNotify) gdk_color_free);
2363 g_hash_table_iter_init (&iter, data->color_hash);
2364 while (g_hash_table_iter_next (&iter, &name, &color))
2366 g_hash_table_insert (old_hash, name, color);
2367 g_hash_table_iter_steal (&iter);
2375 for (i = 0; i <= GTK_SETTINGS_SOURCE_APPLICATION; i++)
2377 if (data->tables[i])
2378 g_hash_table_foreach (data->tables[i], (GHFunc) add_color_to_hash,
2384 /* now check if the merged hash has changed */
2386 if (g_hash_table_size (old_hash) != g_hash_table_size (data->color_hash))
2390 GHashTableIter iter;
2391 gpointer key, value, new_value;
2393 g_hash_table_iter_init (&iter, old_hash);
2394 while (g_hash_table_iter_next (&iter, &key, &value))
2396 new_value = g_hash_table_lookup (data->color_hash, key);
2397 if (!new_value || !gdk_color_equal (value, new_value))
2405 g_hash_table_unref (old_hash);
2414 merge_color_scheme (GtkSettings *settings,
2415 const GValue *value,
2416 GtkSettingsSource source)
2418 ColorSchemeData *data;
2419 const gchar *colors;
2421 g_object_freeze_notify (G_OBJECT (settings));
2423 colors = g_value_get_string (value);
2425 settings_update_color_scheme (settings);
2427 data = (ColorSchemeData *) g_object_get_data (G_OBJECT (settings),
2428 "gtk-color-scheme");
2430 if (update_color_hash (data, colors, source))
2431 g_object_notify (G_OBJECT (settings), "color-hash");
2433 g_object_thaw_notify (G_OBJECT (settings));
2437 get_color_hash (GtkSettings *settings)
2439 ColorSchemeData *data;
2441 settings_update_color_scheme (settings);
2443 data = (ColorSchemeData *)g_object_get_data (G_OBJECT (settings),
2444 "gtk-color-scheme");
2446 return data->color_hash;
2450 append_color_scheme (gpointer key,
2454 gchar *name = (gchar *)key;
2455 GdkColor *color = (GdkColor *)value;
2456 GString *string = (GString *)data;
2458 g_string_append_printf (string, "%s: #%04x%04x%04x\n",
2459 name, color->red, color->green, color->blue);
2463 get_color_scheme (GtkSettings *settings)
2465 ColorSchemeData *data;
2468 settings_update_color_scheme (settings);
2470 data = (ColorSchemeData *) g_object_get_data (G_OBJECT (settings),
2471 "gtk-color-scheme");
2473 string = g_string_new ("");
2475 g_hash_table_foreach (data->color_hash, append_color_scheme, string);
2477 return g_string_free (string, FALSE);
2481 #define __GTK_SETTINGS_C__
2482 #include "gtkaliasdef.c"