Commit aa2168781de64c99de8f9ac07d5314d0f1b0a77d
1 parent
da3dd36a
Exists in
master
and in
1 other branch
Trace, log and messages are now managed by session.
Showing
1 changed file
with
23 additions
and
10 deletions
Show diff stats
widget.c
... | ... | @@ -927,6 +927,28 @@ static void release_activity_timer(v3270 *widget) |
927 | 927 | widget->activity.timer = NULL; |
928 | 928 | } |
929 | 929 | |
930 | +static int popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list args) | |
931 | + { | |
932 | + GtkWidget *terminal = (GtkWidget *) lib3270_get_user_data(session); | |
933 | + | |
934 | + if(terminal && GTK_IS_V3270(terminal)) { | |
935 | + | |
936 | + if(fmt) | |
937 | + { | |
938 | + gchar *text = g_strdup_vprintf(fmt,args); | |
939 | + v3270_popup_message(GTK_WIDGET(terminal),type,title,msg,text); | |
940 | + g_free(text); | |
941 | + } | |
942 | + else | |
943 | + { | |
944 | + v3270_popup_message(GTK_WIDGET(terminal),type,title,msg,NULL); | |
945 | + } | |
946 | + | |
947 | + } | |
948 | + | |
949 | + return 0; | |
950 | + } | |
951 | + | |
930 | 952 | static void v3270_init(v3270 *widget) |
931 | 953 | { |
932 | 954 | struct lib3270_session_callbacks *cbk; |
... | ... | @@ -934,16 +956,7 @@ static void v3270_init(v3270 *widget) |
934 | 956 | widget->host = lib3270_session_new(""); |
935 | 957 | |
936 | 958 | lib3270_set_user_data(widget->host,widget); |
937 | - | |
938 | - /* | |
939 | - trace("%s host->sz=%d expected=%d revision=%s expected=%s",__FUNCTION__,widget->host->sz,(int) sizeof(H3270),lib3270_get_revision(),PACKAGE_REVISION); | |
940 | - | |
941 | - if(widget->host->sz != sizeof(H3270)) | |
942 | - { | |
943 | - g_error( _( "Unexpected signature in H3270 object, possible version mismatch in lib3270") ); | |
944 | - return; | |
945 | - } | |
946 | - */ | |
959 | + lib3270_set_popup_handler(widget->host, popup_handler); | |
947 | 960 | |
948 | 961 | cbk = lib3270_get_session_callbacks(widget->host,sizeof(struct lib3270_session_callbacks)); |
949 | 962 | if(!cbk) | ... | ... |