Mercurial > pidgin.yaz
changeset 7928:dca50d465b7d
[gaim-migrate @ 8599]
Fixes the add/remove button. Whoops. I might end up changing this
soonish...
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 25 Dec 2003 17:52:44 +0000 |
parents | 1441648fe974 |
children | 94a90bf90f32 |
files | src/gtkconv.c |
diffstat | 1 files changed, 68 insertions(+), 65 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkconv.c Thu Dec 25 09:23:27 2003 +0000 +++ b/src/gtkconv.c Thu Dec 25 17:52:44 2003 +0000 @@ -459,7 +459,7 @@ } static void -add_cb(GtkWidget *widget, GaimConversation *conv) +add_remove_cb(GtkWidget *widget, GaimConversation *conv) { GaimAccount *account; const char *name; @@ -945,7 +945,7 @@ conv = gaim_conv_window_get_active_conversation(win); - add_cb(NULL, conv); + add_remove_cb(NULL, conv); } static void @@ -1172,7 +1172,7 @@ } static void -menu_chat_add_cb(GtkWidget *w, GaimConversation *conv) +menu_chat_add_remove_cb(GtkWidget *w, GaimConversation *conv) { GaimAccount *account; GaimBuddy *b; @@ -1292,7 +1292,7 @@ button = gtk_menu_item_new_with_label(_("Add")); g_signal_connect(G_OBJECT(button), "activate", - G_CALLBACK(menu_chat_add_cb), conv); + G_CALLBACK(menu_chat_add_remove_cb), conv); g_object_set_data(G_OBJECT(button), "user_data", who); gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); @@ -2277,6 +2277,67 @@ } static void +update_convo_add_button(GaimConversation *conv) +{ + GaimPluginProtocolInfo *prpl_info = NULL; + GaimConvWindow *win; + GaimGtkWindow *gtkwin; + GaimGtkConversation *gtkconv; + GaimConnection *gc; + GaimConversationType type; + GtkWidget *parent; + + gc = gaim_conversation_get_gc(conv); + win = gaim_conversation_get_window(conv); + type = gaim_conversation_get_type(conv); + gtkconv = GAIM_GTK_CONVERSATION(conv); + gtkwin = GAIM_GTK_WINDOW(win); + parent = gtk_widget_get_parent(gtkconv->u.im->add); + + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); + + if (gaim_find_buddy(gc->account, gaim_conversation_get_name(conv))) { + gtkconv->u.im->add = + gaim_gtk_change_text(_("Remove"), gtkconv->u.im->add, + GTK_STOCK_REMOVE, type); + gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add, + _("Remove the user from your buddy list"), NULL); + + gtk_widget_set_sensitive(gtkconv->u.im->add, + (gc != NULL && prpl_info->remove_buddy != NULL)); + + if (gaim_conv_window_get_active_conversation(win) == conv) { + gtk_widget_show(gtkwin->menu.remove); + gtk_widget_hide(gtkwin->menu.add); + } + } + else { + gtkconv->u.im->add = + gaim_gtk_change_text(_("Add"), gtkconv->u.im->add, + GTK_STOCK_ADD, type); + gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add, + _("Add the user to your buddy list"), NULL); + + gtk_widget_set_sensitive(gtkconv->u.im->add, + (gc != NULL && prpl_info->add_buddy != NULL)); + + if (gaim_conv_window_get_active_conversation(win) == conv) { + gtk_widget_show(gtkwin->menu.add); + gtk_widget_hide(gtkwin->menu.remove); + } + } + + g_signal_connect(G_OBJECT(gtkconv->u.im->add), "clicked", + G_CALLBACK(add_remove_cb), conv); + + gtk_box_pack_start(GTK_BOX(parent), gtkconv->u.im->add, + FALSE, FALSE, 0); + gtk_box_reorder_child(GTK_BOX(parent), gtkconv->u.im->add, 3); + gtk_button_set_relief(GTK_BUTTON(gtkconv->u.im->add), GTK_RELIEF_NONE); + gtk_size_group_add_widget(gtkconv->sg, gtkconv->u.im->add); +} + +static void switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, gpointer user_data) { @@ -3277,6 +3338,9 @@ G_CALLBACK(warn_cb), conv); g_signal_connect(G_OBJECT(gtkim->block), "clicked", G_CALLBACK(block_cb), conv); + + /* The add or remove button */ + update_convo_add_button(conv); } static void @@ -4382,67 +4446,6 @@ gaim_gtk_get_active_index }; -static void -update_convo_add_button(GaimConversation *conv) -{ - GaimPluginProtocolInfo *prpl_info = NULL; - GaimConvWindow *win; - GaimGtkWindow *gtkwin; - GaimGtkConversation *gtkconv; - GaimConnection *gc; - GaimConversationType type; - GtkWidget *parent; - - gc = gaim_conversation_get_gc(conv); - win = gaim_conversation_get_window(conv); - type = gaim_conversation_get_type(conv); - gtkconv = GAIM_GTK_CONVERSATION(conv); - gtkwin = GAIM_GTK_WINDOW(win); - parent = gtk_widget_get_parent(gtkconv->u.im->add); - - prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); - - if (gaim_find_buddy(gc->account, gaim_conversation_get_name(conv))) { - gtkconv->u.im->add = - gaim_gtk_change_text(_("Remove"), gtkconv->u.im->add, - GTK_STOCK_REMOVE, type); - gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add, - _("Remove the user from your buddy list"), NULL); - - gtk_widget_set_sensitive(gtkconv->u.im->add, - (gc != NULL && prpl_info->remove_buddy != NULL)); - - if (gaim_conv_window_get_active_conversation(win) == conv) { - gtk_widget_show(gtkwin->menu.remove); - gtk_widget_hide(gtkwin->menu.add); - } - } - else { - gtkconv->u.im->add = - gaim_gtk_change_text(_("Add"), gtkconv->u.im->add, - GTK_STOCK_ADD, type); - gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add, - _("Add the user to your buddy list"), NULL); - - gtk_widget_set_sensitive(gtkconv->u.im->add, - (gc != NULL && prpl_info->add_buddy != NULL)); - - if (gaim_conv_window_get_active_conversation(win) == conv) { - gtk_widget_show(gtkwin->menu.add); - gtk_widget_hide(gtkwin->menu.remove); - } - } - - g_signal_connect(G_OBJECT(gtkconv->u.im->add), "clicked", - G_CALLBACK(add_cb), conv); - - gtk_box_pack_start(GTK_BOX(parent), gtkconv->u.im->add, - FALSE, FALSE, 0); - gtk_box_reorder_child(GTK_BOX(parent), gtkconv->u.im->add, 3); - gtk_button_set_relief(GTK_BUTTON(gtkconv->u.im->add), GTK_RELIEF_NONE); - gtk_size_group_add_widget(gtkconv->sg, gtkconv->u.im->add); -} - GaimConvWindowUiOps * gaim_gtk_conversations_get_win_ui_ops(void) {