621
617
brasero_search_entry_save_history (entry);
625
brasero_search_entry_get_query (BraseroSearchEntry *entry)
621
brasero_search_entry_set_query (BraseroSearchEntry *entry,
622
BraseroSearchEngine *search)
628
BeagleQueryPartHuman *text;
629
BeagleQueryPartOr *or_part = NULL;
631
/* Not sure about all this */
632
query = beagle_query_new ();
634
if (strcmp (entry->priv->keywords, _("All files"))) {
635
BeagleQueryPartHuman *text;
637
text = beagle_query_part_human_new ();
638
beagle_query_part_human_set_string (text, entry->priv->keywords);
639
beagle_query_part_set_logic (BEAGLE_QUERY_PART (text),
640
BEAGLE_QUERY_PART_LOGIC_REQUIRED);
642
beagle_query_add_part (query, BEAGLE_QUERY_PART (text));
645
text = beagle_query_part_human_new ();
646
beagle_query_part_human_set_string (text, "type:File");
647
beagle_query_add_part (query, BEAGLE_QUERY_PART (text));
649
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->documents))) {
650
BeagleQueryPartProperty *filetype;
653
or_part = beagle_query_part_or_new ();
655
filetype = beagle_query_part_property_new ();
656
beagle_query_part_property_set_property_type (filetype, BEAGLE_PROPERTY_TYPE_KEYWORD);
657
beagle_query_part_property_set_key (filetype, "beagle:FileType");
658
beagle_query_part_property_set_value (filetype, "document");
659
beagle_query_part_or_add_subpart (or_part, BEAGLE_QUERY_PART (filetype));
662
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->pictures))) {
663
BeagleQueryPartProperty *filetype;
666
or_part = beagle_query_part_or_new ();
668
filetype = beagle_query_part_property_new ();
669
beagle_query_part_property_set_property_type (filetype, BEAGLE_PROPERTY_TYPE_KEYWORD);
670
beagle_query_part_property_set_key (filetype, "beagle:FileType");
671
beagle_query_part_property_set_value (filetype, "image");
672
beagle_query_part_or_add_subpart (or_part, BEAGLE_QUERY_PART (filetype));
675
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->music))) {
676
BeagleQueryPartProperty *filetype;
679
or_part = beagle_query_part_or_new ();
681
filetype = beagle_query_part_property_new ();
682
beagle_query_part_property_set_property_type (filetype, BEAGLE_PROPERTY_TYPE_KEYWORD);
683
beagle_query_part_property_set_key (filetype, "beagle:FileType");
684
beagle_query_part_property_set_value (filetype, "audio");
685
beagle_query_part_or_add_subpart (or_part, BEAGLE_QUERY_PART (filetype));
688
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->video))) {
689
BeagleQueryPartProperty *filetype;
692
or_part = beagle_query_part_or_new ();
694
filetype = beagle_query_part_property_new ();
695
beagle_query_part_property_set_property_type (filetype, BEAGLE_PROPERTY_TYPE_KEYWORD);
696
beagle_query_part_property_set_key (filetype, "beagle:FileType");
697
beagle_query_part_property_set_value (filetype, "video");
698
beagle_query_part_or_add_subpart (or_part, BEAGLE_QUERY_PART (filetype));
704
beagle_query_add_part (query, BEAGLE_QUERY_PART (or_part));
624
BraseroSearchScope scope = BRASERO_SEARCH_SCOPE_ANY;
625
const gchar *keywords = NULL;
627
if (strcmp (entry->priv->keywords, _("All files")))
628
keywords = entry->priv->keywords;
630
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->documents)))
631
scope |= BRASERO_SEARCH_SCOPE_DOCUMENTS;
633
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->pictures)))
634
scope |= BRASERO_SEARCH_SCOPE_PICTURES;
636
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->music)))
637
scope |= BRASERO_SEARCH_SCOPE_MUSIC;
639
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->video)))
640
scope |= BRASERO_SEARCH_SCOPE_VIDEO;
642
brasero_search_engine_new_query (search, keywords);
643
brasero_search_engine_set_query_scope (search, scope);