diff pui-application.c @ 1:2f04ec9e0506

Add preferences application Split settings into separate file.
author Guido Berhoerster <guido+pui@berhoerster.name>
date Fri, 08 Jun 2018 08:38:42 +0200
parents 6884bb8130ca
children 7172a0db97af
line wrap: on
line diff
--- a/pui-application.c	Sun May 20 11:32:57 2018 +0200
+++ b/pui-application.c	Fri Jun 08 08:38:42 2018 +0200
@@ -21,21 +21,16 @@
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#define	G_SETTINGS_ENABLE_BACKEND
-#include <gio/gsettingsbackend.h>
 #include <glib/gi18n.h>
 #include <libappindicator/app-indicator.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "pui-common.h"
 #include "pui-application.h"
-#include "pui-types.h"
 #include "pui-backend.h"
-
-#define	SETTINGS_ROOT_PATH \
-    "/org/guido-berhoerster/code/package-update-indicator/"
-#define	SETTINGS_ROOT_GROUP	"General"
+#include "pui-common.h"
+#include "pui-settings.h"
+#include "pui-types.h"
 
 struct _PuiApplication {
 	GApplication	parent_instance;
@@ -410,8 +405,6 @@
 {
 	PuiApplication	*self = PUI_APPLICATION(application);
 	gsize		i;
-	gchar		*settings_filename;
-	GSettingsBackend *settings_backend;
 	GtkWidget	*menu;
 	GtkWidget	*menu_item;
 
@@ -428,12 +421,7 @@
 	}
 
 	/* create settings */
-	settings_filename = g_build_filename(g_get_user_config_dir(), PACKAGE,
-	    PACKAGE ".conf", NULL);
-	settings_backend = g_keyfile_settings_backend_new(settings_filename,
-	    SETTINGS_ROOT_PATH, SETTINGS_ROOT_GROUP);
-	self->settings = g_settings_new_with_backend(APPLICATION_ID,
-	    settings_backend);
+	self->settings = pui_settings_new();
 	g_settings_bind(self->settings, "update-command", self,
 	    "update-command", G_SETTINGS_BIND_GET);
 
@@ -468,9 +456,6 @@
 
 	/* keep GApplication running */
 	g_application_hold(application);
-
-	g_object_unref(settings_backend);
-	g_free(settings_filename);
 }
 
 static void