_action_set_sensitive (browser, "ZoomOut", web_view != NULL);
_action_set_sensitive (browser, "ZoomNormal", web_view != NULL
&& webkit_web_view_get_zoom_level (WEBKIT_WEB_VIEW (web_view)) != 1.0);
- #if GLIB_CHECK_VERSION (2, 16, 0)
- _action_set_sensitive (browser, "SourceView", web_view != NULL);
- #endif
+ if (sokoke_gio_supports_http ())
+ _action_set_sensitive (browser, "SourceView", web_view != NULL);
_action_set_sensitive (browser, "FindNext", web_view != NULL);
_action_set_sensitive (browser, "FindPrevious", web_view != NULL);
/* _action_set_sensitive (browser, "FindQuick", web_view != NULL); */
g_object_unref (ui_manager);
- #if !GLIB_CHECK_VERSION (2, 16, 0)
- _action_set_sensitive (browser, "SourceView", FALSE);
- #endif
+ _action_set_sensitive (browser, "SourceView", sokoke_gio_supports_http ());
+
#ifndef WEBKIT_CHECK_VERSION
_action_set_sensitive (browser, "ZoomIn", FALSE);
_action_set_sensitive (browser, "ZoomOut", FALSE);
return menuitem;
}
+
+gboolean
+sokoke_gio_supports_http (void)
+{
+ #if HAVE_GIO
+ static gboolean supports_http;
+ static gboolean tested;
+ const gchar* const* schemes = g_vfs_get_supported_uri_schemes (g_vfs_get_default ());
+
+ if (tested)
+ return supports_http;
+ while (*schemes)
+ {
+ if (!strcmp (*schemes, "http"))
+ supports_http = TRUE;
+ schemes++;
+ }
+ tested = TRUE;
+ return supports_http;
+ #else
+ return FALSE;
+ #endif
+}