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.
22 #include <glib-object.h>
23 #include <glib/gi18n.h>
25 #include "mm-attribute-manager.h"
26 #include "mm-attribute-base-manager.h"
27 #include "mm-base-attributes.h"
29 static MMAttributeManager
*base_manager
= NULL
;
31 static void mm_attribute_manager_iface_init (MMAttributeManagerIface
*iface
);
33 G_DEFINE_TYPE_WITH_CODE (MMAttributeBaseManager
, mm_attribute_base_manager
,
35 G_IMPLEMENT_INTERFACE (MM_TYPE_ATTRIBUTE_MANAGER
,
36 mm_attribute_manager_iface_init
));
39 static const char * attribute_ids
[] = {
40 MM_ATTRIBUTE_BASE_URI
,
41 MM_ATTRIBUTE_BASE_NAME
44 static const GType attribute_types
[] = {
49 static const char * attribute_names
[] = {
54 static const char * attribute_descriptions
[] = {
55 N_("URI of the resource"),
56 N_("Name of the resource")
59 /* MMAttributeManager interface implementation */
62 impl_lookup_attribute (MMAttributeManager
*m
,
66 gboolean found
= FALSE
;
68 for (idx
= 0; idx
< G_N_ELEMENTS (attribute_ids
); idx
++) {
69 if (g_strcmp0 (attribute_ids
[idx
], id
) == 0) {
76 return mm_attribute_new (attribute_types
[idx
],
79 attribute_descriptions
[idx
]);
86 impl_get_supported_attributes (MMAttributeManager
*m
)
88 GList
*attributes
= NULL
;
92 for (idx
= 0; idx
< G_N_ELEMENTS (attribute_ids
); idx
++) {
93 attr
= mm_attribute_new (attribute_types
[idx
],
96 attribute_descriptions
[idx
]);
97 attributes
= g_list_prepend (attributes
, attr
);
100 return g_list_reverse (attributes
);
104 mm_attribute_manager_iface_init (MMAttributeManagerIface
*iface
)
106 iface
->lookup_attribute
= impl_lookup_attribute
;
107 iface
->get_supported_attributes
= impl_get_supported_attributes
;
111 mm_attribute_base_manager_get (void)
114 base_manager
= MM_ATTRIBUTE_MANAGER (g_object_new (MM_TYPE_ATTRIBUTE_BASE_MANAGER
, NULL
));
121 mm_attribute_base_manager_init (MMAttributeBaseManager
*abm
)
126 mm_attribute_base_manager_class_init (MMAttributeBaseManagerClass
*klass
)