Mercurial > pidgin.yaz
comparison src/dialogs.c @ 5258:4ac135a2f422
[gaim-migrate @ 5630]
Jose' M^(a) Pe'rez Ca'ncer (jm_pc) writes:
" When you are logged in with just protocols that don't
allow chats, selecting Buddies/Add a Chat crashes the app.
This patch will present an error dialog whenever it is
not possible to add a chat because the user is not
connected to any protocol that allows chats.
It will also only allow to select accounts with chat
capabilities in the "Add a Chat" dialog. "
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Tue, 29 Apr 2003 00:17:36 +0000 |
parents | 98fc2d44c2ba |
children | 8bd4f777489f |
comparison
equal
deleted
inserted
replaced
5257:e131ab86ead7 | 5258:4ac135a2f422 |
---|---|
1338 | 1338 |
1339 menu = gtk_menu_new(); | 1339 menu = gtk_menu_new(); |
1340 | 1340 |
1341 while (g) { | 1341 while (g) { |
1342 c = (struct gaim_connection *)g->data; | 1342 c = (struct gaim_connection *)g->data; |
1343 g_snprintf(buf, sizeof(buf), "%s (%s)", | 1343 if (GAIM_PLUGIN_PROTOCOL_INFO(c->prpl)->join_chat) { |
1344 c->username, c->prpl->info->name); | 1344 g_snprintf(buf, sizeof(buf), "%s (%s)", |
1345 opt = gtk_menu_item_new_with_label(buf); | 1345 c->username, c->prpl->info->name); |
1346 g_object_set_data(G_OBJECT(opt), "addchat", ac); | 1346 opt = gtk_menu_item_new_with_label(buf); |
1347 g_signal_connect(GTK_OBJECT(opt), "activate", | 1347 g_object_set_data(G_OBJECT(opt), "addchat", ac); |
1348 G_CALLBACK(addchat_select_account), | 1348 g_signal_connect(GTK_OBJECT(opt), "activate", |
1349 c); | 1349 G_CALLBACK(addchat_select_account), |
1350 gtk_widget_show(opt); | 1350 c); |
1351 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); | 1351 gtk_widget_show(opt); |
1352 | 1352 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); |
1353 /* Now check to see if it's our current menu */ | 1353 |
1354 if (c->account == ac->account) { | 1354 /* Now check to see if it's our current menu */ |
1355 place = count; | 1355 if (c->account == ac->account) { |
1356 gtk_menu_item_activate(GTK_MENU_ITEM(opt)); | 1356 place = count; |
1357 gtk_option_menu_set_history(GTK_OPTION_MENU(ac->account_menu), count); | 1357 gtk_menu_item_activate(GTK_MENU_ITEM(opt)); |
1358 | 1358 gtk_option_menu_set_history(GTK_OPTION_MENU(ac->account_menu), count); |
1359 /* Do the cha cha cha */ | 1359 |
1360 /* Do the cha cha cha */ | |
1361 } | |
1362 | |
1363 count++; | |
1360 } | 1364 } |
1361 | |
1362 count++; | |
1363 | 1365 |
1364 g = g->next; | 1366 g = g->next; |
1365 } | 1367 } |
1366 | 1368 |
1367 gtk_option_menu_remove_menu(GTK_OPTION_MENU(ac->account_menu)); | 1369 gtk_option_menu_remove_menu(GTK_OPTION_MENU(ac->account_menu)); |
1370 } | 1372 } |
1371 | 1373 |
1372 void show_add_chat(struct gaim_account *account, struct group *group) { | 1374 void show_add_chat(struct gaim_account *account, struct group *group) { |
1373 struct addchat *ac = g_new0(struct addchat, 1); | 1375 struct addchat *ac = g_new0(struct addchat, 1); |
1374 struct gaim_gtk_buddy_list *gtkblist; | 1376 struct gaim_gtk_buddy_list *gtkblist; |
1377 GSList *c; | |
1378 struct gaim_connection *gc; | |
1375 | 1379 |
1376 GtkWidget *label; | 1380 GtkWidget *label; |
1377 GtkWidget *rowbox; | 1381 GtkWidget *rowbox; |
1378 GtkWidget *hbox; | 1382 GtkWidget *hbox; |
1379 GtkWidget *vbox; | 1383 GtkWidget *vbox; |
1380 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, | 1384 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
1381 GTK_ICON_SIZE_DIALOG); | 1385 GTK_ICON_SIZE_DIALOG); |
1382 | 1386 |
1383 gtkblist = GAIM_GTK_BLIST(gaim_get_blist()); | 1387 gtkblist = GAIM_GTK_BLIST(gaim_get_blist()); |
1384 | 1388 |
1385 ac->account = account ? account : | 1389 if (account) { |
1386 ((struct gaim_connection *)connections->data)->account; | 1390 ac->account = account; |
1391 } else { | |
1392 /* Select an account with chat capabilities */ | |
1393 for (c = connections; c != NULL; c = c->next) { | |
1394 gc = c->data; | |
1395 | |
1396 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat) { | |
1397 ac->account = gc->account; | |
1398 break; | |
1399 } | |
1400 } | |
1401 } | |
1402 | |
1403 if (!ac->account) { | |
1404 do_error_dialog( | |
1405 _("You are not currently signed on with any protocols " | |
1406 "that have the ability to chat."), NULL, GAIM_ERROR); | |
1407 return; | |
1408 } | |
1387 | 1409 |
1388 ac->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | 1410 ac->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
1389 | 1411 |
1390 ac->window = gtk_dialog_new_with_buttons(_("Add Chat"), | 1412 ac->window = gtk_dialog_new_with_buttons(_("Add Chat"), |
1391 GTK_WINDOW(gtkblist->window), 0, | 1413 GTK_WINDOW(gtkblist->window), 0, |