First implementation of a "server side" app to test the module
[mmediamanager.git] / test / server / src / server-cat.c
blob7243acb467c04cce2d930d01eb66ed09936c1487
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>
22 #include <glib.h>
23 #include <libmmanager/mm-category-provider.h>
24 #include <libmmanager/mm-category.h>
25 #include <libmmanager/mm-application.h>
27 #include "server-cat.h"
29 static GObjectClass *server_cat_parent_class;
30 static GType server_cat_type = 0;
32 GList *
33 server_cat_get_categories (MMCategoryProvider *p,
34 MMApplication *app)
36 GList *list = NULL;
37 MMCategory *cat1, *cat2;
39 cat1 = mm_category_new (app, "Cat1", NULL);
40 cat2 = mm_category_new (app, "Cat2", NULL);
42 list = g_list_prepend (list, cat2);
43 list = g_list_prepend (list, cat1);
45 return list;
48 static void
49 server_cat_category_provider_iface_init (MMCategoryProviderIface *iface)
51 /* implement interface methods */
52 iface->get_categories = server_cat_get_categories;
55 static void
56 server_cat_instance_init (ServerCat *cat)
58 /* do nothing */
61 static void
62 server_cat_class_init (ServerCatClass *klass)
64 server_cat_parent_class = g_type_class_peek_parent (klass);
67 GType
68 server_cat_get_type (void)
70 return server_cat_type;
73 void
74 server_cat_register_type (GTypeModule *module)
76 static const GTypeInfo info = {
77 sizeof (ServerCatClass),
78 (GBaseInitFunc) NULL,
79 (GBaseFinalizeFunc) NULL,
80 (GClassInitFunc) server_cat_class_init,
81 NULL,
82 NULL,
83 sizeof (ServerCat),
85 (GInstanceInitFunc) server_cat_instance_init,
88 static const GInterfaceInfo category_provider_iface_info = {
89 (GInterfaceInitFunc) server_cat_category_provider_iface_init,
90 NULL,
91 NULL
94 server_cat_type = g_type_module_register_type (module,
95 G_TYPE_OBJECT,
96 "ServerCat",
97 &info, 0);
99 g_type_module_add_interface (module,
100 server_cat_type,
101 MM_TYPE_CATEGORY_PROVIDER,
102 &category_provider_iface_info);