From: Enrico Tröger Date: Sat, 18 Oct 2008 20:50:58 +0000 (+0200) Subject: Optimize view popup population X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51d111d85ce97e7ebe3b89648d9c83a175621d36;p=midori Optimize view popup population --- 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"));