Commit ff320ce9aea75920cb900773681c71daa9d09131

Authored by Perry Werneck
1 parent 3f46e593

Adding action groups (required for GAction implementatin).

src/core/actions/table.c
@@ -83,6 +83,8 @@ @@ -83,6 +83,8 @@
83 .label = N_( "_Connect" ) , 83 .label = N_( "_Connect" ) ,
84 .summary = N_( "Connect to host." ), 84 .summary = N_( "Connect to host." ),
85 .activate = connect_host, 85 .activate = connect_host,
  86 +
  87 + .group = LIB3270_ACTION_GROUP_OFFLINE,
86 .activatable = lib3270_is_disconnected 88 .activatable = lib3270_is_disconnected
87 }, 89 },
88 90
@@ -93,6 +95,8 @@ @@ -93,6 +95,8 @@
93 .label = N_( "_Disconnect" ), 95 .label = N_( "_Disconnect" ),
94 .summary = N_( "Disconnect from host." ), 96 .summary = N_( "Disconnect from host." ),
95 .activate = lib3270_disconnect, 97 .activate = lib3270_disconnect,
  98 +
  99 + .group = LIB3270_ACTION_GROUP_ONLINE,
96 .activatable = lib3270_is_connected 100 .activatable = lib3270_is_connected
97 }, 101 },
98 102
@@ -106,6 +110,8 @@ @@ -106,6 +110,8 @@
106 .label = NULL, 110 .label = NULL,
107 .summary = N_( "Cursor up 1 position." ), 111 .summary = N_( "Cursor up 1 position." ),
108 .activate = lib3270_cursor_up, 112 .activate = lib3270_cursor_up,
  113 +
  114 + .group = LIB3270_ACTION_GROUP_ONLINE,
109 .activatable = lib3270_is_connected 115 .activatable = lib3270_is_connected
110 }, 116 },
111 117
@@ -116,6 +122,8 @@ @@ -116,6 +122,8 @@
116 .label = NULL, 122 .label = NULL,
117 .summary = N_( "Cursor down 1 position." ), 123 .summary = N_( "Cursor down 1 position." ),
118 .activate = lib3270_cursor_down, 124 .activate = lib3270_cursor_down,
  125 +
  126 + .group = LIB3270_ACTION_GROUP_ONLINE,
119 .activatable = lib3270_is_connected 127 .activatable = lib3270_is_connected
120 }, 128 },
121 129
@@ -126,6 +134,8 @@ @@ -126,6 +134,8 @@
126 .label = NULL, 134 .label = NULL,
127 .summary = N_( "Cursor left 1 position." ), 135 .summary = N_( "Cursor left 1 position." ),
128 .activate = lib3270_cursor_left, 136 .activate = lib3270_cursor_left,
  137 +
  138 + .group = LIB3270_ACTION_GROUP_ONLINE,
129 .activatable = lib3270_is_connected 139 .activatable = lib3270_is_connected
130 }, 140 },
131 141
@@ -136,6 +146,8 @@ @@ -136,6 +146,8 @@
136 .label = NULL, 146 .label = NULL,
137 .summary = N_( "Cursor right 1 position." ), 147 .summary = N_( "Cursor right 1 position." ),
138 .activate = lib3270_cursor_right, 148 .activate = lib3270_cursor_right,
  149 +
  150 + .group = LIB3270_ACTION_GROUP_ONLINE,
139 .activatable = lib3270_is_connected 151 .activatable = lib3270_is_connected
140 }, 152 },
141 153
@@ -146,6 +158,8 @@ @@ -146,6 +158,8 @@
146 .label = NULL, 158 .label = NULL,
147 .summary = N_( "Cursor to first field on next line or any lines after that." ), 159 .summary = N_( "Cursor to first field on next line or any lines after that." ),
148 .activate = lib3270_newline, 160 .activate = lib3270_newline,
  161 +
  162 + .group = LIB3270_ACTION_GROUP_ONLINE,
149 .activatable = lib3270_is_connected 163 .activatable = lib3270_is_connected
150 }, 164 },
151 165
@@ -156,6 +170,8 @@ @@ -156,6 +170,8 @@
156 .label = NULL, 170 .label = NULL,
157 .summary = N_( "Cursor to previous word." ), 171 .summary = N_( "Cursor to previous word." ),
158 .activate = lib3270_previousword, 172 .activate = lib3270_previousword,
  173 +
  174 + .group = LIB3270_ACTION_GROUP_ONLINE,
159 .activatable = lib3270_is_connected 175 .activatable = lib3270_is_connected
160 }, 176 },
161 177
@@ -166,6 +182,8 @@ @@ -166,6 +182,8 @@
166 .label = NULL, 182 .label = NULL,
167 .summary = N_( "Cursor to next unprotected word." ), 183 .summary = N_( "Cursor to next unprotected word." ),
168 .activate = lib3270_nextword, 184 .activate = lib3270_nextword,
  185 +
  186 + .group = LIB3270_ACTION_GROUP_ONLINE,
169 .activatable = lib3270_is_connected 187 .activatable = lib3270_is_connected
170 }, 188 },
171 189
@@ -179,6 +197,8 @@ @@ -179,6 +197,8 @@
179 .label = NULL, 197 .label = NULL,
180 .summary = N_( "Save screen." ), 198 .summary = N_( "Save screen." ),
181 .activate = save_all, 199 .activate = save_all,
  200 +
  201 + .group = LIB3270_ACTION_GROUP_ONLINE,
182 .activatable = lib3270_is_connected 202 .activatable = lib3270_is_connected
183 }, 203 },
184 204
@@ -189,6 +209,8 @@ @@ -189,6 +209,8 @@
189 .label = NULL, 209 .label = NULL,
190 .summary = N_( "Save selected area." ), 210 .summary = N_( "Save selected area." ),
191 .activate = save_selected, 211 .activate = save_selected,
  212 +
  213 + .group = LIB3270_ACTION_GROUP_SELECTION,
192 .activatable = lib3270_has_selection 214 .activatable = lib3270_has_selection
193 }, 215 },
194 216
@@ -199,6 +221,8 @@ @@ -199,6 +221,8 @@
199 .label = NULL, 221 .label = NULL,
200 .summary = NULL, 222 .summary = NULL,
201 .activate = save_copy, 223 .activate = save_copy,
  224 +
  225 + .group = LIB3270_ACTION_GROUP_ONLINE,
202 .activatable = lib3270_is_connected 226 .activatable = lib3270_is_connected
203 }, 227 },
204 228
@@ -209,6 +233,8 @@ @@ -209,6 +233,8 @@
209 .label = NULL, 233 .label = NULL,
210 .summary = N_( "Paste file." ), 234 .summary = N_( "Paste file." ),
211 .activate = paste_file, 235 .activate = paste_file,
  236 +
  237 + .group = LIB3270_ACTION_GROUP_ONLINE,
212 .activatable = lib3270_is_connected 238 .activatable = lib3270_is_connected
213 }, 239 },
214 240
@@ -222,6 +248,8 @@ @@ -222,6 +248,8 @@
222 .label = N_( "Select all" ), 248 .label = N_( "Select all" ),
223 .summary = NULL, 249 .summary = NULL,
224 .activate = lib3270_select_all, 250 .activate = lib3270_select_all,
  251 +
  252 + .group = LIB3270_ACTION_GROUP_ONLINE,
225 .activatable = lib3270_is_connected 253 .activatable = lib3270_is_connected
226 }, 254 },
227 255
@@ -232,6 +260,8 @@ @@ -232,6 +260,8 @@
232 .label = N_( "Remove selection" ), 260 .label = N_( "Remove selection" ),
233 .summary = N_( "Remove selection" ), 261 .summary = N_( "Remove selection" ),
234 .activate = lib3270_unselect, 262 .activate = lib3270_unselect,
  263 +
  264 + .group = LIB3270_ACTION_GROUP_ONLINE,
235 .activatable = lib3270_has_selection 265 .activatable = lib3270_has_selection
236 }, 266 },
237 267
@@ -242,6 +272,8 @@ @@ -242,6 +272,8 @@
242 .label = N_( "Reselect" ), 272 .label = N_( "Reselect" ),
243 .summary = N_( "Reselect"), 273 .summary = N_( "Reselect"),
244 .activate = lib3270_reselect, 274 .activate = lib3270_reselect,
  275 +
  276 + .group = LIB3270_ACTION_GROUP_ONLINE,
245 .activatable = lib3270_is_connected 277 .activatable = lib3270_is_connected
246 }, 278 },
247 279
@@ -255,6 +287,8 @@ @@ -255,6 +287,8 @@
255 .label = N_( "Select field" ), 287 .label = N_( "Select field" ),
256 .summary = N_( "Select Field" ), 288 .summary = N_( "Select Field" ),
257 .activate = lib3270_select_field, 289 .activate = lib3270_select_field,
  290 +
  291 + .group = LIB3270_ACTION_GROUP_ONLINE,
258 .activatable = lib3270_is_formatted 292 .activatable = lib3270_is_formatted
259 }, 293 },
260 294
@@ -266,6 +300,8 @@ @@ -266,6 +300,8 @@
266 .label = NULL, 300 .label = NULL,
267 .summary = N_( "Move the cursor to the first blank after the last nonblank in the field." ), 301 .summary = N_( "Move the cursor to the first blank after the last nonblank in the field." ),
268 .activate = lib3270_fieldend, 302 .activate = lib3270_fieldend,
  303 +
  304 + .group = LIB3270_ACTION_GROUP_ONLINE,
269 .activatable = lib3270_is_formatted 305 .activatable = lib3270_is_formatted
270 }, 306 },
271 307
@@ -276,6 +312,8 @@ @@ -276,6 +312,8 @@
276 .label = NULL, 312 .label = NULL,
277 .summary = N_( "Move to first unprotected field on screen." ), 313 .summary = N_( "Move to first unprotected field on screen." ),
278 .activate = lib3270_firstfield, 314 .activate = lib3270_firstfield,
  315 +
  316 + .group = LIB3270_ACTION_GROUP_ONLINE,
279 .activatable = lib3270_is_formatted 317 .activatable = lib3270_is_formatted
280 }, 318 },
281 319
@@ -286,6 +324,8 @@ @@ -286,6 +324,8 @@
286 .label = NULL, 324 .label = NULL,
287 .summary = N_( "Tab forward to next field." ), 325 .summary = N_( "Tab forward to next field." ),
288 .activate = lib3270_nextfield, 326 .activate = lib3270_nextfield,
  327 +
  328 + .group = LIB3270_ACTION_GROUP_ONLINE,
289 .activatable = lib3270_is_formatted 329 .activatable = lib3270_is_formatted
290 }, 330 },
291 331
@@ -296,6 +336,8 @@ @@ -296,6 +336,8 @@
296 .label = NULL, 336 .label = NULL,
297 .summary = N_( "Tab backward to previous field." ), 337 .summary = N_( "Tab backward to previous field." ),
298 .activate = lib3270_previousfield, 338 .activate = lib3270_previousfield,
  339 +
  340 + .group = LIB3270_ACTION_GROUP_ONLINE,
299 .activatable = lib3270_is_formatted 341 .activatable = lib3270_is_formatted
300 }, 342 },
301 343
@@ -310,6 +352,8 @@ @@ -310,6 +352,8 @@
310 .label = NULL, 352 .label = NULL,
311 .summary = N_( "Backspaces the cursor until it hits the front of a word." ), 353 .summary = N_( "Backspaces the cursor until it hits the front of a word." ),
312 .activate = lib3270_deleteword, 354 .activate = lib3270_deleteword,
  355 +
  356 + .group = LIB3270_ACTION_GROUP_ONLINE,
313 .activatable = lib3270_is_connected 357 .activatable = lib3270_is_connected
314 }, 358 },
315 359
@@ -320,6 +364,8 @@ @@ -320,6 +364,8 @@
320 .label = NULL, 364 .label = NULL,
321 .summary = N_( "Delete field" ), 365 .summary = N_( "Delete field" ),
322 .activate = lib3270_deletefield, 366 .activate = lib3270_deletefield,
  367 +
  368 + .group = LIB3270_ACTION_GROUP_ONLINE,
323 .activatable = lib3270_is_formatted 369 .activatable = lib3270_is_formatted
324 }, 370 },
325 371
@@ -331,6 +377,8 @@ @@ -331,6 +377,8 @@
331 .label = NULL, 377 .label = NULL,
332 .summary = NULL, 378 .summary = NULL,
333 .activate = lib3270_eraseinput, 379 .activate = lib3270_eraseinput,
  380 +
  381 + .group = LIB3270_ACTION_GROUP_ONLINE,
334 .activatable = lib3270_is_connected 382 .activatable = lib3270_is_connected
335 }, 383 },
336 384
@@ -341,6 +389,8 @@ @@ -341,6 +389,8 @@
341 .label = NULL, 389 .label = NULL,
342 .summary = N_( "Erase End Of Field Key." ), 390 .summary = N_( "Erase End Of Field Key." ),
343 .activate = lib3270_eraseeof, 391 .activate = lib3270_eraseeof,
  392 +
  393 + .group = LIB3270_ACTION_GROUP_ONLINE,
344 .activatable = lib3270_is_formatted 394 .activatable = lib3270_is_formatted
345 }, 395 },
346 396
@@ -351,6 +401,8 @@ @@ -351,6 +401,8 @@
351 .label = NULL, 401 .label = NULL,
352 .summary = N_( "Erase End Of Line Key." ), 402 .summary = N_( "Erase End Of Line Key." ),
353 .activate = lib3270_eraseeol, 403 .activate = lib3270_eraseeol,
  404 +
  405 + .group = LIB3270_ACTION_GROUP_ONLINE,
354 .activatable = lib3270_is_connected 406 .activatable = lib3270_is_connected
355 }, 407 },
356 408
@@ -361,6 +413,8 @@ @@ -361,6 +413,8 @@
361 .label = NULL, 413 .label = NULL,
362 .summary = NULL, 414 .summary = NULL,
363 .activate = lib3270_erase, 415 .activate = lib3270_erase,
  416 +
  417 + .group = LIB3270_ACTION_GROUP_ONLINE,
364 .activatable = lib3270_is_connected 418 .activatable = lib3270_is_connected
365 }, 419 },
366 420
@@ -374,6 +428,8 @@ @@ -374,6 +428,8 @@
374 .label = NULL, 428 .label = NULL,
375 .summary = N_( "Send an \"Enter\" action." ), 429 .summary = N_( "Send an \"Enter\" action." ),
376 .activate = lib3270_enter, 430 .activate = lib3270_enter,
  431 +
  432 + .group = LIB3270_ACTION_GROUP_ONLINE,
377 .activatable = lib3270_is_connected 433 .activatable = lib3270_is_connected
378 }, 434 },
379 435
@@ -385,6 +441,8 @@ @@ -385,6 +441,8 @@
385 .label = NULL, 441 .label = NULL,
386 .summary = NULL, 442 .summary = NULL,
387 .activate = lib3270_kybdreset, 443 .activate = lib3270_kybdreset,
  444 +
  445 + .group = LIB3270_ACTION_GROUP_ONLINE,
388 .activatable = lib3270_is_connected 446 .activatable = lib3270_is_connected
389 }, 447 },
390 448
@@ -395,6 +453,8 @@ @@ -395,6 +453,8 @@
395 .label = NULL, 453 .label = NULL,
396 .summary = N_( "Clear AID key" ), 454 .summary = N_( "Clear AID key" ),
397 .activate = lib3270_clear, 455 .activate = lib3270_clear,
  456 +
  457 + .group = LIB3270_ACTION_GROUP_ONLINE,
398 .activatable = lib3270_is_connected 458 .activatable = lib3270_is_connected
399 }, 459 },
400 460
@@ -406,6 +466,8 @@ @@ -406,6 +466,8 @@
406 .label = NULL, 466 .label = NULL,
407 .summary = NULL, 467 .summary = NULL,
408 .activate = lib3270_delete, 468 .activate = lib3270_delete,
  469 +
  470 + .group = LIB3270_ACTION_GROUP_ONLINE,
409 .activatable = lib3270_is_connected 471 .activatable = lib3270_is_connected
410 }, 472 },
411 473
@@ -416,6 +478,8 @@ @@ -416,6 +478,8 @@
416 .label = NULL, 478 .label = NULL,
417 .summary = N_( "DUP key" ), 479 .summary = N_( "DUP key" ),
418 .activate = lib3270_dup, 480 .activate = lib3270_dup,
  481 +
  482 + .group = LIB3270_ACTION_GROUP_ONLINE,
419 .activatable = lib3270_is_connected 483 .activatable = lib3270_is_connected
420 }, 484 },
421 485
@@ -426,6 +490,8 @@ @@ -426,6 +490,8 @@
426 .label = NULL, 490 .label = NULL,
427 .summary = N_( "FM key" ), 491 .summary = N_( "FM key" ),
428 .activate = lib3270_fieldmark, 492 .activate = lib3270_fieldmark,
  493 +
  494 + .group = LIB3270_ACTION_GROUP_ONLINE,
429 .activatable = lib3270_is_connected 495 .activatable = lib3270_is_connected
430 }, 496 },
431 497
@@ -436,6 +502,8 @@ @@ -436,6 +502,8 @@
436 .label = NULL, 502 .label = NULL,
437 .summary = N_( "3270-style backspace." ), 503 .summary = N_( "3270-style backspace." ),
438 .activate = lib3270_backspace, 504 .activate = lib3270_backspace,
  505 +
  506 + .group = LIB3270_ACTION_GROUP_ONLINE,
439 .activatable = lib3270_is_connected 507 .activatable = lib3270_is_connected
440 }, 508 },
441 509
@@ -446,6 +514,8 @@ @@ -446,6 +514,8 @@
446 .label = NULL, 514 .label = NULL,
447 .summary = N_( "ATTN key, per RFC 2355. Sends IP, regardless." ), 515 .summary = N_( "ATTN key, per RFC 2355. Sends IP, regardless." ),
448 .activate = lib3270_attn, 516 .activate = lib3270_attn,
  517 +
  518 + .group = LIB3270_ACTION_GROUP_ONLINE,
449 .activatable = lib3270_is_connected 519 .activatable = lib3270_is_connected
450 }, 520 },
451 521
@@ -456,6 +526,8 @@ @@ -456,6 +526,8 @@
456 .label = NULL, 526 .label = NULL,
457 .summary = NULL, 527 .summary = NULL,
458 .activate = lib3270_break, 528 .activate = lib3270_break,
  529 +
  530 + .group = LIB3270_ACTION_GROUP_ONLINE,
459 .activatable = lib3270_is_connected 531 .activatable = lib3270_is_connected
460 }, 532 },
461 533
@@ -466,6 +538,8 @@ @@ -466,6 +538,8 @@
466 .label = NULL, 538 .label = NULL,
467 .summary = NULL, 539 .summary = NULL,
468 .activate = lib3270_paste_next, 540 .activate = lib3270_paste_next,
  541 +
  542 + .group = LIB3270_ACTION_GROUP_ONLINE,
469 .activatable = lib3270_is_connected 543 .activatable = lib3270_is_connected
470 }, 544 },
471 545
@@ -476,6 +550,8 @@ @@ -476,6 +550,8 @@
476 .label = NULL, 550 .label = NULL,
477 .summary = NULL, 551 .summary = NULL,
478 .activate = lib3270_sysreq, 552 .activate = lib3270_sysreq,
  553 +
  554 + .group = LIB3270_ACTION_GROUP_ONLINE,
479 .activatable = lib3270_is_connected 555 .activatable = lib3270_is_connected
480 }, 556 },
481 557
@@ -490,6 +566,8 @@ @@ -490,6 +566,8 @@
490 .summary = N_("Send to print"), 566 .summary = N_("Send to print"),
491 .description = N_("If the terminal has selected area print it, if not, print all contents."), 567 .description = N_("If the terminal has selected area print it, if not, print all contents."),
492 .activate = lib3270_print, 568 .activate = lib3270_print,
  569 +
  570 + .group = LIB3270_ACTION_GROUP_ONLINE,
493 .activatable = lib3270_is_connected 571 .activatable = lib3270_is_connected
494 }, 572 },
495 573
@@ -500,6 +578,8 @@ @@ -500,6 +578,8 @@
500 .label = NULL, 578 .label = NULL,
501 .summary = N_("Print screen contents"), 579 .summary = N_("Print screen contents"),
502 .activate = lib3270_print_all, 580 .activate = lib3270_print_all,
  581 +
  582 + .group = LIB3270_ACTION_GROUP_ONLINE,
503 .activatable = lib3270_is_connected 583 .activatable = lib3270_is_connected
504 }, 584 },
505 585
@@ -510,6 +590,8 @@ @@ -510,6 +590,8 @@
510 .label = NULL, 590 .label = NULL,
511 .summary = N_( "Print selected area." ), 591 .summary = N_( "Print selected area." ),
512 .activate = lib3270_print_selected, 592 .activate = lib3270_print_selected,
  593 +
  594 + .group = LIB3270_ACTION_GROUP_SELECTION,
513 .activatable = lib3270_has_selection 595 .activatable = lib3270_has_selection
514 }, 596 },
515 597
@@ -520,6 +602,8 @@ @@ -520,6 +602,8 @@
520 .label = NULL, 602 .label = NULL,
521 .summary = N_("Print copy (if available)"), 603 .summary = N_("Print copy (if available)"),
522 .activate = lib3270_print_copy, 604 .activate = lib3270_print_copy,
  605 +
  606 + .group = LIB3270_ACTION_GROUP_ONLINE,
523 .activatable = lib3270_is_connected 607 .activatable = lib3270_is_connected
524 }, 608 },
525 609
@@ -534,6 +618,8 @@ @@ -534,6 +618,8 @@
534 .label = NULL, 618 .label = NULL,
535 .summary = NULL, 619 .summary = NULL,
536 .activate = lib3270_testpattern, 620 .activate = lib3270_testpattern,
  621 +
  622 + .group = LIB3270_ACTION_GROUP_OFFLINE,
537 .activatable = lib3270_is_disconnected 623 .activatable = lib3270_is_disconnected
538 }, 624 },
539 625
@@ -544,17 +630,13 @@ @@ -544,17 +630,13 @@
544 .label = NULL, 630 .label = NULL,
545 .summary = NULL, 631 .summary = NULL,
546 .activate = lib3270_charsettable, 632 .activate = lib3270_charsettable,
  633 +
  634 + .group = LIB3270_ACTION_GROUP_OFFLINE,
547 .activatable = lib3270_is_disconnected 635 .activatable = lib3270_is_disconnected
548 }, 636 },
549 637
550 { 638 {
551 .name = NULL, 639 .name = NULL,
552 - .key = NULL,  
553 - .icon = NULL,  
554 - .label = NULL,  
555 - .summary = NULL,  
556 - .activate = NULL,  
557 - .activatable = NULL  
558 } 640 }
559 }; 641 };
560 642
src/include/lib3270/actions.h
@@ -33,10 +33,21 @@ @@ -33,10 +33,21 @@
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 requires an active selection.
  42 + LIB3270_ACTION_GROUP_UNSELECTED, ///< @brief Action fails if there has a selection.
  43 + } LIB3270_ACTION_GROUP;
  44 +
36 typedef struct _lib3270_action 45 typedef struct _lib3270_action
37 { 46 {
38 LIB3270_PROPERTY_HEAD 47 LIB3270_PROPERTY_HEAD
39 48
  49 + LIB3270_ACTION_GROUP group; ///< @brief Action group.
  50 +
40 int (*activate)(H3270 *hSession); ///< @brief lib3270 associated method. 51 int (*activate)(H3270 *hSession); ///< @brief lib3270 associated method.
41 int (*activatable)(const H3270 *hSession); ///< @brief Is the action activatable? 52 int (*activatable)(const H3270 *hSession); ///< @brief Is the action activatable?
42 53