Mercurial > pidgin
comparison src/prefs.c @ 5422:af62169c74fd
[gaim-migrate @ 5801]
Not to be too LSchieresque, but:
<SeanEgan> Which should I do? Finish writing sorting code or commit sorting code?
<Robot101> the latter, then the former.
This is my incomplete buddy list sorting code. Sorting methods are modular, a plugin
can add its own if it wanted to. Included are four sorting methods:
None - this will be perceived as no sorting. It sorts the list in the order specified
in blist.xml
Alphabetical - duh.
By status - this isn't really written yet, but I'm going to fix it right now. This will
sort using idle time, away status, and online status when it's written
By log file size - this puts the people you talk to the most at the top of your list. Pretty
keen, eh?
Of course this is replete with Sean Egan Hacks (TM).
Now I'm going to go eat some weird "golden crunch" cereal from nestle.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sun, 18 May 2003 03:41:31 +0000 |
parents | c54cb8f8655f |
children | 19224d2ab31e |
comparison
equal
deleted
inserted
replaced
5421:7955274fa92b | 5422:af62169c74fd |
---|---|
571 | 571 |
572 GtkWidget *list_page() { | 572 GtkWidget *list_page() { |
573 GtkWidget *ret; | 573 GtkWidget *ret; |
574 GtkWidget *vbox; | 574 GtkWidget *vbox; |
575 GtkWidget *button, *b2; | 575 GtkWidget *button, *b2; |
576 int r = 0; | |
577 gboolean fnd = FALSE; | |
578 GList *l= NULL; | |
579 GSList *sl = gaim_gtk_blist_sort_methods; | |
576 ret = gtk_vbox_new(FALSE, 18); | 580 ret = gtk_vbox_new(FALSE, 18); |
577 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | 581 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); |
582 | |
583 | |
584 vbox = make_frame (ret, _("Buddy List Sorting")); | |
585 while (sl) { | |
586 l = g_list_append(l, ((struct gaim_gtk_blist_sort_method*)sl->data)->name); | |
587 l = g_list_append(l, ((struct gaim_gtk_blist_sort_method*)sl->data)->name); | |
588 if (!fnd && !gaim_utf8_strcasecmp(((struct gaim_gtk_blist_sort_method*)sl->data)->name, sort_method)) | |
589 fnd = TRUE; | |
590 sl = sl->next; | |
591 if (!fnd) r++; | |
592 } | |
593 gaim_dropdown_from_list(vbox, _("Sorting:"), | |
594 (int*)&sort_method, r, l); | |
595 | |
596 g_list_free(l); | |
578 | 597 |
579 vbox = make_frame (ret, _("Buddy List Toolbar")); | 598 vbox = make_frame (ret, _("Buddy List Toolbar")); |
580 gaim_dropdown(vbox, _("Show _buttons as:"), &blist_options, OPT_BLIST_SHOW_BUTTON_XPM | OPT_BLIST_NO_BUTTON_TEXT, | 599 gaim_dropdown(vbox, _("Show _buttons as:"), &blist_options, OPT_BLIST_SHOW_BUTTON_XPM | OPT_BLIST_NO_BUTTON_TEXT, |
581 _("Pictures"), OPT_BLIST_SHOW_BUTTON_XPM | OPT_BLIST_NO_BUTTON_TEXT, | 600 _("Pictures"), OPT_BLIST_SHOW_BUTTON_XPM | OPT_BLIST_NO_BUTTON_TEXT, |
582 _("Text"), 0, | 601 _("Text"), 0, |
2298 void dropdown_set(GObject *w, int *option) | 2317 void dropdown_set(GObject *w, int *option) |
2299 { | 2318 { |
2300 int opt = GPOINTER_TO_INT(g_object_get_data(w, "value")); | 2319 int opt = GPOINTER_TO_INT(g_object_get_data(w, "value")); |
2301 int clear = GPOINTER_TO_INT(g_object_get_data(w, "clear")); | 2320 int clear = GPOINTER_TO_INT(g_object_get_data(w, "clear")); |
2302 | 2321 |
2322 if (option == (int*)&sort_method) { | |
2323 /* Hack city -- Population: Sean Egan */ | |
2324 char *name = (char*)opt; | |
2325 gaim_gtk_blist_sort_method_set(name); | |
2326 return; | |
2327 } | |
2303 if (clear != -1) { | 2328 if (clear != -1) { |
2304 *option = *option & ~clear; | 2329 *option = *option & ~clear; |
2305 *option = *option | opt; | 2330 *option = *option | opt; |
2306 } else { | 2331 } else { |
2307 gaim_debug(GAIM_DEBUG_MISC, "dropdown_set", "HELLO %d\n", opt); | 2332 gaim_debug(GAIM_DEBUG_MISC, "dropdown_set", "HELLO %d\n", opt); |
2338 gaim_gtkconv_update_chat_button_style(); | 2363 gaim_gtkconv_update_chat_button_style(); |
2339 // } else if (option == (int*)&blist_options) { | 2364 // } else if (option == (int*)&blist_options) { |
2340 // set_blist_tab(); | 2365 // set_blist_tab(); |
2341 } else if (option == (int *)&conv_placement_option) { | 2366 } else if (option == (int *)&conv_placement_option) { |
2342 gaim_conv_placement_set_active(conv_placement_option); | 2367 gaim_conv_placement_set_active(conv_placement_option); |
2343 } | 2368 } |
2344 } | 2369 } |
2345 | 2370 |
2346 static GtkWidget *gaim_dropdown(GtkWidget *box, const gchar *title, int *option, int clear, ...) | 2371 static GtkWidget *gaim_dropdown(GtkWidget *box, const gchar *title, int *option, int clear, ...) |
2347 { | 2372 { |
2348 va_list ap; | 2373 va_list ap; |
2407 g_signal_connect(G_OBJECT(opt), "activate", | 2432 g_signal_connect(G_OBJECT(opt), "activate", |
2408 G_CALLBACK(dropdown_set), (void *)option); | 2433 G_CALLBACK(dropdown_set), (void *)option); |
2409 gtk_widget_show(opt); | 2434 gtk_widget_show(opt); |
2410 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); | 2435 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); |
2411 | 2436 |
2412 if (((clear > -1) && ((*option & clear) == value)) || *option == value) { | 2437 if (option == (int*)sort_method) { |
2438 /* Now Entering Hacksville, Estd. May 17, 2003 */ | |
2439 gtk_menu_set_active(GTK_MENU(menu), clear); | |
2440 } else if (((clear > -1) && ((*option & clear) == value)) || *option == value) { | |
2413 gtk_menu_set_active(GTK_MENU(menu), o); | 2441 gtk_menu_set_active(GTK_MENU(menu), o); |
2414 } | 2442 } |
2415 o++; | 2443 o++; |
2416 | 2444 |
2417 } | 2445 } |