Add function ag_settings_get_house_system()

It gets the default house system from GSettings and converts it to a
valid GsweHouseSystem.
This commit is contained in:
Gergely Polonkai 2014-09-28 22:52:52 +02:00
parent 1ac0f2779b
commit bd16d5c2f6
2 changed files with 21 additions and 0 deletions

View File

@ -17,6 +17,7 @@
* <http://www.gnu.org/licenses/>.
*/
#include "ag-settings.h"
#include "astrognome.h"
#define SETTINGS_SCHEMA_ID_MAIN "eu.polonkai.gergely.Astrognome"
#define SETTINGS_SCHEMA_ID_WINDOW "eu.polonkai.gergely.Astrognome.state.window"
@ -98,3 +99,20 @@ ag_settings_peek_window_settings(AgSettings *settings)
return priv->settings_window;
}
GsweHouseSystem
ag_settings_get_house_system(AgSettings *settings)
{
gchar *house_system_nick;
GsweHouseSystem house_system;
AgSettingsPrivate *priv = ag_settings_get_instance_private(settings);
house_system_nick = g_settings_get_string(
priv->settings_main,
"default-house-system"
);
house_system = ag_house_system_nick_to_id(house_system_nick);
g_free(house_system_nick);
return house_system;
}

View File

@ -21,6 +21,7 @@
#include <gio/gio.h>
#include <glib-object.h>
#include <swe-glib.h>
G_BEGIN_DECLS
@ -57,6 +58,8 @@ AgSettings *ag_settings_get(void);
GSettings *ag_settings_peek_main_settings(AgSettings *settings);
GSettings *ag_settings_peek_window_settings(AgSettings *settings);
GsweHouseSystem ag_settings_get_house_system(AgSettings *settings);
G_END_DECLS
#endif /* __AG_SETTINGS_H__ */