Commit 3d6f9f7ba5fb42126c516f67cc02e10431010df3
1 parent
44977a0a
Exists in
master
and in
5 other branches
Separando fontes para tratamento das propriedades do widget, convertendo luname numa propriedade
Showing
7 changed files
with
185 additions
and
134 deletions
Show diff stats
pw3270.cbp
| @@ -435,6 +435,9 @@ | @@ -435,6 +435,9 @@ | ||
| 435 | <Option compilerVar="CC" /> | 435 | <Option compilerVar="CC" /> |
| 436 | </Unit> | 436 | </Unit> |
| 437 | <Unit filename="src/pw3270/v3270/private.h" /> | 437 | <Unit filename="src/pw3270/v3270/private.h" /> |
| 438 | + <Unit filename="src/pw3270/v3270/properties.c"> | ||
| 439 | + <Option compilerVar="CC" /> | ||
| 440 | + </Unit> | ||
| 438 | <Unit filename="src/pw3270/v3270/security.c"> | 441 | <Unit filename="src/pw3270/v3270/security.c"> |
| 439 | <Option compilerVar="CC" /> | 442 | <Option compilerVar="CC" /> |
| 440 | </Unit> | 443 | </Unit> |
src/lib3270/ctlr.c
| @@ -39,6 +39,7 @@ | @@ -39,6 +39,7 @@ | ||
| 39 | 39 | ||
| 40 | #include "globals.h" | 40 | #include "globals.h" |
| 41 | #include <errno.h> | 41 | #include <errno.h> |
| 42 | +#include <stdlib.h> | ||
| 42 | #include "3270ds.h" | 43 | #include "3270ds.h" |
| 43 | //#include "appres.h" | 44 | //#include "appres.h" |
| 44 | // #include "ctlr.h" | 45 | // #include "ctlr.h" |
src/pw3270/v3270/oia.c
| @@ -647,22 +647,29 @@ void v3270_update_luname(GtkWidget *widget,const gchar *name) | @@ -647,22 +647,29 @@ void v3270_update_luname(GtkWidget *widget,const gchar *name) | ||
| 647 | GdkRectangle * rect; | 647 | GdkRectangle * rect; |
| 648 | v3270 * terminal = GTK_V3270(widget); | 648 | v3270 * terminal = GTK_V3270(widget); |
| 649 | 649 | ||
| 650 | - if(!terminal->surface) | ||
| 651 | - return; | 650 | + if(terminal->surface) |
| 651 | + { | ||
| 652 | + cr = set_update_region(terminal,&rect,V3270_OIA_LUNAME); | ||
| 652 | 653 | ||
| 653 | - cr = set_update_region(terminal,&rect,V3270_OIA_LUNAME); | 654 | + if(name) |
| 655 | + { | ||
| 656 | + cairo_move_to(cr,rect->x,rect->y+terminal->metrics.height); | ||
| 657 | + gdk_cairo_set_source_rgba(cr,terminal->color+V3270_COLOR_OIA_LUNAME); | ||
| 658 | + cairo_show_text(cr,name); | ||
| 659 | + cairo_stroke(cr); | ||
| 660 | + } | ||
| 654 | 661 | ||
| 655 | - if(name) | ||
| 656 | - { | ||
| 657 | - cairo_move_to(cr,rect->x,rect->y+terminal->metrics.height); | ||
| 658 | - gdk_cairo_set_source_rgba(cr,terminal->color+V3270_COLOR_OIA_LUNAME); | ||
| 659 | - cairo_show_text(cr,name); | ||
| 660 | - cairo_stroke(cr); | 662 | + cairo_destroy(cr); |
| 663 | + | ||
| 664 | + gtk_widget_queue_draw_area(GTK_WIDGET(terminal),rect->x,rect->y,rect->width,rect->height); | ||
| 661 | } | 665 | } |
| 662 | 666 | ||
| 663 | - cairo_destroy(cr); | 667 | +#if GTK_CHECK_VERSION(2,26,0) |
| 668 | + g_object_notify_by_pspec(G_OBJECT(widget), v3270_properties[PROP_LUNAME]); | ||
| 669 | +#else | ||
| 670 | + g_object_notify(G_OBJECT(widget),"luname"); | ||
| 671 | +#endif // GTK_CHECK_VERSION | ||
| 664 | 672 | ||
| 665 | - gtk_widget_queue_draw_area(GTK_WIDGET(terminal),rect->x,rect->y,rect->width,rect->height); | ||
| 666 | } | 673 | } |
| 667 | 674 | ||
| 668 | void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id) | 675 | void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id) |
src/pw3270/v3270/private.h
| @@ -51,7 +51,6 @@ G_BEGIN_DECLS | @@ -51,7 +51,6 @@ G_BEGIN_DECLS | ||
| 51 | void (*activate)(GtkWidget *widget); | 51 | void (*activate)(GtkWidget *widget); |
| 52 | void (*toggle_changed)(v3270 *widget,LIB3270_TOGGLE toggle_id,gboolean toggle_state,const gchar *toggle_name); | 52 | void (*toggle_changed)(v3270 *widget,LIB3270_TOGGLE toggle_id,gboolean toggle_state,const gchar *toggle_name); |
| 53 | void (*message_changed)(v3270 *widget, LIB3270_MESSAGE id); | 53 | void (*message_changed)(v3270 *widget, LIB3270_MESSAGE id); |
| 54 | - void (*luname_changed)(GtkWidget *widget,const gchar *luname); | ||
| 55 | void (*popup_message)(GtkWidget *widget, LIB3270_NOTIFY id , const gchar *title, const gchar *message, const gchar *text); | 54 | void (*popup_message)(GtkWidget *widget, LIB3270_NOTIFY id , const gchar *title, const gchar *message, const gchar *text); |
| 56 | gboolean (*keypress)(GtkWidget *widget,guint keyval,GdkModifierType state); | 55 | gboolean (*keypress)(GtkWidget *widget,guint keyval,GdkModifierType state); |
| 57 | 56 | ||
| @@ -71,7 +70,6 @@ G_BEGIN_DECLS | @@ -71,7 +70,6 @@ G_BEGIN_DECLS | ||
| 71 | { | 70 | { |
| 72 | SIGNAL_TOGGLE_CHANGED, | 71 | SIGNAL_TOGGLE_CHANGED, |
| 73 | SIGNAL_MESSAGE_CHANGED, | 72 | SIGNAL_MESSAGE_CHANGED, |
| 74 | - SIGNAL_LUNAME_CHANGED, | ||
| 75 | SIGNAL_KEYPRESS, | 73 | SIGNAL_KEYPRESS, |
| 76 | SIGNAL_CONNECTED, | 74 | SIGNAL_CONNECTED, |
| 77 | SIGNAL_DISCONNECTED, | 75 | SIGNAL_DISCONNECTED, |
| @@ -211,11 +209,34 @@ G_BEGIN_DECLS | @@ -211,11 +209,34 @@ G_BEGIN_DECLS | ||
| 211 | 209 | ||
| 212 | }; | 210 | }; |
| 213 | 211 | ||
| 212 | +/*--[ Properties ]-----------------------------------------------------------------------------------*/ | ||
| 213 | + | ||
| 214 | + enum | ||
| 215 | + { | ||
| 216 | + PROP_0, | ||
| 217 | + | ||
| 218 | + /* Construct */ | ||
| 219 | + PROP_TYPE, | ||
| 220 | + | ||
| 221 | + | ||
| 222 | + /* Widget properties */ | ||
| 223 | + PROP_ONLINE, | ||
| 224 | + PROP_SELECTION, | ||
| 225 | + PROP_MODEL, | ||
| 226 | + PROP_LUNAME, | ||
| 227 | + | ||
| 228 | + /* Toggles - always the last one, the real values are PROP_TOGGLE+LIB3270_TOGGLE */ | ||
| 229 | + PROP_TOGGLE | ||
| 230 | + }; | ||
| 231 | + | ||
| 232 | + #define PROP_LAST (PROP_TOGGLE+LIB3270_TOGGLE_COUNT) | ||
| 233 | + | ||
| 234 | + | ||
| 214 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ | 235 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
| 215 | 236 | ||
| 216 | G_GNUC_INTERNAL guint v3270_widget_signal[LAST_SIGNAL]; | 237 | G_GNUC_INTERNAL guint v3270_widget_signal[LAST_SIGNAL]; |
| 217 | G_GNUC_INTERNAL GdkCursor * v3270_cursor[V3270_CURSOR_COUNT]; | 238 | G_GNUC_INTERNAL GdkCursor * v3270_cursor[V3270_CURSOR_COUNT]; |
| 218 | - | 239 | + G_GNUC_INTERNAL GParamSpec * v3270_properties[PROP_LAST]; |
| 219 | 240 | ||
| 220 | /*--[ Prototipes ]-----------------------------------------------------------------------------------*/ | 241 | /*--[ Prototipes ]-----------------------------------------------------------------------------------*/ |
| 221 | 242 | ||
| @@ -271,12 +292,13 @@ void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int h | @@ -271,12 +292,13 @@ void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int h | ||
| 271 | 292 | ||
| 272 | void v3270_update_cursor_rect(v3270 *widget, GdkRectangle *rect, unsigned char chr, unsigned short attr); | 293 | void v3270_update_cursor_rect(v3270 *widget, GdkRectangle *rect, unsigned char chr, unsigned short attr); |
| 273 | 294 | ||
| 274 | -void v3270_update_luname(GtkWidget *widget,const gchar *name); | ||
| 275 | void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id); | 295 | void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id); |
| 276 | void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr); | 296 | void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr); |
| 277 | void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on); | 297 | void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on); |
| 278 | void v3270_update_ssl(H3270 *session, LIB3270_SSL_STATE state); | 298 | void v3270_update_ssl(H3270 *session, LIB3270_SSL_STATE state); |
| 279 | 299 | ||
| 300 | +G_GNUC_INTERNAL void v3270_update_luname(GtkWidget *widget,const gchar *name); | ||
| 301 | + | ||
| 280 | // Keyboard & Mouse | 302 | // Keyboard & Mouse |
| 281 | gboolean v3270_key_press_event(GtkWidget *widget, GdkEventKey *event); | 303 | gboolean v3270_key_press_event(GtkWidget *widget, GdkEventKey *event); |
| 282 | gboolean v3270_key_release_event(GtkWidget *widget, GdkEventKey *event); | 304 | gboolean v3270_key_release_event(GtkWidget *widget, GdkEventKey *event); |
| @@ -0,0 +1,133 @@ | @@ -0,0 +1,133 @@ | ||
| 1 | +/* | ||
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | ||
| 5 | + * | ||
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
| 7 | + * | ||
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
| 10 | + * Free Software Foundation. | ||
| 11 | + * | ||
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
| 15 | + * obter mais detalhes. | ||
| 16 | + * | ||
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | + * | ||
| 21 | + * Este programa está nomeado como properties.c e possui - linhas de código. | ||
| 22 | + * | ||
| 23 | + * Contatos: | ||
| 24 | + * | ||
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
| 26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
| 27 | + * | ||
| 28 | + */ | ||
| 29 | + | ||
| 30 | + #include <gtk/gtk.h> | ||
| 31 | + #include <lib3270.h> | ||
| 32 | + #include <lib3270/session.h> | ||
| 33 | + #include <lib3270/actions.h> | ||
| 34 | + #include <lib3270/log.h> | ||
| 35 | + #include <lib3270/macros.h> | ||
| 36 | + #include <errno.h> | ||
| 37 | + #include <pw3270/v3270.h> | ||
| 38 | + #include "private.h" | ||
| 39 | + | ||
| 40 | +/*--[ Globals ]--------------------------------------------------------------------------------------*/ | ||
| 41 | + | ||
| 42 | + GParamSpec * v3270_properties[PROP_LAST] = { 0 }; | ||
| 43 | + | ||
| 44 | +/*--[ Implement ]------------------------------------------------------------------------------------*/ | ||
| 45 | + | ||
| 46 | + static void v3270_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) | ||
| 47 | + { | ||
| 48 | + v3270 *window = GTK_V3270(object); | ||
| 49 | + | ||
| 50 | + switch (prop_id) | ||
| 51 | + { | ||
| 52 | + case PROP_MODEL: | ||
| 53 | + lib3270_set_model(window->host,g_value_get_string(value)); | ||
| 54 | + break; | ||
| 55 | + | ||
| 56 | + default: | ||
| 57 | + if(prop_id < (PROP_TOGGLE + LIB3270_TOGGLE_COUNT)) | ||
| 58 | + { | ||
| 59 | + lib3270_set_toggle(window->host,prop_id - PROP_TOGGLE, (int) g_value_get_boolean (value)); | ||
| 60 | + return; | ||
| 61 | + } | ||
| 62 | + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + static void v3270_get_property(GObject *object,guint prop_id, GValue *value, GParamSpec *pspec) | ||
| 68 | + { | ||
| 69 | + v3270 *window = GTK_V3270(object); | ||
| 70 | + | ||
| 71 | + switch (prop_id) | ||
| 72 | + { | ||
| 73 | + case PROP_MODEL: | ||
| 74 | + g_value_set_string(value,lib3270_get_model(window->host)); | ||
| 75 | + break; | ||
| 76 | + | ||
| 77 | + case PROP_LUNAME: | ||
| 78 | + g_value_set_string(value,lib3270_get_luname(window->host)); | ||
| 79 | + break; | ||
| 80 | + | ||
| 81 | + case PROP_ONLINE: | ||
| 82 | + g_value_set_boolean(value,lib3270_is_connected(window->host) ? TRUE : FALSE ); | ||
| 83 | + break; | ||
| 84 | + | ||
| 85 | + case PROP_SELECTION: | ||
| 86 | + g_value_set_boolean(value,lib3270_has_selection(window->host) ? TRUE : FALSE ); | ||
| 87 | + break; | ||
| 88 | + | ||
| 89 | + default: | ||
| 90 | + if(prop_id < (PROP_TOGGLE + LIB3270_TOGGLE_COUNT)) | ||
| 91 | + { | ||
| 92 | + g_value_set_boolean(value,lib3270_get_toggle(window->host,prop_id - PROP_TOGGLE) ? TRUE : FALSE ); | ||
| 93 | + return; | ||
| 94 | + } | ||
| 95 | + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + void v3270_init_properties(GObjectClass * gobject_class) | ||
| 100 | + { | ||
| 101 | + gobject_class->set_property = v3270_set_property; | ||
| 102 | + gobject_class->get_property = v3270_get_property; | ||
| 103 | + | ||
| 104 | + v3270_properties[PROP_ONLINE] = g_param_spec_boolean( | ||
| 105 | + "online", | ||
| 106 | + "online", | ||
| 107 | + "True if is online", | ||
| 108 | + FALSE,G_PARAM_READABLE); | ||
| 109 | + g_object_class_install_property(gobject_class,PROP_ONLINE,v3270_properties[PROP_ONLINE]); | ||
| 110 | + | ||
| 111 | + v3270_properties[PROP_SELECTION] = g_param_spec_boolean( | ||
| 112 | + "selection", | ||
| 113 | + "selection", | ||
| 114 | + "True on selected area", | ||
| 115 | + FALSE,G_PARAM_READABLE); | ||
| 116 | + g_object_class_install_property(gobject_class,PROP_SELECTION,v3270_properties[PROP_SELECTION]); | ||
| 117 | + | ||
| 118 | + v3270_properties[PROP_MODEL] = g_param_spec_string( | ||
| 119 | + "model", | ||
| 120 | + "model", | ||
| 121 | + "The model of 3270 display to be emulated", | ||
| 122 | + FALSE,G_PARAM_READABLE|G_PARAM_WRITABLE); | ||
| 123 | + g_object_class_install_property(gobject_class,PROP_MODEL,v3270_properties[PROP_MODEL]); | ||
| 124 | + | ||
| 125 | + // Toggle properties | ||
| 126 | + int f; | ||
| 127 | + | ||
| 128 | + for(f=0;f<LIB3270_TOGGLE_COUNT;f++) | ||
| 129 | + { | ||
| 130 | + v3270_properties[PROP_TOGGLE+f] = g_param_spec_boolean(lib3270_get_toggle_name(f),lib3270_get_toggle_name(f),lib3270_get_toggle_description(f),FALSE,G_PARAM_WRITABLE|G_PARAM_READABLE); | ||
| 131 | + g_object_class_install_property(gobject_class,PROP_TOGGLE+f,v3270_properties[PROP_TOGGLE+f]); | ||
| 132 | + } | ||
| 133 | + } |
src/pw3270/v3270/sources.mak
| @@ -27,5 +27,5 @@ | @@ -27,5 +27,5 @@ | ||
| 27 | # | 27 | # |
| 28 | 28 | ||
| 29 | V3270_SRC=marshal.c widget.c oia.c iocallback.c keyboard.c draw.c mouse.c selection.c \ | 29 | V3270_SRC=marshal.c widget.c oia.c iocallback.c keyboard.c draw.c mouse.c selection.c \ |
| 30 | - accessible.c security.c macros.c hostselect.c | 30 | + accessible.c security.c macros.c hostselect.c properties.c |
| 31 | 31 |
src/pw3270/v3270/widget.c
| @@ -68,38 +68,15 @@ | @@ -68,38 +68,15 @@ | ||
| 68 | 68 | ||
| 69 | /*--[ Widget definition ]----------------------------------------------------------------------------*/ | 69 | /*--[ Widget definition ]----------------------------------------------------------------------------*/ |
| 70 | 70 | ||
| 71 | - enum | ||
| 72 | - { | ||
| 73 | - PROP_0, | ||
| 74 | - | ||
| 75 | - /* Construct */ | ||
| 76 | - PROP_TYPE, | ||
| 77 | - | ||
| 78 | - | ||
| 79 | - /* Widget properties */ | ||
| 80 | - PROP_ONLINE, | ||
| 81 | - PROP_SELECTION, | ||
| 82 | - PROP_MODEL, | ||
| 83 | - | ||
| 84 | - /* Toggles - always the last one, the real values are PROP_TOGGLE+LIB3270_TOGGLE */ | ||
| 85 | - PROP_TOGGLE | ||
| 86 | - }; | ||
| 87 | - | ||
| 88 | - #define PROP_LAST (PROP_TOGGLE+LIB3270_TOGGLE_COUNT) | ||
| 89 | - | ||
| 90 | G_DEFINE_TYPE(v3270, v3270, GTK_TYPE_WIDGET); | 71 | G_DEFINE_TYPE(v3270, v3270, GTK_TYPE_WIDGET); |
| 91 | 72 | ||
| 92 | -/*--[ Globals ]----------LIB3270_TOGGLE_COUNT----------------------------------------------------------------------------*/ | 73 | +/*--[ Globals ]--------------------------------------------------------------------------------------*/ |
| 93 | 74 | ||
| 94 | guint v3270_widget_signal[LAST_SIGNAL] = { 0 }; | 75 | guint v3270_widget_signal[LAST_SIGNAL] = { 0 }; |
| 95 | GdkCursor * v3270_cursor[V3270_CURSOR_COUNT] = { 0 }; | 76 | GdkCursor * v3270_cursor[V3270_CURSOR_COUNT] = { 0 }; |
| 96 | 77 | ||
| 97 | - static GParamSpec * v3270_properties[PROP_LAST] = { 0 }; | ||
| 98 | - | ||
| 99 | /*--[ Prototipes ]-----------------------------------------------------------------------------------*/ | 78 | /*--[ Prototipes ]-----------------------------------------------------------------------------------*/ |
| 100 | 79 | ||
| 101 | - // http://git.gnome.org/browse/gtk+/tree/gtk/gtkdrawingarea.c?h=gtk-3-0 | ||
| 102 | - | ||
| 103 | static void v3270_realize ( GtkWidget * widget) ; | 80 | static void v3270_realize ( GtkWidget * widget) ; |
| 104 | static void v3270_size_allocate ( GtkWidget * widget, | 81 | static void v3270_size_allocate ( GtkWidget * widget, |
| 105 | GtkAllocation * allocation ); | 82 | GtkAllocation * allocation ); |
| @@ -337,55 +314,6 @@ gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboa | @@ -337,55 +314,6 @@ gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboa | ||
| 337 | return FALSE; | 314 | return FALSE; |
| 338 | } | 315 | } |
| 339 | 316 | ||
| 340 | -static void v3270_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) | ||
| 341 | -{ | ||
| 342 | - v3270 *window = GTK_V3270(object); | ||
| 343 | - | ||
| 344 | - switch (prop_id) | ||
| 345 | - { | ||
| 346 | - case PROP_MODEL: | ||
| 347 | - lib3270_set_model(window->host,g_value_get_string(value)); | ||
| 348 | - break; | ||
| 349 | - | ||
| 350 | - default: | ||
| 351 | - if(prop_id < (PROP_TOGGLE + LIB3270_TOGGLE_COUNT)) | ||
| 352 | - { | ||
| 353 | - lib3270_set_toggle(window->host,prop_id - PROP_TOGGLE, (int) g_value_get_boolean (value)); | ||
| 354 | - return; | ||
| 355 | - } | ||
| 356 | - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
| 357 | - } | ||
| 358 | - | ||
| 359 | -} | ||
| 360 | - | ||
| 361 | -static void v3270_get_property(GObject *object,guint prop_id, GValue *value, GParamSpec *pspec) | ||
| 362 | -{ | ||
| 363 | - v3270 *window = GTK_V3270(object); | ||
| 364 | - | ||
| 365 | - switch (prop_id) | ||
| 366 | - { | ||
| 367 | - case PROP_MODEL: | ||
| 368 | - g_value_set_string(value,lib3270_get_model(window->host)); | ||
| 369 | - break; | ||
| 370 | - | ||
| 371 | - case PROP_ONLINE: | ||
| 372 | - g_value_set_boolean(value,lib3270_is_connected(window->host) ? TRUE : FALSE ); | ||
| 373 | - break; | ||
| 374 | - | ||
| 375 | - case PROP_SELECTION: | ||
| 376 | - g_value_set_boolean(value,lib3270_has_selection(window->host) ? TRUE : FALSE ); | ||
| 377 | - break; | ||
| 378 | - | ||
| 379 | - default: | ||
| 380 | - if(prop_id < (PROP_TOGGLE + LIB3270_TOGGLE_COUNT)) | ||
| 381 | - { | ||
| 382 | - g_value_set_boolean(value,lib3270_get_toggle(window->host,prop_id - PROP_TOGGLE) ? TRUE : FALSE ); | ||
| 383 | - return; | ||
| 384 | - } | ||
| 385 | - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
| 386 | - } | ||
| 387 | -} | ||
| 388 | - | ||
| 389 | static void v3270_class_init(v3270Class *klass) | 317 | static void v3270_class_init(v3270Class *klass) |
| 390 | { | 318 | { |
| 391 | GObjectClass * gobject_class = G_OBJECT_CLASS(klass); | 319 | GObjectClass * gobject_class = G_OBJECT_CLASS(klass); |
| @@ -416,7 +344,6 @@ static void v3270_class_init(v3270Class *klass) | @@ -416,7 +344,6 @@ static void v3270_class_init(v3270Class *klass) | ||
| 416 | klass->activate = v3270_activate; | 344 | klass->activate = v3270_activate; |
| 417 | klass->toggle_changed = v3270_toggle_changed; | 345 | klass->toggle_changed = v3270_toggle_changed; |
| 418 | klass->message_changed = v3270_update_message; | 346 | klass->message_changed = v3270_update_message; |
| 419 | - klass->luname_changed = v3270_update_luname; | ||
| 420 | klass->popup_message = v3270_popup_message; | 347 | klass->popup_message = v3270_popup_message; |
| 421 | 348 | ||
| 422 | #if GTK_CHECK_VERSION(3,0,0) | 349 | #if GTK_CHECK_VERSION(3,0,0) |
| @@ -524,15 +451,6 @@ static void v3270_class_init(v3270Class *klass) | @@ -524,15 +451,6 @@ static void v3270_class_init(v3270Class *klass) | ||
| 524 | v3270_VOID__VOID_ENUM, | 451 | v3270_VOID__VOID_ENUM, |
| 525 | G_TYPE_NONE, 1, G_TYPE_UINT); | 452 | G_TYPE_NONE, 1, G_TYPE_UINT); |
| 526 | 453 | ||
| 527 | - v3270_widget_signal[SIGNAL_LUNAME_CHANGED] = | ||
| 528 | - g_signal_new( "luname_changed", | ||
| 529 | - G_OBJECT_CLASS_TYPE (gobject_class), | ||
| 530 | - G_SIGNAL_RUN_FIRST, | ||
| 531 | - G_STRUCT_OFFSET (v3270Class, luname_changed), | ||
| 532 | - NULL, NULL, | ||
| 533 | - v3270_VOID__VOID_POINTER, | ||
| 534 | - G_TYPE_NONE, 1, G_TYPE_STRING); | ||
| 535 | - | ||
| 536 | v3270_widget_signal[SIGNAL_KEYPRESS] = | 454 | v3270_widget_signal[SIGNAL_KEYPRESS] = |
| 537 | g_signal_new( "keypress", | 455 | g_signal_new( "keypress", |
| 538 | G_OBJECT_CLASS_TYPE (gobject_class), | 456 | G_OBJECT_CLASS_TYPE (gobject_class), |
| @@ -651,40 +569,7 @@ static void v3270_class_init(v3270Class *klass) | @@ -651,40 +569,7 @@ static void v3270_class_init(v3270Class *klass) | ||
| 651 | v3270_VOID__VOID, | 569 | v3270_VOID__VOID, |
| 652 | G_TYPE_NONE, 0); | 570 | G_TYPE_NONE, 0); |
| 653 | 571 | ||
| 654 | - | ||
| 655 | - // Properties | ||
| 656 | - gobject_class->set_property = v3270_set_property; | ||
| 657 | - gobject_class->get_property = v3270_get_property; | ||
| 658 | - | ||
| 659 | - v3270_properties[PROP_ONLINE] = g_param_spec_boolean( | ||
| 660 | - "online", | ||
| 661 | - "online", | ||
| 662 | - "True if is online", | ||
| 663 | - FALSE,G_PARAM_READABLE); | ||
| 664 | - g_object_class_install_property(gobject_class,PROP_ONLINE,v3270_properties[PROP_ONLINE]); | ||
| 665 | - | ||
| 666 | - v3270_properties[PROP_SELECTION] = g_param_spec_boolean( | ||
| 667 | - "selection", | ||
| 668 | - "selection", | ||
| 669 | - "True on selected area", | ||
| 670 | - FALSE,G_PARAM_READABLE); | ||
| 671 | - g_object_class_install_property(gobject_class,PROP_SELECTION,v3270_properties[PROP_SELECTION]); | ||
| 672 | - | ||
| 673 | - v3270_properties[PROP_MODEL] = g_param_spec_string( | ||
| 674 | - "model", | ||
| 675 | - "model", | ||
| 676 | - "The model of 3270 display to be emulated", | ||
| 677 | - FALSE,G_PARAM_READABLE|G_PARAM_WRITABLE); | ||
| 678 | - g_object_class_install_property(gobject_class,PROP_MODEL,v3270_properties[PROP_MODEL]); | ||
| 679 | - | ||
| 680 | - // Toggle properties | ||
| 681 | - int f; | ||
| 682 | - | ||
| 683 | - for(f=0;f<LIB3270_TOGGLE_COUNT;f++) | ||
| 684 | - { | ||
| 685 | - v3270_properties[PROP_TOGGLE+f] = g_param_spec_boolean(lib3270_get_toggle_name(f),lib3270_get_toggle_name(f),lib3270_get_toggle_description(f),FALSE,G_PARAM_WRITABLE|G_PARAM_READABLE); | ||
| 686 | - g_object_class_install_property(gobject_class,PROP_TOGGLE+f,v3270_properties[PROP_TOGGLE+f]); | ||
| 687 | - } | 572 | + v3270_init_properties(gobject_class); |
| 688 | 573 | ||
| 689 | } | 574 | } |
| 690 | 575 | ||
| @@ -825,7 +710,7 @@ static void update_message(H3270 *session, LIB3270_MESSAGE id) | @@ -825,7 +710,7 @@ static void update_message(H3270 *session, LIB3270_MESSAGE id) | ||
| 825 | 710 | ||
| 826 | static void update_luname(H3270 *session, const char *name) | 711 | static void update_luname(H3270 *session, const char *name) |
| 827 | { | 712 | { |
| 828 | - g_signal_emit(GTK_WIDGET(session->widget), v3270_widget_signal[SIGNAL_LUNAME_CHANGED], 0, (gchar *) name); | 713 | + v3270_update_luname(GTK_WIDGET(session->widget),name); |
| 829 | } | 714 | } |
| 830 | 715 | ||
| 831 | static void select_cursor(H3270 *session, LIB3270_CURSOR id) | 716 | static void select_cursor(H3270 *session, LIB3270_CURSOR id) |