[librsvg] Add rsvg_handle_new_with_flags()
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Add rsvg_handle_new_with_flags()
- Date: Mon, 7 Nov 2011 19:28:52 +0000 (UTC)
commit 5e351aa7b2faca0075990e49161e558214472ac4
Author: Christian Persch <chpe gnome org>
Date: Mon Nov 7 16:03:08 2011 +0100
Add rsvg_handle_new_with_flags()
doc/rsvg-sections.txt | 1 +
rsvg-base.c | 2 +-
rsvg-gobject.c | 42 ++++++++++++++++++++++++++++++++++++++++++
rsvg-private.h | 2 ++
rsvg.h | 2 ++
5 files changed, 48 insertions(+), 1 deletions(-)
---
diff --git a/doc/rsvg-sections.txt b/doc/rsvg-sections.txt
index 59fadde..684dc64 100644
--- a/doc/rsvg-sections.txt
+++ b/doc/rsvg-sections.txt
@@ -16,6 +16,7 @@ rsvg_set_default_dpi_x_y
rsvg_handle_set_dpi
rsvg_handle_set_dpi_x_y
rsvg_handle_new
+rsvg_handle_new_with_flags
rsvg_handle_write
rsvg_handle_close
rsvg_handle_get_base_uri
diff --git a/rsvg-base.c b/rsvg-base.c
index 7cab26b..7d353dd 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -1931,7 +1931,7 @@ rsvg_handle_new_from_stream_sync (GInputStream *stream,
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
- handle = rsvg_handle_new ();
+ handle = rsvg_handle_new_with_flags (flags);
if (base_file)
rsvg_handle_set_base_gfile (handle, base_file);
diff --git a/rsvg-gobject.c b/rsvg-gobject.c
index 61d85b0..36df226 100644
--- a/rsvg-gobject.c
+++ b/rsvg-gobject.c
@@ -39,9 +39,11 @@
#include "rsvg-private.h"
#include "rsvg-defs.h"
+#include "librsvg-enum-types.h"
enum {
PROP_0,
+ PROP_FLAGS,
PROP_DPI_X,
PROP_DPI_Y,
PROP_BASE_URI,
@@ -65,6 +67,7 @@ instance_init (RsvgHandle * self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, RSVG_TYPE_HANDLE, RsvgHandlePrivate);
+ self->priv->flags = RSVG_HANDLE_FLAGS_NONE;
self->priv->defs = rsvg_defs_new ();
self->priv->handler_nest = 0;
self->priv->entities = g_hash_table_new (g_str_hash, g_str_equal);
@@ -153,6 +156,9 @@ set_property (GObject * instance, guint prop_id, GValue const *value, GParamSpec
RsvgHandle *self = RSVG_HANDLE (instance);
switch (prop_id) {
+ case PROP_FLAGS:
+ self->priv->flags = g_value_get_flags (value);
+ break;
case PROP_DPI_X:
rsvg_handle_set_dpi_x_y (self, g_value_get_double (value), self->priv->dpi_y);
break;
@@ -174,6 +180,9 @@ get_property (GObject * instance, guint prop_id, GValue * value, GParamSpec * ps
RsvgDimensionData dim;
switch (prop_id) {
+ case PROP_FLAGS:
+ g_value_set_flags (value, self->priv->flags);
+ break;
case PROP_DPI_X:
g_value_set_double (value, self->priv->dpi_x);
break;
@@ -227,6 +236,20 @@ class_init (RsvgHandleClass * klass)
gobject_class->get_property = get_property;
/**
+ * RsvgHandle:flags:
+ *
+ * Flags from #RsvgHandleFlags.
+ *
+ * Since: 2.36
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_FLAGS,
+ g_param_spec_flags ("flags", NULL, NULL,
+ RSVG_TYPE_HANDLE_FLAGS,
+ RSVG_HANDLE_FLAGS_NONE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ /**
* dpi-x:
*/
g_object_class_install_property (gobject_class,
@@ -363,3 +386,22 @@ rsvg_handle_new (void)
{
return RSVG_HANDLE (g_object_new (RSVG_TYPE_HANDLE, NULL));
}
+
+
+/**
+ * rsvg_handle_new_with_flags:
+ * @flags: flags from #RsvgHandleFlags
+ *
+ * Creates a new #RsvgHandle with flags @flags.
+ *
+ * Returns: (transfer full): a new #RsvgHandle
+ *
+ * Since: 2.36
+ **/
+RsvgHandle *
+rsvg_handle_new_with_flags (RsvgHandleFlags flags)
+{
+ return g_object_new (RSVG_TYPE_HANDLE,
+ "flags", flags,
+ NULL);
+}
diff --git a/rsvg-private.h b/rsvg-private.h
index 5efe904..39bf0af 100644
--- a/rsvg-private.h
+++ b/rsvg-private.h
@@ -126,6 +126,8 @@ struct RsvgSaxHandler {
};
struct RsvgHandlePrivate {
+ RsvgHandleFlags flags;
+
gboolean is_disposed;
gboolean is_closed;
diff --git a/rsvg.h b/rsvg.h
index ee28db3..746d4af 100644
--- a/rsvg.h
+++ b/rsvg.h
@@ -143,6 +143,8 @@ typedef enum /*< flags >*/
RSVG_HANDLE_FLAGS_NONE = 0
} RsvgHandleFlags;
+RsvgHandle *rsvg_handle_new_with_flags (RsvgHandleFlags flags);
+
void rsvg_handle_set_base_gfile (RsvgHandle *handle,
GFile *base_file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]