comparison pidgin/gtkblist.c @ 32692:0f94ec89f0bc

merged from im.pidgin.pidgin
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 26 Sep 2011 14:57:21 +0900
parents ac6353ffa129 20dfcc9aa471
children 4a34689eeb33
comparison
equal deleted inserted replaced
32438:55e678325bda 32692:0f94ec89f0bc
3542 3542
3543 fields = purple_request_fields_new(); 3543 fields = purple_request_fields_new();
3544 g = purple_request_field_group_new(NULL); 3544 g = purple_request_field_group_new(NULL);
3545 f = purple_request_field_list_new("mood", _("Please select your mood from the list")); 3545 f = purple_request_field_list_new("mood", _("Please select your mood from the list"));
3546 3546
3547 purple_request_field_list_add(f, _("None"), ""); 3547 purple_request_field_list_add_icon(f, _("None"), NULL, "");
3548 if (current_mood == NULL) 3548 if (current_mood == NULL)
3549 purple_request_field_list_add_selected(f, _("None")); 3549 purple_request_field_list_add_selected(f, _("None"));
3550 3550
3551 /* TODO: rlaager wants this sorted. */ 3551 /* TODO: rlaager wants this sorted. */
3552 /* TODO: darkrain wants it sorted post-translation */ 3552 /* TODO: darkrain wants it sorted post-translation */
4767 static void pidgin_blist_new_list(PurpleBuddyList *blist) 4767 static void pidgin_blist_new_list(PurpleBuddyList *blist)
4768 { 4768 {
4769 PidginBuddyList *gtkblist; 4769 PidginBuddyList *gtkblist;
4770 4770
4771 gtkblist = g_new0(PidginBuddyList, 1); 4771 gtkblist = g_new0(PidginBuddyList, 1);
4772 gtkblist->connection_errors = g_hash_table_new_full(g_direct_hash,
4773 g_direct_equal, NULL, g_free);
4774 gtkblist->priv = g_new0(PidginBuddyListPrivate, 1); 4772 gtkblist->priv = g_new0(PidginBuddyListPrivate, 1);
4775 4773
4776 blist->ui_data = gtkblist; 4774 blist->ui_data = gtkblist;
4777 } 4775 }
4778 4776
5082 5080
5083 static void 5081 static void
5084 generic_error_destroy_cb(GtkObject *dialog, 5082 generic_error_destroy_cb(GtkObject *dialog,
5085 PurpleAccount *account) 5083 PurpleAccount *account)
5086 { 5084 {
5087 g_hash_table_remove(gtkblist->connection_errors, account);
5088 /* If the error dialog is being destroyed in response to the 5085 /* If the error dialog is being destroyed in response to the
5089 * account-error-changed signal, we don't want to clear the current 5086 * account-error-changed signal, we don't want to clear the current
5090 * error. 5087 * error.
5091 */ 5088 */
5092 if (g_object_get_data(G_OBJECT(dialog), DO_NOT_CLEAR_ERROR) == NULL) 5089 if (g_object_get_data(G_OBJECT(dialog), DO_NOT_CLEAR_ERROR) == NULL)
5340 gtk_widget_set_tooltip_text(label, description); 5337 gtk_widget_set_tooltip_text(label, description);
5341 #endif 5338 #endif
5342 } 5339 }
5343 5340
5344 5341
5345 /**
5346 * Was used by the connection API to tell the blist if an account has a
5347 * connection error or no longer has a connection error, but the blist now does
5348 * this itself with the @ref account-error-changed signal.
5349 *
5350 * @param account The account that either has a connection error
5351 * or no longer has a connection error.
5352 * @param message The connection error message, or NULL if this
5353 * account is no longer in an error state.
5354 */
5355 static void
5356 pidgin_blist_update_account_error_state(PurpleAccount *account, const char *text)
5357 {
5358 /* connection_errors isn't actually used anywhere; it's just kept in
5359 * sync with reality in case a plugin uses it.
5360 */
5361 if (text == NULL)
5362 g_hash_table_remove(gtkblist->connection_errors, account);
5363 else
5364 g_hash_table_insert(gtkblist->connection_errors, account, g_strdup(text));
5365 }
5366
5367 /* Call appropriate error notification code based on error types */ 5342 /* Call appropriate error notification code based on error types */
5368 static void 5343 static void
5369 update_account_error_state(PurpleAccount *account, 5344 update_account_error_state(PurpleAccount *account,
5370 const PurpleConnectionErrorInfo *old, 5345 const PurpleConnectionErrorInfo *old,
5371 const PurpleConnectionErrorInfo *new, 5346 const PurpleConnectionErrorInfo *new,
5374 gboolean descriptions_differ; 5349 gboolean descriptions_differ;
5375 const char *desc; 5350 const char *desc;
5376 5351
5377 if (old == NULL && new == NULL) 5352 if (old == NULL && new == NULL)
5378 return; 5353 return;
5379
5380 /* For backwards compatibility: */
5381 if (new)
5382 pidgin_blist_update_account_error_state(account, new->description);
5383 else
5384 pidgin_blist_update_account_error_state(account, NULL);
5385 5354
5386 if (new != NULL) 5355 if (new != NULL)
5387 pidgin_blist_select_notebook_page(gtkblist); 5356 pidgin_blist_select_notebook_page(gtkblist);
5388 5357
5389 if (old != NULL && new == NULL) { 5358 if (old != NULL && new == NULL) {
6888 if (gtkblist->timeout) 6857 if (gtkblist->timeout)
6889 g_source_remove(gtkblist->timeout); 6858 g_source_remove(gtkblist->timeout);
6890 if (gtkblist->drag_timeout) 6859 if (gtkblist->drag_timeout)
6891 g_source_remove(gtkblist->drag_timeout); 6860 g_source_remove(gtkblist->drag_timeout);
6892 6861
6893 g_hash_table_destroy(gtkblist->connection_errors);
6894 gtkblist->refresh_timer = 0; 6862 gtkblist->refresh_timer = 0;
6895 gtkblist->timeout = 0; 6863 gtkblist->timeout = 0;
6896 gtkblist->drag_timeout = 0; 6864 gtkblist->drag_timeout = 0;
6897 gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL; 6865 gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL;
6898 g_object_unref(G_OBJECT(gtkblist->treemodel)); 6866 g_object_unref(G_OBJECT(gtkblist->treemodel));
7044 { 7012 {
7045 b = purple_buddy_new(account, who, whoalias); 7013 b = purple_buddy_new(account, who, whoalias);
7046 purple_blist_add_buddy(b, NULL, g, NULL); 7014 purple_blist_add_buddy(b, NULL, g, NULL);
7047 } 7015 }
7048 7016
7049 purple_account_add_buddy_with_invite(account, b, invite); 7017 purple_account_add_buddy(account, b, invite);
7050 7018
7051 /* Offer to merge people with the same alias. */ 7019 /* Offer to merge people with the same alias. */
7052 if (whoalias != NULL && g != NULL) 7020 if (whoalias != NULL && g != NULL)
7053 gtk_blist_auto_personize((PurpleBlistNode *)g, whoalias); 7021 gtk_blist_auto_personize((PurpleBlistNode *)g, whoalias);
7054 7022