Commit 74dfd19511e7f9f041a0e2ecf6fbdd7a16349995

Authored by Perry Werneck
1 parent 9ec86260

Refactoring action table.

Showing 1 changed file with 315 additions and 315 deletions   Show diff stats
src/core/actions/table.c
... ... @@ -77,226 +77,226 @@
77 77 // Network actions
78 78 //
79 79 {
80   - "reconnect",
81   - NULL,
82   - "connect",
83   - NULL,
84   - N_( "Connect to host." ),
85   - connect_host,
86   - lib3270_is_disconnected
  80 + .name = "reconnect",
  81 + .key = NULL,
  82 + .icon = "connect",
  83 + .label = NULL,
  84 + .summary = N_( "Connect to host." ),
  85 + .call = connect_host,
  86 + .enabled = lib3270_is_disconnected
87 87 },
88 88  
89 89 {
90   - "disconnect",
91   - NULL,
92   - "disconnect",
93   - NULL,
94   - N_( "Disconnect from host." ),
95   - lib3270_disconnect,
96   - lib3270_is_connected
  90 + .name = "disconnect",
  91 + .key = NULL,
  92 + .icon = "disconnect",
  93 + .label = NULL,
  94 + .summary = N_( "Disconnect from host." ),
  95 + .call = lib3270_disconnect,
  96 + .enabled = lib3270_is_connected
97 97 },
98 98  
99 99 //
100 100 // Navigation actions
101 101 //
102 102 {
103   - "up",
104   - "Up",
105   - NULL,
106   - NULL,
107   - N_( "Cursor up 1 position." ),
108   - lib3270_cursor_up,
109   - lib3270_is_connected
  103 + .name = "up",
  104 + .key = "Up",
  105 + .icon = NULL,
  106 + .label = NULL,
  107 + .summary = N_( "Cursor up 1 position." ),
  108 + .call = lib3270_cursor_up,
  109 + .enabled = lib3270_is_connected
110 110 },
111 111  
112 112 {
113   - "down",
114   - "Down",
115   - NULL,
116   - NULL,
117   - N_( "Cursor down 1 position." ),
118   - lib3270_cursor_down,
119   - lib3270_is_connected
  113 + .name = "down",
  114 + .key = "Down",
  115 + .icon = NULL,
  116 + .label = NULL,
  117 + .summary = N_( "Cursor down 1 position." ),
  118 + .call = lib3270_cursor_down,
  119 + .enabled = lib3270_is_connected
120 120 },
121 121  
122 122 {
123   - "left",
124   - "Left",
125   - NULL,
126   - NULL,
127   - N_( "Cursor left 1 position." ),
128   - lib3270_cursor_left,
129   - lib3270_is_connected
  123 + .name = "left",
  124 + .key = "Left",
  125 + .icon = NULL,
  126 + .label = NULL,
  127 + .summary = N_( "Cursor left 1 position." ),
  128 + .call = lib3270_cursor_left,
  129 + .enabled = lib3270_is_connected
130 130 },
131 131  
132 132 {
133   - "right",
134   - "Right",
135   - NULL,
136   - NULL,
137   - N_( "Cursor right 1 position." ),
138   - lib3270_cursor_right,
139   - lib3270_is_connected
  133 + .name = "right",
  134 + .key = "Right",
  135 + .icon = NULL,
  136 + .label = NULL,
  137 + .summary = N_( "Cursor right 1 position." ),
  138 + .call = lib3270_cursor_right,
  139 + .enabled = lib3270_is_connected
140 140 },
141 141  
142 142 {
143   - "newline",
144   - "Control_R",
145   - NULL,
146   - NULL,
147   - N_( "Cursor to first field on next line or any lines after that." ),
148   - lib3270_newline,
149   - lib3270_is_connected
  143 + .name = "newline",
  144 + .key = "Control_R",
  145 + .icon = NULL,
  146 + .label = NULL,
  147 + .summary = N_( "Cursor to first field on next line or any lines after that." ),
  148 + .call = lib3270_newline,
  149 + .enabled = lib3270_is_connected
150 150 },
151 151  
152 152 {
153   - "previousword",
154   - NULL,
155   - NULL,
156   - NULL,
157   - N_( "Cursor to previous word." ),
158   - lib3270_previousword,
159   - lib3270_is_connected
  153 + .name = "previousword",
  154 + .key = NULL,
  155 + .icon = NULL,
  156 + .label = NULL,
  157 + .summary = N_( "Cursor to previous word." ),
  158 + .call = lib3270_previousword,
  159 + .enabled = lib3270_is_connected
160 160 },
161 161  
162 162 {
163   - "nextword",
164   - NULL,
165   - NULL,
166   - NULL,
167   - N_( "Cursor to next unprotected word." ),
168   - lib3270_nextword,
169   - lib3270_is_connected
  163 + .name = "nextword",
  164 + .key = NULL,
  165 + .icon = NULL,
  166 + .label = NULL,
  167 + .summary = N_( "Cursor to next unprotected word." ),
  168 + .call = lib3270_nextword,
  169 + .enabled = lib3270_is_connected
170 170 },
171 171  
172 172 //
173 173 // Save/load actions
174 174 //
175 175 {
176   - "saveall",
177   - NULL,
178   - "document-save",
179   - NULL,
180   - N_( "Save screen." ),
181   - save_all,
182   - lib3270_is_connected
  176 + .name = "saveall",
  177 + .key = NULL,
  178 + .icon = "document-save",
  179 + .label = NULL,
  180 + .summary = N_( "Save screen." ),
  181 + .call = save_all,
  182 + .enabled = lib3270_is_connected
183 183 },
184 184  
185 185 {
186   - "saveselected",
187   - NULL,
188   - NULL,
189   - NULL,
190   - N_( "Save selected area." ),
191   - save_selected,
192   - lib3270_has_selection
  186 + .name = "saveselected",
  187 + .key = NULL,
  188 + .icon = NULL,
  189 + .label = NULL,
  190 + .summary = N_( "Save selected area." ),
  191 + .call = save_selected,
  192 + .enabled = lib3270_has_selection
193 193 },
194 194  
195 195 {
196   - "savecopy",
197   - NULL,
198   - NULL,
199   - NULL,
200   - NULL,
201   - save_copy,
202   - lib3270_is_connected
  196 + .name = "savecopy",
  197 + .key = NULL,
  198 + .icon = NULL,
  199 + .label = NULL,
  200 + .summary = NULL,
  201 + .call = save_copy,
  202 + .enabled = lib3270_is_connected
203 203 },
204 204  
205 205 {
206   - "loadfile",
207   - NULL,
208   - "document-load",
209   - NULL,
210   - N_( "Paste file." ),
211   - paste_file,
212   - lib3270_is_connected
  206 + .name = "loadfile",
  207 + .key = NULL,
  208 + .icon = "document-load",
  209 + .label = NULL,
  210 + .summary = N_( "Paste file." ),
  211 + .call = paste_file,
  212 + .enabled = lib3270_is_connected
213 213 },
214 214  
215 215 //
216 216 // Selection actions
217 217 //
218 218 {
219   - "select_all",
220   - "<ctrl>a",
221   - "edit-select-all",
222   - NULL,
223   - NULL,
224   - lib3270_select_all,
225   - lib3270_is_connected
  219 + .name = "select_all",
  220 + .key = "<ctrl>a",
  221 + .icon = "edit-select-all",
  222 + .label = NULL,
  223 + .summary = NULL,
  224 + .call = lib3270_select_all,
  225 + .enabled = lib3270_is_connected
226 226 },
227 227  
228 228 {
229   - "unselect",
230   - NULL,
231   - NULL,
232   - NULL,
233   - N_( "Remove selection" ),
234   - lib3270_unselect,
235   - lib3270_has_selection
  229 + .name = "unselect",
  230 + .key = NULL,
  231 + .icon = NULL,
  232 + .label = NULL,
  233 + .summary = N_( "Remove selection" ),
  234 + .call = lib3270_unselect,
  235 + .enabled = lib3270_has_selection
236 236 },
237 237  
238 238 {
239   - "reselect",
240   - "<Ctrl>r",
241   - NULL,
242   - NULL,
243   - N_( "Reselect"),
244   - lib3270_reselect,
245   - lib3270_is_connected
  239 + .name = "reselect",
  240 + .key = "<Ctrl>r",
  241 + .icon = NULL,
  242 + .label = NULL,
  243 + .summary = N_( "Reselect"),
  244 + .call = lib3270_reselect,
  245 + .enabled = lib3270_is_connected
246 246 },
247 247  
248 248 //
249 249 // Field actions.
250 250 //
251 251 {
252   - "select_field",
253   - "<Ctrl>f",
254   - NULL,
255   - NULL,
256   - N_( "Select Field" ),
257   - lib3270_select_field,
258   - lib3270_is_formatted
  252 + .name = "select_field",
  253 + .key = "<Ctrl>f",
  254 + .icon = NULL,
  255 + .label = NULL,
  256 + .summary = N_( "Select Field" ),
  257 + .call = lib3270_select_field,
  258 + .enabled = lib3270_is_formatted
259 259 },
260 260  
261 261  
262 262 {
263   - "fieldend",
264   - NULL,
265   - NULL,
266   - NULL,
267   - N_( "Move the cursor to the first blank after the last nonblank in the field." ),
268   - lib3270_fieldend,
269   - lib3270_is_formatted
  263 + .name = "fieldend",
  264 + .key = NULL,
  265 + .icon = NULL,
  266 + .label = NULL,
  267 + .summary = N_( "Move the cursor to the first blank after the last nonblank in the field." ),
  268 + .call = lib3270_fieldend,
  269 + .enabled = lib3270_is_formatted
270 270 },
271 271  
272 272 {
273   - "firstfield",
274   - "Home",
275   - "go-first",
276   - NULL,
277   - N_( "Move to first unprotected field on screen." ),
278   - lib3270_firstfield,
279   - lib3270_is_formatted
  273 + .name = "firstfield",
  274 + .key = "Home",
  275 + .icon = "go-first",
  276 + .label = NULL,
  277 + .summary = N_( "Move to first unprotected field on screen." ),
  278 + .call = lib3270_firstfield,
  279 + .enabled = lib3270_is_formatted
280 280 },
281 281  
282 282 {
283   - "nextfield",
284   - "Tab",
285   - "go-next",
286   - NULL,
287   - N_( "Tab forward to next field." ),
288   - lib3270_nextfield,
289   - lib3270_is_formatted
  283 + .name = "nextfield",
  284 + .key = "Tab",
  285 + .icon = "go-next",
  286 + .label = NULL,
  287 + .summary = N_( "Tab forward to next field." ),
  288 + .call = lib3270_nextfield,
  289 + .enabled = lib3270_is_formatted
290 290 },
291 291  
292 292 {
293   - "previousfield",
294   - "ISO_Left_Tab",
295   - "go-previous",
296   - NULL,
297   - N_( "Tab backward to previous field." ),
298   - lib3270_previousfield,
299   - lib3270_is_formatted
  293 + .name = "previousfield",
  294 + .key = "ISO_Left_Tab",
  295 + .icon = "go-previous",
  296 + .label = NULL,
  297 + .summary = N_( "Tab backward to previous field." ),
  298 + .call = lib3270_previousfield,
  299 + .enabled = lib3270_is_formatted
300 300 },
301 301  
302 302  
... ... @@ -304,222 +304,222 @@
304 304 // Erase actions.
305 305 //
306 306 {
307   - "deleteword",
308   - "<Ctrl>w",
309   - NULL,
310   - NULL,
311   - N_( "Backspaces the cursor until it hits the front of a word." ),
312   - lib3270_deleteword,
313   - lib3270_is_connected
  307 + .name = "deleteword",
  308 + .key = "<Ctrl>w",
  309 + .icon = NULL,
  310 + .label = NULL,
  311 + .summary = N_( "Backspaces the cursor until it hits the front of a word." ),
  312 + .call = lib3270_deleteword,
  313 + .enabled = lib3270_is_connected
314 314 },
315 315  
316 316 {
317   - "deletefield",
318   - "<Ctrl>u",
319   - NULL,
320   - NULL,
321   - N_( "Delete field" ),
322   - lib3270_deletefield,
323   - lib3270_is_formatted
  317 + .name = "deletefield",
  318 + .key = "<Ctrl>u",
  319 + .icon = NULL,
  320 + .label = NULL,
  321 + .summary = N_( "Delete field" ),
  322 + .call = lib3270_deletefield,
  323 + .enabled = lib3270_is_formatted
324 324 },
325 325  
326 326  
327 327 {
328   - "eraseinput",
329   - NULL,
330   - NULL,
331   - NULL,
332   - NULL,
333   - lib3270_eraseinput,
334   - lib3270_is_connected
  328 + .name = "eraseinput",
  329 + .key = NULL,
  330 + .icon = NULL,
  331 + .label = NULL,
  332 + .summary = NULL,
  333 + .call = lib3270_eraseinput,
  334 + .enabled = lib3270_is_connected
335 335 },
336 336  
337 337 {
338   - "eraseeof",
339   - "End",
340   - NULL,
341   - NULL,
342   - N_( "Erase End Of Field Key." ),
343   - lib3270_eraseeof,
344   - lib3270_is_formatted
  338 + .name = "eraseeof",
  339 + .key = "End",
  340 + .icon = NULL,
  341 + .label = NULL,
  342 + .summary = N_( "Erase End Of Field Key." ),
  343 + .call = lib3270_eraseeof,
  344 + .enabled = lib3270_is_formatted
345 345 },
346 346  
347 347 {
348   - "eraseeol",
349   - NULL,
350   - NULL,
351   - NULL,
352   - N_( "Erase End Of Line Key." ),
353   - lib3270_eraseeol,
354   - lib3270_is_connected
  348 + .name = "eraseeol",
  349 + .key = NULL,
  350 + .icon = NULL,
  351 + .label = NULL,
  352 + .summary = N_( "Erase End Of Line Key." ),
  353 + .call = lib3270_eraseeol,
  354 + .enabled = lib3270_is_connected
355 355 },
356 356  
357 357 {
358   - "erase",
359   - "BackSpace",
360   - NULL,
361   - NULL,
362   - NULL,
363   - lib3270_erase,
364   - lib3270_is_connected
  358 + .name = "erase",
  359 + .key = "BackSpace",
  360 + .icon = NULL,
  361 + .label = NULL,
  362 + .summary = NULL,
  363 + .call = lib3270_erase,
  364 + .enabled = lib3270_is_connected
365 365 },
366 366  
367 367 //
368 368 // Keyboard actions
369 369 //
370 370 {
371   - "enter",
372   - NULL,
373   - NULL,
374   - NULL,
375   - N_( "Send an \"Enter\" action." ),
376   - lib3270_enter,
377   - lib3270_is_connected
  371 + .name = "enter",
  372 + .key = NULL,
  373 + .icon = NULL,
  374 + .label = NULL,
  375 + .summary = N_( "Send an \"Enter\" action." ),
  376 + .call = lib3270_enter,
  377 + .enabled = lib3270_is_connected
378 378 },
379 379  
380 380  
381 381 {
382   - "kybdreset",
383   - "Escape",
384   - NULL,
385   - NULL,
386   - NULL,
387   - lib3270_kybdreset,
388   - lib3270_is_connected
  382 + .name = "kybdreset",
  383 + .key = "Escape",
  384 + .icon = NULL,
  385 + .label = NULL,
  386 + .summary = NULL,
  387 + .call = lib3270_kybdreset,
  388 + .enabled = lib3270_is_connected
389 389 },
390 390  
391 391 {
392   - "clear",
393   - NULL,
394   - NULL,
395   - NULL,
396   - N_( "Clear AID key" ),
397   - lib3270_clear,
398   - lib3270_is_connected
  392 + .name = "clear",
  393 + .key = NULL,
  394 + .icon = NULL,
  395 + .label = NULL,
  396 + .summary = N_( "Clear AID key" ),
  397 + .call = lib3270_clear,
  398 + .enabled = lib3270_is_connected
399 399 },
400 400  
401 401  
402 402 {
403   - "delete",
404   - "Delete",
405   - NULL,
406   - NULL,
407   - NULL,
408   - lib3270_delete,
409   - lib3270_is_connected
  403 + .name = "delete",
  404 + .key = "Delete",
  405 + .icon = NULL,
  406 + .label = NULL,
  407 + .summary = NULL,
  408 + .call = lib3270_delete,
  409 + .enabled = lib3270_is_connected
410 410 },
411 411  
412 412 {
413   - "dup",
414   - "<Shift>KP_Multiply",
415   - NULL,
416   - NULL,
417   - N_( "DUP key" ),
418   - lib3270_dup,
419   - lib3270_is_connected
  413 + .name = "dup",
  414 + .key = "<Shift>KP_Multiply",
  415 + .icon = NULL,
  416 + .label = NULL,
  417 + .summary = N_( "DUP key" ),
  418 + .call = lib3270_dup,
  419 + .enabled = lib3270_is_connected
420 420 },
421 421  
422 422 {
423   - "fieldmark",
424   - NULL,
425   - NULL,
426   - NULL,
427   - N_( "FM key" ),
428   - lib3270_fieldmark,
429   - lib3270_is_connected
  423 + .name = "fieldmark",
  424 + .key = NULL,
  425 + .icon = NULL,
  426 + .label = NULL,
  427 + .summary = N_( "FM key" ),
  428 + .call = lib3270_fieldmark,
  429 + .enabled = lib3270_is_connected
430 430 },
431 431  
432 432 {
433   - "backspace",
434   - NULL,
435   - NULL,
436   - NULL,
437   - N_( "3270-style backspace." ),
438   - lib3270_backspace,
439   - lib3270_is_connected
  433 + .name = "backspace",
  434 + .key = NULL,
  435 + .icon = NULL,
  436 + .label = NULL,
  437 + .summary = N_( "3270-style backspace." ),
  438 + .call = lib3270_backspace,
  439 + .enabled = lib3270_is_connected
440 440 },
441 441  
442 442 {
443   - "attn",
444   - "<shift>Escape",
445   - NULL,
446   - NULL,
447   - N_( "ATTN key, per RFC 2355. Sends IP, regardless." ),
448   - lib3270_attn,
449   - lib3270_is_connected
  443 + .name = "attn",
  444 + .key = "<shift>Escape",
  445 + .icon = NULL,
  446 + .label = NULL,
  447 + .summary = N_( "ATTN key, per RFC 2355. Sends IP, regardless." ),
  448 + .call = lib3270_attn,
  449 + .enabled = lib3270_is_connected
450 450 },
451 451  
452 452 {
453   - "break",
454   - NULL,
455   - NULL,
456   - NULL,
457   - NULL,
458   - lib3270_break,
459   - lib3270_is_connected
  453 + .name = "break",
  454 + .key = NULL,
  455 + .icon = NULL,
  456 + .label = NULL,
  457 + .summary = NULL,
  458 + .call = lib3270_break,
  459 + .enabled = lib3270_is_connected
460 460 },
461 461  
462 462 {
463   - "pastenext",
464   - "<shift><ctrl>v",
465   - NULL,
466   - NULL,
467   - NULL,
468   - lib3270_paste_next,
469   - lib3270_is_connected
  463 + .name = "pastenext",
  464 + .key = "<shift><ctrl>v",
  465 + .icon = NULL,
  466 + .label = NULL,
  467 + .summary = NULL,
  468 + .call = lib3270_paste_next,
  469 + .enabled = lib3270_is_connected
470 470 },
471 471  
472 472 {
473   - "sysreq",
474   - "<shift>Print",
475   - NULL,
476   - NULL,
477   - NULL,
478   - lib3270_sysreq,
479   - lib3270_is_connected
  473 + .name = "sysreq",
  474 + .key = "<shift>Print",
  475 + .icon = NULL,
  476 + .label = NULL,
  477 + .summary = NULL,
  478 + .call = lib3270_sysreq,
  479 + .enabled = lib3270_is_connected
480 480 },
481 481  
482 482 //
483 483 // Misc actions
484 484 //
485 485 {
486   - "print",
487   - "Print",
488   - "document-print",
489   - NULL,
490   - N_("If the terminal has selected area print tje selected area, if not, print all contents."),
491   - lib3270_print,
492   - lib3270_is_connected
  486 + .name = "print",
  487 + .key = "Print",
  488 + .icon = "document-print",
  489 + .label = NULL,
  490 + .summary = N_("If the terminal has selected area print it, if not, print all contents."),
  491 + .call = lib3270_print,
  492 + .enabled = lib3270_is_connected
493 493 },
494 494  
495 495 {
496   - "printall",
497   - NULL,
498   - NULL,
499   - NULL,
500   - N_("Print screen contents"),
501   - lib3270_print_all,
502   - lib3270_is_connected
  496 + .name = "printall",
  497 + .key = NULL,
  498 + .icon = NULL,
  499 + .label = NULL,
  500 + .summary = N_("Print screen contents"),
  501 + .call = lib3270_print_all,
  502 + .enabled = lib3270_is_connected
503 503 },
504 504  
505 505 {
506   - "printselected",
507   - NULL,
508   - NULL,
509   - NULL,
510   - N_( "Print selected area." ),
511   - lib3270_print_selected,
512   - lib3270_has_selection
  506 + .name = "printselected",
  507 + .key = NULL,
  508 + .icon = NULL,
  509 + .label = NULL,
  510 + .summary = N_( "Print selected area." ),
  511 + .call = lib3270_print_selected,
  512 + .enabled = lib3270_has_selection
513 513 },
514 514  
515 515 {
516   - "printcopy",
517   - NULL,
518   - NULL,
519   - NULL,
520   - N_("Print copy (if available)"),
521   - lib3270_print_copy,
522   - lib3270_is_connected
  516 + .name = "printcopy",
  517 + .key = NULL,
  518 + .icon = NULL,
  519 + .label = NULL,
  520 + .summary = N_("Print copy (if available)"),
  521 + .call = lib3270_print_copy,
  522 + .enabled = lib3270_is_connected
523 523 },
524 524  
525 525 //
... ... @@ -527,33 +527,33 @@
527 527 //
528 528  
529 529 {
530   - "testpattern",
531   - NULL,
532   - NULL,
533   - NULL,
534   - NULL,
535   - lib3270_testpattern,
536   - lib3270_is_disconnected
  530 + .name = "testpattern",
  531 + .key = NULL,
  532 + .icon = NULL,
  533 + .label = NULL,
  534 + .summary = NULL,
  535 + .call = lib3270_testpattern,
  536 + .enabled = lib3270_is_disconnected
537 537 },
538 538  
539 539 {
540   - "charsettable",
541   - NULL,
542   - NULL,
543   - NULL,
544   - NULL,
545   - lib3270_charsettable,
546   - lib3270_is_disconnected
  540 + .name = "charsettable",
  541 + .key = NULL,
  542 + .icon = NULL,
  543 + .label = NULL,
  544 + .summary = NULL,
  545 + .call = lib3270_charsettable,
  546 + .enabled = lib3270_is_disconnected
547 547 },
548 548  
549 549 {
550   - NULL,
551   - NULL,
552   - NULL,
553   - NULL,
554   - NULL,
555   - NULL,
556   - NULL
  550 + .name = NULL,
  551 + .key = NULL,
  552 + .icon = NULL,
  553 + .label = NULL,
  554 + .summary = NULL,
  555 + .call = NULL,
  556 + .enabled = NULL
557 557 }
558 558 };
559 559  
... ...