Commit fc3b8b17a375541f83075b0c0d657509454f79a9
1 parent
ab1c5846
Exists in
master
and in
5 other branches
Removing unused sources.
Showing
9 changed files
with
0 additions
and
2091 deletions
Show diff stats
src/pw3270/ft/Makefile.in
... | ... | @@ -1,123 +0,0 @@ |
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., 59 Temple | |
19 | -# Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | -# | |
21 | -# Contatos: | |
22 | -# | |
23 | -# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
24 | -# erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) | |
25 | -# | |
26 | - | |
27 | -MODULE_NAME=ft3270 | |
28 | - | |
29 | -SOURCES=ftdialog.c ftprogress.c browse.c | |
30 | - | |
31 | -#---[ Paths ]------------------------------------------------------------------ | |
32 | - | |
33 | -prefix=@prefix@ | |
34 | -exec_prefix=@exec_prefix@ | |
35 | -bindir=@bindir@ | |
36 | -libdir=@libdir@ | |
37 | -datarootdir=@datarootdir@ | |
38 | -localedir=@localedir@ | |
39 | -desktopdir=$(datarootdir)/applications | |
40 | - | |
41 | -#---[ Tools ]----------------------------------------------------------------- | |
42 | - | |
43 | -MKDIR=@MKDIR_P@ | |
44 | -CC=@CC@ | |
45 | -LD=@CC@ | |
46 | -AR=@AR@ | |
47 | - | |
48 | -#---[ Environment ]------------------------------------------------------------ | |
49 | - | |
50 | -LIB3270_CFLAGS=-I../../include | |
51 | -LIB3270_LIBS=-L../../../.bin/Debug@DLLDIR@ -l3270 | |
52 | - | |
53 | -CFLAGS=@CFLAGS@ @DLL_CFLAGS@ @GTK_CFLAGS@ @GTKMAC_CFLAGS@ -DLIBDIR=\"$(libdir)\" -I../../include | |
54 | -LIBS=@LIBS@ @GTK_LIBS@ @GTKMAC_LIBS@ | |
55 | - | |
56 | -DEBUG_CFLAGS=-DDEBUG=1 -g -Wall | |
57 | -DEPENDS ?= *.h ../../include/*.h ../../include/lib3270/*.h Makefile | |
58 | - | |
59 | -#---[ Paths ]------------------------------------------------------------------ | |
60 | - | |
61 | -ROOTDIR ?= . | |
62 | -OBJDIR ?= $(ROOTDIR)/.obj | |
63 | -BINDIR ?= $(ROOTDIR)/.bin | |
64 | -TMPDIR ?= $(ROOTDIR)/.tmp | |
65 | - | |
66 | -BINDBG ?= $(BINDIR)/Debug | |
67 | -BINRLS ?= $(BINDIR)/Release | |
68 | -LIBDBG ?= $(BINDBG)@DLLDIR@ | |
69 | - | |
70 | -OBJDBG = $(OBJDIR)/Debug | |
71 | -OBJRLS = $(OBJDIR)/Release | |
72 | - | |
73 | -#---[ Rules ]------------------------------------------------------------------ | |
74 | - | |
75 | -$(OBJDBG)/%.o: %.c $(DEPENDS) | |
76 | - @echo " CC `basename $@`" | |
77 | - @$(MKDIR) `dirname $@` | |
78 | - @$(CC) $(DEBUG_CFLAGS) $(CFLAGS) $(LIB3270_CFLAGS) -o $@ -c $< | |
79 | - | |
80 | -$(OBJRLS)/%.o: %.c $(DEPENDS) | |
81 | - @echo " CC `basename $@`" | |
82 | - @$(MKDIR) `dirname $@` | |
83 | - @$(CC) $(CFLAGS) $(LIB3270_CFLAGS) -o $@ -c $< | |
84 | - | |
85 | -#---[ Targets ]---------------------------------------------------------------- | |
86 | - | |
87 | -Release: \ | |
88 | - $(BINRLS)/$(MODULE_NAME).a | |
89 | - | |
90 | -Debug: \ | |
91 | - $(BINDBG)/$(MODULE_NAME)@EXEEXT@ | |
92 | - | |
93 | -run: \ | |
94 | - $(BINDBG)/$(MODULE_NAME)@EXEEXT@ | |
95 | - @$(BINDBG)/$(MODULE_NAME)@EXEEXT@ | |
96 | - | |
97 | -$(BINDBG)/$(MODULE_NAME).a: \ | |
98 | - $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC).o) | |
99 | - | |
100 | - @$(MKDIR) `dirname $@` | |
101 | - @$(AR) rcs $@ $^ | |
102 | - | |
103 | -$(BINRLS)/$(MODULE_NAME).a: \ | |
104 | - $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) | |
105 | - | |
106 | - @$(MKDIR) `dirname $@` | |
107 | - @$(AR) rcs $@ $^ | |
108 | - | |
109 | -$(BINDBG)/$(MODULE_NAME)@EXEEXT@: \ | |
110 | - $(OBJDBG)/testprogram.o \ | |
111 | - $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC).o) | |
112 | - | |
113 | - @$(MKDIR) `dirname $@` | |
114 | - @$(LD) @LDARCH@ @DBGRPATH@ -o $@ $^ $(LIBS) | |
115 | - | |
116 | -cleanDebug: \ | |
117 | - clean | |
118 | - | |
119 | -clean: | |
120 | - @rm -fr .bin | |
121 | - @rm -fr .obj | |
122 | - | |
123 | - |
src/pw3270/ft/browse.c
... | ... | @@ -1,158 +0,0 @@ |
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 browse.c 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 | - #include "private.h" | |
31 | - | |
32 | -#ifdef WIN32 | |
33 | - #include <gdk/gdkwin32.h> | |
34 | -#endif // WIN32 | |
35 | - | |
36 | -/*---[ Implement ]----------------------------------------------------------------------------------*/ | |
37 | - | |
38 | -/* | |
39 | -#ifdef WIN32 | |
40 | - | |
41 | -struct file | |
42 | -{ | |
43 | - OPENFILENAME ofn; | |
44 | - char szName[260]; // buffer for file name | |
45 | - int mode; | |
46 | - BOOL ok; | |
47 | -}; | |
48 | - | |
49 | -static gpointer select_file(struct file *fl) | |
50 | -{ | |
51 | - if(fl->mode == 1) | |
52 | - { | |
53 | - fl->ok = GetSaveFileName(&fl->ofn); | |
54 | - } | |
55 | - else | |
56 | - { | |
57 | - fl->ok = GetOpenFileName(&fl->ofn); | |
58 | - } | |
59 | - | |
60 | - fl->mode = 3; | |
61 | - | |
62 | - return 0; | |
63 | -} | |
64 | - | |
65 | -void browse_file(GtkButton *button,v3270FTD *parent) | |
66 | -{ | |
67 | - GThread * thd; | |
68 | - struct file fl; | |
69 | - GdkWindow * win = gtk_widget_get_window(GTK_WIDGET(parent)); | |
70 | - | |
71 | - gtk_widget_set_sensitive(GTK_WIDGET(parent),FALSE); | |
72 | - | |
73 | - memset(&fl,0,sizeof(fl)); | |
74 | - fl.ofn.lStructSize = sizeof(fl.ofn); | |
75 | - fl.ofn.hwndOwner = GDK_WINDOW_HWND(win); | |
76 | - fl.ofn.lpstrFile = fl.szName; | |
77 | - | |
78 | - // Set lpstrFile[0] to '\0' so that GetOpenFileName does not | |
79 | - // use the contents of szFile to initialize itself. | |
80 | - fl.ofn.lpstrFile[0] = '\0'; | |
81 | - | |
82 | - fl.ofn.nMaxFile = sizeof(fl.szName); | |
83 | - fl.ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0"; | |
84 | - fl.ofn.nFilterIndex = 1; | |
85 | - fl.ofn.nMaxFileTitle = 0; | |
86 | - fl.ofn.lpstrInitialDir = NULL; | |
87 | - | |
88 | - // Guarda o valor atual | |
89 | - strncpy(fl.szName,gtk_entry_get_text(GTK_ENTRY(parent->filename[FILENAME_LOCAL])),fl.ofn.nMaxFile); | |
90 | - | |
91 | - fl.mode = (parent->options & LIB3270_FT_OPTION_RECEIVE) ? 1 : 0; | |
92 | - | |
93 | - if(fl.mode == 1) | |
94 | - { | |
95 | - // Receber arquivo | |
96 | - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms646839(v=vs.85).aspx | |
97 | - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms646829(v=vs.85).aspx#open_file | |
98 | - | |
99 | -// fl.ofn.lpstrFileTitle = _( "Select file to receive" ); | |
100 | - fl.ofn.Flags = OFN_OVERWRITEPROMPT; | |
101 | - | |
102 | - } | |
103 | - else | |
104 | - { | |
105 | - // Enviar arquivo | |
106 | - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms646928(v=vs.85).aspx | |
107 | -// fl.ofn.lpstrFileTitle = _( "Select file to send" ); | |
108 | - fl.ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; | |
109 | - | |
110 | - } | |
111 | - | |
112 | - thd = g_thread_new("GetFileName",(GThreadFunc) select_file, &fl); | |
113 | - | |
114 | - while(fl.mode != 3) { | |
115 | - g_main_context_iteration(NULL,TRUE); | |
116 | - } | |
117 | - | |
118 | - g_thread_unref(thd); | |
119 | - | |
120 | - if(fl.ok) | |
121 | - { | |
122 | - gtk_entry_set_text(GTK_ENTRY(parent->filename[FILENAME_LOCAL]),fl.szName); | |
123 | - } | |
124 | - | |
125 | - gtk_widget_set_sensitive(GTK_WIDGET(parent),TRUE); | |
126 | - | |
127 | -} | |
128 | -#else | |
129 | -void browse_file(GtkButton *button,v3270FTD *parent) | |
130 | -{ | |
131 | - gboolean recv = (parent->options & LIB3270_FT_OPTION_RECEIVE); | |
132 | - GtkWidget * dialog = gtk_file_chooser_dialog_new | |
133 | - ( | |
134 | - recv ? _( "Select file to receive" ) : _( "Select file to send" ), | |
135 | - GTK_WINDOW(parent), | |
136 | - GTK_FILE_CHOOSER_ACTION_OPEN, | |
137 | - _("_Cancel" ), GTK_RESPONSE_CANCEL, | |
138 | - recv ? _("_Save") : _("_Send"), GTK_RESPONSE_ACCEPT, | |
139 | - NULL | |
140 | - ); | |
141 | - | |
142 | - const gchar * current = gtk_entry_get_text(GTK_ENTRY(parent->filename[FILENAME_LOCAL])); | |
143 | - if(current && *current) | |
144 | - gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),current); | |
145 | - | |
146 | - if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) | |
147 | - { | |
148 | - gchar *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); | |
149 | - gtk_entry_set_text(GTK_ENTRY(parent->filename[FILENAME_LOCAL]),filename); | |
150 | - g_free(filename); | |
151 | - } | |
152 | - | |
153 | - gtk_widget_destroy(dialog); | |
154 | - | |
155 | - | |
156 | -} | |
157 | -#endif // WIN32 | |
158 | -*/ |
src/pw3270/ft/filetransfer.c
... | ... | @@ -1,321 +0,0 @@ |
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 filetransfer.c 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 | - * Agradecimento: | |
29 | - * | |
30 | - * Roberto Soares (a_r_soares@hotmail.com) | |
31 | - * | |
32 | - */ | |
33 | - | |
34 | -#include <stdlib.h> | |
35 | -#include "globals.h" | |
36 | -#include "ft/v3270ft.h" | |
37 | -#include <lib3270/filetransfer.h> | |
38 | - | |
39 | -/*--[ Constants ]------------------------------------------------------------------------------------*/ | |
40 | - | |
41 | - static const struct _ftoptions | |
42 | - { | |
43 | - LIB3270_FT_OPTION val; | |
44 | - const gchar * name; | |
45 | - } | |
46 | - ftoptions[] = | |
47 | - { { LIB3270_FT_OPTION_ASCII, "text" }, | |
48 | - { LIB3270_FT_OPTION_CRLF, "cr" }, | |
49 | - { LIB3270_FT_OPTION_APPEND, "append" }, | |
50 | - { LIB3270_FT_OPTION_REMAP, "remap" } | |
51 | - }; | |
52 | - | |
53 | - static const struct _recfm | |
54 | - { | |
55 | - LIB3270_FT_OPTION val; | |
56 | - const gchar * name; | |
57 | - } recfm[] = | |
58 | - { | |
59 | - { LIB3270_FT_RECORD_FORMAT_DEFAULT, "default" }, | |
60 | - { LIB3270_FT_RECORD_FORMAT_FIXED, "fixed" }, | |
61 | - { LIB3270_FT_RECORD_FORMAT_VARIABLE, "variable" }, | |
62 | - { LIB3270_FT_RECORD_FORMAT_UNDEFINED, "undefined" } | |
63 | - }; | |
64 | - | |
65 | - static const struct _ftunits | |
66 | - { | |
67 | - LIB3270_FT_OPTION val; | |
68 | - const gchar * name; | |
69 | - } units[] = | |
70 | - { | |
71 | - { LIB3270_FT_ALLOCATION_UNITS_DEFAULT, "default" }, | |
72 | - { LIB3270_FT_ALLOCATION_UNITS_TRACKS, "tracks" }, | |
73 | - { LIB3270_FT_ALLOCATION_UNITS_CYLINDERS, "cylinders" }, | |
74 | - { LIB3270_FT_ALLOCATION_UNITS_AVBLOCK, "avblock" } | |
75 | - }; | |
76 | - | |
77 | - | |
78 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
79 | - | |
80 | -/* | |
81 | -static LIB3270_FT_OPTION get_options_from_config(const gchar *group) | |
82 | -{ | |
83 | - int f; | |
84 | - LIB3270_FT_OPTION rc = 0; | |
85 | - gchar * ptr; | |
86 | - | |
87 | - // Get base FT options | |
88 | - for(f=0;f<G_N_ELEMENTS(ftoptions);f++) | |
89 | - { | |
90 | - if(get_boolean_from_config(group,ftoptions[f].name,FALSE)) | |
91 | - rc |= ftoptions[f].val; | |
92 | - } | |
93 | - | |
94 | - // Get Record format | |
95 | - ptr = get_string_from_config(group, "units", "default"); | |
96 | - for(f=0;f<G_N_ELEMENTS(units);f++) | |
97 | - { | |
98 | - if(!g_ascii_strcasecmp(ptr,units[f].name)) | |
99 | - rc |= units[f].val; | |
100 | - } | |
101 | - g_free(ptr); | |
102 | - | |
103 | - // Get allocation units | |
104 | - ptr = get_string_from_config(group, "recfm", "variable"); | |
105 | - for(f=0;f<G_N_ELEMENTS(recfm);f++) | |
106 | - { | |
107 | - if(!g_ascii_strcasecmp(ptr,recfm[f].name)) | |
108 | - rc |= recfm[f].val; | |
109 | - } | |
110 | - g_free(ptr); | |
111 | - | |
112 | - | |
113 | - return rc; | |
114 | -} | |
115 | - | |
116 | -static void ft_dialog_load(GtkWidget *widget, const gchar *name) | |
117 | -{ | |
118 | - gchar *ptr; | |
119 | - | |
120 | - ptr = get_string_from_config(name, "remote", ""); | |
121 | - v3270_ft_dialog_set_host_filename(widget,ptr); | |
122 | - g_free(ptr); | |
123 | - | |
124 | - ptr = get_string_from_config(name, "local", ""); | |
125 | - v3270_ft_dialog_set_local_filename(widget,ptr); | |
126 | - g_free(ptr); | |
127 | - | |
128 | - v3270_ft_dialog_set_dft_buffer_size(widget,get_integer_from_config(name,"dft",4096)); | |
129 | - v3270_ft_dialog_set_record_length(widget,get_integer_from_config(name,"reclen",0)); | |
130 | - v3270_ft_dialog_set_block_size(widget,get_integer_from_config(name,"blksize",0)); | |
131 | - v3270_ft_dialog_set_primary_space(widget,get_integer_from_config(name,"primspace",0)); | |
132 | - v3270_ft_dialog_set_secondary_space(widget,get_integer_from_config(name,"secspace",0)); | |
133 | - | |
134 | -} | |
135 | - | |
136 | -static void ft_dialog_save(GtkWidget *widget, const gchar *name) | |
137 | -{ | |
138 | - LIB3270_FT_OPTION opt = v3270_ft_dialog_get_options(widget); | |
139 | - const gchar * filename = v3270_ft_dialog_get_local_filename(widget); | |
140 | - int f; | |
141 | - | |
142 | - for(f=0;f<G_N_ELEMENTS(ftoptions);f++) | |
143 | - { | |
144 | - trace("%s=%s",ftoptions[f].name,((opt & ftoptions[f].val) != 0) ? "ON" : "OFF"); | |
145 | - set_boolean_to_config(name, ftoptions[f].name, ((opt & ftoptions[f].val) != 0)); | |
146 | - } | |
147 | - | |
148 | - for(f=0;f<G_N_ELEMENTS(recfm);f++) | |
149 | - { | |
150 | - if((opt & LIB3270_FT_RECORD_FORMAT_MASK) == recfm[f].val) | |
151 | - set_string_to_config(name,"recfm","%s",recfm[f].name); | |
152 | - } | |
153 | - | |
154 | - for(f=0;f<G_N_ELEMENTS(units);f++) | |
155 | - { | |
156 | - if( (opt & LIB3270_FT_ALLOCATION_UNITS_MASK) == units[f].val) | |
157 | - set_string_to_config(name,"units","%s",units[f].name); | |
158 | - } | |
159 | - | |
160 | - set_integer_to_config(name,"dft",v3270_ft_dialog_get_dft_buffer_size(widget)); | |
161 | - set_integer_to_config(name,"reclen",v3270_ft_dialog_get_record_length(widget)); | |
162 | - set_integer_to_config(name,"blksize",v3270_ft_dialog_get_block_size(widget)); | |
163 | - set_integer_to_config(name,"primspace",v3270_ft_dialog_get_primary_space(widget)); | |
164 | - set_integer_to_config(name,"secspace",v3270_ft_dialog_get_secondary_space(widget)); | |
165 | - | |
166 | - set_string_to_config(name,"local","%s",filename); | |
167 | - set_string_to_config(name,"remote","%s",v3270_ft_dialog_get_host_filename(widget)); | |
168 | - | |
169 | -#ifdef HAVE_WIN_REGISTRY | |
170 | - gchar *ext = strrchr(filename,'.'); | |
171 | - | |
172 | - if(ext) | |
173 | - { | |
174 | - // Save extension based file settings | |
175 | - HKEY hKey; | |
176 | - DWORD disp; | |
177 | - gchar * path = g_strdup_printf("%s\\%s\\%s\\%s","SOFTWARE",g_get_application_name(),name,ext+1); | |
178 | - | |
179 | - if(RegCreateKeyEx(HKEY_CURRENT_USER,path,0,NULL,REG_OPTION_NON_VOLATILE,KEY_SET_VALUE,NULL,&hKey,&disp) == ERROR_SUCCESS) | |
180 | - { | |
181 | - DWORD value; | |
182 | - | |
183 | - value = (DWORD) v3270_ft_dialog_get_options(widget); | |
184 | - RegSetValueEx(hKey, "options", 0, REG_DWORD,(const BYTE *) &value,sizeof(value)); | |
185 | - | |
186 | - value = (DWORD) v3270_ft_dialog_get_dft_buffer_size(widget); | |
187 | - RegSetValueEx(hKey, "dft", 0, REG_DWORD,(const BYTE *) &value,sizeof(value)); | |
188 | - | |
189 | - value = (DWORD) v3270_ft_dialog_get_record_length(widget); | |
190 | - RegSetValueEx(hKey, "reclen", 0, REG_DWORD,(const BYTE *) &value,sizeof(value)); | |
191 | - | |
192 | - value = (DWORD) v3270_ft_dialog_get_block_size(widget); | |
193 | - RegSetValueEx(hKey, "blksize", 0, REG_DWORD,(const BYTE *) &value,sizeof(value)); | |
194 | - | |
195 | - value = (DWORD) v3270_ft_dialog_get_primary_space(widget); | |
196 | - RegSetValueEx(hKey, "primspace", 0, REG_DWORD,(const BYTE *) &value,sizeof(value)); | |
197 | - | |
198 | - value = (DWORD) v3270_ft_dialog_get_secondary_space(widget); | |
199 | - RegSetValueEx(hKey, "secspace", 0, REG_DWORD,(const BYTE *) &value,sizeof(value)); | |
200 | - | |
201 | - RegCloseKey(hKey); | |
202 | - } | |
203 | - | |
204 | - g_free(path); | |
205 | - } | |
206 | - | |
207 | -#endif // HAVE_WIN_REGISTRY | |
208 | - | |
209 | -} | |
210 | - | |
211 | -static void ft_complete(H3270 *hSession, unsigned long length,double kbytes_sec, const char *msg, void *widget) | |
212 | -{ | |
213 | - v3270_ft_progress_complete(GTK_WIDGET(widget),length,kbytes_sec); | |
214 | - v3270_ft_progress_set_message(GTK_WIDGET(widget),gettext(msg)); | |
215 | -} | |
216 | - | |
217 | -static void ft_message(H3270 *hSession, const char *text, void *widget) | |
218 | -{ | |
219 | - v3270_ft_progress_set_message(GTK_WIDGET(widget),gettext(text)); | |
220 | -} | |
221 | - | |
222 | -static void ft_update(H3270 *hSession, unsigned long current, unsigned long length, double kbytes_sec, void *widget) | |
223 | -{ | |
224 | - v3270_ft_progress_update(GTK_WIDGET(widget), current, length, kbytes_sec); | |
225 | -} | |
226 | - | |
227 | -void download_action(GtkAction *action, GtkWidget *widget) | |
228 | -{ | |
229 | - const gchar *name = g_object_get_data(G_OBJECT(action),"configuration"); | |
230 | - | |
231 | - if(!name) | |
232 | - name = "download"; | |
233 | - | |
234 | - if(lib3270_get_ft_state(v3270_get_session(widget)) != LIB3270_FT_STATE_NONE) | |
235 | - { | |
236 | - lib3270_popup_dialog( v3270_get_session(widget), | |
237 | - LIB3270_NOTIFY_ERROR, | |
238 | - _( "Request failed" ), | |
239 | - _( "Can't start download." ), | |
240 | - "%s", | |
241 | - _( "File transfer is already active." )); | |
242 | - | |
243 | - return; | |
244 | - } | |
245 | - | |
246 | - GtkWidget *dialog = v3270_ft_dialog_new(widget,LIB3270_FT_OPTION_RECEIVE|get_options_from_config(name)); | |
247 | - | |
248 | - v3270_ft_dialog_set_tso(dialog,lib3270_is_tso(v3270_get_session(widget))); | |
249 | - | |
250 | - ft_dialog_load(dialog,name); | |
251 | - | |
252 | - if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) | |
253 | - { | |
254 | - ft_dialog_save(dialog,name); | |
255 | - gtk_widget_hide(dialog); | |
256 | - | |
257 | - v3270_transfer_file( | |
258 | - widget, | |
259 | - v3270_ft_dialog_get_options(dialog), | |
260 | - v3270_ft_dialog_get_local_filename(dialog), | |
261 | - v3270_ft_dialog_get_host_filename(dialog), | |
262 | - v3270_ft_dialog_get_record_length(dialog), | |
263 | - v3270_ft_dialog_get_block_size(dialog), | |
264 | - v3270_ft_dialog_get_primary_space(dialog), | |
265 | - v3270_ft_dialog_get_secondary_space(dialog), | |
266 | - v3270_ft_dialog_get_dft_buffer_size(dialog) | |
267 | - ); | |
268 | - | |
269 | - } | |
270 | - | |
271 | - gtk_widget_destroy(dialog); | |
272 | - | |
273 | -} | |
274 | - | |
275 | -void upload_action(GtkAction *action, GtkWidget *widget) | |
276 | -{ | |
277 | - const gchar *name = g_object_get_data(G_OBJECT(action),"configuration"); | |
278 | - | |
279 | - if(!name) | |
280 | - name = "upload"; | |
281 | - | |
282 | - if(lib3270_get_ft_state(v3270_get_session(widget)) != LIB3270_FT_STATE_NONE) | |
283 | - { | |
284 | - lib3270_popup_dialog( v3270_get_session(widget), | |
285 | - LIB3270_NOTIFY_ERROR, | |
286 | - _( "Request failed" ), | |
287 | - _( "Can't start upload." ), | |
288 | - "%s", | |
289 | - _( "File transfer is already active." )); | |
290 | - | |
291 | - return; | |
292 | - } | |
293 | - | |
294 | - GtkWidget *dialog = v3270_ft_dialog_new(widget,LIB3270_FT_OPTION_SEND|get_options_from_config(name)); | |
295 | - | |
296 | - v3270_ft_dialog_set_tso(dialog,lib3270_is_tso(v3270_get_session(widget))); | |
297 | - ft_dialog_load(dialog,name); | |
298 | - | |
299 | - if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) | |
300 | - { | |
301 | - ft_dialog_save(dialog,name); | |
302 | - gtk_widget_hide(dialog); | |
303 | - | |
304 | - v3270_transfer_file( | |
305 | - widget, | |
306 | - v3270_ft_dialog_get_options(dialog), | |
307 | - v3270_ft_dialog_get_local_filename(dialog), | |
308 | - v3270_ft_dialog_get_host_filename(dialog), | |
309 | - v3270_ft_dialog_get_record_length(dialog), | |
310 | - v3270_ft_dialog_get_block_size(dialog), | |
311 | - v3270_ft_dialog_get_primary_space(dialog), | |
312 | - v3270_ft_dialog_get_secondary_space(dialog), | |
313 | - v3270_ft_dialog_get_dft_buffer_size(dialog) | |
314 | - ); | |
315 | - } | |
316 | - | |
317 | - gtk_widget_destroy(dialog); | |
318 | - | |
319 | -} | |
320 | - | |
321 | -*/ |
src/pw3270/ft/ft.cbp
... | ... | @@ -1,63 +0,0 @@ |
1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | |
2 | -<CodeBlocks_project_file> | |
3 | - <FileVersion major="1" minor="6" /> | |
4 | - <Project> | |
5 | - <Option title="PW3270 FT Dialogs" /> | |
6 | - <Option makefile_is_custom="1" /> | |
7 | - <Option pch_mode="2" /> | |
8 | - <Option compiler="gcc" /> | |
9 | - <Build> | |
10 | - <Target title="Debug"> | |
11 | - <Option output=".bin/Debug/ft3270" prefix_auto="1" extension_auto="1" /> | |
12 | - <Option object_output=".obj/Debug/" /> | |
13 | - <Option type="1" /> | |
14 | - <Option compiler="gcc" /> | |
15 | - <Compiler> | |
16 | - <Add option="-g" /> | |
17 | - <Add option="-DDEBUG=1" /> | |
18 | - </Compiler> | |
19 | - </Target> | |
20 | - <Target title="Release"> | |
21 | - <Option output=".bin/Release/ft3270" prefix_auto="1" extension_auto="1" /> | |
22 | - <Option object_output=".obj/Release/" /> | |
23 | - <Option type="1" /> | |
24 | - <Option compiler="gcc" /> | |
25 | - <Compiler> | |
26 | - <Add option="-O2" /> | |
27 | - </Compiler> | |
28 | - <Linker> | |
29 | - <Add option="-s" /> | |
30 | - </Linker> | |
31 | - </Target> | |
32 | - </Build> | |
33 | - <Compiler> | |
34 | - <Add option="-Wall" /> | |
35 | - <Add option="`pkg-config --cflags gtk+-3.0`" /> | |
36 | - <Add directory="../../include" /> | |
37 | - </Compiler> | |
38 | - <Linker> | |
39 | - <Add option="`pkg-config --libs gtk+-3.0`" /> | |
40 | - </Linker> | |
41 | - <Unit filename="Makefile.in" /> | |
42 | - <Unit filename="browse.c"> | |
43 | - <Option compilerVar="CC" /> | |
44 | - </Unit> | |
45 | - <Unit filename="ftdialog.c"> | |
46 | - <Option compilerVar="CC" /> | |
47 | - </Unit> | |
48 | - <Unit filename="ftprogress.c"> | |
49 | - <Option compilerVar="CC" /> | |
50 | - </Unit> | |
51 | - <Unit filename="private.h" /> | |
52 | - <Unit filename="testprogram.c"> | |
53 | - <Option compilerVar="CC" /> | |
54 | - </Unit> | |
55 | - <Unit filename="v3270ft.h" /> | |
56 | - <Extensions> | |
57 | - <code_completion /> | |
58 | - <envvars /> | |
59 | - <debugger /> | |
60 | - <lib_finder disable_auto="1" /> | |
61 | - </Extensions> | |
62 | - </Project> | |
63 | -</CodeBlocks_project_file> |
src/pw3270/ft/ftdialog.c
... | ... | @@ -1,833 +0,0 @@ |
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 ftdialog.c 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 | - #include "private.h" | |
31 | - | |
32 | - G_DEFINE_TYPE(v3270FTD, v3270FTD, GTK_TYPE_DIALOG); | |
33 | - | |
34 | - struct ftoptions | |
35 | - { | |
36 | - LIB3270_FT_OPTION flag; | |
37 | - enum _button id; | |
38 | - const gchar * label; | |
39 | - const gchar * tooltip; | |
40 | - }; | |
41 | - | |
42 | - struct rdoptions | |
43 | - { | |
44 | - LIB3270_FT_OPTION flag; | |
45 | - const gchar * label; | |
46 | - const gchar * tooltip; | |
47 | - }; | |
48 | - | |
49 | - struct ftvalues | |
50 | - { | |
51 | - int id; | |
52 | - const gchar * label; | |
53 | - const gchar * tooltip; | |
54 | - }; | |
55 | - | |
56 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
57 | - | |
58 | -/* | |
59 | -static void v3270FTD_class_init(v3270FTDClass *klass) | |
60 | -{ | |
61 | -// GtkDialogClass * widget_class = GTK_DIALOG_CLASS(klass); | |
62 | - | |
63 | -#if GTK_CHECK_VERSION(3,0,0) | |
64 | -#else | |
65 | -#endif // GTK_CHECK_VERSION | |
66 | - | |
67 | -} | |
68 | - | |
69 | -static void v3270FTD_init(v3270FTD *widget) | |
70 | -{ | |
71 | -} | |
72 | - | |
73 | -static void toggle_option(GtkToggleButton *button, v3270FTD *dialog) | |
74 | -{ | |
75 | - const struct ftoptions *opt = (const struct ftoptions *) g_object_get_data(G_OBJECT(button),"cfg"); | |
76 | - | |
77 | - if(gtk_toggle_button_get_active(button)) | |
78 | - dialog->options |= opt->flag; | |
79 | - else | |
80 | - dialog->options &= ~opt->flag; | |
81 | - | |
82 | -// g_message("Option \"%s\" is %s flag=%08lx",opt->label,gtk_toggle_button_get_active(button) ? "ON" : "OFF", (unsigned long) opt->flag); | |
83 | - | |
84 | -} | |
85 | - | |
86 | -static GtkWidget * ftoption_new(v3270FTD *dialog, const struct ftoptions *opt) | |
87 | -{ | |
88 | - GtkContainer * frame = GTK_CONTAINER(gtk_frame_new(_("Transfer options"))); | |
89 | - int f; | |
90 | - | |
91 | -#if GTK_CHECK_VERSION(3,0,0) | |
92 | - | |
93 | - GtkGrid * grid = GTK_GRID(gtk_grid_new()); | |
94 | - | |
95 | - gtk_grid_set_row_homogeneous(grid,TRUE); | |
96 | - gtk_grid_set_column_homogeneous(grid,TRUE); | |
97 | - gtk_grid_set_column_spacing(grid,5); | |
98 | - gtk_grid_set_row_spacing(grid,5); | |
99 | - | |
100 | -#else | |
101 | - | |
102 | - GtkTable * grid = GTK_TABLE(gtk_table_new(2,3,FALSE)); | |
103 | - | |
104 | - gtk_table_set_row_spacings(grid,5); | |
105 | - gtk_table_set_col_spacings(grid,5); | |
106 | - | |
107 | -#endif // GTK_CHECK_VERSION | |
108 | - | |
109 | - | |
110 | - for(f=0;opt[f].label;f++) | |
111 | - { | |
112 | - GtkWidget * button = gtk_check_button_new_with_mnemonic(gettext(opt[f].label)); | |
113 | - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),(dialog->options & opt[f].flag) != 0); | |
114 | - gtk_widget_set_tooltip_text(GTK_WIDGET(button),gettext(opt[f].tooltip)); | |
115 | -#if GTK_CHECK_VERSION(3,0,0) | |
116 | - gtk_widget_set_hexpand(button,TRUE); | |
117 | - gtk_grid_attach(grid,button,f&1,f/2,1,1); | |
118 | -#else | |
119 | - gtk_table_attach_defaults(grid,button,f&1,(f&1)+1,f/2,(f/2)+1); | |
120 | -#endif // GTK_CHECK_VERSION | |
121 | - g_object_set_data(G_OBJECT(button),"cfg",(gpointer) &opt[f]); | |
122 | - g_signal_connect(G_OBJECT(button),"toggled",G_CALLBACK(toggle_option),dialog); | |
123 | - dialog->button[opt->id] = GTK_TOGGLE_BUTTON(button); | |
124 | - } | |
125 | - | |
126 | - gtk_container_add(frame,GTK_WIDGET(grid)); | |
127 | - | |
128 | - return GTK_WIDGET(frame); | |
129 | -} | |
130 | - | |
131 | -#if GTK_CHECK_VERSION(3,0,0) | |
132 | -static GtkWidget * ftvalue_new(v3270FTD *dialog, GtkGrid *grid, int r, const struct ftvalues *val) | |
133 | -#else | |
134 | -static GtkWidget * ftvalue_new(v3270FTD *dialog, GtkTable *grid, int r, const struct ftvalues *val) | |
135 | -#endif // GTK_CHECK_VERSION | |
136 | -{ | |
137 | - int f; | |
138 | - | |
139 | - for(f=0;val[f].label;f++) | |
140 | - { | |
141 | - int col = (f&1)*2; | |
142 | - int row = (f/2)+r; | |
143 | - int id = val[f].id; | |
144 | - GtkWidget * label = gtk_label_new_with_mnemonic(gettext(val[f].label)); | |
145 | - | |
146 | - dialog->value[id] = GTK_SPIN_BUTTON(gtk_spin_button_new_with_range(0,99999,1)); | |
147 | - | |
148 | - gtk_misc_set_alignment(GTK_MISC(label),0,0.5); | |
149 | - | |
150 | - gtk_label_set_mnemonic_widget(GTK_LABEL(label),GTK_WIDGET(dialog->value[id])); | |
151 | - | |
152 | - if(val[f].tooltip && *val[f].tooltip) | |
153 | - { | |
154 | - gtk_widget_set_tooltip_text(GTK_WIDGET(label),gettext(val[f].tooltip)); | |
155 | - gtk_widget_set_tooltip_text(GTK_WIDGET(dialog->value[id]),gettext(val[f].tooltip)); | |
156 | - } | |
157 | - | |
158 | - g_object_set_data(G_OBJECT(dialog->value[id]),"cfg",(gpointer) &val[f]); | |
159 | - | |
160 | -#if GTK_CHECK_VERSION(3,0,0) | |
161 | - gtk_widget_set_hexpand(GTK_WIDGET(label),TRUE); | |
162 | - gtk_grid_attach(grid,GTK_WIDGET(label),col,row,1,1); | |
163 | - gtk_grid_attach(grid,GTK_WIDGET(dialog->value[id]),col+1,row,1,1); | |
164 | -#else | |
165 | - gtk_table_attach(grid,GTK_WIDGET(label),col,col+1,row,row+1,GTK_EXPAND|GTK_FILL,GTK_FILL,0,0); | |
166 | - gtk_table_attach(grid,GTK_WIDGET(dialog->value[id]),col+1,col+2,row,row+1,GTK_EXPAND|GTK_FILL,GTK_FILL,0,0); | |
167 | -#endif // GTK_CHECK_VERSION | |
168 | - | |
169 | - | |
170 | - } | |
171 | - | |
172 | - return GTK_WIDGET(grid); | |
173 | - | |
174 | -} | |
175 | - | |
176 | -static GtkWidget * ftradio_new(v3270FTD *dialog, GtkToggleButton **button, LIB3270_FT_OPTION option, const gchar *title, const gchar *tooltip, const struct rdoptions *opt) | |
177 | -{ | |
178 | - GtkContainer * frame = GTK_CONTAINER(gtk_frame_new(title)); | |
179 | -#if GTK_CHECK_VERSION(3,0,0) | |
180 | - GtkBox * box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2)); | |
181 | -#else | |
182 | - GtkBox * box = GTK_BOX(gtk_hbox_new(FALSE,2)); | |
183 | -#endif // GTK_CHECK_VERSION | |
184 | - GSList * lst = NULL; | |
185 | - int f; | |
186 | - | |
187 | - for(f=0;opt[f].label;f++) | |
188 | - { | |
189 | - button[f] = GTK_TOGGLE_BUTTON(gtk_radio_button_new_with_label(lst,gettext(opt[f].label))); | |
190 | - gtk_toggle_button_set_active(button[f],(dialog->options & opt[f].flag) == opt[f].flag); | |
191 | - if(opt[f].tooltip) | |
192 | - gtk_widget_set_tooltip_text(GTK_WIDGET(button[f]),gettext(opt[f].tooltip)); | |
193 | - | |
194 | - g_object_set_data(G_OBJECT(button[f]),"cfg",(gpointer) &opt[f]); | |
195 | - g_signal_connect(G_OBJECT(button[f]),"toggled",G_CALLBACK(toggle_option),dialog); | |
196 | - | |
197 | - gtk_box_pack_start(box,GTK_WIDGET(button[f]),FALSE,TRUE,2); | |
198 | - lst = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button[f])); | |
199 | - } | |
200 | - | |
201 | - gtk_widget_set_tooltip_text(GTK_WIDGET(frame),tooltip); | |
202 | - gtk_container_add(frame,GTK_WIDGET(box)); | |
203 | - return GTK_WIDGET(frame); | |
204 | -} | |
205 | - | |
206 | -static void test_remote_file(GtkEditable *editable, v3270FTD *dialog) | |
207 | -{ | |
208 | -#if GTK_CHECK_VERSION(3,2,0) | |
209 | - if(!gtk_entry_get_text_length(GTK_ENTRY(dialog->filename[FILENAME_LOCAL]))) | |
210 | - { | |
211 | - gchar *basename = g_path_get_basename(gtk_entry_get_text(GTK_ENTRY(editable))); | |
212 | - gchar *filename = g_build_filename(g_get_user_special_dir(G_USER_DIRECTORY_DOCUMENTS),basename,NULL); | |
213 | - gtk_entry_set_placeholder_text(GTK_ENTRY(dialog->filename[FILENAME_LOCAL]),filename); | |
214 | - g_free(filename); | |
215 | - g_free(basename); | |
216 | - } | |
217 | -#endif // GTK(3,2) | |
218 | - | |
219 | - dialog->remote = gtk_entry_get_text_length(GTK_ENTRY(dialog->filename[FILENAME_HOST])) > 0; | |
220 | - gtk_widget_set_sensitive(dialog->ready,dialog->local && dialog->remote); | |
221 | - | |
222 | -} | |
223 | - | |
224 | -static void test_file_exists(GtkEditable *editable, v3270FTD *dialog) | |
225 | -{ | |
226 | - const gchar *filename = gtk_entry_get_text(GTK_ENTRY(dialog->filename[FILENAME_LOCAL])); | |
227 | - dialog->local = g_file_test(filename,G_FILE_TEST_EXISTS); | |
228 | - | |
229 | -#if GTK_CHECK_VERSION(3,2,0) | |
230 | - if(dialog->local && !gtk_entry_get_text_length(GTK_ENTRY(dialog->filename[FILENAME_HOST]))) | |
231 | - { | |
232 | - gchar *basename = g_path_get_basename(gtk_entry_get_text(GTK_ENTRY(editable))); | |
233 | - gtk_entry_set_placeholder_text(GTK_ENTRY(dialog->filename[FILENAME_HOST]),basename); | |
234 | - g_free(basename); | |
235 | - } | |
236 | -#endif // GTK(3,2) | |
237 | - | |
238 | - gtk_widget_set_sensitive(dialog->ready,dialog->local && dialog->remote); | |
239 | - | |
240 | -} | |
241 | - | |
242 | -static void test_path_exists(GtkEditable *editable, v3270FTD *dialog) | |
243 | -{ | |
244 | - const gchar *filename = gtk_entry_get_text(GTK_ENTRY(dialog->filename[FILENAME_LOCAL])); | |
245 | - | |
246 | - if(!*filename) | |
247 | - { | |
248 | - dialog->local = FALSE; | |
249 | - } | |
250 | - else | |
251 | - { | |
252 | - gchar *dirname = g_path_get_dirname(filename); | |
253 | - dialog->local = g_file_test(dirname,G_FILE_TEST_IS_DIR); | |
254 | - g_free(dirname); | |
255 | - | |
256 | - } | |
257 | - | |
258 | - gtk_widget_set_sensitive(dialog->ready,dialog->local && dialog->remote); | |
259 | -} | |
260 | - | |
261 | -GtkWidget * v3270_ft_dialog_new(GtkWidget *parent, LIB3270_FT_OPTION options) | |
262 | -{ | |
263 | - v3270FTD *dialog = g_object_new(GTK_TYPE_V3270FTD, NULL); | |
264 | - | |
265 | - if(parent) | |
266 | - gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(parent))); | |
267 | - | |
268 | - // Set defaults | |
269 | - dialog->options = options; | |
270 | - | |
271 | - // Filename entry | |
272 | - int f; | |
273 | - | |
274 | - GtkWidget * label[FILENAME_COUNT] = | |
275 | - { | |
276 | - gtk_label_new_with_mnemonic( _( "_Local file name:" ) ), | |
277 | - gtk_label_new_with_mnemonic( _( "_Host file name:" ) ) | |
278 | - }; | |
279 | - | |
280 | - for(f=0;f<FILENAME_COUNT;f++) | |
281 | - { | |
282 | - dialog->filename[f] = gtk_entry_new(); | |
283 | - gtk_label_set_mnemonic_widget(GTK_LABEL(label[f]),dialog->filename[f]); | |
284 | -#if GTK_CHECK_VERSION(3,0,0) | |
285 | - gtk_widget_set_hexpand(dialog->filename[f],TRUE); | |
286 | -#endif // GTK_CHECK_VERSION | |
287 | - } | |
288 | - | |
289 | -#if GTK_CHECK_VERSION(3,0,0) | |
290 | - | |
291 | - GtkGrid *grid = GTK_GRID(gtk_grid_new()); | |
292 | - | |
293 | - gtk_grid_set_row_homogeneous(grid,FALSE); | |
294 | - gtk_grid_set_column_homogeneous(grid,FALSE); | |
295 | - gtk_grid_set_column_spacing(grid,5); | |
296 | - gtk_grid_set_row_spacing(grid,5); | |
297 | - | |
298 | -#else | |
299 | - GtkTable *grid = gtk_table_new(2,3,FALSE); | |
300 | - | |
301 | - gtk_table_set_row_spacings(grid,5); | |
302 | - gtk_table_set_col_spacings(grid,5); | |
303 | - | |
304 | -#endif // GTK_CHECK_VERSION | |
305 | - | |
306 | - | |
307 | -#if GTK_CHECK_VERSION(3,10,0) | |
308 | - GtkButton * browse = GTK_BUTTON(gtk_button_new_from_icon_name("text-x-generic",GTK_ICON_SIZE_BUTTON)); | |
309 | -#else | |
310 | - GtkButton * browse = GTK_BUTTON(gtk_button_new_with_mnemonic(_( "_Browse" ))); | |
311 | -#endif // GTK_CHECK_VERSION | |
312 | - | |
313 | - gtk_button_set_focus_on_click(browse,FALSE); | |
314 | - gtk_widget_set_tooltip_text(GTK_WIDGET(browse),_("Select file")); | |
315 | - g_signal_connect(G_OBJECT(browse),"clicked",G_CALLBACK(browse_file),dialog); | |
316 | - | |
317 | - gtk_widget_set_tooltip_text(gtk_dialog_add_button(GTK_DIALOG(dialog),_( "_Cancel" ), GTK_RESPONSE_CANCEL), | |
318 | - (dialog->options & LIB3270_FT_OPTION_RECEIVE) != 0 ? _("Cancel download.") : _("Cancel upload.")); | |
319 | - | |
320 | - | |
321 | - dialog->ready = gtk_dialog_add_button(GTK_DIALOG(dialog), | |
322 | - (dialog->options & LIB3270_FT_OPTION_RECEIVE) != 0 ? _( "_Receive") : _( "_Send" ), | |
323 | - GTK_RESPONSE_ACCEPT); | |
324 | - gtk_widget_set_sensitive(dialog->ready,FALSE); | |
325 | - | |
326 | - gtk_widget_set_tooltip_text(GTK_WIDGET(dialog->ready), | |
327 | - (dialog->options & LIB3270_FT_OPTION_RECEIVE) != 0 ? _("Start download.") : _("Start upload.")); | |
328 | - | |
329 | - | |
330 | - g_signal_connect(G_OBJECT(dialog->filename[FILENAME_HOST]),"changed",G_CALLBACK(test_remote_file),dialog); | |
331 | - | |
332 | - if(options & LIB3270_FT_OPTION_RECEIVE) | |
333 | - { | |
334 | - // It's receiving file first host filename, then local filename | |
335 | - gtk_window_set_title(GTK_WINDOW(dialog),_( "Receive file from host" )); | |
336 | - | |
337 | - g_signal_connect(G_OBJECT(dialog->filename[FILENAME_LOCAL]),"changed",G_CALLBACK(test_path_exists),dialog); | |
338 | - | |
339 | - | |
340 | -#if GTK_CHECK_VERSION(3,0,0) | |
341 | - | |
342 | - gtk_grid_attach(grid,label[FILENAME_HOST],0,0,1,1); | |
343 | - gtk_grid_attach(grid,label[FILENAME_LOCAL],0,1,1,1); | |
344 | - | |
345 | - gtk_grid_attach(grid,dialog->filename[FILENAME_HOST],1,0,3,1); | |
346 | - gtk_grid_attach(grid,dialog->filename[FILENAME_LOCAL],1,1,3,1); | |
347 | - | |
348 | - gtk_grid_attach(grid,GTK_WIDGET(browse),5,1,1,1); | |
349 | - | |
350 | -#else | |
351 | - | |
352 | - gtk_table_attach(grid,label[FILENAME_HOST],0,1,0,1,GTK_EXPAND|GTK_FILL,GTK_FILL,0,0); | |
353 | - gtk_table_attach(grid,label[FILENAME_LOCAL],0,1,1,2,GTK_EXPAND|GTK_FILL,GTK_FILL,0,0); | |
354 | - | |
355 | - gtk_table_attach(grid,dialog->filename[FILENAME_HOST],1,2,0,1,GTK_EXPAND|GTK_FILL,GTK_FILL,0,0); | |
356 | - gtk_table_attach(grid,dialog->filename[FILENAME_LOCAL],1,2,1,2,GTK_EXPAND|GTK_FILL,GTK_FILL,0,0); | |
357 | - | |
358 | - gtk_table_attach(grid,GTK_WIDGET(browse),2,3,1,2,GTK_FILL,GTK_FILL,0,0); | |
359 | - | |
360 | -#endif | |
361 | - | |
362 | - gtk_widget_set_tooltip_text(dialog->filename[FILENAME_HOST],_("Name of the source file.")); | |
363 | - gtk_widget_set_tooltip_text(dialog->filename[FILENAME_LOCAL],_("Where to save the received file.")); | |
364 | - | |
365 | - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),GTK_WIDGET(grid),FALSE,TRUE,2); | |
366 | - | |
367 | - // Create options box | |
368 | - static const struct ftoptions opt[] = | |
369 | - { | |
370 | - { | |
371 | - LIB3270_FT_OPTION_ASCII, | |
372 | - BUTTON_ASCII, | |
373 | - N_( "_Text file." ), | |
374 | - N_( "Check this if the file consists of character data only.") | |
375 | - }, | |
376 | - { | |
377 | - LIB3270_FT_OPTION_CRLF, | |
378 | - BUTTON_CRLF, | |
379 | - N_( "Follow the convention for ASCII text files." ), | |
380 | -#ifdef _WIN32 | |
381 | - N_( "Following the convention for ASCII text files, <CR> <LF> pairs are used to terminate records in the PC file, and a CTRL-Z (x'1A') marks the end of file.") | |
382 | -#else | |
383 | - N_( "Following the convention for ASCII text files, <LF> is used to terminate records in the PC file.") | |
384 | -#endif // _WIN32 | |
385 | - }, | |
386 | - { | |
387 | - LIB3270_FT_OPTION_APPEND, | |
388 | - BUTTON_APPEND, | |
389 | - N_( "_Append to destination" ), | |
390 | - N_( "Appends the source file to the destination file.") | |
391 | - }, | |
392 | - { | |
393 | - LIB3270_FT_OPTION_REMAP, | |
394 | - BUTTON_REMAP, | |
395 | - N_("Re_map to ASCII Characters."), | |
396 | - N_("Remap the text to ensure maximum compatibility between the workstation's character set and encoding and the host's EBCDIC code page.") | |
397 | - }, | |
398 | - { | |
399 | - 0, | |
400 | - 0, | |
401 | - NULL, | |
402 | - NULL | |
403 | - } | |
404 | - }; | |
405 | - | |
406 | - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),ftoption_new(dialog,opt),FALSE,TRUE,2); | |
407 | - | |
408 | - // Create DFT | |
409 | -#if GTK_CHECK_VERSION(3,0,0) | |
410 | - GtkBox * box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2)); | |
411 | -#else | |
412 | - GtkBox * box = GTK_BOX(gtk_hbox_new(FALSE,2)); | |
413 | -#endif // GTK_CHECK_VERSION | |
414 | - | |
415 | - GtkWidget * label = gtk_label_new_with_mnemonic(_("DFT B_uffer size:")); | |
416 | - dialog->value[VALUE_DFT] = GTK_SPIN_BUTTON(gtk_spin_button_new_with_range(256,32768,1)); | |
417 | - gtk_misc_set_alignment(GTK_MISC(label),0,0.5); | |
418 | - | |
419 | - gtk_label_set_mnemonic_widget(GTK_LABEL(label),GTK_WIDGET(dialog->value[VALUE_DFT])); | |
420 | - | |
421 | - gtk_box_pack_start(box,label,FALSE,TRUE,2); | |
422 | - gtk_box_pack_start(box,GTK_WIDGET(dialog->value[VALUE_DFT]),FALSE,TRUE,2); | |
423 | - | |
424 | - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),GTK_WIDGET(box),FALSE,TRUE,2); | |
425 | - | |
426 | - } | |
427 | - else | |
428 | - { | |
429 | - // It's sending file first local filename, then hostfilename | |
430 | - gtk_window_set_title(GTK_WINDOW(dialog),_( "Send file to host" )); | |
431 | - g_signal_connect(G_OBJECT(dialog->filename[FILENAME_LOCAL]),"changed",G_CALLBACK(test_file_exists),dialog); | |
432 | - | |
433 | -#if GTK_CHECK_VERSION(3,0,0) | |
434 | - | |
435 | - gtk_grid_attach(grid,label[FILENAME_LOCAL],0,0,1,1); | |
436 | - gtk_grid_attach(grid,label[FILENAME_HOST],0,1,1,1); | |
437 | - | |
438 | - gtk_grid_attach(grid,dialog->filename[FILENAME_LOCAL],1,0,3,1); | |
439 | - gtk_grid_attach(grid,GTK_WIDGET(browse),5,0,1,1); | |
440 | - | |
441 | - gtk_grid_attach(grid,dialog->filename[FILENAME_HOST],1,1,3,1); | |
442 | - | |
443 | -#else | |
444 | - | |
445 | - gtk_table_attach(grid,label[FILENAME_LOCAL],0,1,0,1,GTK_FILL,GTK_FILL,0,0); | |
446 | - gtk_table_attach(grid,label[FILENAME_HOST],0,1,1,2,GTK_FILL,GTK_FILL,0,0); | |
447 | - | |
448 | - gtk_table_attach(grid,dialog->filename[FILENAME_LOCAL],1,2,0,1,GTK_EXPAND|GTK_FILL,GTK_FILL,0,0); | |
449 | - gtk_table_attach(grid,dialog->filename[FILENAME_HOST],1,2,1,2,GTK_EXPAND|GTK_FILL,GTK_FILL,0,0); | |
450 | - | |
451 | - gtk_table_attach(grid,GTK_WIDGET(browse),2,3,0,1,GTK_FILL,GTK_FILL,0,0); | |
452 | - | |
453 | -#endif // GTK_CHECK_VERSION | |
454 | - | |
455 | - | |
456 | - gtk_widget_set_tooltip_text(dialog->filename[FILENAME_HOST],_("Name of the target file.")); | |
457 | - gtk_widget_set_tooltip_text(dialog->filename[FILENAME_LOCAL],_("Path of the local file to send.")); | |
458 | - | |
459 | - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),GTK_WIDGET(grid),FALSE,TRUE,2); | |
460 | - | |
461 | - // Create options box | |
462 | - static const struct ftoptions opt[] = | |
463 | - { | |
464 | - { | |
465 | - LIB3270_FT_OPTION_ASCII, | |
466 | - BUTTON_ASCII, | |
467 | - N_( "_Text file." ), | |
468 | - N_( "Check this if the file consists of character data only.") | |
469 | - }, | |
470 | - { | |
471 | - LIB3270_FT_OPTION_CRLF, | |
472 | - BUTTON_CRLF, | |
473 | - N_( "Follow the convention for ASCII text files." ), | |
474 | -#ifdef _WIN32 | |
475 | - N_( "Following the convention for ASCII text files, <CR> <LF> pairs are used to terminate records in the PC file, and a CTRL-Z (x'1A') marks the end of file.") | |
476 | -#else | |
477 | - N_( "Following the convention for ASCII text files, <LF> is used to terminate records in the PC file.") | |
478 | -#endif // _WIN32 | |
479 | - }, | |
480 | - { | |
481 | - LIB3270_FT_OPTION_APPEND, | |
482 | - BUTTON_APPEND, | |
483 | - N_( "_Append to destination" ), | |
484 | - N_( "Appends the source file to the destination file.") | |
485 | - }, | |
486 | - { | |
487 | - LIB3270_FT_OPTION_REMAP, | |
488 | - BUTTON_REMAP, | |
489 | - N_("Re_map to EBCDIC Characters."), | |
490 | - N_("Remap the text to ensure maximum compatibility between the workstation's character set and encoding and the host's EBCDIC code page.") | |
491 | - }, | |
492 | - { | |
493 | - 0, | |
494 | - 0, | |
495 | - NULL, | |
496 | - NULL | |
497 | - } | |
498 | - }; | |
499 | - | |
500 | - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),ftoption_new(dialog,opt),FALSE,TRUE,2); | |
501 | - | |
502 | - | |
503 | - // Create format box | |
504 | - | |
505 | -#if GTK_CHECK_VERSION(3,0,0) | |
506 | - | |
507 | - GtkGrid * grid = GTK_GRID(gtk_grid_new()); | |
508 | - gtk_grid_set_column_spacing(grid,5); | |
509 | - gtk_grid_set_row_spacing(grid,5); | |
510 | - | |
511 | -#else | |
512 | - GtkTable *grid = GTK_TABLE(gtk_table_new(4,4,FALSE)); | |
513 | - | |
514 | - gtk_table_set_row_spacings(grid,5); | |
515 | - gtk_table_set_col_spacings(grid,5); | |
516 | - | |
517 | -#endif // GTK_CHECK_VERSION | |
518 | - | |
519 | - // Create record format box | |
520 | - static const struct rdoptions recfm[] = | |
521 | - { | |
522 | - { | |
523 | - LIB3270_FT_RECORD_FORMAT_DEFAULT, | |
524 | - N_("Default"), | |
525 | - N_("Use host default record format.") | |
526 | - }, | |
527 | - { | |
528 | - LIB3270_FT_RECORD_FORMAT_FIXED, | |
529 | - N_("Fixed"), | |
530 | - N_("Creates a file with fixed-length records.") | |
531 | - }, | |
532 | - { | |
533 | - LIB3270_FT_RECORD_FORMAT_VARIABLE, | |
534 | - N_("Variable"), | |
535 | - N_("Creates a file with variable-length records.") | |
536 | - }, | |
537 | - { | |
538 | - LIB3270_FT_RECORD_FORMAT_UNDEFINED, | |
539 | - N_("Undefined"), | |
540 | - N_("Creates a file with undefined-length records (TSO hosts only).") | |
541 | - }, | |
542 | - { | |
543 | - 0, | |
544 | - NULL, | |
545 | - NULL | |
546 | - } | |
547 | - }; | |
548 | - | |
549 | -#if GTK_CHECK_VERSION(3,0,0) | |
550 | - gtk_grid_attach( grid, | |
551 | - ftradio_new(dialog,dialog->recfm,dialog->options,_("Record format"),_("Specifies the record format of the data set."),recfm), | |
552 | - 0,0,2,1 | |
553 | - ); | |
554 | -#else | |
555 | - gtk_table_attach( grid, | |
556 | - ftradio_new(dialog,dialog->recfm,dialog->options,_("Record format"),_("Specifies the record format of the data set."),recfm), | |
557 | - 0,2,0,1,GTK_EXPAND|GTK_FILL,GTK_FILL,0,0 | |
558 | - ); | |
559 | -#endif // GTK_CHECK_VERSION | |
560 | - | |
561 | - | |
562 | - | |
563 | - // Create allocation unit box | |
564 | - static const struct rdoptions units[] = | |
565 | - { | |
566 | - { | |
567 | - LIB3270_FT_ALLOCATION_UNITS_DEFAULT, | |
568 | - N_("Default"), | |
569 | - NULL | |
570 | - }, | |
571 | - { | |
572 | - LIB3270_FT_ALLOCATION_UNITS_TRACKS, | |
573 | - N_("Tracks"), | |
574 | - NULL | |
575 | - }, | |
576 | - { | |
577 | - LIB3270_FT_ALLOCATION_UNITS_CYLINDERS, | |
578 | - N_("Cylinders"), | |
579 | - NULL | |
580 | - }, | |
581 | - { | |
582 | - LIB3270_FT_ALLOCATION_UNITS_AVBLOCK, | |
583 | - N_("Avblock"), | |
584 | - NULL | |
585 | - }, | |
586 | - { | |
587 | - 0, | |
588 | - NULL, | |
589 | - NULL | |
590 | - } | |
591 | - }; | |
592 | - | |
593 | - dialog->units = ftradio_new(dialog,dialog->btnUnits,dialog->options,_("Space allocation units"),_("Specifies the units for the TSO host primary and secondary space options."),units); | |
594 | - | |
595 | -#if GTK_CHECK_VERSION(3,0,0) | |
596 | - gtk_grid_attach( grid, | |
597 | - dialog->units, | |
598 | - 2,0,2,1 | |
599 | - ); | |
600 | -#else | |
601 | - gtk_table_attach( grid, | |
602 | - dialog->units, | |
603 | - 2,4,0,1,GTK_EXPAND|GTK_FILL,GTK_FILL,0,0 | |
604 | - ); | |
605 | -#endif // GTK_CHECK_VERSION | |
606 | - | |
607 | - // Create values box | |
608 | - static const struct ftvalues val[] = | |
609 | - { | |
610 | - { | |
611 | - VALUE_LRECL, | |
612 | - N_( "Record Length:" ), | |
613 | - N_( "Specifies the record length (or maximum record length) for files created on the host." ) | |
614 | - }, | |
615 | - | |
616 | - | |
617 | - { | |
618 | - VALUE_PRIMSPACE, | |
619 | - N_( "Primary space:" ), | |
620 | - N_( "Primary allocation for a file created on a TSO host.\nThe units are given by the space allocation units option." ) | |
621 | - }, | |
622 | - | |
623 | - { | |
624 | - VALUE_BLKSIZE, | |
625 | - N_( "Block size:" ), | |
626 | - N_( "Specifies the block size (n) for a new data set. For data sets containing fixed " \ | |
627 | - "length records, the block size must be a multiple of the record length. " \ | |
628 | - "For data sets containing variable length records, the block size must be " \ | |
629 | - "greater than or equal to the record length plus four bytes. The block size " \ | |
630 | - "must not exceed the track length of the device on which the data set resides." ) | |
631 | - }, | |
632 | - | |
633 | - { | |
634 | - VALUE_SECSPACE, | |
635 | - N_( "Secondary space:" ), | |
636 | - N_( "Secondary allocation for a file created on a TSO host.\nThe units are given by the space allocation units option." ) | |
637 | - }, | |
638 | - | |
639 | - { | |
640 | - VALUE_DFT, | |
641 | - N_( "DFT B_uffer size:" ), | |
642 | - "" | |
643 | - }, | |
644 | - | |
645 | - { | |
646 | - 0, | |
647 | - NULL, | |
648 | - NULL | |
649 | - } | |
650 | - }; | |
651 | - | |
652 | - ftvalue_new(dialog,grid,1,val); | |
653 | - | |
654 | - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),GTK_WIDGET(grid),FALSE,TRUE,2); | |
655 | - | |
656 | - gtk_spin_button_set_range(dialog->value[VALUE_DFT],256,32768); | |
657 | - } | |
658 | - | |
659 | - gtk_widget_set_tooltip_text(GTK_WIDGET(dialog->value[VALUE_DFT]),_( "Buffer size for DFT-mode transfers. Can range from 256 to 32768. Larger values give better performance, but some hosts may not be able to support them.")); | |
660 | - gtk_spin_button_set_value(dialog->value[VALUE_DFT],4096); | |
661 | - | |
662 | - // Setup limits | |
663 | - if(dialog->value[VALUE_LRECL]) | |
664 | - gtk_spin_button_set_range(dialog->value[VALUE_LRECL],0,32760); | |
665 | - | |
666 | - if(dialog->value[VALUE_BLKSIZE]) | |
667 | - gtk_spin_button_set_range(dialog->value[VALUE_BLKSIZE],0,32760); | |
668 | - | |
669 | - | |
670 | - gtk_widget_show_all(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); | |
671 | - | |
672 | - return GTK_WIDGET(dialog); | |
673 | -} | |
674 | - | |
675 | -void v3270_ft_dialog_set_host_filename(GtkWidget *widget, const gchar *name) | |
676 | -{ | |
677 | - g_return_if_fail(GTK_IS_V3270FTD(widget)); | |
678 | - gtk_entry_set_text(GTK_ENTRY(GTK_V3270FTD(widget)->filename[FILENAME_HOST]),name); | |
679 | -} | |
680 | - | |
681 | -void v3270_ft_dialog_set_local_filename(GtkWidget *widget, const gchar *name) | |
682 | -{ | |
683 | - g_return_if_fail(GTK_IS_V3270FTD(widget)); | |
684 | - gtk_entry_set_text(GTK_ENTRY(GTK_V3270FTD(widget)->filename[FILENAME_LOCAL]),name); | |
685 | -} | |
686 | - | |
687 | -const gchar * v3270_ft_dialog_get_host_filename(GtkWidget *widget) | |
688 | -{ | |
689 | - g_return_val_if_fail(GTK_IS_V3270FTD(widget),NULL); | |
690 | - return gtk_entry_get_text(GTK_ENTRY(GTK_V3270FTD(widget)->filename[FILENAME_HOST])); | |
691 | -} | |
692 | - | |
693 | -const gchar * v3270_ft_dialog_get_local_filename(GtkWidget *widget) | |
694 | -{ | |
695 | - g_return_val_if_fail(GTK_IS_V3270FTD(widget),NULL); | |
696 | - return gtk_entry_get_text(GTK_ENTRY(GTK_V3270FTD(widget)->filename[FILENAME_LOCAL])); | |
697 | -} | |
698 | - | |
699 | -LIB3270_FT_OPTION v3270_ft_dialog_get_options(GtkWidget *widget) | |
700 | -{ | |
701 | - LIB3270_FT_OPTION opt; | |
702 | - | |
703 | - g_return_val_if_fail(GTK_IS_V3270FTD(widget),0); | |
704 | - | |
705 | - opt = GTK_V3270FTD(widget)->options; | |
706 | - | |
707 | -#ifndef _WIN32 | |
708 | - if( (opt & (LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_CRLF)) == (LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_CRLF) ) | |
709 | - { | |
710 | - opt |= LIB3270_FT_OPTION_UNIX; | |
711 | - } | |
712 | -#endif // _WIN32 | |
713 | - | |
714 | - return opt; | |
715 | -} | |
716 | - | |
717 | -void v3270_ft_dialog_set_options(GtkWidget *widget,LIB3270_FT_OPTION options) | |
718 | -{ | |
719 | - g_return_if_fail(GTK_IS_V3270FTD(widget)); | |
720 | - int f; | |
721 | - | |
722 | - for(f=0;f<BUTTON_COUNT;f++) | |
723 | - { | |
724 | - GtkToggleButton *button = GTK_V3270FTD(widget)->button[f]; | |
725 | - if(button) | |
726 | - { | |
727 | - const struct ftoptions * opt = (const struct ftoptions *) g_object_get_data(G_OBJECT(button),"cfg"); | |
728 | - gtk_toggle_button_set_active(button,(options & opt->flag) != 0); | |
729 | - } | |
730 | - } | |
731 | - | |
732 | - #warning Implementar | |
733 | -} | |
734 | - | |
735 | -void v3270_ft_dialog_set_tso(GtkWidget *widget,gboolean flag) | |
736 | -{ | |
737 | - g_return_if_fail(GTK_IS_V3270FTD(widget)); | |
738 | - | |
739 | - v3270FTD *dialog = GTK_V3270FTD(widget); | |
740 | - | |
741 | - GtkWidget *tsoWidget[] = | |
742 | - { | |
743 | - GTK_WIDGET(dialog->value[VALUE_BLKSIZE]), | |
744 | - GTK_WIDGET(dialog->value[VALUE_PRIMSPACE]), | |
745 | - GTK_WIDGET(dialog->value[VALUE_SECSPACE]), | |
746 | - GTK_WIDGET(dialog->units), | |
747 | - GTK_WIDGET(dialog->recfm[3]), | |
748 | - }; | |
749 | - | |
750 | - int f; | |
751 | - | |
752 | - for(f=0;f<G_N_ELEMENTS(tsoWidget);f++) | |
753 | - { | |
754 | - if(tsoWidget[f]) | |
755 | - gtk_widget_set_sensitive(tsoWidget[f],flag); | |
756 | - } | |
757 | - | |
758 | -} | |
759 | - | |
760 | -LIB3270_EXPORT void v3270_ft_dialog_set_dft_buffer_size(GtkWidget *widget, gint value) | |
761 | -{ | |
762 | - g_return_if_fail(GTK_IS_V3270FTD(widget)); | |
763 | - gtk_spin_button_set_value(GTK_V3270FTD(widget)->value[VALUE_DFT],value); | |
764 | -} | |
765 | - | |
766 | -LIB3270_EXPORT void v3270_ft_dialog_set_record_length(GtkWidget *widget, gint value) | |
767 | -{ | |
768 | - g_return_if_fail(GTK_IS_V3270FTD(widget)); | |
769 | - if(GTK_V3270FTD(widget)->value[VALUE_LRECL]) | |
770 | - gtk_spin_button_set_value(GTK_V3270FTD(widget)->value[VALUE_LRECL],value); | |
771 | -} | |
772 | - | |
773 | -LIB3270_EXPORT void v3270_ft_dialog_set_block_size(GtkWidget *widget, gint value) | |
774 | -{ | |
775 | - g_return_if_fail(GTK_IS_V3270FTD(widget)); | |
776 | - if(GTK_V3270FTD(widget)->value[VALUE_BLKSIZE]) | |
777 | - gtk_spin_button_set_value(GTK_V3270FTD(widget)->value[VALUE_BLKSIZE],value); | |
778 | -} | |
779 | - | |
780 | -LIB3270_EXPORT void v3270_ft_dialog_set_primary_space(GtkWidget *widget, gint value) | |
781 | -{ | |
782 | - g_return_if_fail(GTK_IS_V3270FTD(widget)); | |
783 | - if(GTK_V3270FTD(widget)->value[VALUE_PRIMSPACE]) | |
784 | - gtk_spin_button_set_value(GTK_V3270FTD(widget)->value[VALUE_PRIMSPACE],value); | |
785 | -} | |
786 | - | |
787 | -LIB3270_EXPORT void v3270_ft_dialog_set_secondary_space(GtkWidget *widget, gint value) | |
788 | -{ | |
789 | - g_return_if_fail(GTK_IS_V3270FTD(widget)); | |
790 | - if(GTK_V3270FTD(widget)->value[VALUE_SECSPACE]) | |
791 | - gtk_spin_button_set_value(GTK_V3270FTD(widget)->value[VALUE_SECSPACE],value); | |
792 | -} | |
793 | - | |
794 | -LIB3270_EXPORT gint v3270_ft_dialog_get_dft_buffer_size(GtkWidget *widget) | |
795 | -{ | |
796 | - g_return_val_if_fail(GTK_IS_V3270FTD(widget),0); | |
797 | - return gtk_spin_button_get_value_as_int(GTK_V3270FTD(widget)->value[VALUE_DFT]); | |
798 | -} | |
799 | - | |
800 | -LIB3270_EXPORT gint v3270_ft_dialog_get_record_length(GtkWidget *widget) | |
801 | -{ | |
802 | - g_return_val_if_fail(GTK_IS_V3270FTD(widget),0); | |
803 | - if(GTK_V3270FTD(widget)->value[VALUE_LRECL]) | |
804 | - return gtk_spin_button_get_value_as_int(GTK_V3270FTD(widget)->value[VALUE_LRECL]); | |
805 | - return 0; | |
806 | -} | |
807 | - | |
808 | -LIB3270_EXPORT gint v3270_ft_dialog_get_block_size(GtkWidget *widget) | |
809 | -{ | |
810 | - g_return_val_if_fail(GTK_IS_V3270FTD(widget),0); | |
811 | - | |
812 | - if(GTK_V3270FTD(widget)->value[VALUE_BLKSIZE]) | |
813 | - return gtk_spin_button_get_value_as_int(GTK_V3270FTD(widget)->value[VALUE_BLKSIZE]); | |
814 | - return 0; | |
815 | -} | |
816 | - | |
817 | -LIB3270_EXPORT gint v3270_ft_dialog_get_primary_space(GtkWidget *widget) | |
818 | -{ | |
819 | - g_return_val_if_fail(GTK_IS_V3270FTD(widget),0); | |
820 | - | |
821 | - if(GTK_V3270FTD(widget)->value[VALUE_PRIMSPACE]) | |
822 | - return gtk_spin_button_get_value_as_int(GTK_V3270FTD(widget)->value[VALUE_PRIMSPACE]); | |
823 | - return 0; | |
824 | -} | |
825 | - | |
826 | -LIB3270_EXPORT gint v3270_ft_dialog_get_secondary_space(GtkWidget *widget) | |
827 | -{ | |
828 | - g_return_val_if_fail(GTK_IS_V3270FTD(widget),0); | |
829 | - if(GTK_V3270FTD(widget)->value[VALUE_SECSPACE]) | |
830 | - return gtk_spin_button_get_value_as_int(GTK_V3270FTD(widget)->value[VALUE_SECSPACE]); | |
831 | - return 0; | |
832 | -} | |
833 | -*/ |
src/pw3270/ft/ftprogress.c
... | ... | @@ -1,329 +0,0 @@ |
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 ftprogress.c 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 | - #include "v3270ft.h" | |
31 | - | |
32 | -/*--[ Widget definition ]----------------------------------------------------------------------------*/ | |
33 | - | |
34 | - enum _filename | |
35 | - { | |
36 | - TEXT_FROM, | |
37 | - TEXT_TO, | |
38 | - TEXT_STATUS, | |
39 | - | |
40 | - TEXT_COUNT | |
41 | - }; | |
42 | - | |
43 | - enum _value | |
44 | - { | |
45 | - VALUE_TOTAL, | |
46 | - VALUE_CURRENT, | |
47 | - VALUE_SPEED, | |
48 | - VALUE_ETA, | |
49 | - | |
50 | - VALUE_COUNT | |
51 | - }; | |
52 | - | |
53 | - struct _v3270FTProgress | |
54 | - { | |
55 | -#if GTK_CHECK_VERSION(3,0,0) | |
56 | - GtkBin parent; | |
57 | -#else | |
58 | - GtkVBox parent; | |
59 | -#endif // GTK_CHECK_VERSION | |
60 | - GtkLabel * text[TEXT_COUNT]; | |
61 | - GtkLabel * value[VALUE_COUNT]; | |
62 | - GtkProgressBar * progress; | |
63 | - }; | |
64 | - | |
65 | - struct _v3270FTProgressClass | |
66 | - { | |
67 | -#if GTK_CHECK_VERSION(3,0,0) | |
68 | - GtkBinClass parent_class; | |
69 | -#else | |
70 | - GtkVBoxClass parent_class; | |
71 | -#endif // GTK_CHECK_VERSION | |
72 | - }; | |
73 | - | |
74 | -#if GTK_CHECK_VERSION(3,0,0) | |
75 | - G_DEFINE_TYPE(v3270FTProgress, v3270FTProgress, GTK_TYPE_BIN); | |
76 | -#else | |
77 | - G_DEFINE_TYPE(v3270FTProgress, v3270FTProgress, GTK_TYPE_VBOX); | |
78 | -#endif // GTK_CHECK_VERSION | |
79 | - | |
80 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
81 | - | |
82 | -/* | |
83 | -static void v3270FTProgress_class_init(v3270FTProgressClass *klass) | |
84 | -{ | |
85 | -#if GTK_CHECK_VERSION(3,0,0) | |
86 | -#else | |
87 | -#endif // GTK_CHECK_VERSION | |
88 | -} | |
89 | - | |
90 | -static void v3270FTProgress_init(v3270FTProgress *widget) | |
91 | -{ | |
92 | - GtkWidget * frame; | |
93 | -#if GTK_CHECK_VERSION(3,0,0) | |
94 | - GtkGrid * grid; | |
95 | - GtkWidget * box = gtk_box_new(GTK_ORIENTATION_VERTICAL,3); | |
96 | -#else | |
97 | - GtkTable * grid; | |
98 | - GtkWidget * box = GTK_WIDGET(widget); | |
99 | -#endif // GTK_CHECK_VERSION | |
100 | - int f; | |
101 | - | |
102 | - gtk_container_set_border_width(GTK_CONTAINER(box),3); | |
103 | - | |
104 | - // Create From/to fields | |
105 | - static const gchar * label[TEXT_COUNT] = { N_("From"), N_("To"), N_("Status") }; | |
106 | - | |
107 | - frame = gtk_frame_new( _( "Informations" ) ); | |
108 | - | |
109 | -#if GTK_CHECK_VERSION(3,0,0) | |
110 | - | |
111 | - grid = GTK_GRID(gtk_grid_new()); | |
112 | - | |
113 | - gtk_grid_set_column_spacing(grid,5); | |
114 | - gtk_grid_set_row_spacing(grid,5); | |
115 | - gtk_widget_set_hexpand(GTK_WIDGET(grid),TRUE); | |
116 | - | |
117 | -#else | |
118 | - | |
119 | - grid = GTK_TABLE(gtk_table_new(2,2,FALSE)); | |
120 | - | |
121 | - gtk_table_set_row_spacings(grid,5); | |
122 | - gtk_table_set_col_spacings(grid,5); | |
123 | - | |
124 | -#endif // GTK_CHECK_VERSION | |
125 | - | |
126 | - gtk_container_set_border_width(GTK_CONTAINER(grid),3); | |
127 | - | |
128 | - for(f=0;f<TEXT_COUNT;f++) | |
129 | - { | |
130 | - GtkWidget * l = gtk_label_new(""); | |
131 | - gchar * ptr = g_strdup_printf("<b>%s:</b>",gettext(label[f])); | |
132 | - | |
133 | - gtk_label_set_markup(GTK_LABEL(l),ptr); | |
134 | - gtk_misc_set_alignment(GTK_MISC(l),0,0); | |
135 | - g_free(ptr); | |
136 | - | |
137 | - | |
138 | - widget->text[f] = GTK_LABEL(gtk_label_new("-")); | |
139 | - gtk_label_set_ellipsize(widget->text[f],PANGO_ELLIPSIZE_START); | |
140 | - gtk_label_set_width_chars(widget->text[f],50); | |
141 | - gtk_misc_set_alignment(GTK_MISC(widget->text[f]),0,0); | |
142 | - | |
143 | -#if GTK_CHECK_VERSION(3,0,0) | |
144 | - | |
145 | - gtk_widget_set_hexpand(GTK_WIDGET(widget->text[f]),TRUE); | |
146 | - gtk_grid_attach(grid,l,0,f,1,1); | |
147 | - gtk_grid_attach(grid,GTK_WIDGET(widget->text[f]),1,f,1,1); | |
148 | - | |
149 | -#else | |
150 | - | |
151 | - gtk_table_attach(grid,l,0,1,f,f+1,GTK_FILL,GTK_FILL,0,0); | |
152 | - gtk_table_attach(grid,GTK_WIDGET(widget->text[f]),1,2,f,f+1,GTK_EXPAND|GTK_FILL,GTK_FILL,0,0); | |
153 | - | |
154 | -#endif // GTK_CHECK_VERSION | |
155 | - | |
156 | - | |
157 | - } | |
158 | - gtk_container_add(GTK_CONTAINER(frame),GTK_WIDGET(grid)); | |
159 | - gtk_container_add(GTK_CONTAINER(box),GTK_WIDGET(frame)); | |
160 | - | |
161 | - // Progress info | |
162 | - static const gchar *progressLabel[VALUE_COUNT] = { N_( "Total" ), N_( "Current" ), N_( "Speed" ), N_( "ETA" ) }; | |
163 | - | |
164 | - frame = gtk_frame_new( _( "Progress" ) ); | |
165 | - | |
166 | -#if GTK_CHECK_VERSION(3,0,0) | |
167 | - | |
168 | - grid = GTK_GRID(gtk_grid_new()); | |
169 | - | |
170 | - gtk_grid_set_column_spacing(grid,5); | |
171 | - gtk_grid_set_row_spacing(grid,5); | |
172 | - gtk_widget_set_hexpand(GTK_WIDGET(grid),TRUE); | |
173 | - gtk_grid_set_column_homogeneous(grid,TRUE); | |
174 | - | |
175 | -#else | |
176 | - | |
177 | - grid = GTK_TABLE(gtk_table_new(3,4,FALSE)); | |
178 | - | |
179 | - gtk_table_set_row_spacings(grid,5); | |
180 | - gtk_table_set_col_spacings(grid,5); | |
181 | - | |
182 | -#endif // GTK_CHECK_VERSION | |
183 | - | |
184 | - gtk_container_set_border_width(GTK_CONTAINER(grid),3); | |
185 | - | |
186 | - for(f=0;f<VALUE_COUNT;f++) | |
187 | - { | |
188 | - GtkWidget * l = gtk_label_new(_("N/A")); | |
189 | - int r = f/2; | |
190 | - int c = (f&1)*2; | |
191 | - gchar * ptr = g_strdup_printf("<b>%s:</b>",gettext(progressLabel[f])); | |
192 | - | |
193 | - gtk_label_set_markup(GTK_LABEL(l),ptr); | |
194 | - gtk_misc_set_alignment(GTK_MISC(l),0,0); | |
195 | - g_free(ptr); | |
196 | - | |
197 | - widget->value[f] = GTK_LABEL(gtk_label_new(_("N/A"))); | |
198 | - gtk_misc_set_alignment(GTK_MISC(widget->value[f]),1,0); | |
199 | - | |
200 | -#if GTK_CHECK_VERSION(3,0,0) | |
201 | - | |
202 | - gtk_widget_set_hexpand(GTK_WIDGET(widget->value[f]),TRUE); | |
203 | - gtk_grid_attach(grid,l,c,r,1,1); | |
204 | - gtk_grid_attach(grid,GTK_WIDGET(widget->value[f]),c+1,r,1,1); | |
205 | - | |
206 | -#else | |
207 | - | |
208 | - gtk_table_attach(grid,l,c,c+1,r,r+1,GTK_FILL,GTK_FILL,0,0); | |
209 | - gtk_table_attach(grid,GTK_WIDGET(widget->value[f]),c+1,c+2,r,r+1,GTK_EXPAND|GTK_FILL,GTK_FILL,0,0); | |
210 | - | |
211 | -#endif // GTK_CHECK_VERSION | |
212 | - | |
213 | - } | |
214 | - | |
215 | - widget->progress = GTK_PROGRESS_BAR(gtk_progress_bar_new()); | |
216 | - | |
217 | -#if GTK_CHECK_VERSION(3,0,0) | |
218 | - gtk_widget_set_hexpand(GTK_WIDGET(widget->progress),TRUE); | |
219 | - gtk_grid_attach(grid,GTK_WIDGET(widget->progress),0,2,4,1); | |
220 | -#else | |
221 | - gtk_table_attach(grid,GTK_WIDGET(widget->progress),0,4,2,3,GTK_EXPAND|GTK_FILL,GTK_FILL,0,0); | |
222 | -#endif // GTK_CHECK_VERSION | |
223 | - | |
224 | - gtk_container_add(GTK_CONTAINER(frame),GTK_WIDGET(grid)); | |
225 | - gtk_container_add(GTK_CONTAINER(box),GTK_WIDGET(frame)); | |
226 | - | |
227 | - // Add box on parent widget | |
228 | -#if GTK_CHECK_VERSION(3,0,0) | |
229 | - gtk_container_add(GTK_CONTAINER(widget),box); | |
230 | -#endif // GTK_CHECK_VERSION | |
231 | - | |
232 | -} | |
233 | - | |
234 | -GtkWidget * v3270_ft_progress_new(void) | |
235 | -{ | |
236 | - return g_object_new(GTK_TYPE_V3270FTProgress, NULL); | |
237 | -} | |
238 | - | |
239 | -void v3270_ft_progress_update(GtkWidget *widget, unsigned long current, unsigned long total, double kbytes_sec) | |
240 | -{ | |
241 | - g_return_if_fail(GTK_IS_V3270FTProgress(widget)); | |
242 | - | |
243 | - v3270FTProgress *obj = GTK_V3270FTProcess(widget); | |
244 | - | |
245 | - if(current) | |
246 | - { | |
247 | - gchar *str = g_strdup_printf("%ld",current); | |
248 | - gtk_label_set_text(obj->value[VALUE_CURRENT],str); | |
249 | - g_free(str); | |
250 | - } | |
251 | - | |
252 | - if(total) | |
253 | - { | |
254 | - gchar *str = g_strdup_printf("%ld",total); | |
255 | - gtk_label_set_text(obj->value[VALUE_TOTAL],str); | |
256 | - g_free(str); | |
257 | - } | |
258 | - | |
259 | - if(kbytes_sec) | |
260 | - { | |
261 | - gchar *str = g_strdup_printf("%ld KB/s",(unsigned long) kbytes_sec); | |
262 | - gtk_label_set_text(obj->value[VALUE_SPEED],str); | |
263 | - g_free(str); | |
264 | - } | |
265 | - | |
266 | - if(total && current) | |
267 | - { | |
268 | - double remaining = ((double) (total - current))/1024.0; | |
269 | - | |
270 | - if(remaining > 0 && kbytes_sec > 0) | |
271 | - { | |
272 | - char buffer[40]; | |
273 | - double seconds = ((double) remaining) / kbytes_sec; | |
274 | - time_t eta = time(0) + ((time_t) seconds); | |
275 | - strftime(buffer, 39, "%H:%M:%S", localtime(&eta)); | |
276 | - gtk_label_set_text(obj->value[VALUE_ETA],buffer); | |
277 | - } | |
278 | - else | |
279 | - { | |
280 | - gtk_label_set_text(obj->value[VALUE_ETA],""); | |
281 | - } | |
282 | - | |
283 | - gtk_progress_bar_set_fraction(obj->progress,((gdouble) current) / ((gdouble) total)); | |
284 | - } | |
285 | - else | |
286 | - { | |
287 | - gtk_progress_bar_pulse(obj->progress); | |
288 | - gtk_label_set_text(obj->value[VALUE_ETA],""); | |
289 | - } | |
290 | - | |
291 | -} | |
292 | - | |
293 | -void v3270_ft_progress_complete(GtkWidget *widget,unsigned long length, double kbytes_sec) | |
294 | -{ | |
295 | - g_return_if_fail(GTK_IS_V3270FTProgress(widget)); | |
296 | - | |
297 | - v3270FTProgress *obj = GTK_V3270FTProcess(widget); | |
298 | - | |
299 | - if(length) | |
300 | - { | |
301 | - gchar *str = g_strdup_printf("%ld",length); | |
302 | - gtk_label_set_text(obj->value[VALUE_CURRENT],str); | |
303 | - g_free(str); | |
304 | - } | |
305 | - | |
306 | - if(kbytes_sec) | |
307 | - { | |
308 | - gchar *str = g_strdup_printf("%ld KB/s",(unsigned long) kbytes_sec); | |
309 | - gtk_label_set_text(obj->value[VALUE_SPEED],str); | |
310 | - g_free(str); | |
311 | - } | |
312 | - | |
313 | - gtk_label_set_text(obj->value[VALUE_ETA],""); | |
314 | - | |
315 | -} | |
316 | - | |
317 | -void v3270_ft_progress_set_message(GtkWidget *widget, const gchar *msg) | |
318 | -{ | |
319 | - g_return_if_fail(GTK_IS_V3270FTProgress(widget)); | |
320 | - gtk_label_set_text(GTK_V3270FTProcess(widget)->text[TEXT_STATUS],msg); | |
321 | -} | |
322 | - | |
323 | -void v3270_ft_progress_set_filenames(GtkWidget *widget, const gchar *from, const gchar *to) | |
324 | -{ | |
325 | - g_return_if_fail(GTK_IS_V3270FTProgress(widget)); | |
326 | - gtk_label_set_text(GTK_V3270FTProcess(widget)->text[TEXT_FROM],from); | |
327 | - gtk_label_set_text(GTK_V3270FTProcess(widget)->text[TEXT_TO],to); | |
328 | -} | |
329 | -*/ |
src/pw3270/ft/private.h
... | ... | @@ -1,92 +0,0 @@ |
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 | - #define PRIVATE_H_INCLUDED | |
33 | - | |
34 | - #include "v3270ft.h" | |
35 | - | |
36 | -/*--[ Widget definition ]----------------------------------------------------------------------------*/ | |
37 | - | |
38 | - enum _filename | |
39 | - { | |
40 | - FILENAME_LOCAL, | |
41 | - FILENAME_HOST, | |
42 | - | |
43 | - FILENAME_COUNT | |
44 | - }; | |
45 | - | |
46 | - enum _value | |
47 | - { | |
48 | - VALUE_LRECL, | |
49 | - VALUE_BLKSIZE, | |
50 | - VALUE_PRIMSPACE, | |
51 | - VALUE_SECSPACE, | |
52 | - VALUE_DFT, | |
53 | - | |
54 | - VALUE_COUNT | |
55 | - }; | |
56 | - | |
57 | - enum _button | |
58 | - { | |
59 | - BUTTON_ASCII, | |
60 | - BUTTON_CRLF, | |
61 | - BUTTON_APPEND, | |
62 | - BUTTON_REMAP, | |
63 | - | |
64 | - BUTTON_COUNT | |
65 | - }; | |
66 | - | |
67 | - struct _v3270FTD | |
68 | - { | |
69 | - GtkDialog parent; | |
70 | - GtkWidget * filename[FILENAME_COUNT]; /**< Filenames for the transfer */ | |
71 | - GtkWidget * units; /**< Units frame box */ | |
72 | - GtkWidget * ready; /**< Send/Save button */ | |
73 | - GtkToggleButton * button[BUTTON_COUNT]; /**< Buttons */ | |
74 | - GtkToggleButton * recfm[4]; /**< Record format buttons */ | |
75 | - GtkToggleButton * btnUnits[4]; /**< Unit buttons */ | |
76 | - GtkSpinButton * value[VALUE_COUNT]; | |
77 | - gboolean local; /**< TRUE if local filename is ok */ | |
78 | - gboolean remote; /**< TRUE if remote filename is ok */ | |
79 | - LIB3270_FT_OPTION options; | |
80 | - }; | |
81 | - | |
82 | - struct _v3270FTDClass | |
83 | - { | |
84 | - GtkDialogClass parent_class; | |
85 | - | |
86 | - int dummy; | |
87 | - }; | |
88 | - | |
89 | -// G_GNUC_INTERNAL void browse_file(GtkButton *button,v3270FTD *parent); | |
90 | - | |
91 | - | |
92 | -#endif // PRIVATE_H_INCLUDED |
src/pw3270/ft/testprogram.c
... | ... | @@ -1,64 +0,0 @@ |
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 testprogram.c 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 | - #include <gtk/gtk.h> | |
31 | - #include "v3270ft.h" | |
32 | - | |
33 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
34 | - | |
35 | -int main (int argc, char *argv[]) | |
36 | -{ | |
37 | - gtk_init (&argc, &argv); | |
38 | - | |
39 | - { | |
40 | - GtkWidget *win = v3270_ft_dialog_new(NULL,LIB3270_FT_OPTION_RECEIVE); | |
41 | - v3270_ft_dialog_set_options(win,LIB3270_FT_OPTION_REMAP); | |
42 | - gtk_dialog_run(GTK_DIALOG(win)); | |
43 | - } | |
44 | - | |
45 | - /* | |
46 | - { | |
47 | - GtkWidget *win = v3270_ft_dialog_new(NULL,LIB3270_FT_OPTION_SEND|LIB3270_FT_RECORD_FORMAT_VARIABLE); | |
48 | - v3270_ft_dialog_set_tso(win,FALSE); | |
49 | - gtk_dialog_run(GTK_DIALOG(win)); | |
50 | - } | |
51 | - */ | |
52 | - | |
53 | - /* | |
54 | - { | |
55 | - GtkWidget *win = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
56 | - gtk_container_add(GTK_CONTAINER(win),v3270_ft_progress_new()); | |
57 | - gtk_widget_show_all(win); | |
58 | - gtk_main (); | |
59 | - } | |
60 | - */ | |
61 | - | |
62 | - return 0; | |
63 | - | |
64 | -} |
src/pw3270/ft/v3270ft.h
... | ... | @@ -1,108 +0,0 @@ |
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 v3270ft.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 | - * licinio@bb.com.br (Licínio Luis Branco) | |
28 | - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | - * | |
30 | - */ | |
31 | - | |
32 | -#ifndef V3270FT_H_INCLUDED | |
33 | - | |
34 | - #define ENABLE_NLS | |
35 | - | |
36 | - #ifndef GETTEXT_PACKAGE | |
37 | - #define GETTEXT_PACKAGE PACKAGE_NAME | |
38 | - #endif | |
39 | - | |
40 | - #include <libintl.h> | |
41 | - #include <glib/gi18n.h> | |
42 | - #include <gtk/gtk.h> | |
43 | - #include <lib3270.h> | |
44 | - #include <lib3270/filetransfer.h> | |
45 | - | |
46 | - #define V3270FT_H_INCLUDED 1 | |
47 | - | |
48 | - G_BEGIN_DECLS | |
49 | - | |
50 | -/*--[ Select file dialog ]---------------------------------------------------------------------------*/ | |
51 | - #define GTK_TYPE_V3270FTD (v3270FTD_get_type ()) | |
52 | - #define GTK_V3270FTD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_V3270FTD, v3270FTD)) | |
53 | - #define GTK_V3270FTD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_V3270FTD, v3270FTDClass)) | |
54 | - #define GTK_IS_V3270FTD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_V3270FTD)) | |
55 | - #define GTK_IS_V3270FTD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_V3270FTD)) | |
56 | - #define GTK_V3270FTD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_V3270FTD, v3270FTDClass)) | |
57 | - | |
58 | - typedef struct _v3270FTD v3270FTD; | |
59 | - typedef struct _v3270FTDClass v3270FTDClass; | |
60 | - | |
61 | -/*--[ Progress widget ]------------------------------------------------------------------------------*/ | |
62 | - | |
63 | - #define GTK_TYPE_V3270FTProgress (v3270FTProgress_get_type ()) | |
64 | - #define GTK_V3270FTProcess(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_V3270FTProgress, v3270FTProgress)) | |
65 | - #define GTK_V3270FTProgress_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_V3270FTProgress, v3270FTProgressClass)) | |
66 | - #define GTK_IS_V3270FTProgress(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_V3270FTProgress)) | |
67 | - #define GTK_IS_V3270FTProgress_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_V3270FTProgress)) | |
68 | - #define GTK_V3270FTProgress_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_V3270FTProgress, v3270FTProgressClass)) | |
69 | - | |
70 | - typedef struct _v3270FTProgress v3270FTProgress; | |
71 | - typedef struct _v3270FTProgressClass v3270FTProgressClass; | |
72 | - | |
73 | -/*--[ Prototipes ]-----------------------------------------------------------------------------------*/ | |
74 | - LIB3270_EXPORT GtkWidget * v3270_ft_dialog_new(GtkWidget *parent, LIB3270_FT_OPTION options); | |
75 | - LIB3270_EXPORT void v3270_ft_dialog_set_host_filename(GtkWidget *widget, const gchar *name); | |
76 | - LIB3270_EXPORT void v3270_ft_dialog_set_local_filename(GtkWidget *widget, const gchar *name); | |
77 | - LIB3270_EXPORT const gchar * v3270_ft_dialog_get_host_filename(GtkWidget *widget); | |
78 | - LIB3270_EXPORT const gchar * v3270_ft_dialog_get_local_filename(GtkWidget *widget); | |
79 | - LIB3270_EXPORT void v3270_ft_dialog_set_options(GtkWidget *widget,LIB3270_FT_OPTION options); | |
80 | - LIB3270_EXPORT LIB3270_FT_OPTION v3270_ft_dialog_get_options(GtkWidget *widget); | |
81 | - LIB3270_EXPORT void v3270_ft_dialog_set_tso(GtkWidget *widget,gboolean flag); | |
82 | - LIB3270_EXPORT void v3270_ft_dialog_set_dft_buffer_size(GtkWidget *widget, gint value); | |
83 | - LIB3270_EXPORT void v3270_ft_dialog_set_record_length(GtkWidget *widget, gint value); | |
84 | - LIB3270_EXPORT void v3270_ft_dialog_set_block_size(GtkWidget *widget, gint value); | |
85 | - LIB3270_EXPORT void v3270_ft_dialog_set_primary_space(GtkWidget *widget, gint value); | |
86 | - LIB3270_EXPORT void v3270_ft_dialog_set_secondary_space(GtkWidget *widget, gint value); | |
87 | - | |
88 | - LIB3270_EXPORT gint v3270_ft_dialog_get_dft_buffer_size(GtkWidget *widget); | |
89 | - LIB3270_EXPORT gint v3270_ft_dialog_get_record_length(GtkWidget *widget); | |
90 | - LIB3270_EXPORT gint v3270_ft_dialog_get_block_size(GtkWidget *widget); | |
91 | - LIB3270_EXPORT gint v3270_ft_dialog_get_primary_space(GtkWidget *widget); | |
92 | - LIB3270_EXPORT gint v3270_ft_dialog_get_secondary_space(GtkWidget *widget); | |
93 | - | |
94 | - /* | |
95 | - LIB3270_EXPORT GtkWidget * v3270_ft_progress_new(void); | |
96 | - LIB3270_EXPORT void v3270_ft_progress_update(GtkWidget *widget, unsigned long current, unsigned long total, double kbytes_sec); | |
97 | - LIB3270_EXPORT void v3270_ft_progress_set_message(GtkWidget *widget, const gchar *msg); | |
98 | - LIB3270_EXPORT void v3270_ft_progress_set_filenames(GtkWidget *widget, const gchar *from, const gchar *to); | |
99 | - LIB3270_EXPORT void v3270_ft_progress_complete(GtkWidget *widget,unsigned long length,double kbytes_sec); | |
100 | - */ | |
101 | - | |
102 | - // File transfer | |
103 | - // LIB3270_EXPORT gint pw3270_transfer_file(GtkWidget *widget, LIB3270_FT_OPTION options, const gchar *local, const gchar *remote, int lrecl, int blksize, int primspace, int secspace, int dft); | |
104 | - | |
105 | - | |
106 | - G_END_DECLS | |
107 | - | |
108 | -#endif // V3270_H_INCLUDED |