Second round at Gtk-Doc-ifying public methods.
[mmediamanager.git] / src / mm-so-application.c
blobf71dc6fd6c73083fb83ff9864c3b6eb621d5ec6e
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 "mm-error.h"
26 #include <glib.h>
27 #include <glib-object.h>
29 G_DEFINE_TYPE (MMSoApplication, mm_so_application, MM_TYPE_APPLICATION);
31 static GList *
32 mm_so_application_get_categories (MMApplication *a, GError **ret_error)
34 MMManager *manager;
35 MMCategoryProvider *cat_provider;
36 const char *app_id;
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),
44 app_id);
45 if (!cat_provider) {
46 g_set_error (ret_error,
47 MM_SO_ERROR_QUARK,
48 MM_SO_ERROR_NULL_PROVIDER,
49 "Unable to get the category provider for application %s",
50 app_id);
51 return NULL;
54 return mm_category_provider_get_categories (cat_provider, a);
57 static void
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;
65 static void
66 mm_so_application_init (MMSoApplication *app)
68 /* empty */
71 /* public methods */
73 /**
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.
84 MMApplication *
85 mm_so_application_new (const char *desktop_id,
86 MMApplicationType supported_type,
87 const char *id)
89 MMApplication *app;
91 app = MM_APPLICATION (g_object_new (MM_TYPE_SO_APPLICATION, NULL));
92 mm_application_set_attributes (app, desktop_id, supported_type, id);
94 return app;