Edit data/Makefile.am, Makefile.am and configure.ac to pass make dist.
[mmediamanager.git] / test / server-app / server-coll.c
blobf724dfb381031432608c25a2b8628feea9e420a9
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.h>
25 #include "server-coll.h"
27 static GObjectClass *server_coll_parent_class;
28 static GType server_coll_type = 0;
30 MMHitCollection *
31 server_coll_get_hits (MMHitCollectionProvider *p,
32 MMCategory *belonging_category,
33 MMFilter *f)
35 MMHitCollection *coll;
36 MMHit *hit1;
37 MMAttribute *a;
38 MMAttributeManager *base_manager;
39 GList *l;
41 coll = mm_hit_collection_new ();
42 hit1 = g_object_new (MM_TYPE_HIT, NULL);
44 base_manager = mm_attribute_base_manager_get ();
45 for (l = mm_attribute_manager_get_supported_attributes (base_manager); l; l = l->next) {
46 a = l->data;
47 g_print ("attr supported desc %s\n", mm_attribute_get_description (a));
49 a = mm_attribute_manager_lookup_attribute (base_manager,
50 MM_ATTRIBUTE_BASE_URI);
51 if (a) {
52 GValue *v = g_new0 (GValue, 1);
53 v = g_value_init (v, G_TYPE_STRING);
54 g_value_set_string (v, "file:///home/anarki/foo1");
55 mm_hit_set_value (hit1, a, v);
56 mm_hit_collection_add_hit (coll, hit1);
59 return coll;
62 static void
63 server_coll_hit_collection_provider_iface_init (MMHitCollectionProviderIface *iface)
65 /* implement interface methods */
66 iface->get_hits = server_coll_get_hits;
69 static void
70 server_coll_instance_init (ServerColl *coll)
72 /* do nothing */
75 static void
76 server_coll_class_init (ServerCollClass *klass)
78 server_coll_parent_class = g_type_class_peek_parent (klass);
81 GType
82 server_coll_get_type (void)
84 return server_coll_type;
87 void
88 server_coll_register_type (GTypeModule *module)
90 static const GTypeInfo info = {
91 sizeof (ServerCollClass),
92 (GBaseInitFunc) NULL,
93 (GBaseFinalizeFunc) NULL,
94 (GClassInitFunc) server_coll_class_init,
95 NULL,
96 NULL,
97 sizeof (ServerColl),
99 (GInstanceInitFunc) server_coll_instance_init,
102 static const GInterfaceInfo hit_collection_provider_iface_info = {
103 (GInterfaceInitFunc) server_coll_hit_collection_provider_iface_init,
104 NULL,
105 NULL
108 server_coll_type = g_type_module_register_type (module,
109 G_TYPE_OBJECT,
110 "ServerColl",
111 &info, 0);
113 g_type_module_add_interface (module,
114 server_coll_type,
115 MM_TYPE_HIT_COLLECTION_PROVIDER,
116 &hit_collection_provider_iface_info);