Mercurial > pidgin
comparison src/conversation.c @ 7602:df5b0937ea47
[gaim-migrate @ 8225]
Put back a default conversation placement function. This was causing very
bad things to happen on qpe-gaim, though likely gtk-gaim was okay..?
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Sat, 22 Nov 2003 21:35:25 +0000 |
| parents | b859cfb5f31a |
| children | 08c9d0dcf906 |
comparison
equal
deleted
inserted
replaced
| 7601:6d59800ace03 | 7602:df5b0937ea47 |
|---|---|
| 49 static GList *chats = NULL; | 49 static GList *chats = NULL; |
| 50 static GList *windows = NULL; | 50 static GList *windows = NULL; |
| 51 static GList *conv_placement_fncs = NULL; | 51 static GList *conv_placement_fncs = NULL; |
| 52 static GaimConvPlacementFunc place_conv = NULL; | 52 static GaimConvPlacementFunc place_conv = NULL; |
| 53 | 53 |
| 54 static void ensure_default_funcs(void); | |
| 55 static void conv_placement_last_created_win(GaimConversation *conv); | |
| 56 | |
| 54 static gint | 57 static gint |
| 55 insertname_compare(gconstpointer one, gconstpointer two) | 58 insertname_compare(gconstpointer one, gconstpointer two) |
| 56 { | 59 { |
| 57 const char *a = (const char *)one; | 60 const char *a = (const char *)one; |
| 58 const char *b = (const char *)two; | 61 const char *b = (const char *)two; |
| 849 | 852 |
| 850 /* Ensure the window is visible. */ | 853 /* Ensure the window is visible. */ |
| 851 gaim_conv_window_show(win); | 854 gaim_conv_window_show(win); |
| 852 } | 855 } |
| 853 else { | 856 else { |
| 854 if (!place_conv) | 857 if (place_conv == NULL) |
| 858 { | |
| 859 ensure_default_funcs(); | |
| 860 | |
| 861 place_conv = conv_placement_last_created_win; | |
| 862 } | |
| 863 | |
| 864 if (place_conv == NULL) | |
| 855 gaim_debug(GAIM_DEBUG_ERROR, "conversation", | 865 gaim_debug(GAIM_DEBUG_ERROR, "conversation", |
| 856 "This is about to suck.\n"); | 866 "This is about to suck.\n"); |
| 857 | 867 |
| 858 place_conv(conv); | 868 place_conv(conv); |
| 859 } | 869 } |
| 2322 { | 2332 { |
| 2323 GaimConversationType type; | 2333 GaimConversationType type; |
| 2324 GList *wins, *convs; | 2334 GList *wins, *convs; |
| 2325 GaimAccount *account; | 2335 GaimAccount *account; |
| 2326 | 2336 |
| 2327 | |
| 2328 account = gaim_conversation_get_account(conv); | 2337 account = gaim_conversation_get_account(conv); |
| 2329 type = gaim_conversation_get_type(conv); | 2338 type = gaim_conversation_get_type(conv); |
| 2330 | 2339 |
| 2331 | 2340 |
| 2332 /* Go through the list of IMs and find one with this group. */ | 2341 /* Go through the list of IMs and find one with this group. */ |
| 2355 | 2364 |
| 2356 /* Make a new window. */ | 2365 /* Make a new window. */ |
| 2357 conv_placement_new_window(conv); | 2366 conv_placement_new_window(conv); |
| 2358 } | 2367 } |
| 2359 | 2368 |
| 2360 static ConvPlacementData *get_conv_placement_data(const char *id) | 2369 static ConvPlacementData * |
| 2370 get_conv_placement_data(const char *id) | |
| 2361 { | 2371 { |
| 2362 ConvPlacementData *data = NULL; | 2372 ConvPlacementData *data = NULL; |
| 2363 GList *n; | 2373 GList *n; |
| 2364 | 2374 |
| 2365 for(n = conv_placement_fncs; n; n = n->next) { | 2375 for(n = conv_placement_fncs; n; n = n->next) { |
| 2371 return NULL; | 2381 return NULL; |
| 2372 } | 2382 } |
| 2373 | 2383 |
| 2374 static void | 2384 static void |
| 2375 add_conv_placement_fnc(const char *id, const char *name, | 2385 add_conv_placement_fnc(const char *id, const char *name, |
| 2376 GaimConvPlacementFunc fnc) | 2386 GaimConvPlacementFunc fnc) |
| 2377 { | 2387 { |
| 2378 ConvPlacementData *data; | 2388 ConvPlacementData *data; |
| 2379 | 2389 |
| 2380 data = g_new(ConvPlacementData, 1); | 2390 data = g_new(ConvPlacementData, 1); |
| 2381 | 2391 |
| 2382 data->id = g_strdup(id); | 2392 data->id = g_strdup(id); |
| 2383 data->name = g_strdup(name); | 2393 data->name = g_strdup(name); |
| 2384 data->fnc = fnc; | 2394 data->fnc = fnc; |
| 2385 | 2395 |
| 2386 conv_placement_fncs = g_list_append(conv_placement_fncs, data); | 2396 conv_placement_fncs = g_list_append(conv_placement_fncs, data); |
| 2387 | |
| 2388 } | 2397 } |
| 2389 | 2398 |
| 2390 static void | 2399 static void |
| 2391 ensure_default_funcs(void) | 2400 ensure_default_funcs(void) |
| 2392 { | 2401 { |
| 2393 if (conv_placement_fncs == NULL) { | 2402 if (conv_placement_fncs == NULL) |
| 2403 { | |
| 2394 add_conv_placement_fnc("last", _("Last created window"), | 2404 add_conv_placement_fnc("last", _("Last created window"), |
| 2395 conv_placement_last_created_win); | 2405 conv_placement_last_created_win); |
| 2396 add_conv_placement_fnc("new", _("New window"), | 2406 add_conv_placement_fnc("new", _("New window"), |
| 2397 conv_placement_new_window); | 2407 conv_placement_new_window); |
| 2398 add_conv_placement_fnc("group", _("By group"), | 2408 add_conv_placement_fnc("group", _("By group"), |
