I assume GSettings should override GConf settings.
Otherwise I assume those who upgrade to GNOME 3 will still be using their old
GConf settings, but the configuration utility will change the GSettings
values.
>+ // Check if proxy is enabled, flag is only in schema org.gnome.system.proxy.http,
>+ // there is no separate flag for each schema.
>+ nsresult rv = mGSettings->GetCollectionForSchema(NS_LITERAL_CSTRING("org.gnome.system.proxy.http"),
>+ getter_AddRefs(proxy_settings));
>+ NS_ENSURE_SUCCESS(rv, rv);
>+ rv = proxy_settings->GetBoolean(NS_LITERAL_CSTRING("enabled"), &masterProxySwitch);
>+ NS_ENSURE_SUCCESS(rv, rv);
"enabled" is described as "Unused", so don't use this key.
>+ bool useHttpProxyForAll = false;
>+ // This setting sometimes doesn't exist, don't bail on failure
>+ proxy_settings->GetBoolean(NS_LITERAL_CSTRING("use-same-proxy"), &useHttpProxyForAll);
>+
>+ if (!useHttpProxyForAll) {
>+ rv = SetProxyResultFromGSettings("org.gnome.system.proxy.socks", "SOCKS", aResult);
>+ if (NS_SUCCEEDED(rv))
>+ return rv;
>+ }
>+
Comment on attachment 577534
gsettings proxy patch v2
> FUNC(g_ variant_ get_string, const char *, (GVariant* value, gsize* length)) \ variant_ is_of_type, gboolean, (GVariant* value, const GVariantType* type)) \ variant_ new_int32, GVariant *, (gint32 value)) \ variant_ new_boolean, GVariant *, (gboolean value)) \ variant_ new_string, GVariant *, (const char* string)) \ variant_ get_strv, GVariant *, (gsize* length)) \
> FUNC(g_
> FUNC(g_
> FUNC(g_
> FUNC(g_
>+ FUNC(g_
These were roughly in an order.
Can you insert get_strv after get_string, please?
(In reply to jhorak from comment #10)
> Could you be more specific (the other things)?
Check the #define statements before and after GSETTIINGS_ FUNCTIONS as any new
symbols need to be added here.
A #define is needed for g_variant_get_strv and G_VARIANT_ TYPE_STRING_ ARRAY.
>+ if (mGConf && IsProxyMode( "auto") ) { >GetString( NS_LITERAL_ CSTRING( "/system/ proxy/autoconfi g_url") ,
>+ return mGConf-
>+ aResult);
> }
>+ if (mGSettings) {
>+ // Check if mode is auto
I assume GSettings should override GConf settings.
Otherwise I assume those who upgrade to GNOME 3 will still be using their old
GConf settings, but the configuration utility will change the GSettings
values.
>+ nsCString proxyMode; nsIGSettingsCol lection> proxy_settings; >GetCollectionF orSchema( NS_LITERAL_ CSTRING( "org.gnome. system. proxy") , AddRefs( proxy_settings) ); >GetString( NS_LITERAL_ CSTRING( "mode") , proxyMode);
>+ nsCOMPtr<
>+ mGSettings-
>+ getter_
>+ if (proxy_settings) {
>+ nsresult rv = proxy_settings-
Move the proxyMode declaration to within the "if (proxy_setttings)" block
where it is used.
>+ return proxy_settings- >GetString( NS_LITERAL_ CSTRING( "autoconfig- url"),
>+ aResult);
Alignment.
>+ PRInt32 port; >GetInt( NS_LITERAL_ CSTRING( "port") , &port); SUCCESS( rv, rv); aType, host, port, aResult);
>+ rv = proxy_settings-
>+ NS_ENSURE_
>+
>+ SetProxyResult(
>+ return NS_OK;
Need to return NS_ERROR_FAILURE when the port is 0.
'Each of the 4 proxy types is enabled if its "host" key is
non-empty and its "port" key is non-0.'
http:// git.gnome. org/browse/ gsettings- desktop- schemas/ tree/schemas/ org.gnome. system. proxy.gschema. xml.in. in
>+ // Check if proxy is enabled, flag is only in schema org.gnome. system. proxy.http, >GetCollectionF orSchema( NS_LITERAL_ CSTRING( "org.gnome. system. proxy.http" ), AddRefs( proxy_settings) ); SUCCESS( rv, rv); >GetBoolean( NS_LITERAL_ CSTRING( "enabled" ), &masterProxySwi tch); SUCCESS( rv, rv);
>+ // there is no separate flag for each schema.
>+ nsresult rv = mGSettings-
>+ getter_
>+ NS_ENSURE_
>+ rv = proxy_settings-
>+ NS_ENSURE_
"enabled" is described as "Unused", so don't use this key.
>+ bool useHttpProxyForAll = false; >GetBoolean( NS_LITERAL_ CSTRING( "use-same- proxy") , &useHttpProxyFo rAll); orAll) { romGSettings( "org.gnome. system. proxy.socks" , "SOCKS", aResult);
>+ // This setting sometimes doesn't exist, don't bail on failure
>+ proxy_settings-
>+
>+ if (!useHttpProxyF
>+ rv = SetProxyResultF
>+ if (NS_SUCCEEDED(rv))
>+ return rv;
>+ }
>+
Similarly, "use-same-proxy" is also "Unused".
>+ if (aScheme. LowerCaseEquals Literal( "http") || useHttpProxyForAll) { romGSettings( "org.gnome. system. proxy.http" , "PROXY", aResult); LowerCaseEquals Literal( "https" )) { romGSettings( "org.gnome. system. proxy.https" , "PROXY", aResult);
>+ rv = SetProxyResultF
>+ } else if (aScheme.
>+ rv = SetProxyResultF
Need to handle this case:
"If an http proxy is configured, but an https proxy is not,
then the http proxy is also used for https."