[Webkit-unassigned] [Bug 68371] [GTK][WEBKIT2] Add WebKitWebSettings GTK+ API

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Sep 21 00:56:17 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=68371





--- Comment #10 from Carlos Garcia Campos <cgarcia at igalia.com>  2011-09-21 00:56:18 PST ---
(In reply to comment #9)
> It would be something like this then,
> 
> void webkit_web_setting_set_scripts_enabled(gobject, value)
> {
>     WebKitWebSettings* webSettings = WEBKIT_WEB_SETTINGS(object);
>     WebKitWebSettingsPrivate* priv = webSettings->priv;
>     WKPreferencesSetJavaScriptEnabled(priv->preferences, (bool)g_value_get_boolean(value));
> }
> 
> static void webkitWebSettingsSetProperty(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec)
> {   ....
>     switch(prop_id) {
>     case PROP_ENABLE_SCRIPTS:
>          webkit_web_setting_set_scripts_enabled(gobject, value);
>          break;
>     ....
> }

No, it should be something like this:

void webkit_web_setting_set_enable_scripts(WebKitWebSettings* settings, gboolean enabled)
{
    g_return_if_fail(WEBKIT_IS_WEB_SETTINGS(settings));
    WebKitWebSettingsPrivate* priv = settings->priv;
    gboolean currentValue = WKPreferencesGetJavaScriptEnabled(priv->preferences);
    if (enabled == currentValue)
        return;

    WKPreferencesSetJavaScriptEnabled(priv->preferences, enabled);
    g_object_notify(G_OBJECT(settings), "enable-scripts");
}

switch(prop_id) {
case PROP_ENABLE_SCRIPTS:
    webkit_web_setting_set_enable_scripts(settings, g_value_get_boolean(value));
    break;

> This would expose many API's for get/set properties. Should that be fine?

It's fine for me, Martin?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list