Commit 8ac39478dbbaf16c85c234b36cb0ce5a7107a7e1
1 parent
2f131313
Exists in
master
and in
5 other branches
Simplificando propriedade toggle
Showing
3 changed files
with
29 additions
and
32 deletions
Show diff stats
src/pw3270/v3270/private.h
... | ... | @@ -298,6 +298,7 @@ void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on); |
298 | 298 | void v3270_update_ssl(H3270 *session, LIB3270_SSL_STATE state); |
299 | 299 | |
300 | 300 | G_GNUC_INTERNAL void v3270_update_luname(GtkWidget *widget,const gchar *name); |
301 | +G_GNUC_INTERNAL void v3270_init_properties(GObjectClass * gobject_class); | |
301 | 302 | |
302 | 303 | // Keyboard & Mouse |
303 | 304 | gboolean v3270_key_press_event(GtkWidget *widget, GdkEventKey *event); | ... | ... |
src/pw3270/v3270/properties.c
... | ... | @@ -96,7 +96,7 @@ |
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - void v3270_init_properties(GObjectClass * gobject_class) | |
99 | + void v3270_init_properties(GObjectClass * gobject_class) | |
100 | 100 | { |
101 | 101 | gobject_class->set_property = v3270_set_property; |
102 | 102 | gobject_class->get_property = v3270_get_property; | ... | ... |
src/pw3270/v3270/widget.c
... | ... | @@ -115,37 +115,9 @@ static void v3270_cursor_draw(v3270 *widget) |
115 | 115 | |
116 | 116 | } |
117 | 117 | |
118 | + | |
118 | 119 | static void v3270_toggle_changed(v3270 *widget,LIB3270_TOGGLE toggle_id, gboolean toggle_state,const gchar *toggle_name) |
119 | 120 | { |
120 | - trace("%s: toggle %d (%s)=%s",__FUNCTION__,toggle_id,toggle_name,toggle_state ? "Yes" : "No"); | |
121 | - | |
122 | - switch(toggle_id) | |
123 | - { | |
124 | - case LIB3270_TOGGLE_CURSOR_POS: | |
125 | - case LIB3270_TOGGLE_CROSSHAIR: | |
126 | - v3270_reload(GTK_WIDGET(widget)); | |
127 | - gtk_widget_queue_draw(GTK_WIDGET(widget)); | |
128 | - break; | |
129 | - | |
130 | - case LIB3270_TOGGLE_CURSOR_BLINK: | |
131 | - widget->cursor.show |= 1; | |
132 | - break; | |
133 | - | |
134 | - case LIB3270_TOGGLE_INSERT: | |
135 | - v3270_draw_ins_status(widget); | |
136 | - v3270_cursor_draw(widget); | |
137 | - break; | |
138 | - | |
139 | - case LIB3270_TOGGLE_BOLD: | |
140 | - v3270_reload(GTK_WIDGET(widget)); | |
141 | - gtk_widget_queue_draw(GTK_WIDGET(widget)); | |
142 | - break; | |
143 | - | |
144 | - default: | |
145 | - return; | |
146 | - | |
147 | - } | |
148 | - | |
149 | 121 | } |
150 | 122 | |
151 | 123 | static void loghandler(H3270 *session, const char *module, int rc, const char *fmt, va_list args) |
... | ... | @@ -688,8 +660,31 @@ static void set_timer(H3270 *session, unsigned char on) |
688 | 660 | |
689 | 661 | static void update_toggle(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, LIB3270_TOGGLE_TYPE reason, const char *name) |
690 | 662 | { |
691 | - if(ix == LIB3270_TOGGLE_FULL_SCREEN) | |
663 | + trace("Toggle %s is %s",name,value ? "ON" : "OFF"); | |
664 | + | |
665 | + switch(ix) | |
692 | 666 | { |
667 | + case LIB3270_TOGGLE_CURSOR_POS: | |
668 | + case LIB3270_TOGGLE_CROSSHAIR: | |
669 | + v3270_reload(GTK_WIDGET(session->widget)); | |
670 | + gtk_widget_queue_draw(GTK_WIDGET(session->widget)); | |
671 | + break; | |
672 | + | |
673 | + case LIB3270_TOGGLE_CURSOR_BLINK: | |
674 | + GTK_V3270(session->widget)->cursor.show |= 1; | |
675 | + break; | |
676 | + | |
677 | + case LIB3270_TOGGLE_INSERT: | |
678 | + v3270_draw_ins_status(GTK_WIDGET(session->widget)); | |
679 | + v3270_cursor_draw(GTK_WIDGET(session->widget)); | |
680 | + break; | |
681 | + | |
682 | + case LIB3270_TOGGLE_BOLD: | |
683 | + v3270_reload(GTK_WIDGET(session->widget)); | |
684 | + gtk_widget_queue_draw(GTK_WIDGET(session->widget)); | |
685 | + break; | |
686 | + | |
687 | + case LIB3270_TOGGLE_FULL_SCREEN: | |
693 | 688 | if(value) |
694 | 689 | gtk_window_fullscreen(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(session->widget)))); |
695 | 690 | else |
... | ... | @@ -698,8 +693,9 @@ static void update_toggle(H3270 *session, LIB3270_TOGGLE ix, unsigned char value |
698 | 693 | #if GTK_CHECK_VERSION(2,26,0) |
699 | 694 | g_object_notify_by_pspec(G_OBJECT(session->widget), v3270_properties[PROP_TOGGLE+ix]); |
700 | 695 | #else |
701 | - g_object_notify(G_OBJECT(session->widget),lib3270_get_toggle_name(ix)); | |
696 | + g_object_notify(G_OBJECT(session->widget),name); | |
702 | 697 | #endif // GTK_CHECK_VERSION |
698 | + | |
703 | 699 | g_signal_emit(GTK_WIDGET(session->widget), v3270_widget_signal[SIGNAL_TOGGLE_CHANGED], 0, (guint) ix, (gboolean) (value != 0), (gchar *) name); |
704 | 700 | } |
705 | 701 | ... | ... |