projects/package-update-indicator

changeset 1:2f04ec9e0506

Add preferences application

Split settings into separate file.
author Guido Berhoerster <guido+pui@berhoerster.name>
date Fri Jun 08 08:38:42 2018 +0200 (2018-06-08)
parents 6884bb8130ca
children 7172a0db97af
files Makefile org.guido-berhoerster.code.package-update-indicator.preferences.desktop.in package-update-indicator-prefs.1.xml package-update-indicator-prefs.c package-update-indicator.1.xml po/POTFILES.in pui-application.c pui-prefs-application.c pui-prefs-application.h pui-prefs-window.ui pui-prefs.gresource.xml pui-settings.c pui-settings.h
line diff
     1.1 --- a/Makefile	Sun May 20 11:32:57 2018 +0200
     1.2 +++ b/Makefile	Fri Jun 08 08:38:42 2018 +0200
     1.3 @@ -23,6 +23,7 @@
     1.4  
     1.5  PACKAGE =	package-update-indicator
     1.6  APPLICATION_ID = org.guido-berhoerster.code.package-update-indicator
     1.7 +PREFS_APPLICATION_ID = org.guido-berhoerster.code.package-update-indicator.preferences
     1.8  VERSION =	1
     1.9  DISTNAME =	$(PACKAGE)-$(VERSION)
    1.10  AUTHOR =	Guido Berhoerster
    1.11 @@ -48,6 +49,7 @@
    1.12  GZIP :=		gzip
    1.13  SED :=		sed
    1.14  GLIB_COMPILE_SCHEMAS := $(shell pkg-config --variable=glib_compile_schemas gio-2.0)
    1.15 +GLIB_COMPILE_RESOURCES := $(shell pkg-config --variable=glib_compile_resources gio-2.0)
    1.16  XSLTPROC :=	xsltproc
    1.17  DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
    1.18  DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \
    1.19 @@ -91,32 +93,45 @@
    1.20  localedir ?=	$(datadir)/locale
    1.21  sysconfdir ?=	/etc
    1.22  xdgautostartdir ?= $(sysconfdir)/xdg/autostart
    1.23 +xdgapplicationsdir ?= $(datadir)/applications
    1.24  
    1.25  OS_NAME :=	$(shell uname -s)
    1.26  OS_RELEASE :=	$(shell uname -r)
    1.27  
    1.28 -OBJS =		package-update-indicator.o \
    1.29 +$(PACKAGE)_OBJS = package-update-indicator.o \
    1.30  		pui-application.o \
    1.31  		pui-backend.o \
    1.32  		pui-get-updates.o \
    1.33 +		pui-settings.o \
    1.34  		pui-types.o
    1.35  
    1.36 +$(PACKAGE)-prefs_OBJS = package-update-indicator-prefs.o \
    1.37 +		pui-prefs-application.o \
    1.38 +		pui-settings.o \
    1.39 +		pui-prefs-resources.o
    1.40 +
    1.41 +OBJS = $($(PACKAGE)_OBJS) $($(PACKAGE)-prefs_OBJS)
    1.42 +
    1.43  GSETTINGS_SCHEMAS = $(APPLICATION_ID).gschema.xml
    1.44  
    1.45 -AUTOSTART_FILES = $(APPLICATION_ID).desktop
    1.46 +GRESOURCE_FILES = pui-prefs.gresource.xml
    1.47 +
    1.48 +AUTOSTART_FILE = $(APPLICATION_ID).desktop
    1.49 +
    1.50 +DESKTOP_FILES = $(PREFS_APPLICATION_ID).desktop
    1.51  
    1.52  LINGUAS :=	$(shell sed 's/\#.*//' po/LINGUAS)
    1.53  MOFILES :=	$(patsubst %,po/%.mo,$(LINGUAS))
    1.54  POTFILES_IN :=	$(shell sed 's/\#.*//' po/POTFILES.in)
    1.55  POTFILE =	po/$(PACKAGE).pot
    1.56  
    1.57 -MANPAGES =	$(PACKAGE).1
    1.58 +MANPAGES =	$(PACKAGE).1 $(PACKAGE)-prefs.1
    1.59  
    1.60  .DEFAULT_TARGET = all
    1.61  
    1.62  .PHONY: all pot update-po clean clobber dist install
    1.63  
    1.64 -all: $(PACKAGE) $(AUTOSTART_FILES) $(MOFILES) $(MANPAGES)
    1.65 +all: $(PACKAGE) $(PACKAGE)-prefs $(AUTOSTART_FILE) $(DESKTOP_FILES) $(MOFILES) $(MANPAGES)
    1.66  
    1.67  $(PACKAGE): XCPPFLAGS =	-DPACKAGE=\"$(PACKAGE)\" \
    1.68  			-DAPPLICATION_ID=\"$(APPLICATION_ID)\" \
    1.69 @@ -124,12 +139,23 @@
    1.70  			-DG_LOG_DOMAIN=\"$(PACKAGE)\" \
    1.71  			-DPACKAGE_LOCALE_DIR="\"$(localedir)\"" \
    1.72  			-DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
    1.73 +			-DSETTINGS_SCHEMA_ID=\"$(APPLICATION_ID)\" \
    1.74  			-DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE
    1.75  $(PACKAGE): XCFLAGS =	$(shell pkg-config --cflags gtk+-3.0 \
    1.76  			    appindicator3-0.1 packagekit-glib2)
    1.77  $(PACKAGE): LDLIBS =	$(shell pkg-config --libs gtk+-3.0 \
    1.78  			    appindicator3-0.1 packagekit-glib2)
    1.79  
    1.80 +$(PACKAGE)-prefs: XCPPFLAGS = -DPACKAGE=\"$(PACKAGE)\" \
    1.81 +			-DAPPLICATION_ID=\"$(PREFS_APPLICATION_ID)\" \
    1.82 +			-DVERSION=\"$(VERSION)\" \
    1.83 +			-DG_LOG_DOMAIN=\"$(PACKAGE)\" \
    1.84 +			-DPACKAGE_LOCALE_DIR="\"$(localedir)\"" \
    1.85 +			-DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
    1.86 +			-DSETTINGS_SCHEMA_ID=\"$(APPLICATION_ID)\"
    1.87 +$(PACKAGE)-prefs: XCFLAGS = $(shell pkg-config --cflags gtk+-3.0)
    1.88 +$(PACKAGE)-prefs: LDLIBS = $(shell pkg-config --libs gtk+-3.0)
    1.89 +
    1.90  ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly OpenBSD),)
    1.91    $(PACKAGE): XCPPFLAGS +=	-I/usr/local/include
    1.92    $(PACKAGE): XLDFLAGS +=	-L/usr/local/lib
    1.93 @@ -141,9 +167,19 @@
    1.94    $(PACKAGE): XCPPFLAGS +=	-D_XOPEN_SOURCE=600
    1.95  endif
    1.96  
    1.97 -$(PACKAGE): $(OBJS)
    1.98 +$(PACKAGE): $($(PACKAGE)_OBJS)
    1.99  	$(LINK.o) $^ $(LDLIBS) -o $@
   1.100  
   1.101 +$(PACKAGE)-prefs: $($(PACKAGE)-prefs_OBJS)
   1.102 +	$(LINK.o) $^ $(LDLIBS) -o $@
   1.103 +
   1.104 +%-resources.c: %.gresource.xml
   1.105 +	$(GLIB_COMPILE_RESOURCES) --generate-dependencies $< | \
   1.106 +	    while read -r resource_file; do \
   1.107 +	        printf '%s: %s\n' $@ "$${resource_file}"; \
   1.108 +	    done
   1.109 +	$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=. --generate-source $<
   1.110 +
   1.111  $(POTFILE): po/POTFILES.in $(POTFILES_IN)
   1.112  	$(XGETTEXT) $(XGETTEXT_OPTIONS) --files-from $< --output $@
   1.113  
   1.114 @@ -168,15 +204,19 @@
   1.115  
   1.116  install: all
   1.117  	$(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)"
   1.118 +	$(INSTALL.exec) $(PACKAGE)-prefs \
   1.119 +	    "$(DESTDIR)$(bindir)/$(PACKAGE)-prefs"
   1.120  	for schema in $(GSETTINGS_SCHEMAS); do \
   1.121  	    $(INSTALL.data) $${schema} \
   1.122  	        $(DESTDIR)$(datadir)/glib-2.0/schemas/$${schema}; \
   1.123  	done
   1.124  	[ -n "$(GSETTINGS_SCHEMAS)" ] && \
   1.125  	    $(GLIB_COMPILE_SCHEMAS) $(datadir)/glib-2.0/schemas
   1.126 -	for desktop_file in $(AUTOSTART_FILES); do \
   1.127 +	$(INSTALL.data) $(AUTOSTART_FILE) \
   1.128 +	    $(DESTDIR)$(xdgautostartdir)/$(AUTOSTART_FILE)
   1.129 +	for desktop_file in $(DESKTOP_FILES); do \
   1.130  	    $(INSTALL.data) $${desktop_file} \
   1.131 -	        $(DESTDIR)$(xdgautostartdir)/$${desktop_file}; \
   1.132 +	        $(DESTDIR)$(xdgapplicationsdir)/$${desktop_file}; \
   1.133  	done
   1.134  	for lang in $(LINGUAS); do \
   1.135  	   $(INSTALL.data) po/$${lang}.mo \
   1.136 @@ -188,8 +228,8 @@
   1.137  	done
   1.138  
   1.139  clean:
   1.140 -	rm -f $(PACKAGE) $(OBJS) $(AUTOSTART_FILES) $(POTFILE) $(MOFILES) \
   1.141 -	    $(MANPAGES)
   1.142 +	rm -f $(PACKAGE) $(OBJS) $(AUTOSTART_FILE) $(DESKTOP_FILES) $(POTFILE) \
   1.143 +	    $(MOFILES) $(MANPAGES)
   1.144  
   1.145  clobber: clean
   1.146  	rm -f $(patsubst %.o,%.d,$(OBJS))
   1.147 @@ -202,3 +242,4 @@
   1.148  -include local.mk
   1.149  
   1.150  -include $(patsubst %.o,%.d,$(OBJS))
   1.151 +-include $(patsubst %.gresource.xml,%.gresource.d,$(GRESOURCE_FILES))
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/org.guido-berhoerster.code.package-update-indicator.preferences.desktop.in	Fri Jun 08 08:38:42 2018 +0200
     2.3 @@ -0,0 +1,10 @@
     2.4 +[Desktop Entry]
     2.5 +Name=Package Update Indicator Preferences
     2.6 +GenericName=Package Update Indicator Preferences
     2.7 +Comment=Edit the Preferences for Package Update Indicator
     2.8 +Icon=preferences-other
     2.9 +Exec=package-update-indicator-prefs
    2.10 +Terminal=false
    2.11 +Type=Application
    2.12 +Categories=Settings;PackageManager;GTK;
    2.13 +NotShowIn=GNOME;
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/package-update-indicator-prefs.1.xml	Fri Jun 08 08:38:42 2018 +0200
     3.3 @@ -0,0 +1,106 @@
     3.4 +<?xml version="1.0"?>
     3.5 +<!--
     3.6 +
     3.7 +Copyright (C) 2018 Guido Berhoerster <guido+pui@berhoerster.name>
     3.8 +
     3.9 +Permission is hereby granted, free of charge, to any person obtaining
    3.10 +a copy of this software and associated documentation files (the
    3.11 +"Software"), to deal in the Software without restriction, including
    3.12 +without limitation the rights to use, copy, modify, merge, publish,
    3.13 +distribute, sublicense, and/or sell copies of the Software, and to
    3.14 +permit persons to whom the Software is furnished to do so, subject to
    3.15 +the following conditions:
    3.16 +
    3.17 +The above copyright notice and this permission notice shall be included
    3.18 +in all copies or substantial portions of the Software.
    3.19 +
    3.20 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    3.21 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    3.22 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    3.23 +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    3.24 +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    3.25 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    3.26 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    3.27 +
    3.28 +-->
    3.29 +<refentry xmlns="http://docbook.org/ns/docbook" xml:lang="en">
    3.30 +  <info>
    3.31 +    <author>
    3.32 +      <personname>
    3.33 +        <firstname>Guido</firstname>
    3.34 +        <surname>Berhoerster</surname>
    3.35 +      </personname>
    3.36 +      <email>guido+pui@berhoerster.name</email>
    3.37 +      <personblurb/>
    3.38 +    </author>
    3.39 +    <date>5 June, 2018</date>
    3.40 +  </info>
    3.41 +  <refmeta>
    3.42 +    <refentrytitle>package-update-indicator-prefs</refentrytitle>
    3.43 +    <manvolnum>1</manvolnum>
    3.44 +    <refmiscinfo class="source"/>
    3.45 +    <refmiscinfo class="version"/>
    3.46 +    <refmiscinfo class="manual">User Commands</refmiscinfo>
    3.47 +  </refmeta>
    3.48 +  <refnamediv>
    3.49 +    <refname>package-update-indicator-prefs</refname>
    3.50 +    <refpurpose>edit preferences for package-update-indicator</refpurpose>
    3.51 +  </refnamediv>
    3.52 +  <refsynopsisdiv>
    3.53 +    <cmdsynopsis>
    3.54 +      <command>package-update-indicator-prefs</command>
    3.55 +    </cmdsynopsis>
    3.56 +  </refsynopsisdiv>
    3.57 +  <refsect1>
    3.58 +    <title>Description</title>
    3.59 +    <para>The <command>package-update-indicator-prefs</command> utility can be
    3.60 +    used to edit the preferences for
    3.61 +    <command>package-update-indicator</command>.</para>
    3.62 +  </refsect1>
    3.63 +  <refsect1>
    3.64 +    <title>Preferences</title>
    3.65 +    <variablelist>
    3.66 +      <varlistentry>
    3.67 +        <term>Cache refresh interval</term>
    3.68 +        <listitem>
    3.69 +          <para>The interval in which package metadata is refreshed.</para>
    3.70 +        </listitem>
    3.71 +      </varlistentry>
    3.72 +      <varlistentry>
    3.73 +        <term>Update installer command</term>
    3.74 +        <listitem>
    3.75 +          <para>The command for installing updates.</para>
    3.76 +        </listitem>
    3.77 +      </varlistentry>
    3.78 +    </variablelist>
    3.79 +  </refsect1>
    3.80 +  <refsect1>
    3.81 +    <title>Exit Status</title>
    3.82 +    <para>The following exit values are returned:</para>
    3.83 +    <variablelist>
    3.84 +      <varlistentry>
    3.85 +        <term>0</term>
    3.86 +        <listitem>
    3.87 +          <para>Command successfully executed.</para>
    3.88 +        </listitem>
    3.89 +      </varlistentry>
    3.90 +      <varlistentry>
    3.91 +        <term>1</term>
    3.92 +        <listitem>
    3.93 +          <para>An unspecified error has occured.</para>
    3.94 +        </listitem>
    3.95 +      </varlistentry>
    3.96 +      <varlistentry>
    3.97 +        <term>2</term>
    3.98 +        <listitem>
    3.99 +          <para>Invalid command line options were specified.</para>
   3.100 +        </listitem>
   3.101 +      </varlistentry>
   3.102 +    </variablelist>
   3.103 +  </refsect1>
   3.104 +  <refsect1>
   3.105 +    <title>See Also</title>
   3.106 +    <para><citerefentry><refentrytitle>package-update-indicator</refentrytitle>
   3.107 +      <manvolnum>1</manvolnum></citerefentry></para>
   3.108 +  </refsect1>
   3.109 +</refentry>
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/package-update-indicator-prefs.c	Fri Jun 08 08:38:42 2018 +0200
     4.3 @@ -0,0 +1,52 @@
     4.4 +/*
     4.5 + * Copyright (C) 2018 Guido Berhoerster <guido+pui@berhoerster.name>
     4.6 + *
     4.7 + * Permission is hereby granted, free of charge, to any person obtaining
     4.8 + * a copy of this software and associated documentation files (the
     4.9 + * "Software"), to deal in the Software without restriction, including
    4.10 + * without limitation the rights to use, copy, modify, merge, publish,
    4.11 + * distribute, sublicense, and/or sell copies of the Software, and to
    4.12 + * permit persons to whom the Software is furnished to do so, subject to
    4.13 + * the following conditions:
    4.14 + *
    4.15 + * The above copyright notice and this permission notice shall be included
    4.16 + * in all copies or substantial portions of the Software.
    4.17 + *
    4.18 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    4.19 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    4.20 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    4.21 + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    4.22 + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    4.23 + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    4.24 + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    4.25 + */
    4.26 +
    4.27 +#include <errno.h>
    4.28 +#include <glib/gi18n.h>
    4.29 +#include <gtk/gtk.h>
    4.30 +#include <locale.h>
    4.31 +#include <stdlib.h>
    4.32 +
    4.33 +#include "pui-prefs-application.h"
    4.34 +
    4.35 +int
    4.36 +main(int argc, char *argv[])
    4.37 +{
    4.38 +	int		status;
    4.39 +	PuiPrefsApplication *application;
    4.40 +
    4.41 +	bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
    4.42 +	setlocale(LC_ALL, "");
    4.43 +	bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
    4.44 +	textdomain(GETTEXT_PACKAGE);
    4.45 +
    4.46 +	g_set_application_name(_("Package Update Indicator Preferences"));
    4.47 +
    4.48 +	gtk_init(&argc, &argv);
    4.49 +
    4.50 +	application = pui_prefs_application_new();
    4.51 +	status = g_application_run(G_APPLICATION(application), argc, argv);
    4.52 +	g_object_unref(application);
    4.53 +
    4.54 +	exit(status);
    4.55 +}
     5.1 --- a/package-update-indicator.1.xml	Sun May 20 11:32:57 2018 +0200
     5.2 +++ b/package-update-indicator.1.xml	Fri Jun 08 08:38:42 2018 +0200
     5.3 @@ -33,7 +33,7 @@
     5.4        <email>guido+pui@berhoerster.name</email>
     5.5        <personblurb/>
     5.6      </author>
     5.7 -    <date>25 May, 2018</date>
     5.8 +    <date>5 June, 2018</date>
     5.9    </info>
    5.10    <refmeta>
    5.11      <refentrytitle>package-update-indicator</refentrytitle>
    5.12 @@ -127,4 +127,10 @@
    5.13        </varlistentry>
    5.14      </variablelist>
    5.15    </refsect1>
    5.16 +  <refsect1>
    5.17 +    <title>See Also</title>
    5.18 +    <para><citerefentry>
    5.19 +      <refentrytitle>package-update-indicator-prefs</refentrytitle>
    5.20 +      <manvolnum>1</manvolnum></citerefentry></para>
    5.21 +  </refsect1>
    5.22  </refentry>
     6.1 --- a/po/POTFILES.in	Sun May 20 11:32:57 2018 +0200
     6.2 +++ b/po/POTFILES.in	Fri Jun 08 08:38:42 2018 +0200
     6.3 @@ -1,7 +1,12 @@
     6.4  org.guido-berhoerster.code.package-update-indicator.desktop.in
     6.5  org.guido-berhoerster.code.package-update-indicator.gschema.xml
     6.6 +org.guido-berhoerster.code.package-update-indicator.preferences.desktop.in
     6.7 +package-update-indicator-prefs.c
     6.8  package-update-indicator.c
     6.9  pui-application.c
    6.10  pui-backend.c
    6.11  pui-get-updates.c
    6.12 +pui-prefs-application.c
    6.13 +pui-prefs-window.ui
    6.14 +pui-settings.c
    6.15  pui-types.c
     7.1 --- a/pui-application.c	Sun May 20 11:32:57 2018 +0200
     7.2 +++ b/pui-application.c	Fri Jun 08 08:38:42 2018 +0200
     7.3 @@ -21,21 +21,16 @@
     7.4   * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     7.5   */
     7.6  
     7.7 -#define	G_SETTINGS_ENABLE_BACKEND
     7.8 -#include <gio/gsettingsbackend.h>
     7.9  #include <glib/gi18n.h>
    7.10  #include <libappindicator/app-indicator.h>
    7.11  #include <stdlib.h>
    7.12  #include <string.h>
    7.13  
    7.14 +#include "pui-application.h"
    7.15 +#include "pui-backend.h"
    7.16  #include "pui-common.h"
    7.17 -#include "pui-application.h"
    7.18 +#include "pui-settings.h"
    7.19  #include "pui-types.h"
    7.20 -#include "pui-backend.h"
    7.21 -
    7.22 -#define	SETTINGS_ROOT_PATH \
    7.23 -    "/org/guido-berhoerster/code/package-update-indicator/"
    7.24 -#define	SETTINGS_ROOT_GROUP	"General"
    7.25  
    7.26  struct _PuiApplication {
    7.27  	GApplication	parent_instance;
    7.28 @@ -410,8 +405,6 @@
    7.29  {
    7.30  	PuiApplication	*self = PUI_APPLICATION(application);
    7.31  	gsize		i;
    7.32 -	gchar		*settings_filename;
    7.33 -	GSettingsBackend *settings_backend;
    7.34  	GtkWidget	*menu;
    7.35  	GtkWidget	*menu_item;
    7.36  
    7.37 @@ -428,12 +421,7 @@
    7.38  	}
    7.39  
    7.40  	/* create settings */
    7.41 -	settings_filename = g_build_filename(g_get_user_config_dir(), PACKAGE,
    7.42 -	    PACKAGE ".conf", NULL);
    7.43 -	settings_backend = g_keyfile_settings_backend_new(settings_filename,
    7.44 -	    SETTINGS_ROOT_PATH, SETTINGS_ROOT_GROUP);
    7.45 -	self->settings = g_settings_new_with_backend(APPLICATION_ID,
    7.46 -	    settings_backend);
    7.47 +	self->settings = pui_settings_new();
    7.48  	g_settings_bind(self->settings, "update-command", self,
    7.49  	    "update-command", G_SETTINGS_BIND_GET);
    7.50  
    7.51 @@ -468,9 +456,6 @@
    7.52  
    7.53  	/* keep GApplication running */
    7.54  	g_application_hold(application);
    7.55 -
    7.56 -	g_object_unref(settings_backend);
    7.57 -	g_free(settings_filename);
    7.58  }
    7.59  
    7.60  static void
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/pui-prefs-application.c	Fri Jun 08 08:38:42 2018 +0200
     8.3 @@ -0,0 +1,213 @@
     8.4 +/*
     8.5 + * Copyright (C) 2018 Guido Berhoerster <guido+pui@berhoerster.name>
     8.6 + *
     8.7 + * Permission is hereby granted, free of charge, to any person obtaining
     8.8 + * a copy of this software and associated documentation files (the
     8.9 + * "Software"), to deal in the Software without restriction, including
    8.10 + * without limitation the rights to use, copy, modify, merge, publish,
    8.11 + * distribute, sublicense, and/or sell copies of the Software, and to
    8.12 + * permit persons to whom the Software is furnished to do so, subject to
    8.13 + * the following conditions:
    8.14 + *
    8.15 + * The above copyright notice and this permission notice shall be included
    8.16 + * in all copies or substantial portions of the Software.
    8.17 + *
    8.18 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    8.19 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    8.20 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    8.21 + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    8.22 + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    8.23 + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    8.24 + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    8.25 + */
    8.26 +
    8.27 +#include <glib/gi18n.h>
    8.28 +#include <gio/gio.h>
    8.29 +
    8.30 +#include "pui-prefs-application.h"
    8.31 +#include "pui-settings.h"
    8.32 +
    8.33 +#define	COLUMN_REFRESH_INTERVAL	2
    8.34 +
    8.35 +struct _PuiPrefsApplication {
    8.36 +	GtkApplication	parent_instance;
    8.37 +	GSettings	*settings;
    8.38 +};
    8.39 +
    8.40 +G_DEFINE_TYPE(PuiPrefsApplication, pui_prefs_application, GTK_TYPE_APPLICATION)
    8.41 +
    8.42 +static void	pui_prefs_application_quit(GSimpleAction *, GVariant *,
    8.43 +    gpointer);
    8.44 +
    8.45 +static const GActionEntry pui_prefs_application_actions[] = {
    8.46 +    { "quit", pui_prefs_application_quit }
    8.47 +};
    8.48 +
    8.49 +static void
    8.50 +pui_prefs_application_quit(GSimpleAction *simple, GVariant *parameter,
    8.51 +    gpointer user_data)
    8.52 +{
    8.53 +	PuiPrefsApplication	*self = user_data;
    8.54 +
    8.55 +	g_application_quit(G_APPLICATION(self));
    8.56 +}
    8.57 +
    8.58 +static gboolean
    8.59 +map_refresh_interval_to_index(GValue *value, GVariant *variant,
    8.60 +    gpointer user_data)
    8.61 +{
    8.62 +	GtkTreeModel	*tree_model = user_data;
    8.63 +	guint32		setting_interval;
    8.64 +	gint		index;
    8.65 +	gboolean	iter_continue;
    8.66 +	GtkTreeIter	iter = { 0 };
    8.67 +	GValue		model_value = G_VALUE_INIT;
    8.68 +	guint		model_interval;
    8.69 +
    8.70 +	setting_interval = g_variant_get_uint32(variant);
    8.71 +
    8.72 +	/* try to find a matching entry in the list */
    8.73 +	for (iter_continue = gtk_tree_model_get_iter_first(tree_model, &iter),
    8.74 +	    index = 0; iter_continue;
    8.75 +	    iter_continue = gtk_tree_model_iter_next(tree_model, &iter),
    8.76 +	    index++) {
    8.77 +		gtk_tree_model_get_value(tree_model, &iter,
    8.78 +		    COLUMN_REFRESH_INTERVAL, &model_value);
    8.79 +		model_interval = g_value_get_uint(&model_value);
    8.80 +		g_value_unset(&model_value);
    8.81 +		if (setting_interval == model_interval) {
    8.82 +			g_debug("mapping refresh-interval %" G_GUINT32_FORMAT
    8.83 +			    " to index %d", setting_interval, index);
    8.84 +			g_value_set_int(value, index);
    8.85 +
    8.86 +			return (TRUE);
    8.87 +		}
    8.88 +	}
    8.89 +
    8.90 +	g_debug("mapping refresh-interval %" G_GUINT32_FORMAT " to index -1",
    8.91 +	    setting_interval);
    8.92 +	g_value_set_int(value, -1);
    8.93 +
    8.94 +	return (TRUE);
    8.95 +}
    8.96 +
    8.97 +static GVariant *
    8.98 +map_index_to_refresh_interval(const GValue *value,
    8.99 +    const GVariantType *expected_type, gpointer user_data)
   8.100 +{
   8.101 +	GtkTreeModel	*tree_model = GTK_TREE_MODEL(user_data);
   8.102 +	gint		index;
   8.103 +	GtkTreeIter	iter = { 0 };
   8.104 +	GValue		model_value = G_VALUE_INIT;
   8.105 +	guint		model_interval;
   8.106 +
   8.107 +	index = g_value_get_int(value);
   8.108 +	if (!gtk_tree_model_iter_nth_child(tree_model, &iter, NULL, index)) {
   8.109 +		return (NULL);
   8.110 +	}
   8.111 +
   8.112 +	gtk_tree_model_get_value(tree_model, &iter, COLUMN_REFRESH_INTERVAL,
   8.113 +	    &model_value);
   8.114 +	model_interval = g_value_get_uint(&model_value);
   8.115 +	g_debug("mapping index %d to refresh-interval value %" G_GUINT32_FORMAT,
   8.116 +	    index, model_interval);
   8.117 +	g_value_unset(&model_value);
   8.118 +
   8.119 +	return (g_variant_new_uint32(model_interval));
   8.120 +}
   8.121 +
   8.122 +static void
   8.123 +pui_prefs_application_startup(GApplication *application)
   8.124 +{
   8.125 +	PuiPrefsApplication *self = PUI_PREFS_APPLICATION(application);
   8.126 +	GApplicationClass *application_class =
   8.127 +	    G_APPLICATION_CLASS(pui_prefs_application_parent_class);
   8.128 +	GtkBuilder	*builder;
   8.129 +	GtkWidget	*window;
   8.130 +	GtkTreeModel	*tree_model;
   8.131 +	GtkWidget	*update_command_entry;
   8.132 +	GtkWidget	*refresh_interval_combo_box;
   8.133 +
   8.134 +	application_class->startup(application);
   8.135 +
   8.136 +	/* create actions */
   8.137 +	g_action_map_add_action_entries(G_ACTION_MAP(self),
   8.138 +	    pui_prefs_application_actions,
   8.139 +	    G_N_ELEMENTS(pui_prefs_application_actions), self);
   8.140 +
   8.141 +	/* get widgets from builder */
   8.142 +	builder = gtk_builder_new_from_resource("/org/guido-berhoerster/code/"
   8.143 +	    "package-update-indicator/preferences/pui-prefs-window.ui");
   8.144 +	window = GTK_WIDGET(gtk_builder_get_object(builder, "window"));
   8.145 +	gtk_application_add_window(GTK_APPLICATION(self), GTK_WINDOW(window));
   8.146 +	update_command_entry = GTK_WIDGET(gtk_builder_get_object(builder,
   8.147 +	    "update-command"));
   8.148 +	refresh_interval_combo_box = GTK_WIDGET(gtk_builder_get_object(builder,
   8.149 +	    "refresh-interval"));
   8.150 +	tree_model =
   8.151 +	    gtk_combo_box_get_model(GTK_COMBO_BOX(refresh_interval_combo_box));
   8.152 +
   8.153 +	/* bind settings to widgets */
   8.154 +	self->settings = pui_settings_new();
   8.155 +	g_settings_bind(self->settings, "update-command",
   8.156 +	    update_command_entry, "text", G_SETTINGS_BIND_DEFAULT);
   8.157 +	g_settings_bind_with_mapping(self->settings, "refresh-interval",
   8.158 +	    refresh_interval_combo_box, "active", G_SETTINGS_BIND_DEFAULT,
   8.159 +	    map_refresh_interval_to_index, map_index_to_refresh_interval,
   8.160 +	    tree_model, NULL);
   8.161 +
   8.162 +	/* show window */
   8.163 +	gtk_widget_show(window);
   8.164 +	gtk_window_present(GTK_WINDOW(window));
   8.165 +
   8.166 +	g_object_unref(builder);
   8.167 +}
   8.168 +
   8.169 +static void
   8.170 +pui_prefs_application_activate(GApplication *application) {
   8.171 +	GtkApplication	*gtk_application = GTK_APPLICATION(application);
   8.172 +	GApplicationClass *application_class =
   8.173 +	    G_APPLICATION_CLASS(pui_prefs_application_parent_class);
   8.174 +
   8.175 +	/* raise window when activated */
   8.176 +	gtk_window_present(gtk_application_get_active_window(gtk_application));
   8.177 +
   8.178 +	application_class->activate(application);
   8.179 +}
   8.180 +
   8.181 +static void
   8.182 +pui_prefs_application_dispose(GObject *object)
   8.183 +{
   8.184 +	PuiPrefsApplication *self = PUI_PREFS_APPLICATION(object);
   8.185 +
   8.186 +	if (self->settings != NULL) {
   8.187 +		g_clear_object(&self->settings);
   8.188 +	}
   8.189 +
   8.190 +	G_OBJECT_CLASS(pui_prefs_application_parent_class)->dispose(object);
   8.191 +}
   8.192 +
   8.193 +static void
   8.194 +pui_prefs_application_class_init(PuiPrefsApplicationClass *klass)
   8.195 +{
   8.196 +	GObjectClass	*object_class = G_OBJECT_CLASS(klass);
   8.197 +	GApplicationClass *application_class = G_APPLICATION_CLASS(klass);
   8.198 +
   8.199 +	object_class->dispose = pui_prefs_application_dispose;
   8.200 +
   8.201 +	application_class->startup = pui_prefs_application_startup;
   8.202 +	application_class->activate = pui_prefs_application_activate;
   8.203 +}
   8.204 +
   8.205 +static void
   8.206 +pui_prefs_application_init(PuiPrefsApplication *self)
   8.207 +{
   8.208 +	/* do nothing, implementation required */
   8.209 +}
   8.210 +
   8.211 +PuiPrefsApplication *
   8.212 +pui_prefs_application_new(void)
   8.213 +{
   8.214 +	return (g_object_new(PUI_TYPE_PREFS_APPLICATION,
   8.215 +	    "application-id", APPLICATION_ID, NULL));
   8.216 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/pui-prefs-application.h	Fri Jun 08 08:38:42 2018 +0200
     9.3 @@ -0,0 +1,42 @@
     9.4 +/*
     9.5 + * Copyright (C) 2018 Guido Berhoerster <guido+pui@berhoerster.name>
     9.6 + *
     9.7 + * Permission is hereby granted, free of charge, to any person obtaining
     9.8 + * a copy of this software and associated documentation files (the
     9.9 + * "Software"), to deal in the Software without restriction, including
    9.10 + * without limitation the rights to use, copy, modify, merge, publish,
    9.11 + * distribute, sublicense, and/or sell copies of the Software, and to
    9.12 + * permit persons to whom the Software is furnished to do so, subject to
    9.13 + * the following conditions:
    9.14 + *
    9.15 + * The above copyright notice and this permission notice shall be included
    9.16 + * in all copies or substantial portions of the Software.
    9.17 + *
    9.18 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    9.19 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    9.20 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    9.21 + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    9.22 + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    9.23 + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    9.24 + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    9.25 + */
    9.26 +
    9.27 +#ifndef	PUI_PREFS_APPLICATION_H
    9.28 +#define	PUI_PREFS_APPLICATION_H
    9.29 +
    9.30 +#include <gtk/gtk.h>
    9.31 +
    9.32 +#include <glib-object.h>
    9.33 +
    9.34 +G_BEGIN_DECLS
    9.35 +
    9.36 +#define	PUI_TYPE_PREFS_APPLICATION	(pui_prefs_application_get_type())
    9.37 +
    9.38 +G_DECLARE_FINAL_TYPE(PuiPrefsApplication, pui_prefs_application, PUI,
    9.39 +    PREFS_APPLICATION, GtkApplication)
    9.40 +
    9.41 +PuiPrefsApplication *	pui_prefs_application_new(void);
    9.42 +
    9.43 +G_END_DECLS
    9.44 +
    9.45 +#endif /* !PUI_PREFS_APPLICATION_H */
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/pui-prefs-window.ui	Fri Jun 08 08:38:42 2018 +0200
    10.3 @@ -0,0 +1,165 @@
    10.4 +<?xml version="1.0" encoding="UTF-8"?>
    10.5 +<!-- Generated with glade 3.20.0 -->
    10.6 +<interface>
    10.7 +  <requires lib="gtk+" version="3.20"/>
    10.8 +  <object class="GtkListStore" id="refresh-interval-list">
    10.9 +    <columns>
   10.10 +      <!-- column-name id -->
   10.11 +      <column type="gchararray"/>
   10.12 +      <!-- column-name title -->
   10.13 +      <column type="gchararray"/>
   10.14 +      <!-- column-name interval -->
   10.15 +      <column type="guint"/>
   10.16 +    </columns>
   10.17 +    <data>
   10.18 +      <row>
   10.19 +        <col id="0">always</col>
   10.20 +        <col id="1" translatable="yes">always</col>
   10.21 +        <col id="2">0</col>
   10.22 +      </row>
   10.23 +      <row>
   10.24 +        <col id="0">one-hour</col>
   10.25 +        <col id="1" translatable="yes">every hour</col>
   10.26 +        <col id="2">3600</col>
   10.27 +      </row>
   10.28 +      <row>
   10.29 +        <col id="0">eight-hours</col>
   10.30 +        <col id="1" translatable="yes">every 8 hours</col>
   10.31 +        <col id="2">28800</col>
   10.32 +      </row>
   10.33 +      <row>
   10.34 +        <col id="0">twelve-hours</col>
   10.35 +        <col id="1" translatable="yes">twice a day</col>
   10.36 +        <col id="2">43200</col>
   10.37 +      </row>
   10.38 +      <row>
   10.39 +        <col id="0">one-day</col>
   10.40 +        <col id="1" translatable="yes">daily</col>
   10.41 +        <col id="2">86400</col>
   10.42 +      </row>
   10.43 +      <row>
   10.44 +        <col id="0">one-week</col>
   10.45 +        <col id="1" translatable="yes">weekly</col>
   10.46 +        <col id="2">604800</col>
   10.47 +      </row>
   10.48 +      <row>
   10.49 +        <col id="0">never</col>
   10.50 +        <col id="1" translatable="yes">never</col>
   10.51 +        <col id="2">4294967295</col>
   10.52 +      </row>
   10.53 +    </data>
   10.54 +  </object>
   10.55 +  <object class="GtkWindow" id="window">
   10.56 +    <property name="can_focus">False</property>
   10.57 +    <property name="resizable">False</property>
   10.58 +    <child>
   10.59 +      <object class="GtkBox">
   10.60 +        <property name="visible">True</property>
   10.61 +        <property name="can_focus">False</property>
   10.62 +        <property name="margin_left">18</property>
   10.63 +        <property name="margin_right">18</property>
   10.64 +        <property name="margin_top">18</property>
   10.65 +        <property name="margin_bottom">18</property>
   10.66 +        <property name="orientation">vertical</property>
   10.67 +        <property name="spacing">18</property>
   10.68 +        <child>
   10.69 +          <object class="GtkGrid">
   10.70 +            <property name="visible">True</property>
   10.71 +            <property name="can_focus">False</property>
   10.72 +            <property name="row_spacing">18</property>
   10.73 +            <property name="column_spacing">12</property>
   10.74 +            <child>
   10.75 +              <object class="GtkLabel">
   10.76 +                <property name="visible">True</property>
   10.77 +                <property name="can_focus">False</property>
   10.78 +                <property name="halign">end</property>
   10.79 +                <property name="label" translatable="yes">_Refresh cache:</property>
   10.80 +                <property name="use_underline">True</property>
   10.81 +              </object>
   10.82 +              <packing>
   10.83 +                <property name="left_attach">0</property>
   10.84 +                <property name="top_attach">0</property>
   10.85 +              </packing>
   10.86 +            </child>
   10.87 +            <child>
   10.88 +              <object class="GtkLabel">
   10.89 +                <property name="visible">True</property>
   10.90 +                <property name="can_focus">False</property>
   10.91 +                <property name="halign">end</property>
   10.92 +                <property name="label" translatable="yes">_Command for installing updates:</property>
   10.93 +                <property name="use_underline">True</property>
   10.94 +                <property name="mnemonic_widget">update-command</property>
   10.95 +              </object>
   10.96 +              <packing>
   10.97 +                <property name="left_attach">0</property>
   10.98 +                <property name="top_attach">1</property>
   10.99 +              </packing>
  10.100 +            </child>
  10.101 +            <child>
  10.102 +              <object class="GtkEntry" id="update-command">
  10.103 +                <property name="visible">True</property>
  10.104 +                <property name="can_focus">True</property>
  10.105 +                <property name="width_chars">32</property>
  10.106 +                <signal name="changed" handler="on_command_changed" swapped="no"/>
  10.107 +              </object>
  10.108 +              <packing>
  10.109 +                <property name="left_attach">1</property>
  10.110 +                <property name="top_attach">1</property>
  10.111 +              </packing>
  10.112 +            </child>
  10.113 +            <child>
  10.114 +              <object class="GtkComboBox" id="refresh-interval">
  10.115 +                <property name="visible">True</property>
  10.116 +                <property name="can_focus">False</property>
  10.117 +                <property name="model">refresh-interval-list</property>
  10.118 +                <property name="id_column">0</property>
  10.119 +                <child>
  10.120 +                  <object class="GtkCellRendererText"/>
  10.121 +                  <attributes>
  10.122 +                    <attribute name="text">1</attribute>
  10.123 +                  </attributes>
  10.124 +                </child>
  10.125 +              </object>
  10.126 +              <packing>
  10.127 +                <property name="left_attach">1</property>
  10.128 +                <property name="top_attach">0</property>
  10.129 +              </packing>
  10.130 +            </child>
  10.131 +          </object>
  10.132 +          <packing>
  10.133 +            <property name="expand">True</property>
  10.134 +            <property name="fill">True</property>
  10.135 +            <property name="position">0</property>
  10.136 +          </packing>
  10.137 +        </child>
  10.138 +        <child>
  10.139 +          <object class="GtkButtonBox">
  10.140 +            <property name="visible">True</property>
  10.141 +            <property name="can_focus">False</property>
  10.142 +            <property name="layout_style">end</property>
  10.143 +            <child>
  10.144 +              <object class="GtkButton">
  10.145 +                <property name="label">gtk-close</property>
  10.146 +                <property name="visible">True</property>
  10.147 +                <property name="can_focus">True</property>
  10.148 +                <property name="receives_default">True</property>
  10.149 +                <property name="action_name">app.quit</property>
  10.150 +                <property name="use_stock">True</property>
  10.151 +              </object>
  10.152 +              <packing>
  10.153 +                <property name="expand">True</property>
  10.154 +                <property name="fill">True</property>
  10.155 +                <property name="position">0</property>
  10.156 +              </packing>
  10.157 +            </child>
  10.158 +          </object>
  10.159 +          <packing>
  10.160 +            <property name="expand">False</property>
  10.161 +            <property name="fill">True</property>
  10.162 +            <property name="position">1</property>
  10.163 +          </packing>
  10.164 +        </child>
  10.165 +      </object>
  10.166 +    </child>
  10.167 +  </object>
  10.168 +</interface>
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/pui-prefs.gresource.xml	Fri Jun 08 08:38:42 2018 +0200
    11.3 @@ -0,0 +1,6 @@
    11.4 +<?xml version="1.0" encoding="UTF-8"?>
    11.5 +<gresources>
    11.6 +  <gresource prefix="/org/guido-berhoerster/code/package-update-indicator/preferences">
    11.7 +    <file compressed="true">pui-prefs-window.ui</file>
    11.8 +  </gresource>
    11.9 +</gresources>
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/pui-settings.c	Fri Jun 08 08:38:42 2018 +0200
    12.3 @@ -0,0 +1,46 @@
    12.4 +/*
    12.5 + * Copyright (C) 2018 Guido Berhoerster <guido+pui@berhoerster.name>
    12.6 + *
    12.7 + * Permission is hereby granted, free of charge, to any person obtaining
    12.8 + * a copy of this software and associated documentation files (the
    12.9 + * "Software"), to deal in the Software without restriction, including
   12.10 + * without limitation the rights to use, copy, modify, merge, publish,
   12.11 + * distribute, sublicense, and/or sell copies of the Software, and to
   12.12 + * permit persons to whom the Software is furnished to do so, subject to
   12.13 + * the following conditions:
   12.14 + *
   12.15 + * The above copyright notice and this permission notice shall be included
   12.16 + * in all copies or substantial portions of the Software.
   12.17 + *
   12.18 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   12.19 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   12.20 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   12.21 + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
   12.22 + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
   12.23 + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
   12.24 + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   12.25 + */
   12.26 +
   12.27 +#define	G_SETTINGS_ENABLE_BACKEND
   12.28 +#include <gio/gsettingsbackend.h>
   12.29 +
   12.30 +#include "pui-settings.h"
   12.31 +
   12.32 +#define	SETTINGS_ROOT_PATH \
   12.33 +    "/org/guido-berhoerster/code/package-update-indicator/"
   12.34 +#define	SETTINGS_ROOT_GROUP	"General"
   12.35 +
   12.36 +GSettings *
   12.37 +pui_settings_new(void)
   12.38 +{
   12.39 +	gchar		*settings_filename;
   12.40 +	GSettingsBackend *settings_backend;
   12.41 +
   12.42 +	settings_filename = g_build_filename(g_get_user_config_dir(), PACKAGE,
   12.43 +	    PACKAGE ".conf", NULL);
   12.44 +	settings_backend = g_keyfile_settings_backend_new(settings_filename,
   12.45 +	    SETTINGS_ROOT_PATH, SETTINGS_ROOT_GROUP);
   12.46 +
   12.47 +	return (g_settings_new_with_backend(SETTINGS_SCHEMA_ID,
   12.48 +	    settings_backend));
   12.49 +}
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/pui-settings.h	Fri Jun 08 08:38:42 2018 +0200
    13.3 @@ -0,0 +1,31 @@
    13.4 +/*
    13.5 + * Copyright (C) 2018 Guido Berhoerster <guido+pui@berhoerster.name>
    13.6 + *
    13.7 + * Permission is hereby granted, free of charge, to any person obtaining
    13.8 + * a copy of this software and associated documentation files (the
    13.9 + * "Software"), to deal in the Software without restriction, including
   13.10 + * without limitation the rights to use, copy, modify, merge, publish,
   13.11 + * distribute, sublicense, and/or sell copies of the Software, and to
   13.12 + * permit persons to whom the Software is furnished to do so, subject to
   13.13 + * the following conditions:
   13.14 + *
   13.15 + * The above copyright notice and this permission notice shall be included
   13.16 + * in all copies or substantial portions of the Software.
   13.17 + *
   13.18 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   13.19 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   13.20 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   13.21 + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
   13.22 + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
   13.23 + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
   13.24 + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   13.25 + */
   13.26 +
   13.27 +#ifndef	PUI_SETTINGS_H
   13.28 +#define	PUI_SETTINGS_H
   13.29 +
   13.30 +#include <gio/gio.h>
   13.31 +
   13.32 +GSettings *	pui_settings_new(void);
   13.33 +
   13.34 +#endif /* !PUI_SETTINGS_H */