# HG changeset patch # User Nathan Walp # Date 1047539614 0 # Node ID 0c85078fd3711cdf77e3e6a12c1fc76da56aa11f # Parent 66c2388046fb7dab0728b6bd306956d8ac1776c2 [gaim-migrate @ 5051] DO NOT complain about these icons. They are placeholders until the cooler icons arrive in the (hopefully very near) future. Squint your eyes and pretend they're cool looking if you have to. Oh, in case you're wondering, this puts a nifty icon in the upper-right corner of the conversation window for when the other person is typing, it corresponds with changing colors in the tabs. Enjoy! committer: Tailor Script diff -r 66c2388046fb -r 0c85078fd371 src/gtkconv.c --- a/src/gtkconv.c Thu Mar 13 06:56:40 2003 +0000 +++ b/src/gtkconv.c Thu Mar 13 07:13:34 2003 +0000 @@ -122,6 +122,7 @@ static void add_chat_buddy_common(struct gaim_conversation *conv, const char *name, int pos); static void tab_complete(struct gaim_conversation *conv); +static void update_typing_icon(struct gaim_conversation *conv); static gboolean update_send_as_selection(struct gaim_window *win); static char *item_factory_translate_func (const char *path, gpointer func_data); @@ -1723,6 +1724,8 @@ gtk_widget_hide(gtkwin->menu.send_as); } + update_typing_icon(conv); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), gaim_conversation_is_logging(conv)); @@ -1894,6 +1897,48 @@ } } +static void +update_typing_icon(struct gaim_conversation *conv) +{ + struct gaim_gtk_window *gtkwin; + struct gaim_im *im = NULL; + + gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); + + if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) + im = GAIM_IM(conv); + + if(gtkwin->menu.typing_icon) { + gtk_widget_destroy(gtkwin->menu.typing_icon); + gtkwin->menu.typing_icon = NULL; + } + if(im && gaim_im_get_typing_state(im) == TYPING) { + gtkwin->menu.typing_icon = gtk_image_menu_item_new(); + gtk_image_menu_item_set_image( + GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), + gtk_image_new_from_stock(GAIM_STOCK_TYPING, + GTK_ICON_SIZE_MENU)); + gtk_tooltips_set_tip(gtk_tooltips_new(), gtkwin->menu.typing_icon, + _("User is typing..."), NULL); + } else if(im && gaim_im_get_typing_state(im) == TYPED) { + gtkwin->menu.typing_icon = gtk_image_menu_item_new(); + gtk_image_menu_item_set_image( + GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), + gtk_image_new_from_stock(GAIM_STOCK_TYPED, + GTK_ICON_SIZE_MENU)); + gtk_tooltips_set_tip(gtk_tooltips_new(), gtkwin->menu.typing_icon, + _("User has typed something and paused"), NULL); + } + + if(gtkwin->menu.typing_icon) { + gtk_menu_item_set_right_justified( + GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); + gtk_widget_show_all(gtkwin->menu.typing_icon); + gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), + gtkwin->menu.typing_icon); + } +} + static gboolean update_send_as_selection(struct gaim_window *win) { @@ -4185,11 +4230,13 @@ gaim_gtkconv_updated(struct gaim_conversation *conv, GaimConvUpdateType type) { struct gaim_window *win; + struct gaim_gtk_window *gtkwin; struct gaim_gtk_conversation *gtkconv; struct gaim_gtk_chat_pane *gtkchat; struct gaim_chat *chat; win = gaim_conversation_get_window(conv); + gtkwin = GAIM_GTK_WINDOW(win); gtkconv = GAIM_GTK_CONVERSATION(conv); if (type == GAIM_CONV_UPDATE_ACCOUNT) { @@ -4203,10 +4250,10 @@ } else if (type == GAIM_CONV_UPDATE_TYPING || type == GAIM_CONV_UPDATE_UNSEEN) { - GtkStyle *style; struct gaim_im *im = NULL; + if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) im = GAIM_IM(conv); @@ -4245,6 +4292,12 @@ gtk_widget_set_style(gtkconv->tab_label, style); g_object_unref(G_OBJECT(style)); + + if(type == GAIM_CONV_UPDATE_TYPING && + conv == gaim_window_get_active_conversation(win)) { + update_typing_icon(conv); + } + } else if (type == GAIM_CONV_UPDATE_TOPIC) { chat = GAIM_CHAT(conv); @@ -4260,7 +4313,7 @@ } else if(type == GAIM_CONV_UPDATE_ADD || type == GAIM_CONV_UPDATE_REMOVE) { - + update_convo_add_button(conv); } } diff -r 66c2388046fb -r 0c85078fd371 src/gtkconv.h --- a/src/gtkconv.h Thu Mar 13 06:56:40 2003 +0000 +++ b/src/gtkconv.h Thu Mar 13 07:13:34 2003 +0000 @@ -52,6 +52,7 @@ GtkWidget *logging; GtkWidget *sounds; GtkWidget *send_as; + GtkWidget *typing_icon; GtkItemFactory *item_factory; diff -r 66c2388046fb -r 0c85078fd371 src/stock.c --- a/src/stock.c Thu Mar 13 06:56:40 2003 +0000 +++ b/src/stock.c Thu Mar 13 07:13:34 2003 +0000 @@ -53,6 +53,8 @@ { GAIM_STOCK_TEXT_BIGGER, "buttons", "text_bigger.png" }, { GAIM_STOCK_TEXT_NORMAL, "buttons", "text_normal.png" }, { GAIM_STOCK_TEXT_SMALLER, "buttons", "text_smaller.png" }, + { GAIM_STOCK_TYPED, NULL, GTK_STOCK_JUSTIFY_FILL }, + { GAIM_STOCK_TYPING, NULL, GTK_STOCK_EXECUTE }, { GAIM_STOCK_UPLOAD, NULL, GTK_STOCK_GO_UP }, { GAIM_STOCK_WARN, NULL, GTK_STOCK_DIALOG_WARNING }, { GAIM_STOCK_IM, NULL, GTK_STOCK_CONVERT }, diff -r 66c2388046fb -r 0c85078fd371 src/stock.h --- a/src/stock.h Thu Mar 13 06:56:40 2003 +0000 +++ b/src/stock.h Thu Mar 13 07:13:34 2003 +0000 @@ -45,6 +45,8 @@ #define GAIM_STOCK_TEXT_SMALLER "gaim-text-smaller" #define GAIM_STOCK_UPLOAD "gaim-upload" #define GAIM_STOCK_WARN "gaim-warn" +#define GAIM_STOCK_TYPING "gaim-typing" +#define GAIM_STOCK_TYPED "gaim-typed" #define GAIM_STOCK_IM "gaim-im" #define GAIM_STOCK_CHAT "gaim-chat" #define GAIM_STOCK_AWAY "gaim-away"