void prefs_save(void) { int i; gpointer ptr; for (i=0;i<NUM_PREFS_DATA;i++) { if ((prefs_data[i].type == PREF_NONE) || (prefs_data[i].type == PREF_END_GROUP)) continue; ptr = (char *)&prefs + prefs_data[i].offset; switch (prefs_data[i].type) { case PREF_BOOLEAN: persistence_set_boolean(prefs_data[i].name, *(gint *)ptr); break; case PREF_INT: case PREF_UINT: persistence_set_integer(prefs_data[i].name, *(gint *)ptr); break; case PREF_REAL: case PREF_UREAL: persistence_set_real(prefs_data[i].name, *(real *)ptr); break; case PREF_COLOUR: persistence_set_color(prefs_data[i].name, (Color *)ptr); break; case PREF_CHOICE: case PREF_STRING: persistence_set_string(prefs_data[i].name, *(gchar **)ptr); break; case PREF_NONE: case PREF_END_GROUP: break; } } }
/** Set the default background color for new objects. * @param color A color object to use for background color. This object is * not stored by ths function and can be freed afterwards. */ void attributes_set_background(Color *color) { attributes_background = *color; persistence_set_color("bg_color", color); }
/** Set the default foreground color for new objects. * @param color A color object to use for foreground color. This object is * not stored by ths function and can be freed afterwards. */ void attributes_set_foreground(Color *color) { attributes_foreground = *color; persistence_set_color("fg_color", color); }