From d844231d3ff566547bb400140af55da4b8a8c476 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Thu, 17 Jan 2013 23:55:07 +0100 Subject: Remove ability to open URIs in the clipboard through middle click This is disabled by default, pretty obscure, and problematic to port properly to WebKit2. So just drop the code. --- data/epiphany.convert | 1 - data/org.gnome.epiphany.gschema.xml | 5 --- lib/ephy-prefs.h | 1 - src/ephy-window.c | 78 ------------------------------------- 4 files changed, 85 deletions(-) diff --git a/data/epiphany.convert b/data/epiphany.convert index 66b37aff8..b73024cd5 100644 --- a/data/epiphany.convert +++ b/data/epiphany.convert @@ -3,7 +3,6 @@ user-agent = /apps/epiphany/general/user_agent new-windows-in-tabs = /apps/epiphany/general/open_new_windows_in_tab automatic-downloads = /apps/epiphany/general/automatic_downloads warn-on-close-unsubmitted-data = /apps/epiphany/dialogs/warn_on_close_unsubmitted_data -middle-click-opens-url = /apps/epiphany/general/middle_click_open_url remember-passwords = /apps/epiphany/general/remember_passwords keyword-search-url = /apps/epiphany/general/url_search managed-network = /apps/epiphany/general/managed_network diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml index c94df5fd1..becb0a23d 100644 --- a/data/org.gnome.epiphany.gschema.xml +++ b/data/org.gnome.epiphany.gschema.xml @@ -24,11 +24,6 @@ Automatic downloads When files cannot be opened by the browser they are automatically downloaded to the download folder and opened with the appropriate application. - - false - Middle click to open the web page pointed to by the currently selected text - Middle clicking on the main view pane will open the web page pointed to by the currently selected text. - true Force new windows to be opened in tabs diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h index b95458310..c390e37a1 100644 --- a/lib/ephy-prefs.h +++ b/lib/ephy-prefs.h @@ -116,7 +116,6 @@ typedef enum #define EPHY_PREFS_NEW_WINDOWS_IN_TABS "new-windows-in-tabs" #define EPHY_PREFS_AUTO_DOWNLOADS "automatic-downloads" #define EPHY_PREFS_WARN_ON_CLOSE_UNSUBMITTED_DATA "warn-on-close-unsubmitted-data" -#define EPHY_PREFS_MIDDLE_CLICK_OPENS_URL "middle-click-opens-url" #define EPHY_PREFS_REMEMBER_PASSWORDS "remember-passwords" #define EPHY_PREFS_KEYWORD_SEARCH_URL "keyword-search-url" #define EPHY_PREFS_MANAGED_NETWORK "managed-network" diff --git a/src/ephy-window.c b/src/ephy-window.c index 4fd14a9f7..548df0233 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -2137,81 +2137,6 @@ save_target_uri (EphyWindow *window, return retval; } -typedef struct -{ - EphyWindow *window; - EphyEmbed *embed; -} ClipboardTextCBData; - -static void -clipboard_text_received_cb (GtkClipboard *clipboard, - const char *text, - ClipboardTextCBData *data) -{ - if (data->embed != NULL && text != NULL) - { - ephy_link_open (EPHY_LINK (data->window), text, data->embed, 0); - } - - if (data->embed != NULL) - { - EphyEmbed **embed_ptr = &(data->embed); - g_object_remove_weak_pointer (G_OBJECT (data->embed), (gpointer *) embed_ptr); - } - - g_slice_free (ClipboardTextCBData, data); -} - -static gboolean -open_selected_url (EphyWindow *window, - WebKitWebView *view, - GdkEventButton *event, - WebKitHitTestResult *hit_test_result) -{ - guint context; - ClipboardTextCBData *cb_data; - EphyEmbed *embed; - EphyEmbed **embed_ptr; - - if (!g_settings_get_boolean (EPHY_SETTINGS_MAIN, EPHY_PREFS_MIDDLE_CLICK_OPENS_URL) || - g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN, EPHY_PREFS_LOCKDOWN_ARBITRARY_URL)) - { - return FALSE; - } - - g_object_get (hit_test_result, "context", &context, NULL); - - LOG ("ephy_window_dom_mouse_click_cb: button %d, context %d, modifier %d (%d:%d)", - event->button, context, event->state, (int)event->x, (int)event->y); - - if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK || - context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE) - { - return FALSE; - } - - /* See bug #133633 for why we do it this way */ - - /* We need to make sure we know if the embed is destroyed - * between requesting the clipboard contents, and receiving - * them. - */ - embed = EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (view); - - cb_data = g_slice_new0 (ClipboardTextCBData); - cb_data->embed = embed; - cb_data->window = window; - embed_ptr = &cb_data->embed; - - g_object_add_weak_pointer (G_OBJECT (embed), (gpointer *) embed_ptr); - - gtk_clipboard_request_text (gtk_widget_get_clipboard (GTK_WIDGET (embed), - GDK_SELECTION_PRIMARY), - (GtkClipboardTextReceivedFunc) clipboard_text_received_cb, - cb_data); - return TRUE; -} - static gboolean ephy_window_dom_mouse_click_cb (WebKitWebView *view, GdkEventButton *event, @@ -2231,9 +2156,6 @@ ephy_window_dom_mouse_click_cb (WebKitWebView *view, case GDK_BUTTON_PRIMARY: handled = save_target_uri (window, view, event, hit_test_result); break; - case GDK_BUTTON_MIDDLE: - handled = open_selected_url (window, view, event, hit_test_result); - break; #ifndef HAVE_WEBKIT2 case GDK_BUTTON_SECONDARY: show_embed_popup (window, view, event, hit_test_result); -- cgit v1.2.3