im.pidgin.pidgin: 1feb18178944ec0683c72714b1f19c45c751ba64
resiak at soc.pidgin.im
resiak at soc.pidgin.im
Sat Feb 16 10:30:37 EST 2008
-----------------------------------------------------------------
Revision: 1feb18178944ec0683c72714b1f19c45c751ba64
Ancestor: 1db48062464daa0913a6b22ccd36ca90fef29f90
Author: resiak at soc.pidgin.im
Date: 2008-02-16T15:25:19
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/1feb18178944ec0683c72714b1f19c45c751ba64
Modified files:
pidgin/gtkblist.c
ChangeLog:
Rework update_account_error_state to reuse existing mini-dialogs if they exist,
just changing the message as appropriate. I believe this should also reduce
spurious re-URGENTings.
-------------- next part --------------
============================================================
--- pidgin/gtkblist.c 9a82011280f123f76282e230a1ba56029b16bcbe
+++ pidgin/gtkblist.c 6f5ea19ed10321fed345f855596665324daaaa7f
@@ -4582,6 +4582,20 @@ remove_generic_error_dialog(PurpleAccoun
}
+static void
+update_generic_error_message(PurpleAccount *account,
+ const char *description)
+{
+ PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
+ GtkWidget *mini_dialog = find_child_widget_by_account(
+ GTK_CONTAINER(priv->error_scrollbook), account);
+ pidgin_mini_dialog_set_description(PIDGIN_MINI_DIALOG(mini_dialog),
+ description);
+ if (!GTK_WIDGET_HAS_FOCUS(gtkblist->window))
+ pidgin_set_urgent(GTK_WINDOW(gtkblist->window), TRUE);
+}
+
+
/* Notifications about accounts which were disconnected with
* PURPLE_CONNECTION_ERROR_NAME_IN_USE
*/
@@ -4753,6 +4767,21 @@ remove_from_signed_on_elsewhere(PurpleAc
}
+static void
+update_signed_on_elsewhere_tooltip(PurpleAccount *account,
+ const char *description)
+{
+#if GTK_CHECK_VERSION(2,12,0)
+ PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
+ GtkContainer *c = GTK_CONTAINER(priv->signed_on_elsewhere->contents);
+ GtkWidget *label = find_child_widget_by_account(c, account);
+ gtk_widget_set_tooltip_text(label, description);
+ if (!GTK_WIDGET_HAS_FOCUS(gtkblist->window))
+ pidgin_set_urgent(GTK_WINDOW(gtkblist->window), TRUE);
+#endif
+}
+
+
/* Call appropriate error notification code based on error types */
static void
update_account_error_state(PurpleAccount *account,
@@ -4760,36 +4789,61 @@ update_account_error_state(PurpleAccount
const PurpleConnectionErrorInfo *new,
PidginBuddyList *gtkblist)
{
+ gboolean descriptions_differ;
+ const char *desc;
+
+ if (old == NULL && new == NULL)
+ return;
+
/* For backwards compatibility: */
if (new)
pidgin_blist_update_account_error_state(account, new->description);
else
pidgin_blist_update_account_error_state(account, NULL);
- pidgin_blist_select_notebook_page(gtkblist);
- /* Don't bother updating the error if it hasn't changed. This stops
- * URGENT being repeatedly set for network errors whenever they try to
- * reconnect.
- */
- if ((old == new) ||
- (old != NULL && new != NULL && old->type == new->type
- && g_str_equal(old->description, new->description))
- )
- return;
+ if (new != NULL)
+ pidgin_blist_select_notebook_page(gtkblist);
- if (old) {
+ if (old != NULL && new == NULL) {
if(old->type == PURPLE_CONNECTION_ERROR_NAME_IN_USE)
remove_from_signed_on_elsewhere(account);
else
remove_generic_error_dialog(account);
+ return;
}
- if (new) {
+ if (old == NULL && new != NULL) {
if(new->type == PURPLE_CONNECTION_ERROR_NAME_IN_USE)
add_to_signed_on_elsewhere(account);
else
add_generic_error_dialog(account, new);
+ return;
}
+
+ /* else, new and old are both non-NULL */
+
+ descriptions_differ = strcmp(old->description, new->description);
+ desc = new->description;
+
+ switch (new->type) {
+ case PURPLE_CONNECTION_ERROR_NAME_IN_USE:
+ if (old->type == PURPLE_CONNECTION_ERROR_NAME_IN_USE
+ && descriptions_differ) {
+ update_signed_on_elsewhere_tooltip(account, desc);
+ } else {
+ remove_generic_error_dialog(account);
+ add_to_signed_on_elsewhere(account);
+ }
+ break;
+ default:
+ if (old->type == PURPLE_CONNECTION_ERROR_NAME_IN_USE) {
+ remove_from_signed_on_elsewhere(account);
+ add_generic_error_dialog(account, new);
+ } else if (descriptions_differ) {
+ update_generic_error_message(account, desc);
+ }
+ break;
+ }
}
/* In case accounts are loaded before the blist (which they currently are),
More information about the Commits
mailing list