2 * this file is part of evince, a gnome document viewer
4 * Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
6 * Evince is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * Evince is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "ev-mapping.h"
24 ev_mapping_list_find (GList *mapping_list,
29 for (list = mapping_list; list; list = list->next) {
30 EvMapping *mapping = list->data;
32 if (mapping->data == data)
40 ev_mapping_list_find_custom (GList *mapping_list,
46 for (list = mapping_list; list; list = list->next) {
47 EvMapping *mapping = list->data;
49 if (!func (mapping->data, data))
57 ev_mapping_list_get_data (GList *mapping_list,
63 for (list = mapping_list; list; list = list->next) {
64 EvMapping *mapping = list->data;
66 if ((x >= mapping->area.x1) &&
67 (y >= mapping->area.y1) &&
68 (x <= mapping->area.x2) &&
69 (y <= mapping->area.y2)) {
78 mapping_list_free_foreach (EvMapping *mapping,
79 GDestroyNotify destroy_func)
81 destroy_func (mapping->data);
86 ev_mapping_list_free (GList *mapping_list,
87 GDestroyNotify destroy_func)
89 g_list_foreach (mapping_list,
90 (GFunc)mapping_list_free_foreach,
92 g_list_free (mapping_list);