Bug 159630 - [GTK] Add webkit_context_menu_find API
Summary: [GTK] Add webkit_context_menu_find API
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: Other
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-11 10:08 PDT by Michael Catanzaro
Modified: 2016-07-13 00:04 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2016-07-11 10:08:32 PDT
We have this code in ephy-window.c; it should probably be upstreamed into WebKitContextMenu.

/* FIXME: Add webkit_context_menu_find() ? */
static WebKitContextMenuItem *
find_item_in_context_menu (WebKitContextMenu      *context_menu,
                           WebKitContextMenuAction action)
{
  GList *items, *iter;

  items = webkit_context_menu_get_items (context_menu);
  for (iter = items; iter; iter = g_list_next (iter)) {
    WebKitContextMenuItem *item = (WebKitContextMenuItem *)iter->data;

    if (webkit_context_menu_item_get_stock_action (item) == action)
      return g_object_ref (item);
  }

  return NULL;
}
Comment 1 Michael Catanzaro 2016-07-11 10:16:42 PDT
It's written by Carlos Garcia, so we have no copyright issues, but let's have Carlos give final review on this as a formality.
Comment 2 Carlos Garcia Campos 2016-07-13 00:03:43 PDT
Well, this is very specific to what we need in ephy, as a general purpose API we should probably use a compare function as argument instead of searching by stock action unconditionally. And maybe a flag to indicate whether we want to search for the item in submenus or not