comparison src/gtkroomlist.c @ 8937:fd1a4ff1f7ed

[gaim-migrate @ 9707] Tools->Room List will now be grayed out when you're not signed on with an account that supports listing rooms. This involved 2 big changes: -Change when the sign_on_off_cb function in gtkblist gets called... it used to get called when the signing-on and signing-off signal was emitted, but I changed it to signed-on and signed-off. This makes more sense to me, and it makes my code work :-) Let me know if you notice any side-effects -Add functions to the roomlist API for determining if any online accounts support chatting or not. This involved extracting a function from gtkroomlist.c and putting it in roomlist.c, and adding a little helper TRUE/FALSE function committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 15 May 2004 21:56:17 +0000
parents 058efd3cb86f
children 19885cb8a24c
comparison
equal deleted inserted replaced
8936:7cbdbed9d329 8937:fd1a4ff1f7ed
300 GtkWidget *vbox; 300 GtkWidget *vbox;
301 GtkWidget *vbox2; 301 GtkWidget *vbox2;
302 GtkWidget *account_hbox; 302 GtkWidget *account_hbox;
303 GtkWidget *bbox; 303 GtkWidget *bbox;
304 GtkWidget *label; 304 GtkWidget *label;
305 GaimAccount *first_account = NULL; 305
306 306 if (account == NULL) {
307 if (!account) { 307 account = gaim_roomlist_get_first_valid_account();
308 GList *c; 308
309 GaimConnection *gc; 309 if (account == NULL) {
310
311 for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
312 gc = c->data;
313
314 if (gaim_roomlist_is_possible(gc)) {
315 first_account = gaim_connection_get_account(gc);
316 break;
317 }
318 }
319
320 if (first_account == NULL) {
321 gaim_notify_error(NULL, NULL, 310 gaim_notify_error(NULL, NULL,
322 _("You are not currently signed on with any " 311 _("You are not currently signed on with any "
323 "protocols that have the ability to list rooms."), 312 "protocols that have the ability to list rooms."),
324 NULL); 313 NULL);
325 314
326 return NULL; 315 return NULL;
327 } 316 }
328 } 317 }
329 318
330 dialog = g_new0(GaimGtkRoomlistDialog, 1); 319 dialog = g_new0(GaimGtkRoomlistDialog, 1);
320 dialog->account = account;
331 321
332 /* Create the window. */ 322 /* Create the window. */
333 dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 323 dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
334 gtk_window_set_role(GTK_WINDOW(window), "room list"); 324 gtk_window_set_role(GTK_WINDOW(window), "room list");
335 gtk_window_set_title(GTK_WINDOW(window), _("Room List")); 325 gtk_window_set_title(GTK_WINDOW(window), _("Room List"));
346 gtk_widget_show(vbox); 336 gtk_widget_show(vbox);
347 337
348 vbox2 = gtk_vbox_new(FALSE, 12); 338 vbox2 = gtk_vbox_new(FALSE, 12);
349 gtk_container_add(GTK_CONTAINER(vbox), vbox2); 339 gtk_container_add(GTK_CONTAINER(vbox), vbox2);
350 gtk_widget_show(vbox2); 340 gtk_widget_show(vbox2);
351
352
353 if (!account)
354 dialog->account = first_account;
355 else
356 dialog->account = account;
357 341
358 /* accounts dropdown list */ 342 /* accounts dropdown list */
359 account_hbox = gtk_hbox_new(FALSE, 6); 343 account_hbox = gtk_hbox_new(FALSE, 6);
360 gtk_box_pack_start(GTK_BOX(vbox2), account_hbox, FALSE, FALSE, 0); 344 gtk_box_pack_start(GTK_BOX(vbox2), account_hbox, FALSE, FALSE, 0);
361 gtk_widget_show(account_hbox); 345 gtk_widget_show(account_hbox);