[evince] Added ev_mapping_list_get: returns the EvMapping in the EvMappingList at coordinates (x, y).
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] Added ev_mapping_list_get: returns the EvMapping in the EvMappingList at coordinates (x, y).
- Date: Thu, 3 Oct 2013 10:40:08 +0000 (UTC)
commit 2de7a658dd94654d508af50d3b82cc7db5ea80ee
Author: Antia Puentes <apuentes igalia com>
Date: Fri Sep 20 11:14:50 2013 +0200
Added ev_mapping_list_get: returns the EvMapping in the EvMappingList at coordinates (x,y).
libdocument/ev-mapping-list.c | 36 +++++++++++++++++++++++++++++-------
libdocument/ev-mapping-list.h | 3 +++
2 files changed, 32 insertions(+), 7 deletions(-)
---
diff --git a/libdocument/ev-mapping-list.c b/libdocument/ev-mapping-list.c
index f181a61..a7abc40 100644
--- a/libdocument/ev-mapping-list.c
+++ b/libdocument/ev-mapping-list.c
@@ -100,17 +100,17 @@ ev_mapping_list_nth (EvMappingList *mapping_list,
}
/**
- * ev_mapping_list_get_data:
+ * ev_mapping_list_get:
* @mapping_list: an #EvMappingList
* @x: X coordinate
* @y: Y coordinate
*
- * Returns: (transfer none): the data of a mapping in the list at coordinates (x, y)
+ * Returns: (transfer none): the #EvMapping in the list at coordinates (x, y)
*/
-gpointer
-ev_mapping_list_get_data (EvMappingList *mapping_list,
- gdouble x,
- gdouble y)
+EvMapping *
+ev_mapping_list_get (EvMappingList *mapping_list,
+ gdouble x,
+ gdouble y)
{
GList *list;
@@ -121,7 +121,7 @@ ev_mapping_list_get_data (EvMappingList *mapping_list,
(y >= mapping->area.y1) &&
(x <= mapping->area.x2) &&
(y <= mapping->area.y2)) {
- return mapping->data;
+ return mapping;
}
}
@@ -129,6 +129,28 @@ ev_mapping_list_get_data (EvMappingList *mapping_list,
}
/**
+ * ev_mapping_list_get_data:
+ * @mapping_list: an #EvMappingList
+ * @x: X coordinate
+ * @y: Y coordinate
+ *
+ * Returns: (transfer none): the data of a mapping in the list at coordinates (x, y)
+ */
+gpointer
+ev_mapping_list_get_data (EvMappingList *mapping_list,
+ gdouble x,
+ gdouble y)
+{
+ EvMapping *mapping;
+
+ mapping = ev_mapping_list_get (mapping_list, x, y);
+ if (mapping)
+ return mapping->data;
+
+ return NULL;
+}
+
+/**
* ev_mapping_list_get_list:
* @mapping_list: an #EvMappingList
*
diff --git a/libdocument/ev-mapping-list.h b/libdocument/ev-mapping-list.h
index ada6296..4bc3db2 100644
--- a/libdocument/ev-mapping-list.h
+++ b/libdocument/ev-mapping-list.h
@@ -47,6 +47,9 @@ EvMapping *ev_mapping_list_find (EvMappingList *mapping_list,
EvMapping *ev_mapping_list_find_custom (EvMappingList *mapping_list,
gconstpointer data,
GCompareFunc func);
+EvMapping *ev_mapping_list_get (EvMappingList *mapping_list,
+ gdouble x,
+ gdouble y);
gpointer ev_mapping_list_get_data (EvMappingList *mapping_list,
gdouble x,
gdouble y);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]