]> spindle.queued.net Git - midori/commitdiff
Remove zoom compatibility, use new API or fall through
authorChristian Dywan <christian@twotoasts.de>
Mon, 9 Jun 2008 01:13:08 +0000 (03:13 +0200)
committerChristian Dywan <christian@twotoasts.de>
Mon, 9 Jun 2008 01:13:08 +0000 (03:13 +0200)
midori/compat.c
midori/compat.h
midori/midori-browser.c

index 5ebbfa39a1fa220db99007a923ffef3328013dad..7dff901f0950fac7fad2aeef12768a842e5ff084 100644 (file)
@@ -40,90 +40,31 @@ gtk_tool_item_set_tooltip_text (GtkToolItem* toolitem,
 
 #ifndef WEBKIT_CHECK_VERSION
 
-/**
- * webkit_web_view_get_zoom_level:
- * @web_view: a #WebKitWebView
- *
- * Retrieves the current zoom level.
- *
- * Return value: the zoom level, always 1.0 if not supported
- **/
 gfloat
 webkit_web_view_get_zoom_level (WebKitWebView* web_view)
 {
     g_return_val_if_fail (WEBKIT_IS_WEB_VIEW (web_view), 1.0);
 
-    if (g_object_class_find_property (G_OBJECT_GET_CLASS (web_view),
-                                      "zoom-level"))
-    {
-        gfloat zoom_level;
-        g_object_get (web_view, "zoom-level", &zoom_level, NULL);
-        return zoom_level;
-    }
     return 1.0;
 }
 
-/**
- * webkit_web_view_set_zoom_level:
- * @web_view: a #WebKitWebView
- *
- * Sets the current zoom level.
- *
- * Does nothing if not supported.
- **/
 void
 webkit_web_view_set_zoom_level (WebKitWebView* web_view,
                                 gfloat         zoom_level)
 {
     g_return_if_fail (WEBKIT_IS_WEB_VIEW (web_view));
-
-    if (g_object_class_find_property (G_OBJECT_GET_CLASS (web_view),
-                                      "zoom-level"))
-        g_object_set (web_view, "zoom-level", zoom_level, NULL);
 }
 
-/**
- * webkit_web_view_zoom_in:
- * @web_view: a #WebKitWebView
- *
- * Increases the current zoom level.
- *
- * Does nothing if not supported.
- **/
 void
 webkit_web_view_zoom_in (WebKitWebView* web_view)
 {
     g_return_if_fail (WEBKIT_IS_WEB_VIEW (web_view));
-
-    gfloat zoom_level = webkit_web_view_get_zoom_level (web_view);
-    WebKitWebSettings* settings = webkit_web_view_get_settings (web_view);
-    gfloat zoom_step;
-    g_object_get (settings, "zoom-step", &zoom_step, NULL);
-    webkit_web_view_set_zoom_level (web_view, zoom_level + zoom_step);
 }
 
-/**
- * webkit_web_view_zoom_out:
- * @web_view: a #WebKitWebView
- *
- * Decreases the current zoom level.
- *
- * Does nothing if not supported.
- **/
 void
 webkit_web_view_zoom_out (WebKitWebView* web_view)
 {
     g_return_if_fail (WEBKIT_IS_WEB_VIEW (web_view));
-
-    gfloat zoom_level = webkit_web_view_get_zoom_level (web_view);
-    WebKitWebSettings* settings = webkit_web_view_get_settings (web_view);
-    if (g_object_class_find_property (G_OBJECT_GET_CLASS (settings),
-                                      "zoom-step"))
-    {
-        gfloat zoom_step;
-        g_object_get (settings, "zoom-step", &zoom_step, NULL);
-        webkit_web_view_set_zoom_level (web_view, zoom_level - zoom_step);
-    }
 }
 
 #endif
index a539ed5fdf76ccc8cc38480abe7833493d34674a..c0818d8c8cdc756f4baedb78bfff91f5b188ae06 100644 (file)
@@ -34,7 +34,8 @@ gfloat
 webkit_web_view_get_zoom_level         (WebKitWebView*     web_view);
 
 void
-webkit_web_view_set_zoom_level         (WebKitWebView*     web_view);
+webkit_web_view_set_zoom_level         (WebKitWebView*     web_view,
+                                        gfloat             zoom_level);
 
 void
 webkit_web_view_zoom_in                (WebKitWebView*     web_view);
index d68ad086c8e94a5785d40faec91d1db901e3ea89..1a99d61f075869b6a4f993479e11fe3f3c2dd729 100644 (file)
@@ -180,12 +180,6 @@ _midori_browser_update_interface (MidoriBrowser* browser)
         loading = midori_web_view_is_loading (MIDORI_WEB_VIEW (web_view));
         _action_set_sensitive (browser, "ZoomNormal",
             webkit_web_view_get_zoom_level (WEBKIT_WEB_VIEW (web_view)) != 1.0);
-        if (!g_object_class_find_property (G_OBJECT_GET_CLASS (web_view),
-                                           "zoom-level"))
-        {
-            _action_set_sensitive (browser, "ZoomIn", FALSE);
-            _action_set_sensitive (browser, "ZoomOut", FALSE);
-        }
         _action_set_sensitive (browser, "Back",
             webkit_web_view_can_go_back (WEBKIT_WEB_VIEW (web_view)));
         _action_set_sensitive (browser, "Forward",
@@ -2985,6 +2979,11 @@ midori_browser_init (MidoriBrowser* browser)
                               "", _("Extensions"));
 
     g_object_unref (ui_manager);
+
+    #ifndef WEBKIT_CHECK_VERSION
+    _action_set_sensitive (browser, "ZoomIn", FALSE);
+    _action_set_sensitive (browser, "ZoomOut", FALSE);
+    #endif
 }
 
 static void