Introduce Zoom Text and Images preference

This commit is contained in:
Christian Dywan 2009-01-16 05:05:50 +01:00
parent e247529b6b
commit 8f2c5befb2
3 changed files with 47 additions and 3 deletions

View file

@ -453,7 +453,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
/* Page "Behavior" */
PAGE_NEW (GTK_STOCK_SELECT_COLOR, _("Behavior"));
FRAME_NEW (_("Features"));
TABLE_NEW (6, 2);
TABLE_NEW (7, 2);
button = katze_property_proxy (settings, "auto-load-images", NULL);
gtk_button_set_label (GTK_BUTTON (button), _("Load images automatically"));
gtk_widget_set_tooltip_text (button, _("Load and display images automatically"));
@ -486,10 +486,12 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
gtk_button_set_label (GTK_BUTTON (button), _("Enable developer tools"));
gtk_widget_set_tooltip_text (button, _("Enable special extensions for developers"));
SPANNED_ADD (button, 1, 2, 3, 4);
button = katze_property_proxy (settings, "zoom-text-and-images", NULL);
SPANNED_ADD (button, 0, 1, 4, 5);
label = katze_property_label (settings, "location-entry-search");
INDENTED_ADD (label, 0, 1, 4, 5);
INDENTED_ADD (label, 0, 1, 5, 6);
entry = katze_property_proxy (settings, "location-entry-search", NULL);
FILLED_ADD (entry, 1, 2, 4, 5);
FILLED_ADD (entry, 1, 2, 5, 6);
/* Page "Interface" */
PAGE_NEW (GTK_STOCK_CONVERT, _("Interface"));

View file

@ -1260,13 +1260,20 @@ midori_view_new (KatzeNet* net)
static void
_midori_view_update_settings (MidoriView* view)
{
gboolean zoom_text_and_images;
g_object_get (view->settings,
"download-manager", &view->download_manager,
"zoom-text-and-images", &zoom_text_and_images,
"close-buttons-on-tabs", &view->close_buttons_on_tabs,
"open-new-pages-in", &view->open_new_pages_in,
"middle-click-opens-selection", &view->middle_click_opens_selection,
"open-tabs-in-the-background", &view->open_tabs_in_the_background,
NULL);
if (view->web_view)
g_object_set (view->web_view, "full-content-zoom",
zoom_text_and_images, NULL);
}
static void
@ -1285,6 +1292,12 @@ midori_view_settings_notify_cb (MidoriWebSettings* settings,
{
katze_assign (view->download_manager, g_value_dup_string (&value));
}
else if (name == g_intern_string ("zoom-text-and-images"))
{
if (view->web_view)
g_object_set (view->web_view, "full-content-zoom",
g_value_get_boolean (&value), NULL);
}
else if (name == g_intern_string ("close-buttons-on-tabs"))
{
view->close_buttons_on_tabs = g_value_get_boolean (&value);
@ -1492,6 +1505,9 @@ midori_view_construct_web_view (MidoriView* view)
NULL);
g_object_set (view->web_view, "settings", view->settings, NULL);
if (katze_object_has_property (view->web_view, "full-content-zoom"))
g_object_set (view->web_view, "full-content-zoom",
katze_object_get_boolean (view->settings, "zoom-text-and-images"), NULL);
gtk_widget_show (view->web_view);
gtk_container_add (GTK_CONTAINER (view), view->web_view);

View file

@ -59,6 +59,7 @@ struct _MidoriWebSettings
gboolean open_tabs_next_to_current;
gboolean open_popups_in_tabs;
gboolean zoom_text_and_images;
MidoriAcceptCookies accept_cookies;
gboolean original_cookies_only;
gint maximum_cookie_age;
@ -122,6 +123,7 @@ enum
PROP_ENFORCE_96_DPI,
PROP_ENABLE_DEVELOPER_EXTRAS,
PROP_ZOOM_TEXT_AND_IMAGES,
PROP_ACCEPT_COOKIES,
PROP_ORIGINAL_COOKIES_ONLY,
PROP_MAXIMUM_COOKIE_AGE,
@ -602,6 +604,24 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
FALSE,
G_PARAM_READABLE));
if (!g_object_class_find_property (gobject_class, "zoom-text-and-images"))
/**
* MidoriWebSettings:zoom-text-and-images:
*
* Whether to zoom text and images.
*
* Since: 0.1.3
*/
g_object_class_install_property (gobject_class,
PROP_ZOOM_TEXT_AND_IMAGES,
g_param_spec_boolean (
"zoom-text-and-images",
_("Zoom Text and Images"),
_("Whether to zoom text and images"),
FALSE,
g_object_class_find_property (g_type_class_ref (WEBKIT_TYPE_WEB_VIEW),
"full-content-zoom") ? G_PARAM_READWRITE : G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
PROP_ACCEPT_COOKIES,
g_param_spec_enum (
@ -972,6 +992,9 @@ midori_web_settings_set_property (GObject* object,
web_settings->open_popups_in_tabs = g_value_get_boolean (value);
break;
case PROP_ZOOM_TEXT_AND_IMAGES:
web_settings->zoom_text_and_images = g_value_get_boolean (value);
break;
case PROP_ACCEPT_COOKIES:
web_settings->accept_cookies = g_value_get_enum (value);
break;
@ -1130,6 +1153,9 @@ midori_web_settings_get_property (GObject* object,
case PROP_ENABLE_DEVELOPER_EXTRAS:
g_value_set_boolean (value, FALSE);
break;
case PROP_ZOOM_TEXT_AND_IMAGES:
g_value_set_boolean (value, web_settings->zoom_text_and_images);
break;
case PROP_ACCEPT_COOKIES:
g_value_set_enum (value, web_settings->accept_cookies);
break;