Show URL in New Tab menu item only over selections

This commit is contained in:
Christian Dywan 2008-10-18 23:21:06 +02:00
parent 51d111d85c
commit 952729e4ae

View file

@ -895,8 +895,10 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view,
GList* items; GList* items;
gboolean has_selection; gboolean has_selection;
/* We do not want to modify the Edit menu. has_selection = midori_view_has_selection (view);
The only reliable indicator is inspecting the first item. */
/* Unfortunately inspecting the menu is the only way to
determine that the mouse is over a text area or selection. */
items = gtk_container_get_children (GTK_CONTAINER (menu)); items = gtk_container_get_children (GTK_CONTAINER (menu));
menuitem = (GtkWidget*)g_list_nth_data (items, 0); menuitem = (GtkWidget*)g_list_nth_data (items, 0);
if (GTK_IS_IMAGE_MENU_ITEM (menuitem)) if (GTK_IS_IMAGE_MENU_ITEM (menuitem))
@ -905,10 +907,10 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view,
gtk_image_get_stock (GTK_IMAGE (icon), &stock_id, NULL); gtk_image_get_stock (GTK_IMAGE (icon), &stock_id, NULL);
if (!strcmp (stock_id, GTK_STOCK_CUT)) if (!strcmp (stock_id, GTK_STOCK_CUT))
return; return;
if (strcmp (stock_id, GTK_STOCK_FIND))
has_selection = FALSE;
} }
has_selection = midori_view_has_selection (view);
if (view->link_uri) if (view->link_uri)
{ {
menuitem = gtk_image_menu_item_new_with_mnemonic ( menuitem = gtk_image_menu_item_new_with_mnemonic (