summaryrefslogtreecommitdiff
path: root/libdocument
diff options
context:
space:
mode:
Diffstat (limited to 'libdocument')
-rw-r--r--libdocument/ev-mapping-list.c36
-rw-r--r--libdocument/ev-mapping-list.h5
2 files changed, 33 insertions, 8 deletions
diff --git a/libdocument/ev-mapping-list.c b/libdocument/ev-mapping-list.c
index 672d5297..8c639e8e 100644
--- a/libdocument/ev-mapping-list.c
+++ b/libdocument/ev-mapping-list.c
@@ -94,17 +94,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;
@@ -115,7 +115,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;
}
}
@@ -123,6 +123,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 ad509674..e4cb5a80 100644
--- a/libdocument/ev-mapping-list.h
+++ b/libdocument/ev-mapping-list.h
@@ -47,9 +47,12 @@ EvMapping *ev_mapping_list_find (EvMappingList *mapping_list,
EvMapping *ev_mapping_list_find_custom (EvMappingList *mapping_list,
gconstpointer data,
GCompareFunc func);
-gpointer ev_mapping_list_get_data (EvMappingList *mapping_list,
+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);
EvMapping *ev_mapping_list_nth (EvMappingList *mapping_list,
guint n);
guint ev_mapping_list_length (EvMappingList *mapping_list);