Commit c0f8961445d74a6a2380381189bd3ae4257eff37

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

Working on new FT dialog.

Showing 2 changed files with 48 additions and 13 deletions   Show diff stats
src/v3270ft/settings.c
@@ -79,24 +79,22 @@ @@ -79,24 +79,22 @@
79 return entry; 79 return entry;
80 } 80 }
81 81
82 - static GtkWidget * create_frame(V3270FTSettings *widget, const gchar *title, GtkWidget *box, gint left, gint top, gint width, gint height, gint margin_top) 82 + static GtkWidget * create_frame(GtkWidget *container, const gchar *title, GtkWidget *box, GtkAlign align)
83 { 83 {
84 GtkFrame * frame = GTK_FRAME(gtk_frame_new("")); 84 GtkFrame * frame = GTK_FRAME(gtk_frame_new(""));
85 g_autofree gchar * markup = g_strdup_printf("<b>%s</b>",title); 85 g_autofree gchar * markup = g_strdup_printf("<b>%s</b>",title);
86 GtkWidget * label = gtk_label_new(NULL); 86 GtkWidget * label = gtk_label_new(NULL);
87 87
88 - if(margin_top)  
89 - g_object_set(G_OBJECT(frame),"margin-top",margin_top,NULL);  
90 -  
91 gtk_frame_set_shadow_type(GTK_FRAME(frame),GTK_SHADOW_NONE); 88 gtk_frame_set_shadow_type(GTK_FRAME(frame),GTK_SHADOW_NONE);
92 gtk_label_set_markup(GTK_LABEL(label),markup); 89 gtk_label_set_markup(GTK_LABEL(label),markup);
93 gtk_frame_set_label_widget(GTK_FRAME(frame),label); 90 gtk_frame_set_label_widget(GTK_FRAME(frame),label);
94 91
95 gtk_container_add(GTK_CONTAINER(frame),GTK_WIDGET(box)); 92 gtk_container_add(GTK_CONTAINER(frame),GTK_WIDGET(box));
  93 + gtk_widget_set_halign(GTK_WIDGET(frame),align);
96 94
97 - gtk_grid_attach(GTK_GRID(widget),GTK_WIDGET(frame),left,top,width,height); 95 + g_object_set(G_OBJECT(frame),"margin-top",6,NULL);
98 96
99 - g_object_set(G_OBJECT(box),"margin-top",6,NULL); 97 + gtk_box_pack_start(GTK_BOX(container),GTK_WIDGET(frame),TRUE,TRUE,0);
100 98
101 return box; 99 return box;
102 } 100 }
@@ -112,7 +110,7 @@ @@ -112,7 +110,7 @@
112 // Operation type 110 // Operation type
113 { 111 {
114 GtkTreeModel * model = GTK_TREE_MODEL(gtk_list_store_new(2,G_TYPE_STRING,G_TYPE_ULONG)); 112 GtkTreeModel * model = GTK_TREE_MODEL(gtk_list_store_new(2,G_TYPE_STRING,G_TYPE_ULONG));
115 - GtkWidget * entry = create_entry(widget,"_Operation",gtk_combo_box_new_with_model(model),0,0,10); 113 + GtkWidget * entry = create_entry(widget,"_Operation",gtk_combo_box_new_with_model(model),0,0,9);
116 GtkCellRenderer * renderer = gtk_cell_renderer_text_new(); 114 GtkCellRenderer * renderer = gtk_cell_renderer_text_new();
117 115
118 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(entry), renderer, TRUE); 116 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(entry), renderer, TRUE);
@@ -131,7 +129,7 @@ @@ -131,7 +129,7 @@
131 // Local and remote file names. 129 // Local and remote file names.
132 { 130 {
133 // Local file name 131 // Local file name
134 - widget->file.local = GTK_ENTRY(create_entry(widget,"_Local file",gtk_entry_new(),0,1,10)); 132 + widget->file.local = GTK_ENTRY(create_entry(widget,"_Local file",gtk_entry_new(),0,1,9));
135 gtk_entry_set_icon_from_icon_name(widget->file.local,GTK_ENTRY_ICON_SECONDARY,"document-open"); 133 gtk_entry_set_icon_from_icon_name(widget->file.local,GTK_ENTRY_ICON_SECONDARY,"document-open");
136 gtk_entry_set_icon_activatable(widget->file.local,GTK_ENTRY_ICON_SECONDARY,TRUE); 134 gtk_entry_set_icon_activatable(widget->file.local,GTK_ENTRY_ICON_SECONDARY,TRUE);
137 gtk_entry_set_icon_tooltip_text(widget->file.local,GTK_ENTRY_ICON_SECONDARY,_("Select file")); 135 gtk_entry_set_icon_tooltip_text(widget->file.local,GTK_ENTRY_ICON_SECONDARY,_("Select file"));
@@ -139,15 +137,20 @@ @@ -139,15 +137,20 @@
139 // g_signal_connect(G_OBJECT(widget->file.local),"icon-press",G_CALLBACK(open_select_file_dialog),dialog); 137 // g_signal_connect(G_OBJECT(widget->file.local),"icon-press",G_CALLBACK(open_select_file_dialog),dialog);
140 138
141 // Remote file name 139 // Remote file name
142 - widget->file.remote = GTK_ENTRY(create_entry(widget,"_Remote file",gtk_entry_new(),0,2,10));  
143 -  
144 - 140 + widget->file.remote = GTK_ENTRY(create_entry(widget,"_Remote file",gtk_entry_new(),0,2,9));
145 141
146 } 142 }
147 143
  144 + // Options box
  145 + GtkWidget * options = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,6);
  146 + gtk_box_set_homogeneous(GTK_BOX(options),FALSE);
  147 + g_object_set(G_OBJECT(options),"margin-top",8,NULL);
  148 + gtk_widget_set_hexpand(options,TRUE);
  149 + gtk_grid_attach(GTK_GRID(widget),options,0,3,10,5);
  150 +
148 // Transfer options 151 // Transfer options
149 { 152 {
150 - GtkWidget * box = create_frame(widget, _("Transfer options"), gtk_box_new(GTK_ORIENTATION_VERTICAL,6), 0, 3, 5, 5, 8); 153 + GtkWidget * box = create_frame(options, _("Transfer options"), gtk_box_new(GTK_ORIENTATION_VERTICAL,6),GTK_ALIGN_START);
151 154
152 for(ix=0;ix<4;ix++) 155 for(ix=0;ix<4;ix++)
153 { 156 {
@@ -160,6 +163,38 @@ @@ -160,6 +163,38 @@
160 163
161 } 164 }
162 165
  166 + // Record format
  167 + {
  168 + GtkWidget * box = create_frame(options, _("Record format"), gtk_box_new(GTK_ORIENTATION_VERTICAL,6),GTK_ALIGN_CENTER);
  169 + GSList * group = NULL;
  170 +
  171 + for(ix=4;ix<8;ix++)
  172 + {
  173 + widget->options[ix] = gtk_radio_button_new_with_label(group,gettext(ft_option[ix].label));
  174 + gtk_widget_set_tooltip_markup(widget->options[ix],gettext(ft_option[ix].tooltip));
  175 + group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(widget->options[ix]));
  176 + // g_signal_connect(G_OBJECT(widget->options[ix]),"toggled",G_CALLBACK(option_toggled),widget);
  177 + gtk_box_pack_start(GTK_BOX(box),widget->options[ix],FALSE,TRUE,0);
  178 +
  179 + }
  180 + }
  181 +
  182 + // Space allocation units
  183 + {
  184 + GtkWidget * box = create_frame(options, _("Space allocation units"), gtk_box_new(GTK_ORIENTATION_VERTICAL,6),GTK_ALIGN_END);
  185 + GSList * group = NULL;
  186 +
  187 + for(ix=8;ix<12;ix++)
  188 + {
  189 + widget->options[ix] = gtk_radio_button_new_with_label(group,gettext(ft_option[ix].label));
  190 + gtk_widget_set_tooltip_markup(widget->options[ix],gettext(ft_option[ix].tooltip));
  191 + group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(widget->options[ix]));
  192 + // g_signal_connect(G_OBJECT(widget->options[ix]),"toggled",G_CALLBACK(option_toggled),widget);
  193 + gtk_box_pack_start(GTK_BOX(box),widget->options[ix],FALSE,TRUE,0);
  194 +
  195 + }
  196 + }
  197 +
163 gtk_widget_show_all(GTK_WIDGET(widget)); 198 gtk_widget_show_all(GTK_WIDGET(widget));
164 199
165 } 200 }
src/v3270ft/tables.c
@@ -46,7 +46,7 @@ const struct v3270ft_option ft_option[NUM_OPTIONS_WIDGETS] = { @@ -46,7 +46,7 @@ const struct v3270ft_option ft_option[NUM_OPTIONS_WIDGETS] = {
46 { 46 {
47 LIB3270_FT_OPTION_CRLF, 47 LIB3270_FT_OPTION_CRLF,
48 "crlf", 48 "crlf",
49 - N_("Follow the convention for _ASCII text files."), 49 + N_("_ASCII text"),
50 #ifdef _WIN32 50 #ifdef _WIN32
51 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.") 51 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.")
52 #else 52 #else