Optimize view popup population

This commit is contained in:
Enrico Tröger 2008-10-18 22:50:58 +02:00 committed by Christian Dywan
parent 3a9071a761
commit 51d111d85c

View file

@ -893,6 +893,7 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view,
GdkScreen* screen;
GtkIconTheme* icon_theme;
GList* items;
gboolean has_selection;
/* We do not want to modify the Edit menu.
The only reliable indicator is inspecting the first item. */
@ -906,6 +907,8 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view,
return;
}
has_selection = midori_view_has_selection (view);
if (view->link_uri)
{
menuitem = gtk_image_menu_item_new_with_mnemonic (
@ -949,7 +952,7 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view,
gtk_widget_show (menuitem);
}
if (!view->link_uri && midori_view_has_selection (view))
if (!view->link_uri && has_selection)
{
if (strchr (view->selected_text, '.')
&& !strchr (view->selected_text, ' '))
@ -968,7 +971,7 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view,
/* FIXME: view selection source */
}
if (!view->link_uri && !midori_view_has_selection (view))
if (!view->link_uri && !has_selection)
{
/* FIXME: Make this sensitive only when there is a tab to undo */
menuitem = gtk_image_menu_item_new_with_mnemonic (_("Undo Close Tab"));