[evince] libdocument: Add length and nth methods to EvMappingList



commit 19db23aaf53f0c740212d2b764773d91404d8528
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Thu Jan 17 03:42:31 2013 +0100

    libdocument: Add length and nth methods to EvMappingList

 libdocument/ev-mapping-list.c |   17 +++++++++++++++++
 libdocument/ev-mapping-list.h |    3 +++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/libdocument/ev-mapping-list.c b/libdocument/ev-mapping-list.c
index f99b4f9..e8e1cae 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 b207736..46d848a 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
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]