[lasem] build: fix introspection warnings.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [lasem] build: fix introspection warnings.
- Date: Wed, 13 Jun 2012 12:09:39 +0000 (UTC)
commit 46706e7a874578fc33076945668fbe85e922a77c
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Wed Jun 13 14:07:54 2012 +0200
build: fix introspection warnings.
docs/reference/lasem/lasem-sections.txt | 5 ++-
src/Makefile.am | 4 ++-
src/lsmattributes.c | 23 +++++++++++--
src/lsmattributes.h | 10 ++++-
src/lsmcairo.h | 4 +-
src/lsmdomdocument.c | 42 +++++++++++++++++++++++
src/lsmdomimplementation.c | 17 +++++++---
src/lsmdomimplementation.h | 2 -
src/lsmdomnamednodemap.c | 28 +++++++++++++++
src/lsmdomnamednodemap.h | 2 +-
src/lsmdomnode.c | 56 +++++++++++++++++++++++++++---
src/lsmdomnodelist.c | 7 ++++
src/lsmdomview.h | 2 +-
src/lsmproperties.c | 25 +++++++++++--
src/lsmproperties.h | 7 +++-
src/lsmtraits.c | 1 +
src/lsmtypes.h | 15 +-------
src/lsmutils.c | 54 +++++++++++++++++++++++++++++
src/lsmutils.h | 56 +++++++++++++++++++++++++++++++
19 files changed, 318 insertions(+), 42 deletions(-)
---
diff --git a/docs/reference/lasem/lasem-sections.txt b/docs/reference/lasem/lasem-sections.txt
index 9479ae4..50cd032 100644
--- a/docs/reference/lasem/lasem-sections.txt
+++ b/docs/reference/lasem/lasem-sections.txt
@@ -93,7 +93,6 @@ lsm_dom_named_node_map_get_type
LsmDomDocument
LsmDomDocumentCreateFunction
lsm_dom_implementation_create_document
-lsm_dom_implementation_add_document_create_function
lsm_dom_implementation_cleanup
lsm_dom_document_append_from_memory
lsm_dom_document_new_from_memory
@@ -188,8 +187,12 @@ LSM_IS_DOM_VIEW_CLASS
LSM_DOM_VIEW_GET_CLASS
<SUBSECTION Private>
lsm_dom_view_set_document
+LSM_TYPE_BOX
+LSM_TYPE_EXTENTS
LsmBox
LsmExtents
+lsm_box_get_type
+lsm_extents_get_type
</SECTION>
<SECTION>
diff --git a/src/Makefile.am b/src/Makefile.am
index de94a8d..2f9c4d7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,6 +32,7 @@ LASEM_DOM_SRCS = \
lsm.c \
lsmdebug.c \
lsmstr.c \
+ lsmutils.c \
lsmtraits.c \
lsmproperties.c \
lsmattributes.c \
@@ -131,6 +132,7 @@ LASEM_DOM_HDRS = \
lsmtypes.h \
lsmcairo.h \
lsmstr.h \
+ lsmutils.h \
lsmdebug.h \
lsmtraits.h \
lsmproperties.h \
@@ -285,7 +287,7 @@ introspection_files = $(LASEM_DOM_SRCS) \
Lasem- LASEM_API_VERSION@.gir: $(INTROSPECTION_SCANNER)
Lasem_ LASEM_API_VERSION_U@_gir_INCLUDES = GObject-2.0 cairo-1.0 Gio-2.0 Pango-1.0 GdkPixbuf-2.0
-Lasem_ LASEM_API_VERSION_U@_gir_SCANNERFLAGS = --identifier-prefix=Lsm
+Lasem_ LASEM_API_VERSION_U@_gir_SCANNERFLAGS = --identifier-prefix=Lsm --warn-all
Lasem_ LASEM_API_VERSION_U@_gir_CFLAGS = $(INCLUDES)
Lasem_ LASEM_API_VERSION_U@_gir_LIBS = liblasem- LASEM_API_VERSION@.la
Lasem_ LASEM_API_VERSION_U@_gir_FILES = $(addprefix $(srcdir)/,$(introspection_files))
diff --git a/src/lsmattributes.c b/src/lsmattributes.c
index 50fec7e..d4798ed 100644
--- a/src/lsmattributes.c
+++ b/src/lsmattributes.c
@@ -39,8 +39,12 @@ lsm_attribute_is_defined (const LsmAttribute *attribute)
struct _LsmAttributeManager {
GHashTable * hash_by_name;
+
+ gint ref_count;
};
+G_DEFINE_BOXED_TYPE (LsmAttributeManager, lsm_attribute_manager, lsm_attribute_manager_ref, lsm_attribute_manager_unref)
+
static LsmAttributeManager *
lsm_attribute_manager_create (void)
{
@@ -48,6 +52,7 @@ lsm_attribute_manager_create (void)
manager = g_new0 (LsmAttributeManager, 1);
manager->hash_by_name = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
+ manager->ref_count = 1;
return manager;
}
@@ -104,13 +109,25 @@ lsm_attribute_manager_add_attributes (LsmAttributeManager *manager,
}
+LsmAttributeManager *
+lsm_attribute_manager_ref (LsmAttributeManager *manager)
+{
+ g_return_val_if_fail (manager != NULL, NULL);
+
+ g_atomic_int_inc (&manager->ref_count);
+
+ return manager;
+}
+
void
-lsm_attribute_manager_free (LsmAttributeManager *manager)
+lsm_attribute_manager_unref (LsmAttributeManager *manager)
{
g_return_if_fail (manager != NULL);
- g_hash_table_unref (manager->hash_by_name);
- g_free (manager);
+ if (g_atomic_int_dec_and_test (&manager->ref_count)) {
+ g_hash_table_unref (manager->hash_by_name);
+ g_free (manager);
+ }
}
gboolean
diff --git a/src/lsmattributes.h b/src/lsmattributes.h
index 9aea2f6..e3ea183 100644
--- a/src/lsmattributes.h
+++ b/src/lsmattributes.h
@@ -44,13 +44,19 @@ typedef struct {
typedef struct _LsmAttributeManager LsmAttributeManager;
+#define LSM_TYPE_ATTRIBUTE_MANAGER (lsm_attribute_manager_get_type())
+
+GType lsm_attribute_manager_get_type (void);
+
LsmAttributeManager * lsm_attribute_manager_new (unsigned int n_attributes,
const LsmAttributeInfos *attribute_infos);
-void lsm_attribute_manager_free (LsmAttributeManager *manager);
+LsmAttributeManager * lsm_attribute_manager_duplicate (const LsmAttributeManager *origin);
+LsmAttributeManager * lsm_attribute_manager_ref (LsmAttributeManager *manager);
+void lsm_attribute_manager_unref (LsmAttributeManager *manager);
+
void lsm_attribute_manager_add_attributes (LsmAttributeManager *manager,
unsigned int n_attributes,
const LsmAttributeInfos *attribute_infos);
-LsmAttributeManager * lsm_attribute_manager_duplicate (const LsmAttributeManager *origin);
gboolean lsm_attribute_manager_set_attribute (LsmAttributeManager *manager,
void *instance,
diff --git a/src/lsmcairo.h b/src/lsmcairo.h
index 0b742e9..c39e0f0 100644
--- a/src/lsmcairo.h
+++ b/src/lsmcairo.h
@@ -32,10 +32,10 @@ G_BEGIN_DECLS
typedef struct _LsmFilterSurface LsmFilterSurface;
-GType lsm_filter_surface_get_type (void);
-
#define LSM_TYPE_FILTER_SURFACE (lsm_filter_surface_get_type())
+GType lsm_filter_surface_get_type (void);
+
LsmFilterSurface * lsm_filter_surface_new (const char *name,
unsigned int x0, unsigned int y0,
unsigned int x1, unsigned int y1);
diff --git a/src/lsmdomdocument.c b/src/lsmdomdocument.c
index e340e3d..1baf3e5 100644
--- a/src/lsmdomdocument.c
+++ b/src/lsmdomdocument.c
@@ -52,6 +52,13 @@ lsm_dom_document_get_node_type (LsmDomNode *node)
/* LsmDomDocument implementation */
+
+/**
+ * lsm_dom_document_get_document_element:
+ * @self: a #LsmDomElement
+ * Returns: (transfer none): document element
+ */
+
LsmDomElement *
lsm_dom_document_get_document_element (LsmDomDocument *self)
{
@@ -60,6 +67,13 @@ lsm_dom_document_get_document_element (LsmDomDocument *self)
return LSM_DOM_ELEMENT (lsm_dom_node_get_first_child (LSM_DOM_NODE (self)));
}
+/**
+ * lsm_dom_document_create_element:
+ * @self: a #LsmDomDocument
+ * @tag_name: name of the element to create
+ * Returns: (transfer full): a newly created #LsmDomElement
+ */
+
LsmDomElement *
lsm_dom_document_create_element (LsmDomDocument *document, const char *tag_name)
{
@@ -80,6 +94,13 @@ lsm_dom_document_create_text_node_base (LsmDomDocument *document, const char *da
return LSM_DOM_TEXT (lsm_dom_text_new (data));
}
+/**
+ * lsm_dom_document_create_text_node:
+ * @self: a #LsmDomDocument
+ * @data: content of the text node
+ * Returns: (transfer full): a newly created #LsmDomText
+ */
+
LsmDomText *
lsm_dom_document_create_text_node (LsmDomDocument *document, const char *data)
{
@@ -88,6 +109,12 @@ lsm_dom_document_create_text_node (LsmDomDocument *document, const char *data)
return LSM_DOM_DOCUMENT_GET_CLASS (document)->create_text_node (document, data);
}
+/**
+ * lsm_dom_document_create_view:
+ * @self: a #LsmDomDocument
+ * Returns: (transfer full): a new #LsmDomView
+ */
+
LsmDomView *
lsm_dom_document_create_view (LsmDomDocument *self)
{
@@ -96,6 +123,13 @@ lsm_dom_document_create_view (LsmDomDocument *self)
return LSM_DOM_DOCUMENT_GET_CLASS (self)->create_view (self);
}
+/**
+ * lsm_dom_document_get_element_by_id:
+ * @self: a #LsmDomDocument
+ * @id: id of the element to find
+ * Returns: (transfer none): the requested element, NULL if not found.
+ */
+
LsmDomElement *
lsm_dom_document_get_element_by_id (LsmDomDocument *self, const char *id)
{
@@ -165,6 +199,14 @@ lsm_dom_document_set_url (LsmDomDocument *self, const char *url)
self->url = g_strdup (url);
}
+/**
+ * lsm_dom_document_get_href_data:
+ * @self: a #LsmDomDocument
+ * @href: href
+ * @size: placeholder for the size of the returned data
+ * Returns: (transfer full): a newly allocated buffer containing the requested data.
+ */
+
void *
lsm_dom_document_get_href_data (LsmDomDocument *self, const char *href, gsize *size)
{
diff --git a/src/lsmdomimplementation.c b/src/lsmdomimplementation.c
index 66b2566..0049bb0 100644
--- a/src/lsmdomimplementation.c
+++ b/src/lsmdomimplementation.c
@@ -29,9 +29,9 @@
static GHashTable *document_types = NULL;
-void
-lsm_dom_implementation_add_create_function (const char *qualified_name,
- LsmDomDocumentCreateFunction create_function)
+static void
+lsm_dom_implementation_add_document_create_function (const char *qualified_name,
+ LsmDomDocumentCreateFunction create_function)
{
if (document_types == NULL)
document_types = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
@@ -39,6 +39,13 @@ lsm_dom_implementation_add_create_function (const char *qualified_name,
g_hash_table_insert (document_types, g_strdup (qualified_name), create_function);
}
+/**
+ * lsm_dom_implementation_create_document:
+ * @namespace_uri: namespace uri
+ * @qualified_name: qualified name
+ * Returns: (transfer full): a new #LsmDomDocument
+ */
+
LsmDomDocument *
lsm_dom_implementation_create_document (const char *namespace_uri,
const char *qualified_name)
@@ -48,8 +55,8 @@ lsm_dom_implementation_create_document (const char *namespace_uri,
g_return_val_if_fail (qualified_name != NULL, NULL);
if (document_types == NULL) {
- lsm_dom_implementation_add_create_function ("math", lsm_mathml_document_new);
- lsm_dom_implementation_add_create_function ("svg", lsm_svg_document_new);
+ lsm_dom_implementation_add_document_create_function ("math", lsm_mathml_document_new);
+ lsm_dom_implementation_add_document_create_function ("svg", lsm_svg_document_new);
}
create_function = g_hash_table_lookup (document_types, qualified_name);
diff --git a/src/lsmdomimplementation.h b/src/lsmdomimplementation.h
index 61b6b03..b0b4507 100644
--- a/src/lsmdomimplementation.h
+++ b/src/lsmdomimplementation.h
@@ -33,8 +33,6 @@ typedef LsmDomDocument * (*LsmDomDocumentCreateFunction) (void);
LsmDomDocument * lsm_dom_implementation_create_document (const char *namespace_uri,
const char *qualified_name);
-void lsm_dom_implementation_add_document_create_function (const char *qualified_name,
- LsmDomDocumentCreateFunction create_function);
void lsm_dom_implementation_cleanup (void);
diff --git a/src/lsmdomnamednodemap.c b/src/lsmdomnamednodemap.c
index fd7fd85..b555cab 100644
--- a/src/lsmdomnamednodemap.c
+++ b/src/lsmdomnamednodemap.c
@@ -26,6 +26,13 @@
/* LsmDomNamedNodeMap implementation */
+/**
+ * lsm_dom_named_node_map_get_named_item:
+ * @map: a #LsmDomNamedNodeMap
+ * @name: name of the requested item
+ * Returns: (transfer none): The corresponding node, NULL if not found.
+ */
+
LsmDomNode *
lsm_dom_named_node_map_get_named_item (LsmDomNamedNodeMap *map, const char *name)
{
@@ -34,6 +41,13 @@ lsm_dom_named_node_map_get_named_item (LsmDomNamedNodeMap *map, const char *name
return LSM_DOM_NAMED_NODE_MAP_GET_CLASS (map)->get (map, name);
}
+/**
+ * lsm_dom_named_node_map_set_named_item:
+ * @map: a #LsmDomNamedNodeMap
+ * @node: a #LsmDomNode
+ * Returns: (transfer none): same as @node, NULL on error.
+ */
+
LsmDomNode *
lsm_dom_named_node_map_set_named_item (LsmDomNamedNodeMap *map, LsmDomNode *node)
{
@@ -42,6 +56,13 @@ lsm_dom_named_node_map_set_named_item (LsmDomNamedNodeMap *map, LsmDomNode *node
return LSM_DOM_NAMED_NODE_MAP_GET_CLASS (map)->set (map, node);
}
+/**
+ * lsm_dom_named_node_map_remove_named_item:
+ * @map: a #LsmDomNamedNodeMap
+ * @name: name of the item to remove
+ * Returns: (transfer full): removed node, NULL on error.
+ */
+
LsmDomNode *
lsm_dom_named_node_map_remove_named_item (LsmDomNamedNodeMap *map, const char *name)
{
@@ -50,6 +71,13 @@ lsm_dom_named_node_map_remove_named_item (LsmDomNamedNodeMap *map, const char *n
return LSM_DOM_NAMED_NODE_MAP_GET_CLASS (map)->remove (map, name);
}
+/**
+ * lsm_dom_named_node_map_get_item:
+ * @map: a #LsmDomNamedNodeMap
+ * @index: item index
+ * Returns: (transfer none): The node corresponding to @index, NULL on error.
+ */
+
LsmDomNode *
lsm_dom_named_node_map_get_item (LsmDomNamedNodeMap *map, unsigned int index)
{
diff --git a/src/lsmdomnamednodemap.h b/src/lsmdomnamednodemap.h
index 2821089..2c9c6d4 100644
--- a/src/lsmdomnamednodemap.h
+++ b/src/lsmdomnamednodemap.h
@@ -54,7 +54,7 @@ struct _LsmDomNamedNodeMapClass {
GType lsm_dom_named_node_map_get_type (void);
LsmDomNode * lsm_dom_named_node_map_get_named_item (LsmDomNamedNodeMap *map, const char *name);
-LsmDomNode * lsm_dom_named_node_map_set_named_item (LsmDomNamedNodeMap *map, LsmDomNode *item);
+LsmDomNode * lsm_dom_named_node_map_set_named_item (LsmDomNamedNodeMap *map, LsmDomNode *node);
LsmDomNode * lsm_dom_named_node_map_remove_named_item (LsmDomNamedNodeMap *map, const char *name);
LsmDomNode * lsm_dom_named_node_map_get_item (LsmDomNamedNodeMap *map, unsigned int index);
unsigned int lsm_dom_named_node_map_get_length (LsmDomNamedNodeMap *map);
diff --git a/src/lsmdomnode.c b/src/lsmdomnode.c
index 933aa57..758d670 100644
--- a/src/lsmdomnode.c
+++ b/src/lsmdomnode.c
@@ -222,6 +222,12 @@ LsmDomNodeType lsm_dom_node_get_node_type (LsmDomNode* self)
return 0;
}
+/**
+ * lsm_dom_node_get_parent_node:
+ * @self: a #LsmDomNode
+ * Returns: (transfer none): node parent
+ */
+
LsmDomNode*
lsm_dom_node_get_parent_node (LsmDomNode* self)
{
@@ -230,6 +236,12 @@ lsm_dom_node_get_parent_node (LsmDomNode* self)
return self->parent_node;
}
+/**
+ * lsm_dom_node_get_child_nodes:
+ * @self: a #LsmDomNode
+ * Returns: (transfer none): node child list
+ */
+
LsmDomNodeList*
lsm_dom_node_get_child_nodes (LsmDomNode* self)
{
@@ -247,6 +259,12 @@ lsm_dom_node_get_child_nodes (LsmDomNode* self)
return list;
}
+/**
+ * lsm_dom_node_get_first_child:
+ * @self: a #LsmDomNode
+ * Returns: (transfer none): node first child
+ */
+
LsmDomNode*
lsm_dom_node_get_first_child (LsmDomNode* self)
{
@@ -255,6 +273,12 @@ lsm_dom_node_get_first_child (LsmDomNode* self)
return self->first_child;
}
+/**
+ * lsm_dom_node_get_last_child:
+ * @self: a #LsmDomNode
+ * Returns: (transfer none): node last child
+ */
+
LsmDomNode*
lsm_dom_node_get_last_child (LsmDomNode* self)
{
@@ -263,6 +287,12 @@ lsm_dom_node_get_last_child (LsmDomNode* self)
return self->last_child;
}
+/**
+ * lsm_dom_node_get_previous_sibling:
+ * @self: a #LsmDomNode
+ * Returns: (transfer none): node previous sibling
+ */
+
LsmDomNode*
lsm_dom_node_get_previous_sibling (LsmDomNode* self)
{
@@ -271,6 +301,12 @@ lsm_dom_node_get_previous_sibling (LsmDomNode* self)
return self->previous_sibling;
}
+/**
+ * lsm_dom_node_get_next_sibling:
+ * @self: a #LsmDomNode
+ * Returns: (transfer none): node next sibling
+ */
+
LsmDomNode*
lsm_dom_node_get_next_sibling (LsmDomNode* self)
{
@@ -279,13 +315,21 @@ lsm_dom_node_get_next_sibling (LsmDomNode* self)
return self->next_sibling;
}
-/*LsmDomNamedNodeMap**/
-/*lsm_dom_node_get_attributes (LsmDomNode* self)*/
-/*{*/
-/* return LSM_DOM_NODE_GET_CLASS (self)->get_attributes (self);*/
-/*}*/
+#if 0
+LsmDomNamedNodeMap*
+lsm_dom_node_get_attributes (LsmDomNode* self)
+{
+ return LSM_DOM_NODE_GET_CLASS (self)->get_attributes (self);
+}
+#endif
+
+/**
+ * lsm_dom_node_get_owner_document:
+ * @self: a #LsmDomNode
+ * Returns: (transfer none): node owner document
+ */
-LsmDomDocument*
+LsmDomDocument *
lsm_dom_node_get_owner_document (LsmDomNode* self)
{
LsmDomNode *parent;
diff --git a/src/lsmdomnodelist.c b/src/lsmdomnodelist.c
index e896c91..19cd2bd 100644
--- a/src/lsmdomnodelist.c
+++ b/src/lsmdomnodelist.c
@@ -26,6 +26,13 @@
/* LsmDomNodeList implementation */
+/**
+ * lsm_dom_node_list_get_item:
+ * @list: a #LsmDomNodeList
+ * @index: id of the item to retrieve
+ * Returns: (transfer none): the node corresponding to index, NULL on error.
+ */
+
LsmDomNode *
lsm_dom_node_list_get_item (LsmDomNodeList *list, unsigned int index)
{
diff --git a/src/lsmdomview.h b/src/lsmdomview.h
index e93d047..40ac451 100644
--- a/src/lsmdomview.h
+++ b/src/lsmdomview.h
@@ -25,7 +25,7 @@
#define LSM_DOM_VIEW_H
#include <lsmdomtypes.h>
-#include <lsmtypes.h>
+#include <lsmutils.h>
#include <cairo.h>
#include <pango/pangocairo.h>
diff --git a/src/lsmproperties.c b/src/lsmproperties.c
index 6f4082a..45616e9 100644
--- a/src/lsmproperties.c
+++ b/src/lsmproperties.c
@@ -37,8 +37,12 @@ struct _LsmPropertyManager {
/* FIXME: Not thread safe */
unsigned int * property_check;
unsigned int property_check_count;
+
+ gint ref_count;
};
+G_DEFINE_BOXED_TYPE (LsmPropertyManager, lsm_property_manager, lsm_property_manager_ref, lsm_property_manager_unref)
+
LsmPropertyManager *
lsm_property_manager_new (unsigned int n_properties, const LsmPropertyInfos *property_infos)
{
@@ -54,6 +58,7 @@ lsm_property_manager_new (unsigned int n_properties, const LsmPropertyInfos *pro
manager->property_infos = property_infos;
manager->property_check_count = 0;
manager->property_check = g_new0 (unsigned int, n_properties);
+ manager->ref_count = 1;
for (i = 0; i < n_properties; i++) {
@@ -68,14 +73,26 @@ lsm_property_manager_new (unsigned int n_properties, const LsmPropertyInfos *pro
return manager;
}
+LsmPropertyManager *
+lsm_property_manager_ref (LsmPropertyManager *manager)
+{
+ g_return_val_if_fail (manager != NULL, NULL);
+
+ g_atomic_int_inc (&manager->ref_count);
+
+ return manager;
+}
+
void
-lsm_property_manager_free (LsmPropertyManager *manager)
+lsm_property_manager_unref (LsmPropertyManager *manager)
{
g_return_if_fail (manager != NULL);
- g_hash_table_unref (manager->hash_by_name);
- g_free (manager->property_check);
- g_free (manager);
+ if (g_atomic_int_dec_and_test (&manager->ref_count)) {
+ g_hash_table_unref (manager->hash_by_name);
+ g_free (manager->property_check);
+ g_free (manager);
+ }
}
static void
diff --git a/src/lsmproperties.h b/src/lsmproperties.h
index a9fa6fa..84c0325 100644
--- a/src/lsmproperties.h
+++ b/src/lsmproperties.h
@@ -51,9 +51,14 @@ typedef struct {
typedef struct _LsmPropertyManager LsmPropertyManager;
+#define LSM_TYPE_PROPERTY_MANAGER (lsm_property_manager_get_type())
+
+GType lsm_property_manager_get_type (void);
+
LsmPropertyManager * lsm_property_manager_new (unsigned int n_properties,
const LsmPropertyInfos *property_infos);
-void lsm_property_manager_free (LsmPropertyManager *manager);
+LsmPropertyManager * lsm_property_manager_ref (LsmPropertyManager *manager);
+void lsm_property_manager_unref (LsmPropertyManager *manager);
gboolean lsm_property_manager_set_property (LsmPropertyManager *manager,
LsmPropertyBag *property_bag,
diff --git a/src/lsmtraits.c b/src/lsmtraits.c
index facae1d..de37e3d 100644
--- a/src/lsmtraits.c
+++ b/src/lsmtraits.c
@@ -22,6 +22,7 @@
*/
#include <lsmtraits.h>
+#include <lsmutils.h>
#include <lsmstr.h>
#include <string.h>
diff --git a/src/lsmtypes.h b/src/lsmtypes.h
index c7ac69d..655e420 100644
--- a/src/lsmtypes.h
+++ b/src/lsmtypes.h
@@ -28,19 +28,8 @@
G_BEGIN_DECLS
-typedef struct {
- double x1;
- double y1;
- double x2;
- double y2;
-} LsmExtents;
-
-typedef struct {
- double x;
- double y;
- double width;
- double height;
-} LsmBox;
+typedef struct _LsmExtents LsmExtents;
+typedef struct _LsmBox LsmBox;
G_END_DECLS
diff --git a/src/lsmutils.c b/src/lsmutils.c
new file mode 100644
index 0000000..8d03a9c
--- /dev/null
+++ b/src/lsmutils.c
@@ -0,0 +1,54 @@
+/* Lasem
+ *
+ * Copyright  2007-2012 Emmanuel Pacaud
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author:
+ * Emmanuel Pacaud <emmanuel gnome org>
+ */
+
+#include <lsmutils.h>
+
+LsmExtents *
+lsm_extents_duplicate (const LsmExtents *from)
+{
+ LsmExtents *extents;
+
+ g_return_val_if_fail (from != NULL, NULL);
+
+ extents = g_new (LsmExtents, 1);
+ *extents = *from;
+
+ return extents;
+}
+
+G_DEFINE_BOXED_TYPE (LsmExtents, lsm_extents, lsm_extents_duplicate, g_free)
+
+LsmBox *
+lsm_box_duplicate (const LsmBox *from)
+{
+ LsmBox *box;
+
+ g_return_val_if_fail (from != NULL, NULL);
+
+ box = g_new (LsmBox, 1);
+ *box = *from;
+
+ return box;
+}
+
+G_DEFINE_BOXED_TYPE (LsmBox, lsm_box, lsm_box_duplicate, g_free)
diff --git a/src/lsmutils.h b/src/lsmutils.h
new file mode 100644
index 0000000..8930b8b
--- /dev/null
+++ b/src/lsmutils.h
@@ -0,0 +1,56 @@
+/* Lasem
+ *
+ * Copyright  2007-2012 Emmanuel Pacaud
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author:
+ * Emmanuel Pacaud <emmanuel gnome org>
+ */
+
+#ifndef LSM_UTILS_H
+#define LSM_UTILS_H
+
+#include <lsmtypes.h>
+
+G_BEGIN_DECLS
+
+struct _LsmExtents {
+ double x1;
+ double y1;
+ double x2;
+ double y2;
+};
+
+#define LSM_TYPE_EXTENTS (lsm_extents_get_type())
+
+GType lsm_extents_get_type (void);
+
+struct _LsmBox {
+ double x;
+ double y;
+ double width;
+ double height;
+};
+
+#define LSM_TYPE_BOX (lsm_box_get_type())
+
+GType lsm_box_get_type (void);
+
+G_END_DECLS
+
+#endif
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]