Debian Codegraph @

gdk/x11/gdksettings.c

raw
1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 *
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.
8 *
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.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 /*
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23 */
24
25 static const struct {
26 const char *xname, *gdkname;
27 } gdk_settings_map[] = {
28 {"Net/DoubleClickTime", "gtk-double-click-time"},
29 {"Net/DoubleClickDistance", "gtk-double-click-distance"},
30 {"Net/DndDragThreshold", "gtk-dnd-drag-threshold"},
31 {"Net/CursorBlink", "gtk-cursor-blink"},
32 {"Net/CursorBlinkTime", "gtk-cursor-blink-time"},
33 {"Net/ThemeName", "gtk-theme-name"},
34 {"Net/IconThemeName", "gtk-icon-theme-name"},
35 {"Gtk/ColorPalette", "gtk-color-palette"},
36 {"Gtk/FontName", "gtk-font-name"},
37 {"Gtk/KeyThemeName", "gtk-key-theme-name"},
38 {"Gtk/Modules", "gtk-modules"},
39 {"Gtk/ButtonImages", "gtk-button-images"},
40 {"Gtk/MenuImages", "gtk-menu-images"},
41 {"Gtk/CursorThemeName", "gtk-cursor-theme-name"},
42 {"Gtk/CursorThemeSize", "gtk-cursor-theme-size"},
43 {"Gtk/ColorScheme", "gtk-color-scheme"},
44 {"Gtk/EnableAnimations", "gtk-enable-animations"},
45 {"Xft/Antialias", "gtk-xft-antialias"},
46 {"Xft/Hinting", "gtk-xft-hinting"},
47 {"Xft/HintStyle", "gtk-xft-hintstyle"},
48 {"Xft/RGBA", "gtk-xft-rgba"},
49 {"Xft/DPI", "gtk-xft-dpi"},
50 {"Gtk/EnableAccels", "gtk-enable-accels"},
51 {"Gtk/ScrolledWindowPlacement", "gtk-scrolled-window-placement"},
52 {"Gtk/IMModule", "gtk-im-module"},
53 {"Fontconfig/Timestamp", "gtk-fontconfig-timestamp"},
54 {"Net/SoundThemeName", "gtk-sound-theme-name"},
55 {"Net/EnableInputFeedbackSounds", "gtk-enable-input-feedback-sounds"},
56 {"Net/EnableEventSounds", "gtk-enable-event-sounds"},
57 {"Gtk/CursorBlinkTimeout", "gtk-cursor-blink-timeout"},
58 {"Gtk/ShellShowsAppMenu", "gtk-shell-shows-app-menu"},
59 {"Gtk/ShellShowsMenubar", "gtk-shell-shows-menubar"},
60 {"Gtk/ShellShowsDesktop", "gtk-shell-shows-desktop"},
61 {"Gtk/SessionBusId", "gtk-session-bus-id"},
62 {"Gtk/DecorationLayout", "gtk-decoration-layout"},
63 {"Gtk/TitlebarDoubleClick", "gtk-titlebar-double-click"},
64 {"Gtk/TitlebarMiddleClick", "gtk-titlebar-middle-click"},
65 {"Gtk/TitlebarRightClick", "gtk-titlebar-right-click"},
66 {"Gtk/DialogsUseHeader", "gtk-dialogs-use-header"},
67 {"Gtk/EnablePrimaryPaste", "gtk-enable-primary-paste"},
68 {"Gtk/PrimaryButtonWarpsSlider", "gtk-primary-button-warps-slider"},
69 {"Gtk/RecentFilesMaxAge", "gtk-recent-files-max-age"},
70 {"Gtk/RecentFilesEnabled", "gtk-recent-files-enabled"},
71 {"Gtk/KeynavUseCaret", "gtk-keynav-use-caret"},
72 {"Gtk/OverlayScrolling", "gtk-overlay-scrolling"},
73
74 /* These are here in order to be recognized, but are not sent to
75 gtk as they are handled internally by gdk: */
76 {"Gdk/WindowScalingFactor", "gdk-window-scaling-factor"},
77 {"Gdk/UnscaledDPI", "gdk-unscaled-dpi"}
78 };
79
80 static const char *
81 gdk_from_xsettings_name (const char *xname)
82 {
83 static GHashTable *hash = NULL;
84 guint i;
85
86 if (G_UNLIKELY (hash == NULL))
87 {
88 hash = g_hash_table_new (g_str_hash, g_str_equal);
89
90 for (i = 0; i < G_N_ELEMENTS (gdk_settings_map); i++)
91 g_hash_table_insert (hash, (gpointer)gdk_settings_map[i].xname,
92 (gpointer)gdk_settings_map[i].gdkname);
93 }
94
95 return g_hash_table_lookup (hash, xname);
96 }
97