Esempio n. 1
0
/** \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;
     }
}
/** \brief User pressed OK. Any changes should be stored in config.
 */
void
sat_pref_single_pass_ok     ()
{

     if (dirty) {
          sat_cfg_set_int (SAT_CFG_INT_PRED_SINGLE_COL, flags);
          dirty = FALSE;
     }
     else if (reset) {
          sat_cfg_reset_int (SAT_CFG_INT_PRED_SINGLE_COL);
          reset = FALSE;
     }
}
Esempio n. 3
0
/* User pressed OK. Any changes should be stored in config. */
void sat_pref_debug_ok()
{
    gint            num = gtk_combo_box_get_active(GTK_COMBO_BOX(age));

    if (dirty)
    {
        /* store new values */
        sat_cfg_set_int(SAT_CFG_INT_LOG_LEVEL,
                        gtk_combo_box_get_active(GTK_COMBO_BOX(level)));

        switch (num)
        {
        case 1:
            sat_cfg_set_int(SAT_CFG_INT_LOG_CLEAN_AGE, SEC_PER_DAY);
            break;

        case 2:
            sat_cfg_set_int(SAT_CFG_INT_LOG_CLEAN_AGE, SEC_PER_WEEK);
            break;

        case 3:
            sat_cfg_set_int(SAT_CFG_INT_LOG_CLEAN_AGE, SEC_PER_MONTH);
            break;

        default:
            sat_cfg_set_int(SAT_CFG_INT_LOG_CLEAN_AGE, 0);
        }
    }

    else if (reset)
    {
        /* reset values */
        sat_cfg_reset_int(SAT_CFG_INT_LOG_LEVEL);
        sat_cfg_reset_int(SAT_CFG_INT_LOG_CLEAN_AGE);
    }

    dirty = FALSE;
    reset = FALSE;
}
/** \brief User pressed OK. Any changes should be stored in config.
 */
void
sat_pref_single_sat_ok     (GKeyFile *cfg)
{

    if (dirty) {

        if (cfg != NULL) {
            g_key_file_set_integer (cfg,
                        MOD_CFG_SINGLE_SAT_SECTION,
                        MOD_CFG_SINGLE_SAT_FIELDS,
                        flags);
                        
        }
        else {
            sat_cfg_set_int (SAT_CFG_INT_SINGLE_SAT_FIELDS, flags);
        }
    }
    else if (reset) {

        if (cfg != NULL) {
            /* local mode; remove key */
            g_key_file_remove_key (cfg,
                           MOD_CFG_SINGLE_SAT_SECTION,
                           MOD_CFG_SINGLE_SAT_FIELDS,
                           NULL);
                        
        }
        else {
            /* global mode; reset value */
            sat_cfg_reset_int (SAT_CFG_INT_SINGLE_SAT_FIELDS);
        }
    }

    dirty = FALSE;
    reset = FALSE;
}
Esempio n. 5
0
/** \brief User pressed OK. Any changes should be stored in config.
 */
void
sat_pref_refresh_ok     (GKeyFile *cfg)
{
     if (dirty) {

          if (cfg != NULL) {

               g_key_file_set_integer (cfg,
                              MOD_CFG_GLOBAL_SECTION,
                              MOD_CFG_TIMEOUT_KEY,
                              gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dataspin)));

               g_key_file_set_integer (cfg,
                              MOD_CFG_LIST_SECTION,
                              MOD_CFG_LIST_REFRESH,
                              gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (listspin)));

               g_key_file_set_integer (cfg,
                              MOD_CFG_MAP_SECTION,
                              MOD_CFG_MAP_REFRESH,
                              gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mapspin)));

               g_key_file_set_integer (cfg,
                              MOD_CFG_POLAR_SECTION,
                              MOD_CFG_POLAR_REFRESH,
                              gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (polarspin)));

               g_key_file_set_integer (cfg,
                              MOD_CFG_SINGLE_SAT_SECTION,
                              MOD_CFG_SINGLE_SAT_REFRESH,
                              gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (singlespin)));

          }
          else {

               sat_cfg_set_int (SAT_CFG_INT_MODULE_TIMEOUT,
                          gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dataspin)));

               sat_cfg_set_int (SAT_CFG_INT_LIST_REFRESH,
                          gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (listspin)));

               sat_cfg_set_int (SAT_CFG_INT_MAP_REFRESH,
                          gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mapspin)));

               sat_cfg_set_int (SAT_CFG_INT_POLAR_REFRESH,
                          gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (polarspin)));

               sat_cfg_set_int (SAT_CFG_INT_SINGLE_SAT_REFRESH,
                          gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (singlespin)));

          }

     }
     else if (reset) {
          /* we have to reset the values to global or default settings */
          if (cfg == NULL) {
               /* reset values in sat-cfg */
               sat_cfg_reset_int (SAT_CFG_INT_MODULE_TIMEOUT);
               sat_cfg_reset_int (SAT_CFG_INT_LIST_REFRESH);
               sat_cfg_reset_int (SAT_CFG_INT_MAP_REFRESH);
               sat_cfg_reset_int (SAT_CFG_INT_POLAR_REFRESH);
               sat_cfg_reset_int (SAT_CFG_INT_SINGLE_SAT_REFRESH);
          }
          else {
               /* remove keys */
               g_key_file_remove_key ((GKeyFile *)(cfg),
                                MOD_CFG_GLOBAL_SECTION,
                                MOD_CFG_TIMEOUT_KEY,
                                NULL);
               g_key_file_remove_key ((GKeyFile *)(cfg),
                                MOD_CFG_LIST_SECTION,
                                MOD_CFG_LIST_REFRESH,
                                NULL);
               g_key_file_remove_key ((GKeyFile *)(cfg),
                                MOD_CFG_MAP_SECTION,
                                MOD_CFG_MAP_REFRESH,
                                NULL);
               g_key_file_remove_key ((GKeyFile *)(cfg),
                                MOD_CFG_POLAR_SECTION,
                                MOD_CFG_POLAR_REFRESH,
                                NULL);
               g_key_file_remove_key ((GKeyFile *)(cfg),
                                MOD_CFG_SINGLE_SAT_SECTION,
                                MOD_CFG_SINGLE_SAT_REFRESH,
                                NULL);
          }
     }

     dirty = FALSE;
     reset = FALSE;
}
/** \brief User pressed OK. Any changes should be stored in config.
 */
void
sat_pref_sky_at_glance_ok     ()
{
    GdkColor col;
    guint    rgb;


    if (dirty) {
        /* values have changed; store new values */
        sat_cfg_set_int (SAT_CFG_INT_SKYATGL_TIME,
                         gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (timesp)));

        gtk_color_button_get_color (GTK_COLOR_BUTTON (col1), &col);
        gdk2rgb (&col, &rgb);
        sat_cfg_set_int (SAT_CFG_INT_SKYATGL_COL_01, rgb);

        gtk_color_button_get_color (GTK_COLOR_BUTTON (col2), &col);
        gdk2rgb (&col, &rgb);
        sat_cfg_set_int (SAT_CFG_INT_SKYATGL_COL_02, rgb);

        gtk_color_button_get_color (GTK_COLOR_BUTTON (col3), &col);
        gdk2rgb (&col, &rgb);
        sat_cfg_set_int (SAT_CFG_INT_SKYATGL_COL_03, rgb);

        gtk_color_button_get_color (GTK_COLOR_BUTTON (col4), &col);
        gdk2rgb (&col, &rgb);
        sat_cfg_set_int (SAT_CFG_INT_SKYATGL_COL_04, rgb);

        gtk_color_button_get_color (GTK_COLOR_BUTTON (col5), &col);
        gdk2rgb (&col, &rgb);
        sat_cfg_set_int (SAT_CFG_INT_SKYATGL_COL_05, rgb);

        gtk_color_button_get_color (GTK_COLOR_BUTTON (col6), &col);
        gdk2rgb (&col, &rgb);
        sat_cfg_set_int (SAT_CFG_INT_SKYATGL_COL_06, rgb);

        gtk_color_button_get_color (GTK_COLOR_BUTTON (col7), &col);
        gdk2rgb (&col, &rgb);
        sat_cfg_set_int (SAT_CFG_INT_SKYATGL_COL_07, rgb);

        gtk_color_button_get_color (GTK_COLOR_BUTTON (col8), &col);
        gdk2rgb (&col, &rgb);
        sat_cfg_set_int (SAT_CFG_INT_SKYATGL_COL_08, rgb);

        gtk_color_button_get_color (GTK_COLOR_BUTTON (col9), &col);
        gdk2rgb (&col, &rgb);
        sat_cfg_set_int (SAT_CFG_INT_SKYATGL_COL_09, rgb);

        gtk_color_button_get_color (GTK_COLOR_BUTTON (col10), &col);
        gdk2rgb (&col, &rgb);
        sat_cfg_set_int (SAT_CFG_INT_SKYATGL_COL_10, rgb);


    }
    else if (reset) {
        /* values haven't changed since last reset */
        sat_cfg_reset_int (SAT_CFG_INT_SKYATGL_TIME);
        sat_cfg_reset_int (SAT_CFG_INT_SKYATGL_COL_01);
        sat_cfg_reset_int (SAT_CFG_INT_SKYATGL_COL_02);
        sat_cfg_reset_int (SAT_CFG_INT_SKYATGL_COL_03);
        sat_cfg_reset_int (SAT_CFG_INT_SKYATGL_COL_04);
        sat_cfg_reset_int (SAT_CFG_INT_SKYATGL_COL_05);
        sat_cfg_reset_int (SAT_CFG_INT_SKYATGL_COL_06);
        sat_cfg_reset_int (SAT_CFG_INT_SKYATGL_COL_07);
        sat_cfg_reset_int (SAT_CFG_INT_SKYATGL_COL_08);
        sat_cfg_reset_int (SAT_CFG_INT_SKYATGL_COL_09);
        sat_cfg_reset_int (SAT_CFG_INT_SKYATGL_COL_10);

        /* FIXME: sats */
    }
}