gdouble *rclib_settings_get_double_list(const gchar *group_name, const gchar *key, gsize *length, GError **error) { if(settings_keyfile==NULL) return NULL; return g_key_file_get_double_list(settings_keyfile, group_name, key, length, error); }
/** * pragha_preferences_get_double_list: * */ gdouble * pragha_preferences_get_double_list (PraghaPreferences *preferences, const gchar *group_name, const gchar *key) { g_return_val_if_fail(PRAGHA_IS_PREFERENCES(preferences), NULL); return g_key_file_get_double_list(preferences->priv->rc_keyfile, group_name, key, NULL, NULL); }
/** * Gets a list of doubles from preferences. * On error, returns NULL. * * @param key the specific settings key * @param n integer pointer that will contain the returned array size * @return the preference value or NULL on error */ gdouble * prefs_get_double_list(const gchar *key, gsize *n) { gsize numcols = 0; gdouble *ret = NULL; GError *error = NULL; ret = g_key_file_get_double_list(keyFile, "PNMixer", key, &numcols, &error); if (error) { g_error_free(error); ret = NULL; } /* For the volume meter color, we need a little bit of care. * Ensure the list is valid, and provide default values if needed. */ if (!g_strcmp0(key, "VolMeterColor")) { gsize i; if (ret && numcols != 3) { g_free(ret); ret = NULL; } if (!ret) { ret = g_malloc(3 * sizeof(gdouble)); ret[0] = 0.909803921569; ret[1] = 0.43137254902; ret[2] = 0.43137254902; } for (i = 0; i < 3; i++) { if (ret[i] < 0) ret[i] = 0; if (ret[i] > 1) ret[i] = 1; } } if (n) *n = numcols; return ret; }
static void check_double_list_value (GKeyFile *keyfile, const gchar *group, const gchar *key, ...) { gint i; gdouble v, *value; va_list args; gsize len; GError *error = NULL; value = g_key_file_get_double_list (keyfile, group, key, &len, &error); check_no_error (error); cut_assert (value); va_start (args, key); i = 0; v = va_arg (args, gdouble); while (v != -100) { cut_assert (i != len, cut_message ("Group %s key %s: list too short (%d)", group, key, i)); cut_assert_equal_int (v, value[i], cut_message ("Group %s key %s: mismatch at %d, " "expected %e, got %e", group, key, i, v, value[i])); i++; v = va_arg (args, gdouble); } va_end (args); g_free (value); }
void cid_read_key_file (CidMainContainer **pCid, const gchar *f) { CidMainContainer *cid = *pCid; if (!cid_load_key_file(pCid, f)) cid_exit(CID_ERROR_READING_FILE,"Key File error"); bChangedDesktop = cid->config->bAllDesktop; iPlayerChanged = cid->config->iPlayer; iSymbolChanged = cid->config->iSymbolColor; iOldWidth = cid->config->iWidth; iOldHeight = cid->config->iHeight; gint *pSize; gsize iReadSize; GError *error = NULL; bUnvalidKey = FALSE; // [System] configuration cid->config->iPlayer = CID_CONFIG_GET_INTEGER ("System", "PLAYER"); cid->config->iInter = CID_CONFIG_GET_INTEGER_WITH_DEFAULT ("System", "INTER", DEFAULT_TIMERS) SECONDES; cid->config->bMonitorPlayer = CID_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("System", "MONITOR", TRUE); cid->config->bPlayerState = CID_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("System", "STATE", TRUE); cid->config->bDisplayTitle = CID_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("System", "TITLE", TRUE); cid->config->iSymbolColor = CID_CONFIG_GET_INTEGER ("System", "SYMBOL_COLOR"); cid->config->bDisplayControl = CID_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("System", "CONTROLS", TRUE); cid->config->dPoliceSize = g_key_file_get_double (cid->pKeyFile, "System", "POLICE_SIZE", &error); cid_free_and_debug_error(&error); cid->config->dPoliceColor = g_key_file_get_double_list (cid->pKeyFile, "System", "POLICE_COLOR", &cid->config->gPlainTextSize, &error); cid_free_and_debug_error(&error); cid->config->dOutlineTextColor = g_key_file_get_double_list (cid->pKeyFile, "System", "OUTLINE_COLOR", &cid->config->gOutlineTextSize, &error); cid_free_and_debug_error(&error); // [Options] configuration cid->config->bHide = CID_CONFIG_GET_BOOLEAN ("Options", "HIDE"); cid->config->cDefaultImage = CID_CONFIG_GET_FILE_PATH ("Options", "IMAGE", cid->config->bDevMode ? TESTING_DIR"/"TESTING_COVER : CID_DEFAULT_IMAGE); cid->config->bRunAnimation = CID_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Options", "ANIMATION", TRUE); cid->config->iAnimationType = CID_CONFIG_GET_INTEGER ("Options", "ANIMATION_TYPE"); cid->config->iAnimationSpeed = CID_CONFIG_GET_INTEGER ("Options", "ANIMATION_SPEED"); cid->config->bThreaded = CID_CONFIG_GET_BOOLEAN ("Options", "THREAD"); cid->config->bDownload = CID_CONFIG_GET_BOOLEAN ("Options", "DOWNLOAD"); cid->config->cDLPath = CID_CONFIG_GET_STRING_WITH_DEFAULT ("Options", "DL_PATH", cid->defaut->cDLPath); cid->config->iImageSize = CID_CONFIG_GET_INTEGER ("Options", "D_SIZE"); cid->config->iTimeToWait = CID_CONFIG_GET_INTEGER_WITH_DEFAULT ("Options", "DELAY", DEFAULT_TIMERS); cid->config->bUnstable = cid->config->bTesting && CID_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Options", "B_UNSTABLE", TRUE); // [Behaviour] configuration cid->config->iPosX = CID_CONFIG_GET_INTEGER ("Behaviour", "GAP_X"); cid->config->iPosY = CID_CONFIG_GET_INTEGER ("Behaviour", "GAP_Y"); pSize = g_key_file_get_integer_list (cid->pKeyFile, "Behaviour", "SIZE", &iReadSize, &error); if (cid_free_and_debug_error(&error) || iReadSize != 2) { pSize = g_realloc (pSize, 2 * sizeof(int)); if (pSize != NULL) { pSize[0] = DEFAULT_SIZE; pSize[1] = DEFAULT_SIZE; } else { cid_exit (CID_ERROR_READING_FILE, "cannot allocate memory"); } } cid->config->dRotate = g_key_file_get_double (cid->pKeyFile, "Behaviour", "ROTATION", &error); cid_free_and_debug_error(&error); cid->config->dColor = g_key_file_get_double_list (cid->pKeyFile, "Behaviour", "COLOR", &cid->config->gColorSize, &error); cid_free_and_debug_error(&error); cid->config->dFlyingColor = g_key_file_get_double_list (cid->pKeyFile, "Behaviour", "FLYING_COLOR", &cid->config->gFlyingColorSize, &error); cid_free_and_debug_error(&error); cid->config->bKeepCorners = CID_CONFIG_GET_BOOLEAN ("Behaviour", "KEEP_CORNERS"); cid->config->bAllDesktop = CID_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Behaviour", "ALL_DESKTOP", TRUE); cid->config->bLockPosition = CID_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Behaviour", "LOCK", TRUE); cid->config->bMask = CID_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Behaviour", "MASK", TRUE); cid->config->bShowAbove = CID_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Behaviour", "SWITCH_ABOVE", TRUE); // MPD configurations cid->mpd_dir = CID_CONFIG_GET_DIR_PATH ("MPD", "MPD_DIR", g_strdup_printf ("%s/Music",g_getenv ("HOME"))); cid->mpd_host = CID_CONFIG_GET_STRING ("MPD", "MPD_HOST"); if (cid->mpd_host != NULL && strcmp (cid->mpd_host, "") == 0) { g_free (cid->mpd_host); cid->mpd_host = g_strdup ("localhost"); } gchar *cEncrypted = NULL; cEncrypted = CID_CONFIG_GET_STRING ("MPD", "MPD_PASS"); //cid_decrypt_string (cEncrypted, &cid->mpd_pass); cid->mpd_pass = g_strdup (cEncrypted); g_free (cEncrypted); cid->mpd_port = CID_CONFIG_GET_INTEGER_WITH_DEFAULT ("MPD", "MPD_PORT", 6600); cid->config->iWidth = pSize[0] <= MAX_SIZE ? pSize[0] : MAX_SIZE; cid->config->iHeight = pSize[1] <= MAX_SIZE ? pSize[1] : MAX_SIZE; if (!bUnvalidKey) { cid->config->dRed = cid->config->dColor[0]; cid->config->dGreen = cid->config->dColor[1]; cid->config->dBlue = cid->config->dColor[2]; cid->config->dAlpha = cid->config->dColor[3]; cid->runtime->dFocusVariation = cid->config->dFlyingColor[3]>cid->config->dAlpha ? +1 : -1; cid->config->iExtraSize = (cid->config->iHeight + cid->config->iWidth)/20; cid->config->iPrevNextSize = cid->config->iExtraSize * 2; cid->config->iPlayPauseSize = cid->config->iExtraSize * 3; } cid_key_file_free(pCid); if (bUnvalidKey && !bReloaded) { cid_save_data (pCid); cid_read_key_file (pCid, f); bReloaded = TRUE; } }
else { gchar *subtitle = NULL, *font_desc; gdouble *my_points = NULL, *p_start, *p_stop, *c_start, *c_stop; gsize length; gint anim_id,anim_duration, text_pos, placing, gradient; GdkPixbuf *pix = NULL; gboolean load_ok, img_load_ok; gchar *original_filename = NULL; GtkIconTheme *icon_theme; GtkIconInfo *icon_info; const gchar *icon_filename; ImgAngle angle = 0; /* Load project backgroud color */ color = g_key_file_get_double_list( img_key_file, "slideshow settings", "background color", NULL, NULL ); img->background_color[0] = color[0]; img->background_color[1] = color[1]; img->background_color[2] = color[2]; g_free( color ); /* Loads the thumbnails and set the slides info */ number = g_key_file_get_integer( img_key_file, "slideshow settings", "number of slides", NULL); /* Store the previous number of slides and set img->slides_nr so to have the correct number of slides displayed on the status bar */ previous_nr_of_slides = img->slides_nr; img->slides_nr = number; gtk_widget_show( img->progress_bar ); for( i = 1; i <= number; i++ ) {