mir: clean up an ugly function

This commit is contained in:
William Hua
2017-04-03 12:59:50 -04:00
parent efbe40214b
commit 6e711beb0b

View File

@ -901,178 +901,93 @@ setting_changed (GSettings *settings,
g_free (schema_id); g_free (schema_id);
} }
static gboolean static const gchar * const KNOWN_SETTINGS[] =
is_known_setting (const gchar *name)
{ {
if (!g_strcmp0 (name, "gtk-double-click-time")) "gtk-double-click-time",
return TRUE; "gtk-double-click-distance",
if (!g_strcmp0 (name, "gtk-double-click-distance")) "gtk-cursor-blink",
return TRUE; "gtk-cursor-blink-time",
if (!g_strcmp0 (name, "gtk-cursor-blink")) "gtk-cursor-blink-timeout",
return TRUE; "gtk-split-cursor",
if (!g_strcmp0 (name, "gtk-cursor-blink-time")) "gtk-theme-name",
return TRUE; "gtk-icon-theme-name",
if (!g_strcmp0 (name, "gtk-cursor-blink-timeout")) "gtk-fallback-icon-theme",
return TRUE; "gtk-key-theme-name",
if (!g_strcmp0 (name, "gtk-split-cursor")) "gtk-menu-bar-accel",
return TRUE; "gtk-dnd-drag-threshold",
if (!g_strcmp0 (name, "gtk-theme-name")) "gtk-font-name",
return TRUE; "gtk-icon-sizes",
if (!g_strcmp0 (name, "gtk-icon-theme-name")) "gtk-modules",
return TRUE; "gtk-xft-antialias",
if (!g_strcmp0 (name, "gtk-fallback-icon-theme")) "gtk-xft-hinting",
return TRUE; "gtk-xft-hintstyle",
if (!g_strcmp0 (name, "gtk-key-theme-name")) "gtk-xft-rgba",
return TRUE; "gtk-xft-dpi",
if (!g_strcmp0 (name, "gtk-menu-bar-accel")) "gtk-cursor-theme-name",
return TRUE; "gtk-cursor-theme-size",
if (!g_strcmp0 (name, "gtk-dnd-drag-threshold")) "gtk-alternative-button-order",
return TRUE; "gtk-alternative-sort-arrows",
if (!g_strcmp0 (name, "gtk-font-name")) "gtk-show-input-method-menu",
return TRUE; "gtk-show-unicode-menu",
if (!g_strcmp0 (name, "gtk-icon-sizes")) "gtk-timeout-initial",
return TRUE; "gtk-timeout-repeat",
if (!g_strcmp0 (name, "gtk-modules")) "gtk-timeout-expand",
return TRUE; "gtk-color-scheme",
if (!g_strcmp0 (name, "gtk-xft-antialias")) "gtk-enable-animations",
return TRUE; "gtk-touchscreen-mode",
if (!g_strcmp0 (name, "gtk-xft-hinting")) "gtk-tooltip-timeout",
return TRUE; "gtk-tooltip-browse-timeout",
if (!g_strcmp0 (name, "gtk-xft-hintstyle")) "gtk-tooltip-browse-mode-timeout",
return TRUE; "gtk-keynav-cursor-only",
if (!g_strcmp0 (name, "gtk-xft-rgba")) "gtk-keynav-wrap-around",
return TRUE; "gtk-error-bell",
if (!g_strcmp0 (name, "gtk-xft-dpi")) "color-hash",
return TRUE; "gtk-file-chooser-backend",
if (!g_strcmp0 (name, "gtk-cursor-theme-name")) "gtk-print-backends",
return TRUE; "gtk-print-preview-command",
if (!g_strcmp0 (name, "gtk-cursor-theme-size")) "gtk-enable-mnemonics",
return TRUE; "gtk-enable-accels",
if (!g_strcmp0 (name, "gtk-alternative-button-order")) "gtk-recent-files-limit",
return TRUE; "gtk-im-module",
if (!g_strcmp0 (name, "gtk-alternative-sort-arrows")) "gtk-recent-files-max-age",
return TRUE; "gtk-fontconfig-timestamp",
if (!g_strcmp0 (name, "gtk-show-input-method-menu")) "gtk-sound-theme-name",
return TRUE; "gtk-enable-input-feedback-sounds",
if (!g_strcmp0 (name, "gtk-show-unicode-menu")) "gtk-enable-event-sounds",
return TRUE; "gtk-enable-tooltips",
if (!g_strcmp0 (name, "gtk-timeout-initial")) "gtk-toolbar-style",
return TRUE; "gtk-toolbar-icon-size",
if (!g_strcmp0 (name, "gtk-timeout-repeat")) "gtk-auto-mnemonics",
return TRUE; "gtk-primary-button-warps-slider",
if (!g_strcmp0 (name, "gtk-timeout-expand")) "gtk-visible-focus",
return TRUE; "gtk-application-prefer-dark-theme",
if (!g_strcmp0 (name, "gtk-color-scheme")) "gtk-button-images",
return TRUE; "gtk-entry-select-on-focus",
if (!g_strcmp0 (name, "gtk-enable-animations")) "gtk-entry-password-hint-timeout",
return TRUE; "gtk-menu-images",
if (!g_strcmp0 (name, "gtk-touchscreen-mode")) "gtk-menu-bar-popup-delay",
return TRUE; "gtk-scrolled-window-placement",
if (!g_strcmp0 (name, "gtk-tooltip-timeout")) "gtk-can-change-accels",
return TRUE; "gtk-menu-popup-delay",
if (!g_strcmp0 (name, "gtk-tooltip-browse-timeout")) "gtk-menu-popdown-delay",
return TRUE; "gtk-label-select-on-focus",
if (!g_strcmp0 (name, "gtk-tooltip-browse-mode-timeout")) "gtk-color-palette",
return TRUE; "gtk-im-preedit-style",
if (!g_strcmp0 (name, "gtk-keynav-cursor-only")) "gtk-im-status-style",
return TRUE; "gtk-shell-shows-app-menu",
if (!g_strcmp0 (name, "gtk-keynav-wrap-around")) "gtk-shell-shows-menubar",
return TRUE; "gtk-shell-shows-desktop",
if (!g_strcmp0 (name, "gtk-error-bell")) "gtk-decoration-layout",
return TRUE; "gtk-titlebar-double-click",
if (!g_strcmp0 (name, "color-hash")) "gtk-titlebar-middle-click",
return TRUE; "gtk-titlebar-right-click",
if (!g_strcmp0 (name, "gtk-file-chooser-backend")) "gtk-dialogs-use-header",
return TRUE; "gtk-enable-primary-paste",
if (!g_strcmp0 (name, "gtk-print-backends")) "gtk-recent-files-enabled",
return TRUE; "gtk-long-press-time",
if (!g_strcmp0 (name, "gtk-print-preview-command")) "gtk-keynav-use-caret",
return TRUE; NULL
if (!g_strcmp0 (name, "gtk-enable-mnemonics")) };
return TRUE;
if (!g_strcmp0 (name, "gtk-enable-accels"))
return TRUE;
if (!g_strcmp0 (name, "gtk-recent-files-limit"))
return TRUE;
if (!g_strcmp0 (name, "gtk-im-module"))
return TRUE;
if (!g_strcmp0 (name, "gtk-recent-files-max-age"))
return TRUE;
if (!g_strcmp0 (name, "gtk-fontconfig-timestamp"))
return TRUE;
if (!g_strcmp0 (name, "gtk-sound-theme-name"))
return TRUE;
if (!g_strcmp0 (name, "gtk-enable-input-feedback-sounds"))
return TRUE;
if (!g_strcmp0 (name, "gtk-enable-event-sounds"))
return TRUE;
if (!g_strcmp0 (name, "gtk-enable-tooltips"))
return TRUE;
if (!g_strcmp0 (name, "gtk-toolbar-style"))
return TRUE;
if (!g_strcmp0 (name, "gtk-toolbar-icon-size"))
return TRUE;
if (!g_strcmp0 (name, "gtk-auto-mnemonics"))
return TRUE;
if (!g_strcmp0 (name, "gtk-primary-button-warps-slider"))
return TRUE;
if (!g_strcmp0 (name, "gtk-visible-focus"))
return TRUE;
if (!g_strcmp0 (name, "gtk-application-prefer-dark-theme"))
return TRUE;
if (!g_strcmp0 (name, "gtk-button-images"))
return TRUE;
if (!g_strcmp0 (name, "gtk-entry-select-on-focus"))
return TRUE;
if (!g_strcmp0 (name, "gtk-entry-password-hint-timeout"))
return TRUE;
if (!g_strcmp0 (name, "gtk-menu-images"))
return TRUE;
if (!g_strcmp0 (name, "gtk-menu-bar-popup-delay"))
return TRUE;
if (!g_strcmp0 (name, "gtk-scrolled-window-placement"))
return TRUE;
if (!g_strcmp0 (name, "gtk-can-change-accels"))
return TRUE;
if (!g_strcmp0 (name, "gtk-menu-popup-delay"))
return TRUE;
if (!g_strcmp0 (name, "gtk-menu-popdown-delay"))
return TRUE;
if (!g_strcmp0 (name, "gtk-label-select-on-focus"))
return TRUE;
if (!g_strcmp0 (name, "gtk-color-palette"))
return TRUE;
if (!g_strcmp0 (name, "gtk-im-preedit-style"))
return TRUE;
if (!g_strcmp0 (name, "gtk-im-status-style"))
return TRUE;
if (!g_strcmp0 (name, "gtk-shell-shows-app-menu"))
return TRUE;
if (!g_strcmp0 (name, "gtk-shell-shows-menubar"))
return TRUE;
if (!g_strcmp0 (name, "gtk-shell-shows-desktop"))
return TRUE;
if (!g_strcmp0 (name, "gtk-decoration-layout"))
return TRUE;
if (!g_strcmp0 (name, "gtk-titlebar-double-click"))
return TRUE;
if (!g_strcmp0 (name, "gtk-titlebar-middle-click"))
return TRUE;
if (!g_strcmp0 (name, "gtk-titlebar-right-click"))
return TRUE;
if (!g_strcmp0 (name, "gtk-dialogs-use-header"))
return TRUE;
if (!g_strcmp0 (name, "gtk-enable-primary-paste"))
return TRUE;
if (!g_strcmp0 (name, "gtk-recent-files-enabled"))
return TRUE;
if (!g_strcmp0 (name, "gtk-long-press-time"))
return TRUE;
if (!g_strcmp0 (name, "gtk-keynav-use-caret"))
return TRUE;
return FALSE;
}
static gboolean static gboolean
gdk_mir_screen_get_setting (GdkScreen *screen, gdk_mir_screen_get_setting (GdkScreen *screen,
@ -1092,7 +1007,7 @@ gdk_mir_screen_get_setting (GdkScreen *screen,
if (!variant) if (!variant)
{ {
if (!is_known_setting (name)) if (!g_strv_contains (KNOWN_SETTINGS, name))
g_warning ("unknown setting: %s", name); g_warning ("unknown setting: %s", name);
return FALSE; return FALSE;