/** * Reset settings. * @param button The RESET button. * @param cfg Pointer to the module config or NULL in global mode. * * This function is called when the user clicks on the RESET button. In global mode * (when cfg = NULL) the function will reset the settings to the efault values, while * in "local" mode (when cfg != NULL) the function will reset the module settings to * the global settings. This is done by removing the corresponding key from the GKeyFile. */ static void reset_cb(GtkWidget * button, gpointer cfg) { guint i, sel = PREDEF_NUM - 1; gchar *buffer; (void)button; /* views */ if (cfg == NULL) { /* global mode, get defaults */ buffer = sat_cfg_get_str_def(SAT_CFG_STR_MODULE_GRID); gtk_entry_set_text(GTK_ENTRY(gridstr), buffer); } else { /* local mode, get global value */ buffer = sat_cfg_get_str(SAT_CFG_STR_MODULE_GRID); gtk_entry_set_text(GTK_ENTRY(gridstr), buffer); } /* findcombo box setting */ for (i = 0; i < PREDEF_NUM; i++) { /* check if this layout corresponds to the settings */ if (!g_ascii_strcasecmp(buffer, predef_layout[i][0])) { sel = i; } } gtk_combo_box_set_active(GTK_COMBO_BOX(selector), sel); g_free(buffer); /* window placement settings */ if (cfg == NULL) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mwin), sat_cfg_get_bool_def (SAT_CFG_BOOL_MAIN_WIN_POS)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mod), sat_cfg_get_bool_def (SAT_CFG_BOOL_MOD_WIN_POS)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(state), sat_cfg_get_bool_def (SAT_CFG_BOOL_MOD_STATE)); } /* reset flags */ reset = TRUE; dirty = FALSE; }
/** \brief Reset settings. * \param button The RESET button. * \param data User data (unused). * * This function is called when the user clicks on the RESET button. The function * will get the default values for the parameters and set the dirty and reset flags * apropriately. The reset will not have any effect if the user cancels the * dialog. */ static void reset_cb (GtkWidget *button, gpointer data) { (void) button; /* avoid unused parameter compiler warning */ (void) data; /* avoid unused parameter compiler warning */ /* get defaults */ gtk_spin_button_set_value (GTK_SPIN_BUTTON (minel), sat_cfg_get_int_def (SAT_CFG_INT_PRED_MIN_EL)); gtk_spin_button_set_value (GTK_SPIN_BUTTON (numpass), sat_cfg_get_int_def (SAT_CFG_INT_PRED_NUM_PASS)); gtk_spin_button_set_value (GTK_SPIN_BUTTON (lookahead), sat_cfg_get_int_def (SAT_CFG_INT_PRED_LOOK_AHEAD)); gtk_spin_button_set_value (GTK_SPIN_BUTTON (res), sat_cfg_get_int_def (SAT_CFG_INT_PRED_RESOLUTION)); gtk_spin_button_set_value (GTK_SPIN_BUTTON (nument), sat_cfg_get_int_def (SAT_CFG_INT_PRED_NUM_ENTRIES)); gtk_spin_button_set_value (GTK_SPIN_BUTTON (twspin), sat_cfg_get_int_def (SAT_CFG_INT_PRED_TWILIGHT_THLD)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tzero), sat_cfg_get_bool_def (SAT_CFG_BOOL_PRED_USE_REAL_T0)); /* reset flags */ reset = TRUE; dirty = FALSE; }