Add planets-char and aspects-char settings to GSettings schema

This commit is contained in:
Gergely Polonkai 2014-07-04 13:02:45 +02:00
parent f65cb50f8e
commit d8aadc4ffa
3 changed files with 24 additions and 1 deletions

View File

@ -1,6 +1,16 @@
<schemalist gettext-domain="astrognome"> <schemalist gettext-domain="astrognome">
<schema id="eu.polonkai.gergely.Astrognome" path="/eu/polonkai/gergely/Astrognome/"> <schema id="eu.polonkai.gergely.Astrognome" path="/eu/polonkai/gergely/Astrognome/">
<child name="state" schema="eu.polonkai.gergely.Astrognome.state" /> <child name="state" schema="eu.polonkai.gergely.Astrognome.state" />
<key name="planets-char" type="b">
<default>false</default>
<summary>Display planet symbols as UTF-8 characters</summary>
<description>Whether to show planet symbols as their UTF-8 representation. Uses less memory, but not all system fonts have them defined. If a planet (like most dwarves) dont have a character representation, an image fallback will be used.</description>
</key>
<key name="aspects-char" type="b">
<default>false</default>
<summary>Display aspect symbols as UTF-8 characters</summary>
<description>Whether to show aspect symbols as their UTF-8 representation. Uses less memory, but not all system fonts have them defined. If an aspect dont have a character representation, an image fallback will be used.</description>
</key>
</schema> </schema>
<schema id="eu.polonkai.gergely.Astrognome.state" path="/eu/polonkai/gergely/Astrognome/state/"> <schema id="eu.polonkai.gergely.Astrognome.state" path="/eu/polonkai/gergely/Astrognome/state/">
<child name="window" schema="eu.polonkai.gergely.Astrognome.state.window" /> <child name="window" schema="eu.polonkai.gergely.Astrognome.state.window" />

View File

@ -1,11 +1,13 @@
#include "ag-settings.h" #include "ag-settings.h"
#define SETTINGS_SCHEMA_ID_MAIN "eu.polonkai.gergely.Astrognome"
#define SETTINGS_SCHEMA_ID_WINDOW "eu.polonkai.gergely.Astrognome.state.window" #define SETTINGS_SCHEMA_ID_WINDOW "eu.polonkai.gergely.Astrognome.state.window"
#define SETTINGS_SCHEMA_ID_CHART "eu.polonkai.gergely.Astrognome.state.chart" #define SETTINGS_SCHEMA_ID_CHART "eu.polonkai.gergely.Astrognome.state.chart"
static AgSettings *singleton = NULL; static AgSettings *singleton = NULL;
struct _AgSettingsPrivate { struct _AgSettingsPrivate {
GSettings *settings_main;
GSettings *settings_window; GSettings *settings_window;
GSettings *settings_chart; GSettings *settings_chart;
}; };
@ -17,6 +19,7 @@ ag_settings_init(AgSettings *settings)
{ {
AgSettingsPrivate *priv = ag_settings_get_instance_private(settings); AgSettingsPrivate *priv = ag_settings_get_instance_private(settings);
priv->settings_main = g_settings_new(SETTINGS_SCHEMA_ID_MAIN);
priv->settings_window = g_settings_new(SETTINGS_SCHEMA_ID_WINDOW); priv->settings_window = g_settings_new(SETTINGS_SCHEMA_ID_WINDOW);
priv->settings_chart = g_settings_new(SETTINGS_SCHEMA_ID_CHART); priv->settings_chart = g_settings_new(SETTINGS_SCHEMA_ID_CHART);
} }
@ -28,6 +31,7 @@ ag_settings_dispose(GObject *object)
g_clear_object(&priv->settings_window); g_clear_object(&priv->settings_window);
g_clear_object(&priv->settings_chart); g_clear_object(&priv->settings_chart);
g_clear_object(&priv->settings_main);
G_OBJECT_CLASS(ag_settings_parent_class)->dispose(object); G_OBJECT_CLASS(ag_settings_parent_class)->dispose(object);
} }
@ -63,6 +67,14 @@ ag_settings_get(void)
return singleton; return singleton;
} }
GSettings *
ag_settings_peek_main_settings(AgSettings *settings)
{
AgSettingsPrivate *priv = ag_settings_get_instance_private(settings);
return priv->settings_main;
}
GSettings * GSettings *
ag_settings_peek_window_settings(AgSettings *settings) ag_settings_peek_window_settings(AgSettings *settings)
{ {

View File

@ -29,6 +29,7 @@ GType ag_settings_get_type(void);
AgSettings *ag_settings_get(void); AgSettings *ag_settings_get(void);
GSettings *ag_settings_peek_main_settings(AgSettings *settings);
GSettings *ag_settings_peek_window_settings(AgSettings *settings); GSettings *ag_settings_peek_window_settings(AgSettings *settings);
GSettings *ag_settings_peek_chart_settings(AgSettings *settings); GSettings *ag_settings_peek_chart_settings(AgSettings *settings);