Commit 5e351aa7 authored by Christian Persch's avatar Christian Persch

Add rsvg_handle_new_with_flags()

parent 21dce772
...@@ -16,6 +16,7 @@ rsvg_set_default_dpi_x_y ...@@ -16,6 +16,7 @@ rsvg_set_default_dpi_x_y
rsvg_handle_set_dpi rsvg_handle_set_dpi
rsvg_handle_set_dpi_x_y rsvg_handle_set_dpi_x_y
rsvg_handle_new rsvg_handle_new
rsvg_handle_new_with_flags
rsvg_handle_write rsvg_handle_write
rsvg_handle_close rsvg_handle_close
rsvg_handle_get_base_uri rsvg_handle_get_base_uri
......
...@@ -1931,7 +1931,7 @@ rsvg_handle_new_from_stream_sync (GInputStream *stream, ...@@ -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 (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, 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) if (base_file)
rsvg_handle_set_base_gfile (handle, base_file); rsvg_handle_set_base_gfile (handle, base_file);
......
...@@ -39,9 +39,11 @@ ...@@ -39,9 +39,11 @@
#include "rsvg-private.h" #include "rsvg-private.h"
#include "rsvg-defs.h" #include "rsvg-defs.h"
#include "librsvg-enum-types.h"
enum { enum {
PROP_0, PROP_0,
PROP_FLAGS,
PROP_DPI_X, PROP_DPI_X,
PROP_DPI_Y, PROP_DPI_Y,
PROP_BASE_URI, PROP_BASE_URI,
...@@ -65,6 +67,7 @@ instance_init (RsvgHandle * self) ...@@ -65,6 +67,7 @@ instance_init (RsvgHandle * self)
{ {
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, RSVG_TYPE_HANDLE, RsvgHandlePrivate); 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->defs = rsvg_defs_new ();
self->priv->handler_nest = 0; self->priv->handler_nest = 0;
self->priv->entities = g_hash_table_new (g_str_hash, g_str_equal); 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 ...@@ -153,6 +156,9 @@ set_property (GObject * instance, guint prop_id, GValue const *value, GParamSpec
RsvgHandle *self = RSVG_HANDLE (instance); RsvgHandle *self = RSVG_HANDLE (instance);
switch (prop_id) { switch (prop_id) {
case PROP_FLAGS:
self->priv->flags = g_value_get_flags (value);
break;
case PROP_DPI_X: case PROP_DPI_X:
rsvg_handle_set_dpi_x_y (self, g_value_get_double (value), self->priv->dpi_y); rsvg_handle_set_dpi_x_y (self, g_value_get_double (value), self->priv->dpi_y);
break; break;
...@@ -174,6 +180,9 @@ get_property (GObject * instance, guint prop_id, GValue * value, GParamSpec * ps ...@@ -174,6 +180,9 @@ get_property (GObject * instance, guint prop_id, GValue * value, GParamSpec * ps
RsvgDimensionData dim; RsvgDimensionData dim;
switch (prop_id) { switch (prop_id) {
case PROP_FLAGS:
g_value_set_flags (value, self->priv->flags);
break;
case PROP_DPI_X: case PROP_DPI_X:
g_value_set_double (value, self->priv->dpi_x); g_value_set_double (value, self->priv->dpi_x);
break; break;
...@@ -226,6 +235,20 @@ class_init (RsvgHandleClass * klass) ...@@ -226,6 +235,20 @@ class_init (RsvgHandleClass * klass)
gobject_class->set_property = set_property; gobject_class->set_property = set_property;
gobject_class->get_property = get_property; 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: * dpi-x:
*/ */
...@@ -363,3 +386,22 @@ rsvg_handle_new (void) ...@@ -363,3 +386,22 @@ rsvg_handle_new (void)
{ {
return RSVG_HANDLE (g_object_new (RSVG_TYPE_HANDLE, NULL)); 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);
}
...@@ -126,6 +126,8 @@ struct RsvgSaxHandler { ...@@ -126,6 +126,8 @@ struct RsvgSaxHandler {
}; };
struct RsvgHandlePrivate { struct RsvgHandlePrivate {
RsvgHandleFlags flags;
gboolean is_disposed; gboolean is_disposed;
gboolean is_closed; gboolean is_closed;
......
...@@ -143,6 +143,8 @@ typedef enum /*< flags >*/ ...@@ -143,6 +143,8 @@ typedef enum /*< flags >*/
RSVG_HANDLE_FLAGS_NONE = 0 RSVG_HANDLE_FLAGS_NONE = 0
} RsvgHandleFlags; } RsvgHandleFlags;
RsvgHandle *rsvg_handle_new_with_flags (RsvgHandleFlags flags);
void rsvg_handle_set_base_gfile (RsvgHandle *handle, void rsvg_handle_set_base_gfile (RsvgHandle *handle,
GFile *base_file); GFile *base_file);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment