Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing proxy setter for WebContext #81

Closed
jangernert opened this issue Jan 9, 2021 · 9 comments
Closed

Missing proxy setter for WebContext #81

jangernert opened this issue Jan 9, 2021 · 9 comments

Comments

@jangernert
Copy link
Contributor

set_network_proxy_settings in the WebContextExt trait as well as the NetworkProxyMode enum seem to be missing. NetworkProxySettings however exist.

@antoyo
Copy link
Contributor

antoyo commented Jan 9, 2021

It seems like it was ignored in the Gir.toml and when NetworkProxySettings stopped being ignored, the function didn't.
I guess that would just need this ignore to be removed to make it work.

@sciguy16
Copy link

Is there anything blocking this being included? Would you like me to open a PR to remove the ignore in Gir.toml and rerun make gir?

@antoyo
Copy link
Contributor

antoyo commented Jun 18, 2021

@sciguy16: I don't know. You can try regenerating the bindings without the ignore to see if it works!

@sciguy16
Copy link

Generating the bindings seemed to work, it generated these changes:

diff --git a/Gir.toml b/Gir.toml
index 8f04cd1..95ff067 100644
--- a/Gir.toml
+++ b/Gir.toml
@@ -255,9 +255,6 @@ module_name = "uri_response"
 name = "WebKit2.WebContext"
 status = "generate"
 generate_builder = true
-    [[object.function]]
-    name = "set_network_proxy_settings"
-    ignore = true

 [[object]]
 name = "WebKit2.WebsiteDataManager"
diff --git a/src/auto/web_context.rs b/src/auto/web_context.rs
index a425476..f4eb54f 100644
--- a/src/auto/web_context.rs
+++ b/src/auto/web_context.rs
@@ -12,6 +12,12 @@ use crate::FaviconDatabase;
 #[cfg(any(feature = "v2_26", feature = "dox"))]
 #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_26")))]
 use crate::GeolocationManager;
+#[cfg(any(feature = "v2_16", feature = "dox"))]
+#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_16")))]
+use crate::NetworkProxyMode;
+#[cfg(any(feature = "v2_16", feature = "dox"))]
+#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_16")))]
+use crate::NetworkProxySettings;
 use crate::Plugin;
 #[cfg(any(feature = "v2_4", feature = "dox"))]
 #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_4")))]
@@ -325,6 +331,15 @@ pub trait WebContextExt: 'static {
     #[doc(alias = "webkit_web_context_set_favicon_database_directory")]
     fn set_favicon_database_directory(&self, path: Option<&str>);

+    #[cfg(any(feature = "v2_16", feature = "dox"))]
+    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_16")))]
+    #[doc(alias = "webkit_web_context_set_network_proxy_settings")]
+    fn set_network_proxy_settings(
+        &self,
+        proxy_mode: NetworkProxyMode,
+        proxy_settings: Option<&mut NetworkProxySettings>,
+    );
+
     #[doc(alias = "webkit_web_context_set_preferred_languages")]
     fn set_preferred_languages(&self, languages: &[&str]);

@@ -767,6 +782,22 @@ impl<O: IsA<WebContext>> WebContextExt for O {
         }
     }

+    #[cfg(any(feature = "v2_16", feature = "dox"))]
+    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_16")))]
+    fn set_network_proxy_settings(
+        &self,
+        proxy_mode: NetworkProxyMode,
+        proxy_settings: Option<&mut NetworkProxySettings>,
+    ) {
+        unsafe {
+            ffi::webkit_web_context_set_network_proxy_settings(
+                self.as_ref().to_glib_none().0,
+                proxy_mode.to_glib(),
+                proxy_settings.to_glib_none_mut().0,
+            );
+        }
+    }
+
     fn set_preferred_languages(&self, languages: &[&str]) {
         unsafe {
             ffi::webkit_web_context_set_preferred_languages(

But a cargo build failed since the Cairo-rs dependency is broken (pending #88)

@ttys3
Copy link

ttys3 commented Jun 25, 2021

I have encountered the dependency problem when tried the master branch, That is a nightmare. Everything failed to compile.

So I have to added the feature my self ttys3@0d78fb0

And this works good for now (in production).

@antoyo
Copy link
Contributor

antoyo commented Jun 25, 2021

@sciguy16 : Can you please open a PR with this patch?

@ttys3
Copy link

ttys3 commented Jun 26, 2021

@sciguy16 : Can you please open a PR with this patch?

done, please review

@antoyo
Copy link
Contributor

antoyo commented Jun 30, 2021

@ttys3 : It seems like it was added manually instead of using the code generator, so I asked here to do it since they do the codegen anyway.

@jangernert
Copy link
Contributor Author

Fixed with 0.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants