| 4761 static void pidgin_blist_new_list(PurpleBuddyList *blist) |
4761 static void pidgin_blist_new_list(PurpleBuddyList *blist) |
| 4762 { |
4762 { |
| 4763 PidginBuddyList *gtkblist; |
4763 PidginBuddyList *gtkblist; |
| 4764 |
4764 |
| 4765 gtkblist = g_new0(PidginBuddyList, 1); |
4765 gtkblist = g_new0(PidginBuddyList, 1); |
| 4766 gtkblist->connection_errors = g_hash_table_new_full(g_direct_hash, |
|
| 4767 g_direct_equal, NULL, g_free); |
|
| 4768 gtkblist->priv = g_new0(PidginBuddyListPrivate, 1); |
4766 gtkblist->priv = g_new0(PidginBuddyListPrivate, 1); |
| 4769 |
4767 |
| 4770 blist->ui_data = gtkblist; |
4768 blist->ui_data = gtkblist; |
| 4771 } |
4769 } |
| 4772 |
4770 |
| 5076 |
5074 |
| 5077 static void |
5075 static void |
| 5078 generic_error_destroy_cb(GtkObject *dialog, |
5076 generic_error_destroy_cb(GtkObject *dialog, |
| 5079 PurpleAccount *account) |
5077 PurpleAccount *account) |
| 5080 { |
5078 { |
| 5081 g_hash_table_remove(gtkblist->connection_errors, account); |
|
| 5082 /* If the error dialog is being destroyed in response to the |
5079 /* If the error dialog is being destroyed in response to the |
| 5083 * account-error-changed signal, we don't want to clear the current |
5080 * account-error-changed signal, we don't want to clear the current |
| 5084 * error. |
5081 * error. |
| 5085 */ |
5082 */ |
| 5086 if (g_object_get_data(G_OBJECT(dialog), DO_NOT_CLEAR_ERROR) == NULL) |
5083 if (g_object_get_data(G_OBJECT(dialog), DO_NOT_CLEAR_ERROR) == NULL) |
| 5334 gtk_widget_set_tooltip_text(label, description); |
5331 gtk_widget_set_tooltip_text(label, description); |
| 5335 #endif |
5332 #endif |
| 5336 } |
5333 } |
| 5337 |
5334 |
| 5338 |
5335 |
| 5339 /** |
|
| 5340 * Was used by the connection API to tell the blist if an account has a |
|
| 5341 * connection error or no longer has a connection error, but the blist now does |
|
| 5342 * this itself with the @ref account-error-changed signal. |
|
| 5343 * |
|
| 5344 * @param account The account that either has a connection error |
|
| 5345 * or no longer has a connection error. |
|
| 5346 * @param message The connection error message, or NULL if this |
|
| 5347 * account is no longer in an error state. |
|
| 5348 */ |
|
| 5349 static void |
|
| 5350 pidgin_blist_update_account_error_state(PurpleAccount *account, const char *text) |
|
| 5351 { |
|
| 5352 /* connection_errors isn't actually used anywhere; it's just kept in |
|
| 5353 * sync with reality in case a plugin uses it. |
|
| 5354 */ |
|
| 5355 if (text == NULL) |
|
| 5356 g_hash_table_remove(gtkblist->connection_errors, account); |
|
| 5357 else |
|
| 5358 g_hash_table_insert(gtkblist->connection_errors, account, g_strdup(text)); |
|
| 5359 } |
|
| 5360 |
|
| 5361 /* Call appropriate error notification code based on error types */ |
5336 /* Call appropriate error notification code based on error types */ |
| 5362 static void |
5337 static void |
| 5363 update_account_error_state(PurpleAccount *account, |
5338 update_account_error_state(PurpleAccount *account, |
| 5364 const PurpleConnectionErrorInfo *old, |
5339 const PurpleConnectionErrorInfo *old, |
| 5365 const PurpleConnectionErrorInfo *new, |
5340 const PurpleConnectionErrorInfo *new, |
| 5368 gboolean descriptions_differ; |
5343 gboolean descriptions_differ; |
| 5369 const char *desc; |
5344 const char *desc; |
| 5370 |
5345 |
| 5371 if (old == NULL && new == NULL) |
5346 if (old == NULL && new == NULL) |
| 5372 return; |
5347 return; |
| 5373 |
|
| 5374 /* For backwards compatibility: */ |
|
| 5375 if (new) |
|
| 5376 pidgin_blist_update_account_error_state(account, new->description); |
|
| 5377 else |
|
| 5378 pidgin_blist_update_account_error_state(account, NULL); |
|
| 5379 |
5348 |
| 5380 if (new != NULL) |
5349 if (new != NULL) |
| 5381 pidgin_blist_select_notebook_page(gtkblist); |
5350 pidgin_blist_select_notebook_page(gtkblist); |
| 5382 |
5351 |
| 5383 if (old != NULL && new == NULL) { |
5352 if (old != NULL && new == NULL) { |
| 6882 if (gtkblist->timeout) |
6851 if (gtkblist->timeout) |
| 6883 g_source_remove(gtkblist->timeout); |
6852 g_source_remove(gtkblist->timeout); |
| 6884 if (gtkblist->drag_timeout) |
6853 if (gtkblist->drag_timeout) |
| 6885 g_source_remove(gtkblist->drag_timeout); |
6854 g_source_remove(gtkblist->drag_timeout); |
| 6886 |
6855 |
| 6887 g_hash_table_destroy(gtkblist->connection_errors); |
|
| 6888 gtkblist->refresh_timer = 0; |
6856 gtkblist->refresh_timer = 0; |
| 6889 gtkblist->timeout = 0; |
6857 gtkblist->timeout = 0; |
| 6890 gtkblist->drag_timeout = 0; |
6858 gtkblist->drag_timeout = 0; |
| 6891 gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL; |
6859 gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL; |
| 6892 g_object_unref(G_OBJECT(gtkblist->treemodel)); |
6860 g_object_unref(G_OBJECT(gtkblist->treemodel)); |