Commit de1baac4 authored by Christoph Haag's avatar Christoph Haag Committed by Lubosz Sarnecki

settings: Add function to check if the gsettings schema is installed

parent 9ff3ae6c
......@@ -580,6 +580,12 @@ main (int argc, char *argv[])
}
g_option_context_free (context);
if (!xrd_settings_is_schema_installed ())
{
g_print ("GSettings schema not found. Check xrdesktop installation!\n");
return 1;
}
Example self = {
.loop = g_main_loop_new (NULL, FALSE),
.window_pixbuf = load_gdk_pixbuf ("/res/hawk.jpg"),
......
......@@ -7,13 +7,31 @@
#include "xrd-settings.h"
#define SCHEMA_ID "org.xrdesktop"
static GSettings *instance = NULL;
gboolean
xrd_settings_is_schema_installed ()
{
GSettingsSchemaSource *source =
g_settings_schema_source_get_default ();
GSettingsSchema *schema =
g_settings_schema_source_lookup (source, SCHEMA_ID, TRUE);
gboolean installed = schema != NULL;
if (schema)
g_settings_schema_unref (schema);
return installed;
}
GSettings *
xrd_settings_get_instance ()
{
if (!instance)
instance = g_settings_new ("org.xrdesktop");
instance = g_settings_new (SCHEMA_ID);
return instance;
}
......
......@@ -14,6 +14,9 @@
#include <gio/gio.h>
gboolean
xrd_settings_is_schema_installed ();
GSettings *
xrd_settings_get_instance (void);
......
......@@ -20,6 +20,12 @@ _update_input_poll_rate (GSettings *settings, gchar *key, gpointer data)
int
main ()
{
if (!xrd_settings_is_schema_installed ())
{
g_print ("org.xrdestkop gsettings schema is not installed!\n");
return 1;
}
xrd_settings_connect_and_apply (G_CALLBACK (_update_input_poll_rate),
"input-poll-rate-ms", NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment