Split MMApplication into MMSoApplication and a base implementation. This
[mmediamanager.git] / src / mm-so-application.c
blobea3d07de450927bd376cca59925d138bcab42f70
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"
25 #include <glib.h>
26 #include <glib-object.h>
28 G_DEFINE_TYPE (MMSoApplication, mm_so_application, MM_TYPE_APPLICATION);
30 static GList *
31 mm_so_application_get_categories (MMApplication *a)
33 MMManager *manager;
34 MMCategoryProvider *cat_provider;
36 g_return_val_if_fail (a != NULL, NULL);
37 g_return_val_if_fail (MM_IS_APPLICATION (a), NULL);
39 manager = mm_manager_get ();
40 cat_provider = mm_module_manager_get_category_provider_for_application (mm_manager_get_module_manager (manager),
41 mm_application_get_id (a));
42 return mm_category_provider_get_categories (cat_provider, a);
45 static void
46 mm_so_application_class_init (MMSoApplicationClass *klass)
48 MMApplicationClass *app_class = MM_APPLICATION_CLASS (klass);
50 app_class->get_categories = mm_so_application_get_categories;
53 static void
54 mm_so_application_init (MMSoApplication *app)
56 /* empty */
59 /* public methods */
61 MMApplication *
62 mm_so_application_new (const char *desktop_id,
63 MMApplicationType supported_type,
64 const char *id)
66 MMApplication *app;
68 app = MM_APPLICATION (g_object_new (MM_TYPE_SO_APPLICATION, NULL));
69 mm_application_set_attributes (app, desktop_id, supported_type, id);
71 return app;