diff --git a/src/matrix-c-compacts.c b/src/matrix-c-compacts.c index 5d89882..476e8c4 100644 --- a/src/matrix-c-compacts.c +++ b/src/matrix-c-compacts.c @@ -1049,7 +1049,7 @@ matrix_filter_get_json_node(MatrixJsonCompact *matrix_json_compact, GError **err json_builder_end_array(builder); json_builder_set_member_name(builder, "event_format"); - json_builder_add_string_value(builder, _matrix_g_enum_to_string(MATRIX_TYPE_EVENT_FORMAT, priv->_event_format, TRUE)); + json_builder_add_string_value(builder, _matrix_g_enum_to_string(MATRIX_TYPE_EVENT_FORMAT, priv->_event_format, '_')); json_builder_set_member_name(builder, "presence"); node = matrix_json_compact_get_json_node(MATRIX_JSON_COMPACT(priv->_presence_filter), &inner_error); @@ -2231,7 +2231,7 @@ matrix_search_grouping_get_json_node(MatrixJsonCompact *matrix_json_compact, GEr json_builder_set_member_name(builder, "key"); - json_builder_add_string_value(builder, _matrix_g_enum_to_string(MATRIX_TYPE_SEARCH_GROUP_BY, priv->_key, TRUE)); + json_builder_add_string_value(builder, _matrix_g_enum_to_string(MATRIX_TYPE_SEARCH_GROUP_BY, priv->_key, '_')); json_builder_end_object(builder); diff --git a/src/utils.c b/src/utils.c index 5c4f8da..822f0cd 100644 --- a/src/utils.c +++ b/src/utils.c @@ -35,7 +35,7 @@ * Returns: (transfer full) the converted enum name, which must be freed */ gchar * -_matrix_g_enum_to_string(GType enum_type, gint value, gboolean convert_dashes) +_matrix_g_enum_to_string(GType enum_type, gint value, gchar convert_dashes) { GEnumClass *enum_class = g_type_class_ref(enum_type); GEnumValue *enum_value = g_enum_get_value(enum_class, value); @@ -49,7 +49,7 @@ _matrix_g_enum_to_string(GType enum_type, gint value, gboolean convert_dashes) for (a = nick; *a; a++) { if (*a == '-') { - *a = '_'; + *a = convert_dashes; } } } diff --git a/src/utils.h b/src/utils.h index a5a14c5..ab432a1 100644 --- a/src/utils.h +++ b/src/utils.h @@ -23,7 +23,7 @@ G_BEGIN_DECLS -gchar *_matrix_g_enum_to_string(GType enum_type, gint value, gboolean convert_dashes); +gchar *_matrix_g_enum_to_string(GType enum_type, gint value, gchar convert_dashes); gint _matrix_g_enum_nick_to_value(GType enum_type, const gchar *nick, GError **error); G_END_DECLS diff --git a/vapi/c-api.vapi b/vapi/c-api.vapi index 61b81e5..ba2fc44 100644 --- a/vapi/c-api.vapi +++ b/vapi/c-api.vapi @@ -384,7 +384,7 @@ namespace Matrix { /* Utilities */ [CCode (cheader_filename = "utils.h", cname = "_matrix_g_enum_to_string")] - public string? _g_enum_value_to_nick(GLib.Type enum_type, int value, bool convert_dashes = true); + public string? _g_enum_value_to_nick(GLib.Type enum_type, int value, char convert_dashes = '_'); [CCode (cheader_filename = "utils.h", cname = "_matrix_g_enum_nick_to_value")] public int _g_enum_nick_to_value(GLib.Type enum_type, string nick)