Commit 1d8358e7763df9099ee6e4e1648201d9f47d9c24
1 parent
f8cc9e1e
Exists in
master
and in
5 other branches
Trace, log and messages are now managed by session.
Showing
4 changed files
with
28 additions
and
34 deletions
Show diff stats
modules/lib3270
src/pw3270/main.c
... | ... | @@ -274,6 +274,7 @@ static void trace_window_destroy(GtkWidget *widget, H3270 *hSession) |
274 | 274 | trace_window = NULL; |
275 | 275 | } |
276 | 276 | |
277 | +/* | |
277 | 278 | static void g_trace(H3270 *hSession, const char *fmt, va_list args) |
278 | 279 | { |
279 | 280 | gchar *ptr = g_strdup_vprintf(fmt,args); |
... | ... | @@ -334,6 +335,7 @@ static void g_trace(H3270 *hSession, const char *fmt, va_list args) |
334 | 335 | |
335 | 336 | g_free(ptr); |
336 | 337 | } |
338 | +*/ | |
337 | 339 | |
338 | 340 | static gboolean startup(GtkWidget *toplevel) |
339 | 341 | { |
... | ... | @@ -491,7 +493,7 @@ int main(int argc, char *argv[]) |
491 | 493 | g_log_set_default_handler(g_logfile,NULL); |
492 | 494 | } |
493 | 495 | |
494 | - lib3270_set_trace_handler(g_trace); | |
496 | +// lib3270_set_trace_handler(g_trace); | |
495 | 497 | |
496 | 498 | // Check GTK Version |
497 | 499 | { | ... | ... |
src/pw3270/v3270/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) | ... | ... |
src/pw3270/window.c
... | ... | @@ -139,27 +139,7 @@ |
139 | 139 | return 0; |
140 | 140 | } |
141 | 141 | |
142 | - static int popup_handler(H3270 *session, void *terminal, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list args) | |
143 | - { | |
144 | - GtkWidget *widget = NULL; | |
145 | - | |
146 | - if(session && terminal && GTK_IS_V3270(terminal)) | |
147 | - widget = GTK_WIDGET(terminal); | |
148 | - | |
149 | - if(fmt) | |
150 | - { | |
151 | - gchar *text = g_strdup_vprintf(fmt,args); | |
152 | - v3270_popup_message(GTK_WIDGET(widget),type,title,msg,text); | |
153 | - g_free(text); | |
154 | - } | |
155 | - else | |
156 | - { | |
157 | - v3270_popup_message(GTK_WIDGET(widget),type,title,msg,NULL); | |
158 | - } | |
159 | - return 0; | |
160 | - } | |
161 | - | |
162 | - static void pw3270_class_init(pw3270Class *klass) | |
142 | + static void pw3270_class_init(pw3270Class *klass) | |
163 | 143 | { |
164 | 144 | #if GTK_CHECK_VERSION(3,0,0) |
165 | 145 | GtkWidgetClass * widget_class = GTK_WIDGET_CLASS(klass); |
... | ... | @@ -172,7 +152,6 @@ |
172 | 152 | #endif // GTK3 |
173 | 153 | |
174 | 154 | configuration_init(); |
175 | - lib3270_set_popup_handler(popup_handler); | |
176 | 155 | |
177 | 156 | } |
178 | 157 | ... | ... |