Commit fc3bbab1487b71efc127b5849b0775973c93a351

Authored by Perry Werneck
1 parent 9169a2de
Exists in master and in 1 other branch develop

Updating host select dialog.

Showing 1 changed file with 41 additions and 63 deletions   Show diff stats
src/dialogs/hostselect.c
@@ -55,11 +55,7 @@ @@ -55,11 +55,7 @@
55 55
56 struct _V3270HostSelectWidget 56 struct _V3270HostSelectWidget
57 { 57 {
58 -#if GTK_CHECK_VERSION(3,0,0)  
59 - GtkBin parent;  
60 -#else  
61 - GtkVBox parent;  
62 -#endif // GTK_CHECK_VERSION 58 + GtkGrid parent;
63 59
64 LIB3270_HOST_TYPE type; /**< @brief Connect option */ 60 LIB3270_HOST_TYPE type; /**< @brief Connect option */
65 61
@@ -78,11 +74,11 @@ @@ -78,11 +74,11 @@
78 74
79 struct _V3270HostSelectWidgetClass 75 struct _V3270HostSelectWidgetClass
80 { 76 {
81 - GtkBinClass parent_class; 77 + GtkGridClass parent_class;
82 }; 78 };
83 79
84 80
85 - G_DEFINE_TYPE(V3270HostSelectWidget, V3270HostSelectWidget, GTK_TYPE_BIN); 81 + G_DEFINE_TYPE(V3270HostSelectWidget, V3270HostSelectWidget, GTK_TYPE_GRID);
86 82
87 /*--[ Implement ]------------------------------------------------------------------------------------*/ 83 /*--[ Implement ]------------------------------------------------------------------------------------*/
88 84
@@ -120,26 +116,21 @@ static void colortable_changed(GtkComboBox *widget, V3270HostSelectWidget *dialo @@ -120,26 +116,21 @@ static void colortable_changed(GtkComboBox *widget, V3270HostSelectWidget *dialo
120 116
121 static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) 117 static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
122 { 118 {
123 - GtkGrid * grid = GTK_GRID(gtk_grid_new()); 119 + int f;
  120 +
  121 + gtk_container_set_border_width(GTK_CONTAINER(widget),10);
  122 +
  123 + gtk_grid_set_row_spacing(GTK_GRID(widget),5);
  124 + gtk_grid_set_column_spacing(GTK_GRID(widget),10);
124 125
  126 + // Entry fields
125 GtkWidget * label[ENTRY_COUNT] = 127 GtkWidget * label[ENTRY_COUNT] =
126 { 128 {
127 gtk_label_new_with_mnemonic( _( "_Host:" ) ), 129 gtk_label_new_with_mnemonic( _( "_Host:" ) ),
128 gtk_label_new_with_mnemonic( _( "_Service:" ) ) 130 gtk_label_new_with_mnemonic( _( "_Service:" ) )
129 }; 131 };
130 132
131 - int f;  
132 -  
133 - gtk_container_set_border_width(GTK_CONTAINER(grid),10);  
134 -  
135 - gtk_grid_set_row_spacing(grid,5);  
136 - gtk_grid_set_column_spacing(grid,10);  
137 -  
138 - gtk_grid_set_row_homogeneous(grid,FALSE);  
139 - gtk_grid_set_column_homogeneous(grid,FALSE);  
140 -  
141 -  
142 - for(f=0;f<ENTRY_COUNT;f++) 133 + for(f=0;f<ENTRY_COUNT;f++)
143 { 134 {
144 widget->input.entry[f] = GTK_ENTRY(gtk_entry_new()); 135 widget->input.entry[f] = GTK_ENTRY(gtk_entry_new());
145 gtk_widget_set_halign(label[f],GTK_ALIGN_START); 136 gtk_widget_set_halign(label[f],GTK_ALIGN_START);
@@ -149,12 +140,31 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) @@ -149,12 +140,31 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
149 gtk_widget_set_tooltip_text(GTK_WIDGET(widget->input.entry[ENTRY_HOSTNAME]),_("Address or name of the host to connect.") ); 140 gtk_widget_set_tooltip_text(GTK_WIDGET(widget->input.entry[ENTRY_HOSTNAME]),_("Address or name of the host to connect.") );
150 gtk_widget_set_tooltip_text(GTK_WIDGET(widget->input.entry[ENTRY_SRVCNAME]),_("Port or service name (empty for \"telnet\").") ); 141 gtk_widget_set_tooltip_text(GTK_WIDGET(widget->input.entry[ENTRY_SRVCNAME]),_("Port or service name (empty for \"telnet\").") );
151 142
  143 + gtk_entry_set_max_length(widget->input.entry[ENTRY_HOSTNAME],0xFF);
  144 + gtk_entry_set_width_chars(widget->input.entry[ENTRY_HOSTNAME],50);
  145 +
  146 + gtk_entry_set_max_length(widget->input.entry[ENTRY_SRVCNAME],6);
  147 + gtk_entry_set_width_chars(widget->input.entry[ENTRY_SRVCNAME],7);
  148 +
  149 + gtk_entry_set_placeholder_text(widget->input.entry[ENTRY_SRVCNAME],"telnet");
  150 +
  151 + gtk_widget_set_hexpand(GTK_WIDGET(widget->input.entry[ENTRY_HOSTNAME]),TRUE);
  152 +
  153 + gtk_grid_attach(GTK_GRID(widget),label[0],0,0,1,1);
  154 + gtk_grid_attach(GTK_GRID(widget),GTK_WIDGET(widget->input.entry[ENTRY_HOSTNAME]),1,0,5,1);
  155 +
  156 + gtk_grid_attach(GTK_GRID(widget),label[1],0,1,1,1);
  157 + gtk_grid_attach(GTK_GRID(widget),GTK_WIDGET(widget->input.entry[ENTRY_SRVCNAME]),1,1,1,1);
  158 +
  159 + // gtk_widget_set_hexpand(GTK_WIDGET(widget->input.ssl),TRUE);
  160 +
152 // SSL checkbox 161 // SSL checkbox
153 - widget->input.ssl = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_mnemonic(_( "_Secure connection." )));  
154 - gtk_widget_set_tooltip_text(GTK_WIDGET(widget->input.ssl),_( "Check for SSL secure connection." )); 162 + {
  163 + widget->input.ssl = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_mnemonic(_( "_Secure connection." )));
  164 + gtk_widget_set_tooltip_text(GTK_WIDGET(widget->input.ssl),_( "Check for SSL secure connection." ));
155 165
156 - // Extended options  
157 - GtkWidget * expander = gtk_expander_new_with_mnemonic(_( "_Host options")); 166 + gtk_grid_attach(GTK_GRID(widget),GTK_WIDGET(widget->input.ssl),3,1,1,1);
  167 + }
158 168
159 // Host type 169 // Host type
160 { 170 {
@@ -199,49 +209,17 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) @@ -199,49 +209,17 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
199 209
200 } 210 }
201 211
202 - gtk_entry_set_max_length(widget->input.entry[ENTRY_HOSTNAME],0xFF);  
203 - gtk_entry_set_width_chars(widget->input.entry[ENTRY_HOSTNAME],50);  
204 -  
205 - gtk_entry_set_max_length(widget->input.entry[ENTRY_SRVCNAME],6);  
206 - gtk_entry_set_width_chars(widget->input.entry[ENTRY_SRVCNAME],7);  
207 -  
208 - gtk_entry_set_placeholder_text(widget->input.entry[ENTRY_SRVCNAME],"telnet");  
209 -  
210 - gtk_widget_set_hexpand(GTK_WIDGET(widget->input.entry[ENTRY_HOSTNAME]),TRUE);  
211 - gtk_widget_set_hexpand(GTK_WIDGET(widget->input.ssl),TRUE);  
212 - gtk_widget_set_hexpand(GTK_WIDGET(expander),TRUE);  
213 -  
214 -  
215 - gtk_grid_attach(grid,label[ENTRY_HOSTNAME],0,0,1,1);  
216 - gtk_grid_attach(grid,GTK_WIDGET(widget->input.entry[ENTRY_HOSTNAME]),1,0,3,1);  
217 -  
218 - gtk_grid_attach(grid,label[ENTRY_SRVCNAME],4,0,1,1);  
219 - gtk_grid_attach(grid,GTK_WIDGET(widget->input.entry[ENTRY_SRVCNAME]),5,0,1,1);  
220 -  
221 - gtk_grid_attach(grid,GTK_WIDGET(widget->input.ssl),1,1,3,1);  
222 -  
223 -  
224 // Host options 212 // Host options
  213 + for(f=0;f< (int) G_N_ELEMENTS(comboLabel);f++)
225 { 214 {
226 - GtkGrid *opt = GTK_GRID(gtk_grid_new());  
227 -  
228 - gtk_grid_set_column_spacing(opt,5);  
229 - gtk_grid_set_row_spacing(opt,5);  
230 -  
231 - for(f=0;f< (int) G_N_ELEMENTS(comboLabel);f++)  
232 - {  
233 - GtkWidget *label = gtk_label_new_with_mnemonic(gettext(comboLabel[f]));  
234 - gtk_widget_set_halign(label,GTK_ALIGN_START);  
235 - gtk_grid_attach(opt,label,0,f+1,1,1);  
236 - gtk_grid_attach(opt,GTK_WIDGET(widget->input.combo[f]),1,f+1,2,1);  
237 - }  
238 -  
239 - gtk_container_add(GTK_CONTAINER(expander),GTK_WIDGET(opt)); 215 + GtkWidget *label = gtk_label_new_with_mnemonic(gettext(comboLabel[f]));
  216 + gtk_widget_set_halign(label,GTK_ALIGN_START);
  217 + gtk_grid_attach(GTK_GRID(widget),label,0,f+2,1,1);
  218 + gtk_grid_attach(GTK_GRID(widget),GTK_WIDGET(widget->input.combo[f]),1,f+2,2,1);
240 } 219 }
241 - gtk_grid_attach(grid,GTK_WIDGET(expander),1,2,5,2);  
242 220
243 - gtk_widget_show_all(GTK_WIDGET(grid));  
244 - gtk_container_add(GTK_CONTAINER(widget),GTK_WIDGET(grid)); 221 + gtk_widget_show_all(GTK_WIDGET(widget));
  222 +
245 } 223 }
246 224
247 LIB3270_EXPORT GtkWidget * v3270_host_select_new(GtkWidget *widget) 225 LIB3270_EXPORT GtkWidget * v3270_host_select_new(GtkWidget *widget)