Mercurial > pidgin
changeset 12228:f28e51bf9be8
[gaim-migrate @ 14530]
patch by sadrul to make the per-accounts status boxes show error/connecting, etc.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Sat, 26 Nov 2005 16:27:45 +0000 |
parents | b4391f2ae8de |
children | 18f0dadb29cf |
files | src/gtkconn.c src/gtkstatusbox.c |
diffstat | 2 files changed, 56 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- 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);
--- 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<span size=\"smaller\" weight=\"bold\" color=\"red\">%s</span>", - title, status_box->error); + text = g_strdup_printf("<span size=\"smaller\" weight=\"bold\" color=\"red\">%s</span>", + status_box->error); } else if (status_box->typing) { - text = g_strdup_printf("%s\n<span size=\"smaller\" color=\"%s\">%s</span>", - title, aa_color, _("Typing")); + text = g_strdup_printf("<span size=\"smaller\" color=\"%s\">%s</span>", + aa_color, _("Typing")); } else if (status_box->connecting) { - text = g_strdup_printf("%s\n<span size=\"smaller\" color=\"%s\">%s</span>", - title, aa_color, _("Connecting")); + text = g_strdup_printf("<span size=\"smaller\" color=\"%s\">%s</span>", + aa_color, _("Connecting")); } else if (status_box->desc) { - text = g_strdup_printf("%s\n<span size=\"smaller\" color=\"%s\">%s</span>", - title, aa_color, status_box->desc); - } else { - text = g_strdup_printf("%s", title); + text = g_strdup_printf("<span size=\"smaller\" color=\"%s\">%s</span>", + aa_color, status_box->desc); } if (status_box->account) { - char *text2 = g_strdup_printf("%s\n<span size=\"smaller\">%s</span>", gaim_account_get_username(status_box->account), text); + char *text2 = g_strdup_printf("%s\n<span size=\"smaller\">%s</span>", + 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)