~ubuntu-branches/ubuntu/maverick/brasero/maverick

« back to all changes in this revision

Viewing changes to src/brasero-search-entry.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2009-11-26 16:20:01 UTC
  • mto: This revision was merged to the branch mainline in revision 58.
  • Revision ID: james.westby@ubuntu.com-20091126162001-5iw2jzxdx8l31okz
Tags: upstream-2.29.2
ImportĀ upstreamĀ versionĀ 2.29.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#  include <config.h>
29
29
#endif
30
30
 
31
 
#ifdef BUILD_SEARCH
32
 
 
33
31
#include <string.h>
34
32
 
35
33
#include <glib.h>
38
36
 
39
37
#include <gtk/gtk.h>
40
38
 
41
 
#include <beagle/beagle.h>
42
 
 
43
39
#include "brasero-search-entry.h"
44
40
#include "brasero-layout.h"
45
41
#include "brasero-setting.h"
621
617
        brasero_search_entry_save_history (entry);
622
618
}
623
619
 
624
 
BeagleQuery *
625
 
brasero_search_entry_get_query (BraseroSearchEntry *entry)
 
620
gboolean
 
621
brasero_search_entry_set_query (BraseroSearchEntry *entry,
 
622
                                BraseroSearchEngine *search)
626
623
{
627
 
        BeagleQuery *query;
628
 
        BeagleQueryPartHuman *text;
629
 
        BeagleQueryPartOr *or_part = NULL;
630
 
 
631
 
        /* Not sure about all this */
632
 
        query = beagle_query_new ();
633
 
 
634
 
        if (strcmp (entry->priv->keywords, _("All files"))) {
635
 
                BeagleQueryPartHuman *text;
636
 
 
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);
641
 
 
642
 
                beagle_query_add_part (query, BEAGLE_QUERY_PART (text));
643
 
        }
644
 
 
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));
648
 
 
649
 
        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->documents))) {
650
 
                BeagleQueryPartProperty *filetype;
651
 
 
652
 
                if (!or_part)
653
 
                        or_part = beagle_query_part_or_new ();
654
 
 
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));
660
 
        }
661
 
 
662
 
        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->pictures))) {
663
 
                BeagleQueryPartProperty *filetype;
664
 
 
665
 
                if (!or_part)
666
 
                        or_part = beagle_query_part_or_new ();
667
 
 
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));
673
 
        }
674
 
 
675
 
        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->music))) {
676
 
                BeagleQueryPartProperty *filetype;
677
 
 
678
 
                if (!or_part)
679
 
                        or_part = beagle_query_part_or_new ();
680
 
 
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));
686
 
        }
687
 
 
688
 
        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->video))) {
689
 
                BeagleQueryPartProperty *filetype;
690
 
 
691
 
                if (!or_part)
692
 
                        or_part = beagle_query_part_or_new ();
693
 
 
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));
699
 
        }
700
 
 
701
 
        if (!or_part)
702
 
                return query;
703
 
 
704
 
        beagle_query_add_part (query, BEAGLE_QUERY_PART (or_part));
705
 
        return query;
 
624
        BraseroSearchScope scope = BRASERO_SEARCH_SCOPE_ANY;
 
625
        const gchar *keywords = NULL;
 
626
 
 
627
        if (strcmp (entry->priv->keywords, _("All files")))
 
628
                keywords = entry->priv->keywords;
 
629
 
 
630
        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->documents)))
 
631
                scope |= BRASERO_SEARCH_SCOPE_DOCUMENTS;
 
632
 
 
633
        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->pictures)))
 
634
                scope |= BRASERO_SEARCH_SCOPE_PICTURES;
 
635
 
 
636
        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->music)))
 
637
                scope |= BRASERO_SEARCH_SCOPE_MUSIC;
 
638
 
 
639
        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (entry->priv->video)))
 
640
                scope |= BRASERO_SEARCH_SCOPE_VIDEO;
 
641
 
 
642
        brasero_search_engine_new_query (search, keywords);
 
643
        brasero_search_engine_set_query_scope (search, scope);
 
644
 
 
645
        return TRUE;
706
646
}
707
647
 
708
648
void
727
667
        }
728
668
}
729
669
 
730
 
#endif /*BUILD_SEARCH*/