/** * properties_set_config * @n: config number * * Description: * sets the current configuration * * Returns: * TRUE if successful, FALSE otherwise **/ gboolean properties_set_config (gint n) { if (!set_game_config (n)) return FALSE; properties.selected_config = n; return TRUE; }
/** * type_selection * @widget: widget * @data: callback data * * Description: * handles configuration selection messages **/ static void type_selection (GtkWidget * widget, gpointer data) { gint num = gtk_combo_box_get_active (GTK_COMBO_BOX (widget)); properties.selected_config = num; conf_set_configuration (game_config_name (properties.selected_config)); set_game_config (properties.selected_config); start_new_game (); }
/** * load_properties * * Description: * loads the game properties from a file * * Returns: * TRUE if the properties can be loaded, FALSE otherwise **/ gboolean load_properties (void) { gchar *cname = NULL; gint i; gchar *bgcolour; load_keys (); bgcolour = games_conf_get_string_with_default (KEY_PREFERENCES_GROUP, KEY_BACKGROUND_COLOR, "#7590AE"); gdk_color_parse (bgcolour, &properties.bgcolour); set_background_color (properties.bgcolour); properties.themename = games_conf_get_string_with_default (KEY_PREFERENCES_GROUP, KEY_THEME, "robots"); cname = games_conf_get_string_with_default (KEY_PREFERENCES_GROUP, KEY_CONFIGURATION, "classic_robots"); properties.selected_config = 0; for (i = 0; i < num_game_configs (); ++i) { if (!strcmp (cname, game_config_name (i))) { properties.selected_config = i; break; } } g_free (cname); properties.safe_moves = games_conf_get_boolean (KEY_PREFERENCES_GROUP, KEY_SAFE_MOVES, NULL); properties.super_safe_moves = games_conf_get_boolean (KEY_PREFERENCES_GROUP, KEY_SUPER_SAFE_MOVES, NULL); properties.sound = games_conf_get_boolean (KEY_PREFERENCES_GROUP, KEY_ENABLE_SOUND, NULL); properties.show_toolbar = games_conf_get_boolean (KEY_PREFERENCES_GROUP, KEY_SHOW_TOOLBAR, NULL); games_sound_enable (properties.sound); set_game_graphics (properties.themename); set_game_config (properties.selected_config); keyboard_set (properties.keys); return TRUE; }
/** * load_properties * * Description: * loads the game properties from a file * * Returns: * TRUE if the properties can be loaded, FALSE otherwise **/ gboolean load_properties (void) { gchar *cname = NULL; gint i; gchar *bgcolour, *config; load_keys (); bgcolour = g_settings_get_string (settings, KEY_BACKGROUND_COLOR); gdk_rgba_parse (&properties.bgcolour, bgcolour); set_background_color (properties.bgcolour); properties.themename = g_settings_get_string (settings, KEY_THEME); cname = g_settings_get_string (settings, KEY_CONFIGURATION); properties.selected_config = 0; for (i = 0; i < num_game_configs (); ++i) { config = game_config_name (i); if (!strcmp (cname, config)) { g_free (config); properties.selected_config = i; break; } g_free (config); } g_free (cname); properties.safe_moves = g_settings_get_boolean (settings, KEY_SAFE_MOVES); properties.super_safe_moves = g_settings_get_boolean (settings, KEY_SUPER_SAFE_MOVES); properties.sound = g_settings_get_boolean (settings, KEY_ENABLE_SOUND); properties.show_toolbar = g_settings_get_boolean (settings, KEY_SHOW_TOOLBAR); load_game_graphics (); set_game_config (properties.selected_config); keyboard_set (properties.keys); return TRUE; }