/* control-viewport.c * * Copyright 2007-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 "diversity-control.h" static gboolean control_viewport_start(DiversityViewport *view, GError **error); static gboolean control_viewport_stop(DiversityViewport *view, GError **error); static gboolean control_viewport_set_rule(DiversityViewport *view, gint IN_type, gint IN_mask, gint IN_value, GError **error); static gboolean control_viewport_list_objects(DiversityViewport *view, GPtrArray **OUT_objects, GError **error); #include "control-viewport-glue.h" static gboolean control_viewport_start(DiversityViewport *view, GError **error) { diversity_viewport_set_enabled(view, TRUE); return TRUE; } static gboolean control_viewport_stop(DiversityViewport *view, GError **error) { diversity_viewport_set_enabled(view, FALSE); return TRUE; } static gboolean control_viewport_set_rule(DiversityViewport *view, gint IN_type, gint IN_mask, gint IN_value, GError **error) { diversity_viewport_set_rule(view, IN_type, IN_mask, IN_value); return TRUE; } static gboolean control_viewport_list_objects(DiversityViewport *view, GPtrArray **OUT_objects, GError **error) { DiversityControl *ctrl; GPtrArray *array; GSList *objects; guint len; ctrl = diversity_control_from_object(DIVERSITY_OBJECT(view)); objects = (GSList *) diversity_viewport_get_objects(view); len = g_slist_length(objects); array = g_ptr_array_sized_new(len); while (objects) { DiversityControlExport *export; export = diversity_control_object_export(ctrl, objects->data, NULL); g_assert(export); g_ptr_array_add(array, g_strdup(export->path)); objects = objects->next; } *OUT_objects = array; return TRUE; }