Commit 37e8f615dafbae5c52b0f22efe092a5079453514
1 parent
39c215e0
Exists in
master
and in
1 other branch
Implementando métodos para que um script rexx possa alterar o clipboard salvo
Showing
1 changed file
with
35 additions
and
0 deletions
Show diff stats
selection.c
| ... | ... | @@ -244,6 +244,41 @@ gchar * v3270_get_copy(GtkWidget *widget) |
| 244 | 244 | return NULL; |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | +void v3270_set_copy(GtkWidget *widget, const gchar *text) | |
| 248 | +{ | |
| 249 | + v3270 * terminal; | |
| 250 | + gchar * isotext; | |
| 251 | + | |
| 252 | + g_return_if_fail(GTK_IS_V3270(widget)); | |
| 253 | + | |
| 254 | + terminal = GTK_V3270(widget); | |
| 255 | + v3270_clear_clipboard(terminal); | |
| 256 | + | |
| 257 | + if(!text) | |
| 258 | + { | |
| 259 | + /* No string, signal clipboard clear and return */ | |
| 260 | + g_signal_emit(widget,v3270_widget_signal[SIGNAL_CLIPBOARD], 0, FALSE); | |
| 261 | + return; | |
| 262 | + } | |
| 263 | + | |
| 264 | + /* Received text, replace the selection buffer */ | |
| 265 | + terminal->table = 0; | |
| 266 | + isotext = g_convert(text, -1, lib3270_get_charset(terminal->host), "UTF-8", NULL, NULL, NULL); | |
| 267 | + | |
| 268 | + if(!isotext) | |
| 269 | + { | |
| 270 | + /* No string, signal clipboard clear and return */ | |
| 271 | + g_signal_emit(widget,v3270_widget_signal[SIGNAL_CLIPBOARD], 0, FALSE); | |
| 272 | + return; | |
| 273 | + } | |
| 274 | + | |
| 275 | + terminal->selection.text = lib3270_strdup(isotext); | |
| 276 | + | |
| 277 | + g_free(isotext); | |
| 278 | + | |
| 279 | + g_signal_emit(widget,v3270_widget_signal[SIGNAL_CLIPBOARD], 0, TRUE); | |
| 280 | +} | |
| 281 | + | |
| 247 | 282 | static void update_system_clipboard(GtkWidget *widget) |
| 248 | 283 | { |
| 249 | 284 | if(GTK_V3270(widget)->selection.text) | ... | ... |