60 |
60 |
static bool_t adding;
|
61 |
61 |
static int search_source;
|
62 |
62 |
|
63 |
|
static GtkWidget * entry, * help_label, * wait_label, * scrolled, * results_list;
|
|
63 |
static GtkWidget * entry, * help_label, * wait_label, * scrolled, * results_list, * button_top;
|
64 |
64 |
|
65 |
65 |
static void item_free (Item * item);
|
66 |
66 |
|
... | ... | |
143 |
143 |
char * folded = str_tolower_utf8 (phrase);
|
144 |
144 |
index_free_full (search_terms, (IndexFreeFunc) str_unref);
|
145 |
145 |
search_terms = str_list_to_index (folded, " ");
|
|
146 |
|
146 |
147 |
str_unref (folded);
|
147 |
148 |
}
|
148 |
149 |
|
... | ... | |
269 |
270 |
if (! (state->mask & bit))
|
270 |
271 |
continue; /* skip term if it is already found */
|
271 |
272 |
|
272 |
|
if (strstr (item->folded, index_get (search_terms, t)))
|
273 |
|
state->mask &= ~bit; /* we found it */
|
274 |
|
else if (! item->children)
|
|
273 |
if (strstr (item->folded, index_get (search_terms, t))) {
|
|
274 |
if (!gtk_toggle_button_get_active(button_top) ||item->matches->len > 2)
|
|
275 |
state->mask &= ~bit; /* we found it */
|
|
276 |
} else if (! item->children) {
|
275 |
277 |
break; /* quit early if there are no children to search */
|
|
278 |
}
|
276 |
279 |
}
|
277 |
280 |
|
278 |
281 |
if (! state->mask)
|
... | ... | |
707 |
710 |
static void * search_get_widget (void)
|
708 |
711 |
{
|
709 |
712 |
GtkWidget * vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
|
713 |
GtkWidget * hbox_top = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
710 |
714 |
|
711 |
715 |
entry = gtk_entry_new ();
|
712 |
716 |
gtk_entry_set_icon_from_icon_name ((GtkEntry *) entry, GTK_ENTRY_ICON_PRIMARY, "edit-find");
|
713 |
717 |
gtk_entry_set_placeholder_text ((GtkEntry *) entry, _("Search library"));
|
714 |
718 |
g_signal_connect (entry, "destroy", (GCallback) gtk_widget_destroyed, & entry);
|
715 |
|
gtk_box_pack_start ((GtkBox *) vbox, entry, FALSE, FALSE, 0);
|
|
719 |
gtk_box_pack_start ((GtkBox *) hbox_top, entry, FALSE, FALSE, 0);
|
|
720 |
|
|
721 |
button_top = gtk_toggle_button_new_with_mnemonic ("_*");
|
|
722 |
g_signal_connect (button, "toggled", (GCallback) do_search, NULL);
|
|
723 |
|
|
724 |
gtk_box_pack_start ((GtkBox *) hbox_top, button_top, FALSE, FALSE, 0);
|
|
725 |
gtk_box_pack_start ((GtkBox *) vbox, hbox_top, FALSE, FALSE, 0);
|
716 |
726 |
|
717 |
727 |
help_label = gtk_label_new (_("To import your music library into "
|
718 |
728 |
"Audacious, choose a folder and then click the \"refresh\" icon."));
|