Mercurial > pidgin.yaz
diff pidgin/gtkconv.c @ 21077:488796f5ba33
propagate from branch 'im.pidgin.pidgin' (head 4d50bf3b08569aa2108a9f5da47fb1548d0c7dd9)
to branch 'org.maemo.garage.pidgin.pidgin.dialog-transience' (head 2de97b7c8c13f4714a53d342a4dc68ecd8fc2248)
author | Gabriel Schulhof <nix@go-nix.ca> |
---|---|
date | Tue, 09 Oct 2007 18:01:51 +0000 |
parents | b84655373d7b 9da2ac85ce81 |
children | 8c9aad9479c0 c5f9e1eb59d5 |
line wrap: on
line diff
--- a/pidgin/gtkconv.c Mon Oct 08 16:06:39 2007 +0000 +++ b/pidgin/gtkconv.c Tue Oct 09 18:01:51 2007 +0000 @@ -2498,11 +2498,16 @@ gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model), &(gtkconv->infopane_iter), CONV_EMBLEM_COLUMN, emblem, -1); + if (emblem) + g_object_unref(emblem); if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")) { + emblem = pidgin_create_prpl_icon(gtkconv->active_conv->account, PIDGIN_PRPL_ICON_SMALL); gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model), &(gtkconv->infopane_iter), - CONV_PROTOCOL_ICON_COLUMN, pidgin_create_prpl_icon(gtkconv->active_conv->account, PIDGIN_PRPL_ICON_SMALL), -1); + CONV_PROTOCOL_ICON_COLUMN, emblem, -1); + if (emblem) + g_object_unref(emblem); } /* XXX seanegan Why do I have to do this? */ @@ -4358,45 +4363,54 @@ gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuitem, 1); } - static void resize_imhtml_cb(PidginConversation *gtkconv) { GtkTextBuffer *buffer; GtkTextIter iter; - int wrapped_lines; - int lines; - GdkRectangle oneline; + int wrapped_lines; + int lines; + GdkRectangle oneline; GtkRequisition sr; - int height; - int pad_top, pad_inside, pad_bottom; + int height, diff; + int pad_top, pad_inside, pad_bottom; buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); - wrapped_lines = 1; - gtk_text_buffer_get_start_iter(buffer, &iter); - gtk_text_view_get_iter_location(GTK_TEXT_VIEW(gtkconv->entry), &iter, &oneline); - while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(gtkconv->entry), &iter)) - wrapped_lines++; - - lines = gtk_text_buffer_get_line_count(buffer); - - /* Show a maximum of 4 lines */ - lines = MIN(lines, 4); - wrapped_lines = MIN(wrapped_lines, 4); - - pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry)); - pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry)); - pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(gtkconv->entry)); - - height = (oneline.height + pad_top + pad_bottom) * lines; - height += (oneline.height + pad_inside) * (wrapped_lines - lines); + wrapped_lines = 1; + gtk_text_buffer_get_start_iter(buffer, &iter); + gtk_text_view_get_iter_location(GTK_TEXT_VIEW(gtkconv->entry), &iter, &oneline); + while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(gtkconv->entry), &iter)) + wrapped_lines++; + + lines = gtk_text_buffer_get_line_count(buffer); + + /* Show a maximum of 4 lines */ + lines = MIN(lines, 4); + wrapped_lines = MIN(wrapped_lines, 4); + + pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry)); + pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry)); + pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(gtkconv->entry)); + + height = (oneline.height + pad_top + pad_bottom) * lines; + height += (oneline.height + pad_inside) * (wrapped_lines - lines); gtkconv->auto_resize = TRUE; - g_idle_add(reset_auto_resize_cb, gtkconv); - gtk_widget_size_request(gtkconv->lower_hbox, &sr); - if (sr.height < height + PIDGIN_HIG_BOX_SPACE) { + g_idle_add(reset_auto_resize_cb, gtkconv); + + diff = height - gtkconv->entry->allocation.height; + + if (diff > 0) { + gtk_widget_size_request(gtkconv->lower_hbox, &sr); gtkconv->entry_growing = TRUE; - gtk_widget_set_size_request(gtkconv->lower_hbox, -1, height + PIDGIN_HIG_BOX_SPACE); + + /* uncomment this to auto resize even after the user manually + resizes + gtk_paned_set_position(GTK_PANED(gtkconv->lower_hbox->parent->parent), + -1); + */ + gtk_widget_set_size_request(gtkconv->lower_hbox, -1, + diff + gtkconv->lower_hbox->allocation.height); } } @@ -4728,7 +4742,6 @@ g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); #endif - rend = gtk_cell_renderer_pixbuf_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(gtkconv->infopane), rend, FALSE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "pixbuf", CONV_PROTOCOL_ICON_COLUMN, NULL);