Commit 4e41fbbda2c516b26a81b864a1d10d2a3b91a166

Authored by perry.werneck@gmail.com
1 parent 91a931df

Melhorando funcionalidades da action "Erase"

Showing 2 changed files with 30 additions and 7 deletions   Show diff stats
src/pw3270/actions.c
... ... @@ -499,6 +499,7 @@ GtkAction * ui_get_action(GtkWidget *widget, const gchar *name, GHashTable *hash
499 499 ACTION_TYPE_RESET,
500 500 ACTION_TYPE_TABLE,
501 501 ACTION_TYPE_STRING,
  502 + ACTION_TYPE_LIB3270,
502 503  
503 504 } action_type = ACTION_TYPE_DEFAULT;
504 505  
... ... @@ -581,6 +582,22 @@ GtkAction * ui_get_action(GtkWidget *widget, const gchar *name, GHashTable *hash
581 582 id = ui_get_bool_attribute("append",names,values,FALSE) ? 1 : 0;
582 583 nm = g_strconcat(id == 0 ? "cut" : "cutappend",ui_get_attribute("format",names,values),NULL);
583 584 }
  585 + else if(!g_ascii_strcasecmp(name,"erase"))
  586 + {
  587 + static const gchar * src[] = { "input", "eof", "eol", "all", "char", NULL };
  588 +
  589 + static const GCallback cbk[] = { G_CALLBACK(lib3270_eraseinput),
  590 + G_CALLBACK(lib3270_eraseeof),
  591 + G_CALLBACK(lib3270_eraseeol),
  592 + G_CALLBACK(lib3270_clear),
  593 + G_CALLBACK(lib3270_erase)
  594 + };
  595 + callback = cbk;
  596 + action_type = ACTION_TYPE_LIB3270;
  597 + id = get_attribute_id(name,"target",&nm,src,names,values,error);
  598 + if(id < 0)
  599 + return NULL;
  600 + }
584 601 else if(!g_ascii_strcasecmp(name,"select"))
585 602 {
586 603 static const gchar * src[] = { "all", "field", "none", "last", NULL };
... ... @@ -751,6 +768,12 @@ GtkAction * ui_get_action(GtkWidget *widget, const gchar *name, GHashTable *hash
751 768 g_signal_connect(action,"activate",callback[id],widget);
752 769 break;
753 770  
  771 + case ACTION_TYPE_LIB3270:
  772 + action = gtk_action_new(nm,NULL,NULL,NULL);
  773 + g_object_set_data(G_OBJECT(action),"lib3270_call",callback[id]);
  774 + g_signal_connect(action,"activate",G_CALLBACK(lib3270_action),widget);
  775 + break;
  776 +
754 777 case ACTION_TYPE_STRING:
755 778 action = gtk_action_new(nm,NULL,NULL,NULL);
756 779 g_signal_connect(action,"activate",G_CALLBACK(action_string),widget);
... ...
ui/00default.xml
... ... @@ -76,11 +76,11 @@
76 76 <menuitem action='select' target='last' key='<Ctrl>r' group='online' label='Reselect' />
77 77  
78 78 <separator/>
79   - <menuitem action='clear' group='online' key='Pause' label='Clear' />
80   - <menuitem action='EraseInput' icon='clear' group='online' label='Erase input' />
81   -<!--- <menuitem action='EraseField' key='<Ctrl>u' group='online' /> -->
82   - <menuitem action='EraseEOF' group='online' label='Erase to end of field' />
83   - <menuitem action='EraseEOL' group='online' label='Erase to end of line' />
  79 + <menuitem action='erase' target='all' group='online' key='Pause' label='Clear' />
  80 + <menuitem action='erase' target='input' icon='clear' group='online' label='Erase input' />
  81 +<!--- <menuitem action='erase' target='field' key='<Ctrl>u' group='online' /> -->
  82 + <menuitem action='erase' target='eof' group='online' label='Erase to end of field' />
  83 + <menuitem action='erase' target='eol' group='online' label='Erase to end of line' />
84 84 </menu>
85 85  
86 86 <!--- Special action - View menu will be populated with labeled toolbars, menubars and keypads --->
... ... @@ -212,8 +212,8 @@
212 212  
213 213 <accelerator action='DeleteWord' key='<Ctrl>w' group='online' />
214 214 <accelerator action='Delete' key='Delete' group='online' />
215   - <accelerator action='Erase' key='BackSpace' group='online' />
216   - <accelerator action='EraseEOF' key='End' group='online' />
  215 + <accelerator action='erase' target='char' key='BackSpace' group='online' />
  216 + <accelerator action='erase' target='eof' key='End' group='online' />
217 217 <accelerator action='fieldend' key='<ctrl>End' group='online' />
218 218  
219 219 <accelerator action='SysREQ' key='Sys_Req' group='online' />
... ...