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>
23 #include <libmmanager/mm.h>
25 #include "server-coll.h"
27 static GObjectClass
*server_coll_parent_class
;
28 static GType server_coll_type
= 0;
31 server_coll_get_hits (MMHitCollectionProvider
*p
,
32 MMCategory
*belonging_category
,
35 MMHitCollection
*coll
;
38 MMAttributeManager
*base_manager
;
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
) {
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
);
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
);
63 server_coll_hit_collection_provider_iface_init (MMHitCollectionProviderIface
*iface
)
65 /* implement interface methods */
66 iface
->get_hits
= server_coll_get_hits
;
70 server_coll_instance_init (ServerColl
*coll
)
76 server_coll_class_init (ServerCollClass
*klass
)
78 server_coll_parent_class
= g_type_class_peek_parent (klass
);
82 server_coll_get_type (void)
84 return server_coll_type
;
88 server_coll_register_type (GTypeModule
*module
)
90 static const GTypeInfo info
= {
91 sizeof (ServerCollClass
),
93 (GBaseFinalizeFunc
) NULL
,
94 (GClassInitFunc
) server_coll_class_init
,
99 (GInstanceInitFunc
) server_coll_instance_init
,
102 static const GInterfaceInfo hit_collection_provider_iface_info
= {
103 (GInterfaceInitFunc
) server_coll_hit_collection_provider_iface_init
,
108 server_coll_type
= g_type_module_register_type (module
,
113 g_type_module_add_interface (module
,
115 MM_TYPE_HIT_COLLECTION_PROVIDER
,
116 &hit_collection_provider_iface_info
);