Mercurial > pidgin
comparison src/conversation.c @ 1692:a312d64a995d
[gaim-migrate @ 1702]
and i thought i couldn't do it.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sun, 08 Apr 2001 09:26:00 +0000 |
parents | 0f7d2284296f |
children | 70f9d7cdb127 |
comparison
equal
deleted
inserted
replaced
1691:d802b115800f | 1692:a312d64a995d |
---|---|
372 return; | 372 return; |
373 } | 373 } |
374 | 374 |
375 int close_callback(GtkWidget *widget, struct conversation *c) | 375 int close_callback(GtkWidget *widget, struct conversation *c) |
376 { | 376 { |
377 if (c->is_chat && (widget == c->close)) { | 377 if (c->is_chat && (widget == c->close) && !(display_options & OPT_DISP_ONE_CHAT_WINDOW)) { |
378 GtkWidget *tmp = c->window; | 378 GtkWidget *tmp = c->window; |
379 debug_printf("chat clicked close button\n"); | 379 debug_printf("chat clicked close button\n"); |
380 c->window = NULL; | 380 c->window = NULL; |
381 gtk_widget_destroy(tmp); | 381 gtk_widget_destroy(tmp); |
382 return FALSE; | 382 return FALSE; |
385 debug_printf("conversation close callback\n"); | 385 debug_printf("conversation close callback\n"); |
386 | 386 |
387 if (general_options & OPT_GEN_CHECK_SPELLING) | 387 if (general_options & OPT_GEN_CHECK_SPELLING) |
388 gtkspell_detach(GTK_TEXT(c->entry)); | 388 gtkspell_detach(GTK_TEXT(c->entry)); |
389 | 389 |
390 if ((display_options & OPT_DISP_ONE_WINDOW) && (!c->is_chat)) { | 390 if (!c->is_chat) { |
391 if (g_list_length(conversations) > 1) { | 391 if (display_options & OPT_DISP_ONE_WINDOW) { |
392 gtk_notebook_remove_page(GTK_NOTEBOOK(convo_notebook), | 392 if (g_list_length(conversations) > 1) { |
393 g_list_index(conversations, c)); | 393 gtk_notebook_remove_page(GTK_NOTEBOOK(convo_notebook), |
394 g_list_index(conversations, c)); | |
395 } else { | |
396 if (c->window) | |
397 gtk_widget_destroy(c->window); | |
398 c->window = NULL; | |
399 all_convos = NULL; | |
400 } | |
394 } else { | 401 } else { |
395 if (c->window) | 402 if (c->window) |
396 gtk_widget_destroy(c->window); | 403 gtk_widget_destroy(c->window); |
397 c->window = NULL; | 404 c->window = NULL; |
398 all_convos = NULL; | |
399 } | 405 } |
400 } else { | 406 } else { |
401 if (c->window) | 407 if (display_options & OPT_DISP_ONE_CHAT_WINDOW) { |
402 gtk_widget_destroy(c->window); | 408 if (g_list_length(chats) > 1) { |
403 c->window = NULL; | 409 gtk_notebook_remove_page(GTK_NOTEBOOK(chat_notebook), |
410 g_list_index(chats, c)); | |
411 } else { | |
412 if (c->window) | |
413 gtk_widget_destroy(c->window); | |
414 c->window = NULL; | |
415 all_chats = NULL; | |
416 } | |
417 } else { | |
418 if (c->window) | |
419 gtk_widget_destroy(c->window); | |
420 c->window = NULL; | |
421 } | |
404 } | 422 } |
405 | 423 |
406 if (c->fg_color_dialog) | 424 if (c->fg_color_dialog) |
407 gtk_widget_destroy(c->fg_color_dialog); | 425 gtk_widget_destroy(c->fg_color_dialog); |
408 c->fg_color_dialog = NULL; | 426 c->fg_color_dialog = NULL; |
421 if (c->log_dialog) | 439 if (c->log_dialog) |
422 gtk_widget_destroy(c->log_dialog); | 440 gtk_widget_destroy(c->log_dialog); |
423 c->log_dialog = NULL; | 441 c->log_dialog = NULL; |
424 | 442 |
425 if (c->is_chat) { | 443 if (c->is_chat) { |
444 chats = g_list_remove(chats, c); | |
426 if (c->gc) | 445 if (c->gc) |
427 serv_chat_leave(c->gc, c->id); | 446 serv_chat_leave(c->gc, c->id); |
428 else { | 447 else { |
429 /* bah */ | 448 /* bah */ |
430 while (c->in_room) { | 449 while (c->in_room) { |
646 buf, strlen(buf), &pos); | 665 buf, strlen(buf), &pos); |
647 } | 666 } |
648 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | 667 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
649 } | 668 } |
650 } | 669 } |
651 if (!c->is_chat && (display_options & OPT_DISP_ONE_WINDOW)) { | 670 if ((!c->is_chat && (display_options & OPT_DISP_ONE_WINDOW)) || |
671 ( c->is_chat && (display_options & OPT_DISP_ONE_CHAT_WINDOW))) { | |
672 GtkWidget *notebook = (c->is_chat ? chat_notebook : convo_notebook); | |
652 if (event->keyval == '[') { | 673 if (event->keyval == '[') { |
653 gtk_notebook_prev_page(GTK_NOTEBOOK(convo_notebook)); | 674 gtk_notebook_prev_page(GTK_NOTEBOOK(notebook)); |
654 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | 675 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
655 } else if (event->keyval == ']') { | 676 } else if (event->keyval == ']') { |
656 gtk_notebook_next_page(GTK_NOTEBOOK(convo_notebook)); | 677 gtk_notebook_next_page(GTK_NOTEBOOK(notebook)); |
657 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | 678 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
658 } else if (event->keyval == GDK_Tab) { | 679 } else if (event->keyval == GDK_Tab) { |
659 GList *cnv = g_list_nth(conversations, | 680 GList *ws = (c->is_chat ? chats : conversations); |
681 GList *cnv = g_list_nth(ws, | |
660 gtk_notebook_get_current_page( | 682 gtk_notebook_get_current_page( |
661 GTK_NOTEBOOK(convo_notebook))); | 683 GTK_NOTEBOOK(notebook))); |
662 struct conversation *d; | 684 struct conversation *d; |
663 while (cnv) { | 685 while (cnv) { |
664 d = cnv->data; | 686 d = cnv->data; |
665 if (d->unseen) | 687 if (d->unseen) |
666 break; | 688 break; |
667 cnv = cnv->next; | 689 cnv = cnv->next; |
668 d = NULL; | 690 d = NULL; |
669 } | 691 } |
670 if (d) { | 692 if (d) { |
671 gtk_notebook_set_page(GTK_NOTEBOOK(convo_notebook), | 693 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), |
672 g_list_index(conversations, d)); | 694 g_list_index(ws, d)); |
673 } else { | 695 } else { |
674 cnv = conversations; | 696 cnv = ws; |
675 while (cnv) { | 697 while (cnv) { |
676 d = cnv->data; | 698 d = cnv->data; |
677 if (d->unseen) | 699 if (d->unseen) |
678 break; | 700 break; |
679 cnv = cnv->next; | 701 cnv = cnv->next; |
680 d = NULL; | 702 d = NULL; |
681 } | 703 } |
682 if (d) { | 704 if (d) { |
683 gtk_notebook_set_page( | 705 gtk_notebook_set_page( |
684 GTK_NOTEBOOK(convo_notebook), | 706 GTK_NOTEBOOK(notebook), |
685 g_list_index(conversations, d)); | 707 g_list_index(chats, d)); |
686 } else { | 708 } else { |
687 cnv = g_list_last(conversations); | 709 cnv = g_list_last(chats); |
688 if (c == cnv->data) | 710 if (c == cnv->data) |
689 gtk_notebook_set_page( | 711 gtk_notebook_set_page( |
690 GTK_NOTEBOOK(convo_notebook), 0); | 712 GTK_NOTEBOOK(notebook), 0); |
691 else | 713 else |
692 gtk_notebook_next_page( | 714 gtk_notebook_next_page( |
693 GTK_NOTEBOOK(convo_notebook)); | 715 GTK_NOTEBOOK(notebook)); |
694 } | 716 } |
695 } | 717 } |
696 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | 718 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
697 } | 719 } |
698 } | 720 } |
699 } else if (!c->is_chat && (display_options & OPT_DISP_ONE_WINDOW) && | 721 } else if (((!c->is_chat && (display_options & OPT_DISP_ONE_WINDOW)) || |
722 ( c->is_chat && (display_options & OPT_DISP_ONE_CHAT_WINDOW))) && | |
700 (event->state & GDK_MOD1_MASK) && isdigit(event->keyval) && | 723 (event->state & GDK_MOD1_MASK) && isdigit(event->keyval) && |
701 (event->keyval > '0')) { | 724 (event->keyval > '0')) { |
702 gtk_notebook_set_page(GTK_NOTEBOOK(convo_notebook), event->keyval - '1'); | 725 GtkWidget *notebook = (c->is_chat ? chat_notebook : convo_notebook); |
726 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), event->keyval - '1'); | |
703 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | 727 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
704 } | 728 } |
705 | 729 |
706 return TRUE; | 730 return TRUE; |
707 } | 731 } |
1447 | 1471 |
1448 if ((c->is_chat && (general_options & OPT_GEN_POPUP_CHAT)) || | 1472 if ((c->is_chat && (general_options & OPT_GEN_POPUP_CHAT)) || |
1449 (!c->is_chat && (general_options & OPT_GEN_POPUP_WINDOWS))) | 1473 (!c->is_chat && (general_options & OPT_GEN_POPUP_WINDOWS))) |
1450 gdk_window_show(c->window->window); | 1474 gdk_window_show(c->window->window); |
1451 | 1475 |
1452 if (((flags & WFLAG_RECV) || (flags & WFLAG_SYSTEM)) && !c->is_chat && | 1476 if (((flags & WFLAG_RECV) || (flags & WFLAG_SYSTEM)) && |
1453 (display_options & OPT_DISP_ONE_WINDOW) && | 1477 ((!c->is_chat && (display_options & OPT_DISP_ONE_WINDOW) && |
1454 (gtk_notebook_get_current_page(GTK_NOTEBOOK(convo_notebook)) | 1478 (gtk_notebook_get_current_page(GTK_NOTEBOOK(convo_notebook)) |
1455 != g_list_index(conversations, c))) { | 1479 != g_list_index(conversations, c))) || |
1456 GtkWidget *label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(convo_notebook), | 1480 ( c->is_chat && (display_options & OPT_DISP_ONE_CHAT_WINDOW) && |
1457 gtk_notebook_get_nth_page(GTK_NOTEBOOK(convo_notebook), | 1481 (gtk_notebook_get_current_page(GTK_NOTEBOOK(chat_notebook)) |
1458 g_list_index(conversations, c))); | 1482 != g_list_index(chats, c))))) { |
1483 GtkWidget *notebook = (c->is_chat ? chat_notebook : convo_notebook); | |
1484 GList *ws = (c->is_chat ? chats : conversations); | |
1485 GtkWidget *label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook), | |
1486 gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), g_list_index(ws, c))); | |
1459 GtkStyle *style = gtk_style_new(); | 1487 GtkStyle *style = gtk_style_new(); |
1460 if (!GTK_WIDGET_REALIZED(label)) | 1488 if (!GTK_WIDGET_REALIZED(label)) |
1461 gtk_widget_realize(label); | 1489 gtk_widget_realize(label); |
1462 gdk_font_unref(style->font); | 1490 gdk_font_unref(style->font); |
1463 style->font = gdk_font_ref(label->style->font); | 1491 style->font = gdk_font_ref(label->style->font); |