Rework _g_enum_to_string in Vala

Its new name is Matrix._g_enum_value_to_nick
This commit is contained in:
2016-03-04 08:58:56 +01:00
parent bd4efee0cf
commit 4d1d6562d0
7 changed files with 61 additions and 39 deletions

View File

@@ -19,6 +19,7 @@
#include "config.h"
#include "matrix-http-api.h"
#include "matrix-enumtypes.h"
#include "matrix-glib.h"
#include "utils.h"
#include <string.h>
@@ -965,7 +966,7 @@ i_create_room(MatrixAPI *api,
}
if (preset != MATRIX_ROOM_PRESET_NONE) {
gchar *preset_string = _g_enum_to_string(
gchar *preset_string = _matrix_g_enum_value_to_nick(
MATRIX_TYPE_ROOM_PRESET, preset, TRUE);
if (preset_string) {
@@ -988,7 +989,7 @@ i_create_room(MatrixAPI *api,
}
if (visibility != MATRIX_ROOM_VISIBILITY_DEFAULT) {
gchar *visibility_string = _g_enum_to_string(
gchar *visibility_string = _matrix_g_enum_value_to_nick(
MATRIX_TYPE_ROOM_VISIBILITY, visibility, TRUE);
if (visibility_string) {
@@ -1343,7 +1344,8 @@ i_set_user_presence(MatrixAPI *api,
json_builder_begin_object(builder);
json_builder_set_member_name(builder, "presence");
presence_string = _g_enum_to_string(MATRIX_TYPE_PRESENCE, presence, TRUE);
presence_string = _matrix_g_enum_value_to_nick(MATRIX_TYPE_PRESENCE,
presence, TRUE);
json_builder_add_string_value(builder, presence_string);
g_free(presence_string);
@@ -1411,7 +1413,7 @@ i_delete_pusher(MatrixAPI *api,
encoded_scope = soup_uri_encode(scope, NULL);
encoded_rule_id = soup_uri_encode(rule_id, NULL);
kind_string = _g_enum_to_string(MATRIX_TYPE_PUSHER_KIND, kind, TRUE);
kind_string = _matrix_g_enum_value_to_nick(MATRIX_TYPE_PUSHER_KIND, kind, TRUE);
path = g_strdup_printf("pushrules/%s/%s/%s",
encoded_scope,
@@ -1443,7 +1445,8 @@ i_get_pusher(MatrixAPI *api,
encoded_scope = soup_uri_encode(scope, NULL);
encoded_rule_id = soup_uri_encode(rule_id, NULL);
kind_string = _g_enum_to_string(MATRIX_TYPE_PUSHER_KIND, kind, TRUE);
kind_string = _matrix_g_enum_value_to_nick(MATRIX_TYPE_PUSHER_KIND,
kind, TRUE);
path = g_strdup_printf("pushrules/%s/%s/%s",
encoded_scope,
@@ -1466,7 +1469,7 @@ static void
add_condition_kind_object(MatrixPusherConditionKind kind,
JsonBuilder *builder)
{
gchar *kind_string = _g_enum_to_string(
gchar *kind_string = _matrix_g_enum_value_to_nick(
MATRIX_TYPE_PUSHER_CONDITION_KIND, kind, TRUE);
if (!kind_string) {
@@ -1502,7 +1505,8 @@ static void i_add_pusher(MatrixAPI *api,
encoded_scope = soup_uri_encode(scope, NULL);
encoded_rule_id = soup_uri_encode(rule_id, NULL);
kind_string = _g_enum_to_string(MATRIX_TYPE_PUSHER_KIND, kind, TRUE);
kind_string = _matrix_g_enum_value_to_nick(MATRIX_TYPE_PUSHER_KIND,
kind, TRUE);
path = g_strdup_printf("pushrules/%s/%s/%s",
encoded_scope,
@@ -1566,7 +1570,8 @@ i_toggle_pusher(MatrixAPI *api,
encoded_scope = soup_uri_encode(scope, NULL);
encoded_rule_id = soup_uri_encode(rule_id, NULL);
kind_string = _g_enum_to_string(MATRIX_TYPE_PUSHER_KIND, kind, TRUE);
kind_string = _matrix_g_enum_value_to_nick(MATRIX_TYPE_PUSHER_KIND,
kind, TRUE);
path = g_strdup_printf("pushrules/%s/%s/%s",
encoded_scope,
@@ -1949,7 +1954,7 @@ i_send_event_receipt(MatrixAPI *api,
encoded_room_id = soup_uri_encode(room_id, NULL);
encoded_event_id = soup_uri_encode(event_id, NULL);
receipt_type_string = _g_enum_to_string(MATRIX_TYPE_RECEIPT_TYPE,
receipt_type_string = _matrix_g_enum_value_to_nick(MATRIX_TYPE_RECEIPT_TYPE,
receipt_type,
TRUE);
path = g_strdup_printf("rooms/%s/receipt/%s/%s",
@@ -2599,8 +2604,9 @@ i_register_account(MatrixAPI *api,
g_object_unref(builder);
if (account_kind != MATRIX_ACCOUNT_KIND_DEFAULT) {
gchar *kind_string = _g_enum_to_string(MATRIX_TYPE_ACCOUNT_KIND,
account_kind, TRUE);
gchar *kind_string = _matrix_g_enum_value_to_nick(
MATRIX_TYPE_ACCOUNT_KIND,
account_kind, TRUE);
params = create_query_params();