From 51d111d85ce97e7ebe3b89648d9c83a175621d36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sat, 18 Oct 2008 22:50:58 +0200 Subject: [PATCH] Optimize view popup population --- midori/midori-view.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/midori/midori-view.c b/midori/midori-view.c index 9425b5de..3bad796b 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -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"));