Skip to content

Commit

Permalink
ev-mapping-list: make a boxed type
Browse files Browse the repository at this point in the history
And fix a number of introspection warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=691354
  • Loading branch information
Cosimo Cecchi committed Jan 28, 2013
1 parent 7917b62 commit d6f7e03
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
46 changes: 46 additions & 0 deletions libdocument/ev-mapping-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ struct _EvMappingList {
volatile gint ref_count;
};

G_DEFINE_BOXED_TYPE (EvMappingList, ev_mapping_list, ev_mapping_list_ref, ev_mapping_list_unref)

/**
* ev_mapping_list_find:
* @mapping_list: an #EvMappingList
* @data: mapping data to find
*
* Returns: (transfer none): an #EvMapping
*/
EvMapping *
ev_mapping_list_find (EvMappingList *mapping_list,
gconstpointer data)
Expand All @@ -43,6 +52,14 @@ ev_mapping_list_find (EvMappingList *mapping_list,
return NULL;
}

/**
* ev_mapping_list_find_custom:
* @mapping_list: an #EvMappingList
* @data: mapping data to find
* @func: (scope call): function to use for equality check
*
* Returns: (transfer none): an #EvMapping
*/
EvMapping *
ev_mapping_list_find_custom (EvMappingList *mapping_list,
gconstpointer data,
Expand All @@ -60,6 +77,13 @@ ev_mapping_list_find_custom (EvMappingList *mapping_list,
return NULL;
}

/**
* ev_mapping_list_nth:
* @mapping_list: an #EvMappingList
* @n: the position to retrieve
*
* Returns: (transfer none): the #Evmapping at position @n in @mapping_list
*/
EvMapping *
ev_mapping_list_nth (EvMappingList *mapping_list,
guint n)
Expand All @@ -69,6 +93,14 @@ ev_mapping_list_nth (EvMappingList *mapping_list,
return (EvMapping *)g_list_nth_data (mapping_list->list, n);
}

/**
* 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,
Expand All @@ -90,6 +122,12 @@ ev_mapping_list_get_data (EvMappingList *mapping_list,
return NULL;
}

/**
* ev_mapping_list_get_list:
* @mapping_list: an #EvMappingList
*
* Returns: (transfer none) (element-type EvMapping): the data for this mapping list
*/
GList *
ev_mapping_list_get_list (EvMappingList *mapping_list)
{
Expand All @@ -110,6 +148,14 @@ ev_mapping_list_length (EvMappingList *mapping_list)
return g_list_length (mapping_list->list);
}

/**
* ev_mapping_list_new:
* @page: page index for this mapping
* @list: (element-type EvMapping): a #GList of data for the page
* @data_destroy_func: function to free a list element
*
* Returns: an #EvMappingList
*/
EvMappingList *
ev_mapping_list_new (guint page,
GList *list,
Expand Down
3 changes: 3 additions & 0 deletions libdocument/ev-mapping-list.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ G_BEGIN_DECLS

typedef struct _EvMappingList EvMappingList;

#define EV_TYPE_MAPPING_LIST (ev_mapping_list_get_type())
GType ev_mapping_list_get_type (void) G_GNUC_CONST;

EvMappingList *ev_mapping_list_new (guint page,
GList *list,
GDestroyNotify data_destroy_func);
Expand Down

0 comments on commit d6f7e03

Please sign in to comment.