diff src/gtkimhtml.c @ 7353:dc35b4a42fea

[gaim-migrate @ 7944] This gets rid of the gtk critical warning regarding clipboards and fixes the broken highlighting (when highlighting text with no smileys... I'm not sure how to get that to work when there are smileys... but I'll work on it.) committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Mon, 27 Oct 2003 19:47:57 +0000
parents 15155dbc768a
children 5a35881e9e89
line wrap: on
line diff
--- a/src/gtkimhtml.c	Mon Oct 27 18:40:11 2003 +0000
+++ b/src/gtkimhtml.c	Mon Oct 27 19:47:57 2003 +0000
@@ -376,8 +376,11 @@
 	text = gtk_text_buffer_get_text(imhtml->text_buffer, &last, &end, FALSE);
 	str = g_string_append(str, text);
 	g_free(text);
-
-	gtk_clipboard_set_text(clipboard, str->str, str->len);
+	
+	if (!gtk_text_iter_equal(&start, &last);
+	gtk_clipboard_set_text(clipboard ? clipboard :  
+			       gtk_widget_get_clipboard(GTK_WIDGET(imhtml), GDK_SELECTION_CLIPBOARD), 
+			       str->str, str->len);
 	g_string_free(str, TRUE);
 }
 
@@ -488,8 +491,7 @@
 	g_signal_connect(G_OBJECT(imhtml), "motion-notify-event", G_CALLBACK(gtk_motion_event_notify), NULL);
 	g_signal_connect(G_OBJECT(imhtml), "leave-notify-event", G_CALLBACK(gtk_leave_event_notify), NULL);
 	g_signal_connect(G_OBJECT(imhtml), "key_press_event", G_CALLBACK(gtk_key_pressed_cb), NULL);
-	g_signal_connect(G_OBJECT(imhtml), "copy-clipboard", G_CALLBACK(copy_clipboard_cb),  
-			 gtk_widget_get_clipboard(GTK_WIDGET(imhtml), GDK_SELECTION_CLIPBOARD));
+	g_signal_connect(G_OBJECT(imhtml), "copy-clipboard", G_CALLBACK(copy_clipboard_cb), NULL);
 	g_signal_connect(G_OBJECT(imhtml), "button-release-event", G_CALLBACK(button_release_cb), imhtml);
 	gtk_widget_add_events(GTK_WIDGET(imhtml), GDK_LEAVE_NOTIFY_MASK);