| 5614 |
5614 |
| 5615 }/* end for loop */ |
5615 }/* end for loop */ |
| 5616 |
5616 |
| 5617 } |
5617 } |
| 5618 |
5618 |
| |
5619 static gboolean |
| |
5620 pidgin_blist_search_equal_func(GtkTreeModel *model, gint column, |
| |
5621 const gchar *key, GtkTreeIter *iter, gpointer data) |
| |
5622 { |
| |
5623 PurpleBlistNode *node = NULL; |
| |
5624 gboolean res = TRUE; |
| |
5625 const char *compare = NULL; |
| |
5626 |
| |
5627 if (!pidgin_tree_view_search_equal_func(model, column, key, iter, data)) |
| |
5628 return FALSE; |
| |
5629 |
| |
5630 /* If the search string does not match the displayed label, then look |
| |
5631 * at the alternate labels for the nodes and search in them. Currently, |
| |
5632 * alternate labels that make sense are usernames/email addresses for |
| |
5633 * buddies (but only for the ones who don't have a local alias). |
| |
5634 */ |
| |
5635 |
| |
5636 gtk_tree_model_get(model, iter, NODE_COLUMN, &node, -1); |
| |
5637 if (!node) |
| |
5638 return TRUE; |
| |
5639 |
| |
5640 compare = NULL; |
| |
5641 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
| |
5642 PurpleBuddy *b = purple_contact_get_priority_buddy(PURPLE_CONTACT(node)); |
| |
5643 if (!purple_buddy_get_local_buddy_alias(b)) |
| |
5644 compare = purple_buddy_get_name(b); |
| |
5645 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
| |
5646 if (!purple_buddy_get_local_buddy_alias(PURPLE_BUDDY(node))) |
| |
5647 compare = purple_buddy_get_name(PURPLE_BUDDY(node)); |
| |
5648 } |
| |
5649 |
| |
5650 if (compare) { |
| |
5651 char *tmp, *enteredstring; |
| |
5652 tmp = g_utf8_normalize(key, -1, G_NORMALIZE_DEFAULT); |
| |
5653 enteredstring = g_utf8_casefold(tmp, -1); |
| |
5654 g_free(tmp); |
| |
5655 |
| |
5656 if (purple_str_has_prefix(compare, enteredstring)) |
| |
5657 res = FALSE; |
| |
5658 g_free(enteredstring); |
| |
5659 } |
| |
5660 |
| |
5661 return res; |
| |
5662 } |
| |
5663 |
| 5619 static void pidgin_blist_show(PurpleBuddyList *list) |
5664 static void pidgin_blist_show(PurpleBuddyList *list) |
| 5620 { |
5665 { |
| 5621 PidginBuddyListPrivate *priv; |
5666 PidginBuddyListPrivate *priv; |
| 5622 void *handle; |
5667 void *handle; |
| 5623 GtkTreeViewColumn *column; |
5668 GtkTreeViewColumn *column; |
| 5850 g_signal_connect(G_OBJECT(gtkblist->treeview), "key-press-event", G_CALLBACK(gtk_blist_key_press_cb), NULL); |
5895 g_signal_connect(G_OBJECT(gtkblist->treeview), "key-press-event", G_CALLBACK(gtk_blist_key_press_cb), NULL); |
| 5851 g_signal_connect(G_OBJECT(gtkblist->treeview), "popup-menu", G_CALLBACK(pidgin_blist_popup_menu_cb), NULL); |
5896 g_signal_connect(G_OBJECT(gtkblist->treeview), "popup-menu", G_CALLBACK(pidgin_blist_popup_menu_cb), NULL); |
| 5852 |
5897 |
| 5853 /* Enable CTRL+F searching */ |
5898 /* Enable CTRL+F searching */ |
| 5854 gtk_tree_view_set_search_column(GTK_TREE_VIEW(gtkblist->treeview), NAME_COLUMN); |
5899 gtk_tree_view_set_search_column(GTK_TREE_VIEW(gtkblist->treeview), NAME_COLUMN); |
| 5855 gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(gtkblist->treeview), pidgin_tree_view_search_equal_func, NULL, NULL); |
5900 gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(gtkblist->treeview), |
| |
5901 pidgin_blist_search_equal_func, NULL, NULL); |
| 5856 |
5902 |
| 5857 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sw, TRUE, TRUE, 0); |
5903 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sw, TRUE, TRUE, 0); |
| 5858 gtk_container_add(GTK_CONTAINER(sw), gtkblist->treeview); |
5904 gtk_container_add(GTK_CONTAINER(sw), gtkblist->treeview); |
| 5859 |
5905 |
| 5860 sep = gtk_hseparator_new(); |
5906 sep = gtk_hseparator_new(); |