summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntia Puentes <[email protected]>2013-09-20 11:14:50 +0200
committerraveit65 <[email protected]>2017-08-28 16:04:00 +0200
commitf03b70d2cd8ea6099af7b24fe2f7c024e9fdd323 (patch)
treec911f5e32eea21e15a7e3ba3fe83da926bacdd8b
parent998dea356a0d26d4654c066af22363d274f35924 (diff)
downloadatril-f03b70d2cd8ea6099af7b24fe2f7c024e9fdd323.tar.bz2
atril-f03b70d2cd8ea6099af7b24fe2f7c024e9fdd323.tar.xz
libdocument: Added ev_mapping_list_get
returns the EvMapping in the EvMappingList at coordinates (x,y). origin commit: https://git.gnome.org/browse/evince/commit/?id=2de7a65
-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);