Optimize view popup population
This commit is contained in:
parent
3a9071a761
commit
51d111d85c
1 changed files with 5 additions and 2 deletions
|
@ -893,6 +893,7 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view,
|
||||||
GdkScreen* screen;
|
GdkScreen* screen;
|
||||||
GtkIconTheme* icon_theme;
|
GtkIconTheme* icon_theme;
|
||||||
GList* items;
|
GList* items;
|
||||||
|
gboolean has_selection;
|
||||||
|
|
||||||
/* We do not want to modify the Edit menu.
|
/* We do not want to modify the Edit menu.
|
||||||
The only reliable indicator is inspecting the first item. */
|
The only reliable indicator is inspecting the first item. */
|
||||||
|
@ -906,6 +907,8 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 (
|
||||||
|
@ -949,7 +952,7 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view,
|
||||||
gtk_widget_show (menuitem);
|
gtk_widget_show (menuitem);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!view->link_uri && midori_view_has_selection (view))
|
if (!view->link_uri && has_selection)
|
||||||
{
|
{
|
||||||
if (strchr (view->selected_text, '.')
|
if (strchr (view->selected_text, '.')
|
||||||
&& !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 */
|
/* 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 */
|
/* FIXME: Make this sensitive only when there is a tab to undo */
|
||||||
menuitem = gtk_image_menu_item_new_with_mnemonic (_("Undo Close Tab"));
|
menuitem = gtk_image_menu_item_new_with_mnemonic (_("Undo Close Tab"));
|
||||||
|
|
Loading…
Reference in a new issue