hythmbox-2.98/podcast/rb-podcast-search.c

No issues found

 1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
 2  *
 3  *  Copyright (C) 2010 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-podcast-search.h"
32 
33 static void rb_podcast_search_class_init (RBPodcastSearchClass *klass);
34 static void rb_podcast_search_init (RBPodcastSearch *search);
35 
36 enum {
37 	RESULT,
38 	FINISHED,
39 	LAST_SIGNAL
40 };
41 
42 G_DEFINE_TYPE (RBPodcastSearch, rb_podcast_search, G_TYPE_OBJECT);
43 
44 static guint signals[LAST_SIGNAL];
45 
46 void
47 rb_podcast_search_start (RBPodcastSearch *search, const char *text, int max_results)
48 {
49 	RBPodcastSearchClass *klass = RB_PODCAST_SEARCH_GET_CLASS (search);
50 	klass->start (search, text, max_results);
51 }
52 
53 void
54 rb_podcast_search_cancel (RBPodcastSearch *search)
55 {
56 	RBPodcastSearchClass *klass = RB_PODCAST_SEARCH_GET_CLASS (search);
57 	klass->cancel (search);
58 }
59 
60 void
61 rb_podcast_search_result (RBPodcastSearch *search, RBPodcastChannel *data)
62 {
63 	g_signal_emit (search, signals[RESULT], 0, data);
64 }
65 
66 void
67 rb_podcast_search_finished (RBPodcastSearch *search, gboolean successful)
68 {
69 	g_signal_emit (search, signals[FINISHED], 0, successful);
70 }
71 
72 static void
73 rb_podcast_search_init (RBPodcastSearch *search)
74 {
75 }
76 
77 static void
78 rb_podcast_search_class_init (RBPodcastSearchClass *klass)
79 {
80 	signals[RESULT] = g_signal_new ("result",
81 					RB_TYPE_PODCAST_SEARCH,
82 					G_SIGNAL_RUN_LAST,
83 					0,
84 					NULL, NULL,
85 					g_cclosure_marshal_VOID__POINTER,
86 					G_TYPE_NONE,
87 					1, G_TYPE_POINTER);
88 	signals[FINISHED] = g_signal_new ("finished",
89 					  RB_TYPE_PODCAST_SEARCH,
90 					  G_SIGNAL_RUN_LAST,
91 					  0,
92 					  NULL, NULL,
93 					  g_cclosure_marshal_VOID__BOOLEAN,
94 					  G_TYPE_NONE,
95 					  1, G_TYPE_BOOLEAN);
96 }