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:
		| @@ -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; | ||||
| } | ||||
|   | ||||
| @@ -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__ */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user