[librsvg] Condense Handle::new() and ::new_with_flags() into one
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Condense Handle::new() and ::new_with_flags() into one
- Date: Tue, 9 Apr 2019 16:44:19 +0000 (UTC)
commit 4269ec6cfb490a7acd436a790ac348f6d274afc2
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Apr 5 09:43:39 2019 -0600
Condense Handle::new() and ::new_with_flags() into one
librsvg_crate/src/lib.rs | 2 +-
rsvg_internals/src/c_api.rs | 2 +-
rsvg_internals/src/handle.rs | 10 ++--------
3 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/librsvg_crate/src/lib.rs b/librsvg_crate/src/lib.rs
index a08a9ab3..d728f49f 100644
--- a/librsvg_crate/src/lib.rs
+++ b/librsvg_crate/src/lib.rs
@@ -278,7 +278,7 @@ impl Loader {
base_file: Option<&gio::File>,
cancellable: P,
) -> Result<SvgHandle, LoadingError> {
- let handle = Handle::new_with_flags(self.load_flags());
+ let handle = Handle::new(self.load_flags());
handle.construct_read_stream_sync(stream, base_file, cancellable.into())?;
Ok(SvgHandle(handle))
diff --git a/rsvg_internals/src/c_api.rs b/rsvg_internals/src/c_api.rs
index 18a37bb3..ece9b5b5 100644
--- a/rsvg_internals/src/c_api.rs
+++ b/rsvg_internals/src/c_api.rs
@@ -273,7 +273,7 @@ impl ObjectSubclass for Handle {
}
fn new() -> Self {
- Handle::new()
+ Handle::new(LoadFlags::default())
}
}
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index d89b1147..52a9e931 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -125,13 +125,13 @@ pub struct Handle {
}
impl Handle {
- pub fn new() -> Handle {
+ pub fn new(load_flags: LoadFlags) -> Handle {
Handle {
dpi: Cell::new(Dpi::default()),
base_url: RefCell::new(None),
base_url_cstring: RefCell::new(None),
svg: RefCell::new(None),
- load_flags: Cell::new(LoadFlags::default()),
+ load_flags: Cell::new(load_flags),
load_state: Cell::new(LoadState::Start),
buffer: RefCell::new(Vec::new()),
size_callback: RefCell::new(SizeCallback::default()),
@@ -140,12 +140,6 @@ impl Handle {
}
}
- pub fn new_with_flags(load_flags: LoadFlags) -> Handle {
- let handle = Handle::new();
- handle.load_flags.set(load_flags);
- handle
- }
-
pub fn set_load_flags(&self, load_flags: LoadFlags) {
self.load_flags.set(load_flags);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]