DOC_CONNECT ("hovering-over-link" , on_webView_link_hover)
DOC_CONNECT ("console-message" , on_webView_console_message)
- // For now we check for "plugins-enabled", in case this build has no properties
- if(g_object_class_find_property(G_OBJECT_GET_CLASS(browser->webView), "plugins-enabled"))
- g_object_set(G_OBJECT(browser->webView)
- , "loads-images-automatically" , config->loadImagesAutomatically
- , "shrinks-standalone-images-to-fit", config->shrinkImagesToFit
- , "text-areas-are-resizable" , config->resizableTextAreas
- , "java-script-enabled" , config->enableJavaScript
- , "plugins-enabled" , config->enablePlugins
- , NULL);
-
DOC_CONNECT ("button-press-event" , on_webView_button_press)
DOC_CONNECT ("popup-menu" , on_webView_popup);
DOC_CONNECT ("scroll-event" , on_webView_scroll);
DOC_CONNECT ("destroy" , on_webView_destroy)
#undef DOC_CONNECT
+ webkit_web_view_set_settings(WEBKIT_WEB_VIEW(browser->webView), webSettings);
+
// Eventually pack and display everything
sokoke_widget_set_visible(browser->navibar, config->toolbarNavigation);
sokoke_widget_set_visible(browser->newTab, config->toolbarNewTab);
#define GET_STR(var, key, default) \
var = sokoke_key_file_get_string_default( \
keyFile, "content", key, default, NULL)
- GET_INT(config->loadImagesAutomatically, "LoadImagesAutomatically", TRUE);
- GET_INT(config->shrinkImagesToFit, "ShrinkImagesTooFit", TRUE);
+ GET_INT(config->autoLoadImages, "AutoLoadImages", TRUE);
+ GET_INT(config->autoShrinkImages, "AutoShrinkImages", TRUE);
+ GET_INT(config->printBackgrounds, "PrintBackgrounds", FALSE);
GET_INT(config->resizableTextAreas, "ResizableTextAreas", FALSE);
- GET_INT(config->enableJavaScript, "EnableJavaScript", TRUE);
+ GET_STR(config->userStylesheetUri, "UserStylesheetUri", "");
+ GET_INT(config->enableScripts, "EnableScripts", TRUE);
GET_INT(config->enablePlugins, "EnablePlugins", TRUE);
#undef GET_INT
#undef GET_STR
g_key_file_set_integer(keyFile, "browser", "OpenTabsInTheBackground", config->openTabsInTheBackground);
g_key_file_set_integer(keyFile, "browser", "OpenPopupsInTabs", config->openPopupsInTabs);
- g_key_file_set_integer(keyFile, "content", "LoadImagesAutomatically", config->loadImagesAutomatically);
- g_key_file_set_integer(keyFile, "content", "ShrinkImagesToFit", config->shrinkImagesToFit);
+ g_key_file_set_integer(keyFile, "content", "AutoLoadImages", config->autoLoadImages);
+ g_key_file_set_integer(keyFile, "content", "AutoShrinkImages", config->autoShrinkImages);
+ g_key_file_set_integer(keyFile, "content", "PrintBackgrounds", config->printBackgrounds);
g_key_file_set_integer(keyFile, "content", "ResizableTextAreas", config->resizableTextAreas);
- g_key_file_set_integer(keyFile, "content", "EnableJavaScript", config->enableJavaScript);
+ g_key_file_set_string (keyFile, "content", "UserStylesheetUri", config->userStylesheetUri);
+ g_key_file_set_integer(keyFile, "content", "EnableScripts", config->enableScripts);
g_key_file_set_integer(keyFile, "content", "EnablePlugins", config->enablePlugins);
g_key_file_set_integer(keyFile, "session", "RememberWinSize", config->rememberWinSize);
static void on_prefs_loadImagesAutomatically_toggled(GtkWidget* widget, CPrefs* prefs)
{
- config->loadImagesAutomatically = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
- // FIXME: Apply the change to all open webViews
- g_object_set(get_nth_webView(-1, prefs->browser)
- , "loads-images-automatically", config->loadImagesAutomatically, NULL);
+ config->autoLoadImages = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ g_object_set(webSettings, "auto-load-images", config->autoLoadImages, NULL);
}
static void on_prefs_shrinkImagesToFit_toggled(GtkWidget* widget, CPrefs* prefs)
{
- config->shrinkImagesToFit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
- // FIXME: Apply the change to all open webViews
- g_object_set(get_nth_webView(-1, prefs->browser)
- , "shrinks-standalone-images-to-fit", config->shrinkImagesToFit, NULL);
+ config->autoShrinkImages = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ g_object_set(webSettings, "auto-shrink-images", config->autoShrinkImages, NULL);
+}
+
+static void on_prefs_printBackgrounds_toggled(GtkWidget* widget, CPrefs* prefs)
+{
+ config->printBackgrounds = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ g_object_set(webSettings, "print-backgrounds", config->printBackgrounds, NULL);
}
static void on_prefs_resizableTextAreas_toggled(GtkWidget* widget, CPrefs* prefs)
{
config->resizableTextAreas = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
- // FIXME: Apply the change to all open webViews
- g_object_set(get_nth_webView(-1, prefs->browser)
- , "text-areas-are-resizable", config->resizableTextAreas, NULL);
+ g_object_set(webSettings, "resizable-text-areas", config->resizableTextAreas, NULL);
}
static void on_prefs_enableJavaScript_toggled(GtkWidget* widget, CPrefs* prefs)
{
- config->enableJavaScript = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
- // FIXME: Apply the change to all open webViews
- g_object_set(get_nth_webView(-1, prefs->browser)
- , "java-script-enabled", config->enableJavaScript, NULL);
+ config->enableScripts = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ g_object_set(webSettings, "enable-scripts", config->enableScripts, NULL);
}
static void on_prefs_enablePlugins_toggled(GtkWidget* widget, CPrefs* prefs)
{
config->enablePlugins = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
- // FIXME: Apply the change to all open webViews
- g_object_set(get_nth_webView(-1, prefs->browser)
- , "plugins-enabled", config->enablePlugins, NULL);
+ g_object_set(webSettings, "enable-plugins", config->enablePlugins, NULL);
}
static void on_prefs_toolbarstyle_changed(GtkWidget* widget, CPrefs* prefs)
FRAME_NEW("Features");
TABLE_NEW(3, 2);
checkbutton = gtk_check_button_new_with_mnemonic("Load _images automatically");
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->loadImagesAutomatically);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->autoLoadImages);
g_signal_connect(checkbutton, "toggled"
, G_CALLBACK(on_prefs_loadImagesAutomatically_toggled), prefs);
SPANNED_ADD(checkbutton, 0, 1, 0, 1);
checkbutton = gtk_check_button_new_with_mnemonic("_Shrink images to fit");
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->shrinkImagesToFit);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->autoShrinkImages);
g_signal_connect(checkbutton, "toggled"
, G_CALLBACK(on_prefs_shrinkImagesToFit_toggled), prefs);
SPANNED_ADD(checkbutton, 1, 2, 0, 1);
+ checkbutton = gtk_check_button_new_with_mnemonic("Print _backgrounds");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->printBackgrounds);
+ g_signal_connect(checkbutton, "toggled"
+ , G_CALLBACK(on_prefs_printBackgrounds_toggled), prefs);
+ SPANNED_ADD(checkbutton, 0, 1, 1, 2);
checkbutton = gtk_check_button_new_with_mnemonic("_Resizable textareas");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->resizableTextAreas);
g_signal_connect(checkbutton, "toggled"
, G_CALLBACK(on_prefs_resizableTextAreas_toggled), prefs);
- SPANNED_ADD(checkbutton, 0, 1, 1, 2);
- checkbutton = gtk_check_button_new_with_mnemonic("Enable java_script");
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->enableJavaScript);
+ SPANNED_ADD(checkbutton, 1, 2, 1, 2);
+ checkbutton = gtk_check_button_new_with_mnemonic("Enable _scripts");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->enableScripts);
g_signal_connect(checkbutton, "toggled"
, G_CALLBACK(on_prefs_enableJavaScript_toggled), prefs);
- SPANNED_ADD(checkbutton, 1, 2, 1, 2);
+ SPANNED_ADD(checkbutton, 0, 1, 2, 3);
checkbutton = gtk_check_button_new_with_mnemonic("Enable _plugins");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->enablePlugins);
g_signal_connect(checkbutton, "toggled"
, G_CALLBACK(on_prefs_enablePlugins_toggled), prefs);
- SPANNED_ADD(checkbutton, 0, 1, 2, 3);
- // For now we check for "plugins-enabled", in case this build has no properties
- if(!g_object_class_find_property(G_OBJECT_GET_CLASS(browser->webView), "plugins-enabled"))
- gtk_widget_set_sensitive(frame, FALSE);
+ SPANNED_ADD(checkbutton, 1, 2, 2, 3);
// Page "Interface"
PAGE_NEW("Interface");