Commit 394b8b924c373eb16ab82dd8b445b3252643687a
1 parent
597d8ae9
Exists in
master
and in
5 other branches
Incluindo action_string
Showing
2 changed files
with
27 additions
and
1 deletions
Show diff stats
src/lib3270/kybd.c
... | ... | @@ -2521,7 +2521,8 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, char *s, int len, int |
2521 | 2521 | return 0; |
2522 | 2522 | } |
2523 | 2523 | |
2524 | - if (pasting && IN_3270) { | |
2524 | + if (pasting && IN_3270) | |
2525 | + { | |
2525 | 2526 | |
2526 | 2527 | /* Check for cursor wrap to top of screen. */ |
2527 | 2528 | if (hSession->cursor_addr < orig_addr) | ... | ... |
src/pw3270/actions.c
... | ... | @@ -389,6 +389,13 @@ static void action_select_last(GtkAction *action, GtkWidget *widget) |
389 | 389 | lib3270_reselect(v3270_get_session(widget)); |
390 | 390 | } |
391 | 391 | |
392 | +static void action_string(GtkAction *action, GtkWidget *widget) | |
393 | +{ | |
394 | + gchar *text = g_object_get_data(G_OBJECT(action),"value"); | |
395 | + if(text) | |
396 | + lib3270_emulate_input(v3270_get_session(widget),text,strlen(text),0); | |
397 | +} | |
398 | + | |
392 | 399 | static int id_from_array(const gchar *key, const gchar **array, GError **error) |
393 | 400 | { |
394 | 401 | int f; |
... | ... | @@ -481,6 +488,7 @@ GtkAction * ui_get_action(GtkWidget *widget, const gchar *name, GHashTable *hash |
481 | 488 | ACTION_TYPE_SET, |
482 | 489 | ACTION_TYPE_RESET, |
483 | 490 | ACTION_TYPE_TABLE, |
491 | + ACTION_TYPE_STRING, | |
484 | 492 | |
485 | 493 | } action_type = ACTION_TYPE_DEFAULT; |
486 | 494 | |
... | ... | @@ -658,6 +666,18 @@ GtkAction * ui_get_action(GtkWidget *widget, const gchar *name, GHashTable *hash |
658 | 666 | id = atoi(attr); |
659 | 667 | nm = g_strdup_printf("pa%02d",id); |
660 | 668 | } |
669 | + else if(!g_ascii_strcasecmp(name,"string")) | |
670 | + { | |
671 | + action_type = ACTION_TYPE_STRING; | |
672 | + attr = ui_get_attribute("value",names,values); | |
673 | + if(!attr) | |
674 | + { | |
675 | + *error = g_error_new(ERROR_DOMAIN,EINVAL,_("%s action needs a valid value" ),name); | |
676 | + return NULL; | |
677 | + } | |
678 | + attr = ui_get_attribute("name",names,values); | |
679 | + nm = g_strdup(attr ? attr : name); | |
680 | + } | |
661 | 681 | else |
662 | 682 | { |
663 | 683 | attr = ui_get_attribute("name",names,values); |
... | ... | @@ -722,6 +742,11 @@ GtkAction * ui_get_action(GtkWidget *widget, const gchar *name, GHashTable *hash |
722 | 742 | action = gtk_action_new(nm,NULL,NULL,NULL); |
723 | 743 | g_signal_connect(action,"activate",callback[id],widget); |
724 | 744 | break; |
745 | + | |
746 | + case ACTION_TYPE_STRING: | |
747 | + action = gtk_action_new(nm,NULL,NULL,NULL); | |
748 | + g_signal_connect(action,"activate",G_CALLBACK(action_string),widget); | |
749 | + break; | |
725 | 750 | } |
726 | 751 | |
727 | 752 | for(f=0;f<ACTION_COUNT;f++) | ... | ... |