[librsvg: 9/30] constructors are no longer prefixed with new_




commit d5cb3300b5000d4db10e72ddad8244a69d76500a
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Thu Jun 10 20:14:59 2021 +0200

    constructors are no longer prefixed with new_
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/516>

 src/api.rs          | 6 +++---
 src/c_api/handle.rs | 9 +++++----
 src/io.rs           | 4 ++--
 3 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/api.rs b/src/api.rs
index b35064f8..3618b853 100644
--- a/src/api.rs
+++ b/src/api.rs
@@ -132,7 +132,7 @@ impl Loader {
     ///     .unwrap();
     /// ```
     pub fn read_path<P: AsRef<Path>>(self, path: P) -> Result<SvgHandle, LoadingError> {
-        let file = gio::File::new_for_path(path);
+        let file = gio::File::for_path(path);
         self.read_file(&file, None::<&Cancellable>)
     }
 
@@ -143,7 +143,7 @@ impl Loader {
     /// # Example:
     /// ```
     /// let svg_handle = librsvg::Loader::new()
-    ///     .read_file(&gio::File::new_for_path("example.svg"), None::<&gio::Cancellable>)
+    ///     .read_file(&gio::File::for_path("example.svg"), None::<&gio::Cancellable>)
     ///     .unwrap();
     /// ```
     pub fn read_file<F: IsA<gio::File>, P: IsA<Cancellable>>(
@@ -172,7 +172,7 @@ impl Loader {
     /// ```
     /// use gio::prelude::*;
     ///
-    /// let file = gio::File::new_for_path("example.svg");
+    /// let file = gio::File::for_path("example.svg");
     ///
     /// let stream = file.read(None::<&gio::Cancellable>).unwrap();
     ///
diff --git a/src/c_api/handle.rs b/src/c_api/handle.rs
index 724cb18c..a613f061 100644
--- a/src/c_api/handle.rs
+++ b/src/c_api/handle.rs
@@ -231,7 +231,7 @@ impl BaseUrl {
     }
 
     fn get_gfile(&self) -> Option<gio::File> {
-        self.get().map(|url| gio::File::new_for_uri(url.as_str()))
+        self.get().map(|url| gio::File::for_uri(url.as_str()))
     }
 
     fn get_ptr(&self) -> *const libc::c_char {
@@ -1089,6 +1089,7 @@ fn get_rust_handle<'a>(handle: *const RsvgHandle) -> &'a CHandle {
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_get_type() -> glib::ffi::GType {
     CHandle::type_().into_glib()
+}
 
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_error_get_type() -> glib::ffi::GType {
@@ -1956,7 +1957,7 @@ pub unsafe extern "C" fn rsvg_cleanup() {}
 ///
 /// `rsvg_handle_new_from_file()` takes a `filename` argument, and advertises
 /// that it will detect either a file system path, or a proper URI.  It will then use
-/// `gio::File::new_for_path()` or `gio::File::new_for_uri()` as appropriate.
+/// `gio::File::for_path()` or `gio::File::for_uri()` as appropriate.
 ///
 /// This enum does the magic heuristics to figure this out.
 ///
@@ -2010,8 +2011,8 @@ impl PathOrUrl {
 
     pub fn get_gfile(&self) -> gio::File {
         match *self {
-            PathOrUrl::Path(ref p) => gio::File::new_for_path(p),
-            PathOrUrl::Url(ref u) => gio::File::new_for_uri(u.as_str()),
+            PathOrUrl::Path(ref p) => gio::File::for_path(p),
+            PathOrUrl::Url(ref u) => gio::File::for_uri(u.as_str()),
         }
     }
 }
diff --git a/src/io.rs b/src/io.rs
index 219ba7ef..a5748aa3 100644
--- a/src/io.rs
+++ b/src/io.rs
@@ -84,7 +84,7 @@ pub fn acquire_stream(
         let stream = MemoryInputStream::from_bytes(&GBytes::from_owned(data));
         Ok(stream.upcast::<InputStream>())
     } else {
-        let file = GFile::new_for_uri(uri);
+        let file = GFile::for_uri(uri);
         let stream = file.read(cancellable)?;
 
         Ok(stream.upcast::<InputStream>())
@@ -101,7 +101,7 @@ pub fn acquire_data(
     if uri.starts_with("data:") {
         Ok(decode_data_uri(uri)?)
     } else {
-        let file = GFile::new_for_uri(uri);
+        let file = GFile::for_uri(uri);
         let (contents, _etag) = file.load_contents(cancellable)?;
 
         let (content_type, _uncertain) = gio::content_type_guess(Some(uri), &contents);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]