| 4456 GtkTextIter iter; |
4456 GtkTextIter iter; |
| 4457 int lines; |
4457 int lines; |
| 4458 GdkRectangle oneline; |
4458 GdkRectangle oneline; |
| 4459 int height, diff; |
4459 int height, diff; |
| 4460 int pad_top, pad_inside, pad_bottom; |
4460 int pad_top, pad_inside, pad_bottom; |
| 4461 int max_height = (gtkconv->imhtml->allocation.height + gtkconv->entry->allocation.height) / 2; |
4461 int total_height = (gtkconv->imhtml->allocation.height + gtkconv->entry->allocation.height); |
| |
4462 int max_height = total_height / 2; |
| |
4463 int min_height; |
| 4462 |
4464 |
| 4463 pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry)); |
4465 pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry)); |
| 4464 pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry)); |
4466 pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry)); |
| 4465 pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(gtkconv->entry)); |
4467 pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(gtkconv->entry)); |
| 4466 |
4468 |
| 4480 height += lines * (oneline.height + pad_top + pad_bottom); |
4482 height += lines * (oneline.height + pad_top + pad_bottom); |
| 4481 |
4483 |
| 4482 /* Make sure there's enough room for at least two lines. Allocate enough space to |
4484 /* Make sure there's enough room for at least two lines. Allocate enough space to |
| 4483 * prevent scrolling when the second line is a continuation of the first line, or |
4485 * prevent scrolling when the second line is a continuation of the first line, or |
| 4484 * is the beginning of a new paragraph. */ |
4486 * is the beginning of a new paragraph. */ |
| 4485 height = MAX(height, 2 * (oneline.height + MAX(pad_inside, pad_top + pad_bottom))); |
4487 min_height = 2 * (oneline.height + MAX(pad_inside, pad_top + pad_bottom)); |
| 4486 |
4488 height = CLAMP(height, min_height, max_height); |
| 4487 height = MIN(height, max_height); |
|
| 4488 |
4489 |
| 4489 diff = height - gtkconv->entry->allocation.height; |
4490 diff = height - gtkconv->entry->allocation.height; |
| 4490 if (diff == 0 || (diff < 0 && -diff < oneline.height / 2)) |
4491 if (ABS(diff) < oneline.height / 2) |
| 4491 return FALSE; |
4492 return FALSE; |
| 4492 |
4493 |
| 4493 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, |
4494 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, |
| 4494 diff + gtkconv->lower_hbox->allocation.height); |
4495 diff + gtkconv->lower_hbox->allocation.height); |
| 4495 |
4496 |
| 4762 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "pixbuf", CONV_EMBLEM_COLUMN, NULL); |
4763 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "pixbuf", CONV_EMBLEM_COLUMN, NULL); |
| 4763 g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0, NULL); |
4764 g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0, NULL); |
| 4764 |
4765 |
| 4765 /* Setup the gtkimhtml widget */ |
4766 /* Setup the gtkimhtml widget */ |
| 4766 frame = pidgin_create_imhtml(FALSE, >kconv->imhtml, NULL, &imhtml_sw); |
4767 frame = pidgin_create_imhtml(FALSE, >kconv->imhtml, NULL, &imhtml_sw); |
| |
4768 gtk_widget_set_size_request(gtkconv->imhtml, -1, 0); |
| 4767 if (chat) { |
4769 if (chat) { |
| 4768 GtkWidget *hpaned; |
4770 GtkWidget *hpaned; |
| 4769 |
4771 |
| 4770 /* Add the topic */ |
4772 /* Add the topic */ |
| 4771 setup_chat_topic(gtkconv, vbox); |
4773 setup_chat_topic(gtkconv, vbox); |