From 9003f36ba25426aa28db505384cc50b426e6505b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Mon, 25 Jul 2022 13:30:27 +0200 Subject: Tidy up GSettings --- CMakeLists.txt | 6 ++++-- config.h.in | 1 + share/logdiag.gschema.xml | 16 ++++++++++++++++ share/org.logdiag.gschema.xml | 17 ----------------- src/ld-window-main.c | 2 +- src/logdiag.c | 8 ++++---- 6 files changed, 26 insertions(+), 24 deletions(-) create mode 100644 share/logdiag.gschema.xml delete mode 100644 share/org.logdiag.gschema.xml diff --git a/CMakeLists.txt b/CMakeLists.txt index 3518f5e..a09368b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ option (OPTION_GTKDOC "For developers only--enable use of gtk-doc" OFF) option (BUILD_TESTING "Build tests" OFF) # Project information +set (project_ID "name.janouch.${PROJECT_NAME}") set (project_URL "https://git.janouch.name/p/logdiag") # For custom modules @@ -245,7 +246,7 @@ if (NOT GLIB_COMPILE_SCHEMAS_EXECUTABLE) endif () 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) 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 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!) if (WIN32 OR \"\$ENV{DESTDIR}\" STREQUAL \"\") execute_process (COMMAND \"${GLIB_COMPILE_SCHEMAS_EXECUTABLE}\" diff --git a/config.h.in b/config.h.in index e7c7e5d..3f1214a 100644 --- a/config.h.in +++ b/config.h.in @@ -10,6 +10,7 @@ #define PROJECT_NAME "${PROJECT_NAME}" #define PROJECT_VERSION "${PROJECT_VERSION}" +#define PROJECT_ID "${project_ID}" #define PROJECT_URL "${project_URL}" #cmakedefine OPTION_NOINSTALL diff --git a/share/logdiag.gschema.xml b/share/logdiag.gschema.xml new file mode 100644 index 0000000..0020369 --- /dev/null +++ b/share/logdiag.gschema.xml @@ -0,0 +1,16 @@ + + + + true + Whether to show the main toolbar + + + true + Whether to show the library pane + + + true + Whether to show the grid + + + diff --git a/share/org.logdiag.gschema.xml b/share/org.logdiag.gschema.xml deleted file mode 100644 index 71131d4..0000000 --- a/share/org.logdiag.gschema.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - true - Whether to show the main toolbar - - - true - Whether to show the library pane - - - true - Whether to show the grid - - - - diff --git a/src/ld-window-main.c b/src/ld-window-main.c index 7acd319..3d78993 100644 --- a/src/ld-window-main.c +++ b/src/ld-window-main.c @@ -389,7 +389,7 @@ ld_window_main_init (LdWindowMain *self) gtk_widget_show_all (GTK_WIDGET (self)); /* 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", gtk_action_group_get_action (priv->action_group, diff --git a/src/logdiag.c b/src/logdiag.c index f5a891f..4f25aea 100644 --- a/src/logdiag.c +++ b/src/logdiag.c @@ -127,16 +127,16 @@ main (int argc, char *argv[]) textdomain (GETTEXT_DOMAIN); #ifdef PROJECT_GSETTINGS_DIR - /* This is enabled when the build is set up for developing, so that the - * application can find its schema. It might also find use when - * installing the application into a location that's missing from + /* This is enabled when the build is set up for development, + * so that the application can find its schema. It might also find use + * when installing the application into a location that's missing from * g_get_system_data_dirs(), for example /usr/local or ~/.local. */ g_setenv ("GSETTINGS_SCHEMA_DIR", PROJECT_GSETTINGS_DIR, 0); #endif /* PROJECT_GSETTINGS_DIR */ #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. */ argv_overriden = get_utf8_args (&argc, &argv); if (argv_overriden) -- cgit v1.2.3