Commit a2f38461fdc3adcd45fef2a643d290d1d58c608a
1 parent
7b2b8935
Exists in
master
and in
1 other branch
Updating trace handler, resetting trace states when trace window closes.
Showing
1 changed file
with
6 additions
and
7 deletions
Show diff stats
src/trace/trace.c
| ... | ... | @@ -85,8 +85,8 @@ |
| 85 | 85 | |
| 86 | 86 | /// @brief lib3270's saved trace handler. |
| 87 | 87 | struct { |
| 88 | - void (*handler)(H3270 *session, void *userdata, const char *fmt, va_list args); | |
| 89 | - void *userdata; | |
| 88 | + LIB3270_TRACE_HANDLER handler; | |
| 89 | + void *userdata; | |
| 90 | 90 | } trace; |
| 91 | 91 | |
| 92 | 92 | }; |
| ... | ... | @@ -97,13 +97,11 @@ |
| 97 | 97 | |
| 98 | 98 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 99 | 99 | |
| 100 | - static void trace_handler(H3270 *hSession, void *userdata, const char *fmt, va_list args) | |
| 100 | + static int trace_handler(const H3270 *hSession, void *userdata, const char *message) | |
| 101 | 101 | { |
| 102 | - g_autofree gchar *ptr = g_strdup_vprintf(fmt,args); | |
| 103 | - g_autofree gchar * utftext = g_convert_with_fallback(ptr,-1,"UTF-8",lib3270_get_display_charset(hSession),"?",NULL,NULL,NULL); | |
| 104 | - | |
| 102 | + g_autofree gchar * utftext = g_convert_with_fallback(message,-1,"UTF-8",lib3270_get_display_charset(hSession),"?",NULL,NULL,NULL); | |
| 105 | 103 | v3270_trace_append_text(GTK_WIDGET(userdata),utftext); |
| 106 | - | |
| 104 | + return 0; | |
| 107 | 105 | } |
| 108 | 106 | |
| 109 | 107 | static void set_session(V3270Trace *widget, H3270 *hSession) |
| ... | ... | @@ -153,6 +151,7 @@ |
| 153 | 151 | for(ix = 0; ix < G_N_ELEMENTS(toggles); ix++) |
| 154 | 152 | { |
| 155 | 153 | // TODO: Use button "destroy" signal to cleanup. |
| 154 | + lib3270_set_toggle(trace->hSession,toggles[ix],0); | |
| 156 | 155 | trace->buttons.widgets[ix] = NULL; |
| 157 | 156 | } |
| 158 | 157 | ... | ... |