Mercurial > pidgin
comparison src/conversation.c @ 4168:ebfb80bbe1ed
[gaim-migrate @ 4397]
(00:16:51) faceprint: apply my g-signal patch too! </whine>
(00:17:02) ChipX86: the what?
(00:17:20) faceprint: sorry
(00:17:23) faceprint: g-timeout, rather
(00:17:28) ChipX86: ah good
(00:17:33) faceprint: http://faceprint.com/code/gaim/g-timeout.20030101.1301.diff
(00:17:33) ChipX86: yes, APPLY THAT
(00:17:38) ChipX86: I need that
(00:17:40) LSchiere: one at a time
(00:17:51) faceprint: ChipX86: you need that?
(00:17:56) ChipX86: for the conversation rewrite
(00:17:59) faceprint: ahh
(00:18:08) faceprint: it also fixes a memleak for msn users
committer: Tailor Script <tailor@pidgin.im>
| author | Luke Schierer <lschiere@pidgin.im> |
|---|---|
| date | Thu, 02 Jan 2003 05:20:55 +0000 |
| parents | d3c8d2b40494 |
| children | 858822a27529 |
comparison
equal
deleted
inserted
replaced
| 4167:7002b6f16bdf | 4168:ebfb80bbe1ed |
|---|---|
| 362 g_free(c->send_history->data); | 362 g_free(c->send_history->data); |
| 363 c->send_history = c->send_history->next; | 363 c->send_history = c->send_history->next; |
| 364 } | 364 } |
| 365 g_list_free(c->send_history); | 365 g_list_free(c->send_history); |
| 366 if (c->typing_timeout) | 366 if (c->typing_timeout) |
| 367 gtk_timeout_remove(c->typing_timeout); | 367 g_source_remove(c->typing_timeout); |
| 368 if (c->type_again_timeout) | 368 if (c->type_again_timeout) |
| 369 gtk_timeout_remove(c->type_again_timeout); | 369 g_source_remove(c->type_again_timeout); |
| 370 g_string_free(c->history, TRUE); | 370 g_string_free(c->history, TRUE); |
| 371 g_free(c); | 371 g_free(c); |
| 372 } | 372 } |
| 373 | 373 |
| 374 void update_log_convs() | 374 void update_log_convs() |
| 1136 | 1136 |
| 1137 static void got_typing_keypress(struct conversation *c, gboolean first) { | 1137 static void got_typing_keypress(struct conversation *c, gboolean first) { |
| 1138 /* we know we got something, so we at least have to make sure we don't send | 1138 /* we know we got something, so we at least have to make sure we don't send |
| 1139 * TYPED any time soon */ | 1139 * TYPED any time soon */ |
| 1140 if(c->type_again_timeout) | 1140 if(c->type_again_timeout) |
| 1141 gtk_timeout_remove(c->type_again_timeout); | 1141 g_source_remove(c->type_again_timeout); |
| 1142 c->type_again_timeout = gtk_timeout_add(SEND_TYPED_TIMEOUT, send_typed, c); | 1142 c->type_again_timeout = g_timeout_add(SEND_TYPED_TIMEOUT, send_typed, c); |
| 1143 | 1143 |
| 1144 /* we send typed if this is the first character typed, or if we're due | 1144 /* we send typed if this is the first character typed, or if we're due |
| 1145 * to send another one */ | 1145 * to send another one */ |
| 1146 if(first || (c->type_again != 0 && time(NULL) > c->type_again)) { | 1146 if(first || (c->type_again != 0 && time(NULL) > c->type_again)) { |
| 1147 int timeout = serv_send_typing(c->gc, c->name, TYPING); | 1147 int timeout = serv_send_typing(c->gc, c->name, TYPING); |
| 1160 | 1160 |
| 1161 if (misc_options & OPT_MISC_STEALTH_TYPING) | 1161 if (misc_options & OPT_MISC_STEALTH_TYPING) |
| 1162 return; | 1162 return; |
| 1163 | 1163 |
| 1164 if(gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | 1164 if(gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { |
| 1165 if(c->type_again_timeout) | 1165 if(c->type_again_timeout) { |
| 1166 gtk_timeout_remove(c->type_again_timeout); | 1166 g_source_remove(c->type_again_timeout); |
| 1167 c->type_again_timeout = 0; | |
| 1168 } | |
| 1167 serv_send_typing(c->gc, c->name, NOT_TYPING); | 1169 serv_send_typing(c->gc, c->name, NOT_TYPING); |
| 1168 } else { | 1170 } else { |
| 1169 /* we're deleting, but not all of it, so it counts as typing */ | 1171 /* we're deleting, but not all of it, so it counts as typing */ |
| 1170 got_typing_keypress(c, FALSE); | 1172 got_typing_keypress(c, FALSE); |
| 1171 } | 1173 } |
| 2775 g_free(buf); | 2777 g_free(buf); |
| 2776 } | 2778 } |
| 2777 } | 2779 } |
| 2778 | 2780 |
| 2779 /* This returns a boolean, so that it can timeout */ | 2781 /* This returns a boolean, so that it can timeout */ |
| 2780 gboolean reset_typing(char *name) { | 2782 gboolean reset_typing(gpointer data) { |
| 2783 char *name = data; | |
| 2781 struct conversation *c = find_conversation(name); | 2784 struct conversation *c = find_conversation(name); |
| 2782 if (!c) { | 2785 if (!c) |
| 2783 g_free(name); | |
| 2784 return FALSE; | 2786 return FALSE; |
| 2785 } | |
| 2786 | 2787 |
| 2787 /* Reset the title (if necessary) */ | 2788 /* Reset the title (if necessary) */ |
| 2788 c->typing_state = NOT_TYPING; | 2789 c->typing_state = NOT_TYPING; |
| 2789 update_convo_status(c); | 2790 update_convo_status(c); |
| 2790 | 2791 |
| 2791 g_free(name); | |
| 2792 c->typing_timeout = 0; | 2792 c->typing_timeout = 0; |
| 2793 return FALSE; | 2793 return FALSE; |
| 2794 } | 2794 } |
| 2795 | 2795 |
| 2796 void show_conv(struct conversation *c) | 2796 void show_conv(struct conversation *c) |
| 3515 gtk_widget_queue_draw(c->icon); | 3515 gtk_widget_queue_draw(c->icon); |
| 3516 if (bm) | 3516 if (bm) |
| 3517 gdk_bitmap_unref(bm); | 3517 gdk_bitmap_unref(bm); |
| 3518 delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter) / 10; | 3518 delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter) / 10; |
| 3519 | 3519 |
| 3520 c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c); | 3520 c->icon_timer = g_timeout_add(delay * 10, redraw_icon, c); |
| 3521 return FALSE; | 3521 return FALSE; |
| 3522 } | 3522 } |
| 3523 | 3523 |
| 3524 static void stop_anim(GtkObject *obj, struct conversation *c) | 3524 static void stop_anim(GtkObject *obj, struct conversation *c) |
| 3525 { | 3525 { |
| 3526 if (c->icon_timer) | 3526 if (c->icon_timer) |
| 3527 gtk_timeout_remove(c->icon_timer); | 3527 g_source_remove(c->icon_timer); |
| 3528 c->icon_timer = 0; | 3528 c->icon_timer = 0; |
| 3529 } | 3529 } |
| 3530 | 3530 |
| 3531 static void start_anim(GtkObject *obj, struct conversation *c) | 3531 static void start_anim(GtkObject *obj, struct conversation *c) |
| 3532 { | 3532 { |
| 3533 int delay; | 3533 int delay; |
| 3534 delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter) / 10; | 3534 delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter) / 10; |
| 3535 if (c->anim) | 3535 if (c->anim) |
| 3536 c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c); | 3536 c->icon_timer = g_timeout_add(delay * 10, redraw_icon, c); |
| 3537 } | 3537 } |
| 3538 | 3538 |
| 3539 static int des_save_icon(GtkObject *obj, GdkEvent *e, struct conversation *c) | 3539 static int des_save_icon(GtkObject *obj, GdkEvent *e, struct conversation *c) |
| 3540 { | 3540 { |
| 3541 gtk_widget_destroy(c->save_icon); | 3541 gtk_widget_destroy(c->save_icon); |
| 3650 c->icon = NULL; | 3650 c->icon = NULL; |
| 3651 if (c->anim) | 3651 if (c->anim) |
| 3652 gdk_pixbuf_animation_unref(c->anim); | 3652 gdk_pixbuf_animation_unref(c->anim); |
| 3653 c->anim = NULL; | 3653 c->anim = NULL; |
| 3654 if (c->icon_timer) | 3654 if (c->icon_timer) |
| 3655 gtk_timeout_remove(c->icon_timer); | 3655 g_source_remove(c->icon_timer); |
| 3656 c->icon_timer = 0; | 3656 c->icon_timer = 0; |
| 3657 if(c->iter) | 3657 if(c->iter) |
| 3658 g_object_unref(G_OBJECT(c->iter)); | 3658 g_object_unref(G_OBJECT(c->iter)); |
| 3659 } | 3659 } |
| 3660 | 3660 |
| 3728 MAX(gdk_pixbuf_get_height(buf) * sf / | 3728 MAX(gdk_pixbuf_get_height(buf) * sf / |
| 3729 gdk_pixbuf_animation_get_height(c->anim), 1), | 3729 gdk_pixbuf_animation_get_height(c->anim), 1), |
| 3730 GDK_INTERP_NEAREST); | 3730 GDK_INTERP_NEAREST); |
| 3731 | 3731 |
| 3732 if (delay) | 3732 if (delay) |
| 3733 c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c); | 3733 c->icon_timer = g_timeout_add(delay * 10, redraw_icon, c); |
| 3734 | 3734 |
| 3735 | 3735 |
| 3736 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | 3736 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); |
| 3737 gdk_pixbuf_unref(scale); | 3737 gdk_pixbuf_unref(scale); |
| 3738 | 3738 |
