From 147e18757bc93372807fc7cd16bffcf25c88906b Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Mon, 25 Nov 2019 18:30:09 -0300 Subject: [PATCH] Adding host-type property as an unsigned int value for saving in the session properties. --- src/core/properties/string.c | 16 ++++++++-------- src/core/properties/unsigned.c | 30 ++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/core/properties/string.c b/src/core/properties/string.c index cdd78bd..2a7aff0 100644 --- a/src/core/properties/string.c +++ b/src/core/properties/string.c @@ -79,19 +79,19 @@ }, { - .name = "model", // Property name. + .name = "model", // Property name. .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group. - .description = N_( "Model name" ), // Property description. - .get = lib3270_get_model_name, // Get value. - .set = lib3270_set_model_name // Set value. + .description = N_( "Model name" ), // Property description. + .get = lib3270_get_model_name, // Get value. + .set = lib3270_set_model_name // Set value. }, { - .name = "hosttype", // Property name. + .name = "host_type_name", // Property name. .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group. - .description = N_( "Host type name" ), // Property description. - .get = lib3270_get_host_type_name, // Get value. - .set = lib3270_set_host_type_by_name // Set value. + .description = N_( "Host type name" ), // Property description. + .get = lib3270_get_host_type_name, // Get value. + .set = lib3270_set_host_type_by_name // Set value. }, { diff --git a/src/core/properties/unsigned.c b/src/core/properties/unsigned.c index fb03b33..a5d3818 100644 --- a/src/core/properties/unsigned.c +++ b/src/core/properties/unsigned.c @@ -54,17 +54,39 @@ return NULL; } +int lib3270_set_host_type_number(H3270 *hSession, unsigned int host_type) +{ + FAIL_IF_ONLINE(hSession); + hSession->host_type = host_type; + return 0; +} + +static unsigned int lib3270_get_host_type_number(const H3270 *hSession) +{ + return (unsigned int) hSession->host_type; +} + const LIB3270_UINT_PROPERTY * lib3270_get_unsigned_properties_list(void) { static const LIB3270_UINT_PROPERTY properties[] = { { - .name = "color_type", // Property name. + .name = "color_type", // Property name. + .default_value = 16, // Default value for the property. + .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group. + .description = N_( "The color type" ), // Property description. + .get = lib3270_get_color_type, // Get value. + .set = lib3270_set_color_type // Set value. + }, + + { + .name = "host_type", // Property name. + .default_value = (unsigned int) LIB3270_HOST_S390, .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group. - .description = N_( "The color type" ), // Property description. - .get = lib3270_get_color_type, // Get value. - .set = lib3270_set_color_type // Set value. + .description = N_( "Host type number" ), // Property description. + .get = lib3270_get_host_type_number, // Get value. + .set = lib3270_set_host_type_number // Set value. }, { -- libgit2 0.21.2