/* diversity-gypsy-backend - * * Copyright 2008 OpenMoko, Inc. * Authored by Chia-I Wu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include "diversity-gypsy-backend.h" #include "diversity-gypsy.h" static struct { DiversityWorld *world; DiversityGypsy *gypsy; } gypsy; int gypsy_init(DiversityWorld *world, GError **error) { DiversityBard *self; if (!g_thread_supported()) g_thread_init(NULL); gypsy.world = world; g_object_ref(world); self = diversity_world_get_self(world); gypsy.gypsy = diversity_gypsy_new(DIVERSITY_OBJECT(self)); diversity_bard_add_equipment(self, DIVERSITY_EQUIPMENT(gypsy.gypsy)); return TRUE; } void gypsy_fini(void) { if (gypsy.gypsy) { g_object_unref(G_OBJECT(gypsy.gypsy)); gypsy.gypsy = NULL; } if (gypsy.world) { g_object_unref(G_OBJECT(gypsy.world)); gypsy.world = NULL; } }