src/gtkconn.c

changeset 12583
d4f1bc373c67
parent 12404
657afdf0f596
child 12607
4622f0adedf4
equal deleted inserted replaced
12582:7ec164be569e 12583:d4f1bc373c67
46 } GaimAutoRecon; 46 } GaimAutoRecon;
47 47
48 static GHashTable *hash = NULL; 48 static GHashTable *hash = NULL;
49 static GSList *accountReconnecting = NULL; 49 static GSList *accountReconnecting = NULL;
50 50
51 static GtkGaimStatusBox *
52 find_status_box_for_account(GaimAccount *account)
53 {
54 GaimGtkBuddyList *gtkblist;
55 GList *iter;
56
57 gtkblist = gaim_gtk_blist_get_default_gtk_blist();
58 if (!gtkblist)
59 return NULL;
60
61 for (iter = gtkblist->statusboxes; iter; iter=iter->next)
62 {
63 GtkGaimStatusBox *box = iter->data;
64 if (box->account == account)
65 return box;
66 }
67 return NULL;
68 }
69
70 static void gaim_gtk_connection_connect_progress(GaimConnection *gc, 51 static void gaim_gtk_connection_connect_progress(GaimConnection *gc,
71 const char *text, size_t step, size_t step_count) 52 const char *text, size_t step, size_t step_count)
72 { 53 {
73 GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist(); 54 GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist();
74 GtkGaimStatusBox *box; 55 GtkGaimStatusBox *box;
75 if (!gtkblist) 56 if (!gtkblist)
76 return; 57 return;
77 gtk_gaim_status_box_set_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox), 58 gtk_gaim_status_box_set_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox),
78 (gaim_connections_get_connecting() != NULL)); 59 (gaim_connections_get_connecting() != NULL));
79 gtk_gaim_status_box_pulse_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox)); 60 gtk_gaim_status_box_pulse_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox));
80
81 if ((box = find_status_box_for_account(gc->account)) != NULL)
82 {
83 gtk_gaim_status_box_set_error(box, NULL);
84 gtk_gaim_status_box_set_connecting(box, TRUE);
85 gtk_gaim_status_box_pulse_connecting(box);
86 }
87 } 61 }
88 62
89 static void gaim_gtk_connection_connected(GaimConnection *gc) 63 static void gaim_gtk_connection_connected(GaimConnection *gc)
90 { 64 {
91 GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist(); 65 GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist();
95 return; 69 return;
96 gtk_gaim_status_box_set_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox), 70 gtk_gaim_status_box_set_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox),
97 (gaim_connections_get_connecting() != NULL)); 71 (gaim_connections_get_connecting() != NULL));
98 account = gaim_connection_get_account(gc); 72 account = gaim_connection_get_account(gc);
99 73
100 if ((box = find_status_box_for_account(account)) != NULL)
101 {
102 gtk_gaim_status_box_set_connecting(box, FALSE);
103 gtk_gaim_status_box_set_error(box, NULL);
104 }
105
106 if (hash != NULL) 74 if (hash != NULL)
107 g_hash_table_remove(hash, account); 75 g_hash_table_remove(hash, account);
108 if (accountReconnecting == NULL) 76 if (accountReconnecting == NULL)
109 return; 77 return;
110 accountReconnecting = g_slist_remove(accountReconnecting, account); 78 accountReconnecting = g_slist_remove(accountReconnecting, account);
117 GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist(); 85 GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist();
118 if (!gtkblist) 86 if (!gtkblist)
119 return; 87 return;
120 gtk_gaim_status_box_set_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox), 88 gtk_gaim_status_box_set_connecting(GTK_GAIM_STATUS_BOX(gtkblist->statusbox),
121 (gaim_connections_get_connecting() != NULL)); 89 (gaim_connections_get_connecting() != NULL));
122 gtk_gaim_status_box_set_connecting(find_status_box_for_account(gc->account),
123 FALSE);
124 90
125 if (gaim_connections_get_all() != NULL) 91 if (gaim_connections_get_all() != NULL)
126 return; 92 return;
127 93
128 gaim_gtkdialogs_destroy_all(); 94 gaim_gtkdialogs_destroy_all();
187 listAccount = NULL; 153 listAccount = NULL;
188 154
189 if (!gc->wants_to_die) { 155 if (!gc->wants_to_die) {
190 if (gtkblist != NULL) 156 if (gtkblist != NULL)
191 gtk_gaim_status_box_set_error(GTK_GAIM_STATUS_BOX(gtkblist->statusbox), text); 157 gtk_gaim_status_box_set_error(GTK_GAIM_STATUS_BOX(gtkblist->statusbox), text);
192 gtk_gaim_status_box_set_error(find_status_box_for_account(account), text); 158
193
194 if (info == NULL) { 159 if (info == NULL) {
195 info = g_new0(GaimAutoRecon, 1); 160 info = g_new0(GaimAutoRecon, 1);
196 g_hash_table_insert(hash, account, info); 161 g_hash_table_insert(hash, account, info);
197 info->delay = INITIAL_RECON_DELAY; 162 info->delay = INITIAL_RECON_DELAY;
198 } else { 163 } else {

mercurial