First implementation of a "server side" app to test the module
[mmediamanager.git] / test / server / src / server-coll.c
blobfdcaa92e7408063abf24e7514e58bfd00bd125fb
1 /* MManager - a Desktop wide manager for multimedia applications.
3 * Copyright (C) 2008 Cosimo Cecchi <cosimoc@gnome.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
21 #include <glib-object.h>
22 #include <glib.h>
23 #include <libmmanager/mm-hit-collection-provider.h>
24 #include <libmmanager/mm-hit.h>
25 #include <libmmanager/mm-hit-collection.h>
27 #include "server-coll.h"
29 static GObjectClass *server_coll_parent_class;
30 static GType server_coll_type = 0;
32 MMHitCollection *
33 server_coll_get_hits (MMHitCollectionProvider *p,
34 MMCategory *belonging_category,
35 MMFilter *f)
37 MMHitCollection *coll;
38 MMHit *hit1;
39 MMHit *hit2;
41 coll = mm_hit_collection_new ();
42 hit1 = g_object_new (MM_TYPE_HIT,
43 "uri", "file:///home/anarki/foo",
44 "name", "foo",
45 NULL);
46 hit2 = g_object_new (MM_TYPE_HIT,
47 "uri", "file:///home/anarki/bar",
48 "name", "bar",
49 NULL);
50 mm_hit_collection_add_hit (coll, hit1);
51 mm_hit_collection_add_hit (coll, hit2);
53 return coll;
56 static void
57 server_coll_hit_collection_provider_iface_init (MMHitCollectionProviderIface *iface)
59 /* implement interface methods */
60 iface->get_hits = server_coll_get_hits;
63 static void
64 server_coll_instance_init (ServerColl *coll)
66 /* do nothing */
69 static void
70 server_coll_class_init (ServerCollClass *klass)
72 server_coll_parent_class = g_type_class_peek_parent (klass);
75 GType
76 server_coll_get_type (void)
78 return server_coll_type;
81 void
82 server_coll_register_type (GTypeModule *module)
84 static const GTypeInfo info = {
85 sizeof (ServerCollClass),
86 (GBaseInitFunc) NULL,
87 (GBaseFinalizeFunc) NULL,
88 (GClassInitFunc) server_coll_class_init,
89 NULL,
90 NULL,
91 sizeof (ServerColl),
93 (GInstanceInitFunc) server_coll_instance_init,
96 static const GInterfaceInfo hit_collection_provider_iface_info = {
97 (GInterfaceInitFunc) server_coll_hit_collection_provider_iface_init,
98 NULL,
99 NULL
102 server_coll_type = g_type_module_register_type (module,
103 G_TYPE_OBJECT,
104 "ServerColl",
105 &info, 0);
107 g_type_module_add_interface (module,
108 server_coll_type,
109 MM_TYPE_HIT_COLLECTION_PROVIDER,
110 &hit_collection_provider_iface_info);