Commit bd299580117735f7870de2d2b75d6d42d28655ed

Authored by Perry Werneck
1 parent b5457bf4

Corrigindo exportação/importação da lista de arquivos a transferir.

src/pw3270/v3270ft/ftdialog.cbp
@@ -33,7 +33,8 @@ @@ -33,7 +33,8 @@
33 <Compiler> 33 <Compiler>
34 <Add option="-Wall" /> 34 <Add option="-Wall" />
35 <Add option="`pkg-config --cflags gtk+-3.0 lib3270`" /> 35 <Add option="`pkg-config --cflags gtk+-3.0 lib3270`" />
36 - <Add directory="../include" /> 36 + <Add directory="../../include" />
  37 + <Add directory="../../include/pw3270" />
37 </Compiler> 38 </Compiler>
38 <Linker> 39 <Linker>
39 <Add option="`pkg-config --libs gtk+-3.0 lib3270`" /> 40 <Add option="`pkg-config --libs gtk+-3.0 lib3270`" />
@@ -45,27 +46,26 @@ @@ -45,27 +46,26 @@
45 <Unit filename="../include/v3270.h" /> 46 <Unit filename="../include/v3270.h" />
46 <Unit filename="../include/v3270ft.h" /> 47 <Unit filename="../include/v3270ft.h" />
47 <Unit filename="../include/v3270ftprogress.h" /> 48 <Unit filename="../include/v3270ftprogress.h" />
48 - <Unit filename="../v3270/actions.c">  
49 - <Option compilerVar="CC" />  
50 - </Unit>  
51 - <Unit filename="../v3270/colors.c">  
52 - <Option compilerVar="CC" />  
53 - </Unit>  
54 - <Unit filename="../v3270/cursor.c"> 49 + <Unit filename="../v3270/accessible.c">
55 <Option compilerVar="CC" /> 50 <Option compilerVar="CC" />
56 </Unit> 51 </Unit>
  52 + <Unit filename="../v3270/accessible.h" />
57 <Unit filename="../v3270/draw.c"> 53 <Unit filename="../v3270/draw.c">
58 <Option compilerVar="CC" /> 54 <Option compilerVar="CC" />
59 </Unit> 55 </Unit>
60 - <Unit filename="../v3270/font.c"> 56 + <Unit filename="../v3270/hostselect.c">
61 <Option compilerVar="CC" /> 57 <Option compilerVar="CC" />
62 </Unit> 58 </Unit>
  59 + <Unit filename="../v3270/hostselect.h" />
63 <Unit filename="../v3270/iocallback.c"> 60 <Unit filename="../v3270/iocallback.c">
64 <Option compilerVar="CC" /> 61 <Option compilerVar="CC" />
65 </Unit> 62 </Unit>
66 <Unit filename="../v3270/keyboard.c"> 63 <Unit filename="../v3270/keyboard.c">
67 <Option compilerVar="CC" /> 64 <Option compilerVar="CC" />
68 </Unit> 65 </Unit>
  66 + <Unit filename="../v3270/macros.c">
  67 + <Option compilerVar="CC" />
  68 + </Unit>
69 <Unit filename="../v3270/marshal.c"> 69 <Unit filename="../v3270/marshal.c">
70 <Option compilerVar="CC" /> 70 <Option compilerVar="CC" />
71 </Unit> 71 </Unit>
@@ -80,13 +80,13 @@ @@ -80,13 +80,13 @@
80 <Unit filename="../v3270/properties.c"> 80 <Unit filename="../v3270/properties.c">
81 <Option compilerVar="CC" /> 81 <Option compilerVar="CC" />
82 </Unit> 82 </Unit>
83 - <Unit filename="../v3270/signals.c"> 83 + <Unit filename="../v3270/security.c">
84 <Option compilerVar="CC" /> 84 <Option compilerVar="CC" />
85 </Unit> 85 </Unit>
86 - <Unit filename="../v3270/text.c"> 86 + <Unit filename="../v3270/selection.c">
87 <Option compilerVar="CC" /> 87 <Option compilerVar="CC" />
88 </Unit> 88 </Unit>
89 - <Unit filename="../v3270/v3270.c"> 89 + <Unit filename="../v3270/widget.c">
90 <Option compilerVar="CC" /> 90 <Option compilerVar="CC" />
91 </Unit> 91 </Unit>
92 <Unit filename="filelist.c"> 92 <Unit filename="filelist.c">
src/pw3270/v3270ft/load.c
@@ -38,6 +38,29 @@ @@ -38,6 +38,29 @@
38 38
39 /*--[ Implement ]------------------------------------------------------------------------------------*/ 39 /*--[ Implement ]------------------------------------------------------------------------------------*/
40 40
  41 +static LIB3270_FT_OPTION getFlagByName(const gchar *option, const char *optval) {
  42 +
  43 + LIB3270_FT_OPTION rc = 0;
  44 + int f;
  45 + gchar * key = g_strconcat(option,".",optval,NULL);
  46 +
  47 + for(f=0;f<NUM_OPTIONS_WIDGETS;f++) {
  48 +
  49 +// debug("%u %s",f,ft_option[f].name);
  50 +
  51 + if(!g_ascii_strcasecmp(key,ft_option[f].name)) {
  52 + rc = ft_option[f].opt;
  53 + debug("%s=%08lx",key,(unsigned int) rc);
  54 + break;
  55 + }
  56 +
  57 + }
  58 +
  59 + g_free(key);
  60 +
  61 + return rc;
  62 +}
  63 +
41 static void entry_start(GMarkupParseContext *context, const gchar *element_name, const gchar **names,const gchar **values, struct v3270ft_entry *info, GError **error) { 64 static void entry_start(GMarkupParseContext *context, const gchar *element_name, const gchar **names,const gchar **values, struct v3270ft_entry *info, GError **error) {
42 65
43 int f; 66 int f;
@@ -72,8 +95,8 @@ static void entry_start(GMarkupParseContext *context, const gchar *element_name, @@ -72,8 +95,8 @@ static void entry_start(GMarkupParseContext *context, const gchar *element_name,
72 95
73 } if(!g_ascii_strcasecmp(element_name,"option")) { 96 } if(!g_ascii_strcasecmp(element_name,"option")) {
74 97
75 - const gchar *option;  
76 - const gchar *optval; 98 + const gchar *option = NULL;
  99 + const gchar *optval = NULL;
77 100
78 if(!g_markup_collect_attributes( 101 if(!g_markup_collect_attributes(
79 element_name,names,values,error, 102 element_name,names,values,error,
@@ -86,43 +109,39 @@ static void entry_start(GMarkupParseContext *context, const gchar *element_name, @@ -86,43 +109,39 @@ static void entry_start(GMarkupParseContext *context, const gchar *element_name,
86 109
87 } 110 }
88 111
89 - // Check for options  
90 - for(f=0;f<NUM_OPTIONS_WIDGETS;f++) { 112 + debug("%s=%s",option,optval);
91 113
92 - char *name = g_strdup(ft_option[f].name);  
93 - char *value = strchr(name,'.'); 114 + if(!g_ascii_strcasecmp(option,"recfm")) {
94 115
95 - if(value) {  
96 - *(value++) = 0;  
97 - } 116 + // Recfm, limpo todas as flags correspondentes e remonto
  117 + info->options &= ~(LIB3270_FT_RECORD_FORMAT_DEFAULT|LIB3270_FT_RECORD_FORMAT_FIXED|LIB3270_FT_RECORD_FORMAT_VARIABLE|LIB3270_FT_RECORD_FORMAT_UNDEFINED); // Reseta flags
  118 + info->options |= getFlagByName(option,optval);
  119 +
  120 + } else if(!g_ascii_strcasecmp(option,"units")) {
98 121
99 - if( !g_ascii_strcasecmp(option,name)) { 122 + // Units, limpo todas as flags correspondentes e remonto
  123 + info->options &= ~(LIB3270_FT_ALLOCATION_UNITS_DEFAULT|LIB3270_FT_ALLOCATION_UNITS_TRACKS|LIB3270_FT_ALLOCATION_UNITS_CYLINDERS|LIB3270_FT_ALLOCATION_UNITS_AVBLOCK);
  124 + info->options |= getFlagByName(option,optval);
100 125
101 - if(!value) { 126 + } else {
102 127
103 - // Opção é boolean 128 + for(f=0;f<NUM_OPTIONS_WIDGETS;f++) {
104 129
105 -// debug("%s=%s",option,optval); 130 + if(!g_ascii_strcasecmp(option,ft_option[f].name)) {
106 131
107 - if( toupper(*optval) == 'Y' || toupper(*optval) == 'S' || *optval == '1') { 132 + if(!g_ascii_strcasecmp(optval,"yes")) {
108 info->options |= ft_option[f].opt; 133 info->options |= ft_option[f].opt;
  134 + } else if(!g_ascii_strcasecmp(optval,"no")) {
  135 + info->options &= ~ft_option[f].opt;
  136 + } else {
  137 + g_warning("Unexpected value for %s: %s",option,optval);
109 } 138 }
110 -  
111 - } else if(!g_ascii_strcasecmp(value,optval)) {  
112 -  
113 - // Opção tem valor  
114 -// debug("%s=%s",option,optval);  
115 -  
116 - info->options |= ft_option[f].opt;  
117 - 139 + break;
118 } 140 }
119 141
120 -  
121 - g_free(name);  
122 - return;  
123 } 142 }
124 143
125 - g_free(name); 144 +
126 } 145 }
127 146
128 // Check for FT values 147 // Check for FT values
@@ -137,7 +156,6 @@ static void entry_start(GMarkupParseContext *context, const gchar *element_name, @@ -137,7 +156,6 @@ static void entry_start(GMarkupParseContext *context, const gchar *element_name,
137 } 156 }
138 } 157 }
139 158
140 -  
141 } 159 }
142 160
143 161
src/pw3270/v3270ft/private.h
@@ -69,7 +69,6 @@ @@ -69,7 +69,6 @@
69 69
70 }; 70 };
71 71
72 -  
73 struct v3270ft_type { 72 struct v3270ft_type {
74 LIB3270_FT_OPTION opt; 73 LIB3270_FT_OPTION opt;
75 const gchar * name; 74 const gchar * name;
src/pw3270/v3270ft/save.c
@@ -30,12 +30,30 @@ @@ -30,12 +30,30 @@
30 30
31 #include "private.h" 31 #include "private.h"
32 32
33 -  
34 /*--[ Statics ]--------------------------------------------------------------------------------------*/ 33 /*--[ Statics ]--------------------------------------------------------------------------------------*/
35 34
36 35
37 /*--[ Implement ]------------------------------------------------------------------------------------*/ 36 /*--[ Implement ]------------------------------------------------------------------------------------*/
38 37
  38 +static const gchar * getNameByFlag(LIB3270_FT_OPTION opt, LIB3270_FT_OPTION mask) {
  39 +
  40 + const gchar * rc = "Default";
  41 + const gchar * ptr;
  42 + int f;
  43 +
  44 + opt &= mask;
  45 +
  46 + for(f=0;f<NUM_OPTIONS_WIDGETS;f++) {
  47 +
  48 + if(opt == ft_option[f].opt) {
  49 + ptr = strchr(ft_option[f].name,'.');
  50 + rc = ptr ? ptr+1 : ft_option[f].name;
  51 + }
  52 + }
  53 +
  54 + return rc;
  55 +}
  56 +
39 void get_item(struct v3270ft_entry *entry, GString *str) { 57 void get_item(struct v3270ft_entry *entry, GString *str) {
40 58
41 int f; 59 int f;
@@ -44,22 +62,31 @@ @@ -44,22 +62,31 @@
44 g_string_append_printf(str,"\t\t<file type=\"%s\" path=\"%s\"/>\n","local",entry->local); 62 g_string_append_printf(str,"\t\t<file type=\"%s\" path=\"%s\"/>\n","local",entry->local);
45 g_string_append_printf(str,"\t\t<file type=\"%s\" path=\"%s\"/>\n","remote",entry->remote); 63 g_string_append_printf(str,"\t\t<file type=\"%s\" path=\"%s\"/>\n","remote",entry->remote);
46 64
47 - for(f=0;f<NUM_OPTIONS_WIDGETS;f++) { 65 + g_string_append_printf(str,"\t\t<option name=\"%s\" value=\"%s\"/>\n",
  66 + "ascii", entry->options & LIB3270_FT_OPTION_ASCII ? "yes" : "no");
48 67
49 - if( (entry->options & ft_option[f].opt) == ft_option[f].opt) {  
50 - char *name = g_strdup(ft_option[f].name);  
51 - char *value = strchr(name,'.'); 68 + g_string_append_printf(str,"\t\t<option name=\"%s\" value=\"%s\"/>\n",
  69 + "crlf", entry->options & LIB3270_FT_OPTION_CRLF ? "yes" : "no");
52 70
53 - if(value)  
54 - *(value++) = 0;  
55 - else  
56 - value = "yes"; 71 + g_string_append_printf(str,"\t\t<option name=\"%s\" value=\"%s\"/>\n",
  72 + "append", entry->options & LIB3270_FT_OPTION_APPEND ? "yes" : "no");
57 73
58 - g_string_append_printf(str,"\t\t<option name=\"%s\" value=\"%s\"/>\n",name,value); 74 + g_string_append_printf(str,"\t\t<option name=\"%s\" value=\"%s\"/>\n",
  75 + "remap", entry->options & LIB3270_FT_OPTION_REMAP ? "yes" : "no");
59 76
60 - g_free(name);  
61 - }  
62 - } 77 + g_string_append_printf(str,"\t\t<option name=\"%s\" value=\"%s\"/>\n",
  78 + "recfm", getNameByFlag(entry->options,
  79 + LIB3270_FT_RECORD_FORMAT_DEFAULT
  80 + |LIB3270_FT_RECORD_FORMAT_FIXED
  81 + |LIB3270_FT_RECORD_FORMAT_VARIABLE
  82 + |LIB3270_FT_RECORD_FORMAT_UNDEFINED));
  83 +
  84 + g_string_append_printf(str,"\t\t<option name=\"%s\" value=\"%s\"/>\n",
  85 + "units", getNameByFlag(entry->options,
  86 + LIB3270_FT_ALLOCATION_UNITS_DEFAULT
  87 + |LIB3270_FT_ALLOCATION_UNITS_TRACKS
  88 + |LIB3270_FT_ALLOCATION_UNITS_CYLINDERS
  89 + |LIB3270_FT_ALLOCATION_UNITS_AVBLOCK));
63 90
64 for(f=0;f<LIB3270_FT_VALUE_COUNT;f++) { 91 for(f=0;f<LIB3270_FT_VALUE_COUNT;f++) {
65 g_string_append_printf(str,"\t\t<option name=\"%s\" value=\"%u\"/>\n",ft_value[f].name,entry->value[f]); 92 g_string_append_printf(str,"\t\t<option name=\"%s\" value=\"%u\"/>\n",ft_value[f].name,entry->value[f]);
src/pw3270/v3270ft/tables.c
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 34
35 /*--[ Globals ]--------------------------------------------------------------------------------------*/ 35 /*--[ Globals ]--------------------------------------------------------------------------------------*/
36 36
37 -const struct v3270ft_option ft_option[] = { 37 +const struct v3270ft_option ft_option[NUM_OPTIONS_WIDGETS] = {
38 38
39 // Transfer options 39 // Transfer options
40 { 40 {
src/pw3270/v3270ft/testprogram.c
@@ -97,7 +97,7 @@ static void activate(GtkApplication* app, gpointer user_data) { @@ -97,7 +97,7 @@ static void activate(GtkApplication* app, gpointer user_data) {
97 g_key_file_load_from_dirs(conf,"pw3270.conf",(const gchar **) search, &filename,G_KEY_FILE_NONE,NULL); 97 g_key_file_load_from_dirs(conf,"pw3270.conf",(const gchar **) search, &filename,G_KEY_FILE_NONE,NULL);
98 g_message("Configuration from %s",filename); 98 g_message("Configuration from %s",filename);
99 99
100 - v3270_set_from_keyfile(terminal,conf); 100 + // v3270_set_from_keyfile(terminal,conf);
101 101
102 g_key_file_unref(conf); 102 g_key_file_unref(conf);
103 103