projects/package-update-indicator

diff pui-settings.c @ 52:707e9e3deeac

Do not hardcode pkg-config

Using a macro allows passing a different executable in case of
cross-compilation.
author Helmut Grohne <helmut@subdivi.de>
date Sat Dec 12 01:08:21 2020 -0500 (13 months ago)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/pui-settings.c	Sat Dec 12 01:08:21 2020 -0500
     1.3 @@ -0,0 +1,46 @@
     1.4 +/*
     1.5 + * Copyright (C) 2018 Guido Berhoerster <guido+pui@berhoerster.name>
     1.6 + *
     1.7 + * Permission is hereby granted, free of charge, to any person obtaining
     1.8 + * a copy of this software and associated documentation files (the
     1.9 + * "Software"), to deal in the Software without restriction, including
    1.10 + * without limitation the rights to use, copy, modify, merge, publish,
    1.11 + * distribute, sublicense, and/or sell copies of the Software, and to
    1.12 + * permit persons to whom the Software is furnished to do so, subject to
    1.13 + * the following conditions:
    1.14 + *
    1.15 + * The above copyright notice and this permission notice shall be included
    1.16 + * in all copies or substantial portions of the Software.
    1.17 + *
    1.18 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    1.19 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    1.20 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    1.21 + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    1.22 + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    1.23 + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    1.24 + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    1.25 + */
    1.26 +
    1.27 +#define	G_SETTINGS_ENABLE_BACKEND
    1.28 +#include <gio/gsettingsbackend.h>
    1.29 +
    1.30 +#include "pui-settings.h"
    1.31 +
    1.32 +#define	SETTINGS_ROOT_PATH \
    1.33 +    "/org/guido-berhoerster/code/package-update-indicator/"
    1.34 +#define	SETTINGS_ROOT_GROUP	"General"
    1.35 +
    1.36 +GSettings *
    1.37 +pui_settings_new(void)
    1.38 +{
    1.39 +	gchar		*settings_filename;
    1.40 +	GSettingsBackend *settings_backend;
    1.41 +
    1.42 +	settings_filename = g_build_filename(g_get_user_config_dir(), PACKAGE,
    1.43 +	    PACKAGE ".conf", NULL);
    1.44 +	settings_backend = g_keyfile_settings_backend_new(settings_filename,
    1.45 +	    SETTINGS_ROOT_PATH, SETTINGS_ROOT_GROUP);
    1.46 +
    1.47 +	return (g_settings_new_with_backend(SETTINGS_SCHEMA_ID,
    1.48 +	    settings_backend));
    1.49 +}