Commit cbc69e8d47bed7f27e3197f34628ebee4728ade6

Authored by perry.werneck@gmail.com
1 parent 43023aba

Melhorando dialogos de transferencia de arquivos

Showing 1 changed file with 53 additions and 8 deletions   Show diff stats
src/pw3270/filetransfer.c
... ... @@ -176,19 +176,68 @@ static void check_entry(GtkEditable *editable, struct ftdialog *dlg)
176 176 {
177 177 gtk_widget_set_sensitive(dlg->ready,is_dialog_ok(editable,dlg));
178 178 }
  179 +
  180 +static GtkWidget * add_filename_entry(GObject *action, int ix, int row, struct ftdialog *dlg, GtkTable *table)
  181 +{
  182 + static const gchar * label_text[] = { N_( "_Local file name:" ), N_( "_Host file name:" ) };
  183 + static const gchar * attr[] = { "local", "remote" };
  184 +
  185 + GtkWidget * entry = gtk_entry_new();
  186 + GtkWidget * label = gtk_label_new_with_mnemonic(gettext(label_text[ix]));
  187 + gchar * val;
  188 +
  189 + gtk_misc_set_alignment(GTK_MISC(label),0,.5);
  190 + gtk_table_attach(GTK_TABLE(table),label,0,1,row,row+1,GTK_FILL,GTK_FILL,2,2);
  191 +
  192 + gtk_widget_set_name(entry,attr[ix]);
  193 +
  194 + val = get_attribute(action,dlg,attr[ix]);
  195 + gtk_entry_set_text(dlg->file[ix],val);
  196 + g_free(val);
  197 +
  198 + gtk_entry_set_width_chars(GTK_ENTRY(entry),40);
  199 +
  200 + gtk_label_set_mnemonic_widget(GTK_LABEL(label),entry);
  201 +
  202 + gtk_table_attach(GTK_TABLE(table),entry,1,3,row,row+1,GTK_EXPAND|GTK_SHRINK|GTK_FILL,GTK_EXPAND|GTK_SHRINK|GTK_FILL,2,2);
  203 +
  204 + return entry;
  205 +}
179 206  
180 207 static void add_file_fields(GObject *action, struct ftdialog *dlg)
181 208 {
182   - static const gchar * label[] = { N_( "_Local file name:" ), N_( "_Host file name:" ) };
183   - static const gchar * attr[] = { "local", "remote" };
184 209 GtkTable * table = GTK_TABLE(gtk_table_new(2,3,FALSE));
185 210 GtkWidget * widget;
186 211 int f;
187 212  
188 213 gtk_container_set_border_width(GTK_CONTAINER(table),2);
  214 +
  215 + if(dlg->option&LIB3270_FT_OPTION_RECEIVE)
  216 + {
  217 + // Receiving file, first the remote filename
  218 + dlg->file[1] = add_filename_entry(action,1,0,dlg,table);
  219 +
  220 + dlg->file[0] = add_filename_entry(action,0,1,dlg,table);
  221 + widget = gtk_button_new_with_mnemonic( _( "_Browse" ) );
  222 + g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(browse_file),dlg);
  223 + gtk_table_attach(GTK_TABLE(table),widget,3,4,1,2,0,0,2,2);
  224 + }
  225 + else
  226 + {
  227 + // Sending file, first the local filename
  228 + dlg->file[0] = add_filename_entry(action,0,0,dlg,table);
  229 + widget = gtk_button_new_with_mnemonic( _( "_Browse" ) );
  230 + g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(browse_file),dlg);
  231 + gtk_table_attach(GTK_TABLE(table),widget,3,4,0,1,0,0,2,2);
  232 +
  233 + dlg->file[1] = add_filename_entry(action,1,1,dlg,table);
  234 + }
  235 +
189 236  
  237 +/*
190 238 for(f=0;f<2;f++)
191   - {
  239 + {
  240 +
192 241 gchar *val;
193 242  
194 243 widget = gtk_label_new_with_mnemonic(gettext(label[f]));
... ... @@ -209,12 +258,8 @@ static void add_file_fields(GObject *action, struct ftdialog *dlg)
209 258 gtk_label_set_mnemonic_widget(GTK_LABEL(widget),GTK_WIDGET(dlg->file[f]));
210 259  
211 260 gtk_table_attach(GTK_TABLE(table),GTK_WIDGET(dlg->file[f]),1,3,f,f+1,GTK_EXPAND|GTK_SHRINK|GTK_FILL,GTK_EXPAND|GTK_SHRINK|GTK_FILL,2,2);
212   -
213 261 }
214   -
215   - widget = gtk_button_new_with_mnemonic( _( "_Browse" ) );
216   - g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(browse_file),dlg);
217   - gtk_table_attach(GTK_TABLE(table),widget,3,4,0,1,0,0,2,2);
  262 +*/
218 263  
219 264 gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg->dialog))),GTK_WIDGET(table),FALSE,FALSE,2);
220 265  
... ...