Tidy up GSettings

This commit is contained in:
Přemysl Eric Janouch 2022-07-25 13:30:27 +02:00
parent 6df51485d3
commit 9003f36ba2
Signed by: p
GPG Key ID: A0420B94F92B9493
5 changed files with 11 additions and 9 deletions

View File

@ -9,6 +9,7 @@ option (OPTION_GTKDOC "For developers only--enable use of gtk-doc" OFF)
option (BUILD_TESTING "Build tests" OFF) option (BUILD_TESTING "Build tests" OFF)
# Project information # Project information
set (project_ID "name.janouch.${PROJECT_NAME}")
set (project_URL "https://git.janouch.name/p/logdiag") set (project_URL "https://git.janouch.name/p/logdiag")
# For custom modules # For custom modules
@ -245,7 +246,7 @@ if (NOT GLIB_COMPILE_SCHEMAS_EXECUTABLE)
endif () endif ()
set (GSETTINGS_DIR "${PROJECT_SOURCE_DIR}/share") set (GSETTINGS_DIR "${PROJECT_SOURCE_DIR}/share")
set (GSETTINGS_SCHEMAS "${GSETTINGS_DIR}/org.logdiag.gschema.xml") set (GSETTINGS_SCHEMAS "${GSETTINGS_DIR}/${PROJECT_NAME}.gschema.xml")
if (OPTION_NOINSTALL) if (OPTION_NOINSTALL)
set (GSETTINGS_COMPILED_SCHEMA "${PROJECT_BINARY_DIR}/gschemas.compiled") set (GSETTINGS_COMPILED_SCHEMA "${PROJECT_BINARY_DIR}/gschemas.compiled")
@ -391,7 +392,8 @@ endif ()
install (DIRECTORY docs/user-guide DESTINATION share/doc/${PROJECT_NAME}) install (DIRECTORY docs/user-guide DESTINATION share/doc/${PROJECT_NAME})
install (DIRECTORY share/library DESTINATION share/${PROJECT_NAME}) install (DIRECTORY share/library DESTINATION share/${PROJECT_NAME})
install (FILES ${GSETTINGS_SCHEMAS} DESTINATION share/glib-2.0/schemas) install (FILES ${GSETTINGS_SCHEMAS} DESTINATION share/glib-2.0/schemas
RENAME "${project_ID}.gschema.xml")
install (CODE " # DESTDIR is not in use on Windows (WIN32 is only native here!) install (CODE " # DESTDIR is not in use on Windows (WIN32 is only native here!)
if (WIN32 OR \"\$ENV{DESTDIR}\" STREQUAL \"\") if (WIN32 OR \"\$ENV{DESTDIR}\" STREQUAL \"\")
execute_process (COMMAND \"${GLIB_COMPILE_SCHEMAS_EXECUTABLE}\" execute_process (COMMAND \"${GLIB_COMPILE_SCHEMAS_EXECUTABLE}\"

View File

@ -10,6 +10,7 @@
#define PROJECT_NAME "${PROJECT_NAME}" #define PROJECT_NAME "${PROJECT_NAME}"
#define PROJECT_VERSION "${PROJECT_VERSION}" #define PROJECT_VERSION "${PROJECT_VERSION}"
#define PROJECT_ID "${project_ID}"
#define PROJECT_URL "${project_URL}" #define PROJECT_URL "${project_URL}"
#cmakedefine OPTION_NOINSTALL #cmakedefine OPTION_NOINSTALL

View File

@ -1,5 +1,5 @@
<schemalist> <schemalist>
<schema id="org.logdiag" path="/org/logdiag/" gettext-domain="logdiag"> <schema id="name.janouch.logdiag" path="/name/janouch/logdiag/" gettext-domain="logdiag">
<key name="show-main-toolbar" type="b"> <key name="show-main-toolbar" type="b">
<default>true</default> <default>true</default>
<summary>Whether to show the main toolbar</summary> <summary>Whether to show the main toolbar</summary>
@ -14,4 +14,3 @@
</key> </key>
</schema> </schema>
</schemalist> </schemalist>

View File

@ -389,7 +389,7 @@ ld_window_main_init (LdWindowMain *self)
gtk_widget_show_all (GTK_WIDGET (self)); gtk_widget_show_all (GTK_WIDGET (self));
/* Set up GSettings. */ /* Set up GSettings. */
priv->settings = g_settings_new ("org." PROJECT_NAME); priv->settings = g_settings_new (PROJECT_ID);
g_settings_bind (priv->settings, "show-main-toolbar", g_settings_bind (priv->settings, "show-main-toolbar",
gtk_action_group_get_action (priv->action_group, gtk_action_group_get_action (priv->action_group,

View File

@ -127,16 +127,16 @@ main (int argc, char *argv[])
textdomain (GETTEXT_DOMAIN); textdomain (GETTEXT_DOMAIN);
#ifdef PROJECT_GSETTINGS_DIR #ifdef PROJECT_GSETTINGS_DIR
/* This is enabled when the build is set up for developing, so that the /* This is enabled when the build is set up for development,
* application can find its schema. It might also find use when * so that the application can find its schema. It might also find use
* installing the application into a location that's missing from * when installing the application into a location that's missing from
* g_get_system_data_dirs(), for example /usr/local or ~/.local. * g_get_system_data_dirs(), for example /usr/local or ~/.local.
*/ */
g_setenv ("GSETTINGS_SCHEMA_DIR", PROJECT_GSETTINGS_DIR, 0); g_setenv ("GSETTINGS_SCHEMA_DIR", PROJECT_GSETTINGS_DIR, 0);
#endif /* PROJECT_GSETTINGS_DIR */ #endif /* PROJECT_GSETTINGS_DIR */
#ifdef _WIN32 #ifdef _WIN32
/* Don't be unneccessarily limited by the system ANSI codepage. */ /* Don't be unneccessarily limited by the system's ANSI codepage. */
/* g_win32_get_command_line() should replace this code for GLib >= 2.40. */ /* g_win32_get_command_line() should replace this code for GLib >= 2.40. */
argv_overriden = get_utf8_args (&argc, &argv); argv_overriden = get_utf8_args (&argc, &argv);
if (argv_overriden) if (argv_overriden)