Commit 6b58b3f66a63b412685eaecb4663e8d019892e83
1 parent
4afc4a58
Exists in
master
and in
1 other branch
Iniciando implementação do recurso "copy" com atributos
Showing
3 changed files
with
14 additions
and
11 deletions
Show diff stats
private.h
| ... | ... | @@ -244,6 +244,8 @@ void v3270_draw_shift_status(v3270 *terminal); |
| 244 | 244 | void v3270_draw_alt_status(v3270 *terminal); |
| 245 | 245 | void v3270_draw_ins_status(v3270 *terminal); |
| 246 | 246 | |
| 247 | +void v3270_clear_clipboard(v3270 *terminal); | |
| 248 | + | |
| 247 | 249 | void v3270_update_cursor_surface(v3270 *widget,unsigned char chr,unsigned short attr); |
| 248 | 250 | |
| 249 | 251 | void v3270_register_io_handlers(v3270Class *cls); | ... | ... |
selection.c
| ... | ... | @@ -138,11 +138,7 @@ const gchar * v3270_get_selected_text(GtkWidget *widget, gboolean cut) |
| 138 | 138 | |
| 139 | 139 | terminal = GTK_V3270(widget); |
| 140 | 140 | |
| 141 | - if(terminal->clipboard) | |
| 142 | - { | |
| 143 | - g_free(terminal->clipboard); | |
| 144 | - terminal->clipboard = NULL; | |
| 145 | - } | |
| 141 | + v3270_clear_clipboard(terminal); | |
| 146 | 142 | |
| 147 | 143 | if(cut) |
| 148 | 144 | text = lib3270_cut_selected(terminal->host); |
| ... | ... | @@ -276,7 +272,7 @@ const gchar * v3270_copy_append(GtkWidget *widget) |
| 276 | 272 | clip = g_strconcat(terminal->clipboard,"\n",text,NULL); |
| 277 | 273 | |
| 278 | 274 | g_free(text); |
| 279 | - g_free(terminal->clipboard); | |
| 275 | + v3270_clear_clipboard(terminal); | |
| 280 | 276 | |
| 281 | 277 | terminal->clipboard = clip; |
| 282 | 278 | ... | ... |
widget.c
| ... | ... | @@ -895,6 +895,15 @@ GtkWidget * v3270_new(void) |
| 895 | 895 | return g_object_new(GTK_TYPE_V3270, NULL); |
| 896 | 896 | } |
| 897 | 897 | |
| 898 | +void v3270_clear_clipboard(v3270 *terminal) | |
| 899 | +{ | |
| 900 | + if(terminal->clipboard) | |
| 901 | + { | |
| 902 | + g_free(terminal->clipboard); | |
| 903 | + terminal->clipboard = NULL; | |
| 904 | + } | |
| 905 | +} | |
| 906 | + | |
| 898 | 907 | #if GTK_CHECK_VERSION(3,0,0) |
| 899 | 908 | static void v3270_destroy(GtkWidget *widget) |
| 900 | 909 | #else |
| ... | ... | @@ -969,11 +978,7 @@ static void v3270_destroy(GtkObject *widget) |
| 969 | 978 | terminal->input_method = NULL; |
| 970 | 979 | } |
| 971 | 980 | |
| 972 | - if(terminal->clipboard) | |
| 973 | - { | |
| 974 | - g_free(terminal->clipboard); | |
| 975 | - terminal->clipboard = NULL; | |
| 976 | - } | |
| 981 | + v3270_clear_clipboard(terminal); | |
| 977 | 982 | |
| 978 | 983 | if(terminal->session_name) |
| 979 | 984 | { | ... | ... |