@kugel-
I don't understand the benefit of using union over casting the pointers. Based on what I'm reading online, they're both considered "bad". It also looks like switching to using unions may require changing existing code, which I've been trying to avoid.
I'm probably doing this wrong... I tried adding the following union to `stash.h`: ```C typedef union { gboolean b; gint n; gdouble d; gchar *s; gchar **v; const gchar *cs; const gchar **cv; } StashPrefType; ```
The StashPref struct becomes: ```C struct StashPref { /* ... */ StashPrefType *setting; StashPrefType default_value; /* ... */ }; ```
Some functions need to be redefined: ```C add_pref(StashGroup *group, GType type, StashPrefType *setting, const gchar *key_name, StashPrefType default_value);
static StashPref * add_widget_pref(StashGroup *group, GType setting_type, StashPrefType *setting, const gchar *key_name, StashPrefType default_value, GType widget_type, StashWidgetID widget_id);
void stash_group_add_widget_property(StashGroup *group, StashPrefType *setting, const gchar *key_name, StashPrefType default_value, StashWidgetID widget_id, const gchar *property_name, GType type); ```
To use StashPrefType requires something like: ```C int *setting = &se->setting->n; double *setting = &se->setting->d; ```
Then calls to the above functions need to have casts to `StashPrefType`, like: ```C add_pref(group, G_TYPE_BOOLEAN, (StashPrefType *) setting, key_name, (StashPrefType)default_value); ```
And any external uses of `stash_group_add_widget_property()` (`sidebar.c` and maybe plugins) also need to cast StashPrefType.