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 "mm-application.h"
22 #include "mm-so-application.h"
23 #include "mm-manager.h"
24 #include "mm-category-provider.h"
27 #include <glib-object.h>
29 G_DEFINE_TYPE (MMSoApplication
, mm_so_application
, MM_TYPE_APPLICATION
);
32 mm_so_application_get_categories (MMApplication
*a
, GError
**ret_error
)
35 MMCategoryProvider
*cat_provider
;
38 g_return_val_if_fail (a
!= NULL
, NULL
);
39 g_return_val_if_fail (MM_IS_APPLICATION (a
), NULL
);
41 manager
= mm_manager_get ();
42 app_id
= mm_application_get_id (a
);
43 cat_provider
= mm_module_manager_get_category_provider_for_application (mm_manager_get_module_manager (manager
),
46 g_set_error (ret_error
,
48 MM_SO_ERROR_NULL_PROVIDER
,
49 "Unable to get the category provider for application %s",
54 return mm_category_provider_get_categories (cat_provider
, a
);
58 mm_so_application_class_init (MMSoApplicationClass
*klass
)
60 MMApplicationClass
*app_class
= MM_APPLICATION_CLASS (klass
);
62 app_class
->get_categories
= mm_so_application_get_categories
;
66 mm_so_application_init (MMSoApplication
*app
)
74 * mm_so_application_new:
75 * @desktop_id: the desktop file id for the application.
76 * @supported_type: the media type supported by the application.
77 * @id: an unique id identifying the application (e.g. its name).
79 * Builds a new #MMApplication object with the specified properties.
81 * Return value: a #MMApplication object.
85 mm_so_application_new (const char *desktop_id
,
86 MMApplicationType supported_type
,
91 app
= MM_APPLICATION (g_object_new (MM_TYPE_SO_APPLICATION
, NULL
));
92 mm_application_set_attributes (app
, desktop_id
, supported_type
, id
);