Mercurial > pidgin.yaz
comparison pidgin/gtkblist.c @ 21618:85fc97ffe538
Workarounds to fix some issues with the minidialog and scrollbook.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Thu, 22 Nov 2007 19:34:50 +0000 |
parents | 21cbdaf265f6 |
children | 1c139f0493b9 |
comparison
equal
deleted
inserted
replaced
21617:4ddc6e16c3ed | 21618:85fc97ffe538 |
---|---|
4439 static GtkWidget * | 4439 static GtkWidget * |
4440 find_child_widget_by_account(GtkContainer *container, | 4440 find_child_widget_by_account(GtkContainer *container, |
4441 PurpleAccount *account) | 4441 PurpleAccount *account) |
4442 { | 4442 { |
4443 GList *l = NULL; | 4443 GList *l = NULL; |
4444 GList *children = gtk_container_get_children(container); | 4444 GList *children = NULL; |
4445 GtkWidget *ret = NULL; | 4445 GtkWidget *ret = NULL; |
4446 /* XXX: Workaround for the currently incomplete implementation of PidginScrollBook */ | |
4447 if (PIDGIN_IS_SCROLL_BOOK(container)) | |
4448 container = PIDGIN_SCROLL_BOOK(container)->notebook; | |
4449 children = gtk_container_get_children(container); | |
4446 l = g_list_find_custom(children, account, (GCompareFunc) find_account_widget); | 4450 l = g_list_find_custom(children, account, (GCompareFunc) find_account_widget); |
4447 if (l) | 4451 if (l) |
4448 ret = GTK_WIDGET(l->data); | 4452 ret = GTK_WIDGET(l->data); |
4449 g_list_free(children); | 4453 g_list_free(children); |
4450 return ret; | 4454 return ret; |
4454 remove_child_widget_by_account(GtkContainer *container, | 4458 remove_child_widget_by_account(GtkContainer *container, |
4455 PurpleAccount *account) | 4459 PurpleAccount *account) |
4456 { | 4460 { |
4457 GtkWidget *widget = find_child_widget_by_account(container, account); | 4461 GtkWidget *widget = find_child_widget_by_account(container, account); |
4458 if(widget) { | 4462 if(widget) { |
4459 gtk_container_remove(container, widget); | |
4460 gtk_widget_destroy(widget); | 4463 gtk_widget_destroy(widget); |
4461 } | 4464 } |
4462 } | 4465 } |
4463 | 4466 |
4464 /* Generic error buttons */ | 4467 /* Generic error buttons */ |
4618 PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist); | 4621 PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist); |
4619 PidginMiniDialog *mini_dialog; | 4622 PidginMiniDialog *mini_dialog; |
4620 | 4623 |
4621 if(priv->signed_on_elsewhere) | 4624 if(priv->signed_on_elsewhere) |
4622 return; | 4625 return; |
4623 | 4626 |
4624 mini_dialog = priv->signed_on_elsewhere = | 4627 mini_dialog = priv->signed_on_elsewhere = |
4625 pidgin_mini_dialog_new(NULL, NULL, PIDGIN_STOCK_DISCONNECT); | 4628 pidgin_mini_dialog_new(NULL, NULL, PIDGIN_STOCK_DISCONNECT); |
4626 | 4629 |
4627 pidgin_mini_dialog_add_button(mini_dialog, _("Re-enable"), | 4630 pidgin_mini_dialog_add_button(mini_dialog, _("Re-enable"), |
4628 reconnect_elsewhere_accounts, NULL); | 4631 reconnect_elsewhere_accounts, NULL); |
4647 | 4650 |
4648 if (mini_dialog == NULL) | 4651 if (mini_dialog == NULL) |
4649 return; | 4652 return; |
4650 | 4653 |
4651 accounts = pidgin_mini_dialog_get_num_children(mini_dialog); | 4654 accounts = pidgin_mini_dialog_get_num_children(mini_dialog); |
4655 if (accounts == 0) { | |
4656 gtk_widget_destroy(GTK_WIDGET(mini_dialog)); | |
4657 return; | |
4658 } | |
4652 | 4659 |
4653 title = g_strdup_printf( | 4660 title = g_strdup_printf( |
4654 ngettext("%d account was disabled because you signed on from another location.", | 4661 ngettext("%d account was disabled because you signed on from another location.", |
4655 "%d accounts were disabled because you signed on from another location.", | 4662 "%d accounts were disabled because you signed on from another location.", |
4656 accounts), | 4663 accounts), |