Fix zooming, and make Zoom Normal work again

This commit is contained in:
Christian Dywan 2009-03-05 22:45:34 +01:00
parent f64547f723
commit 1fb5222a3f
5 changed files with 11 additions and 24 deletions

View file

@ -73,7 +73,7 @@ webkit_web_view_get_zoom_level (WebKitWebView* web_view)
{ {
g_return_val_if_fail (WEBKIT_IS_WEB_VIEW (web_view), 1.0); g_return_val_if_fail (WEBKIT_IS_WEB_VIEW (web_view), 1.0);
return 1.0; return 1.0f;
} }
void void

View file

@ -15,6 +15,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
/* Needed for versioning macros */ /* Needed for versioning macros */
#include <webkit/webkit.h> #include <webkit/webkit.h>
#include "compat.h"
struct _GjsValue struct _GjsValue
{ {
@ -1022,12 +1023,7 @@ gjs_module_new (JSContextRef js_context,
JSGlobalContextRef JSGlobalContextRef
gjs_global_context_new (void) gjs_global_context_new (void)
{ {
#ifdef WEBKIT_CHECK_VERSION
#if WEBKIT_CHECK_VERSION (1, 0, 3) #if WEBKIT_CHECK_VERSION (1, 0, 3)
#define HAVE_JSCONTEXTGROUP 1
#endif
#endif
#if HAVE_JSCONTEXTGROUP
JSGlobalContextRef js_context = JSGlobalContextCreateInGroup (NULL, NULL); JSGlobalContextRef js_context = JSGlobalContextCreateInGroup (NULL, NULL);
#else #else
JSGlobalContextRef js_context = JSGlobalContextCreate (NULL); JSGlobalContextRef js_context = JSGlobalContextCreate (NULL);

View file

@ -29,6 +29,7 @@
#include "midori-websettings.h" #include "midori-websettings.h"
#include "sokoke.h" #include "sokoke.h"
#include "compat.h"
#if HAVE_UNISTD_H #if HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
@ -1607,12 +1608,7 @@ midori_run_script (const gchar* filename)
gchar* script; gchar* script;
GError* error = NULL; GError* error = NULL;
#ifdef WEBKIT_CHECK_VERSION
#if WEBKIT_CHECK_VERSION (1, 0, 3) #if WEBKIT_CHECK_VERSION (1, 0, 3)
#define HAVE_JSCONTEXTGROUP 1
#endif
#endif
#if HAVE_JSCONTEXTGROUP
js_context = JSGlobalContextCreateInGroup (NULL, NULL); js_context = JSGlobalContextCreateInGroup (NULL, NULL);
#else #else
js_context = JSGlobalContextCreate (NULL); js_context = JSGlobalContextCreate (NULL);

View file

@ -252,7 +252,7 @@ _midori_browser_update_interface (MidoriBrowser* browser)
_action_set_sensitive (browser, "ZoomOut", _action_set_sensitive (browser, "ZoomOut",
midori_view_can_zoom_out (MIDORI_VIEW (view))); midori_view_can_zoom_out (MIDORI_VIEW (view)));
_action_set_sensitive (browser, "ZoomNormal", _action_set_sensitive (browser, "ZoomNormal",
midori_view_get_zoom_level (MIDORI_VIEW (view)) != 1.0); midori_view_get_zoom_level (MIDORI_VIEW (view)) != 1.0f);
_action_set_sensitive (browser, "Encoding", _action_set_sensitive (browser, "Encoding",
midori_browser_view_can_set_encoding (MIDORI_VIEW (view))); midori_browser_view_can_set_encoding (MIDORI_VIEW (view)));
_action_set_sensitive (browser, "SourceView", _action_set_sensitive (browser, "SourceView",
@ -511,7 +511,7 @@ midori_view_notify_zoom_level_cb (GtkWidget* view,
{ {
if (view == midori_browser_get_current_tab (browser)) if (view == midori_browser_get_current_tab (browser))
_action_set_sensitive (browser, "ZoomNormal", _action_set_sensitive (browser, "ZoomNormal",
midori_view_get_zoom_level (MIDORI_VIEW (view)) != 1.0); midori_view_get_zoom_level (MIDORI_VIEW (view)) != 1.0f);
} }
static void static void

View file

@ -2246,13 +2246,9 @@ midori_view_get_proxy_item (MidoriView* view)
gfloat gfloat
midori_view_get_zoom_level (MidoriView* view) midori_view_get_zoom_level (MidoriView* view)
{ {
g_return_val_if_fail (MIDORI_IS_VIEW (view), 1.0); g_return_val_if_fail (MIDORI_IS_VIEW (view), 1.0f);
#ifdef WEBKIT_CHECK_VERSION
if (view->web_view != NULL)
return webkit_web_view_get_zoom_level (WEBKIT_WEB_VIEW (view->web_view)); return webkit_web_view_get_zoom_level (WEBKIT_WEB_VIEW (view->web_view));
#endif
return 1.0;
} }
/** /**
@ -2268,10 +2264,9 @@ midori_view_set_zoom_level (MidoriView* view,
{ {
g_return_if_fail (MIDORI_IS_VIEW (view)); g_return_if_fail (MIDORI_IS_VIEW (view));
#ifdef WEBKIT_CHECK_VERSION
webkit_web_view_set_zoom_level ( webkit_web_view_set_zoom_level (
WEBKIT_WEB_VIEW (view->web_view), zoom_level); WEBKIT_WEB_VIEW (view->web_view), zoom_level);
#endif g_object_notify (G_OBJECT (view), "zoom-level");
} }
gboolean gboolean
@ -2279,7 +2274,7 @@ midori_view_can_zoom_in (MidoriView* view)
{ {
g_return_val_if_fail (MIDORI_IS_VIEW (view), FALSE); g_return_val_if_fail (MIDORI_IS_VIEW (view), FALSE);
#ifdef WEBKIT_CHECK_VERSION #if WEBKIT_CHECK_VERSION (1, 0, 1)
return view->web_view != NULL; return view->web_view != NULL;
#else #else
return FALSE; return FALSE;
@ -2291,7 +2286,7 @@ midori_view_can_zoom_out (MidoriView* view)
{ {
g_return_val_if_fail (MIDORI_IS_VIEW (view), FALSE); g_return_val_if_fail (MIDORI_IS_VIEW (view), FALSE);
#ifdef WEBKIT_CHECK_VERSION #if WEBKIT_CHECK_VERSION (1, 0, 1)
return view->web_view != NULL; return view->web_view != NULL;
#else #else
return FALSE; return FALSE;
@ -2440,7 +2435,7 @@ midori_view_print (MidoriView* view)
{ {
g_return_if_fail (MIDORI_IS_VIEW (view)); g_return_if_fail (MIDORI_IS_VIEW (view));
#ifdef WEBKIT_CHECK_VERSION #if WEBKIT_CHECK_VERSION (1, 0, 1)
webkit_web_frame_print (webkit_web_view_get_main_frame ( webkit_web_frame_print (webkit_web_view_get_main_frame (
WEBKIT_WEB_VIEW (view->web_view))); WEBKIT_WEB_VIEW (view->web_view)));
#else #else