[Xfce4-commits] <midori:master> Implement zoom_text_and_images for WebKit2

Christian Dywan noreply at xfce.org
Fri Apr 5 01:20:01 CEST 2013


Updating branch refs/heads/master
         to 9295eb8efd7870fcec255ff7ba6df684bd150fe2 (commit)
       from 13d67c47ae8a1adb3c98737daa3a65ce91a84245 (commit)

commit 9295eb8efd7870fcec255ff7ba6df684bd150fe2
Author: Christian Dywan <christian at twotoasts.de>
Date:   Fri Apr 5 00:38:16 2013 +0200

    Implement zoom_text_and_images for WebKit2

 midori/midori-settings.vala |    9 +++++++--
 midori/midori-view.c        |   29 +++++++++++++++++------------
 2 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/midori/midori-settings.vala b/midori/midori-settings.vala
index 32e379d..946b72c 100644
--- a/midori/midori-settings.vala
+++ b/midori/midori-settings.vala
@@ -33,8 +33,15 @@ namespace Midori {
         } set {
             default_encoding = value;
         } }
+        /* Since: 0.1.3 */
+        public bool zoom_text_and_images { get; set; default = true; }
 #else
     public class Settings : WebKit.Settings {
+        public bool zoom_text_and_images { get {
+            return !zoom_text_only;
+        } set {
+            zoom_text_only = !value;
+        } }
 #endif
         public bool remember_last_window_size { get; set; default = true; }
         public int last_window_width { get; set; default = 0; }
@@ -101,8 +108,6 @@ namespace Midori {
         public bool find_while_typing { get; set; default = false; }
 
         public bool open_popups_in_tabs { get; set; default = true; }
-        /* Since: 0.1.3 */
-        public bool zoom_text_and_images { get; set; default = true; }
         /* Since: 0.2.0 */
         // [Deprecated (since = "0.4.9")]
         public bool kinetic_scrolling { get; set; default = true; }
diff --git a/midori/midori-view.c b/midori/midori-view.c
index a9ac753..a3c497d 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -3432,10 +3432,11 @@ _midori_view_set_settings (MidoriView*        view,
         "open-tabs-in-the-background", &view->open_tabs_in_the_background,
         NULL);
 
-    g_object_set (view->web_view,
-                  "settings", settings,
-                  "full-content-zoom", zoom_text_and_images,
-                  NULL);
+    webkit_web_view_set_settings (WEBKIT_WEB_VIEW (view->web_view), (void*)settings);
+    #ifndef HAVE_WEBKIT2
+    webkit_web_view_set_full_content_zoom (WEBKIT_WEB_VIEW (view->web_view),
+        zoom_text_and_images);
+    #endif
 }
 
 /**
@@ -3506,12 +3507,16 @@ midori_view_settings_notify_cb (MidoriWebSettings* settings,
     g_value_init (&value, pspec->value_type);
     g_object_get_property (G_OBJECT (view->settings), name, &value);
 
-    if (name == g_intern_string ("zoom-text-and-images"))
+    if (name == g_intern_string ("open-new-pages-in"))
+        view->open_new_pages_in = g_value_get_enum (&value);
+    #ifndef HAVE_WEBKIT2
+    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);
+            webkit_web_view_set_full_content_zoom (WEBKIT_WEB_VIEW (view->web_view),
+                g_value_get_boolean (&value));
     }
+    #endif
     else if (name == g_intern_string ("close-buttons-on-tabs"))
     {
         view->close_buttons_on_tabs = g_value_get_boolean (&value);
@@ -3520,8 +3525,6 @@ midori_view_settings_notify_cb (MidoriWebSettings* settings,
                                    view->close_buttons_on_tabs);
         #endif
     }
-    else if (name == g_intern_string ("open-new-pages-in"))
-        view->open_new_pages_in = g_value_get_enum (&value);
     else if (name == g_intern_string ("middle-click-opens-selection"))
         view->middle_click_opens_selection = g_value_get_boolean (&value);
     else if (name == g_intern_string ("open-tabs-in-the-background"))
@@ -3807,9 +3810,11 @@ midori_view_constructor (GType                  type,
 
     if (view->settings)
     {
-        g_object_set (view->web_view, "settings", view->settings,
-            "full-content-zoom", katze_object_get_boolean (view->settings,
-                "zoom-text-and-images"), NULL);
+        webkit_web_view_set_settings (WEBKIT_WEB_VIEW (view->web_view), (void*)view->settings);
+        #ifndef HAVE_WEBKIT2
+        webkit_web_view_set_full_content_zoom (WEBKIT_WEB_VIEW (view->web_view),
+            katze_object_get_boolean (view->settings, "zoom-text-and-images"));
+        #endif
     }
 
     #ifdef HAVE_WEBKIT2


More information about the Xfce4-commits mailing list