| 3103 GAIM_TYPING); |
3103 GAIM_TYPING); |
| 3104 gaim_conv_im_set_type_again(im, timeout); |
3104 gaim_conv_im_set_type_again(im, timeout); |
| 3105 } |
3105 } |
| 3106 } |
3106 } |
| 3107 |
3107 |
| |
3108 static gboolean |
| |
3109 typing_animation(gpointer data) { |
| |
3110 PidginConversation *gtkconv = data; |
| |
3111 const char *stock_id = NULL; |
| |
3112 PidginWindow *gtkwin = gtkconv->win; |
| |
3113 switch (rand() % 5) { |
| |
3114 case 0: |
| |
3115 stock_id = PIDGIN_STOCK_ANIMATION_TYPING0; |
| |
3116 break; |
| |
3117 case 1: |
| |
3118 stock_id = PIDGIN_STOCK_ANIMATION_TYPING1; |
| |
3119 break; |
| |
3120 case 2: |
| |
3121 stock_id = PIDGIN_STOCK_ANIMATION_TYPING2; |
| |
3122 break; |
| |
3123 case 3: |
| |
3124 stock_id = PIDGIN_STOCK_ANIMATION_TYPING3; |
| |
3125 break; |
| |
3126 case 4: |
| |
3127 stock_id = PIDGIN_STOCK_ANIMATION_TYPING4; |
| |
3128 break; |
| |
3129 } |
| |
3130 if (gtkwin->menu.typing_icon == NULL) { |
| |
3131 gtkwin->menu.typing_icon = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU); |
| |
3132 pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray), |
| |
3133 gtkwin->menu.typing_icon, |
| |
3134 _("User is typing...")); |
| |
3135 } else { |
| |
3136 gtk_image_set_from_stock(GTK_IMAGE(gtkwin->menu.typing_icon), stock_id, GTK_ICON_SIZE_MENU); |
| |
3137 } |
| |
3138 gtk_widget_show(gtkwin->menu.typing_icon); |
| |
3139 return TRUE; |
| |
3140 } |
| |
3141 |
| 3108 static void |
3142 static void |
| 3109 update_typing_icon(PidginConversation *gtkconv) |
3143 update_typing_icon(PidginConversation *gtkconv) |
| 3110 { |
3144 { |
| 3111 PidginWindow *gtkwin; |
3145 PidginWindow *gtkwin; |
| 3112 GaimConvIm *im = NULL; |
3146 GaimConvIm *im = NULL; |
| 3121 |
3155 |
| 3122 if (gtkwin->menu.typing_icon) { |
3156 if (gtkwin->menu.typing_icon) { |
| 3123 gtk_widget_hide(gtkwin->menu.typing_icon); |
3157 gtk_widget_hide(gtkwin->menu.typing_icon); |
| 3124 } |
3158 } |
| 3125 |
3159 |
| 3126 if (!im || (gaim_conv_im_get_typing_state(im) == GAIM_NOT_TYPING)) |
3160 if (!im || (gaim_conv_im_get_typing_state(im) == GAIM_NOT_TYPING)) { |
| |
3161 if (gtkconv->u.im->typing_timer != 0) |
| |
3162 g_source_remove(gtkconv->u.im->typing_timer); |
| 3127 return; |
3163 return; |
| |
3164 } |
| 3128 |
3165 |
| 3129 if (gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
3166 if (gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
| 3130 stock_id = PIDGIN_STOCK_TOOLBAR_TYPING; |
3167 if (gtkconv->u.im->typing_timer == 0) { |
| |
3168 gtkconv->u.im->typing_timer = g_timeout_add(250, typing_animation, gtkconv); |
| |
3169 } |
| |
3170 stock_id = PIDGIN_STOCK_ANIMATION_TYPING1; |
| 3131 tooltip = _("User is typing..."); |
3171 tooltip = _("User is typing..."); |
| 3132 } else { |
3172 } else { |
| 3133 stock_id = PIDGIN_STOCK_TYPED; |
3173 stock_id = PIDGIN_STOCK_ANIMATION_TYPING0; |
| 3134 tooltip = _("User has typed something and stopped"); |
3174 tooltip = _("User has typed something and stopped"); |
| |
3175 g_source_remove(gtkconv->u.im->typing_timer); |
| |
3176 gtkconv->u.im->typing_timer = 0; |
| 3135 } |
3177 } |
| 3136 |
3178 |
| 3137 if (gtkwin->menu.typing_icon == NULL) |
3179 if (gtkwin->menu.typing_icon == NULL) |
| 3138 { |
3180 { |
| 3139 gtkwin->menu.typing_icon = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU); |
3181 gtkwin->menu.typing_icon = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU); |
| 3140 pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray), |
3182 pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray), |
| 3141 gtkwin->menu.typing_icon, |
3183 gtkwin->menu.typing_icon, |
| 3142 tooltip); |
3184 tooltip); |
| 3143 } |
3185 } |
| 4396 * Tab title -> conversation scrollback -> entry |
4438 * Tab title -> conversation scrollback -> entry |
| 4397 */ |
4439 */ |
| 4398 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
4440 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
| 4399 gtk_container_set_focus_chain(GTK_CONTAINER(vbox2), focus_chain); |
4441 gtk_container_set_focus_chain(GTK_CONTAINER(vbox2), focus_chain); |
| 4400 |
4442 |
| |
4443 gtkconv->u.im->typing_timer = 0; |
| 4401 return paned; |
4444 return paned; |
| 4402 } |
4445 } |
| 4403 |
4446 |
| 4404 static void |
4447 static void |
| 4405 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, |
4448 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, |