/** User pressed OK. Any changes should be stored in config. */ void sat_pref_layout_ok(GKeyFile * cfg) { if (dirty) { /* we have new settings */ if (cfg != NULL) { g_key_file_set_string(cfg, MOD_CFG_GLOBAL_SECTION, MOD_CFG_GRID, gtk_entry_get_text(GTK_ENTRY(gridstr))); } else { sat_cfg_set_str(SAT_CFG_STR_MODULE_GRID, gtk_entry_get_text(GTK_ENTRY(gridstr))); sat_cfg_set_bool(SAT_CFG_BOOL_MAIN_WIN_POS, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (mwin))); sat_cfg_set_bool(SAT_CFG_BOOL_MOD_WIN_POS, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (mod))); sat_cfg_set_bool(SAT_CFG_BOOL_MOD_STATE, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (state))); } } else if (reset) { /* we have to reset the values to global or default settings */ if (cfg == NULL) { /* layout */ sat_cfg_reset_str(SAT_CFG_STR_MODULE_GRID); /* window placement */ sat_cfg_reset_bool(SAT_CFG_BOOL_MAIN_WIN_POS); sat_cfg_reset_bool(SAT_CFG_BOOL_MOD_WIN_POS); sat_cfg_reset_bool(SAT_CFG_BOOL_MOD_STATE); } else { g_key_file_remove_key((GKeyFile *) (cfg), MOD_CFG_GLOBAL_SECTION, MOD_CFG_GRID, NULL); } } dirty = FALSE; reset = FALSE; }
/** \brief User pressed OK. Any changes should be stored in config. */ void sat_pref_conditions_ok () { if (dirty) { sat_cfg_set_int (SAT_CFG_INT_PRED_MIN_EL, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (minel))); sat_cfg_set_int (SAT_CFG_INT_PRED_NUM_PASS, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (numpass))); sat_cfg_set_int (SAT_CFG_INT_PRED_LOOK_AHEAD, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (lookahead))); sat_cfg_set_int (SAT_CFG_INT_PRED_RESOLUTION, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (res))); sat_cfg_set_int (SAT_CFG_INT_PRED_NUM_ENTRIES, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (nument))); sat_cfg_set_int (SAT_CFG_INT_PRED_TWILIGHT_THLD, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (twspin))); sat_cfg_set_bool (SAT_CFG_BOOL_PRED_USE_REAL_T0, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tzero))); dirty = FALSE; } else if (reset) { sat_cfg_reset_int (SAT_CFG_INT_PRED_MIN_EL); sat_cfg_reset_int (SAT_CFG_INT_PRED_NUM_PASS); sat_cfg_reset_int (SAT_CFG_INT_PRED_LOOK_AHEAD); sat_cfg_reset_int (SAT_CFG_INT_PRED_RESOLUTION); sat_cfg_reset_int (SAT_CFG_INT_PRED_NUM_ENTRIES); sat_cfg_reset_int (SAT_CFG_INT_PRED_TWILIGHT_THLD); sat_cfg_reset_bool (SAT_CFG_BOOL_PRED_USE_REAL_T0); reset = FALSE; } }