Require WebKitGTK+ 1.1.14, remove backwards compatibility

This commit is contained in:
Paweł Forysiuk 2011-06-08 22:03:38 +02:00 committed by Christian Dywan
parent f681ac9ef1
commit 0dbee646b7
7 changed files with 3 additions and 544 deletions

2
README
View file

@ -11,7 +11,7 @@ Midori is a lightweight web browser.
* Customizable and extensible interface.
* Extensions written in C.
Requirements: GTK+ 2.10, WebkitGTK+ 1.1.4, libXML2, libsoup 2.25.2, sqlite 3.0
Requirements: GTK+ 2.10, WebkitGTK+ 1.1.14, libXML2, libsoup 2.25.2, sqlite 3.0
Optional: Unique 0.9, libidn, docutils, libnotify, Vala

View file

@ -747,18 +747,10 @@ midori_browser_privacy_preferences_cb (MidoriBrowser* browser,
gtk_label_set_markup (GTK_LABEL (label), markup);
g_free (markup);
katze_preferences_add_widget (preferences, label, "filled");
#if WEBKIT_CHECK_VERSION (1, 1, 13)
button = katze_property_proxy (settings, "enable-offline-web-application-cache", NULL);
katze_preferences_add_widget (preferences, button, "indented");
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 8)
button = katze_property_proxy (settings, "enable-html5-local-storage", NULL);
katze_preferences_add_widget (preferences, button, "spanned");
#if !WEBKIT_CHECK_VERSION (1, 1, 14)
button = katze_property_proxy (settings, "enable-html5-database", NULL);
katze_preferences_add_widget (preferences, button, "indented");
#endif
#endif
#if HAVE_LIBSOUP_2_27_90
button = katze_property_proxy (settings, "strip-referer", NULL);
katze_preferences_add_widget (preferences, button, "indented");
@ -791,11 +783,9 @@ midori_app_add_browser_cb (MidoriApp* app,
midori_panel_append_page (MIDORI_PANEL (panel), MIDORI_VIEWABLE (addon));
/* Transfers */
#if WEBKIT_CHECK_VERSION (1, 1, 3)
addon = g_object_new (MIDORI_TYPE_TRANSFERS, "app", app, NULL);
gtk_widget_show (addon);
midori_panel_append_page (MIDORI_PANEL (panel), MIDORI_VIEWABLE (addon));
#endif
/* Extensions */
g_signal_connect (browser, "show-preferences",
@ -918,18 +908,6 @@ soup_session_settings_notify_http_proxy_cb (MidoriWebSettings* settings,
midori_soup_session_set_proxy_uri (session, NULL);
}
#if !WEBKIT_CHECK_VERSION (1, 1, 11)
static void
soup_session_settings_notify_ident_string_cb (MidoriWebSettings* settings,
GParamSpec* pspec,
SoupSession* session)
{
gchar* ident_string = katze_object_get_string (settings, "user-agent");
g_object_set (session, "user-agent", ident_string, NULL);
g_free (ident_string);
}
#endif
static void
midori_soup_session_settings_accept_language_cb (SoupSession* session,
SoupMessage* msg,
@ -1038,12 +1016,6 @@ midori_load_soup_session (gpointer settings)
g_signal_connect (settings, "notify::proxy-type",
G_CALLBACK (soup_session_settings_notify_http_proxy_cb), session);
#if !WEBKIT_CHECK_VERSION (1, 1, 11)
soup_session_settings_notify_ident_string_cb (settings, NULL, session);
g_signal_connect (settings, "notify::user-agent",
G_CALLBACK (soup_session_settings_notify_ident_string_cb), session);
#endif
g_signal_connect (session, "request-queued",
G_CALLBACK (midori_soup_session_settings_accept_language_cb), settings);
@ -1500,7 +1472,6 @@ midori_run_script (const gchar* filename)
return 1;
}
#if WEBKIT_CHECK_VERSION (1, 1, 6)
static void
snapshot_load_finished_cb (GtkWidget* web_view,
WebKitWebFrame* web_frame,
@ -1524,7 +1495,6 @@ snapshot_load_finished_cb (GtkWidget* web_view,
g_print (_("Snapshot saved to: %s\n"), filename);
gtk_main_quit ();
}
#endif
static void
midori_web_app_browser_notify_load_status_cb (MidoriBrowser* browser,
@ -1836,13 +1806,11 @@ midori_clear_saved_logins_cb (void)
g_free (path);
}
#if WEBKIT_CHECK_VERSION (1, 1, 14)
static void
midori_clear_html5_databases_cb (void)
{
webkit_remove_all_web_databases ();
}
#endif
#if WEBKIT_CHECK_VERSION (1, 3, 11)
static void
@ -1945,10 +1913,8 @@ main (int argc,
N_("Show a diagnostic dialog"), NULL },
{ "run", 'r', 0, G_OPTION_ARG_NONE, &run,
N_("Run the specified filename as javascript"), NULL },
#if WEBKIT_CHECK_VERSION (1, 1, 6)
{ "snapshot", 's', 0, G_OPTION_ARG_STRING, &snapshot,
N_("Take a snapshot of the specified URI"), NULL },
#endif
{ "execute", 'e', 0, G_OPTION_ARG_NONE, &execute,
N_("Execute the specified command"), NULL },
{ "help-execute", 0, 0, G_OPTION_ARG_NONE, &help_execute,
@ -2126,7 +2092,6 @@ main (int argc,
return 0;
}
#if WEBKIT_CHECK_VERSION (1, 1, 6)
if (snapshot)
{
gchar* filename;
@ -2157,7 +2122,6 @@ main (int argc,
g_free (filename);
return 0;
}
#endif
if (logfile)
{
@ -2231,14 +2195,10 @@ main (int argc,
{
g_object_set (settings,
"preferred-languages", "en",
#if WEBKIT_CHECK_VERSION (1, 1, 2)
"enable-private-browsing", TRUE,
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 8)
"enable-html5-database", FALSE,
"enable-html5-local-storage", FALSE,
"enable-offline-web-application-cache", FALSE,
#endif
/* Arguably DNS prefetching is or isn't a privacy concern. For the
* lack of more fine-grained control we'll go the safe route. */
"enable-dns-prefetching", FALSE,

View file

@ -229,11 +229,9 @@ midori_transferbar_confirm_delete (MidoriTransferbar* transferbar);
static void
_midori_browser_update_notebook (MidoriBrowser* browser);
#if WEBKIT_CHECK_VERSION (1, 1, 3)
void
midori_transferbar_add_download_item (MidoriTransferbar* transferbar,
WebKitDownload* download);
#endif
#define _action_by_name(brwsr, nme) \
gtk_action_group_get_action (brwsr->action_group, nme)
@ -310,10 +308,8 @@ _midori_browser_update_interface (MidoriBrowser* browser)
_action_set_sensitive (browser, "ZoomOut", midori_view_can_zoom_out (view));
_action_set_sensitive (browser, "ZoomNormal",
midori_view_get_zoom_level (view) != 1.0f);
#if WEBKIT_CHECK_VERSION (1, 1, 2)
_action_set_sensitive (browser, "Encoding",
midori_view_can_view_source (view));
#endif
_action_set_sensitive (browser, "SourceView",
midori_view_can_view_source (view));
_action_set_sensitive (browser, "Find",
@ -580,7 +576,6 @@ static void
midori_browser_set_title (MidoriBrowser* browser,
const gchar* title)
{
#if WEBKIT_CHECK_VERSION (1, 1, 2)
if (katze_object_get_boolean (browser->settings, "enable-private-browsing"))
{
gchar* window_title = g_strdup_printf (_("%s (Private Browsing)"), title);
@ -588,7 +583,6 @@ midori_browser_set_title (MidoriBrowser* browser,
g_free (window_title);
}
else
#endif
gtk_window_set_title (GTK_WINDOW (browser), title);
}
@ -922,7 +916,6 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
return return_status;
}
#if WEBKIT_CHECK_VERSION (1, 1, 3)
static gboolean
midori_browser_prepare_download (MidoriBrowser* browser,
WebKitDownload* download,
@ -982,32 +975,6 @@ midori_browser_prepare_download (MidoriBrowser* browser,
midori_transferbar_add_download_item (MIDORI_TRANSFERBAR (browser->transferbar), download);
return TRUE;
}
#else
static void
midori_browser_save_transfer_cb (KatzeNetRequest* request,
gchar* filename)
{
FILE* fp;
size_t ret;
if (request->data)
{
if ((fp = fopen (filename, "wb")))
{
ret = fwrite (request->data, 1, request->length, fp);
fclose (fp);
if ((ret - request->length) != 0)
{
/* Once we have a download interface this should be
indicated graphically. */
g_warning ("Error writing to file %s "
"in midori_browser_save_transfer_cb", filename);
}
}
}
g_free (filename);
}
#endif
static gchar*
midori_browser_save_source (const gchar* uri,
@ -1070,36 +1037,20 @@ midori_browser_save_uri (MidoriBrowser* browser,
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
{
#if WEBKIT_CHECK_VERSION (1, 1, 14)
GtkWidget* view;
GtkWidget* web_view;
WebKitWebDataSource *data_source;
WebKitWebFrame *frame;
const GString *data;
#else
WebKitNetworkRequest* request;
WebKitDownload* download;
gchar* destination;
#endif
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
folder = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog));
#if WEBKIT_CHECK_VERSION (1, 1, 14)
view = midori_browser_get_current_tab (browser);
web_view = midori_view_get_web_view (MIDORI_VIEW (view));
frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view));
data_source = webkit_web_frame_get_data_source (frame);
data = webkit_web_data_source_get_data (data_source);
midori_browser_save_source (uri, data->str, data->len, filename);
#else
request = webkit_network_request_new (uri);
download = webkit_download_new (request);
g_object_unref (request);
destination = g_filename_to_uri (filename, NULL, NULL);
if (midori_browser_prepare_download (browser, download, destination))
webkit_download_start (download);
g_free (destination);
#endif
g_free (last_dir);
last_dir = folder;
@ -1351,8 +1302,6 @@ midori_view_new_view_cb (GtkWidget* view,
}
}
#if WEBKIT_CHECK_VERSION (1, 1, 3)
static void
midori_view_download_save_as_response_cb (GtkWidget* dialog,
gint response,
@ -1461,7 +1410,6 @@ midori_view_download_requested_cb (GtkWidget* view,
}
return TRUE;
}
#endif
static void
midori_view_search_text_cb (GtkWidget* view,
@ -1579,10 +1527,8 @@ _midori_browser_add_tab (MidoriBrowser* browser,
midori_view_new_window_cb, browser,
"signal::new-view",
midori_view_new_view_cb, browser,
#if WEBKIT_CHECK_VERSION (1, 1, 3)
"signal::download-requested",
midori_view_download_requested_cb, browser,
#endif
"signal::search-text",
midori_view_search_text_cb, browser,
"signal::save-as",
@ -2466,19 +2412,15 @@ _action_edit_activate (GtkAction* action,
MidoriBrowser* browser)
{
GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
#if WEBKIT_CHECK_VERSION (1, 1, 14)
gboolean can_undo = FALSE, can_redo = FALSE;
#endif
gboolean can_cut = FALSE, can_copy = FALSE, can_paste = FALSE;
gboolean has_selection, can_select_all = FALSE;
if (WEBKIT_IS_WEB_VIEW (widget))
{
WebKitWebView* view = WEBKIT_WEB_VIEW (widget);
#if WEBKIT_CHECK_VERSION (1, 1, 14)
can_undo = webkit_web_view_can_undo (view);
can_redo = webkit_web_view_can_redo (view);
#endif
can_cut = webkit_web_view_can_cut_clipboard (view);
can_copy = webkit_web_view_can_copy_clipboard (view);
can_paste = webkit_web_view_can_paste_clipboard (view);
@ -2504,10 +2446,8 @@ _action_edit_activate (GtkAction* action,
can_select_all = TRUE;
}
#if WEBKIT_CHECK_VERSION (1, 1, 14)
_action_set_sensitive (browser, "Undo", can_undo);
_action_set_sensitive (browser, "Redo", can_redo);
#endif
_action_set_sensitive (browser, "Cut", can_cut);
_action_set_sensitive (browser, "Copy", can_copy);
_action_set_sensitive (browser, "Paste", can_paste);
@ -2515,7 +2455,6 @@ _action_edit_activate (GtkAction* action,
_action_set_sensitive (browser, "SelectAll", can_select_all);
}
#if WEBKIT_CHECK_VERSION (1, 1, 14)
static void
_action_undo_activate (GtkAction* action,
MidoriBrowser* browser)
@ -2533,7 +2472,6 @@ _action_redo_activate (GtkAction* action,
if (WEBKIT_IS_WEB_VIEW (widget))
webkit_web_view_redo (WEBKIT_WEB_VIEW (widget));
}
#endif
static void
_action_cut_activate (GtkAction* action,
@ -2881,9 +2819,7 @@ _action_tools_populate_popup (GtkAction* action,
{
{ "ManageSearchEngines" },
{ "ClearPrivateData" },
#if WEBKIT_CHECK_VERSION (1, 1, 17)
{ "InspectPage" },
#endif
{ "-" },
{ NULL },
{ "p" },
@ -3048,10 +2984,8 @@ _action_compact_menu_populate_popup (GtkAction* action,
{ "Find" },
#if !HAVE_HILDON
{ "Print" },
#if WEBKIT_CHECK_VERSION (1, 1, 17)
{ "InspectPage" },
#endif
#endif
{ NULL },
{ "PrivateBrowsing" },
#if !HAVE_HILDON
@ -3295,7 +3229,6 @@ _action_view_encoding_activate (GtkAction* action,
GtkAction* current,
MidoriBrowser* browser)
{
#if WEBKIT_CHECK_VERSION (1, 1, 2)
GtkWidget* view = midori_browser_get_current_tab (browser);
if (view)
{
@ -3326,7 +3259,6 @@ _action_view_encoding_activate (GtkAction* action,
g_object_set (web_view, "custom-encoding", encoding, NULL);
}
}
#endif
}
static gchar*
@ -3411,30 +3343,6 @@ midori_browser_save_source (const gchar* uri,
return unique_filename;
}
#if !WEBKIT_CHECK_VERSION (1, 1, 14)
static void
midori_browser_source_transfer_cb (KatzeNetRequest* request,
MidoriBrowser* browser)
{
gchar* text_editor;
gchar* filename;
filename = midori_browser_save_source (request->uri, request->data, request->length, NULL);
if (filename)
{
g_object_get (browser->settings,
"text-editor", &text_editor, NULL);
if (text_editor && *text_editor)
sokoke_spawn_program (text_editor, filename);
else
sokoke_show_uri (NULL, filename,
gtk_get_current_event_time (), NULL);
g_free (text_editor);
}
g_free (filename);
}
#endif
static void
_action_source_view_activate (GtkAction* action,
MidoriBrowser* browser)
@ -3453,7 +3361,6 @@ _action_source_view_activate (GtkAction* action,
if (!(text_editor && *text_editor))
{
#if WEBKIT_CHECK_VERSION (1, 1, 14)
GtkWidget* source;
GtkWidget* web_view;
@ -3466,28 +3373,11 @@ _action_source_view_activate (GtkAction* action,
midori_browser_add_tab (browser, source);
g_free (text_editor);
return;
#else
GError* error = NULL;
if (g_str_has_prefix (uri, "file://"))
{
if (!sokoke_show_uri_with_mime_type (gtk_widget_get_screen (view),
uri, "text/plain", gtk_get_current_event_time (), &error))
sokoke_message_dialog (GTK_MESSAGE_ERROR,
_("Could not run external program."),
error ? error->message : "", FALSE);
if (error)
g_error_free (error);
g_free (text_editor);
return;
}
#endif
}
if (g_str_has_prefix (uri, "file://"))
filename = g_filename_from_uri (uri, NULL, NULL);
#if WEBKIT_CHECK_VERSION (1, 1, 14)
else
{
WebKitWebDataSource *data_source;
@ -3506,14 +3396,9 @@ _action_source_view_activate (GtkAction* action,
sokoke_spawn_program (text_editor, filename);
g_free (filename);
}
#else
katze_net_load_uri (NULL, uri, NULL,
(KatzeNetTransferCb)midori_browser_source_transfer_cb, browser);
#endif
g_free (text_editor);
}
#if WEBKIT_CHECK_VERSION (1, 1, 6)
static void
_action_caret_browsing_activate (GtkAction* action,
MidoriBrowser* browser)
@ -3521,7 +3406,6 @@ _action_caret_browsing_activate (GtkAction* action,
g_object_set (browser->settings, "enable-caret-browsing",
!katze_object_get_boolean (browser->settings, "enable-caret-browsing"), NULL);
}
#endif
static void
_action_fullscreen_activate (GtkAction* action,
@ -3539,7 +3423,6 @@ _action_fullscreen_activate (GtkAction* action,
gtk_window_fullscreen (GTK_WINDOW (browser));
}
#if WEBKIT_CHECK_VERSION (1, 1, 4)
static void
_action_scroll_somewhere_activate (GtkAction* action,
MidoriBrowser* browser)
@ -3563,7 +3446,6 @@ _action_scroll_somewhere_activate (GtkAction* action,
else if (g_str_equal (name, "ScrollRight"))
webkit_web_view_move_cursor (web_view, GTK_MOVEMENT_VISUAL_POSITIONS, 1);
}
#endif
static gboolean
_action_navigation_activate (GtkAction* action,
@ -4543,7 +4425,6 @@ _action_clear_private_data_activate (GtkAction* action,
gtk_window_present (GTK_WINDOW (dialog));
}
#if WEBKIT_CHECK_VERSION (1, 1, 17)
static void
_action_inspect_page_activate (GtkAction* action,
MidoriBrowser* browser)
@ -4553,7 +4434,6 @@ _action_inspect_page_activate (GtkAction* action,
WebKitWebInspector* inspector = webkit_web_view_get_inspector (web_view);
webkit_web_inspector_show (inspector);
}
#endif
static void
_action_tab_move_backward_activate (GtkAction* action,
@ -5111,14 +4991,12 @@ static const GtkActionEntry entries[] =
N_("Close all open windows"), G_CALLBACK (_action_quit_activate) },
{ "Edit", NULL, N_("_Edit"), NULL, NULL, G_CALLBACK (_action_edit_activate) },
#if WEBKIT_CHECK_VERSION (1, 1, 14)
{ "Undo", GTK_STOCK_UNDO,
NULL, "<Ctrl>z",
N_("Undo the last modification"), G_CALLBACK (_action_undo_activate) },
{ "Redo", GTK_STOCK_REDO,
NULL, "<Ctrl><Shift>z",
N_("Redo the last modification"), G_CALLBACK (_action_redo_activate) },
#endif
{ "Cut", GTK_STOCK_CUT,
NULL, "<Ctrl>x",
N_("Cut the selected text"), G_CALLBACK (_action_cut_activate) },
@ -5175,15 +5053,12 @@ static const GtkActionEntry entries[] =
{ "SourceView", NULL,
N_("View So_urce"), "<Ctrl><Alt>U",
N_("View the source code of the page"), G_CALLBACK (_action_source_view_activate) },
#if WEBKIT_CHECK_VERSION (1, 1, 6)
{ "CaretBrowsing", NULL,
N_("Ca_ret Browsing"), "F7",
N_("Toggle text cursor navigation"), G_CALLBACK (_action_caret_browsing_activate) },
#endif
{ "Fullscreen", GTK_STOCK_FULLSCREEN,
NULL, "F11",
N_("Toggle fullscreen view"), G_CALLBACK (_action_fullscreen_activate) },
#if WEBKIT_CHECK_VERSION (1, 1, 4)
{ "ScrollLeft", NULL,
N_("Scroll _Left"), "h",
N_("Scroll to the left"), G_CALLBACK (_action_scroll_somewhere_activate) },
@ -5196,7 +5071,6 @@ static const GtkActionEntry entries[] =
{ "ScrollRight", NULL,
N_("Scroll _Right"), "l",
N_("Scroll to the right"), G_CALLBACK (_action_scroll_somewhere_activate) },
#endif
{ "Go", NULL, N_("_Go") },
{ "Back", GTK_STOCK_GO_BACK,
@ -5243,12 +5117,10 @@ static const GtkActionEntry entries[] =
N_("_Clear Private Data"), "<Ctrl><Shift>Delete",
N_("Clear private data..."),
G_CALLBACK (_action_clear_private_data_activate) },
#if WEBKIT_CHECK_VERSION (1, 1, 17)
{ "InspectPage", NULL,
N_("_Inspect Page"), "<Ctrl><Shift>i",
N_("Inspect page details and access developer tools..."),
G_CALLBACK (_action_inspect_page_activate) },
#endif
{ "TabPrevious", GTK_STOCK_GO_BACK,
N_("_Previous Tab"), "<Ctrl>Page_Up",
@ -5481,11 +5353,9 @@ static const gchar* ui_markup =
"<menuitem action='Quit'/>"
"</menu>"
"<menu action='Edit'>"
#if WEBKIT_CHECK_VERSION (1, 1, 14)
"<menuitem action='Undo'/>"
"<menuitem action='Redo'/>"
"<separator/>"
#endif
"<menuitem action='Cut'/>"
"<menuitem action='Copy'/>"
"<menuitem action='Paste'/>"
@ -5575,9 +5445,7 @@ static const gchar* ui_markup =
"<menuitem action='Preferences'/>"
"<menuitem action='InspectPage'/>"
"<menuitem action='ReloadUncached'/>"
#if WEBKIT_CHECK_VERSION (1, 1, 6)
"<menuitem action='CaretBrowsing'/>"
#endif
"</menu>"
"</menubar>"
"<toolbar name='toolbar_navigation'>"
@ -6058,9 +5926,6 @@ midori_browser_init (MidoriBrowser* browser)
#if HAVE_HILDON
_action_set_visible (browser, "Menubar", FALSE);
#endif
#if !WEBKIT_CHECK_VERSION (1, 1, 2)
_action_set_sensitive (browser, "Encoding", FALSE);
#endif
_action_set_sensitive (browser, "EncodingCustom", FALSE);
_action_set_visible (browser, "LastSession", FALSE);
#if !HAVE_HILDON && !defined (GDK_WINDOWING_X11)

View file

@ -355,13 +355,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
#if !HAVE_HILDON
button = katze_property_proxy (settings, "auto-load-images", NULL);
INDENTED_ADD (button);
#if WEBKIT_CHECK_VERSION (1, 1, 6)
button = katze_property_proxy (settings, "enable-spell-checking", NULL);
#else
button = katze_property_proxy (settings, "enforce-96-dpi", NULL);
gtk_button_set_label (GTK_BUTTON (button), _("Enforce 96 dots per inch"));
gtk_widget_set_tooltip_text (button, _("Enforce a video dot density of 96 DPI"));
#endif
SPANNED_ADD (button);
button = katze_property_proxy (settings, "enable-scripts", NULL);
INDENTED_ADD (button);
@ -370,12 +364,10 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
#endif
button = katze_property_proxy (settings, "zoom-text-and-images", NULL);
INDENTED_ADD (button);
#if WEBKIT_CHECK_VERSION (1, 1, 11)
button = katze_property_proxy (settings, "javascript-can-open-windows-automatically", NULL);
gtk_button_set_label (GTK_BUTTON (button), _("Allow scripts to open popups"));
gtk_widget_set_tooltip_text (button, _("Whether scripts are allowed to open popup windows automatically"));
SPANNED_ADD (button);
#endif
button = NULL;
#if WEBKIT_CHECK_VERSION (1, 1, 15) || HAVE_HILDON
if (katze_widget_has_touchscreen_mode (parent ?

View file

@ -775,115 +775,10 @@ midori_view_update_icon (MidoriView* view,
midori_view_apply_icon (view, icon, NULL);
}
static void
midori_view_icon_cb (GdkPixbuf* icon,
MidoriView* view)
{
midori_view_update_icon (view, icon);
}
typedef void (*KatzeNetIconCb) (GdkPixbuf* icon,
MidoriView* view);
typedef struct
{
gchar* icon_file;
gchar* icon_uri;
MidoriView* view;
} KatzeNetIconPriv;
static void
katze_net_icon_priv_free (KatzeNetIconPriv* priv)
{
g_free (priv->icon_file);
g_free (priv->icon_uri);
g_slice_free (KatzeNetIconPriv, priv);
}
static gboolean
katze_net_icon_status_cb (KatzeNetRequest* request,
KatzeNetIconPriv* priv)
{
switch (request->status)
{
case KATZE_NET_VERIFIED:
if (request->mime_type && strncmp (request->mime_type, "image/", 6))
{
katze_net_icon_priv_free (priv);
return FALSE;
}
break;
case KATZE_NET_MOVED:
break;
default:
katze_net_icon_priv_free (priv);
return FALSE;
}
return TRUE;
}
static void
katze_net_icon_transfer_cb (KatzeNetRequest* request,
KatzeNetIconPriv* priv)
{
GdkPixbuf* pixbuf;
FILE* fp;
GdkPixbuf* pixbuf_scaled;
gint icon_width, icon_height;
size_t ret;
GtkSettings* settings;
if (request->status == KATZE_NET_MOVED)
return;
pixbuf = NULL;
if (request->data)
{
if ((fp = fopen (priv->icon_file, "wb")))
{
ret = fwrite (request->data, 1, request->length, fp);
fclose (fp);
if ((ret - request->length) != 0)
{
g_warning ("Error writing to file %s "
"in katze_net_icon_transfer_cb()", priv->icon_file);
}
pixbuf = gdk_pixbuf_new_from_file (priv->icon_file, NULL);
}
else
pixbuf = katze_pixbuf_new_from_buffer ((guchar*)request->data,
request->length, request->mime_type, NULL);
if (pixbuf)
g_object_ref (pixbuf);
g_hash_table_insert (priv->view->memory,
g_strdup (priv->icon_file), pixbuf);
}
if (!pixbuf)
{
midori_view_icon_cb (NULL, priv->view);
katze_net_icon_priv_free (priv);
return;
}
settings = gtk_widget_get_settings (priv->view->web_view);
gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
&icon_width, &icon_height);
pixbuf_scaled = gdk_pixbuf_scale_simple (pixbuf, icon_width, icon_height,
GDK_INTERP_BILINEAR);
g_object_unref (pixbuf);
katze_assign (priv->view->icon_uri, g_strdup (priv->icon_uri));
midori_view_icon_cb (pixbuf_scaled, priv->view);
katze_net_icon_priv_free (priv);
}
static void
_midori_web_view_load_icon (MidoriView* view)
{
GdkPixbuf* pixbuf;
KatzeNetIconPriv* priv;
gchar* icon_uri;
gchar* icon_file;
gint icon_width, icon_height;
@ -927,17 +822,6 @@ _midori_web_view_load_icon (MidoriView* view)
g_free (icon_file);
katze_assign (view->icon_uri, icon_uri);
}
else if (!view->special)
{
priv = g_slice_new (KatzeNetIconPriv);
priv->icon_file = icon_file;
priv->icon_uri = icon_uri;
priv->view = view;
katze_net_load_uri (NULL, icon_uri,
(KatzeNetStatusCb)katze_net_icon_status_cb,
(KatzeNetTransferCb)katze_net_icon_transfer_cb, priv);
}
}
if (pixbuf)
@ -1112,7 +996,6 @@ webkit_web_view_progress_changed_cb (WebKitWebView* web_view,
g_object_notify (G_OBJECT (view), "progress");
}
#if WEBKIT_CHECK_VERSION (1, 1, 14)
static void
midori_view_web_view_resource_request_cb (WebKitWebView* web_view,
WebKitWebFrame* web_frame,
@ -1220,7 +1103,6 @@ midori_view_web_view_resource_request_cb (WebKitWebView* web_view,
}
}
}
#endif
#define HAVE_GTK_INFO_BAR GTK_CHECK_VERSION (2, 18, 0)
@ -1339,7 +1221,6 @@ midori_view_add_info_bar (MidoriView* view,
return infobar;
}
#if WEBKIT_CHECK_VERSION (1, 1, 14)
static void
midori_view_database_response_cb (GtkWidget* infobar,
gint response,
@ -1370,7 +1251,6 @@ midori_view_web_view_database_quota_exceeded_cb (WebKitWebView* web_view,
NULL);
g_free (message);
}
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 23)
static void
@ -1414,19 +1294,10 @@ midori_view_load_alternate_string (MidoriView* view,
if (!web_frame)
web_frame = webkit_web_view_get_main_frame (web_view);
view->special = TRUE;
#if WEBKIT_CHECK_VERSION (1, 1, 14)
webkit_web_frame_load_alternate_string (
web_frame, data, uri, uri);
#elif WEBKIT_CHECK_VERSION (1, 1, 6)
webkit_web_frame_load_alternate_string (
web_frame, data, res_root, uri);
#else
webkit_web_view_load_html_string (
web_view, data, res_root);
#endif
}
#if WEBKIT_CHECK_VERSION (1, 1, 6)
static gboolean
midori_view_display_error (MidoriView* view,
const gchar* uri,
@ -1443,24 +1314,13 @@ midori_view_display_error (MidoriView* view,
g_free (template_file);
if (g_file_get_contents (path, &template, NULL, NULL))
{
#if !WEBKIT_CHECK_VERSION (1, 1, 14)
SoupServer* res_server;
guint port;
#endif
gchar* res_root;
gchar* stock_root;
gchar* title_escaped;
gchar* result;
#if WEBKIT_CHECK_VERSION (1, 1, 14)
res_root = g_strdup ("res:/");
stock_root = g_strdup ("stock:/");
#else
res_server = sokoke_get_res_server ();
port = soup_server_get_port (res_server);
res_root = g_strdup_printf ("http://localhost:%d/res", port);
stock_root = g_strdup_printf ("http://localhost:%d/stock", port);
#endif
title_escaped = g_markup_escape_text (title, -1);
result = sokoke_replace_variables (template,
@ -1519,44 +1379,6 @@ webkit_web_view_load_error_cb (WebKitWebView* web_view,
g_free (title);
return result;
}
#else
static void
webkit_web_frame_load_done_cb (WebKitWebFrame* web_frame,
gboolean success,
MidoriView* view)
{
if (!success)
{
gchar* title;
gchar* data;
gchar* logo_path;
gchar* logo_uri;
/* i18n: The title of the 404 - Not found error page */
title = g_strdup_printf (_("Not found - %s"), view->uri);
katze_assign (view->title, title);
logo_path = sokoke_find_data_filename ("midori/res/logo-shade.png");
logo_uri = g_filename_to_uri (logo_path, NULL, NULL);
g_free (logo_path);
data = g_strdup_printf (
"<html><head><title>%s</title></head>"
"<body><h1>%s</h1>"
"<img src=\"%s\" "
"style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">"
"<p />The page you were opening doesn't exist."
"<p />Try to <a href=\"%s\">load the page again</a>, "
"or move on to another page."
"</body></html>",
title, title, logo_uri, view->uri);
webkit_web_view_load_html_string (
WEBKIT_WEB_VIEW (view->web_view), data, view->uri);
g_free (title);
g_free (data);
g_free (logo_uri);
}
midori_view_update_load_status (view, MIDORI_LOAD_FINISHED);
}
#endif
static void
midori_view_apply_scroll_position (MidoriView* view)
@ -1662,7 +1484,6 @@ midori_web_view_notify_icon_uri_cb (WebKitWebView* web_view,
}
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 4)
static void
webkit_web_view_notify_uri_cb (WebKitWebView* web_view,
GParamSpec* pspec,
@ -1681,16 +1502,6 @@ webkit_web_view_notify_title_cb (WebKitWebView* web_view,
midori_view_set_title (view, title);
g_object_notify (G_OBJECT (view), "title");
}
#else
static void
webkit_web_view_title_changed_cb (WebKitWebView* web_view,
WebKitWebFrame* web_frame,
const gchar* title,
MidoriView* view)
{
g_object_set (view, "title", title, NULL);
}
#endif
static void
webkit_web_view_statusbar_text_changed_cb (WebKitWebView* web_view,
@ -2250,15 +2061,6 @@ midori_web_view_menu_copy_activate_cb (GtkWidget* widget,
}
#endif
#if !WEBKIT_CHECK_VERSION (1, 1, 3)
static void
midori_web_view_menu_save_as_activate_cb (GtkWidget* widget,
MidoriView* view)
{
g_signal_emit (view, signals[SAVE_AS], 0, view->link_uri);
}
#endif
static void
midori_view_tab_label_menu_window_new_cb (GtkWidget* menuitem,
GtkWidget* view)
@ -2267,7 +2069,6 @@ midori_view_tab_label_menu_window_new_cb (GtkWidget* menuitem,
midori_view_get_display_uri (MIDORI_VIEW (view)));
}
#if WEBKIT_CHECK_VERSION (1, 1, 17)
static void
midori_web_view_menu_inspect_element_activate_cb (GtkWidget* widget,
MidoriView* view)
@ -2281,7 +2082,6 @@ midori_web_view_menu_inspect_element_activate_cb (GtkWidget* widget,
webkit_web_inspector_inspect_coordinates (inspector, x, y);
webkit_web_inspector_show (inspector);
}
#endif
static GtkWidget*
midori_view_insert_menu_item (GtkMenuShell* menu,
@ -2406,7 +2206,6 @@ midori_view_populate_popup (MidoriView* view,
if (is_editable)
{
#if WEBKIT_CHECK_VERSION (1, 1, 14)
menuitem = gtk_separator_menu_item_new ();
gtk_menu_shell_prepend (menu_shell, menuitem);
gtk_widget_show (menuitem);
@ -2420,7 +2219,6 @@ midori_view_populate_popup (MidoriView* view,
gtk_widget_set_sensitive (menuitem,
webkit_web_view_can_undo (web_view));
gtk_menu_shell_prepend (menu_shell, menuitem);
#endif
if (manual)
{
menuitem = sokoke_action_create_popup_menu_item (
@ -2450,7 +2248,6 @@ midori_view_populate_popup (MidoriView* view,
gtk_action_group_get_action (actions, "SelectAll"));
gtk_menu_shell_append (menu_shell, menuitem);
/* FIXME: We are missing Font, Input Methods and Insert Character */
#if WEBKIT_CHECK_VERSION (1, 1, 17)
if (katze_object_get_boolean (view->settings, "enable-developer-extras"))
{
menuitem = gtk_separator_menu_item_new ();
@ -2464,7 +2261,6 @@ midori_view_populate_popup (MidoriView* view,
g_object_set_data (G_OBJECT (menuitem), "x", GINT_TO_POINTER (x));
g_object_set_data (G_OBJECT (menuitem), "y", GINT_TO_POINTER (y));
}
#endif
}
return;
}
@ -2579,20 +2375,11 @@ midori_view_populate_popup (MidoriView* view,
gtk_label_set_label (GTK_LABEL (label), _("Open Link in New _Window"));
menuitem = (GtkWidget*)g_list_nth_data (items, 3);
g_list_free (items);
#if WEBKIT_CHECK_VERSION (1, 1, 3)
/* hack to localize menu item */
label = gtk_bin_get_child (GTK_BIN (menuitem));
GtkStockItem stock_item;
if (gtk_stock_lookup (GTK_STOCK_SAVE_AS, &stock_item))
gtk_label_set_label (GTK_LABEL (label), stock_item.label);
#else
/* hack to disable non-functional Download File */
gtk_widget_hide (menuitem);
gtk_widget_set_no_show_all (menuitem, TRUE);
midori_view_insert_menu_item (menu_shell, 3,
NULL, GTK_STOCK_SAVE_AS,
G_CALLBACK (midori_web_view_menu_save_as_activate_cb), widget);
#endif
}
#endif
@ -2827,7 +2614,6 @@ midori_view_populate_popup (MidoriView* view,
}
}
#if WEBKIT_CHECK_VERSION (1, 1, 17)
if ((!is_document || manual)
&& katze_object_get_boolean (view->settings, "enable-developer-extras"))
{
@ -2838,7 +2624,6 @@ midori_view_populate_popup (MidoriView* view,
g_object_set_data (G_OBJECT (menuitem), "x", GINT_TO_POINTER (x));
g_object_set_data (G_OBJECT (menuitem), "y", GINT_TO_POINTER (y));
}
#endif
gtk_widget_show_all (menu);
}
@ -2931,15 +2716,12 @@ webkit_web_view_mime_type_decision_cb (GtkWidget* web_view,
WebKitWebPolicyDecision* decision,
MidoriView* view)
{
#if WEBKIT_CHECK_VERSION (1, 1, 3)
GtkWidget* dialog;
gchar* content_type;
gchar* description;
gchar* file_type;
#if WEBKIT_CHECK_VERSION (1, 1, 14)
WebKitWebDataSource* datasource;
WebKitNetworkRequest* original_request;
#endif
const gchar* original_uri;
gchar** fingerprint;
#if GTK_CHECK_VERSION (2, 14, 0)
@ -2950,16 +2732,12 @@ webkit_web_view_mime_type_decision_cb (GtkWidget* web_view,
GdkScreen* screen;
GtkIconTheme* icon_theme;
gint response;
#else
gchar* uri;
#endif
if (web_frame != webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view)))
return FALSE;
if (webkit_web_view_can_show_mime_type (WEBKIT_WEB_VIEW (web_view), mime_type))
{
#if WEBKIT_CHECK_VERSION (1, 1, 14)
gboolean view_source = FALSE;
/* Dedicated source code views are always pseudo-blank pages */
if (midori_view_is_blank (view))
@ -2970,7 +2748,6 @@ webkit_web_view_mime_type_decision_cb (GtkWidget* web_view,
|| !strcmp (mime_type, "text/xml")))
view_source = TRUE;
webkit_web_view_set_view_source_mode (WEBKIT_WEB_VIEW (web_view), view_source);
#endif
katze_assign (view->mime_type, g_strdup (mime_type));
midori_view_update_icon (view, NULL);
@ -2979,7 +2756,6 @@ webkit_web_view_mime_type_decision_cb (GtkWidget* web_view,
return FALSE;
}
#if WEBKIT_CHECK_VERSION (1, 1, 3)
dialog = gtk_message_dialog_new (
NULL, 0, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
_("Open or download file"));
@ -3007,14 +2783,10 @@ webkit_web_view_mime_type_decision_cb (GtkWidget* web_view,
g_free (description);
/* Link Fingerprint */
#if WEBKIT_CHECK_VERSION (1, 1, 14)
/* We look at the original URI because redirection would lose the fragment */
datasource = webkit_web_frame_get_provisional_data_source (web_frame);
original_request = webkit_web_data_source_get_initial_request (datasource);
original_uri = webkit_network_request_get_uri (original_request);
#else
original_uri = webkit_network_request_get_uri (request);
#endif
fingerprint = g_strsplit (original_uri, "#!md5!", 2);
if (fingerprint && fingerprint[0] && fingerprint[1])
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
@ -3079,28 +2851,14 @@ webkit_web_view_mime_type_decision_cb (GtkWidget* web_view,
webkit_web_view_stop_loading (WEBKIT_WEB_VIEW (view->web_view));
return FALSE;
}
#else
katze_assign (view->mime_type, NULL);
midori_view_update_icon (view, NULL);
g_object_notify (G_OBJECT (view), "mime-type");
uri = g_strdup_printf ("error:nodisplay %s",
webkit_network_request_get_uri (request));
midori_view_set_uri (view, uri);
g_free (uri);
return TRUE;
#endif
}
#if WEBKIT_CHECK_VERSION (1, 1, 3)
static gboolean
webkit_web_view_download_requested_cb (GtkWidget* web_view,
WebKitDownload* download,
MidoriView* view)
{
gboolean handled;
#if WEBKIT_CHECK_VERSION (1, 1, 14)
/* Propagate original URI to make it available when the download finishes */
WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view));
WebKitWebDataSource* datasource = webkit_web_frame_get_provisional_data_source (web_frame);
@ -3109,7 +2867,6 @@ webkit_web_view_download_requested_cb (GtkWidget* web_view,
WebKitNetworkRequest* request = webkit_download_get_network_request (download);
g_object_set_data_full (G_OBJECT (request), "midori-original-uri",
g_strdup (original_uri), g_free);
#endif
g_object_set_data (G_OBJECT (download), "open-download",
g_object_get_data (G_OBJECT (view), "open-download"));
g_object_set_data (G_OBJECT (download), "save-as-download",
@ -3119,7 +2876,6 @@ webkit_web_view_download_requested_cb (GtkWidget* web_view,
g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled);
return handled;
}
#endif
static gboolean
webkit_web_view_console_message_cb (GtkWidget* web_view,
@ -3165,7 +2921,6 @@ midori_view_web_view_script_alert_cb (GtkWidget* web_view,
return TRUE;
}
#if WEBKIT_CHECK_VERSION (1, 1, 5)
static gboolean
midori_view_web_view_print_requested_cb (GtkWidget* web_view,
WebKitWebFrame* web_frame,
@ -3174,7 +2929,6 @@ midori_view_web_view_print_requested_cb (GtkWidget* web_view,
midori_view_print (view);
return TRUE;
}
#endif
static void
webkit_web_view_window_object_cleared_cb (GtkWidget* web_view,
@ -3183,7 +2937,6 @@ webkit_web_view_window_object_cleared_cb (GtkWidget* web_view,
JSObjectRef js_window,
MidoriView* view)
{
#if WEBKIT_CHECK_VERSION (1, 1, 2)
if (katze_object_get_boolean (view->settings, "enable-private-browsing"))
{
/* Mask language, architecture, no plugin list */
@ -3199,7 +2952,6 @@ webkit_web_view_window_object_cleared_cb (GtkWidget* web_view,
NULL);
g_free (result);
}
#endif
g_signal_emit (view, signals[CONTEXT_READY], 0, js_context);
}
@ -3765,14 +3517,10 @@ midori_view_construct_web_view (MidoriView* view)
g_object_connect (view->web_view,
"signal::navigation-policy-decision-requested",
midori_view_web_view_navigation_decision_cb, view,
#if WEBKIT_CHECK_VERSION (1, 1, 14)
"signal::resource-request-starting",
midori_view_web_view_resource_request_cb, view,
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 14)
"signal::database-quota-exceeded",
midori_view_web_view_database_quota_exceeded_cb, view,
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 23)
"signal::geolocation-policy-decision-requested",
midori_view_web_view_geolocation_decision_cb, view,
@ -3789,15 +3537,10 @@ midori_view_construct_web_view (MidoriView* view)
"signal::notify::icon-uri",
midori_web_view_notify_icon_uri_cb, view,
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 4)
"signal::notify::uri",
webkit_web_view_notify_uri_cb, view,
"signal::notify::title",
webkit_web_view_notify_title_cb, view,
#else
"signal::title-changed",
webkit_web_view_title_changed_cb, view,
#endif
"signal::status-bar-text-changed",
webkit_web_view_statusbar_text_changed_cb, view,
"signal::leave-notify-event",
@ -3822,27 +3565,14 @@ midori_view_construct_web_view (MidoriView* view)
webkit_web_view_create_web_view_cb, view,
"signal-after::mime-type-policy-decision-requested",
webkit_web_view_mime_type_decision_cb, view,
#if WEBKIT_CHECK_VERSION (1, 1, 3)
"signal::download-requested",
webkit_web_view_download_requested_cb, view,
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 5)
"signal::print-requested",
midori_view_web_view_print_requested_cb, view,
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 6)
"signal-after::load-error",
webkit_web_view_load_error_cb, view,
#endif
NULL);
#if !WEBKIT_CHECK_VERSION (1, 1, 6)
g_object_connect (web_frame,
"signal::load-done",
webkit_web_frame_load_done_cb, view,
NULL);
#endif
if (view->settings)
{
g_object_set (view->web_view, "settings", view->settings,
@ -4083,10 +3813,6 @@ midori_view_set_uri (MidoriView* view,
{
if (!strcmp (uri, ""))
{
#if !WEBKIT_CHECK_VERSION (1, 1, 14)
SoupServer* res_server;
guint port;
#endif
gchar* res_root;
gchar* speed_dial_head;
gchar* speed_dial_body;
@ -4109,15 +3835,8 @@ midori_view_set_uri (MidoriView* view,
if (G_UNLIKELY (!speed_dial_head))
speed_dial_head = g_strdup ("");
#if WEBKIT_CHECK_VERSION (1, 1, 14)
res_root = g_strdup ("res:/");
stock_root = g_strdup ("stock:/");
#else
res_server = sokoke_get_res_server ();
port = soup_server_get_port (res_server);
res_root = g_strdup_printf ("http://localhost:%d/res", port);
stock_root = g_strdup_printf ("http://localhost:%d/stock", port);
#endif
data = sokoke_replace_variables (speed_dial_head,
"{res}", res_root,
@ -4161,30 +3880,6 @@ midori_view_set_uri (MidoriView* view,
else if (g_str_has_prefix (uri, "error:") || g_str_has_prefix (uri, "about:"))
{
data = NULL;
#if !WEBKIT_CHECK_VERSION (1, 1, 3)
if (!strncmp (uri, "error:nodisplay ", 16))
{
gchar* title;
gchar* logo_path;
gchar* logo_uri;
katze_assign (view->uri, g_strdup (&uri[16]));
title = g_strdup_printf (_("Document cannot be displayed"));
logo_path = sokoke_find_data_filename ("midori/res/logo-shade.png");
logo_uri = g_filename_to_uri (logo_path, NULL, NULL);
g_free (logo_path);
data = g_strdup_printf (
"<html><head><title>%s</title></head>"
"<body><h1>%s</h1>"
"<img src=\"%s\" "
"style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">"
"<p />The document %s of type '%s' cannot be displayed."
"</body></html>",
title, title, logo_uri, view->uri, view->mime_type);
g_free (title);
g_free (logo_uri);
}
#endif
if (!strncmp (uri, "error:nodocs ", 13))
{
gchar* title;
@ -4305,7 +4000,6 @@ midori_view_set_uri (MidoriView* view,
g_object_notify (G_OBJECT (view), "uri");
return;
}
#if WEBKIT_CHECK_VERSION (1, 1, 6)
else if (g_str_has_prefix (uri, "pause:"))
{
katze_assign (view->uri, g_strdup (&uri[6]));
@ -4318,7 +4012,6 @@ midori_view_set_uri (MidoriView* view,
katze_item_set_uri (view->item, uri);
g_object_notify (G_OBJECT (view), "uri");
}
#endif
else if (g_str_has_prefix (uri, "javascript:"))
{
gboolean result;
@ -5144,22 +4837,9 @@ void
midori_view_reload (MidoriView* view,
gboolean from_cache)
{
gchar* title;
g_return_if_fail (MIDORI_IS_VIEW (view));
#if WEBKIT_CHECK_VERSION (1, 1, 14)
title = NULL;
#elif WEBKIT_CHECK_VERSION (1, 1, 6)
/* WebKit 1.1.6 doesn't handle "alternate content" flawlessly,
so reloading via Javascript works but not via API calls. */
title = g_strdup_printf (_("Error - %s"), view->uri);
#else
/* Error pages are special, we want to try loading the destination
again, not the error page which isn't even a proper page */
title = g_strdup_printf (_("Error - %s"), view->uri);
#endif
if (view->title && title && strstr (title, view->title))
if (view->title)
webkit_web_view_open (WEBKIT_WEB_VIEW (view->web_view), view->uri);
else if (!(view->uri && *view->uri && strncmp (view->uri, "about:", 6)))
{
@ -5172,8 +4852,6 @@ midori_view_reload (MidoriView* view,
else
webkit_web_view_reload_bypass_cache (WEBKIT_WEB_VIEW (view->web_view));
katze_item_set_meta_integer (view->item, "delay", -1);
g_free (title);
}
/**
@ -5329,7 +5007,6 @@ midori_view_get_next_page (MidoriView* view)
return uri && uri[0] != '0' ? uri : NULL;
}
#if WEBKIT_CHECK_VERSION (1, 1, 5)
static GtkWidget*
midori_view_print_create_custom_widget_cb (GtkPrintOperation* operation,
MidoriView* view)
@ -5347,7 +5024,6 @@ midori_view_print_create_custom_widget_cb (GtkPrintOperation* operation,
return box;
}
#endif
static void
midori_view_print_response_cb (GtkWidget* dialog,
@ -5367,15 +5043,12 @@ void
midori_view_print (MidoriView* view)
{
WebKitWebFrame* frame;
#if WEBKIT_CHECK_VERSION (1, 1, 5)
GtkPrintOperation* operation;
GError* error;
#endif
g_return_if_fail (MIDORI_IS_VIEW (view));
frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view));
#if WEBKIT_CHECK_VERSION (1, 1, 5)
operation = gtk_print_operation_new ();
gtk_print_operation_set_custom_tab_label (operation, _("Features"));
#if GTK_CHECK_VERSION (2, 18, 0)
@ -5401,9 +5074,6 @@ midori_view_print (MidoriView* view)
G_CALLBACK (midori_view_print_response_cb), NULL);
gtk_widget_show (dialog);
}
#else
webkit_web_frame_print (frame);
#endif
}
/**

View file

@ -198,9 +198,7 @@ midori_startup_get_type (void)
{ MIDORI_STARTUP_BLANK_PAGE, "MIDORI_STARTUP_BLANK_PAGE", N_("Show Speed Dial") },
{ MIDORI_STARTUP_HOMEPAGE, "MIDORI_STARTUP_HOMEPAGE", N_("Show Homepage") },
{ MIDORI_STARTUP_LAST_OPEN_PAGES, "MIDORI_STARTUP_LAST_OPEN_PAGES", N_("Show last open tabs") },
#if WEBKIT_CHECK_VERSION (1, 1, 6)
{ MIDORI_STARTUP_DELAYED_PAGES, "MIDORI_STARTUP_DELAYED_PAGES", N_("Show last tabs without loading") },
#endif
{ 0, NULL, NULL }
};
type = g_enum_register_static ("MidoriStartup", values);
@ -565,11 +563,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
_("Save downloaded files to:"),
_("The folder downloaded files are saved to"),
midori_get_download_dir (),
#if WEBKIT_CHECK_VERSION (1, 1, 3)
flags));
#else
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
#endif
g_object_class_install_property (gobject_class,
PROP_TEXT_EDITOR,
@ -732,7 +726,6 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
"Enable special extensions for developers",
TRUE,
flags));
#if WEBKIT_CHECK_VERSION (1, 1, 6)
g_object_class_install_property (gobject_class,
PROP_ENABLE_SPELL_CHECKING,
g_param_spec_boolean ("enable-spell-checking",
@ -740,8 +733,6 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
_("Enable spell checking while typing"),
TRUE,
flags));
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 8)
g_object_class_install_property (gobject_class,
PROP_ENABLE_HTML5_DATABASE,
g_param_spec_boolean ("enable-html5-database",
@ -756,7 +747,6 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
_("Whether to enable HTML5 local storage support"),
FALSE,
flags));
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 13)
g_object_class_install_property (gobject_class,
PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE,
@ -1308,13 +1298,10 @@ midori_web_settings_set_property (GObject* object,
g_object_set (web_settings, "WebKitWebSettings::enable-developer-extras",
g_value_get_boolean (value), NULL);
break;
#if WEBKIT_CHECK_VERSION (1, 1, 6)
case PROP_ENABLE_SPELL_CHECKING:
g_object_set (web_settings, "WebKitWebSettings::enable-spell-checking",
g_value_get_boolean (value), NULL);
break;
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 8)
case PROP_ENABLE_HTML5_DATABASE:
g_object_set (web_settings, "WebKitWebSettings::enable-html5-database",
g_value_get_boolean (value), NULL);
@ -1323,13 +1310,10 @@ midori_web_settings_set_property (GObject* object,
g_object_set (web_settings, "WebKitWebSettings::enable-html5-local-storage",
g_value_get_boolean (value), NULL);
break;
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 13)
case PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE:
g_object_set (web_settings, "WebKitWebSettings::enable-offline-web-application-cache",
g_value_get_boolean (value), NULL);
break;
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 18)
case PROP_ENABLE_PAGE_CACHE:
g_object_set (web_settings, "WebKitWebSettings::enable-page-cache",
@ -1370,27 +1354,19 @@ midori_web_settings_set_property (GObject* object,
{
gchar* string = generate_ident_string (web_settings->identify_as);
katze_assign (web_settings->ident_string, string);
#if WEBKIT_CHECK_VERSION (1, 1, 11)
g_object_set (web_settings, "user-agent", string, NULL);
#else
g_object_notify (object, "user-agent");
#endif
}
break;
case PROP_USER_AGENT:
if (web_settings->identify_as == MIDORI_IDENT_CUSTOM)
katze_assign (web_settings->ident_string, g_value_dup_string (value));
#if WEBKIT_CHECK_VERSION (1, 1, 11)
g_object_set (web_settings, "WebKitWebSettings::user-agent",
web_settings->ident_string, NULL);
#endif
break;
case PROP_PREFERRED_LANGUAGES:
katze_assign (web_settings->http_accept_language, g_value_dup_string (value));
#if WEBKIT_CHECK_VERSION (1, 1, 6)
g_object_set (web_settings, "spell-checking-languages",
web_settings->http_accept_language, NULL);
#endif
break;
case PROP_CLEAR_PRIVATE_DATA:
web_settings->clear_private_data = g_value_get_int (value);
@ -1577,13 +1553,10 @@ midori_web_settings_get_property (GObject* object,
g_value_set_boolean (value, katze_object_get_boolean (web_settings,
"WebKitWebSettings::enable-developer-extras"));
break;
#if WEBKIT_CHECK_VERSION (1, 1, 6)
case PROP_ENABLE_SPELL_CHECKING:
g_value_set_boolean (value, katze_object_get_boolean (web_settings,
"WebKitWebSettings::enable-spell-checking"));
break;
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 8)
case PROP_ENABLE_HTML5_DATABASE:
g_value_set_boolean (value, katze_object_get_boolean (web_settings,
"WebKitWebSettings::enable-html5-database"));
@ -1592,7 +1565,6 @@ midori_web_settings_get_property (GObject* object,
g_value_set_boolean (value, katze_object_get_boolean (web_settings,
"WebKitWebSettings::enable-html5-local-storage"));
break;
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 13)
case PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE:
g_value_set_boolean (value, katze_object_get_boolean (web_settings,

View file

@ -203,7 +203,7 @@ def configure (conf):
includes='/usr/X11R6/include', mandatory=False)
conf.check (lib='Xss', libpath='/usr/X11R6/lib', mandatory=False)
check_pkg ('gtk+-2.0', '2.10.0', var='GTK', args=args)
check_pkg ('webkit-1.0', '1.1.4', args=args)
check_pkg ('webkit-1.0', '1.1.14', args=args)
check_pkg ('libsoup-2.4', '2.25.2')
conf.define ('HAVE_LIBSOUP_2_25_2', 1)
check_pkg ('libsoup-2.4', '2.27.90', False, var='LIBSOUP_2_27_90')