Mercurial > pidgin
comparison src/gtkconv.c @ 4397:ce3a0eba91ef
[gaim-migrate @ 4666]
The add/remove button is fixed. Thanks ari.
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Wed, 22 Jan 2003 23:20:09 +0000 |
| parents | a3fd5fe57a0b |
| children | a8249a5250b6 |
comparison
equal
deleted
inserted
replaced
| 4396:868ee63e1fe8 | 4397:ce3a0eba91ef |
|---|---|
| 3499 { | 3499 { |
| 3500 struct gaim_gtk_conversation *gtkconv; | 3500 struct gaim_gtk_conversation *gtkconv; |
| 3501 struct gaim_connection *gc; | 3501 struct gaim_connection *gc; |
| 3502 GaimConversationType type; | 3502 GaimConversationType type; |
| 3503 GtkWidget *parent; | 3503 GtkWidget *parent; |
| 3504 gboolean rebuild = FALSE; | |
| 3505 | 3504 |
| 3506 type = gaim_conversation_get_type(conv); | 3505 type = gaim_conversation_get_type(conv); |
| 3507 gc = gaim_conversation_get_gc(conv); | 3506 gc = gaim_conversation_get_gc(conv); |
| 3508 gtkconv = GAIM_GTK_CONVERSATION(conv); | 3507 gtkconv = GAIM_GTK_CONVERSATION(conv); |
| 3509 parent = gtk_widget_get_parent(gtkconv->u.im->add); | 3508 parent = gtk_widget_get_parent(gtkconv->u.im->add); |
| 3510 | 3509 |
| 3511 if (find_buddy(gc->user, gaim_conversation_get_name(conv))) { | 3510 if (find_buddy(gc->user, gaim_conversation_get_name(conv))) { |
| 3512 if (!g_object_get_data(G_OBJECT(gtkconv->u.im->add), "user_data")) { | 3511 gtkconv->u.im->add = |
| 3513 gtkconv->u.im->add = | 3512 gaim_gtk_change_text(_("Remove"), gtkconv->u.im->add, |
| 3514 gaim_gtk_change_text(_("Remove"), gtkconv->u.im->add, | 3513 GTK_STOCK_REMOVE, type); |
| 3515 GTK_STOCK_REMOVE, type); | 3514 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add, |
| 3516 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add, | 3515 _("Remove the user from your buddy list"), NULL); |
| 3517 _("Remove the user from your buddy list"), NULL); | 3516 |
| 3518 | |
| 3519 rebuild = TRUE; | |
| 3520 } | |
| 3521 | |
| 3522 gtk_widget_set_sensitive(gtkconv->u.im->add, | 3517 gtk_widget_set_sensitive(gtkconv->u.im->add, |
| 3523 (gc != NULL && gc->prpl->remove_buddy != NULL)); | 3518 (gc != NULL && gc->prpl->remove_buddy != NULL)); |
| 3524 | |
| 3525 g_object_set_data(G_OBJECT(gtkconv->u.im->add), "user_data", conv); | |
| 3526 | |
| 3527 } else { | 3519 } else { |
| 3528 if (g_object_get_data(G_OBJECT(gtkconv->u.im->add), "user_data")) { | 3520 gtkconv->u.im->add = |
| 3529 gtkconv->u.im->add = | 3521 gaim_gtk_change_text(_("Add"), gtkconv->u.im->add, |
| 3530 gaim_gtk_change_text(_("Add"), gtkconv->u.im->add, | 3522 GTK_STOCK_ADD, type); |
| 3531 GTK_STOCK_ADD, type); | 3523 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add, |
| 3532 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add, | 3524 _("Add the user to your buddy list"), NULL); |
| 3533 _("Add the user to your buddy list"), NULL); | |
| 3534 | |
| 3535 rebuild = TRUE; | |
| 3536 } | |
| 3537 | 3525 |
| 3538 gtk_widget_set_sensitive(gtkconv->u.im->add, | 3526 gtk_widget_set_sensitive(gtkconv->u.im->add, |
| 3539 (gc != NULL && gc->prpl->add_buddy != NULL)); | 3527 (gc != NULL && gc->prpl->add_buddy != NULL)); |
| 3540 } | 3528 } |
| 3541 | 3529 |
| 3542 if (rebuild) { | 3530 g_signal_connect(G_OBJECT(gtkconv->u.im->add), "clicked", |
| 3543 g_signal_connect(G_OBJECT(gtkconv->u.im->add), "clicked", | 3531 G_CALLBACK(add_cb), conv); |
| 3544 G_CALLBACK(add_cb), conv); | 3532 |
| 3545 | 3533 gtk_box_pack_start(GTK_BOX(parent), gtkconv->u.im->add, |
| 3546 gtk_box_pack_start(GTK_BOX(parent), gtkconv->u.im->add, | 3534 FALSE, FALSE, 0); |
| 3547 FALSE, FALSE, 0); | 3535 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->u.im->add, 3); |
| 3548 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->u.im->add, 3); | 3536 gtk_button_set_relief(GTK_BUTTON(gtkconv->u.im->add), GTK_RELIEF_NONE); |
| 3549 gtk_button_set_relief(GTK_BUTTON(gtkconv->u.im->add), GTK_RELIEF_NONE); | 3537 gtk_size_group_add_widget(gtkconv->sg, gtkconv->u.im->add); |
| 3550 gtk_size_group_add_widget(gtkconv->sg, gtkconv->u.im->add); | |
| 3551 } | |
| 3552 } | 3538 } |
| 3553 | 3539 |
| 3554 struct gaim_window_ops * | 3540 struct gaim_window_ops * |
| 3555 gaim_get_gtk_window_ops(void) | 3541 gaim_get_gtk_window_ops(void) |
| 3556 { | 3542 { |
| 4159 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | 4145 else if (type == GAIM_CONV_ACCOUNT_ONLINE || |
| 4160 type == GAIM_CONV_ACCOUNT_OFFLINE) { | 4146 type == GAIM_CONV_ACCOUNT_OFFLINE) { |
| 4161 | 4147 |
| 4162 generate_send_as_items(win, NULL); | 4148 generate_send_as_items(win, NULL); |
| 4163 } | 4149 } |
| 4150 else if(type == GAIM_CONV_UPDATE_ADD || | |
| 4151 type == GAIM_CONV_UPDATE_REMOVE) { | |
| 4152 | |
| 4153 update_convo_add_button(conv); | |
| 4154 } | |
| 4164 } | 4155 } |
| 4165 | 4156 |
| 4166 static struct gaim_conversation_ops conversation_ops = | 4157 static struct gaim_conversation_ops conversation_ops = |
| 4167 { | 4158 { |
| 4168 gaim_gtkconv_destroy, /* destroy_conversation */ | 4159 gaim_gtkconv_destroy, /* destroy_conversation */ |
