comparison src/conversation.c @ 3787:aed40c72c818

[gaim-migrate @ 3927] more bugs in typing notificatin (surprise surprise) fixed by faceprint committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 22 Oct 2002 16:21:55 +0000
parents 8fcebfa9f357
children fb519383a058
comparison
equal deleted inserted replaced
3786:4c9356a5231c 3787:aed40c72c818
2075 if (!(flags & WFLAG_RECV) && !(flags & WFLAG_SYSTEM)) 2075 if (!(flags & WFLAG_RECV) && !(flags & WFLAG_SYSTEM))
2076 return; 2076 return;
2077 if ((c->unseen == 2) || ((c->unseen == 1) && !(flags & WFLAG_NICK))) 2077 if ((c->unseen == 2) || ((c->unseen == 1) && !(flags & WFLAG_NICK)))
2078 return; 2078 return;
2079 2079
2080 if (flags & WFLAG_RECV)
2081 c->typing_state = NOT_TYPING;
2082
2080 2083
2081 if (c->is_chat) { 2084 if (c->is_chat) {
2082 int offs; 2085 int offs;
2083 if ((convo_options & OPT_CONVO_COMBINE) && (im_options & OPT_IM_ONE_WINDOW)) 2086 if ((convo_options & OPT_CONVO_COMBINE) && (im_options & OPT_IM_ONE_WINDOW))
2084 offs = g_list_length(conversations); 2087 offs = g_list_length(conversations);
2098 } else if (!unhighlight) { 2101 } else if (!unhighlight) {
2099 c->unseen = 1; 2102 c->unseen = 1;
2100 } else { 2103 } else {
2101 c->unseen = 0; 2104 c->unseen = 0;
2102 } 2105 }
2103 update_convo_status(c, FALSE); 2106 update_convo_status(c);
2104 } 2107 }
2105 2108
2106 void update_progress(struct conversation *c, float percent) { 2109 void update_progress(struct conversation *c, float percent) {
2107 2110
2108 if (percent >= 1 && !(c->progress)) 2111 if (percent >= 1 && !(c->progress))
2620 c = g_list_nth_data(chats, page_num); 2623 c = g_list_nth_data(chats, page_num);
2621 if (c && c->window && c->entry) 2624 if (c && c->window && c->entry)
2622 gtk_window_set_focus(GTK_WINDOW(c->window), c->entry); 2625 gtk_window_set_focus(GTK_WINDOW(c->window), c->entry);
2623 if (!GTK_WIDGET_REALIZED(label)) 2626 if (!GTK_WIDGET_REALIZED(label))
2624 return; 2627 return;
2625 if (c->unseen == -1) return;
2626 style = gtk_style_new(); 2628 style = gtk_style_new();
2627 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style))); 2629 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style)));
2628 gtk_widget_set_style(label, style); 2630 gtk_widget_set_style(label, style);
2629 gtk_style_unref(style); 2631 gtk_style_unref(style);
2630 if (c) 2632 if (c)
2633 if (!c->is_chat) { 2635 if (!c->is_chat) {
2634 GtkWidget *menubar; 2636 GtkWidget *menubar;
2635 GtkWidget *parent = convo_notebook->parent; 2637 GtkWidget *parent = convo_notebook->parent;
2636 2638
2637 gtk_widget_freeze_child_notify(GTK_WIDGET(c->window)); 2639 gtk_widget_freeze_child_notify(GTK_WIDGET(c->window));
2638 2640
2639 if (convo_menubar != NULL) 2641 if (convo_menubar != NULL)
2640 gtk_widget_destroy(convo_menubar); 2642 gtk_widget_destroy(convo_menubar);
2641 2643
2642 menubar = build_conv_menubar(c); 2644 menubar = build_conv_menubar(c);
2643 gtk_box_pack_start(GTK_BOX(parent), menubar, FALSE, TRUE, 0); 2645 gtk_box_pack_start(GTK_BOX(parent), menubar, FALSE, TRUE, 0);
2648 } else { 2650 } else {
2649 gtk_widget_destroy(convo_menubar); 2651 gtk_widget_destroy(convo_menubar);
2650 convo_menubar = NULL; 2652 convo_menubar = NULL;
2651 } 2653 }
2652 2654
2655 update_convo_status(c);
2656
2653 gtk_imhtml_to_bottom(c->text); 2657 gtk_imhtml_to_bottom(c->text);
2654 } 2658 }
2655 2659
2656 void update_convo_status(struct conversation *c, int typing_state) { 2660 void update_convo_status(struct conversation *c) {
2657 if(!c) 2661 if(!c)
2658 return; 2662 return;
2659 debug_printf("update_convo_status called for %s\n", c->name); 2663 debug_printf("update_convo_status called for %s\n", c->name);
2660 if (im_options & OPT_IM_ONE_WINDOW) { /* We'll make the tab green */ 2664 if (im_options & OPT_IM_ONE_WINDOW) { /* We'll make the tab green */
2661 GtkStyle *style; 2665 GtkStyle *style;
2669 offs + g_list_index(ws, c))); 2673 offs + g_list_index(ws, c)));
2670 style = gtk_style_new(); 2674 style = gtk_style_new();
2671 if (!GTK_WIDGET_REALIZED(label)) 2675 if (!GTK_WIDGET_REALIZED(label))
2672 gtk_widget_realize(label); 2676 gtk_widget_realize(label);
2673 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style))); 2677 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style)));
2674 if(typing_state == TYPING) { 2678 if(c->typing_state == TYPING) {
2675 style->fg[0].red = 0x0000; 2679 style->fg[0].red = 0x0000;
2676 style->fg[0].green = 0x9999; 2680 style->fg[0].green = 0x9999;
2677 style->fg[0].blue = 0x0000; 2681 style->fg[0].blue = 0x0000;
2678 } else if(typing_state == TYPED) { 2682 } else if(c->typing_state == TYPED) {
2679 style->fg[0].red = 0xfffff; 2683 style->fg[0].red = 0xfffff;
2680 style->fg[0].green = 0xbbbb; 2684 style->fg[0].green = 0xbbbb;
2681 style->fg[0].blue = 0x2222; 2685 style->fg[0].blue = 0x2222;
2682 } else if(c->unseen == 2) { 2686 } else if(c->unseen == 2) {
2683 style->fg[0].red = 0x0000; 2687 style->fg[0].red = 0x0000;
2705 debug_printf("title was free of typing information\n"); 2709 debug_printf("title was free of typing information\n");
2706 len = strlen(win->title); 2710 len = strlen(win->title);
2707 } 2711 }
2708 buf = g_malloc(len+1); 2712 buf = g_malloc(len+1);
2709 g_snprintf(buf, len+1, win->title); 2713 g_snprintf(buf, len+1, win->title);
2710 if(typing_state == TYPING) { 2714 if(c->typing_state == TYPING) {
2711 buf2 = g_strconcat(buf,_(" [TYPING]"), NULL); 2715 buf2 = g_strconcat(buf,_(" [TYPING]"), NULL);
2712 g_free(buf); 2716 g_free(buf);
2713 buf = buf2; 2717 buf = buf2;
2714 } else if(typing_state == TYPED) { 2718 } else if(c->typing_state == TYPED) {
2715 buf2 = g_strconcat(buf,_(" [TYPED]"), NULL); 2719 buf2 = g_strconcat(buf,_(" [TYPED]"), NULL);
2716 g_free(buf); 2720 g_free(buf);
2717 buf = buf2; 2721 buf = buf2;
2718 } 2722 }
2719 gtk_window_set_title(win, buf); 2723 gtk_window_set_title(win, buf);
2728 g_free(name); 2732 g_free(name);
2729 return FALSE; 2733 return FALSE;
2730 } 2734 }
2731 2735
2732 /* Reset the title (if necessary) */ 2736 /* Reset the title (if necessary) */
2733 update_convo_status(c, FALSE); 2737 c->typing_state = NOT_TYPING;
2738 update_convo_status(c);
2734 2739
2735 g_free(name); 2740 g_free(name);
2736 c->typing_timeout = 0; 2741 c->typing_timeout = 0;
2737 return FALSE; 2742 return FALSE;
2738 } 2743 }