pidgin.next.minor: 91775268: The first thing gtk_text_buffer_delete_s...

markdoliner at pidgin.im markdoliner at pidgin.im
Wed Jan 28 03:35:25 EST 2009


-----------------------------------------------------------------
Revision: 917752686724d1f24ddeeb381cb0e857de193495
Ancestor: 0f6448611cd49bf03cc4646ca0fa7e8d0fd8bea0
Author: markdoliner at pidgin.im
Date: 2009-01-28T08:31:47
Branch: im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/917752686724d1f24ddeeb381cb0e857de193495

Modified files:
        pidgin/gtkimhtml.c

ChangeLog: 

The first thing gtk_text_buffer_delete_selection does is call
gtk_text_buffer_get_selection_bounds and check if anything is
selected, so we don't need to do it ourselves.

Side note: gtk_text_buffer_delete_selection is exactly the same
in gtk HEAD as it was in 2.0.0

-------------- next part --------------
============================================================
--- pidgin/gtkimhtml.c	747dfc91cbf52712e69b9a781ab1d9c69ade5052
+++ pidgin/gtkimhtml.c	79c793226b2f9ce62c3f3f58858bf46a07671e01
@@ -1125,8 +1125,8 @@ static void imhtml_paste_insert(GtkIMHtm
 	GtkTextIter iter;
 	GtkIMHtmlOptions flags = plaintext ? GTK_IMHTML_NO_SMILEY : (GTK_IMHTML_NO_NEWLINE | GTK_IMHTML_NO_COMMENTS);
 
-	if (gtk_text_buffer_get_selection_bounds(imhtml->text_buffer, NULL, NULL))
-		gtk_text_buffer_delete_selection(imhtml->text_buffer, TRUE, TRUE);
+	/* Delete any currently selected text */
+	gtk_text_buffer_delete_selection(imhtml->text_buffer, TRUE, TRUE);
 
 	gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &iter, gtk_text_buffer_get_insert(imhtml->text_buffer));
 	if (!imhtml->wbfo && !plaintext)
@@ -4902,8 +4902,8 @@ void gtk_imhtml_insert_link(GtkIMHtml *i
 {
 	GtkTextIter iter;
 
-	if (gtk_text_buffer_get_selection_bounds(imhtml->text_buffer, NULL, NULL))
-		gtk_text_buffer_delete_selection(imhtml->text_buffer, TRUE, TRUE);
+	/* Delete any currently selected text */
+	gtk_text_buffer_delete_selection(imhtml->text_buffer, TRUE, TRUE);
 
 	gtk_imhtml_toggle_link(imhtml, url);
 	gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &iter, mark);
@@ -4916,8 +4916,8 @@ void gtk_imhtml_insert_smiley(GtkIMHtml 
 	GtkTextMark *mark;
 	GtkTextIter iter;
 
-	if (gtk_text_buffer_get_selection_bounds(imhtml->text_buffer, NULL, NULL))
-		gtk_text_buffer_delete_selection(imhtml->text_buffer, TRUE, TRUE);
+	/* Delete any currently selected text */
+	gtk_text_buffer_delete_selection(imhtml->text_buffer, TRUE, TRUE);
 
 	mark = gtk_text_buffer_get_insert(imhtml->text_buffer);
 


More information about the Commits mailing list