Commit 725b8136bc42105a0d7e520e9474f7faea491af9
1 parent
618c4200
Exists in
master
and in
3 other branches
Adding default values for properties.
Showing
4 changed files
with
20 additions
and
7 deletions
Show diff stats
src/core/properties/string.c
| ... | ... | @@ -68,6 +68,9 @@ |
| 68 | 68 | |
| 69 | 69 | { |
| 70 | 70 | .name = "url", // Property name. |
| 71 | +#ifdef LIB3270_DEFAULT_HOST | |
| 72 | + .default_value = LIB3270_DEFAULT_HOST, // Default value. | |
| 73 | +#endif // LIB3270_DEFAULT_HOST | |
| 71 | 74 | .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group. |
| 72 | 75 | .icon = "network-server", // Property icon. |
| 73 | 76 | .description = N_( "URL of the current host" ), // Property description. |
| ... | ... | @@ -106,11 +109,12 @@ |
| 106 | 109 | }, |
| 107 | 110 | |
| 108 | 111 | { |
| 109 | - .name = "host_charset", // Property name. | |
| 112 | + .name = "host_charset", // Property name. | |
| 113 | + .default_value = "bracket", // Default charset. | |
| 110 | 114 | .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group. |
| 111 | - .description = N_( "Host charset" ), // Property description. | |
| 112 | - .get = lib3270_get_host_charset, // Get value. | |
| 113 | - .set = lib3270_set_host_charset // Set value. | |
| 115 | + .description = N_( "Host charset" ), // Property description. | |
| 116 | + .get = lib3270_get_host_charset, // Get value. | |
| 117 | + .set = lib3270_set_host_charset // Set value. | |
| 114 | 118 | }, |
| 115 | 119 | |
| 116 | 120 | { | ... | ... |
src/core/properties/unsigned.c
| ... | ... | @@ -125,6 +125,11 @@ |
| 125 | 125 | |
| 126 | 126 | { |
| 127 | 127 | .name = "unlock_delay", // Property name. |
| 128 | +#ifdef UNLOCK_MS | |
| 129 | + .default_value = UNLOCK_MS, | |
| 130 | +#else | |
| 131 | + .default_value = 350, | |
| 132 | +#endif // UNLOCK_MS | |
| 128 | 133 | .description = N_( "The delay between the host unlocking the keyboard and the actual unlock" ), // Property description. |
| 129 | 134 | .get = lib3270_get_unlock_delay, // Get value. |
| 130 | 135 | .set = lib3270_set_unlock_delay // Set value. | ... | ... |
src/core/session.c
| ... | ... | @@ -413,7 +413,7 @@ H3270 * lib3270_session_new(const char *model) |
| 413 | 413 | if(!default_session) |
| 414 | 414 | default_session = hSession; |
| 415 | 415 | |
| 416 | - lib3270_session_init(hSession, model, _( "bracket" ) ); | |
| 416 | + lib3270_session_init(hSession, model, "bracket" ); | |
| 417 | 417 | |
| 418 | 418 | if(screen_init(hSession)) |
| 419 | 419 | return NULL; | ... | ... |
src/include/lib3270/properties.h
| ... | ... | @@ -51,6 +51,8 @@ |
| 51 | 51 | int (*get)(const H3270 *hSession); ///< @brief Get value. |
| 52 | 52 | int (*set)(H3270 *hSession, int value); ///< @brief Set value. |
| 53 | 53 | |
| 54 | + int default_value; ///< @brief Default value for the property. | |
| 55 | + | |
| 54 | 56 | } LIB3270_INT_PROPERTY; |
| 55 | 57 | |
| 56 | 58 | typedef struct _lib3270_uint_property |
| ... | ... | @@ -70,8 +72,10 @@ |
| 70 | 72 | { |
| 71 | 73 | LIB3270_PROPERTY_HEAD |
| 72 | 74 | |
| 73 | - const char * (*get)(const H3270 *hSession); ///< @brief Get value. | |
| 74 | - int (*set)(H3270 *hSession, const char * value); ///< @brief Set value. | |
| 75 | + const char * (*get)(const H3270 *hSession); ///< @brief Get value. | |
| 76 | + int (*set)(H3270 *hSession, const char * value); ///< @brief Set value. | |
| 77 | + | |
| 78 | + const char * default_value; ///< @brief Default value | |
| 75 | 79 | |
| 76 | 80 | } LIB3270_STRING_PROPERTY; |
| 77 | 81 | ... | ... |