Commit 5138be21e59e7c51610045bfb736840c0e59df24

Authored by Perry Werneck
1 parent ecbf3ba6

Grouping property descriptors.

src/core/properties/boolean.c
@@ -27,6 +27,11 @@ @@ -27,6 +27,11 @@
27 * 27 *
28 */ 28 */
29 29
  30 + /**
  31 + * @brief Implements the boolean properties.
  32 + *
  33 + */
  34 +
30 #include <config.h> 35 #include <config.h>
31 #include <internals.h> 36 #include <internals.h>
32 #include <string.h> 37 #include <string.h>
@@ -66,6 +71,7 @@ @@ -66,6 +71,7 @@
66 71
67 { 72 {
68 .name = "tso", // Property name. 73 .name = "tso", // Property name.
  74 + .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group.
69 .description = N_( "Non zero if the host is TSO." ), // Property description. 75 .description = N_( "Non zero if the host is TSO." ), // Property description.
70 .get = lib3270_is_tso, // Get value. 76 .get = lib3270_is_tso, // Get value.
71 .set = lib3270_set_tso // Set value. 77 .set = lib3270_set_tso // Set value.
@@ -73,6 +79,7 @@ @@ -73,6 +79,7 @@
73 79
74 { 80 {
75 .name = "as400", // Property name. 81 .name = "as400", // Property name.
  82 + .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group.
76 .description = N_( "Non zero if the host is AS400." ), // Property description. 83 .description = N_( "Non zero if the host is AS400." ), // Property description.
77 .get = lib3270_is_as400, // Get value. 84 .get = lib3270_is_as400, // Get value.
78 .set = lib3270_set_as400 // Set value. 85 .set = lib3270_set_as400 // Set value.
src/core/properties/string.c
@@ -67,46 +67,50 @@ @@ -67,46 +67,50 @@
67 }, 67 },
68 68
69 { 69 {
70 - .name = "url", // Property name.  
71 - .icon = "network-server", // Property icon.  
72 - .description = N_( "URL of the current host" ), // Property description.  
73 - .get = lib3270_get_url, // Get value.  
74 - .set = lib3270_set_url // Set value. 70 + .name = "url", // Property name.
  71 + .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group.
  72 + .icon = "network-server", // Property icon.
  73 + .description = N_( "URL of the current host" ), // Property description.
  74 + .get = lib3270_get_url, // Get value.
  75 + .set = lib3270_set_url // Set value.
75 }, 76 },
76 77
77 { 78 {
78 - .name = "model", // Property name.  
79 - .description = N_( "Model name" ), // Property description.  
80 - .get = lib3270_get_model_name, // Get value.  
81 - .set = lib3270_set_model_name // Set value. 79 + .name = "model", // Property name.
  80 + .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group.
  81 + .description = N_( "Model name" ), // Property description.
  82 + .get = lib3270_get_model_name, // Get value.
  83 + .set = lib3270_set_model_name // Set value.
82 }, 84 },
83 85
84 { 86 {
85 - .name = "hosttype", // Property name.  
86 - .description = N_( "Host type name" ), // Property description.  
87 - .get = lib3270_get_host_type_name, // Get value.  
88 - .set = lib3270_set_host_type_by_name // Set value. 87 + .name = "hosttype", // Property name.
  88 + .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group.
  89 + .description = N_( "Host type name" ), // Property description.
  90 + .get = lib3270_get_host_type_name, // Get value.
  91 + .set = lib3270_set_host_type_by_name // Set value.
89 }, 92 },
90 93
91 { 94 {
92 - .name = "termtype", // Property name.  
93 - .description = N_( "Terminal type" ), // Property description.  
94 - .get = lib3270_get_termtype, // Get value.  
95 - .set = NULL // Set value. 95 + .name = "termtype", // Property name.
  96 + .description = N_( "Terminal type" ), // Property description.
  97 + .get = lib3270_get_termtype, // Get value.
  98 + .set = NULL // Set value.
96 }, 99 },
97 100
98 { 101 {
99 - .name = "termname", // Property name.  
100 - .description = N_( "Terminal name" ), // Property description.  
101 - .get = lib3270_get_termname, // Get value.  
102 - .set = NULL // Set value. 102 + .name = "termname", // Property name.
  103 + .description = N_( "Terminal name" ), // Property description.
  104 + .get = lib3270_get_termname, // Get value.
  105 + .set = NULL // Set value.
103 }, 106 },
104 107
105 { 108 {
106 - .name = "host_charset", // Property name.  
107 - .description = N_( "Host charset" ), // Property description.  
108 - .get = lib3270_get_host_charset, // Get value.  
109 - .set = lib3270_set_host_charset // Set value. 109 + .name = "host_charset", // Property name.
  110 + .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.
110 }, 114 },
111 115
112 { 116 {
@@ -132,6 +136,7 @@ @@ -132,6 +136,7 @@
132 136
133 { 137 {
134 .name = "crlpath", // Property name. 138 .name = "crlpath", // Property name.
  139 + .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group.
135 .description = N_( "URL for the certificate revocation list" ), // Property description. 140 .description = N_( "URL for the certificate revocation list" ), // Property description.
136 .get = lib3270_get_crl_url, // Get value. 141 .get = lib3270_get_crl_url, // Get value.
137 .set = lib3270_set_crl_url, // Set value. 142 .set = lib3270_set_crl_url, // Set value.
@@ -139,6 +144,7 @@ @@ -139,6 +144,7 @@
139 144
140 { 145 {
141 .name = "crlprefer", // Property name. 146 .name = "crlprefer", // Property name.
  147 + .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group.
142 .description = N_( "Prefered protocol for CRL" ), // Property description. 148 .description = N_( "Prefered protocol for CRL" ), // Property description.
143 .get = lib3270_get_crl_prefered_protocol, // Get value. 149 .get = lib3270_get_crl_prefered_protocol, // Get value.
144 .set = lib3270_set_crl_prefered_protocol, // Set value. 150 .set = lib3270_set_crl_prefered_protocol, // Set value.
@@ -167,6 +173,7 @@ @@ -167,6 +173,7 @@
167 173
168 { 174 {
169 .name = "oversize", // Property name. 175 .name = "oversize", // Property name.
  176 + .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group.
170 .description = N_( "Screen oversize if larger than the chosen model"), // Property description. 177 .description = N_( "Screen oversize if larger than the chosen model"), // Property description.
171 .get = lib3270_get_oversize, // Get value. 178 .get = lib3270_get_oversize, // Get value.
172 .set = lib3270_set_oversize // Set value. 179 .set = lib3270_set_oversize // Set value.
src/core/properties/unsigned.c
@@ -60,14 +60,16 @@ @@ -60,14 +60,16 @@
60 static const LIB3270_UINT_PROPERTY properties[] = { 60 static const LIB3270_UINT_PROPERTY properties[] = {
61 61
62 { 62 {
63 - .name = "color_type", // Property name.  
64 - .description = N_( "The color type" ), // Property description.  
65 - .get = lib3270_get_color_type, // Get value.  
66 - .set = lib3270_set_color_type // Set value. 63 + .name = "color_type", // Property name.
  64 + .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group.
  65 + .description = N_( "The color type" ), // Property description.
  66 + .get = lib3270_get_color_type, // Get value.
  67 + .set = lib3270_set_color_type // Set value.
67 }, 68 },
68 69
69 { 70 {
70 .name = "model_number", // Property name. 71 .name = "model_number", // Property name.
  72 + .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group.
71 .icon = "video-display", // Property Icon. 73 .icon = "video-display", // Property Icon.
72 .label = N_("Terminal model"), // Property label. 74 .label = N_("Terminal model"), // Property label.
73 .description = N_( "The model number" ), // Property description. 75 .description = N_( "The model number" ), // Property description.
@@ -80,6 +82,7 @@ @@ -80,6 +82,7 @@
80 82
81 { 83 {
82 .name = "cursor_address", // Property name. 84 .name = "cursor_address", // Property name.
  85 + .group = LIB3270_ACTION_GROUP_ONLINE, // Property group.
83 .description = N_( "Cursor address" ), // Property description. 86 .description = N_( "Cursor address" ), // Property description.
84 .get = lib3270_get_cursor_address, // Get value. 87 .get = lib3270_get_cursor_address, // Get value.
85 .set = lib3270_set_cursor_address // Set value. 88 .set = lib3270_set_cursor_address // Set value.
src/include/lib3270.h
@@ -359,12 +359,27 @@ @@ -359,12 +359,27 @@
359 359
360 #endif 360 #endif
361 361
  362 + /// @brief Action/property groups.
  363 + typedef enum _lib3270_action_group
  364 + {
  365 + LIB3270_ACTION_GROUP_NONE, ///< @brief Simple action, no signals os special treatment.
  366 + LIB3270_ACTION_GROUP_ONLINE, ///< @brief Action requires online state.
  367 + LIB3270_ACTION_GROUP_OFFLINE, ///< @brief Action requires offline state.
  368 + LIB3270_ACTION_GROUP_SELECTION, ///< @brief Action depends on selection.
  369 + LIB3270_ACTION_GROUP_LOCK_STATE, ///< @brief Action depends on keyboard lock state.
  370 + LIB3270_ACTION_GROUP_FORMATTED, ///< @brief Action depends on a formatted screen.
  371 +
  372 + LIB3270_ACTION_GROUP_CUSTOM ///< @brief Custom group/Number of groups.
  373 + } LIB3270_ACTION_GROUP;
  374 +
  375 +
362 /** 376 /**
363 * @brief Head for property descriptors. 377 * @brief Head for property descriptors.
364 * 378 *
365 */ 379 */
366 #define LIB3270_PROPERTY_HEAD \ 380 #define LIB3270_PROPERTY_HEAD \
367 const char * name; \ 381 const char * name; \
  382 + LIB3270_ACTION_GROUP group; \
368 const char * label; \ 383 const char * label; \
369 const char * icon; \ 384 const char * icon; \
370 const char * summary; \ 385 const char * summary; \
src/include/lib3270/actions.h
@@ -33,18 +33,6 @@ @@ -33,18 +33,6 @@
33 extern "C" { 33 extern "C" {
34 #endif 34 #endif
35 35
36 - typedef enum _lib3270_action_group  
37 - {  
38 - LIB3270_ACTION_GROUP_NONE, ///< @brief Simple action, no signals os special treatment.  
39 - LIB3270_ACTION_GROUP_ONLINE, ///< @brief Action requires online state.  
40 - LIB3270_ACTION_GROUP_OFFLINE, ///< @brief Action requires offline state.  
41 - LIB3270_ACTION_GROUP_SELECTION, ///< @brief Action depends on selection.  
42 - LIB3270_ACTION_GROUP_LOCK_STATE, ///< @brief Action depends on keyboard lock state.  
43 - LIB3270_ACTION_GROUP_FORMATTED, ///< @brief Action depends on a formatted screen.  
44 -  
45 - LIB3270_ACTION_GROUP_CUSTOM ///< @brief Custom group/Number of groups.  
46 - } LIB3270_ACTION_GROUP;  
47 -  
48 typedef enum _lib3270_action_type 36 typedef enum _lib3270_action_type
49 { 37 {
50 LIB3270_ACTION_TYPE_GENERIC, ///< @brief Generic action. 38 LIB3270_ACTION_TYPE_GENERIC, ///< @brief Generic action.
@@ -61,7 +49,6 @@ @@ -61,7 +49,6 @@
61 { 49 {
62 LIB3270_PROPERTY_HEAD 50 LIB3270_PROPERTY_HEAD
63 51
64 - LIB3270_ACTION_GROUP group; ///< @brief Action group.  
65 LIB3270_ACTION_TYPE type; ///< @brief Action type. 52 LIB3270_ACTION_TYPE type; ///< @brief Action type.
66 53
67 int (*activate)(H3270 *hSession); ///< @brief lib3270 associated method. 54 int (*activate)(H3270 *hSession); ///< @brief lib3270 associated method.