X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gio%2Fgproxyresolver.c;h=d51dcc523380cb5e54ad53f08e4ebb27f85ad16c;hb=e608ec7b2e47d29fa189fca6e97f484f41c115a4;hp=2bc97338a4a95a1df17295091e796e4f63def842;hpb=1b033919845cef366842373da9f1cfb56f522d01;p=platform%2Fupstream%2Fglib.git diff --git a/gio/gproxyresolver.c b/gio/gproxyresolver.c index 2bc9733..d51dcc5 100644 --- a/gio/gproxyresolver.c +++ b/gio/gproxyresolver.c @@ -13,9 +13,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. + * Public License along with this library; if not, see . * * Author: Nicolas Dufresne */ @@ -50,67 +48,21 @@ g_proxy_resolver_default_init (GProxyResolverInterface *iface) { } -static gpointer -get_default_proxy_resolver (gpointer arg) -{ - const gchar *use_this; - GProxyResolver *resolver; - GList *l; - GIOExtensionPoint *ep; - GIOExtension *extension; - - - use_this = g_getenv ("GIO_USE_PROXY_RESOLVER"); - - /* Ensure proxy-resolver modules loaded */ - _g_io_modules_ensure_loaded (); - - ep = g_io_extension_point_lookup (G_PROXY_RESOLVER_EXTENSION_POINT_NAME); - - if (use_this) - { - extension = g_io_extension_point_get_extension_by_name (ep, use_this); - if (extension) - { - resolver = g_object_new (g_io_extension_get_type (extension), NULL); - - if (g_proxy_resolver_is_supported (resolver)) - return resolver; - - g_object_unref (resolver); - } - } - - for (l = g_io_extension_point_get_extensions (ep); l != NULL; l = l->next) - { - extension = l->data; - - resolver = g_object_new (g_io_extension_get_type (extension), NULL); - - if (g_proxy_resolver_is_supported (resolver)) - return resolver; - - g_object_unref (resolver); - } - - return NULL; -} - /** * g_proxy_resolver_get_default: * * Gets the default #GProxyResolver for the system. * - * Return value: (transfer none): the default #GProxyResolver. + * Returns: (transfer none): the default #GProxyResolver. * * Since: 2.26 */ GProxyResolver * g_proxy_resolver_get_default (void) { - static GOnce once_init = G_ONCE_INIT; - - return g_once (&once_init, get_default_proxy_resolver, NULL); + return _g_io_module_get_default (G_PROXY_RESOLVER_EXTENSION_POINT_NAME, + "GIO_USE_PROXY_RESOLVER", + (GIOModuleVerifyFunc)g_proxy_resolver_is_supported); } /** @@ -121,7 +73,7 @@ g_proxy_resolver_get_default (void) * internally; g_proxy_resolver_get_default() will only return a proxy * resolver that returns %TRUE for this method.) * - * Return value: %TRUE if @resolver is supported. + * Returns: %TRUE if @resolver is supported. * * Since: 2.26 */ @@ -145,22 +97,22 @@ g_proxy_resolver_is_supported (GProxyResolver *resolver) * @error: return location for a #GError, or %NULL * * Looks into the system proxy configuration to determine what proxy, - * if any, to use to connect to @uri. The returned proxy URIs are of the - * form <protocol>://[user[:password]@]host:port - * or direct://, where <protocol> could be - * http, rtsp, socks or other proxying protocol. + * if any, to use to connect to @uri. The returned proxy URIs are of + * the form `://[user[:password]@]host:port` or + * `direct://`, where could be http, rtsp, socks + * or other proxying protocol. * * If you don't know what network protocol is being used on the - * socket, you should use none as the URI protocol. + * socket, you should use `none` as the URI protocol. * In this case, the resolver might still return a generic proxy type * (such as SOCKS), but would not return protocol-specific proxy types * (such as http). * - * direct:// is used when no proxy is needed. + * `direct://` is used when no proxy is needed. * Direct connection should not be attempted unless it is part of the * returned array of proxies. * - * Return value: (transfer full) (array zero-terminated=1): A + * Returns: (transfer full) (array zero-terminated=1): A * NULL-terminated array of proxy URIs. Must be freed * with g_strfreev(). * @@ -222,7 +174,7 @@ g_proxy_resolver_lookup_async (GProxyResolver *resolver, * g_proxy_resolver_lookup_async() is complete. See * g_proxy_resolver_lookup() for more details. * - * Return value: (transfer full) (array zero-terminated=1): A + * Returns: (transfer full) (array zero-terminated=1): A * NULL-terminated array of proxy URIs. Must be freed * with g_strfreev(). *