comparison src/gtkconn.c @ 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 8a7553e149de
children 2f4577ae3810
comparison
equal deleted inserted replaced
12227:b4391f2ae8de 12228:f28e51bf9be8
47 } GaimAutoRecon; 47 } GaimAutoRecon;
48 48
49 static GHashTable *hash = NULL; 49 static GHashTable *hash = NULL;
50 static GSList *accountReconnecting = NULL; 50 static GSList *accountReconnecting = NULL;
51 51
52 static GtkGaimStatusBox *
53 find_status_box_for_account(GaimAccount *account)
54 {
55 GaimGtkBuddyList *gtkblist;
56 GList *iter;
57
58 gtkblist = gaim_gtk_blist_get_default_gtk_blist();
59 if (!gtkblist)
60 return NULL;
61
62 for (iter = gtkblist->statusboxes; iter; iter=iter->next)
63 {
64 GtkGaimStatusBox *box = iter->data;
65 if (box->account == account)
66 return box;
67 }
68 return NULL;
69 }
70
52 static void gaim_gtk_connection_connect_progress(GaimConnection *gc, 71 static void gaim_gtk_connection_connect_progress(GaimConnection *gc,
53 const char *text, size_t step, size_t step_count) 72 const char *text, size_t step, size_t step_count)
54 { 73 {
55 GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist(); 74 GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist();
75 GtkGaimStatusBox *box;
56 if (!gtkblist) 76 if (!gtkblist)
57 return; 77 return;
58 gtk_gaim_status_box_set_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox), 78 gtk_gaim_status_box_set_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox),
59 (gaim_connections_get_connecting() != NULL)); 79 (gaim_connections_get_connecting() != NULL));
60 gtk_gaim_status_box_pulse_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox)); 80 gtk_gaim_status_box_pulse_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox));
81
82 if ((box = find_status_box_for_account(gc->account)) != NULL)
83 {
84 gtk_gaim_status_box_set_error(box, NULL);
85 gtk_gaim_status_box_set_connecting(box, TRUE);
86 gtk_gaim_status_box_pulse_connecting(box);
87 }
61 } 88 }
62 89
63 static void gaim_gtk_connection_connected(GaimConnection *gc) 90 static void gaim_gtk_connection_connected(GaimConnection *gc)
64 { 91 {
65 GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist(); 92 GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist();
93 GtkGaimStatusBox *box;
66 GaimAccount *account = NULL; 94 GaimAccount *account = NULL;
67 if (!gtkblist) 95 if (!gtkblist)
68 return; 96 return;
69 gtk_gaim_status_box_set_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox), 97 gtk_gaim_status_box_set_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox),
70 (gaim_connections_get_connecting() != NULL)); 98 (gaim_connections_get_connecting() != NULL));
71 account = gaim_connection_get_account(gc); 99 account = gaim_connection_get_account(gc);
100
101 if ((box = find_status_box_for_account(account)) != NULL)
102 {
103 gtk_gaim_status_box_set_connecting(box, FALSE);
104 gtk_gaim_status_box_set_error(box, NULL);
105 }
106
72 if (hash != NULL) 107 if (hash != NULL)
73 g_hash_table_remove(hash, account); 108 g_hash_table_remove(hash, account);
74 if (accountReconnecting == NULL) 109 if (accountReconnecting == NULL)
75 return; 110 return;
76 accountReconnecting = g_slist_remove(accountReconnecting, account); 111 accountReconnecting = g_slist_remove(accountReconnecting, account);
84 GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist(); 119 GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist();
85 if (!gtkblist) 120 if (!gtkblist)
86 return; 121 return;
87 gtk_gaim_status_box_set_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox), 122 gtk_gaim_status_box_set_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox),
88 (gaim_connections_get_connecting() != NULL)); 123 (gaim_connections_get_connecting() != NULL));
124 gtk_gaim_status_box_set_connecting(find_status_box_for_account(gc->account),
125 FALSE);
89 gaim_gtk_blist_update_protocol_actions(); 126 gaim_gtk_blist_update_protocol_actions();
90 127
91 if (gaim_connections_get_all() != NULL) 128 if (gaim_connections_get_all() != NULL)
92 return; 129 return;
93 130
153 listAccount = NULL; 190 listAccount = NULL;
154 191
155 if (!gc->wants_to_die) { 192 if (!gc->wants_to_die) {
156 if (gtkblist != NULL) 193 if (gtkblist != NULL)
157 gtk_gaim_status_box_set_error(GTK_GAIM_STATUS_BOX(gtkblist->statusbox), text); 194 gtk_gaim_status_box_set_error(GTK_GAIM_STATUS_BOX(gtkblist->statusbox), text);
195 gtk_gaim_status_box_set_error(find_status_box_for_account(account), text);
158 196
159 if (info == NULL) { 197 if (info == NULL) {
160 info = g_new0(GaimAutoRecon, 1); 198 info = g_new0(GaimAutoRecon, 1);
161 g_hash_table_insert(hash, account, info); 199 g_hash_table_insert(hash, account, info);
162 info->delay = INITIAL_RECON_DELAY; 200 info->delay = INITIAL_RECON_DELAY;