# HG changeset patch # User Tim Ringenbach # Date 1133022465 0 # Node ID f28e51bf9be8517ba368a18555bcd5dee5a79887 # Parent b4391f2ae8dee954b497b838a467756a91f9ac4e [gaim-migrate @ 14530] patch by sadrul to make the per-accounts status boxes show error/connecting, etc. committer: Tailor Script diff -r b4391f2ae8de -r f28e51bf9be8 src/gtkconn.c --- a/src/gtkconn.c Fri Nov 25 22:45:08 2005 +0000 +++ b/src/gtkconn.c Sat Nov 26 16:27:45 2005 +0000 @@ -49,26 +49,61 @@ static GHashTable *hash = NULL; static GSList *accountReconnecting = NULL; +static GtkGaimStatusBox * +find_status_box_for_account(GaimAccount *account) +{ + GaimGtkBuddyList *gtkblist; + GList *iter; + + gtkblist = gaim_gtk_blist_get_default_gtk_blist(); + if (!gtkblist) + return NULL; + + for (iter = gtkblist->statusboxes; iter; iter=iter->next) + { + GtkGaimStatusBox *box = iter->data; + if (box->account == account) + return box; + } + return NULL; +} + static void gaim_gtk_connection_connect_progress(GaimConnection *gc, const char *text, size_t step, size_t step_count) { GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist(); + GtkGaimStatusBox *box; if (!gtkblist) return; gtk_gaim_status_box_set_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox), (gaim_connections_get_connecting() != NULL)); gtk_gaim_status_box_pulse_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox)); + + if ((box = find_status_box_for_account(gc->account)) != NULL) + { + gtk_gaim_status_box_set_error(box, NULL); + gtk_gaim_status_box_set_connecting(box, TRUE); + gtk_gaim_status_box_pulse_connecting(box); + } } static void gaim_gtk_connection_connected(GaimConnection *gc) { GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist(); + GtkGaimStatusBox *box; GaimAccount *account = NULL; if (!gtkblist) return; gtk_gaim_status_box_set_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox), (gaim_connections_get_connecting() != NULL)); account = gaim_connection_get_account(gc); + + if ((box = find_status_box_for_account(account)) != NULL) + { + gtk_gaim_status_box_set_connecting(box, FALSE); + gtk_gaim_status_box_set_error(box, NULL); + } + if (hash != NULL) g_hash_table_remove(hash, account); if (accountReconnecting == NULL) @@ -86,6 +121,8 @@ return; gtk_gaim_status_box_set_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox), (gaim_connections_get_connecting() != NULL)); + gtk_gaim_status_box_set_connecting(find_status_box_for_account(gc->account), + FALSE); gaim_gtk_blist_update_protocol_actions(); if (gaim_connections_get_all() != NULL) @@ -155,6 +192,7 @@ if (!gc->wants_to_die) { if (gtkblist != NULL) gtk_gaim_status_box_set_error(GTK_GAIM_STATUS_BOX(gtkblist->statusbox), text); + gtk_gaim_status_box_set_error(find_status_box_for_account(account), text); if (info == NULL) { info = g_new0(GaimAutoRecon, 1); diff -r b4391f2ae8de -r f28e51bf9be8 src/gtkstatusbox.c --- a/src/gtkstatusbox.c Fri Nov 25 22:45:08 2005 +0000 +++ b/src/gtkstatusbox.c Sat Nov 26 16:27:45 2005 +0000 @@ -231,7 +231,7 @@ static void gtk_gaim_status_box_refresh(GtkGaimStatusBox *status_box) { - char *text, *title; + char *text = NULL, *title; char aa_color[8]; GdkPixbuf *pixbuf; GtkTreePath *path; @@ -247,30 +247,34 @@ if (!title) title = ""; - if (status_box->error) { - text = g_strdup_printf("%s\n%s", - title, status_box->error); + text = g_strdup_printf("%s", + status_box->error); } else if (status_box->typing) { - text = g_strdup_printf("%s\n%s", - title, aa_color, _("Typing")); + text = g_strdup_printf("%s", + aa_color, _("Typing")); } else if (status_box->connecting) { - text = g_strdup_printf("%s\n%s", - title, aa_color, _("Connecting")); + text = g_strdup_printf("%s", + aa_color, _("Connecting")); } else if (status_box->desc) { - text = g_strdup_printf("%s\n%s", - title, aa_color, status_box->desc); - } else { - text = g_strdup_printf("%s", title); + text = g_strdup_printf("%s", + aa_color, status_box->desc); } if (status_box->account) { - char *text2 = g_strdup_printf("%s\n%s", gaim_account_get_username(status_box->account), text); + char *text2 = g_strdup_printf("%s\n%s", + gaim_account_get_username(status_box->account), + text ? text : title); g_free(text); text = text2; + } else if (text) { + char *text2 = g_strdup_printf("%s\n%s", title, text); + g_free(text); + text = text2; + } else { + text = g_strdup(title); } - if (status_box->connecting) pixbuf = status_box->connecting_pixbufs[status_box->connecting_index]; else if (status_box->error)