} type;
union {
gchar *string;
- GList *list;
+ gchar **list;
ObActionList *actions;
} v;
};
case OB_CV_STRING:
g_free(v->v.string);
break;
- case OB_CV_LIST: {
- GList *it;
- for (it = v->v.list; it; it = g_list_next(it))
- config_value_unref(it->data);
- g_list_free(v->v.list);
+ case OB_CV_LIST:
+ g_strfreev(v->v.list);
break;
- }
case OB_CV_ACTION_LIST:
action_list_unref(v->v.actions);
break;
return v->type == OB_CV_STRING;
}
-gboolean config_value_is_list(const ObConfigValue *v)
+gboolean config_value_is_string_list(const ObConfigValue *v)
{
g_return_val_if_fail(v != NULL, FALSE);
return v->type == OB_CV_LIST;
*p.coord = c;
break;
}
- case OB_CONFIG_VALUE_LIST:
- *p.list = config_value_list(v);
+ case OB_CONFIG_VALUE_STRING_LIST: {
+ *p.list = config_value_string_list(v);
break;
+ }
case OB_CONFIG_VALUE_ACTIONLIST:
*p.actions = config_value_action_list(v);
break;
c->denom = atoi(s+1);
}
}
-GList* config_value_list(ObConfigValue *v)
+const gchar *const* config_value_string_list(ObConfigValue *v)
{
g_return_val_if_fail(v != NULL, NULL);
- g_return_val_if_fail(config_value_is_list(v), NULL);
- return v->v.list;
+ g_return_val_if_fail(config_value_is_string_list(v), NULL);
+ return (const gchar**)v->v.list;
}
ObActionList* config_value_action_list(ObConfigValue *v)
{
return v;
}
-ObConfigValue* config_value_new_list(GList *list)
+ObConfigValue* config_value_new_string_list(gchar **list)
{
- GList *c = g_list_copy(list);
- GList *it;
-
- for (it = c; it; it = g_list_next(it))
- config_value_ref(it->data);
- return config_value_new_list_steal(c);
+ return config_value_new_string_list_steal(g_strdupv(list));
}
-ObConfigValue* config_value_new_list_steal(GList *list)
+ObConfigValue* config_value_new_string_list_steal(gchar **list)
{
ObConfigValue *v = g_slice_new(ObConfigValue);
v->ref = 1;
OB_CONFIG_VALUE_INTEGER,
OB_CONFIG_VALUE_FRACTION,
OB_CONFIG_VALUE_GRAVITY_COORD,
- OB_CONFIG_VALUE_LIST,
+ OB_CONFIG_VALUE_STRING_LIST,
OB_CONFIG_VALUE_ACTIONLIST,
NUM_OB_CONFIG_VALUE_TYPES
} ObConfigValueDataType;
/*! This holds a pointer to one of the possible types in ObConfigValueType. */
-typedef union {
+typedef union _ObConfigValueDataPtr {
const gpointer *pointer; /*!< Generic pointer */
const gchar **string;
gboolean *boolean;
guint numer;
guint denom;
} *fraction;
- GravityCoord *coord;
- const GList **list; /*!< A list of ObConfigValue objects */
+ struct _GravityCoord *coord;
+ const gchar *const**list;
struct _ObActionList **actions;
} ObConfigValueDataPtr;
/*! Creates a config value which holds a list of other values
This function copies the list and adds a refcount to the values within. */
-ObConfigValue* config_value_new_list(GList *list);
+ObConfigValue* config_value_new_string_list(gchar **list);
/*! Creates a config value which holds a list of other values.
This function steals ownership the list and the values within. */
-ObConfigValue* config_value_new_list_steal(GList *list);
+ObConfigValue* config_value_new_string_list_steal(gchar **list);
+
ObConfigValue* config_value_new_action_list(struct _ObActionList *al);
gboolean config_value_is_string(const ObConfigValue *v);
-gboolean config_value_is_list(const ObConfigValue *v);
+gboolean config_value_is_string_list(const ObConfigValue *v);
gboolean config_value_is_action_list(const ObConfigValue *v);
/*! Copies the data inside @v to the destination that the pointer @p is
void config_value_fraction(ObConfigValue *v, gint *numer, gint *denom);
void config_value_gravity_coord(ObConfigValue *v, struct _GravityCoord *c);
-/* These ones are valid on a list value */
+/* These ones are valid on a string list value */
-GList* config_value_list(ObConfigValue *v);
+gchar const*const* config_value_string_list(ObConfigValue *v);
/* These ones are value on a action list value */