# HG changeset patch # User Sadrul Habib Chowdhury # Date 1208104137 0 # Node ID 0de4b47d36ab915b6d7883dce9c5dd6b6b666ba7 # Parent 58b109b8a4e85516835915f5803797eb01f8d4c1 Do not show tooltips for
or s in gtkimhtml. Fixes #5480. There are a bunch of white-space fixes in there as well. diff -r 58b109b8a4e8 -r 0de4b47d36ab pidgin/gtkimhtml.c --- a/pidgin/gtkimhtml.c Sat Apr 12 06:52:07 2008 +0000 +++ b/pidgin/gtkimhtml.c Sun Apr 13 16:28:57 2008 +0000 @@ -359,17 +359,17 @@ GtkTextIter iter; gboolean scroll = TRUE; - gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter); + gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter); gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(widget), &rect); - gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(imhtml), &iter, &y, &height); - - if(((y + height) - (rect.y + rect.height)) > height - && gtk_text_buffer_get_char_count(imhtml->text_buffer)){ - scroll = FALSE; - } - - if(imhtml->old_rect.width != rect.width || imhtml->old_rect.height != rect.height){ + gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(imhtml), &iter, &y, &height); + + if (((y + height) - (rect.y + rect.height)) > height && + gtk_text_buffer_get_char_count(imhtml->text_buffer)) { + scroll = FALSE; + } + + if(imhtml->old_rect.width != rect.width || imhtml->old_rect.height != rect.height) { GList *iter = GTK_IMHTML(widget)->scalables; xminus = gtk_text_view_get_left_margin(GTK_TEXT_VIEW(widget)) + @@ -386,11 +386,11 @@ imhtml->old_rect = rect; parent_size_allocate(widget, alloc); - + /* Don't scroll here if we're in the middle of a smooth scroll */ if (scroll && imhtml->scroll_time == NULL && - GTK_WIDGET_REALIZED(imhtml)) - gtk_imhtml_scroll_to_end(imhtml, FALSE); + GTK_WIDGET_REALIZED(imhtml)) + gtk_imhtml_scroll_to_end(imhtml, FALSE); } static gint @@ -576,11 +576,11 @@ /* If we don't have a tip from a URL, let's see if we have a tip from a smiley */ anchor = gtk_text_iter_get_child_anchor(&iter); if (anchor) { - tip = g_object_get_data(G_OBJECT(anchor), "gtkimhtml_plaintext"); + tip = g_object_get_data(G_OBJECT(anchor), "gtkimhtml_tiptext"); hand = FALSE; } - if (tip){ + if (tip && *tip) { if (!GTK_IMHTML(imhtml)->editable && hand) gdk_window_set_cursor(win, GTK_IMHTML(imhtml)->hand_cursor); GTK_IMHTML(imhtml)->tip_timer = g_timeout_add (TOOLTIP_TIMEOUT, @@ -2268,8 +2268,7 @@ GSList *unused) { GtkTextIter iter, ins, sel; - GdkRectangle rect; - int y, height, ins_offset = 0, sel_offset = 0; + int ins_offset = 0, sel_offset = 0; gboolean fixins = FALSE, fixsel = FALSE; g_return_if_fail (imhtml != NULL); @@ -2290,13 +2289,17 @@ sel_offset = gtk_text_iter_get_offset(&sel); } - gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(imhtml), &rect); - gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(imhtml), &iter, &y, &height); - - - if(((y + height) - (rect.y + rect.height)) > height - && gtk_text_buffer_get_char_count(imhtml->text_buffer)){ - options |= GTK_IMHTML_NO_SCROLL; + if (!(options & GTK_IMHTML_NO_SCROLL)) { + GdkRectangle rect; + int y, height; + + gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(imhtml), &rect); + gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(imhtml), &iter, &y, &height); + + if (((y + height) - (rect.y + rect.height)) > height && + gtk_text_buffer_get_char_count(imhtml->text_buffer)) { + options |= GTK_IMHTML_NO_SCROLL; + } } gtk_imhtml_insert_html_at_iter(imhtml, text, options, &iter); @@ -4713,8 +4716,11 @@ } if (icon) { + char *text = g_strdup(unescaped); /* Do not g_free 'text'. + It will be destroyed when 'anchor' is destroyed. */ anchor = gtk_text_buffer_create_child_anchor(imhtml->text_buffer, iter); - g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", g_strdup(unescaped), g_free); + g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", text, g_free); + g_object_set_data(G_OBJECT(anchor), "gtkimhtml_tiptext", text); g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_htmltext", g_strdup(smiley), g_free); /* This catches the expose events generated by animated @@ -4732,9 +4738,11 @@ imhtml_smiley->anchors = g_slist_append(imhtml_smiley->anchors, anchor); if (ebox) { GtkWidget *img = gtk_image_new_from_stock(GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_MENU); + char *text = g_strdup(unescaped); gtk_container_add(GTK_CONTAINER(ebox), img); gtk_widget_show(img); - g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", g_strdup(unescaped), g_free); + g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", text, g_free); + g_object_set_data(G_OBJECT(anchor), "gtkimhtml_tiptext", text); gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), ebox, anchor); } } else {