comparison src/gtkconn.c @ 11251:ad9a61894d9b

[gaim-migrate @ 13420] sf patch #1242524, from Sadrul Habib Chowdhury gaim_account_is_connected fix committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 13 Aug 2005 05:54:34 +0000
parents a511b77a368b
children 1116993aadd2
comparison
equal deleted inserted replaced
11250:4e25fb6678bd 11251:ad9a61894d9b
138 disconnect_window_hide(); 138 disconnect_window_hide();
139 return; 139 return;
140 } 140 }
141 141
142 /* 142 /*
143 * If we have more than one disconnected account then show the 143 * If we have more than one disconnected account then show the
144 * GtkTreeView and the "Reconnect All" button 144 * GtkTreeView and the "Reconnect All" button
145 */ 145 */
146 if (gtk_tree_model_iter_next(model, &iter)) { 146 if (gtk_tree_model_iter_next(model, &iter)) {
147 gtk_widget_show_all(disconnect_window->sw); 147 gtk_widget_show_all(disconnect_window->sw);
148 gtk_widget_show(disconnect_window->reconnectall_btn); 148 gtk_widget_show(disconnect_window->reconnectall_btn);
159 gtk_tree_model_get_iter_first(model, &iter); 159 gtk_tree_model_get_iter_first(model, &iter);
160 gtk_tree_selection_select_iter(sel, &iter); 160 gtk_tree_selection_select_iter(sel, &iter);
161 } 161 }
162 162
163 /* 163 /*
164 * Update the Reconnect/Remove button appropriately and set the 164 * Update the Reconnect/Remove button appropriately and set the
165 * label in the dialog to what it should be. If there is only 165 * label in the dialog to what it should be. If there is only
166 * one account in the tree model, and that account is connected, 166 * one account in the tree model, and that account is connected,
167 * then we don't show the remove button. 167 * then we don't show the remove button.
168 */ 168 */
169 gtk_tree_model_get(model, &iter, 3, &label_text, 4, &account, -1); 169 gtk_tree_model_get(model, &iter, 3, &label_text, 4, &account, -1);
170 gtk_button_set_label(GTK_BUTTON(disconnect_window->reconnect_btn), 170 gtk_button_set_label(GTK_BUTTON(disconnect_window->reconnect_btn),
171 gaim_account_is_connected(account) ? _("_Remove") : _("_Reconnect")); 171 gaim_account_is_disconnected(account) ? _("Reconnect") : _("_Remove"));
172 gtk_label_set_markup(GTK_LABEL(disconnect_window->label), label_text); 172 gtk_label_set_markup(GTK_LABEL(disconnect_window->label), label_text);
173 gtk_dialog_set_response_sensitive(GTK_DIALOG(disconnect_window->window), GTK_RESPONSE_ACCEPT, TRUE); 173 gtk_dialog_set_response_sensitive(GTK_DIALOG(disconnect_window->window), GTK_RESPONSE_ACCEPT, TRUE);
174 gtk_tree_model_get_iter_first(model, &iter); 174 gtk_tree_model_get_iter_first(model, &iter);
175 if (gaim_account_is_connected(account) && !(gtk_tree_model_iter_next(model, &iter))) 175 if (gaim_account_is_disconnected(account) || gtk_tree_model_iter_next(model, &iter))
176 gtk_widget_show(disconnect_window->reconnect_btn);
177 else
176 gtk_widget_hide(disconnect_window->reconnect_btn); 178 gtk_widget_hide(disconnect_window->reconnect_btn);
177 else
178 gtk_widget_show(disconnect_window->reconnect_btn);
179 g_free(label_text); 179 g_free(label_text);
180 } 180 }
181 181
182 static void disconnect_response_cb(GtkDialog *dialog, gint id, GtkWidget *widget) 182 static void disconnect_response_cb(GtkDialog *dialog, gint id, GtkWidget *widget)
183 { 183 {
199 GtkTreeRowReference* del_row = gtk_tree_row_reference_new(model, path); 199 GtkTreeRowReference* del_row = gtk_tree_row_reference_new(model, path);
200 l_del = g_list_append(l_del, del_row); 200 l_del = g_list_append(l_del, del_row);
201 gtk_tree_path_free(path); 201 gtk_tree_path_free(path);
202 202
203 gtk_tree_model_get(model, &iter, 4, &account, -1); 203 gtk_tree_model_get(model, &iter, 4, &account, -1);
204 if (!gaim_account_is_connected(account) && g_list_find(l_accts, account) == NULL) 204 if (gaim_account_is_disconnected(account) && g_list_find(l_accts, account) == NULL)
205 l_accts = g_list_append(l_accts, account); 205 l_accts = g_list_append(l_accts, account);
206 } while (gtk_tree_model_iter_next(model, &iter)); 206 } while (gtk_tree_model_iter_next(model, &iter));
207 207
208 /* remove all rows */ 208 /* remove all rows */
209 /* We could just do the following, but we only want to remove accounts 209 /* We could just do the following, but we only want to remove accounts
323 model = gtk_tree_view_get_model(GTK_TREE_VIEW(disconnect_window->treeview)); 323 model = gtk_tree_view_get_model(GTK_TREE_VIEW(disconnect_window->treeview));
324 icon = gaim_gtk_create_prpl_icon(account); 324 icon = gaim_gtk_create_prpl_icon(account);
325 scale = gdk_pixbuf_scale_simple(icon, 16, 16, GDK_INTERP_BILINEAR); 325 scale = gdk_pixbuf_scale_simple(icon, 16, 16, GDK_INTERP_BILINEAR);
326 326
327 /* Mark all disconnections w/ the account type disconnected /w grey icon */ 327 /* Mark all disconnections w/ the account type disconnected /w grey icon */
328 if (!gaim_account_is_connected(account)) 328 if (gaim_account_is_disconnected(account))
329 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE); 329 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
330 330
331 gtk_tree_model_get_iter_first(model, &iter); 331 gtk_tree_model_get_iter_first(model, &iter);
332 do { 332 do {
333 GaimAccount *account2 = NULL; 333 GaimAccount *account2 = NULL;
335 gtk_tree_model_get(model, &iter, 4, &account2, -1); 335 gtk_tree_model_get(model, &iter, 4, &account2, -1);
336 if (account2 == account) 336 if (account2 == account)
337 gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, scale, -1); 337 gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, scale, -1);
338 338
339 /* Add */ 339 /* Add */
340 if (!gaim_account_is_connected(account2) 340 if (gaim_account_is_disconnected(account2)
341 && g_list_find(l_disc_accts, account2) == NULL) 341 && g_list_find(l_disc_accts, account2) == NULL)
342 l_disc_accts = g_list_append(l_disc_accts, account2); 342 l_disc_accts = g_list_append(l_disc_accts, account2);
343 } while (gtk_tree_model_iter_next(model, &iter)); 343 } while (gtk_tree_model_iter_next(model, &iter));
344 344
345 gtk_dialog_set_response_sensitive( 345 gtk_dialog_set_response_sensitive(