1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gio.SimpleProxyResolver; 26 27 private import gio.ProxyResolverIF; 28 private import gio.ProxyResolverT; 29 private import gio.c.functions; 30 public import gio.c.types; 31 private import glib.ConstructionException; 32 private import glib.Str; 33 private import gobject.ObjectG; 34 35 36 /** 37 * #GSimpleProxyResolver is a simple #GProxyResolver implementation 38 * that handles a single default proxy, multiple URI-scheme-specific 39 * proxies, and a list of hosts that proxies should not be used for. 40 * 41 * #GSimpleProxyResolver is never the default proxy resolver, but it 42 * can be used as the base class for another proxy resolver 43 * implementation, or it can be created and used manually, such as 44 * with g_socket_client_set_proxy_resolver(). 45 * 46 * Since: 2.36 47 */ 48 public class SimpleProxyResolver : ObjectG, ProxyResolverIF 49 { 50 /** the main Gtk struct */ 51 protected GSimpleProxyResolver* gSimpleProxyResolver; 52 53 /** Get the main Gtk struct */ 54 public GSimpleProxyResolver* getSimpleProxyResolverStruct(bool transferOwnership = false) 55 { 56 if (transferOwnership) 57 ownedRef = false; 58 return gSimpleProxyResolver; 59 } 60 61 /** the main Gtk struct as a void* */ 62 protected override void* getStruct() 63 { 64 return cast(void*)gSimpleProxyResolver; 65 } 66 67 /** 68 * Sets our main struct and passes it to the parent class. 69 */ 70 public this (GSimpleProxyResolver* gSimpleProxyResolver, bool ownedRef = false) 71 { 72 this.gSimpleProxyResolver = gSimpleProxyResolver; 73 super(cast(GObject*)gSimpleProxyResolver, ownedRef); 74 } 75 76 // add the ProxyResolver capabilities 77 mixin ProxyResolverT!(GSimpleProxyResolver); 78 79 80 /** */ 81 public static GType getType() 82 { 83 return g_simple_proxy_resolver_get_type(); 84 } 85 86 /** 87 * Creates a new #GSimpleProxyResolver. See 88 * #GSimpleProxyResolver:default-proxy and 89 * #GSimpleProxyResolver:ignore-hosts for more details on how the 90 * arguments are interpreted. 91 * 92 * Params: 93 * defaultProxy = the default proxy to use, eg 94 * "socks://192.168.1.1" 95 * ignoreHosts = an optional list of hosts/IP addresses 96 * to not use a proxy for. 97 * 98 * Returns: a new #GSimpleProxyResolver 99 * 100 * Since: 2.36 101 * 102 * Throws: ConstructionException GTK+ fails to create the object. 103 */ 104 public this(string defaultProxy, string[] ignoreHosts) 105 { 106 auto __p = g_simple_proxy_resolver_new(Str.toStringz(defaultProxy), Str.toStringzArray(ignoreHosts)); 107 108 if(__p is null) 109 { 110 throw new ConstructionException("null returned by new"); 111 } 112 113 this(cast(GSimpleProxyResolver*) __p, true); 114 } 115 116 /** 117 * Sets the default proxy on @resolver, to be used for any URIs that 118 * don't match #GSimpleProxyResolver:ignore-hosts or a proxy set 119 * via g_simple_proxy_resolver_set_uri_proxy(). 120 * 121 * If @default_proxy starts with "socks://", 122 * #GSimpleProxyResolver will treat it as referring to all three of 123 * the socks5, socks4a, and socks4 proxy types. 124 * 125 * Params: 126 * defaultProxy = the default proxy to use 127 * 128 * Since: 2.36 129 */ 130 public void setDefaultProxy(string defaultProxy) 131 { 132 g_simple_proxy_resolver_set_default_proxy(gSimpleProxyResolver, Str.toStringz(defaultProxy)); 133 } 134 135 /** 136 * Sets the list of ignored hosts. 137 * 138 * See #GSimpleProxyResolver:ignore-hosts for more details on how the 139 * @ignore_hosts argument is interpreted. 140 * 141 * Params: 142 * ignoreHosts = %NULL-terminated list of hosts/IP addresses 143 * to not use a proxy for 144 * 145 * Since: 2.36 146 */ 147 public void setIgnoreHosts(string[] ignoreHosts) 148 { 149 g_simple_proxy_resolver_set_ignore_hosts(gSimpleProxyResolver, Str.toStringzArray(ignoreHosts)); 150 } 151 152 /** 153 * Adds a URI-scheme-specific proxy to @resolver; URIs whose scheme 154 * matches @uri_scheme (and which don't match 155 * #GSimpleProxyResolver:ignore-hosts) will be proxied via @proxy. 156 * 157 * As with #GSimpleProxyResolver:default-proxy, if @proxy starts with 158 * "socks://", #GSimpleProxyResolver will treat it 159 * as referring to all three of the socks5, socks4a, and socks4 proxy 160 * types. 161 * 162 * Params: 163 * uriScheme = the URI scheme to add a proxy for 164 * proxy = the proxy to use for @uri_scheme 165 * 166 * Since: 2.36 167 */ 168 public void setUriProxy(string uriScheme, string proxy) 169 { 170 g_simple_proxy_resolver_set_uri_proxy(gSimpleProxyResolver, Str.toStringz(uriScheme), Str.toStringz(proxy)); 171 } 172 }