| 1035 |
1035 |
| 1036 static void paste_plaintext_received_cb (GtkClipboard *clipboard, const gchar *text, gpointer data) |
1036 static void paste_plaintext_received_cb (GtkClipboard *clipboard, const gchar *text, gpointer data) |
| 1037 { |
1037 { |
| 1038 char *tmp; |
1038 char *tmp; |
| 1039 |
1039 |
| 1040 if (text == NULL) |
1040 if (text == NULL || !(*text)) |
| 1041 return; |
1041 return; |
| 1042 |
1042 |
| 1043 tmp = g_markup_escape_text(text, -1); |
1043 tmp = g_markup_escape_text(text, -1); |
| 1044 imhtml_paste_insert(data, tmp, TRUE); |
1044 imhtml_paste_insert(data, tmp, TRUE); |
| 1045 g_free(tmp); |
1045 g_free(tmp); |
| 1051 GtkIMHtml *imhtml = data; |
1051 GtkIMHtml *imhtml = data; |
| 1052 |
1052 |
| 1053 if (!gtk_text_view_get_editable(GTK_TEXT_VIEW(imhtml))) |
1053 if (!gtk_text_view_get_editable(GTK_TEXT_VIEW(imhtml))) |
| 1054 return; |
1054 return; |
| 1055 |
1055 |
| 1056 if (imhtml->wbfo || selection_data->length < 0) { |
1056 if (imhtml->wbfo || selection_data->length <= 0) { |
| 1057 gtk_clipboard_request_text(clipboard, paste_plaintext_received_cb, imhtml); |
1057 gtk_clipboard_request_text(clipboard, paste_plaintext_received_cb, imhtml); |
| 1058 return; |
1058 return; |
| 1059 } else { |
1059 } else { |
| 1060 #if 0 |
1060 #if 0 |
| 1061 /* Here's some debug code, for figuring out what sent to us over the clipboard. */ |
1061 /* Here's some debug code, for figuring out what sent to us over the clipboard. */ |