Commit c38bd9b91020430b37988cf45e70b86f2bacb01b
1 parent
feec7d0e
Exists in
master
and in
1 other branch
Melhorando sistema de callbacks.
Showing
1 changed file
with
34 additions
and
24 deletions
Show diff stats
widget.c
@@ -918,7 +918,11 @@ static void release_activity_timer(v3270 *widget) | @@ -918,7 +918,11 @@ static void release_activity_timer(v3270 *widget) | ||
918 | 918 | ||
919 | static void v3270_init(v3270 *widget) | 919 | static void v3270_init(v3270 *widget) |
920 | { | 920 | { |
921 | - widget->host = lib3270_session_new(""); | 921 | + struct lib3270_session_callbacks *cbk; |
922 | + | ||
923 | + widget->host = lib3270_session_new(""); | ||
924 | + widget->host->user_data = widget; | ||
925 | + | ||
922 | 926 | ||
923 | trace("%s host->sz=%d expected=%d revision=%s expected=%s",__FUNCTION__,widget->host->sz,(int) sizeof(H3270),lib3270_get_revision(),PACKAGE_REVISION); | 927 | trace("%s host->sz=%d expected=%d revision=%s expected=%s",__FUNCTION__,widget->host->sz,(int) sizeof(H3270),lib3270_get_revision(),PACKAGE_REVISION); |
924 | 928 | ||
@@ -928,29 +932,35 @@ static void v3270_init(v3270 *widget) | @@ -928,29 +932,35 @@ static void v3270_init(v3270 *widget) | ||
928 | return; | 932 | return; |
929 | } | 933 | } |
930 | 934 | ||
931 | - widget->host->user_data = widget; | ||
932 | - | ||
933 | - widget->host->cbk.update = v3270_update_char; | ||
934 | - widget->host->cbk.changed = changed; | ||
935 | - widget->host->cbk.set_timer = set_timer; | ||
936 | - | ||
937 | - widget->host->cbk.set_selection = set_selection; | ||
938 | - widget->host->cbk.update_selection = update_selection; | ||
939 | - | ||
940 | - widget->host->cbk.update_luname = update_luname; | ||
941 | - widget->host->cbk.configure = update_screen_size; | ||
942 | - widget->host->cbk.update_status = update_message; | ||
943 | - widget->host->cbk.update_cursor = v3270_update_cursor; | ||
944 | - widget->host->cbk.update_toggle = update_toggle; | ||
945 | - widget->host->cbk.update_oia = v3270_update_oia; | ||
946 | - widget->host->cbk.cursor = select_cursor; | ||
947 | - widget->host->cbk.update_connect = update_connect; | ||
948 | - widget->host->cbk.update_model = update_model; | ||
949 | - widget->host->cbk.changed = changed; | ||
950 | - widget->host->cbk.ctlr_done = ctlr_done; | ||
951 | - widget->host->cbk.message = message; | ||
952 | - widget->host->cbk.update_ssl = v3270_update_ssl; | ||
953 | - widget->host->cbk.print = emit_print_signal; | 935 | + cbk = lib3270_get_session_callbacks(widget->host,sizeof(struct lib3270_session_callbacks)); |
936 | + if(!cbk) | ||
937 | + { | ||
938 | + g_error( _( "Invalid callback table, possible version mismatch in lib3270") ); | ||
939 | + return; | ||
940 | + } | ||
941 | + | ||
942 | + | ||
943 | + cbk->update = v3270_update_char; | ||
944 | + cbk->changed = changed; | ||
945 | + cbk->set_timer = set_timer; | ||
946 | + | ||
947 | + cbk->set_selection = set_selection; | ||
948 | + cbk->update_selection = update_selection; | ||
949 | + | ||
950 | + cbk->update_luname = update_luname; | ||
951 | + cbk->configure = update_screen_size; | ||
952 | + cbk->update_status = update_message; | ||
953 | + cbk->update_cursor = v3270_update_cursor; | ||
954 | + cbk->update_toggle = update_toggle; | ||
955 | + cbk->update_oia = v3270_update_oia; | ||
956 | + cbk->cursor = select_cursor; | ||
957 | + cbk->update_connect = update_connect; | ||
958 | + cbk->update_model = update_model; | ||
959 | + cbk->changed = changed; | ||
960 | + cbk->ctlr_done = ctlr_done; | ||
961 | + cbk->message = message; | ||
962 | + cbk->update_ssl = v3270_update_ssl; | ||
963 | + cbk->print = emit_print_signal; | ||
954 | 964 | ||
955 | 965 | ||
956 | // Reset timer | 966 | // Reset timer |