Commit e4ae81853eebe811280f48d9c098f789cde40754
1 parent
da9163c3
Exists in
master
and in
1 other branch
Implementando propriedade "model" no widget
Showing
1 changed file
with
20 additions
and
0 deletions
Show diff stats
widget.c
... | ... | @@ -79,6 +79,7 @@ |
79 | 79 | /* Widget properties */ |
80 | 80 | PROP_ONLINE, |
81 | 81 | PROP_SELECTION, |
82 | + PROP_MODEL, | |
82 | 83 | |
83 | 84 | /* Toggles - always the last one, the real values are PROP_TOGGLE+LIB3270_TOGGLE */ |
84 | 85 | PROP_TOGGLE |
... | ... | @@ -342,6 +343,9 @@ static void v3270_set_property(GObject *object, guint prop_id, const GValue *val |
342 | 343 | |
343 | 344 | switch (prop_id) |
344 | 345 | { |
346 | + case PROP_MODEL: | |
347 | + lib3270_set_model(window->host,g_value_get_string(value)); | |
348 | + break; | |
345 | 349 | |
346 | 350 | default: |
347 | 351 | if(prop_id < (PROP_TOGGLE + LIB3270_TOGGLE_COUNT)) |
... | ... | @@ -360,6 +364,10 @@ static void v3270_get_property(GObject *object,guint prop_id, GValue *value, GPa |
360 | 364 | |
361 | 365 | switch (prop_id) |
362 | 366 | { |
367 | + case PROP_MODEL: | |
368 | + g_value_set_string(value,lib3270_get_model(window->host)); | |
369 | + break; | |
370 | + | |
363 | 371 | case PROP_ONLINE: |
364 | 372 | g_value_set_boolean(value,lib3270_is_connected(window->host) ? TRUE : FALSE ); |
365 | 373 | break; |
... | ... | @@ -662,6 +670,13 @@ static void v3270_class_init(v3270Class *klass) |
662 | 670 | FALSE,G_PARAM_READABLE); |
663 | 671 | g_object_class_install_property(gobject_class,PROP_SELECTION,v3270_properties[PROP_SELECTION]); |
664 | 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 | + | |
665 | 680 | // Toggle properties |
666 | 681 | int f; |
667 | 682 | |
... | ... | @@ -878,6 +893,11 @@ static void update_screen_size(H3270 *session,unsigned short rows, unsigned shor |
878 | 893 | |
879 | 894 | static void update_model(H3270 *session, const char *name, int model, int rows, int cols) |
880 | 895 | { |
896 | +#if GTK_CHECK_VERSION(2,26,0) | |
897 | + g_object_notify_by_pspec(G_OBJECT(session->widget), v3270_properties[PROP_MODEL]); | |
898 | +#else | |
899 | + g_object_notify(G_OBJECT(session->widget),"model"); | |
900 | +#endif // GTK_CHECK_VERSION | |
881 | 901 | g_signal_emit(GTK_WIDGET(session->widget),v3270_widget_signal[SIGNAL_MODEL_CHANGED], 0, (guint) model, name); |
882 | 902 | } |
883 | 903 | ... | ... |