comparison src/gtkconn.c @ 10915:ceb530338123

[gaim-migrate @ 12673] Hopefully this will fix those annoying reconnect crashes, or at least some of them. Yay! committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 14 May 2005 14:46:06 +0000
parents 5cda52915a1f
children e52ec3cffff4
comparison
equal deleted inserted replaced
10914:0249b1ad6322 10915:ceb530338123
116 * shown or hidden. Also make sure the label on the Reconnect 116 * shown or hidden. Also make sure the label on the Reconnect
117 * button is correctly set to either Reconnect or Remove. If there 117 * button is correctly set to either Reconnect or Remove. If there
118 * is more than one account then make sure the GtkTreeView is shown. 118 * is more than one account then make sure the GtkTreeView is shown.
119 * If there are no accounts disconnected then hide the dialog. 119 * If there are no accounts disconnected then hide the dialog.
120 */ 120 */
121 static void disconnect_window_update_buttons(GtkTreeModel *model) 121 static void disconnect_window_update_buttons()
122 { 122 {
123 GtkTreeIter iter; 123 GtkTreeIter iter;
124 GtkTreeSelection *sel; 124 GtkTreeSelection *sel;
125 GtkTreeModel *model;
125 char *label_text; 126 char *label_text;
126 GaimAccount *account = NULL; 127 GaimAccount *account = NULL;
128
129 model = gtk_tree_view_get_model(GTK_TREE_VIEW(disconnect_window->treeview));
127 130
128 if ((disconnect_window == NULL) || (model == NULL)) 131 if ((disconnect_window == NULL) || (model == NULL))
129 return; 132 return;
130 133
131 if (!gtk_tree_model_get_iter_first(model, &iter)) { 134 if (!gtk_tree_model_get_iter_first(model, &iter)) {
227 } 230 }
228 g_list_free(l_accts); 231 g_list_free(l_accts);
229 232
230 } 233 }
231 234
232 disconnect_window_update_buttons(model); 235 disconnect_window_update_buttons();
233 236
234 break; 237 break;
235 238
236 case GTK_RESPONSE_ACCEPT: /* Reconnect Selected */ 239 case GTK_RESPONSE_ACCEPT: /* Reconnect Selected */
237 model = gtk_tree_view_get_model(GTK_TREE_VIEW(disconnect_window->treeview)); 240 model = gtk_tree_view_get_model(GTK_TREE_VIEW(disconnect_window->treeview));
278 } 281 }
279 g_list_free(l_del); 282 g_list_free(l_del);
280 } 283 }
281 284
282 gaim_account_connect(account); 285 gaim_account_connect(account);
283 disconnect_window_update_buttons(model); 286 disconnect_window_update_buttons();
284 287
285 break; 288 break;
286 289
287 case GTK_RESPONSE_DELETE_EVENT: 290 case GTK_RESPONSE_DELETE_EVENT:
288 case GTK_RESPONSE_CLOSE: 291 case GTK_RESPONSE_CLOSE:
295 /* 298 /*
296 * Called whenever a different account is selected in the GtkListWhatever. 299 * Called whenever a different account is selected in the GtkListWhatever.
297 */ 300 */
298 static void disconnect_tree_cb(GtkTreeSelection *sel, GtkTreeModel *model) 301 static void disconnect_tree_cb(GtkTreeSelection *sel, GtkTreeModel *model)
299 { 302 {
300 disconnect_window_update_buttons(model); 303 disconnect_window_update_buttons();
301 } 304 }
302 305
303 /* 306 /*
304 * Update the icon next to the account in the disconnect dialog, and 307 * Update the icon next to the account in the disconnect dialog, and
305 * gray the Reconnect All button if there is only 1 disconnected account. 308 * gray the Reconnect All button if there is only 1 disconnected account.
346 if (icon != NULL) 349 if (icon != NULL)
347 g_object_unref(G_OBJECT(icon)); 350 g_object_unref(G_OBJECT(icon));
348 if (scale != NULL) 351 if (scale != NULL)
349 g_object_unref(G_OBJECT(scale)); 352 g_object_unref(G_OBJECT(scale));
350 353
351 disconnect_window_update_buttons(model); 354 disconnect_window_update_buttons();
352 } 355 }
353 356
354 static void 357 static void
355 gaim_gtk_connection_report_disconnect(GaimConnection *gc, const char *text) 358 gaim_gtk_connection_report_disconnect(GaimConnection *gc, const char *text)
356 { 359 {
462 465
463 /* Make sure the newly disconnected account is selected */ 466 /* Make sure the newly disconnected account is selected */
464 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(disconnect_window->treeview)); 467 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(disconnect_window->treeview));
465 gtk_tree_selection_select_iter(sel, &new_iter); 468 gtk_tree_selection_select_iter(sel, &new_iter);
466 469
467 disconnect_window_update_buttons(GTK_TREE_MODEL(list_store)); 470 disconnect_window_update_buttons();
468 471
469 g_free(label_text); 472 g_free(label_text);
470 } 473 }
471 /* 474 /*
472 * End of disconnected dialog 475 * End of disconnected dialog