| 2496 CONV_ICON_COLUMN, infopane_status, -1); |
2496 CONV_ICON_COLUMN, infopane_status, -1); |
| 2497 |
2497 |
| 2498 gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model), |
2498 gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model), |
| 2499 &(gtkconv->infopane_iter), |
2499 &(gtkconv->infopane_iter), |
| 2500 CONV_EMBLEM_COLUMN, emblem, -1); |
2500 CONV_EMBLEM_COLUMN, emblem, -1); |
| |
2501 if (emblem) |
| |
2502 g_object_unref(emblem); |
| 2501 |
2503 |
| 2502 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")) { |
2504 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")) { |
| |
2505 emblem = pidgin_create_prpl_icon(gtkconv->active_conv->account, PIDGIN_PRPL_ICON_SMALL); |
| 2503 gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model), |
2506 gtk_list_store_set(GTK_LIST_STORE(gtkconv->infopane_model), |
| 2504 &(gtkconv->infopane_iter), |
2507 &(gtkconv->infopane_iter), |
| 2505 CONV_PROTOCOL_ICON_COLUMN, pidgin_create_prpl_icon(gtkconv->active_conv->account, PIDGIN_PRPL_ICON_SMALL), -1); |
2508 CONV_PROTOCOL_ICON_COLUMN, emblem, -1); |
| |
2509 if (emblem) |
| |
2510 g_object_unref(emblem); |
| 2506 } |
2511 } |
| 2507 |
2512 |
| 2508 /* XXX seanegan Why do I have to do this? */ |
2513 /* XXX seanegan Why do I have to do this? */ |
| 2509 gtk_widget_queue_draw(gtkconv->infopane); |
2514 gtk_widget_queue_draw(gtkconv->infopane); |
| 2510 |
2515 |
| 4356 menuitem = gtk_separator_menu_item_new(); |
4361 menuitem = gtk_separator_menu_item_new(); |
| 4357 gtk_widget_show(menuitem); |
4362 gtk_widget_show(menuitem); |
| 4358 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuitem, 1); |
4363 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuitem, 1); |
| 4359 } |
4364 } |
| 4360 |
4365 |
| 4361 |
|
| 4362 static void resize_imhtml_cb(PidginConversation *gtkconv) |
4366 static void resize_imhtml_cb(PidginConversation *gtkconv) |
| 4363 { |
4367 { |
| 4364 GtkTextBuffer *buffer; |
4368 GtkTextBuffer *buffer; |
| 4365 GtkTextIter iter; |
4369 GtkTextIter iter; |
| 4366 int wrapped_lines; |
4370 int wrapped_lines; |
| 4367 int lines; |
4371 int lines; |
| 4368 GdkRectangle oneline; |
4372 GdkRectangle oneline; |
| 4369 GtkRequisition sr; |
4373 GtkRequisition sr; |
| 4370 int height; |
4374 int height, diff; |
| 4371 int pad_top, pad_inside, pad_bottom; |
4375 int pad_top, pad_inside, pad_bottom; |
| 4372 |
4376 |
| 4373 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
4377 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
| 4374 |
4378 |
| 4375 wrapped_lines = 1; |
4379 wrapped_lines = 1; |
| 4376 gtk_text_buffer_get_start_iter(buffer, &iter); |
4380 gtk_text_buffer_get_start_iter(buffer, &iter); |
| 4377 gtk_text_view_get_iter_location(GTK_TEXT_VIEW(gtkconv->entry), &iter, &oneline); |
4381 gtk_text_view_get_iter_location(GTK_TEXT_VIEW(gtkconv->entry), &iter, &oneline); |
| 4378 while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(gtkconv->entry), &iter)) |
4382 while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(gtkconv->entry), &iter)) |
| 4379 wrapped_lines++; |
4383 wrapped_lines++; |
| 4380 |
4384 |
| 4381 lines = gtk_text_buffer_get_line_count(buffer); |
4385 lines = gtk_text_buffer_get_line_count(buffer); |
| 4382 |
4386 |
| 4383 /* Show a maximum of 4 lines */ |
4387 /* Show a maximum of 4 lines */ |
| 4384 lines = MIN(lines, 4); |
4388 lines = MIN(lines, 4); |
| 4385 wrapped_lines = MIN(wrapped_lines, 4); |
4389 wrapped_lines = MIN(wrapped_lines, 4); |
| 4386 |
4390 |
| 4387 pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry)); |
4391 pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry)); |
| 4388 pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry)); |
4392 pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry)); |
| 4389 pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(gtkconv->entry)); |
4393 pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(gtkconv->entry)); |
| 4390 |
4394 |
| 4391 height = (oneline.height + pad_top + pad_bottom) * lines; |
4395 height = (oneline.height + pad_top + pad_bottom) * lines; |
| 4392 height += (oneline.height + pad_inside) * (wrapped_lines - lines); |
4396 height += (oneline.height + pad_inside) * (wrapped_lines - lines); |
| 4393 |
4397 |
| 4394 gtkconv->auto_resize = TRUE; |
4398 gtkconv->auto_resize = TRUE; |
| 4395 g_idle_add(reset_auto_resize_cb, gtkconv); |
4399 g_idle_add(reset_auto_resize_cb, gtkconv); |
| 4396 gtk_widget_size_request(gtkconv->lower_hbox, &sr); |
4400 |
| 4397 if (sr.height < height + PIDGIN_HIG_BOX_SPACE) { |
4401 diff = height - gtkconv->entry->allocation.height; |
| |
4402 |
| |
4403 if (diff > 0) { |
| |
4404 gtk_widget_size_request(gtkconv->lower_hbox, &sr); |
| 4398 gtkconv->entry_growing = TRUE; |
4405 gtkconv->entry_growing = TRUE; |
| 4399 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, height + PIDGIN_HIG_BOX_SPACE); |
4406 |
| |
4407 /* uncomment this to auto resize even after the user manually |
| |
4408 resizes |
| |
4409 gtk_paned_set_position(GTK_PANED(gtkconv->lower_hbox->parent->parent), |
| |
4410 -1); |
| |
4411 */ |
| |
4412 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, |
| |
4413 diff + gtkconv->lower_hbox->allocation.height); |
| 4400 } |
4414 } |
| 4401 } |
4415 } |
| 4402 |
4416 |
| 4403 static void |
4417 static void |
| 4404 setup_chat_topic(PidginConversation *gtkconv, GtkWidget *vbox) |
4418 setup_chat_topic(PidginConversation *gtkconv, GtkWidget *vbox) |
| 4725 g_object_set(rend, "ypad", 0, "yalign", 0.5, NULL); |
4739 g_object_set(rend, "ypad", 0, "yalign", 0.5, NULL); |
| 4726 |
4740 |
| 4727 #if GTK_CHECK_VERSION(2, 6, 0) |
4741 #if GTK_CHECK_VERSION(2, 6, 0) |
| 4728 g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
4742 g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
| 4729 #endif |
4743 #endif |
| 4730 |
|
| 4731 |
4744 |
| 4732 rend = gtk_cell_renderer_pixbuf_new(); |
4745 rend = gtk_cell_renderer_pixbuf_new(); |
| 4733 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(gtkconv->infopane), rend, FALSE); |
4746 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(gtkconv->infopane), rend, FALSE); |
| 4734 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "pixbuf", CONV_PROTOCOL_ICON_COLUMN, NULL); |
4747 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "pixbuf", CONV_PROTOCOL_ICON_COLUMN, NULL); |
| 4735 g_object_set(rend, "xalign", 0.0, "xpad", 3, "ypad", 0, NULL); |
4748 g_object_set(rend, "xalign", 0.0, "xpad", 3, "ypad", 0, NULL); |
| 5126 |
5139 |
| 5127 void |
5140 void |
| 5128 pidgin_conv_new(PurpleConversation *conv) |
5141 pidgin_conv_new(PurpleConversation *conv) |
| 5129 { |
5142 { |
| 5130 private_gtkconv_new(conv, FALSE); |
5143 private_gtkconv_new(conv, FALSE); |
| |
5144 if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) |
| |
5145 purple_signal_emit(pidgin_conversations_get_handle(), |
| |
5146 "conversation-displayed", PIDGIN_CONVERSATION(conv)); |
| 5131 } |
5147 } |
| 5132 |
5148 |
| 5133 static void |
5149 static void |
| 5134 received_im_msg_cb(PurpleAccount *account, char *sender, char *message, |
5150 received_im_msg_cb(PurpleAccount *account, char *sender, char *message, |
| 5135 PurpleConversation *conv, PurpleMessageFlags flags) |
5151 PurpleConversation *conv, PurpleMessageFlags flags) |