Commit 0777e802919e996139d64b1e0ad600d1b1cb7f55

Authored by Perry Werneck
1 parent d018ea2b
Exists in master and in 1 other branch develop

Adding signal to allow extra commands on the trace window.

Makefile.in
... ... @@ -104,7 +104,8 @@ DEPENDS= \
104 104 src/include/v3270/*.h \
105 105 src/filetransfer/marshal.h \
106 106 src/filetransfer/private.h \
107   - src/terminal/marshal.h
  107 + src/terminal/marshal.h \
  108 + src/trace/marshal.h
108 109  
109 110 CFLAGS= \
110 111 @CFLAGS@ \
... ... @@ -133,7 +134,7 @@ $(OBJDBG)/%.o: \
133 134 $(DEPENDS)
134 135  
135 136 @echo $< ...
136   - @$(MKDIR) $(dir $@)
  137 + @$(MKDIR) $(@D)
137 138  
138 139 @$(CC) \
139 140 $(CFLAGS) \
... ... @@ -145,7 +146,7 @@ $(OBJDBG)/%.o: \
145 146 %.rc
146 147  
147 148 @echo $< ...
148   - @$(MKDIR) $(dir $@)
  149 + @$(MKDIR) $(@D)
149 150 @$(WINDRES) $< -O coff -o $@
150 151  
151 152 %.dll.a: \
... ... @@ -174,7 +175,7 @@ $(OBJRLS)/%.o: \
174 175 %.rc
175 176  
176 177 @echo $< ...
177   - @$(MKDIR) $(dir $@)
  178 + @$(MKDIR) $(@D)
178 179 @$(WINDRES) $< -O coff -o $@
179 180  
180 181 #---[ Misc Rules ]-----------------------------------------------------------------------
... ... @@ -183,7 +184,7 @@ $(POTDIR)/$(LIBNAME)/%.pot: \
183 184 %.c
184 185  
185 186 @echo $(notdir $@) ...
186   - @$(MKDIR) $(dir $@)
  187 + @$(MKDIR) $(@D)
187 188 @$(XGETTEXT) \
188 189 --language=C \
189 190 --keyword=_ \
... ... @@ -207,7 +208,7 @@ src/terminal/marshal.h: \
207 208 src/terminal/marshal
208 209  
209 210 @echo $@ ...
210   - @$(MKDIR) $(dir $@)
  211 + @$(MKDIR) $(@D)
211 212  
212 213 @$(GENMARSHAL) --prefix=v3270 --header $< > $@
213 214  
... ... @@ -215,7 +216,7 @@ $(OBJDIR)/marshal/v3270.c: \
215 216 src/terminal/marshal
216 217  
217 218 @echo $@ ...
218   - @$(MKDIR) $(dir $@)
  219 + @$(MKDIR) $(@D)
219 220  
220 221 @$(GENMARSHAL) --prefix=v3270 --body $< > $@
221 222  
... ... @@ -224,7 +225,7 @@ src/filetransfer/marshal.h: \
224 225 src/filetransfer/marshal
225 226  
226 227 @echo $@ ...
227   - @$(MKDIR) $(dir $@)
  228 + @$(MKDIR) $(@D)
228 229  
229 230 @$(GENMARSHAL) --prefix=v3270ft --header $< > $@
230 231  
... ... @@ -232,16 +233,33 @@ $(OBJDIR)/marshal/v3270ft.c: \
232 233 src/filetransfer/marshal
233 234  
234 235 @echo $@ ...
235   - @$(MKDIR) $(dir $@)
  236 + @$(MKDIR) $(@D)
236 237  
237 238 @$(GENMARSHAL) --prefix=v3270ft --body $< > $@
238 239  
  240 +src/trace/marshal.h: \
  241 + src/trace/marshal
  242 +
  243 + @echo $@ ...
  244 + @$(MKDIR) $(@D)
  245 +
  246 + @$(GENMARSHAL) --prefix=v3270trace --header $< > $@
  247 +
  248 +$(OBJDIR)/marshal/trace.c: \
  249 + src/trace/marshal
  250 +
  251 + @echo $@ ...
  252 + @$(MKDIR) $(@D)
  253 +
  254 + @$(GENMARSHAL) --prefix=v3270trace --body $< > $@
  255 +
  256 +
239 257 $(OBJDIR)/marshal/%.o: \
240 258 $(OBJDIR)/marshal/%.c \
241 259 $(DEPENDS)
242 260  
243 261 @echo $< ...
244   - @$(MKDIR) $(dir $@)
  262 + @$(MKDIR) $(@D)
245 263  
246 264 @$(CC) \
247 265 $(CFLAGS) \
... ... @@ -264,9 +282,10 @@ Release: \
264 282 $(BINRLS)/$(SONAME): \
265 283 $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) \
266 284 $(OBJDIR)/marshal/v3270.o \
267   - $(OBJDIR)/marshal/v3270ft.o
  285 + $(OBJDIR)/marshal/v3270ft.o \
  286 + $(OBJDIR)/marshal/trace.o
268 287  
269   - @$(MKDIR) $(dir $@)
  288 + @$(MKDIR) $(@D)
270 289 @echo $< ...
271 290 @$(LD) \
272 291 @DLL_LDFLAGS@ \
... ... @@ -280,7 +299,7 @@ $(BINRLS)/static/$(LIBNAME).a: \
280 299 $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o)
281 300  
282 301 @echo $@ ...
283   - @$(MKDIR) $(dir $@)
  302 + @$(MKDIR) $(@D)
284 303 @$(AR) rcs $@ $^
285 304  
286 305  
... ... @@ -402,7 +421,7 @@ $(POTDIR)/$(LIBNAME).pot: \
402 421 $(foreach SRC, $(basename $(SOURCES)), $(POTDIR)/$(LIBNAME)/$(SRC).pot)
403 422  
404 423 @rm -f $@
405   - @mkdir -p `dirname $@`
  424 + @$(MKDIR) $(@D)
406 425 @$(MSGCAT) --sort-output $^ > $@
407 426  
408 427 locale: \
... ... @@ -418,7 +437,7 @@ $(BINDBG)/$(LIBNAME)@EXEEXT@: \
418 437 $(foreach SRC, $(basename $(TEST_SOURCES)), $(OBJDBG)/$(SRC).o) \
419 438 $(BINDBG)/$(SONAME)
420 439  
421   - @$(MKDIR) `dirname $@`
  440 + @$(MKDIR) $(@D)
422 441 @echo $< ...
423 442 @$(LD) \
424 443 -o $@ \
... ... @@ -454,9 +473,10 @@ endif
454 473 $(BINDBG)/$(SONAME): \
455 474 $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC).o) \
456 475 $(OBJDIR)/marshal/v3270.o \
457   - $(OBJDIR)/marshal/v3270ft.o
  476 + $(OBJDIR)/marshal/v3270ft.o \
  477 + $(OBJDIR)/marshal/trace.o
458 478  
459   - @$(MKDIR) `dirname $@`
  479 + @$(MKDIR) $(@D)
460 480 @echo $< ...
461 481 @$(LD) \
462 482 -shared -Wl,-soname,$(@F) \
... ...
src/include/v3270.h
... ... @@ -284,7 +284,6 @@
284 284 LIB3270_EXPORT int v3270_save_copy(GtkWidget *widget, const gchar *filename, GError **error);
285 285  
286 286 // Misc
287   - LIB3270_EXPORT int v3270_exec_command(GtkWidget *widget, const gchar *cmdline);
288 287 LIB3270_EXPORT void v3270_zoom_best(GtkWidget *widget);
289 288 LIB3270_EXPORT void v3270_zoom_in(GtkWidget *widget);
290 289 LIB3270_EXPORT void v3270_zoom_out(GtkWidget *widget);
... ...
src/include/v3270/trace.h
... ... @@ -47,6 +47,8 @@
47 47 typedef struct _V3270Trace V3270Trace;
48 48 typedef struct _V3270TraceClass V3270TraceClass;
49 49  
  50 + LIB3270_EXPORT GType V3270Trace_get_type(void);
  51 +
50 52 LIB3270_EXPORT GtkWidget * v3270_trace_new(GtkWidget *terminal);
51 53 LIB3270_EXPORT void v3270_trace_append_text(GtkWidget *widget, const gchar *text);
52 54 LIB3270_EXPORT void v3270_trace_vprintf(GtkWidget *widget, const char *fmt, va_list args);
... ... @@ -58,6 +60,8 @@
58 60 LIB3270_EXPORT void v3270_trace_save(GtkWidget *widget);
59 61 LIB3270_EXPORT void v3270_trace_select_file(GtkWidget *widget);
60 62  
  63 + LIB3270_EXPORT int v3270_trace_exec_command(GtkWidget *widget, const gchar *cmdline);
  64 +
61 65 LIB3270_EXPORT GtkWidget * v3270_trace_window_new(GtkWidget *widget, const gchar *header);
62 66  
63 67 G_END_DECLS
... ...
src/terminal/properties/init.c
... ... @@ -162,7 +162,7 @@
162 162 klass->properties.type.toggle = klass->properties.count;
163 163 for(ix = 0; ix < LIB3270_TOGGLE_COUNT; ix++)
164 164 {
165   - debug("Property %u=%s (Toggle)",(unsigned int) klass->properties.type.toggle + ix, lib3270_get_toggle_name(ix));
  165 +// debug("Property %u=%s (Toggle)",(unsigned int) klass->properties.type.toggle + ix, lib3270_get_toggle_name(ix));
166 166  
167 167 klass->properties.toggle[ix] =
168 168 g_param_spec_boolean(
... ... @@ -183,7 +183,7 @@
183 183  
184 184 for(ix = 0; bool_props[ix].name; ix++)
185 185 {
186   - debug("Property %u=%s (Boolean)",(unsigned int) klass->properties.type.boolean + ix, bool_props[ix].name);
  186 +// debug("Property %u=%s (Boolean)",(unsigned int) klass->properties.type.boolean + ix, bool_props[ix].name);
187 187 spec = g_param_spec_boolean(
188 188 bool_props[ix].name,
189 189 bool_props[ix].name,
... ... @@ -202,7 +202,7 @@
202 202  
203 203 for(ix = 0; int_props[ix].name; ix++)
204 204 {
205   - debug("Property %u=%s (Integer)",(unsigned int) klass->properties.type.integer + ix, int_props[ix].name);
  205 +// debug("Property %u=%s (Integer)",(unsigned int) klass->properties.type.integer + ix, int_props[ix].name);
206 206  
207 207 spec = g_param_spec_int(
208 208 int_props[ix].name,
... ... @@ -224,7 +224,7 @@
224 224  
225 225 for(ix = 0; uint_props[ix].name; ix++)
226 226 {
227   - debug("Property %u=%s (unsigned)",(unsigned int) klass->properties.type.integer + ix, uint_props[ix].name);
  227 +// debug("Property %u=%s (unsigned)",(unsigned int) klass->properties.type.integer + ix, uint_props[ix].name);
228 228  
229 229 spec = g_param_spec_uint(
230 230 uint_props[ix].name,
... ... @@ -247,7 +247,7 @@
247 247 for(ix = 0; str_props[ix].name; ix++)
248 248 {
249 249  
250   - debug("Property %u=%s (String)",(unsigned int) klass->properties.type.str + ix, str_props[ix].name);
  250 +// debug("Property %u=%s (String)",(unsigned int) klass->properties.type.str + ix, str_props[ix].name);
251 251  
252 252 spec = g_param_spec_string(
253 253 str_props[ix].name,
... ...
src/testprogram/testprogram.c
... ... @@ -70,7 +70,9 @@
70 70 }
71 71  
72 72 // Create trace window
73   - gtk_notebook_append_page(GTK_NOTEBOOK(notebook),v3270_trace_new(terminal),gtk_label_new("Trace"));
  73 + GtkWidget *trace = v3270_trace_new(terminal);
  74 + debug("Trace=%p",trace);
  75 + gtk_notebook_append_page(GTK_NOTEBOOK(notebook),trace,gtk_label_new("Trace"));
74 76 // v3270_trace_window_new(terminal,NULL);
75 77  
76 78 // Setup and show main window
... ...
src/trace/exec.c
... ... @@ -27,22 +27,11 @@
27 27 *
28 28 */
29 29  
30   - #include <gtk/gtk.h>
  30 + #include "private.h"
31 31  
32   - #define ENABLE_NLS
33   - #define GETTEXT_PACKAGE PACKAGE_NAME
34   -
35   - #include <libintl.h>
36   - #include <glib/gi18n.h>
37 32 #include <stdlib.h>
38   -
39   - #include <lib3270.h>
40   - #include <lib3270/log.h>
41   - #include <lib3270/trace.h>
42 33 #include <lib3270/properties.h>
43 34 #include <lib3270/actions.h>
44   - #include <v3270.h>
45   - #include <v3270/trace.h>
46 35 #include <internals.h>
47 36  
48 37 static const gchar * get_word(gchar **ptr)
... ... @@ -155,28 +144,28 @@
155 144 return 0;
156 145 }
157 146  
158   - int v3270_exec_command(GtkWidget *widget, const gchar *text)
  147 + int v3270_trace_exec_command(GtkWidget *t, const gchar *text)
159 148 {
160   -// size_t ix;
161 149  
162   - g_return_val_if_fail(GTK_IS_V3270(widget),EINVAL);
  150 + g_return_val_if_fail(GTK_IS_V3270_TRACE(t),EINVAL);
163 151  
164   - H3270 *hSession = v3270_get_session(widget);
165   - g_autofree gchar * cmdline = g_strdup(text);
  152 + V3270Trace * trace = GTK_V3270_TRACE(t);
  153 + H3270 * hSession = v3270_get_session(trace->terminal);
  154 + g_autofree gchar * cmdline = g_strdup(text);
166 155  
167 156 g_strstrip(cmdline);
168 157  
169   - debug("cmdline: \"%s\"",cmdline);
  158 + debug("cmdline: \"%s\" widget=%p",cmdline,t);
170 159  
171 160 if(g_str_has_prefix(cmdline,"reload"))
172 161 {
173   - v3270_reload(widget);
  162 + v3270_reload(trace->terminal);
174 163 return 0;
175 164 }
176 165  
177 166 if(g_str_has_prefix(cmdline,"reconfigure"))
178 167 {
179   - v3270_reconfigure(GTK_V3270(widget));
  168 + v3270_reconfigure(GTK_V3270(trace->terminal));
180 169 return 0;
181 170 }
182 171  
... ... @@ -195,15 +184,15 @@
195 184 if(!(*arg && g_ascii_strcasecmp(arg,"text")))
196 185 {
197 186 // No argument or "text" copy text.
198   - v3270_copy_selection(widget, V3270_SELECT_TEXT, FALSE);
  187 + v3270_copy_selection(trace->terminal, V3270_SELECT_TEXT, FALSE);
199 188 }
200 189 else if(!g_ascii_strcasecmp(arg,"table"))
201 190 {
202   - v3270_copy_selection(widget, V3270_SELECT_TABLE, FALSE);
  191 + v3270_copy_selection(trace->terminal, V3270_SELECT_TABLE, FALSE);
203 192 }
204 193 else if(!g_ascii_strcasecmp(arg,"append"))
205 194 {
206   - v3270_append_selection(widget,FALSE);
  195 + v3270_append_selection(trace->terminal,FALSE);
207 196 }
208 197 else
209 198 {
... ... @@ -223,15 +212,15 @@
223 212 if(!(*arg && g_ascii_strcasecmp(arg,"all")))
224 213 {
225 214 // No argument or "text" copy text.
226   - v3270_print_all(widget,NULL);
  215 + v3270_print_all(trace->terminal,NULL);
227 216 }
228 217 else if(!g_ascii_strcasecmp(arg,"selected"))
229 218 {
230   - v3270_print_selected(widget,NULL);
  219 + v3270_print_selected(trace->terminal,NULL);
231 220 }
232 221 else if(!g_ascii_strcasecmp(arg,"copy"))
233 222 {
234   - v3270_print_copy(widget,NULL);
  223 + v3270_print_copy(trace->terminal,NULL);
235 224 }
236 225 else
237 226 {
... ... @@ -250,11 +239,11 @@
250 239  
251 240 if(!*arg)
252 241 {
253   - v3270_paste(widget);
  242 + v3270_paste(trace->terminal);
254 243 }
255 244 else if(!g_ascii_strcasecmp(arg,"text"))
256 245 {
257   - v3270_paste_text(widget);
  246 + v3270_paste_text(trace->terminal);
258 247 }
259 248 else
260 249 {
... ... @@ -269,7 +258,7 @@
269 258 gchar * str = strchr(cmdline,'?');
270 259 *str = 0;
271 260 g_strstrip(cmdline);
272   - return get_property(widget,cmdline);
  261 + return get_property(trace->terminal,cmdline);
273 262 }
274 263  
275 264 if(strchr(cmdline,'='))
... ... @@ -278,14 +267,14 @@
278 267 *(value++) = 0;
279 268 g_strstrip(cmdline);
280 269 g_strstrip(value);
281   - return set_property(widget,cmdline,value);
  270 + return set_property(trace->terminal,cmdline,value);
282 271 }
283 272  
284 273 if(g_str_has_prefix(cmdline,"remap"))
285 274 {
286 275 gchar *txtptr = cmdline+5;
287 276 g_strstrip(txtptr);
288   - v3270_set_remap_filename(widget,txtptr);
  277 + v3270_set_remap_filename(trace->terminal,txtptr);
289 278 return 0;
290 279 }
291 280  
... ... @@ -294,7 +283,7 @@
294 283 gchar *txtptr = cmdline+3;
295 284 const gchar * name = get_word(&txtptr);
296 285 g_strstrip(txtptr);
297   - return set_property(widget,name,(*txtptr ? txtptr : "1"));
  286 + return set_property(trace->terminal,name,(*txtptr ? txtptr : "1"));
298 287 }
299 288  
300 289 if(g_str_has_prefix(cmdline,"get"))
... ... @@ -302,7 +291,7 @@
302 291 gchar *txtptr = cmdline+3;
303 292 const gchar * name = get_word(&txtptr);
304 293 g_strstrip(txtptr);
305   - return get_property(widget,name);
  294 + return get_property(trace->terminal,name);
306 295 }
307 296  
308 297 if(g_str_has_prefix(cmdline,"reset"))
... ... @@ -310,45 +299,38 @@
310 299 gchar *txtptr = cmdline+3;
311 300 const gchar * name = get_word(&txtptr);
312 301 g_strstrip(txtptr);
313   - return set_property(widget,name,(*txtptr ? txtptr : "0"));
  302 + return set_property(trace->terminal,name,(*txtptr ? txtptr : "0"));
314 303 }
315 304  
316 305 gchar * sep = strchr(cmdline,'=');
317 306 if(sep)
318 307 {
319 308 *(sep++) = 0;
320   - return set_property(widget,g_strstrip(cmdline),g_strstrip(sep));
  309 + return set_property(trace->terminal,g_strstrip(cmdline),g_strstrip(sep));
321 310 }
322 311 else
323 312 {
324   - const LIB3270_ACTION * action = lib3270_get_action(cmdline);
  313 + const LIB3270_ACTION * action = lib3270_action_get_by_name(cmdline);
325 314  
326 315 if(action)
327 316 return lib3270_action_activate(action,hSession);
328 317  
329   - /*
330   - // Check for lib3270 actions.
331   - const LIB3270_ACTION * actions = lib3270_get_actions();
  318 + }
332 319  
333   - for(ix=0; actions[ix].name; ix++)
334   - {
335   - if(!g_ascii_strcasecmp(actions[ix].name,cmdline))
336   - {
337   - if(actions[ix].enabled(hSession))
338   - {
339   - lib3270_trace_event(hSession,"Activating action \"%s\"\n",actions[ix].name);
340   - return actions[ix].activate(hSession);
341   - }
342   - else
343   - {
344   - lib3270_trace_event(hSession,"Action \"%s\" is disabled\n",actions[ix].name);
345   - return EPERM;
346   - }
347   - }
348   - }
349   - */
  320 + // Check for external interpreters
  321 + gboolean handled = FALSE;
  322 + gchar * args = cmdline;
350 323  
351   - }
  324 + while(*args && !g_ascii_isspace(*args))
  325 + args++;
  326 +
  327 + if(*args)
  328 + *(args++) = 0;
  329 +
  330 + g_signal_emit(GTK_WIDGET(trace), v3270_trace_signal[V3270_TRACE_SIGNAL_COMMAND], 0, cmdline, args, &handled);
  331 +
  332 + if(handled)
  333 + return 0;
352 334  
353 335 return errno = ENOENT;
354 336 }
... ...
src/trace/marshal 0 → 100644
... ... @@ -0,0 +1,2 @@
  1 +BOOLEAN:POINTER,POINTER
  2 +
... ...
src/trace/private.h 0 → 100644
... ... @@ -0,0 +1,97 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como private.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + */
  29 +
  30 +#ifndef PRIVATE_H_INCLUDED
  31 +
  32 + #include <config.h>
  33 +
  34 + #include <gtk/gtk.h>
  35 +
  36 + #define ENABLE_NLS
  37 + #define GETTEXT_PACKAGE PACKAGE_NAME
  38 +
  39 + #include <libintl.h>
  40 + #include <glib/gi18n.h>
  41 +
  42 + #include <v3270.h>
  43 + #include <v3270/trace.h>
  44 +
  45 + #include <lib3270.h>
  46 + #include <lib3270/log.h>
  47 + #include <lib3270/trace.h>
  48 +
  49 + /// @brief V3270 Trace Signal list
  50 + enum
  51 + {
  52 + V3270_TRACE_SIGNAL_COMMAND,
  53 +
  54 + V3270_TRACE_SIGNAL_LAST
  55 + };
  56 +
  57 + G_GNUC_INTERNAL guint v3270_trace_signal[V3270_TRACE_SIGNAL_LAST];
  58 +
  59 + G_BEGIN_DECLS
  60 +
  61 + struct _V3270TraceClass
  62 + {
  63 + GtkBoxClass parent_class;
  64 +
  65 + };
  66 +
  67 + struct _V3270Trace
  68 + {
  69 +
  70 + GtkBox parent;
  71 + H3270 * hSession; ///< @brief TN3270 Session.
  72 + GtkWidget * terminal; ///< @brief V3270 Widget.
  73 + GtkScrolledWindow * scroll;
  74 +
  75 + GtkTextView * view; ///< @brief Text view;
  76 + GtkTextBuffer * text; ///< @brief Trace window contents.
  77 + GtkEntry * entry; ///< @brief Command line entry.
  78 + GtkWidget * buttons; ///< @brief Button bar.
  79 +
  80 + gchar * filename; ///< @brief Selected file name.
  81 +
  82 + guint log_handler; ///< @brief GTK Log Handler.
  83 +
  84 + /// @brief lib3270's saved trace handler.
  85 + struct {
  86 + void (*handler)(H3270 *session, void *userdata, const char *fmt, va_list args);
  87 + void *userdata;
  88 + } trace;
  89 +
  90 + };
  91 +
  92 + G_END_DECLS
  93 +
  94 +
  95 +
  96 +#endif // PRIVATE_H_INCLUDED
  97 +
... ...
src/trace/trace.c
... ... @@ -36,62 +36,17 @@
36 36 *
37 37 */
38 38  
39   - #include <gtk/gtk.h>
  39 + #include "private.h"
40 40  
41   - #define ENABLE_NLS
42   - #define GETTEXT_PACKAGE PACKAGE_NAME
43   -
44   - #include <libintl.h>
45   - #include <glib/gi18n.h>
46   -
47   - #include <v3270.h>
48   - #include <lib3270.h>
49   - #include <lib3270/log.h>
50   - #include <lib3270/trace.h>
  41 + #include <lib3270/toggle.h>
51 42 #include <lib3270/properties.h>
52   - #include <v3270/trace.h>
53   - #include <v3270/dialogs.h>
54 43 #include <internals.h>
55   -
56   -#if defined( HAVE_SYSLOG )
57   - #include <syslog.h>
58   -#endif // HAVE_SYSLOG
  44 + #include <v3270/dialogs.h>
  45 + #include "marshal.h"
59 46  
60 47 /*--[ Widget definition ]----------------------------------------------------------------------------*/
61 48  
62   - G_BEGIN_DECLS
63   -
64   - struct _V3270TraceClass
65   - {
66   - GtkBoxClass parent_class;
67   -
68   - };
69   -
70   - struct _V3270Trace
71   - {
72   - GtkBox parent;
73   - H3270 * hSession; ///< @brief TN3270 Session.
74   - GtkWidget * terminal; ///< @brief V3270 Widget.
75   - GtkScrolledWindow * scroll;
76   -
77   - GtkTextView * view; ///< @brief Text view;
78   - GtkTextBuffer * text; ///< @brief Trace window contents.
79   - GtkEntry * entry; ///< @brief Command line entry.
80   - GtkWidget * buttons; ///< @brief Button bar.
81   -
82   - gchar * filename; ///< @brief Selected file name.
83   -
84   - guint log_handler; ///< @brief GTK Log Handler.
85   -
86   - /// @brief lib3270's saved trace handler.
87   - struct {
88   - void (*handler)(H3270 *session, void *userdata, const char *fmt, va_list args);
89   - void *userdata;
90   - } trace;
91   -
92   - };
93   -
94   - G_END_DECLS
  49 + guint v3270_trace_signal[V3270_TRACE_SIGNAL_LAST] = { 0 };
95 50  
96 51 G_DEFINE_TYPE(V3270Trace, V3270Trace, GTK_TYPE_BOX);
97 52  
... ... @@ -151,9 +106,23 @@
151 106 G_OBJECT_CLASS(V3270Trace_parent_class)->finalize(object);
152 107 }
153 108  
154   - static void V3270Trace_class_init(G_GNUC_UNUSED V3270TraceClass *klass)
  109 + static void V3270Trace_class_init(V3270TraceClass *klass)
155 110 {
156   - G_OBJECT_CLASS(klass)->finalize = finalize;
  111 + GObjectClass * gobject_class = G_OBJECT_CLASS(klass);
  112 +
  113 + gobject_class->finalize = finalize;
  114 +
  115 + v3270_trace_signal[V3270_TRACE_SIGNAL_COMMAND] =
  116 + g_signal_new( "command",
  117 + G_OBJECT_CLASS_TYPE(klass),
  118 + G_SIGNAL_RUN_LAST,
  119 + 0,
  120 + NULL, NULL,
  121 + v3270trace_BOOLEAN__POINTER_POINTER,
  122 + G_TYPE_BOOLEAN, 2, G_TYPE_POINTER, G_TYPE_POINTER);
  123 +
  124 +
  125 +
157 126 }
158 127  
159 128 static void v3270_trace_execute(GtkWidget *widget, const gchar *cmd)
... ... @@ -167,7 +136,7 @@
167 136  
168 137 if(trace->terminal)
169 138 {
170   - int rc = v3270_exec_command(trace->terminal,cmd);
  139 + int rc = v3270_trace_exec_command(widget,cmd);
171 140 if(rc)
172 141 v3270_trace_printf(widget, "rc=%d (%s)\n",rc,strerror(rc));
173 142 }
... ... @@ -249,6 +218,9 @@
249 218  
250 219 static void V3270Trace_init(V3270Trace *widget)
251 220 {
  221 +
  222 + debug("%s(%p)",__FUNCTION__,widget);
  223 +
252 224 gtk_orientable_set_orientation(GTK_ORIENTABLE(widget),GTK_ORIENTATION_VERTICAL);
253 225  
254 226 // Create toolbar
... ...
v3270.cbp
... ... @@ -294,6 +294,7 @@
294 294 <Unit filename="src/trace/exec.c">
295 295 <Option compilerVar="CC" />
296 296 </Unit>
  297 + <Unit filename="src/trace/private.h" />
297 298 <Unit filename="src/trace/trace.c">
298 299 <Option compilerVar="CC" />
299 300 </Unit>
... ...