Commit 9e71aed818c72fe2ab0f80153865af3aa72c184f
1 parent
67274bb2
Exists in
master
and in
1 other branch
Adding property and setting option for the LU names list.
Showing
10 changed files
with
93 additions
and
14 deletions
Show diff stats
src/dialogs/hostselect.c
@@ -69,6 +69,7 @@ | @@ -69,6 +69,7 @@ | ||
69 | ENTRY_SRVCNAME, | 69 | ENTRY_SRVCNAME, |
70 | ENTRY_OVERSIZE, | 70 | ENTRY_OVERSIZE, |
71 | ENTRY_REMAP_FILE, | 71 | ENTRY_REMAP_FILE, |
72 | + ENTRY_LU_NAMES, | ||
72 | 73 | ||
73 | ENTRY_COUNT | 74 | ENTRY_COUNT |
74 | }; | 75 | }; |
@@ -228,7 +229,20 @@ | @@ -228,7 +229,20 @@ | ||
228 | .tooltip = N_("Path to XML file with custom charset mapping."), | 229 | .tooltip = N_("Path to XML file with custom charset mapping."), |
229 | .max_length = 0xFF, | 230 | .max_length = 0xFF, |
230 | .width_chars = 50, | 231 | .width_chars = 50, |
231 | - } | 232 | + }, |
233 | + | ||
234 | + { | ||
235 | + .left = 0, | ||
236 | + .top = 2, | ||
237 | + .width = 4, | ||
238 | + .height = 1, | ||
239 | + | ||
240 | + .label = N_( "L_U Names" ), | ||
241 | + .tooltip = N_("Comma separated list of LU names."), | ||
242 | + .max_length = 0xFF, | ||
243 | + .width_chars = 50, | ||
244 | + }, | ||
245 | + | ||
232 | 246 | ||
233 | }; | 247 | }; |
234 | 248 | ||
@@ -439,6 +453,11 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) | @@ -439,6 +453,11 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) | ||
439 | GTK_WIDGET(widget->input.entry[3]) | 453 | GTK_WIDGET(widget->input.entry[3]) |
440 | ); | 454 | ); |
441 | 455 | ||
456 | + v3270_grid_attach( | ||
457 | + GTK_GRID(connection), | ||
458 | + (struct v3270_entry_field *) & entryfields[4], | ||
459 | + GTK_WIDGET(widget->input.entry[4]) | ||
460 | + ); | ||
442 | 461 | ||
443 | } | 462 | } |
444 | 463 | ||
@@ -626,6 +645,9 @@ static void apply(GtkWidget *w, GtkWidget *terminal) | @@ -626,6 +645,9 @@ static void apply(GtkWidget *w, GtkWidget *terminal) | ||
626 | 645 | ||
627 | } | 646 | } |
628 | 647 | ||
648 | + // Apply LU names | ||
649 | + v3270_set_lunames(terminal,gtk_entry_get_text(widget->input.entry[ENTRY_LU_NAMES])); | ||
650 | + | ||
629 | // Apply combos. | 651 | // Apply combos. |
630 | size_t combo; | 652 | size_t combo; |
631 | for(combo = 0; combo < G_N_ELEMENTS(combos); combo++) | 653 | for(combo = 0; combo < G_N_ELEMENTS(combos); combo++) |
@@ -718,6 +740,10 @@ static void load(GtkWidget *w, GtkWidget *terminal) | @@ -718,6 +740,10 @@ static void load(GtkWidget *w, GtkWidget *terminal) | ||
718 | 740 | ||
719 | } | 741 | } |
720 | 742 | ||
743 | + // Load LU names | ||
744 | + g_autofree gchar * lunames = v3270_get_lunames(terminal); | ||
745 | + gtk_entry_set_text(widget->input.entry[ENTRY_LU_NAMES],lunames ? lunames : ""); | ||
746 | + | ||
721 | // Load unsigned int combos | 747 | // Load unsigned int combos |
722 | size_t combo; | 748 | size_t combo; |
723 | for(combo = 0; combo < G_N_ELEMENTS(combos); combo++) | 749 | for(combo = 0; combo < G_N_ELEMENTS(combos); combo++) |
src/include/internals.h
@@ -329,7 +329,7 @@ G_GNUC_INTERNAL void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned | @@ -329,7 +329,7 @@ G_GNUC_INTERNAL void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned | ||
329 | G_GNUC_INTERNAL gchar * v3270_translate_rgba_to_text(GdkRGBA *clr); | 329 | G_GNUC_INTERNAL gchar * v3270_translate_rgba_to_text(GdkRGBA *clr); |
330 | 330 | ||
331 | // Properties | 331 | // Properties |
332 | - G_GNUC_INTERNAL gboolean v3270_update_luname(v3270 *terminal); | 332 | + G_GNUC_INTERNAL gboolean v3270_update_associated_lu(v3270 *terminal); |
333 | G_GNUC_INTERNAL void v3270_update_toggle(GtkWidget *widget, LIB3270_TOGGLE_ID id, unsigned char value, const char *name); | 333 | G_GNUC_INTERNAL void v3270_update_toggle(GtkWidget *widget, LIB3270_TOGGLE_ID id, unsigned char value, const char *name); |
334 | 334 | ||
335 | G_END_DECLS | 335 | G_END_DECLS |
src/include/terminal.h
@@ -47,13 +47,14 @@ G_BEGIN_DECLS | @@ -47,13 +47,14 @@ G_BEGIN_DECLS | ||
47 | // Signal related properties | 47 | // Signal related properties |
48 | GParamSpec * online; | 48 | GParamSpec * online; |
49 | GParamSpec * url; | 49 | GParamSpec * url; |
50 | - GParamSpec * luname; | 50 | + GParamSpec * associated_lu; |
51 | GParamSpec * model; | 51 | GParamSpec * model; |
52 | GParamSpec * selection; | 52 | GParamSpec * selection; |
53 | GParamSpec * session_name; | 53 | GParamSpec * session_name; |
54 | GParamSpec * auto_disconnect; | 54 | GParamSpec * auto_disconnect; |
55 | GParamSpec * remap_file; | 55 | GParamSpec * remap_file; |
56 | GParamSpec * dynamic_spacing; | 56 | GParamSpec * dynamic_spacing; |
57 | + GParamSpec * lu_names; | ||
57 | 58 | ||
58 | struct | 59 | struct |
59 | { | 60 | { |
src/include/v3270.h
@@ -186,12 +186,16 @@ | @@ -186,12 +186,16 @@ | ||
186 | LIB3270_EXPORT int v3270_reconnect(GtkWidget *widget); | 186 | LIB3270_EXPORT int v3270_reconnect(GtkWidget *widget); |
187 | LIB3270_EXPORT void v3270_disconnect(GtkWidget *widget); | 187 | LIB3270_EXPORT void v3270_disconnect(GtkWidget *widget); |
188 | LIB3270_EXPORT int v3270_set_host_charset(GtkWidget *widget, const gchar *name); | 188 | LIB3270_EXPORT int v3270_set_host_charset(GtkWidget *widget, const gchar *name); |
189 | + | ||
189 | LIB3270_EXPORT void v3270_set_auto_disconnect(GtkWidget *widget, guint minutes); | 190 | LIB3270_EXPORT void v3270_set_auto_disconnect(GtkWidget *widget, guint minutes); |
190 | LIB3270_EXPORT guint v3270_get_auto_disconnect(GtkWidget *widget); | 191 | LIB3270_EXPORT guint v3270_get_auto_disconnect(GtkWidget *widget); |
191 | 192 | ||
192 | LIB3270_EXPORT void v3270_set_dynamic_font_spacing(GtkWidget *widget, gboolean state); | 193 | LIB3270_EXPORT void v3270_set_dynamic_font_spacing(GtkWidget *widget, gboolean state); |
193 | LIB3270_EXPORT gboolean v3270_get_dynamic_font_spacing(GtkWidget *widget); | 194 | LIB3270_EXPORT gboolean v3270_get_dynamic_font_spacing(GtkWidget *widget); |
194 | 195 | ||
196 | + LIB3270_EXPORT void v3270_set_lunames(GtkWidget *widget, const gchar *lunames); | ||
197 | + LIB3270_EXPORT gchar * v3270_get_lunames(GtkWidget *widget); | ||
198 | + | ||
195 | // Clipboard | 199 | // Clipboard |
196 | typedef enum _v3270_select_format | 200 | typedef enum _v3270_select_format |
197 | { | 201 | { |
src/terminal/callbacks.c
@@ -99,7 +99,7 @@ static void update_message(H3270 *session, G_GNUC_UNUSED LIB3270_MESSAGE id) | @@ -99,7 +99,7 @@ static void update_message(H3270 *session, G_GNUC_UNUSED LIB3270_MESSAGE id) | ||
99 | 99 | ||
100 | static void update_luname(H3270 *session, const char G_GNUC_UNUSED(*name)) | 100 | static void update_luname(H3270 *session, const char G_GNUC_UNUSED(*name)) |
101 | { | 101 | { |
102 | - g_idle_add((GSourceFunc) v3270_update_luname, lib3270_get_user_data(session)); | 102 | + g_idle_add((GSourceFunc) v3270_update_associated_lu, lib3270_get_user_data(session)); |
103 | } | 103 | } |
104 | 104 | ||
105 | static gboolean v3270_update_url(v3270 *terminal) | 105 | static gboolean v3270_update_url(v3270 *terminal) |
@@ -171,6 +171,7 @@ static void update_connect(H3270 *session, unsigned char connected) | @@ -171,6 +171,7 @@ static void update_connect(H3270 *session, unsigned char connected) | ||
171 | g_signal_emit(GTK_WIDGET(widget), v3270_widget_signal[V3270_SIGNAL_DISCONNECTED], 0); | 171 | g_signal_emit(GTK_WIDGET(widget), v3270_widget_signal[V3270_SIGNAL_DISCONNECTED], 0); |
172 | } | 172 | } |
173 | 173 | ||
174 | + debug("%s(%p)",__FUNCTION__,GTK_V3270_GET_CLASS(widget)->properties.online); | ||
174 | g_object_notify_by_pspec(G_OBJECT(widget), GTK_V3270_GET_CLASS(widget)->properties.online); | 175 | g_object_notify_by_pspec(G_OBJECT(widget), GTK_V3270_GET_CLASS(widget)->properties.online); |
175 | 176 | ||
176 | widget->activity.timestamp = time(0); | 177 | widget->activity.timestamp = time(0); |
@@ -191,7 +192,10 @@ static void update_screen_size(H3270 *session, G_GNUC_UNUSED unsigned short rows | @@ -191,7 +192,10 @@ static void update_screen_size(H3270 *session, G_GNUC_UNUSED unsigned short rows | ||
191 | static void update_model(H3270 *session, const char *name, int model, G_GNUC_UNUSED int rows, G_GNUC_UNUSED int cols) | 192 | static void update_model(H3270 *session, const char *name, int model, G_GNUC_UNUSED int rows, G_GNUC_UNUSED int cols) |
192 | { | 193 | { |
193 | GtkWidget * widget = GTK_WIDGET(lib3270_get_user_data(session)); | 194 | GtkWidget * widget = GTK_WIDGET(lib3270_get_user_data(session)); |
195 | + | ||
196 | + debug("%s(%p)",__FUNCTION__,GTK_V3270_GET_CLASS(widget)->properties.model); | ||
194 | g_object_notify_by_pspec(G_OBJECT(lib3270_get_user_data(session)), GTK_V3270_GET_CLASS(widget)->properties.model); | 197 | g_object_notify_by_pspec(G_OBJECT(lib3270_get_user_data(session)), GTK_V3270_GET_CLASS(widget)->properties.model); |
198 | + | ||
195 | g_signal_emit(widget,v3270_widget_signal[V3270_SIGNAL_MODEL_CHANGED], 0, (guint) model, name); | 199 | g_signal_emit(widget,v3270_widget_signal[V3270_SIGNAL_MODEL_CHANGED], 0, (guint) model, name); |
196 | } | 200 | } |
197 | 201 | ||
@@ -246,7 +250,9 @@ static void set_selection(H3270 *session, unsigned char status) | @@ -246,7 +250,9 @@ static void set_selection(H3270 *session, unsigned char status) | ||
246 | { | 250 | { |
247 | GtkWidget * widget = GTK_WIDGET(lib3270_get_user_data(session)); | 251 | GtkWidget * widget = GTK_WIDGET(lib3270_get_user_data(session)); |
248 | 252 | ||
253 | + debug("%s(%p)",__FUNCTION__,GTK_V3270_GET_CLASS(widget)->properties.selection); | ||
249 | g_object_notify_by_pspec(G_OBJECT(widget), GTK_V3270_GET_CLASS(widget)->properties.selection); | 254 | g_object_notify_by_pspec(G_OBJECT(widget), GTK_V3270_GET_CLASS(widget)->properties.selection); |
255 | + | ||
250 | g_signal_emit(widget,v3270_widget_signal[V3270_SIGNAL_SELECTING], 0, status ? TRUE : FALSE); | 256 | g_signal_emit(widget,v3270_widget_signal[V3270_SIGNAL_SELECTING], 0, status ? TRUE : FALSE); |
251 | 257 | ||
252 | } | 258 | } |
src/terminal/drawing/oia.c
@@ -694,7 +694,7 @@ cairo_t * v3270_oia_set_update_region(v3270 * terminal, GdkRectangle **r, V3270_ | @@ -694,7 +694,7 @@ cairo_t * v3270_oia_set_update_region(v3270 * terminal, GdkRectangle **r, V3270_ | ||
694 | return cr; | 694 | return cr; |
695 | } | 695 | } |
696 | 696 | ||
697 | -gboolean v3270_update_luname(v3270 *terminal) | 697 | +gboolean v3270_update_associated_lu(v3270 *terminal) |
698 | { | 698 | { |
699 | if(terminal->surface) | 699 | if(terminal->surface) |
700 | { | 700 | { |
@@ -713,7 +713,8 @@ gboolean v3270_update_luname(v3270 *terminal) | @@ -713,7 +713,8 @@ gboolean v3270_update_luname(v3270 *terminal) | ||
713 | v3270_queue_draw_area(GTK_WIDGET(terminal),rect->x,rect->y,rect->width,rect->height); | 713 | v3270_queue_draw_area(GTK_WIDGET(terminal),rect->x,rect->y,rect->width,rect->height); |
714 | } | 714 | } |
715 | 715 | ||
716 | - g_object_notify_by_pspec(G_OBJECT(terminal), GTK_V3270_GET_CLASS(terminal)->properties.luname); | 716 | + debug("%s(%p)",__FUNCTION__,GTK_V3270_GET_CLASS(terminal)->properties.associated_lu); |
717 | + g_object_notify_by_pspec(G_OBJECT(terminal), GTK_V3270_GET_CLASS(terminal)->properties.associated_lu); | ||
717 | 718 | ||
718 | return FALSE; | 719 | return FALSE; |
719 | } | 720 | } |
src/terminal/properties/get.c
@@ -108,6 +108,10 @@ | @@ -108,6 +108,10 @@ | ||
108 | g_value_set_boolean(value,v3270_get_dynamic_font_spacing(GTK_WIDGET(object))); | 108 | g_value_set_boolean(value,v3270_get_dynamic_font_spacing(GTK_WIDGET(object))); |
109 | break; | 109 | break; |
110 | 110 | ||
111 | + case V3270_PROPERTY_LU_NAMES: | ||
112 | + g_value_take_string(value,v3270_get_lunames(GTK_WIDGET(object))); | ||
113 | + break; | ||
114 | + | ||
111 | default: | 115 | default: |
112 | G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); | 116 | G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); |
113 | 117 | ||
@@ -182,5 +186,15 @@ LIB3270_EXPORT guint v3270_get_auto_disconnect(GtkWidget *widget) | @@ -182,5 +186,15 @@ LIB3270_EXPORT guint v3270_get_auto_disconnect(GtkWidget *widget) | ||
182 | return GTK_V3270(widget)->activity.disconnect; | 186 | return GTK_V3270(widget)->activity.disconnect; |
183 | } | 187 | } |
184 | 188 | ||
189 | +LIB3270_EXPORT gchar * v3270_get_lunames(GtkWidget *widget) | ||
190 | +{ | ||
191 | + g_return_val_if_fail(GTK_IS_V3270(widget),NULL); | ||
185 | 192 | ||
193 | + const char ** lunames = lib3270_get_lunames(GTK_V3270(widget)->host); | ||
194 | + | ||
195 | + if(!lunames) | ||
196 | + return NULL; | ||
197 | + | ||
198 | + return g_strjoinv(",",(gchar **) lunames); | ||
199 | +} | ||
186 | 200 |
src/terminal/properties/init.c
@@ -40,16 +40,16 @@ | @@ -40,16 +40,16 @@ | ||
40 | const char *name; | 40 | const char *name; |
41 | GParamSpec **prop; | 41 | GParamSpec **prop; |
42 | } properties[] = { | 42 | } properties[] = { |
43 | - { "connected", &klass->properties.online }, | ||
44 | - { "luname", &klass->properties.luname }, | ||
45 | - { "url", &klass->properties.url }, | ||
46 | - { "model", &klass->properties.model }, | ||
47 | - { "has-selection", &klass->properties.selection }, | 43 | + { "connected", &klass->properties.online }, |
44 | + { "associated_lu", &klass->properties.associated_lu }, | ||
45 | + { "url", &klass->properties.url }, | ||
46 | + { "model", &klass->properties.model }, | ||
47 | + { "has_selection", &klass->properties.selection }, | ||
48 | }; | 48 | }; |
49 | 49 | ||
50 | size_t ix; | 50 | size_t ix; |
51 | 51 | ||
52 | -// debug("Property %s=%u",g_param_spec_get_name(pspec),(unsigned int) property_id); | 52 | + debug("Property %s=%u",g_param_spec_get_name(pspec),(unsigned int) property_id); |
53 | g_object_class_install_property(oclass, property_id, pspec); | 53 | g_object_class_install_property(oclass, property_id, pspec); |
54 | 54 | ||
55 | for(ix = 0; ix < G_N_ELEMENTS(properties); ix++) | 55 | for(ix = 0; ix < G_N_ELEMENTS(properties); ix++) |
@@ -166,6 +166,21 @@ | @@ -166,6 +166,21 @@ | ||
166 | klass->properties.dynamic_spacing | 166 | klass->properties.dynamic_spacing |
167 | ); | 167 | ); |
168 | 168 | ||
169 | + // Lu names | ||
170 | + klass->properties.lu_names = g_param_spec_string( | ||
171 | + "lu_names", | ||
172 | + "lu_names", | ||
173 | + _("Comma separated list of LU names"), | ||
174 | + FALSE, | ||
175 | + G_PARAM_READABLE|G_PARAM_WRITABLE | ||
176 | + ); | ||
177 | + | ||
178 | + g_object_class_install_property( | ||
179 | + gobject_class, | ||
180 | + V3270_PROPERTY_LU_NAMES, | ||
181 | + klass->properties.lu_names | ||
182 | + ); | ||
183 | + | ||
169 | 184 | ||
170 | // | 185 | // |
171 | // Create dynamic properties | 186 | // Create dynamic properties |
src/terminal/properties/private.h
@@ -54,9 +54,10 @@ | @@ -54,9 +54,10 @@ | ||
54 | V3270_PROPERTY_AUTO_DISCONNECT = 5, ///< @brief Auto disconnect. | 54 | V3270_PROPERTY_AUTO_DISCONNECT = 5, ///< @brief Auto disconnect. |
55 | V3270_PROPERTY_REMAP_FILE = 6, ///< @brief Path of the remap file. | 55 | V3270_PROPERTY_REMAP_FILE = 6, ///< @brief Path of the remap file. |
56 | V3270_PROPERTY_DYNAMIC_SPACING = 7, ///< @brief Toggle dynamic font spacing. | 56 | V3270_PROPERTY_DYNAMIC_SPACING = 7, ///< @brief Toggle dynamic font spacing. |
57 | + V3270_PROPERTY_LU_NAMES = 8, ///< @brief The LU names list. | ||
57 | 58 | ||
58 | 59 | ||
59 | - V3270_PROPERTY_DYNAMIC = 8 ///< @brief Id of the first LIB3270 internal property. | 60 | + V3270_PROPERTY_DYNAMIC = 9 ///< @brief Id of the first LIB3270 internal property. |
60 | }; | 61 | }; |
61 | 62 | ||
62 | G_GNUC_INTERNAL void v3270_get_property(GObject *object,guint prop_id, GValue *value, GParamSpec *pspec); | 63 | G_GNUC_INTERNAL void v3270_get_property(GObject *object,guint prop_id, GValue *value, GParamSpec *pspec); |
src/terminal/properties/set.c
@@ -126,6 +126,10 @@ | @@ -126,6 +126,10 @@ | ||
126 | v3270_set_dynamic_font_spacing(GTK_WIDGET(object), g_value_get_boolean(value)); | 126 | v3270_set_dynamic_font_spacing(GTK_WIDGET(object), g_value_get_boolean(value)); |
127 | break; | 127 | break; |
128 | 128 | ||
129 | + case V3270_PROPERTY_LU_NAMES: | ||
130 | + v3270_set_lunames(GTK_WIDGET(object),g_value_get_string(value)); | ||
131 | + break; | ||
132 | + | ||
129 | default: | 133 | default: |
130 | G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); | 134 | G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); |
131 | 135 | ||
@@ -215,7 +219,8 @@ LIB3270_EXPORT void v3270_set_auto_disconnect(GtkWidget *widget, guint minutes) | @@ -215,7 +219,8 @@ LIB3270_EXPORT void v3270_set_auto_disconnect(GtkWidget *widget, guint minutes) | ||
215 | 219 | ||
216 | } | 220 | } |
217 | 221 | ||
218 | -LIB3270_EXPORT void v3270_set_dynamic_font_spacing(GtkWidget *widget, gboolean state) { | 222 | +LIB3270_EXPORT void v3270_set_dynamic_font_spacing(GtkWidget *widget, gboolean state) |
223 | +{ | ||
219 | 224 | ||
220 | g_return_if_fail(GTK_IS_V3270(widget)); | 225 | g_return_if_fail(GTK_IS_V3270(widget)); |
221 | 226 | ||
@@ -231,4 +236,10 @@ LIB3270_EXPORT void v3270_set_dynamic_font_spacing(GtkWidget *widget, gboolean s | @@ -231,4 +236,10 @@ LIB3270_EXPORT void v3270_set_dynamic_font_spacing(GtkWidget *widget, gboolean s | ||
231 | 236 | ||
232 | } | 237 | } |
233 | 238 | ||
239 | +LIB3270_EXPORT void v3270_set_lunames(GtkWidget *widget, const gchar *lunames) | ||
240 | +{ | ||
241 | + g_return_if_fail(GTK_IS_V3270(widget)); | ||
242 | + lib3270_set_lunames(GTK_V3270(widget)->host,(lunames && *lunames ? lunames : NULL)); | ||
243 | + g_object_notify_by_pspec(G_OBJECT(widget), GTK_V3270_GET_CLASS(widget)->properties.lu_names); | ||
244 | +} | ||
234 | 245 |