Ejemplo n.º 1
0
static void reset_cb(GtkWidget * button, gpointer data)
{
    gint            num = sat_cfg_get_int_def(SAT_CFG_INT_LOG_CLEAN_AGE);

    (void)button;
    (void)data;

    switch (num)
    {
    case SEC_PER_DAY:
        gtk_combo_box_set_active(GTK_COMBO_BOX(age), 1);
        break;

    case SEC_PER_WEEK:
        gtk_combo_box_set_active(GTK_COMBO_BOX(age), 2);
        break;

    case SEC_PER_MONTH:
        gtk_combo_box_set_active(GTK_COMBO_BOX(age), 3);
        break;

    default:
        gtk_combo_box_set_active(GTK_COMBO_BOX(age), 0);
    }

    gtk_combo_box_set_active(GTK_COMBO_BOX(level),
                             sat_cfg_get_int_def(SAT_CFG_INT_LOG_LEVEL));

    reset = TRUE;
    dirty = FALSE;
}
/** \brief 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;


    if (cfg == NULL) {
        /* global mode, get defaults */
        flags = sat_cfg_get_int_def (SAT_CFG_INT_SINGLE_SAT_FIELDS);
    }
    else {
        /* local mode, get global value */
        flags = sat_cfg_get_int (SAT_CFG_INT_SINGLE_SAT_FIELDS);
    }

    for (i = 0; i < SINGLE_SAT_FIELD_NUMBER; i++) {

        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check[i]),
                          flags & (1 << i));

    }

    /* reset flags */
    dirty = FALSE;
    reset = TRUE;
}
Ejemplo n.º 3
0
/** \brief 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)
{
     gint val;

     (void) button; /* avoid unused parameter compiler warning */

     /* views */
     if (cfg == NULL) {
          /* global mode, get defaults */
          val = sat_cfg_get_int_def (SAT_CFG_INT_MODULE_TIMEOUT);
          gtk_spin_button_set_value (GTK_SPIN_BUTTON (dataspin), val);
          val = sat_cfg_get_int_def (SAT_CFG_INT_LIST_REFRESH);
          gtk_spin_button_set_value (GTK_SPIN_BUTTON (listspin), val);
          val = sat_cfg_get_int_def (SAT_CFG_INT_MAP_REFRESH);
          gtk_spin_button_set_value (GTK_SPIN_BUTTON (mapspin), val);
          val = sat_cfg_get_int_def (SAT_CFG_INT_POLAR_REFRESH);
          gtk_spin_button_set_value (GTK_SPIN_BUTTON (polarspin), val);
          val = sat_cfg_get_int_def (SAT_CFG_INT_SINGLE_SAT_REFRESH);
          gtk_spin_button_set_value (GTK_SPIN_BUTTON (singlespin), val);
     }
     else {
          /* local mode, get global value */
          val = sat_cfg_get_int (SAT_CFG_INT_MODULE_TIMEOUT);
          gtk_spin_button_set_value (GTK_SPIN_BUTTON (dataspin), val);
          val = sat_cfg_get_int (SAT_CFG_INT_LIST_REFRESH);
          gtk_spin_button_set_value (GTK_SPIN_BUTTON (listspin), val);
          val = sat_cfg_get_int (SAT_CFG_INT_MAP_REFRESH);
          gtk_spin_button_set_value (GTK_SPIN_BUTTON (mapspin), val);
          val = sat_cfg_get_int (SAT_CFG_INT_POLAR_REFRESH);
          gtk_spin_button_set_value (GTK_SPIN_BUTTON (polarspin), val);
          val = sat_cfg_get_int (SAT_CFG_INT_SINGLE_SAT_REFRESH);
          gtk_spin_button_set_value (GTK_SPIN_BUTTON (singlespin), val);
     }


     /* reset flags */
     reset = TRUE;
     dirty = FALSE;
}
Ejemplo n.º 4
0
/** \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;
}
/** \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)
{
     guint i;

     /* get defaults */
     flags = sat_cfg_get_int_def (SAT_CFG_INT_PRED_SINGLE_COL);

     for (i = 0; i < MULTI_PASS_COL_NUMBER; i++) {

          gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check[i]),
                               flags & (1 << i));

     }

     /* reset flags */
     reset = TRUE;
     dirty = FALSE;
}
Ejemplo n.º 6
0
/** \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)
{
    guint    rgb;
    GdkColor col;

    (void) data; /* avoid unused parameter compiler warning */
    (void) button; /* avoid unused parameter compiler warning */

    /* get defaults */

    /* hours */
    gtk_spin_button_set_value (GTK_SPIN_BUTTON (timesp),
                               sat_cfg_get_int_def (SAT_CFG_INT_SKYATGL_TIME));

    /* satellites */

    /* colours */
    rgb = sat_cfg_get_int_def (SAT_CFG_INT_SKYATGL_COL_01);
    rgb2gdk (rgb, &col);
    gtk_color_button_set_color (GTK_COLOR_BUTTON (col1), &col);

    rgb = sat_cfg_get_int_def (SAT_CFG_INT_SKYATGL_COL_02);
    rgb2gdk (rgb, &col);
    gtk_color_button_set_color (GTK_COLOR_BUTTON (col2), &col);

    rgb = sat_cfg_get_int_def (SAT_CFG_INT_SKYATGL_COL_03);
    rgb2gdk (rgb, &col);
    gtk_color_button_set_color (GTK_COLOR_BUTTON (col3), &col);

    rgb = sat_cfg_get_int_def (SAT_CFG_INT_SKYATGL_COL_04);
    rgb2gdk (rgb, &col);
    gtk_color_button_set_color (GTK_COLOR_BUTTON (col4), &col);

    rgb = sat_cfg_get_int_def (SAT_CFG_INT_SKYATGL_COL_05);
    rgb2gdk (rgb, &col);
    gtk_color_button_set_color (GTK_COLOR_BUTTON (col5), &col);

    rgb = sat_cfg_get_int_def (SAT_CFG_INT_SKYATGL_COL_06);
    rgb2gdk (rgb, &col);
    gtk_color_button_set_color (GTK_COLOR_BUTTON (col6), &col);

    rgb = sat_cfg_get_int_def (SAT_CFG_INT_SKYATGL_COL_07);
    rgb2gdk (rgb, &col);
    gtk_color_button_set_color (GTK_COLOR_BUTTON (col7), &col);

    rgb = sat_cfg_get_int_def (SAT_CFG_INT_SKYATGL_COL_08);
    rgb2gdk (rgb, &col);
    gtk_color_button_set_color (GTK_COLOR_BUTTON (col8), &col);

    rgb = sat_cfg_get_int_def (SAT_CFG_INT_SKYATGL_COL_09);
    rgb2gdk (rgb, &col);
    gtk_color_button_set_color (GTK_COLOR_BUTTON (col9), &col);

    rgb = sat_cfg_get_int_def (SAT_CFG_INT_SKYATGL_COL_10);
    rgb2gdk (rgb, &col);
    gtk_color_button_set_color (GTK_COLOR_BUTTON (col10), &col);

    /* reset flags */
    reset = TRUE;
    dirty = FALSE;
}