Mercurial > pidgin.yaz
changeset 10456:d23802800eeb
[gaim-migrate @ 11724]
Add a menu item "Show Buddy Icon" to the Options menu of the conversation
window so that hidden icons can be re-revealed.
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Thu, 30 Dec 2004 19:32:08 +0000 |
parents | 6d4f02da1cef |
children | 0c020a10d5da |
files | src/gtkconv.c src/gtkconv.h |
diffstat | 2 files changed, 48 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkconv.c Thu Dec 30 17:41:19 2004 +0000 +++ b/src/gtkconv.c Thu Dec 30 19:32:08 2004 +0000 @@ -2500,9 +2500,14 @@ } static void -remove_icon(GaimGtkConversation *gtkconv) +remove_icon(GaimConversation *conv) { - g_return_if_fail(gtkconv != NULL); + GaimGtkConversation *gtkconv; + GaimGtkWindow *gtkwin; + + g_return_if_fail(conv != NULL); + + gtkconv = GAIM_GTK_CONVERSATION(conv); if (gtkconv->u.im->icon_container != NULL) gtk_widget_destroy(gtkconv->u.im->icon_container); @@ -2520,7 +2525,11 @@ gtkconv->u.im->icon = NULL; gtkconv->u.im->anim = NULL; gtkconv->u.im->iter = NULL; + gtkconv->u.im->icon_container = NULL; gtkconv->u.im->show_icon = FALSE; + + gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.show_icon), FALSE); } static void @@ -2599,7 +2608,7 @@ button = gtk_menu_item_new_with_label(_("Hide Icon")); g_signal_connect_swapped(G_OBJECT(button), "activate", - G_CALLBACK(remove_icon), gtkconv); + G_CALLBACK(remove_icon), conv); gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); gtk_widget_show(button); @@ -2611,6 +2620,32 @@ return TRUE; } + +static void +menu_buddyicon_cb(gpointer data, guint action, GtkWidget *widget) +{ + GaimConvWindow *win = (GaimConvWindow *)data; + GaimConversation *conv; + GaimGtkConversation *gtkconv; + gboolean active; + + conv = gaim_conv_window_get_active_conversation(win); + + if (!conv) + return; + + g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); + + gtkconv = GAIM_GTK_CONVERSATION(conv); + + active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); + gtkconv->u.im->show_icon = active; + if (active) + gaim_gtkconv_update_buddy_icon(conv); + else + remove_icon(conv); +} + /************************************************************************** * End of the bunch of buddy icon functions **************************************************************************/ @@ -2675,6 +2710,7 @@ gtk_widget_show(gtkwin->menu.insert_link); gtk_widget_show(gtkwin->menu.insert_image); + gtk_widget_show(gtkwin->menu.show_icon); } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { /* Show stuff that applies to Chats, hide stuff that applies to IMs */ @@ -2687,6 +2723,7 @@ gtk_widget_show(gtkwin->menu.invite); gtk_widget_show(gtkwin->menu.alias); gtk_widget_hide(gtkwin->menu.block); + gtk_widget_hide(gtkwin->menu.show_icon); if (gaim_blist_find_chat(account, gaim_conversation_get_name(conv)) == NULL) { /* If the chat is NOT in the buddy list */ @@ -2846,6 +2883,9 @@ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.show_timestamps), gtkconv->show_timestamps); + if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.show_icon), + gtkconv->u.im->show_icon); /* * We pause icons when they are not visible. If this icon should * be animated then start it back up again. @@ -3527,6 +3567,7 @@ { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, { N_("/Options/Show Formatting _Toolbars"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, { N_("/Options/Show T_imestamps"), "F2", menu_timestamps_cb, 0, "<CheckItem>" }, + { N_("/Options/Show Buddy _Icon"), NULL, menu_buddyicon_cb, 0, "<CheckItem>" }, }; static const int menu_item_count = @@ -3637,6 +3678,9 @@ gtkwin->menu.show_timestamps = gtk_item_factory_get_widget(gtkwin->menu.item_factory, N_("/Options/Show Timestamps")); + gtkwin->menu.show_icon = + gtk_item_factory_get_widget(gtkwin->menu.item_factory, + N_("/Options/Show Buddy Icon")); generate_send_as_items(win, NULL);