/* diversity-phonekit-backend.c - * * 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 #include #include static struct { DiversityWorld *world; DiversityPhoneKit *pk; } phonekit; int phonekit_init(DiversityWorld *world, GError **error) { DiversityBard *self; if (!g_thread_supported()) { g_thread_init(NULL); dbus_g_thread_init(); } phonekit.world = world; g_object_ref(world); phonekit.pk = diversity_phone_kit_new("phonekit", error); if (!phonekit.pk) { phonekit_fini(); return FALSE; } self = diversity_world_get_self(phonekit.world); diversity_bard_add_equipment(self, DIVERSITY_EQUIPMENT(phonekit.pk)); return TRUE; } void phonekit_fini(void) { if (phonekit.world) { g_object_unref(G_OBJECT(phonekit.world)); phonekit.world = NULL; } if (phonekit.pk) { g_object_unref(phonekit.pk); phonekit.pk = NULL; } }