Commit 470088071ec8b3f4cfd61e1dd081788224d6534a

Authored by perry.werneck@gmail.com
1 parent 7205253b

Implementando diálogo de transferência de arquivos

Showing 2 changed files with 25 additions and 15 deletions   Show diff stats
src/pw3270/actions.c
@@ -242,10 +242,10 @@ static void connect_standard_action(GtkAction *action, GtkWidget *widget, const @@ -242,10 +242,10 @@ static void connect_standard_action(GtkAction *action, GtkWidget *widget, const
242 { "about", about_dialog_action }, 242 { "about", about_dialog_action },
243 { "kpsubtract", kp_subtract_action }, 243 { "kpsubtract", kp_subtract_action },
244 { "kpadd", kp_add_action }, 244 { "kpadd", kp_add_action },
245 -#ifdef DEBUG  
246 - { "copyashtml", copy_as_html_action },  
247 { "download", download_action }, 245 { "download", download_action },
248 { "upload", upload_action }, 246 { "upload", upload_action },
  247 +#ifdef DEBUG
  248 + { "copyashtml", copy_as_html_action },
249 #endif // DEBUG 249 #endif // DEBUG
250 }; 250 };
251 251
src/pw3270/filetransfer.c
@@ -131,18 +131,25 @@ static gboolean is_dialog_ok(GtkEditable *editable, struct ftdialog *dlg) @@ -131,18 +131,25 @@ static gboolean is_dialog_ok(GtkEditable *editable, struct ftdialog *dlg)
131 if(!(*local && *remote)) 131 if(!(*local && *remote))
132 return FALSE; 132 return FALSE;
133 133
134 - if( (dlg->option&LIB3270_FT_OPTION_RECEIVE) == 0 && !g_file_test(local,G_FILE_TEST_EXISTS))  
135 - return FALSE;  
136 134
137 - for(f=0;f<5;f++) 135 + if( (dlg->option&LIB3270_FT_OPTION_RECEIVE) == 0)
138 { 136 {
139 - const gchar *val = gtk_entry_get_text(GTK_ENTRY(dlg->parm[f])); 137 + if(!g_file_test(local,G_FILE_TEST_EXISTS))
  138 + return FALSE;
  139 + }
140 140
141 - while(*val) 141 + for(f=0;f<5;f++)
  142 + {
  143 + if(dlg->parm[f])
142 { 144 {
143 - if(*val < '0' || *val > '9')  
144 - return FALSE;  
145 - val++; 145 + const gchar *val = gtk_entry_get_text(GTK_ENTRY(dlg->parm[f]));
  146 +
  147 + while(*val)
  148 + {
  149 + if(*val < '0' || *val > '9')
  150 + return FALSE;
  151 + val++;
  152 + }
146 } 153 }
147 } 154 }
148 155
@@ -195,8 +202,6 @@ static void add_file_fields(GObject *action, struct ftdialog *dlg) @@ -195,8 +202,6 @@ static void add_file_fields(GObject *action, struct ftdialog *dlg)
195 202
196 gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg->dialog))),GTK_WIDGET(table),FALSE,FALSE,2); 203 gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg->dialog))),GTK_WIDGET(table),FALSE,FALSE,2);
197 204
198 - for(f=0;f<2;f++)  
199 - g_signal_connect(G_OBJECT(dlg->file[f]),"changed",G_CALLBACK(check_entry),dlg);  
200 } 205 }
201 206
202 static void toggle_option(GtkToggleButton *button, const struct ftoption *option) 207 static void toggle_option(GtkToggleButton *button, const struct ftoption *option)
@@ -279,6 +284,8 @@ static void setup_dft(GObject *action, struct ftdialog *dlg, GtkWidget **label) @@ -279,6 +284,8 @@ static void setup_dft(GObject *action, struct ftdialog *dlg, GtkWidget **label)
279 gtk_entry_set_max_length(dlg->parm[4],10); 284 gtk_entry_set_max_length(dlg->parm[4],10);
280 gtk_entry_set_width_chars(dlg->parm[4],10); 285 gtk_entry_set_width_chars(dlg->parm[4],10);
281 286
  287 + gtk_entry_set_text(GTK_ENTRY(dlg->parm[4]),"4096");
  288 +
282 gtk_label_set_mnemonic_widget(GTK_LABEL(*label),GTK_WIDGET(dlg->parm[4])); 289 gtk_label_set_mnemonic_widget(GTK_LABEL(*label),GTK_WIDGET(dlg->parm[4]));
283 290
284 } 291 }
@@ -369,7 +376,10 @@ static void run_ft_dialog(GObject *action, GtkWidget *widget, struct ftdialog *d @@ -369,7 +376,10 @@ static void run_ft_dialog(GObject *action, GtkWidget *widget, struct ftdialog *d
369 if(dlg->parm[f]) 376 if(dlg->parm[f])
370 { 377 {
371 gchar *val = get_attribute(action,dlg,gtk_widget_get_name(GTK_WIDGET(dlg->parm[f]))); 378 gchar *val = get_attribute(action,dlg,gtk_widget_get_name(GTK_WIDGET(dlg->parm[f])));
372 - gtk_entry_set_text(dlg->parm[f],val); 379 +
  380 + if(val && *val)
  381 + gtk_entry_set_text(dlg->parm[f],val);
  382 +
373 g_free(val); 383 g_free(val);
374 g_signal_connect(G_OBJECT(dlg->parm[f]),"changed",G_CALLBACK(check_entry),dlg); 384 g_signal_connect(G_OBJECT(dlg->parm[f]),"changed",G_CALLBACK(check_entry),dlg);
375 } 385 }
@@ -584,9 +594,9 @@ static void run_ft_dialog(GObject *action, GtkWidget *widget, struct ftdialog *d @@ -584,9 +594,9 @@ static void run_ft_dialog(GObject *action, GtkWidget *widget, struct ftdialog *d
584 gtk_widget_show_all(ftdialog); 594 gtk_widget_show_all(ftdialog);
585 lib3270_ft_start(ft); 595 lib3270_ft_start(ft);
586 596
587 - trace("%s: Running dialog %p",ftdialog); 597 + trace("%s: Running dialog %p",__FUNCTION__,ftdialog);
588 gtk_dialog_run(GTK_DIALOG(ftdialog)); 598 gtk_dialog_run(GTK_DIALOG(ftdialog));
589 - trace("%s: Dialog %p ends",ftdialog); 599 + trace("%s: Dialog %p ends",__FUNCTION__,ftdialog);
590 600
591 lib3270_ft_destroy(ft); 601 lib3270_ft_destroy(ft);
592 602