summaryrefslogtreecommitdiff
path: root/libdocument
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2017-03-05 18:46:44 +0100
committerraveit65 <[email protected]>2017-03-07 13:34:19 +0100
commit0abc1ee808a7f4bdf94b41f89ad31175d8b00eb9 (patch)
tree72f6aa361d21f604a37516b1b0a72731f297d504 /libdocument
parent0b6c62b75d02a1ba3bd8c073970965b26111785f (diff)
downloadatril-0abc1ee808a7f4bdf94b41f89ad31175d8b00eb9.tar.bz2
atril-0abc1ee808a7f4bdf94b41f89ad31175d8b00eb9.tar.xz
libdocument: Add length and nth methods to EvMappingList
taken from: https://git.gnome.org/browse/evince/commit/?h=gnome-3-8&id=19db23a
Diffstat (limited to 'libdocument')
-rw-r--r--libdocument/ev-mapping-list.c17
-rw-r--r--libdocument/ev-mapping-list.h3
2 files changed, 20 insertions, 0 deletions
diff --git a/libdocument/ev-mapping-list.c b/libdocument/ev-mapping-list.c
index 44628b09..7bae11da 100644
--- a/libdocument/ev-mapping-list.c
+++ b/libdocument/ev-mapping-list.c
@@ -60,6 +60,15 @@ ev_mapping_list_find_custom (EvMappingList *mapping_list,
return NULL;
}
+EvMapping *
+ev_mapping_list_nth (EvMappingList *mapping_list,
+ guint n)
+{
+ g_return_val_if_fail (mapping_list != NULL, NULL);
+
+ return (EvMapping *)g_list_nth_data (mapping_list->list, n);
+}
+
gpointer
ev_mapping_list_get_data (EvMappingList *mapping_list,
gdouble x,
@@ -93,6 +102,14 @@ ev_mapping_list_get_page (EvMappingList *mapping_list)
return mapping_list->page;
}
+guint
+ev_mapping_list_length (EvMappingList *mapping_list)
+{
+ g_return_val_if_fail (mapping_list != NULL, 0);
+
+ return g_list_length (mapping_list->list);
+}
+
EvMappingList *
ev_mapping_list_new (guint page,
GList *list,
diff --git a/libdocument/ev-mapping-list.h b/libdocument/ev-mapping-list.h
index 27104136..2a713b16 100644
--- a/libdocument/ev-mapping-list.h
+++ b/libdocument/ev-mapping-list.h
@@ -47,6 +47,9 @@ EvMapping *ev_mapping_list_find_custom (EvMappingList *mapping_list,
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);
G_END_DECLS