Commit f54a014eacf7d1764f34263bd370a6347f6ce64e
1 parent
a72db205
Exists in
master
and in
1 other branch
Adding callback method for url property.
Small adjustments in property manager.
Showing
12 changed files
with
175 additions
and
157 deletions
Show diff stats
src/include/internals.h
| @@ -227,7 +227,7 @@ G_GNUC_INTERNAL void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned | @@ -227,7 +227,7 @@ G_GNUC_INTERNAL void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned | ||
| 227 | 227 | ||
| 228 | G_GNUC_INTERNAL void v3270_clear_selection(v3270 *terminal); | 228 | G_GNUC_INTERNAL void v3270_clear_selection(v3270 *terminal); |
| 229 | 229 | ||
| 230 | - G_GNUC_INTERNAL void v3270_update_cursor_surface(v3270 *widget,unsigned char chr,unsigned short attr); | 230 | + G_GNUC_INTERNAL void v3270_update_cursor_surface(v3270 *widget, unsigned char chr, unsigned short attr); |
| 231 | 231 | ||
| 232 | G_GNUC_INTERNAL void v3270_register_io_handlers(v3270Class *cls); | 232 | G_GNUC_INTERNAL void v3270_register_io_handlers(v3270Class *cls); |
| 233 | 233 | ||
| @@ -257,7 +257,6 @@ G_GNUC_INTERNAL void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned | @@ -257,7 +257,6 @@ G_GNUC_INTERNAL void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned | ||
| 257 | 257 | ||
| 258 | G_GNUC_INTERNAL void v3270_blink_ssl(v3270 *terminal); | 258 | G_GNUC_INTERNAL void v3270_blink_ssl(v3270 *terminal); |
| 259 | 259 | ||
| 260 | - G_GNUC_INTERNAL void v3270_update_luname(GtkWidget *widget,const gchar *name); | ||
| 261 | G_GNUC_INTERNAL void v3270_init_properties(GObjectClass * gobject_class); | 260 | G_GNUC_INTERNAL void v3270_init_properties(GObjectClass * gobject_class); |
| 262 | G_GNUC_INTERNAL void v3270_queue_draw_area(GtkWidget *widget, gint x, gint y, gint width, gint height); | 261 | G_GNUC_INTERNAL void v3270_queue_draw_area(GtkWidget *widget, gint x, gint y, gint width, gint height); |
| 263 | 262 | ||
| @@ -288,6 +287,10 @@ G_GNUC_INTERNAL void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned | @@ -288,6 +287,10 @@ G_GNUC_INTERNAL void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned | ||
| 288 | G_GNUC_INTERNAL void v3270_translate_text_to_rgba(const gchar *colors, GdkRGBA *clr); | 287 | G_GNUC_INTERNAL void v3270_translate_text_to_rgba(const gchar *colors, GdkRGBA *clr); |
| 289 | G_GNUC_INTERNAL gchar * v3270_translate_rgba_to_text(GdkRGBA *clr); | 288 | G_GNUC_INTERNAL gchar * v3270_translate_rgba_to_text(GdkRGBA *clr); |
| 290 | 289 | ||
| 290 | + // Properties | ||
| 291 | + G_GNUC_INTERNAL gboolean v3270_update_luname(v3270 *terminal); | ||
| 292 | + G_GNUC_INTERNAL void v3270_update_toggle(GtkWidget *widget, LIB3270_TOGGLE_ID id, unsigned char value, const char *name); | ||
| 293 | + | ||
| 291 | G_END_DECLS | 294 | G_END_DECLS |
| 292 | 295 | ||
| 293 | #endif // V3270_INTERNALS_H_INCLUDED | 296 | #endif // V3270_INTERNALS_H_INCLUDED |
src/include/terminal.h
| @@ -46,6 +46,7 @@ G_BEGIN_DECLS | @@ -46,6 +46,7 @@ G_BEGIN_DECLS | ||
| 46 | 46 | ||
| 47 | // Signal related properties | 47 | // Signal related properties |
| 48 | GParamSpec * online; | 48 | GParamSpec * online; |
| 49 | + GParamSpec * url; | ||
| 49 | GParamSpec * luname; | 50 | GParamSpec * luname; |
| 50 | GParamSpec * model; | 51 | GParamSpec * model; |
| 51 | GParamSpec * selection; | 52 | GParamSpec * selection; |
src/include/v3270.h
| @@ -291,7 +291,6 @@ | @@ -291,7 +291,6 @@ | ||
| 291 | // Convenience | 291 | // Convenience |
| 292 | LIB3270_EXPORT void gtk_entry_set_printf(GtkEntry *entry, const gchar *fmt, ...) G_GNUC_PRINTF(2,3); | 292 | LIB3270_EXPORT void gtk_entry_set_printf(GtkEntry *entry, const gchar *fmt, ...) G_GNUC_PRINTF(2,3); |
| 293 | 293 | ||
| 294 | - | ||
| 295 | G_END_DECLS | 294 | G_END_DECLS |
| 296 | 295 | ||
| 297 | #endif // V3270_H_INCLUDED | 296 | #endif // V3270_H_INCLUDED |
src/terminal/callbacks.c
| @@ -70,74 +70,9 @@ static void set_timer(H3270 *session, unsigned char on) | @@ -70,74 +70,9 @@ static void set_timer(H3270 *session, unsigned char on) | ||
| 70 | 70 | ||
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | -static void update_toggle(H3270 *session, LIB3270_TOGGLE_ID ix, unsigned char value, G_GNUC_UNUSED LIB3270_TOGGLE_TYPE reason, const char *name) | 73 | +static void update_toggle(H3270 *session, LIB3270_TOGGLE_ID id, unsigned char value, G_GNUC_UNUSED LIB3270_TOGGLE_TYPE reason, const char *name) |
| 74 | { | 74 | { |
| 75 | - GtkWidget * widget = GTK_WIDGET(lib3270_get_user_data(session)); | ||
| 76 | - v3270Class * klass = GTK_V3270_GET_CLASS(widget); | ||
| 77 | - | ||
| 78 | - trace("%s(%s,%d)",__FUNCTION__,name,(int) value); | ||
| 79 | - | ||
| 80 | - switch(ix) | ||
| 81 | - { | ||
| 82 | - case LIB3270_TOGGLE_CURSOR_POS: | ||
| 83 | - case LIB3270_TOGGLE_MONOCASE: | ||
| 84 | - case LIB3270_TOGGLE_LINE_WRAP: | ||
| 85 | - case LIB3270_TOGGLE_CROSSHAIR: | ||
| 86 | - case LIB3270_TOGGLE_BLANK_FILL: | ||
| 87 | - case LIB3270_TOGGLE_MARGINED_PASTE: | ||
| 88 | - case LIB3270_TOGGLE_SHOW_TIMING: | ||
| 89 | - case LIB3270_TOGGLE_RECTANGLE_SELECT: | ||
| 90 | - case LIB3270_TOGGLE_UNDERLINE: | ||
| 91 | - case LIB3270_TOGGLE_VIEW_FIELD: | ||
| 92 | - case LIB3270_TOGGLE_ALTSCREEN: | ||
| 93 | - v3270_reload(widget); | ||
| 94 | - gtk_widget_queue_draw(widget); | ||
| 95 | - break; | ||
| 96 | - | ||
| 97 | - case LIB3270_TOGGLE_CURSOR_BLINK: | ||
| 98 | - GTK_V3270(widget)->cursor.show |= 1; | ||
| 99 | - break; | ||
| 100 | - | ||
| 101 | - case LIB3270_TOGGLE_INSERT: | ||
| 102 | - v3270_draw_ins_status(GTK_V3270(widget)); | ||
| 103 | - v3270_cursor_draw(GTK_V3270(widget)); | ||
| 104 | - break; | ||
| 105 | - | ||
| 106 | - case LIB3270_TOGGLE_BOLD: | ||
| 107 | - v3270_reconfigure(GTK_V3270(widget)); | ||
| 108 | - gtk_widget_queue_draw(widget); | ||
| 109 | - break; | ||
| 110 | - | ||
| 111 | - case LIB3270_TOGGLE_FULL_SCREEN: | ||
| 112 | - if(value) | ||
| 113 | - gtk_window_fullscreen(GTK_WINDOW(gtk_widget_get_toplevel(widget))); | ||
| 114 | - else | ||
| 115 | - gtk_window_unfullscreen(GTK_WINDOW(gtk_widget_get_toplevel(widget))); | ||
| 116 | - | ||
| 117 | - break; | ||
| 118 | - | ||
| 119 | - case LIB3270_TOGGLE_DS_TRACE: | ||
| 120 | - case LIB3270_TOGGLE_SSL_TRACE: | ||
| 121 | - case LIB3270_TOGGLE_SCREEN_TRACE: | ||
| 122 | - case LIB3270_TOGGLE_EVENT_TRACE: | ||
| 123 | - case LIB3270_TOGGLE_RECONNECT: | ||
| 124 | - case LIB3270_TOGGLE_SMART_PASTE: | ||
| 125 | - case LIB3270_TOGGLE_KEEP_SELECTED: | ||
| 126 | - case LIB3270_TOGGLE_CONNECT_ON_STARTUP: | ||
| 127 | - case LIB3270_TOGGLE_KP_ALTERNATIVE: | ||
| 128 | - case LIB3270_TOGGLE_NETWORK_TRACE: | ||
| 129 | - case LIB3270_TOGGLE_BEEP: | ||
| 130 | - case LIB3270_TOGGLE_KEEP_ALIVE: | ||
| 131 | - break; | ||
| 132 | - | ||
| 133 | - case LIB3270_TOGGLE_COUNT: | ||
| 134 | - break; | ||
| 135 | - | ||
| 136 | - } | ||
| 137 | - | ||
| 138 | - g_object_notify_by_pspec(G_OBJECT(widget), klass->properties.toggle[ix]); | ||
| 139 | - g_signal_emit(widget, v3270_widget_signal[V3270_SIGNAL_TOGGLE_CHANGED], 0, (guint) ix, (gboolean) (value != 0), (gchar *) name); | ||
| 140 | - | 75 | + v3270_update_toggle((GtkWidget *) lib3270_get_user_data(session), id, value, name); |
| 141 | } | 76 | } |
| 142 | 77 | ||
| 143 | static gboolean bg_update_message(H3270 *session) | 78 | static gboolean bg_update_message(H3270 *session) |
| @@ -162,9 +97,21 @@ static void update_message(H3270 *session, G_GNUC_UNUSED LIB3270_MESSAGE id) | @@ -162,9 +97,21 @@ static void update_message(H3270 *session, G_GNUC_UNUSED LIB3270_MESSAGE id) | ||
| 162 | g_idle_add((GSourceFunc) bg_update_message, session); | 97 | g_idle_add((GSourceFunc) bg_update_message, session); |
| 163 | } | 98 | } |
| 164 | 99 | ||
| 165 | -static void update_luname(H3270 *session, const char *name) | 100 | +static void update_luname(H3270 *session, const char G_GNUC_UNUSED(*name)) |
| 101 | +{ | ||
| 102 | + g_idle_add((GSourceFunc) v3270_update_luname, lib3270_get_user_data(session)); | ||
| 103 | +} | ||
| 104 | + | ||
| 105 | +static gboolean v3270_update_url(v3270 *terminal) | ||
| 106 | +{ | ||
| 107 | + debug("url=%s",v3270_get_url(GTK_WIDGET(terminal))); | ||
| 108 | + g_object_notify_by_pspec(G_OBJECT(terminal), GTK_V3270_GET_CLASS(terminal)->properties.url); | ||
| 109 | + return FALSE; | ||
| 110 | +} | ||
| 111 | + | ||
| 112 | +static void update_url(H3270 *session, const char G_GNUC_UNUSED(*name)) | ||
| 166 | { | 113 | { |
| 167 | - v3270_update_luname(GTK_WIDGET(lib3270_get_user_data(session)),name); | 114 | + g_idle_add((GSourceFunc) v3270_update_url, lib3270_get_user_data(session)); |
| 168 | } | 115 | } |
| 169 | 116 | ||
| 170 | struct select_cursor_data | 117 | struct select_cursor_data |
| @@ -202,11 +149,7 @@ static void ctlr_done(H3270 *session) | @@ -202,11 +149,7 @@ static void ctlr_done(H3270 *session) | ||
| 202 | { | 149 | { |
| 203 | GtkWidget *widget = GTK_WIDGET(lib3270_get_user_data(session)); | 150 | GtkWidget *widget = GTK_WIDGET(lib3270_get_user_data(session)); |
| 204 | 151 | ||
| 205 | -#if GTK_CHECK_VERSION(2,20,0) | ||
| 206 | if(gtk_widget_get_realized(widget) && gtk_widget_get_has_window(widget)) | 152 | if(gtk_widget_get_realized(widget) && gtk_widget_get_has_window(widget)) |
| 207 | -#else | ||
| 208 | - if(GTK_WIDGET_REALIZED(widget) && widget->window) | ||
| 209 | -#endif // GTK(2,20) | ||
| 210 | { | 153 | { |
| 211 | v3270_update_mouse_pointer(widget); | 154 | v3270_update_mouse_pointer(widget); |
| 212 | } | 155 | } |
| @@ -220,7 +163,7 @@ static void update_connect(H3270 *session, unsigned char connected) | @@ -220,7 +163,7 @@ static void update_connect(H3270 *session, unsigned char connected) | ||
| 220 | if(connected) | 163 | if(connected) |
| 221 | { | 164 | { |
| 222 | widget->cursor.show |= 2; | 165 | widget->cursor.show |= 2; |
| 223 | - g_signal_emit(GTK_WIDGET(widget), v3270_widget_signal[V3270_SIGNAL_CONNECTED], 0, lib3270_get_host(session)); | 166 | + g_signal_emit(GTK_WIDGET(widget), v3270_widget_signal[V3270_SIGNAL_CONNECTED], 0, lib3270_get_url(session)); |
| 224 | } | 167 | } |
| 225 | else | 168 | else |
| 226 | { | 169 | { |
| @@ -495,6 +438,8 @@ static void popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title | @@ -495,6 +438,8 @@ static void popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title | ||
| 495 | cbk->update_selection = update_selection; | 438 | cbk->update_selection = update_selection; |
| 496 | 439 | ||
| 497 | cbk->update_luname = update_luname; | 440 | cbk->update_luname = update_luname; |
| 441 | + cbk->update_url = update_url; | ||
| 442 | + | ||
| 498 | cbk->configure = update_screen_size; | 443 | cbk->configure = update_screen_size; |
| 499 | cbk->update_status = update_message; | 444 | cbk->update_status = update_message; |
| 500 | cbk->update_cursor = v3270_update_cursor; | 445 | cbk->update_cursor = v3270_update_cursor; |
src/terminal/drawing/oia.c
| @@ -694,24 +694,18 @@ cairo_t * v3270_oia_set_update_region(v3270 * terminal, GdkRectangle **r, V3270_ | @@ -694,24 +694,18 @@ cairo_t * v3270_oia_set_update_region(v3270 * terminal, GdkRectangle **r, V3270_ | ||
| 694 | return cr; | 694 | return cr; |
| 695 | } | 695 | } |
| 696 | 696 | ||
| 697 | -void v3270_update_luname(GtkWidget *widget,const gchar *name) | 697 | +gboolean v3270_update_luname(v3270 *terminal) |
| 698 | { | 698 | { |
| 699 | - cairo_t * cr; | ||
| 700 | - GdkRectangle * rect; | ||
| 701 | - v3270 * terminal = GTK_V3270(widget); | ||
| 702 | - | ||
| 703 | if(terminal->surface) | 699 | if(terminal->surface) |
| 704 | { | 700 | { |
| 705 | - cr = v3270_oia_set_update_region(terminal,&rect,V3270_OIA_LUNAME); | 701 | + GdkRectangle * rect; |
| 702 | + cairo_t * cr = v3270_oia_set_update_region(terminal,&rect,V3270_OIA_LUNAME); | ||
| 706 | 703 | ||
| 704 | + const char * name = lib3270_get_luname(terminal->host); | ||
| 707 | if(name) | 705 | if(name) |
| 708 | { | 706 | { |
| 709 | -// cairo_move_to(cr,rect->x,rect->y+terminal->font.height); | ||
| 710 | -// cairo_show_text(cr,name); | ||
| 711 | -// cairo_stroke(cr); | ||
| 712 | gdk_cairo_set_source_rgba(cr,terminal->color+V3270_COLOR_OIA_LUNAME); | 707 | gdk_cairo_set_source_rgba(cr,terminal->color+V3270_COLOR_OIA_LUNAME); |
| 713 | v3270_draw_text_at(cr, rect->x, rect->y, &terminal->font, name); | 708 | v3270_draw_text_at(cr, rect->x, rect->y, &terminal->font, name); |
| 714 | - | ||
| 715 | } | 709 | } |
| 716 | 710 | ||
| 717 | cairo_destroy(cr); | 711 | cairo_destroy(cr); |
| @@ -719,8 +713,9 @@ void v3270_update_luname(GtkWidget *widget,const gchar *name) | @@ -719,8 +713,9 @@ void v3270_update_luname(GtkWidget *widget,const gchar *name) | ||
| 719 | 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); |
| 720 | } | 714 | } |
| 721 | 715 | ||
| 722 | - g_object_notify_by_pspec(G_OBJECT(widget), GTK_V3270_GET_CLASS(widget)->properties.luname); | 716 | + g_object_notify_by_pspec(G_OBJECT(terminal), GTK_V3270_GET_CLASS(terminal)->properties.luname); |
| 723 | 717 | ||
| 718 | + return FALSE; | ||
| 724 | } | 719 | } |
| 725 | 720 | ||
| 726 | void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id) | 721 | void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id) |
src/terminal/properties/get.c
| @@ -150,3 +150,11 @@ LIB3270_EXPORT gboolean v3270_is_connected(GtkWidget *widget) | @@ -150,3 +150,11 @@ LIB3270_EXPORT gboolean v3270_is_connected(GtkWidget *widget) | ||
| 150 | return lib3270_is_connected(GTK_V3270(widget)->host) ? TRUE : FALSE; | 150 | return lib3270_is_connected(GTK_V3270(widget)->host) ? TRUE : FALSE; |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | +LIB3270_EXPORT guint v3270_get_auto_disconnect(GtkWidget *widget) | ||
| 154 | +{ | ||
| 155 | + g_return_val_if_fail(GTK_IS_V3270(widget),0); | ||
| 156 | + return GTK_V3270(widget)->activity.disconnect; | ||
| 157 | +} | ||
| 158 | + | ||
| 159 | + | ||
| 160 | + |
src/terminal/properties/init.c
| @@ -42,6 +42,7 @@ | @@ -42,6 +42,7 @@ | ||
| 42 | } properties[] = { | 42 | } properties[] = { |
| 43 | { "connected", &klass->properties.online }, | 43 | { "connected", &klass->properties.online }, |
| 44 | { "luname", &klass->properties.luname }, | 44 | { "luname", &klass->properties.luname }, |
| 45 | + { "url", &klass->properties.url }, | ||
| 45 | { "model", &klass->properties.model }, | 46 | { "model", &klass->properties.model }, |
| 46 | { "has-selection", &klass->properties.selection }, | 47 | { "has-selection", &klass->properties.selection }, |
| 47 | }; | 48 | }; |
src/terminal/properties/methods.c
| @@ -1,66 +0,0 @@ | @@ -1,66 +0,0 @@ | ||
| 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 "private.h" | ||
| 31 | - | ||
| 32 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | ||
| 33 | - | ||
| 34 | - LIB3270_EXPORT void v3270_set_auto_disconnect(GtkWidget *widget, guint minutes) | ||
| 35 | - { | ||
| 36 | - g_return_if_fail(GTK_IS_V3270(widget)); | ||
| 37 | - GTK_V3270(widget)->activity.disconnect = minutes; | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | - LIB3270_EXPORT guint v3270_get_auto_disconnect(GtkWidget *widget) | ||
| 41 | - { | ||
| 42 | - g_return_val_if_fail(GTK_IS_V3270(widget),0); | ||
| 43 | - return GTK_V3270(widget)->activity.disconnect; | ||
| 44 | - } | ||
| 45 | - | ||
| 46 | -LIB3270_EXPORT gboolean v3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE_ID ix) | ||
| 47 | -{ | ||
| 48 | - g_return_val_if_fail(GTK_IS_V3270(widget),FALSE); | ||
| 49 | - | ||
| 50 | - if(ix < LIB3270_TOGGLE_COUNT) | ||
| 51 | - return lib3270_get_toggle(GTK_V3270(widget)->host,ix) ? TRUE : FALSE; | ||
| 52 | - | ||
| 53 | - return FALSE; | ||
| 54 | -} | ||
| 55 | - | ||
| 56 | -LIB3270_EXPORT gboolean v3270_set_toggle(GtkWidget *widget, LIB3270_TOGGLE_ID ix, gboolean state) | ||
| 57 | -{ | ||
| 58 | - g_return_val_if_fail(GTK_IS_V3270(widget),FALSE); | ||
| 59 | - | ||
| 60 | - if(ix < LIB3270_TOGGLE_COUNT) | ||
| 61 | - return lib3270_set_toggle(GTK_V3270(widget)->host,ix,state ? 1 : 0) ? TRUE : FALSE; | ||
| 62 | - | ||
| 63 | - return FALSE; | ||
| 64 | - | ||
| 65 | -} | ||
| 66 | - |
src/terminal/properties/set.c
| @@ -200,3 +200,9 @@ void v3270_set_cursor(GtkWidget *widget, LIB3270_POINTER id) | @@ -200,3 +200,9 @@ void v3270_set_cursor(GtkWidget *widget, LIB3270_POINTER id) | ||
| 200 | ); | 200 | ); |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | +LIB3270_EXPORT void v3270_set_auto_disconnect(GtkWidget *widget, guint minutes) | ||
| 204 | +{ | ||
| 205 | + g_return_if_fail(GTK_IS_V3270(widget)); | ||
| 206 | + GTK_V3270(widget)->activity.disconnect = minutes; | ||
| 207 | +} | ||
| 208 | + |
| @@ -0,0 +1,124 @@ | @@ -0,0 +1,124 @@ | ||
| 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 - 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 <config.h> | ||
| 31 | + | ||
| 32 | + #include <terminal.h> | ||
| 33 | + #include <internals.h> | ||
| 34 | + | ||
| 35 | + #include <lib3270/toggle.h> | ||
| 36 | + | ||
| 37 | +/*--[ Implement ]------------------------------------------------------------------------------------*/ | ||
| 38 | + | ||
| 39 | +LIB3270_EXPORT gboolean v3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE_ID ix) | ||
| 40 | +{ | ||
| 41 | + g_return_val_if_fail(GTK_IS_V3270(widget),FALSE); | ||
| 42 | + | ||
| 43 | + if(ix < LIB3270_TOGGLE_COUNT) | ||
| 44 | + return lib3270_get_toggle(GTK_V3270(widget)->host,ix) ? TRUE : FALSE; | ||
| 45 | + | ||
| 46 | + return FALSE; | ||
| 47 | +} | ||
| 48 | + | ||
| 49 | +LIB3270_EXPORT gboolean v3270_set_toggle(GtkWidget *widget, LIB3270_TOGGLE_ID ix, gboolean state) | ||
| 50 | +{ | ||
| 51 | + g_return_val_if_fail(GTK_IS_V3270(widget),FALSE); | ||
| 52 | + | ||
| 53 | + if(ix < LIB3270_TOGGLE_COUNT) | ||
| 54 | + return lib3270_set_toggle(GTK_V3270(widget)->host,ix,state ? 1 : 0) ? TRUE : FALSE; | ||
| 55 | + | ||
| 56 | + return FALSE; | ||
| 57 | + | ||
| 58 | +} | ||
| 59 | + | ||
| 60 | +void v3270_update_toggle(GtkWidget *widget, LIB3270_TOGGLE_ID id, unsigned char value, const char *name) | ||
| 61 | +{ | ||
| 62 | + v3270Class * klass = GTK_V3270_GET_CLASS(widget); | ||
| 63 | + | ||
| 64 | + trace("%s(%s,%d)",__FUNCTION__,name,(int) value); | ||
| 65 | + | ||
| 66 | + switch(id) | ||
| 67 | + { | ||
| 68 | + case LIB3270_TOGGLE_CURSOR_POS: | ||
| 69 | + case LIB3270_TOGGLE_MONOCASE: | ||
| 70 | + case LIB3270_TOGGLE_LINE_WRAP: | ||
| 71 | + case LIB3270_TOGGLE_CROSSHAIR: | ||
| 72 | + case LIB3270_TOGGLE_BLANK_FILL: | ||
| 73 | + case LIB3270_TOGGLE_MARGINED_PASTE: | ||
| 74 | + case LIB3270_TOGGLE_SHOW_TIMING: | ||
| 75 | + case LIB3270_TOGGLE_RECTANGLE_SELECT: | ||
| 76 | + case LIB3270_TOGGLE_UNDERLINE: | ||
| 77 | + case LIB3270_TOGGLE_VIEW_FIELD: | ||
| 78 | + case LIB3270_TOGGLE_ALTSCREEN: | ||
| 79 | + v3270_reload(widget); | ||
| 80 | + gtk_widget_queue_draw(widget); | ||
| 81 | + break; | ||
| 82 | + | ||
| 83 | + case LIB3270_TOGGLE_CURSOR_BLINK: | ||
| 84 | + GTK_V3270(widget)->cursor.show |= 1; | ||
| 85 | + break; | ||
| 86 | + | ||
| 87 | + case LIB3270_TOGGLE_INSERT: | ||
| 88 | + v3270_draw_ins_status(GTK_V3270(widget)); | ||
| 89 | + v3270_cursor_draw(GTK_V3270(widget)); | ||
| 90 | + break; | ||
| 91 | + | ||
| 92 | + case LIB3270_TOGGLE_BOLD: | ||
| 93 | + v3270_reconfigure(GTK_V3270(widget)); | ||
| 94 | + gtk_widget_queue_draw(widget); | ||
| 95 | + break; | ||
| 96 | + | ||
| 97 | + case LIB3270_TOGGLE_FULL_SCREEN: | ||
| 98 | + if(value) | ||
| 99 | + gtk_window_fullscreen(GTK_WINDOW(gtk_widget_get_toplevel(widget))); | ||
| 100 | + else | ||
| 101 | + gtk_window_unfullscreen(GTK_WINDOW(gtk_widget_get_toplevel(widget))); | ||
| 102 | + break; | ||
| 103 | + | ||
| 104 | + case LIB3270_TOGGLE_DS_TRACE: | ||
| 105 | + case LIB3270_TOGGLE_SSL_TRACE: | ||
| 106 | + case LIB3270_TOGGLE_SCREEN_TRACE: | ||
| 107 | + case LIB3270_TOGGLE_EVENT_TRACE: | ||
| 108 | + case LIB3270_TOGGLE_RECONNECT: | ||
| 109 | + case LIB3270_TOGGLE_SMART_PASTE: | ||
| 110 | + case LIB3270_TOGGLE_KEEP_SELECTED: | ||
| 111 | + case LIB3270_TOGGLE_CONNECT_ON_STARTUP: | ||
| 112 | + case LIB3270_TOGGLE_KP_ALTERNATIVE: | ||
| 113 | + case LIB3270_TOGGLE_NETWORK_TRACE: | ||
| 114 | + case LIB3270_TOGGLE_BEEP: | ||
| 115 | + case LIB3270_TOGGLE_KEEP_ALIVE: | ||
| 116 | + case LIB3270_TOGGLE_COUNT: | ||
| 117 | + break; | ||
| 118 | + | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + g_object_notify_by_pspec(G_OBJECT(widget), klass->properties.toggle[id]); | ||
| 122 | + g_signal_emit(widget, v3270_widget_signal[V3270_SIGNAL_TOGGLE_CHANGED], 0, (guint) id, (gboolean) (value != 0), (gchar *) name); | ||
| 123 | + | ||
| 124 | +} |
src/testprogram/toolbar.c
| @@ -37,6 +37,8 @@ | @@ -37,6 +37,8 @@ | ||
| 37 | #include <lib3270/log.h> | 37 | #include <lib3270/log.h> |
| 38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
| 39 | 39 | ||
| 40 | + #pragma GCC diagnostic ignored "-Wunused-parameter" | ||
| 41 | + | ||
| 40 | /*---[ Implement ]----------------------------------------------------------------------------------*/ | 42 | /*---[ Implement ]----------------------------------------------------------------------------------*/ |
| 41 | 43 | ||
| 42 | static void print_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal) | 44 | static void print_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal) |
v3270.cbp
| @@ -265,9 +265,6 @@ | @@ -265,9 +265,6 @@ | ||
| 265 | <Unit filename="src/terminal/properties/init.c"> | 265 | <Unit filename="src/terminal/properties/init.c"> |
| 266 | <Option compilerVar="CC" /> | 266 | <Option compilerVar="CC" /> |
| 267 | </Unit> | 267 | </Unit> |
| 268 | - <Unit filename="src/terminal/properties/methods.c"> | ||
| 269 | - <Option compilerVar="CC" /> | ||
| 270 | - </Unit> | ||
| 271 | <Unit filename="src/terminal/properties/private.h" /> | 268 | <Unit filename="src/terminal/properties/private.h" /> |
| 272 | <Unit filename="src/terminal/properties/set.c"> | 269 | <Unit filename="src/terminal/properties/set.c"> |
| 273 | <Option compilerVar="CC" /> | 270 | <Option compilerVar="CC" /> |
| @@ -275,6 +272,9 @@ | @@ -275,6 +272,9 @@ | ||
| 275 | <Unit filename="src/terminal/security.c"> | 272 | <Unit filename="src/terminal/security.c"> |
| 276 | <Option compilerVar="CC" /> | 273 | <Option compilerVar="CC" /> |
| 277 | </Unit> | 274 | </Unit> |
| 275 | + <Unit filename="src/terminal/toggles.c"> | ||
| 276 | + <Option compilerVar="CC" /> | ||
| 277 | + </Unit> | ||
| 278 | <Unit filename="src/terminal/widget.c"> | 278 | <Unit filename="src/terminal/widget.c"> |
| 279 | <Option compilerVar="CC" /> | 279 | <Option compilerVar="CC" /> |
| 280 | </Unit> | 280 | </Unit> |