src/conversation.c

changeset 8979
b2e7d7b9ca4d
parent 8942
7419d0b874fe
child 8998
e18e340f1111
equal deleted inserted replaced
8978:38af990ff584 8979:b2e7d7b9ca4d
2412 2412
2413 /* Make a new window. */ 2413 /* Make a new window. */
2414 conv_placement_new_window(conv); 2414 conv_placement_new_window(conv);
2415 } 2415 }
2416 2416
2417 static void
2418 conv_placement_by_number(GaimConversation *conv)
2419 {
2420 GaimConvWindow *win = NULL;
2421
2422 if (gaim_prefs_get_bool("/core/conversations/combine_chat_im"))
2423 win = g_list_last(gaim_get_windows())->data;
2424 else
2425 win = gaim_get_last_window_with_type(gaim_conversation_get_type(conv));
2426
2427 if (win == NULL) {
2428 win = gaim_conv_window_new();
2429
2430 gaim_conv_window_add_conversation(win, conv);
2431 gaim_conv_window_show(win);
2432 } else {
2433 int max_count = gaim_prefs_get_int("/gaim/gtk/conversations/placement_number");
2434 int count = gaim_conv_window_get_conversation_count(win);
2435
2436 if (count < max_count)
2437 gaim_conv_window_add_conversation(win, conv);
2438 else {
2439 GList *l = NULL;
2440
2441 for (l = gaim_get_windows(); l != NULL; l = l->next) {
2442 win = (GaimConvWindow *)l->data;
2443
2444 count = gaim_conv_window_get_conversation_count(win);
2445 if (count < max_count) {
2446 gaim_conv_window_add_conversation(win, conv);
2447 return;
2448 }
2449 }
2450 win = gaim_conv_window_new();
2451
2452 gaim_conv_window_add_conversation(win, conv);
2453 gaim_conv_window_show(win);
2454 }
2455 }
2456 }
2457
2417 static ConvPlacementData * 2458 static ConvPlacementData *
2418 get_conv_placement_data(const char *id) 2459 get_conv_placement_data(const char *id)
2419 { 2460 {
2420 ConvPlacementData *data = NULL; 2461 ConvPlacementData *data = NULL;
2421 GList *n; 2462 GList *n;
2455 conv_placement_new_window); 2496 conv_placement_new_window);
2456 add_conv_placement_fnc("group", _("By group"), 2497 add_conv_placement_fnc("group", _("By group"),
2457 conv_placement_by_group); 2498 conv_placement_by_group);
2458 add_conv_placement_fnc("account", _("By account"), 2499 add_conv_placement_fnc("account", _("By account"),
2459 conv_placement_by_account); 2500 conv_placement_by_account);
2501 add_conv_placement_fnc("number", _("By conversation count"),
2502 conv_placement_by_number);
2460 } 2503 }
2461 } 2504 }
2462 2505
2463 GList * 2506 GList *
2464 gaim_conv_placement_get_options(void) 2507 gaim_conv_placement_get_options(void)

mercurial