Commit 7644e0717ad7088f4c6e399bcb22c3cdde89e47b
1 parent
f1519680
Exists in
master
and in
1 other branch
Criando string para guardar nome de sessao (vai ser alteravel em algum ponto no …
…futuro), movendo include com as funções do widget 3270 para o include geral para facilitar a implementação de plugins que atuem direto no widget)
Showing
9 changed files
with
34 additions
and
200 deletions
Show diff stats
accessible.c
draw.c
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | #include <pw3270.h> |
| 32 | 32 | #include <lib3270.h> |
| 33 | 33 | #include <lib3270/session.h> |
| 34 | - #include "v3270.h" | |
| 34 | + #include <lib3270/v3270.h> | |
| 35 | 35 | #include "private.h" |
| 36 | 36 | |
| 37 | 37 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | ... | ... |
keyboard.c
mouse.c
private.h
| ... | ... | @@ -38,7 +38,7 @@ |
| 38 | 38 | #include <glib/gi18n.h> |
| 39 | 39 | |
| 40 | 40 | #ifndef V3270_H_INCLUDED |
| 41 | - #include "v3270.h" | |
| 41 | + #include <lib3270/v3270.h> | |
| 42 | 42 | #endif |
| 43 | 43 | |
| 44 | 44 | G_BEGIN_DECLS |
| ... | ... | @@ -176,8 +176,9 @@ G_BEGIN_DECLS |
| 176 | 176 | // Acessibility |
| 177 | 177 | GtkAccessible * accessible; |
| 178 | 178 | |
| 179 | - // lib3270 stuff | |
| 179 | + // Session | |
| 180 | 180 | H3270 * host; /**< Related 3270 session */ |
| 181 | + gchar * session_name; /**< Session name (for window title) */ | |
| 181 | 182 | |
| 182 | 183 | }; |
| 183 | 184 | ... | ... |
selection.c
v3270.h
| ... | ... | @@ -1,191 +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., 59 Temple | |
| 19 | - * Place, Suite 330, Boston, MA, 02111-1307, USA | |
| 20 | - * | |
| 21 | - * Este programa está nomeado como v3270.h 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 | - * licinio@bb.com.br (Licínio Luis Branco) | |
| 28 | - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
| 29 | - * | |
| 30 | - */ | |
| 31 | - | |
| 32 | -#ifndef V3270_H_INCLUDED | |
| 33 | - | |
| 34 | - #include <lib3270/config.h> | |
| 35 | - #include <lib3270.h> | |
| 36 | - | |
| 37 | - #define V3270_H_INCLUDED 1 | |
| 38 | - | |
| 39 | - G_BEGIN_DECLS | |
| 40 | - | |
| 41 | - #define GTK_TYPE_V3270 (v3270_get_type ()) | |
| 42 | - #define GTK_V3270(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_V3270, v3270)) | |
| 43 | - #define GTK_V3270_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_V3270, v3270Class)) | |
| 44 | - #define GTK_IS_V3270(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_V3270)) | |
| 45 | - #define GTK_IS_V3270_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_V3270)) | |
| 46 | - #define GTK_V3270_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_V3270, v3270Class)) | |
| 47 | - | |
| 48 | - | |
| 49 | - typedef struct _v3270 v3270; | |
| 50 | - typedef struct _v3270Class v3270Class; | |
| 51 | - | |
| 52 | - enum V3270_COLOR | |
| 53 | - { | |
| 54 | - V3270_COLOR_BACKGROUND, | |
| 55 | - V3270_COLOR_BLUE, | |
| 56 | - V3270_COLOR_RED, | |
| 57 | - V3270_COLOR_PINK, | |
| 58 | - V3270_COLOR_GREEN, | |
| 59 | - V3270_COLOR_TURQUOISE, | |
| 60 | - V3270_COLOR_YELLOW, | |
| 61 | - V3270_COLOR_WHITE, | |
| 62 | - V3270_COLOR_BLACK, | |
| 63 | - V3270_COLOR_DARK_BLUE, | |
| 64 | - V3270_COLOR_ORANGE, | |
| 65 | - V3270_COLOR_PURPLE, | |
| 66 | - V3270_COLOR_DARK_GREEN, | |
| 67 | - V3270_COLOR_DARK_TURQUOISE, | |
| 68 | - V3270_COLOR_MUSTARD, | |
| 69 | - V3270_COLOR_GRAY, | |
| 70 | - | |
| 71 | - V3270_COLOR_FIELD, | |
| 72 | - V3270_COLOR_FIELD_INTENSIFIED, | |
| 73 | - V3270_COLOR_FIELD_PROTECTED, | |
| 74 | - V3270_COLOR_FIELD_PROTECTED_INTENSIFIED, | |
| 75 | - | |
| 76 | - V3270_COLOR_SELECTED_BG, | |
| 77 | - V3270_COLOR_SELECTED_FG, | |
| 78 | - | |
| 79 | - V3270_COLOR_CROSS_HAIR, | |
| 80 | - | |
| 81 | - // Oia Colors (Must be the last block) | |
| 82 | - V3270_COLOR_OIA_BACKGROUND, | |
| 83 | - V3270_COLOR_OIA_FOREGROUND, | |
| 84 | - V3270_COLOR_OIA_SEPARATOR, | |
| 85 | - V3270_COLOR_OIA_STATUS_OK, | |
| 86 | - V3270_COLOR_OIA_STATUS_INVALID, | |
| 87 | - | |
| 88 | - V3270_COLOR_COUNT | |
| 89 | - }; | |
| 90 | - | |
| 91 | - #define V3270_COLOR_OIA_STATUS_WARNING V3270_COLOR_OIA_STATUS_OK | |
| 92 | - | |
| 93 | - typedef enum _v3270_oia_field | |
| 94 | - { | |
| 95 | - V3270_OIA_UNDERA, /**< "A" underlined */ | |
| 96 | - V3270_OIA_CONNECTION, /**< solid box if connected, "?" in a box if not */ | |
| 97 | - V3270_OIA_MESSAGE, /**< message area */ | |
| 98 | - V3270_OIA_SSL, /**< SSL Status */ | |
| 99 | - /**< Meta indication ("M" or blank) */ | |
| 100 | - V3270_OIA_ALT, /**< Alt indication ("A" or blank) */ | |
| 101 | - /**< Compose indication ("C" or blank) */ | |
| 102 | - /**< Compose first character */ | |
| 103 | - V3270_OIA_SHIFT, /**< Shift Status */ | |
| 104 | - V3270_OIA_TYPEAHEAD, /**< Typeahead indication ("T" or blank) */ | |
| 105 | - V3270_OIA_INSERT, /**< Insert mode indication (Special symbol/"I" or blank) */ | |
| 106 | - V3270_OIA_SCRIPT, /**< Script indication ("S" or blank) */ | |
| 107 | - V3270_OIA_LUNAME, /**< LU Name */ | |
| 108 | - V3270_OIA_SPINNER, /**< command timing spinner */ | |
| 109 | - V3270_OIA_TIMER, /**< command timing (mmm:ss, or blank) */ | |
| 110 | - V3270_OIA_CURSOR_POSITION, /**< cursor position (rrr/ccc or blank) */ | |
| 111 | - | |
| 112 | -// V3270_OIA_CAPS, /**< Caps indication ("A" or blank) */ | |
| 113 | - | |
| 114 | -#ifdef X3270_PRINTER | |
| 115 | - V3270_OIA_PRINTER, /**< Printer indication ("P" or blank) */ | |
| 116 | -#endif // X3270_PRINTER | |
| 117 | - | |
| 118 | - V3270_OIA_FIELD_COUNT | |
| 119 | - | |
| 120 | - } V3270_OIA_FIELD; | |
| 121 | - | |
| 122 | - | |
| 123 | - #define V3270_COLOR_OIA_SPINNER V3270_COLOR_OIA_FOREGROUND | |
| 124 | - #define V3270_COLOR_OIA_LUNAME V3270_COLOR_OIA_FOREGROUND | |
| 125 | - #define V3270_COLOR_OIA_INSERT V3270_COLOR_OIA_FOREGROUND | |
| 126 | - | |
| 127 | - #ifndef v3270char | |
| 128 | - #define v3270char void | |
| 129 | - #endif // v3270_char | |
| 130 | - | |
| 131 | - GtkWidget * v3270_new(void); | |
| 132 | - GType v3270_get_type(void); | |
| 133 | - | |
| 134 | - void v3270_reload(GtkWidget * widget); | |
| 135 | - | |
| 136 | - void v3270_set_font_family(GtkWidget *widget, const gchar *name); | |
| 137 | - const gchar * v3270_get_font_family(GtkWidget *widget); | |
| 138 | - | |
| 139 | - H3270 * v3270_get_session(GtkWidget *widget); | |
| 140 | - | |
| 141 | - int v3270_connect(GtkWidget *widget, const gchar *host); | |
| 142 | - void v3270_disconnect(GtkWidget *widget); | |
| 143 | - | |
| 144 | - // Clipboard | |
| 145 | - typedef enum _v3270_select_format | |
| 146 | - { | |
| 147 | - V3270_SELECT_TEXT, | |
| 148 | - V3270_SELECT_TABLE, | |
| 149 | - | |
| 150 | - V3270_SELECT_MAX | |
| 151 | - } V3270_SELECT_FORMAT; | |
| 152 | - | |
| 153 | - const gchar * v3270_copy(GtkWidget *widget, V3270_SELECT_FORMAT mode); | |
| 154 | - const gchar * v3270_copy_append(GtkWidget *widget); | |
| 155 | - | |
| 156 | - const gchar * v3270_get_selected_text(GtkWidget *widget); | |
| 157 | - const gchar * v3270_get_copy(GtkWidget *widget); | |
| 158 | - gchar * v3270_get_text(GtkWidget *widget,int offset, int len); | |
| 159 | - gchar * v3270_get_region(GtkWidget *widget, gint start_pos, gint end_pos, gboolean all); | |
| 160 | - | |
| 161 | - void v3270_set_string(GtkWidget *widget, const gchar *str); | |
| 162 | - void v3270_tab(GtkWidget *widget); | |
| 163 | - void v3270_backtab(GtkWidget *widget); | |
| 164 | - | |
| 165 | - // Cut & Paste | |
| 166 | - gboolean v3270_get_selection_bounds(GtkWidget *widget, gint *start, gint *end); | |
| 167 | - void v3270_unselect(GtkWidget *widget); | |
| 168 | - void v3270_paste(GtkWidget *widget); | |
| 169 | - void v3270_paste_string(GtkWidget *widget, const gchar *text, const gchar *encoding); | |
| 170 | - void v3270_select_region(GtkWidget *widget, gint start, gint end); | |
| 171 | - | |
| 172 | - // Colors | |
| 173 | - void v3270_set_colors(GtkWidget *widget, const gchar *); | |
| 174 | - void v3270_set_color_table(GdkColor *table, const gchar *colors); | |
| 175 | - const GdkColor * v3270_get_color_table(GtkWidget *widget); | |
| 176 | - void v3270_set_mono_color_table(GdkColor *table, const gchar *fg, const gchar *bg); | |
| 177 | - void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned short attr, H3270 *session, guint height, GdkRectangle *rect, GdkColor *color); | |
| 178 | - void v3270_set_color(GtkWidget *widget, enum V3270_COLOR id, GdkColor *color); | |
| 179 | - GdkColor * v3270_get_color(GtkWidget *widget, enum V3270_COLOR id); | |
| 180 | - | |
| 181 | - // Misc | |
| 182 | - GtkIMContext * v3270_get_im_context(GtkWidget *widget); | |
| 183 | - gboolean v3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE ix); | |
| 184 | - void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type, const gchar *title, const gchar *message, const gchar *text); | |
| 185 | - | |
| 186 | - void v3270_set_host(GtkWidget *widget, const gchar *uri); | |
| 187 | - | |
| 188 | - | |
| 189 | -G_END_DECLS | |
| 190 | - | |
| 191 | -#endif // V3270_H_INCLUDED |
widget.c
| ... | ... | @@ -38,7 +38,7 @@ |
| 38 | 38 | #include <malloc.h> |
| 39 | 39 | #endif // HAVE_MALLOC_H |
| 40 | 40 | |
| 41 | - #include "v3270.h" | |
| 41 | + #include <lib3270/v3270.h> | |
| 42 | 42 | #include "private.h" |
| 43 | 43 | #include "accessible.h" |
| 44 | 44 | #include "marshal.h" |
| ... | ... | @@ -898,6 +898,12 @@ static void v3270_destroy(GtkObject *widget) |
| 898 | 898 | terminal->clipboard = NULL; |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | + if(terminal->session_name) | |
| 902 | + { | |
| 903 | + g_free(terminal->session_name); | |
| 904 | + terminal->session_name = NULL; | |
| 905 | + } | |
| 906 | + | |
| 901 | 907 | #if GTK_CHECK_VERSION(3,0,0) |
| 902 | 908 | GTK_WIDGET_CLASS(v3270_parent_class)->destroy(widget); |
| 903 | 909 | #else |
| ... | ... | @@ -1373,3 +1379,21 @@ void v3270_set_host(GtkWidget *widget, const gchar *uri) |
| 1373 | 1379 | g_return_if_fail(uri != NULL); |
| 1374 | 1380 | lib3270_set_host(GTK_V3270(widget)->host,uri); |
| 1375 | 1381 | } |
| 1382 | + | |
| 1383 | +const gchar * v3270_get_session_name(GtkWidget *widget) | |
| 1384 | +{ | |
| 1385 | + if(!GTK_IS_V3270(widget) || GTK_V3270(widget)->session_name == NULL) | |
| 1386 | + return g_get_application_name(); | |
| 1387 | + return GTK_V3270(widget)->session_name; | |
| 1388 | +} | |
| 1389 | + | |
| 1390 | +void v3270_set_session_name(GtkWidget *widget, const gchar *name) | |
| 1391 | +{ | |
| 1392 | + g_return_if_fail(GTK_IS_V3270(widget)); | |
| 1393 | + g_return_if_fail(name != NULL); | |
| 1394 | + | |
| 1395 | + if(GTK_V3270(widget)->session_name) | |
| 1396 | + g_free(GTK_V3270(widget)->session_name); | |
| 1397 | + | |
| 1398 | + GTK_V3270(widget)->session_name = g_strdup(name); | |
| 1399 | +} | ... | ... |