No issues found
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2 *
3 * Copyright (C) 2008 Jonathan Matthew <jonathan@d14n.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * The Rhythmbox authors hereby grant permission for non-GPL compatible
11 * GStreamer plugins to be used and distributed together with GStreamer
12 * and Rhythmbox. This permission is above and beyond the permissions granted
13 * by the GPL license by which Rhythmbox is covered. If you modify this code
14 * you may extend this exception to your version of the code, but you are not
15 * obligated to do so. If you do not wish to do so, delete this exception
16 * statement from your version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26 *
27 */
28
29 #include "config.h"
30
31 #include "rb-iradio-source-search.h"
32
33 static void rb_iradio_source_search_class_init (RBIRadioSourceSearchClass *klass);
34 static void rb_iradio_source_search_init (RBIRadioSourceSearch *search);
35
36 G_DEFINE_DYNAMIC_TYPE (RBIRadioSourceSearch, rb_iradio_source_search, RB_TYPE_SOURCE_SEARCH)
37
38 static RhythmDBQuery *
39 impl_create_query (RBSourceSearch *bsearch, RhythmDB *db, const char *search_text)
40 {
41 return rhythmdb_query_parse (db,
42 RHYTHMDB_QUERY_PROP_LIKE,
43 RHYTHMDB_PROP_GENRE_FOLDED,
44 search_text,
45 RHYTHMDB_QUERY_DISJUNCTION,
46 RHYTHMDB_QUERY_PROP_LIKE,
47 RHYTHMDB_PROP_TITLE_FOLDED,
48 search_text,
49 RHYTHMDB_QUERY_END);
50 }
51
52 static void
53 rb_iradio_source_search_class_init (RBIRadioSourceSearchClass *klass)
54 {
55 RBSourceSearchClass *search_class = RB_SOURCE_SEARCH_CLASS (klass);
56 search_class->create_query = impl_create_query;
57 }
58
59 static void
60 rb_iradio_source_search_class_finalize (RBIRadioSourceSearchClass *klass)
61 {
62 }
63
64 static void
65 rb_iradio_source_search_init (RBIRadioSourceSearch *search)
66 {
67 /* nothing */
68 }
69
70
71 RBSourceSearch *
72 rb_iradio_source_search_new ()
73 {
74 return g_object_new (RB_TYPE_IRADIO_SOURCE_SEARCH, NULL);
75 }
76
77 void
78 _rb_iradio_source_search_register_type (GTypeModule *module)
79 {
80 rb_iradio_source_search_register_type (module);
81 }