comparison src/gtkroomlist.c @ 8939:19885cb8a24c

[gaim-migrate @ 9709] Handle graying out the roomlist menu item in a more sane way. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 15 May 2004 23:04:08 +0000
parents fd1a4ff1f7ed
children b875f5d57b81
comparison
equal deleted inserted replaced
8938:88ec59dec95a 8939:19885cb8a24c
1 /** 1 /**
2 * @file gtkroomlist.c Gtk Room List UI 2 * @file gtkroomlist.c GTK+ Room List UI
3 * @ingroup gtkui 3 * @ingroup gtkui
4 * 4 *
5 * gaim 5 * gaim
6 * 6 *
7 * Gaim is the legal property of its developers, whose names are too numerous 7 * Gaim is the legal property of its developers, whose names are too numerous
281 gaim_roomlist_expand_category(list, category); 281 gaim_roomlist_expand_category(list, category);
282 category->expanded_once = TRUE; 282 category->expanded_once = TRUE;
283 } 283 }
284 } 284 }
285 285
286 static gboolean accounts_filter_func(GaimAccount *account) 286 static gboolean account_filter_func(GaimAccount *account)
287 { 287 {
288 GaimConnection *gc = gaim_account_get_connection(account);
289 GaimPluginProtocolInfo *prpl_info = NULL;
290
291 // if (!gc)
292 // return FALSE;
293
294 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
295
296 return (prpl_info->roomlist_get_list != NULL);
297 }
298
299 gboolean
300 gaim_gtk_roomlist_is_showable()
301 {
302 GList *c;
288 GaimConnection *gc; 303 GaimConnection *gc;
289 304
290 gc = gaim_account_get_connection(account); 305 for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
291 if (!gc) 306 gc = c->data;
292 return FALSE; 307
293 return gaim_roomlist_is_possible(gc); 308 if (account_filter_func(gaim_connection_get_account(gc)))
309 return TRUE;
310 }
311
312 return FALSE;
294 } 313 }
295 314
296 GaimGtkRoomlistDialog *gaim_gtk_roomlist_dialog_new_with_account(GaimAccount *account) 315 GaimGtkRoomlistDialog *gaim_gtk_roomlist_dialog_new_with_account(GaimAccount *account)
297 { 316 {
298 GaimGtkRoomlistDialog *dialog; 317 GaimGtkRoomlistDialog *dialog;
301 GtkWidget *vbox2; 320 GtkWidget *vbox2;
302 GtkWidget *account_hbox; 321 GtkWidget *account_hbox;
303 GtkWidget *bbox; 322 GtkWidget *bbox;
304 GtkWidget *label; 323 GtkWidget *label;
305 324
306 if (account == NULL) {
307 account = gaim_roomlist_get_first_valid_account();
308
309 if (account == NULL) {
310 gaim_notify_error(NULL, NULL,
311 _("You are not currently signed on with any "
312 "protocols that have the ability to list rooms."),
313 NULL);
314
315 return NULL;
316 }
317 }
318
319 dialog = g_new0(GaimGtkRoomlistDialog, 1); 325 dialog = g_new0(GaimGtkRoomlistDialog, 1);
320 dialog->account = account; 326 dialog->account = account;
321 327
322 /* Create the window. */ 328 /* Create the window. */
323 dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 329 dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
349 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Account:")); 355 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Account:"));
350 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); 356 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
351 gtk_widget_show(label); 357 gtk_widget_show(label);
352 358
353 dialog->account_widget = gaim_gtk_account_option_menu_new(dialog->account, FALSE, 359 dialog->account_widget = gaim_gtk_account_option_menu_new(dialog->account, FALSE,
354 G_CALLBACK(dialog_select_account_cb), accounts_filter_func, dialog); 360 G_CALLBACK(dialog_select_account_cb), account_filter_func, dialog);
355 361
356 gtk_box_pack_start(GTK_BOX(account_hbox), dialog->account_widget, TRUE, TRUE, 0); 362 gtk_box_pack_start(GTK_BOX(account_hbox), dialog->account_widget, TRUE, TRUE, 0);
357 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(dialog->account_widget)); 363 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(dialog->account_widget));
358 gtk_widget_show(dialog->account_widget); 364 gtk_widget_show(dialog->account_widget);
359 365