diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2011-05-11 18:33:31 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2011-05-11 18:33:31 +0000 |
commit | 45be35677c20da435cbc81f1b3a96d13ce3f6a37 (patch) | |
tree | 5416ef8061c75df9b491d43f24818ed6356f7e9d /amiga/context_menu.c | |
parent | df081a08884bcf91ef94f679d6b3d69ab0042908 (diff) | |
download | netsurf-45be35677c20da435cbc81f1b3a96d13ce3f6a37.tar.gz netsurf-45be35677c20da435cbc81f1b3a96d13ce3f6a37.tar.bz2 |
Allow users to register external applications for plugin contents, and run from
context menu
svn path=/trunk/netsurf/; revision=12381
Diffstat (limited to 'amiga/context_menu.c')
-rwxr-xr-x | amiga/context_menu.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/amiga/context_menu.c b/amiga/context_menu.c index 71109ef28..d3bb8ae6f 100755 --- a/amiga/context_menu.c +++ b/amiga/context_menu.c @@ -33,6 +33,7 @@ #include "amiga/history_local.h" #include "amiga/iff_dr2d.h" #include "amiga/options.h" +#include "amiga/plugin_hack.h" #include "amiga/theme.h" #include "amiga/utf8.h" #include "desktop/textinput.h" @@ -70,6 +71,7 @@ enum { CMID_SELCOPY, CMID_SELPASTE, CMID_SELSEARCH, + CMID_PLUGINCMD, CMSUB_OBJECT, CMSUB_URL, CMSUB_SEL, @@ -107,6 +109,8 @@ void ami_context_menu_init(void) ctxmenulab[CMID_SELCLEAR] = ami_utf8_easy((char *)messages_get("ClearNS")); ctxmenulab[CMID_SELSEARCH] = ami_utf8_easy((char *)messages_get("SearchWeb")); + ctxmenulab[CMID_PLUGINCMD] = ami_utf8_easy((char *)messages_get("ExternalApp")); + ctxmenulab[CMSUB_OBJECT] = ami_utf8_easy((char *)messages_get("Object")); ctxmenulab[CMSUB_URL] = ami_utf8_easy((char *)messages_get("Link")); ctxmenulab[CMSUB_SEL] = ami_utf8_easy((char *)messages_get("Selection")); @@ -360,6 +364,19 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y) menuhascontent = true; } + if(curbox->object && + (content_get_type(curbox->object) == CONTENT_PLUGIN)) + { + IDoMethod(gwin->objects[OID_MENU],PM_INSERT, + NewObject(POPUPMENU_GetItemClass(), NULL, + PMIA_Title, (ULONG)ctxmenulab[CMID_PLUGINCMD], + PMIA_ID, CMID_PLUGINCMD, + PMIA_UserData, curbox->object, + TAG_DONE), + ~0); + + menuhascontent = true; + } if (curbox->gadget) { switch (curbox->gadget->type) @@ -540,6 +557,10 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved } break; + case CMID_PLUGINCMD: + amiga_plugin_hack_execute((struct hlcache_handle *)userdata); + break; + case CMID_HISTORY: if(userdata == NULL) { |