| 8446 conv_type = purple_conversation_get_type(conv); |
8446 conv_type = purple_conversation_get_type(conv); |
| 8447 |
8447 |
| 8448 win->gtkconvs = g_list_append(win->gtkconvs, gtkconv); |
8448 win->gtkconvs = g_list_append(win->gtkconvs, gtkconv); |
| 8449 gtkconv->win = win; |
8449 gtkconv->win = win; |
| 8450 |
8450 |
| |
8451 if (win->gtkconvs && win->gtkconvs->next && win->gtkconvs->next->next == NULL) |
| |
8452 pidgin_conv_tab_pack(win, ((PidginConversation*)win->gtkconvs->data)); |
| |
8453 |
| |
8454 |
| 8451 /* Close button. */ |
8455 /* Close button. */ |
| 8452 gtkconv->close = gtk_button_new(); |
8456 gtkconv->close = gtk_button_new(); |
| 8453 gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &close_button_width, &close_button_height); |
8457 gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &close_button_width, &close_button_height); |
| 8454 if (gtk_check_version(2, 4, 2) == NULL) { |
8458 if (gtk_check_version(2, 4, 2) == NULL) { |
| 8455 /* Need to account for extra padding around the gtkbutton */ |
8459 /* Need to account for extra padding around the gtkbutton */ |
| 8515 |
8519 |
| 8516 if (pidgin_conv_window_get_gtkconv_count(win) == 1) { |
8520 if (pidgin_conv_window_get_gtkconv_count(win) == 1) { |
| 8517 /* Er, bug in notebooks? Switch to the page manually. */ |
8521 /* Er, bug in notebooks? Switch to the page manually. */ |
| 8518 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0); |
8522 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0); |
| 8519 |
8523 |
| 8520 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE); |
8524 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), |
| 8521 } else |
8525 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/tabs")); |
| |
8526 } else { |
| 8522 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), TRUE); |
8527 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), TRUE); |
| |
8528 } |
| 8523 |
8529 |
| 8524 focus_gtkconv = g_list_nth_data(pidgin_conv_window_get_gtkconvs(win), |
8530 focus_gtkconv = g_list_nth_data(pidgin_conv_window_get_gtkconvs(win), |
| 8525 gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook))); |
8531 gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook))); |
| 8526 gtk_widget_grab_focus(focus_gtkconv->entry); |
8532 gtk_widget_grab_focus(focus_gtkconv->entry); |
| 8527 |
8533 |
| 8543 angle = 90; |
8549 angle = 90; |
| 8544 else if (purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") == (GTK_POS_RIGHT|8)) |
8550 else if (purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") == (GTK_POS_RIGHT|8)) |
| 8545 angle = 270; |
8551 angle = 270; |
| 8546 |
8552 |
| 8547 #if GTK_CHECK_VERSION(2,6,0) |
8553 #if GTK_CHECK_VERSION(2,6,0) |
| 8548 if (!angle) |
8554 if (!angle && pidgin_conv_window_get_gtkconv_count(win) > 1) { |
| 8549 g_object_set(G_OBJECT(gtkconv->tab_label), "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
8555 g_object_set(G_OBJECT(gtkconv->tab_label), "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
| 8550 else |
8556 gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), 6); |
| |
8557 } else { |
| 8551 g_object_set(G_OBJECT(gtkconv->tab_label), "ellipsize", PANGO_ELLIPSIZE_NONE, NULL); |
8558 g_object_set(G_OBJECT(gtkconv->tab_label), "ellipsize", PANGO_ELLIPSIZE_NONE, NULL); |
| 8552 gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), 6); |
8559 gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), -1); |
| |
8560 } |
| |
8561 |
| 8553 if (tabs_side) { |
8562 if (tabs_side) { |
| 8554 gtk_label_set_width_chars( |
8563 gtk_label_set_width_chars( |
| 8555 GTK_LABEL(gtkconv->tab_label), |
8564 GTK_LABEL(gtkconv->tab_label), |
| 8556 MIN(g_utf8_strlen(gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)), -1), 12) |
8565 MIN(g_utf8_strlen(gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)), -1), 12) |
| 8557 ); |
8566 ); |
| 8606 |
8615 |
| 8607 /* Reset the tabs label to the new version */ |
8616 /* Reset the tabs label to the new version */ |
| 8608 gtk_notebook_set_tab_label(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, ebox); |
8617 gtk_notebook_set_tab_label(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, ebox); |
| 8609 } |
8618 } |
| 8610 |
8619 |
| 8611 gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, !tabs_side && !angle, TRUE, GTK_PACK_START); |
8620 gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, |
| |
8621 !tabs_side && !angle && pidgin_conv_window_get_gtkconv_count(win) > 1, |
| |
8622 TRUE, GTK_PACK_START); |
| 8612 |
8623 |
| 8613 /* show the widgets */ |
8624 /* show the widgets */ |
| 8614 /* XXX gtk_widget_show(gtkconv->icon); */ |
8625 /* XXX gtk_widget_show(gtkconv->icon); */ |
| 8615 gtk_widget_show(gtkconv->tab_label); |
8626 gtk_widget_show(gtkconv->tab_label); |
| 8616 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs")) |
8627 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs")) |
| 8633 |
8644 |
| 8634 gtk_notebook_remove_page(GTK_NOTEBOOK(win->notebook), index); |
8645 gtk_notebook_remove_page(GTK_NOTEBOOK(win->notebook), index); |
| 8635 |
8646 |
| 8636 /* go back to tabless */ |
8647 /* go back to tabless */ |
| 8637 if (pidgin_conv_window_get_gtkconv_count(win) <= 2) { |
8648 if (pidgin_conv_window_get_gtkconv_count(win) <= 2) { |
| 8638 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE); |
8649 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), |
| |
8650 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/tabs")); |
| 8639 } |
8651 } |
| 8640 |
8652 |
| 8641 win->gtkconvs = g_list_remove(win->gtkconvs, gtkconv); |
8653 win->gtkconvs = g_list_remove(win->gtkconvs, gtkconv); |
| 8642 |
8654 |
| 8643 if (!win->gtkconvs || !win->gtkconvs->next) |
8655 if (win->gtkconvs && win->gtkconvs->next == NULL) |
| 8644 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE); |
8656 pidgin_conv_tab_pack(win, win->gtkconvs->data); |
| 8645 |
8657 |
| 8646 if (!win->gtkconvs && win != hidden_convwin) |
8658 if (!win->gtkconvs && win != hidden_convwin) |
| 8647 pidgin_conv_window_destroy(win); |
8659 pidgin_conv_window_destroy(win); |
| 8648 } |
8660 } |
| 8649 |
8661 |