mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-26 16:29:36 +03:00
Only show external app context menu item if an external app is actually defined
svn path=/trunk/netsurf/; revision=12470
This commit is contained in:
parent
b9bdb198cb
commit
936baddaba
@ -367,15 +367,18 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
|
||||
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);
|
||||
if(ami_mime_content_to_cmd(curbox->object))
|
||||
{
|
||||
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;
|
||||
menuhascontent = true;
|
||||
}
|
||||
}
|
||||
if (curbox->gadget)
|
||||
{
|
||||
|
@ -564,6 +564,21 @@ struct Node *ami_mime_to_plugincmd(lwc_string *mimetype,
|
||||
}
|
||||
}
|
||||
|
||||
lwc_string *ami_mime_content_to_cmd(struct hlcache_handle *c)
|
||||
{
|
||||
struct Node *node;
|
||||
lwc_string *plugincmd;
|
||||
lwc_string *mimetype;
|
||||
|
||||
mimetype = content_get_mime_type(c);
|
||||
|
||||
node = ami_mime_to_plugincmd(mimetype,
|
||||
&plugincmd, NULL);
|
||||
|
||||
if(node && (plugincmd != NULL)) return plugincmd;
|
||||
else return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the MIME type of an hlcache_handle to a DefIcons type
|
||||
*/
|
||||
@ -595,7 +610,7 @@ bool ami_mime_compare(struct hlcache_handle *c, const char *type)
|
||||
|
||||
void ami_mime_dump(void)
|
||||
{
|
||||
struct Node *node;
|
||||
struct Node *node = NULL;
|
||||
struct ami_mime_entry *mimeentry;
|
||||
|
||||
while(mimeentry = ami_mime_entry_locate(NULL, AMI_MIME_MIMETYPE, &node))
|
||||
|
@ -36,9 +36,8 @@ struct Node *ami_mime_from_datatype(struct DataType *dt,
|
||||
lwc_string **mimetype, struct Node *start_node);
|
||||
struct Node *ami_mime_to_filetype(lwc_string *mimetype,
|
||||
lwc_string **filetype, struct Node *start_node);
|
||||
struct Node *ami_mime_to_plugincmd(lwc_string *mimetype,
|
||||
lwc_string **plugincmd, struct Node *start_node);
|
||||
|
||||
lwc_string *ami_mime_content_to_cmd(struct hlcache_handle *c);
|
||||
struct Node *ami_mime_has_cmd(lwc_string **mimetype, struct Node *start_node);
|
||||
|
||||
bool ami_mime_compare(struct hlcache_handle *c, const char *type);
|
||||
|
@ -240,29 +240,25 @@ content_type amiga_plugin_hack_content_type(lwc_string *mime_type)
|
||||
|
||||
void amiga_plugin_hack_execute(struct hlcache_handle *c)
|
||||
{
|
||||
lwc_string *mimetype;
|
||||
lwc_string *plugincmd;
|
||||
struct Node *node;
|
||||
char *full_cmd;
|
||||
BPTR in, out;
|
||||
|
||||
if(c == NULL) return;
|
||||
|
||||
mimetype = content_get_mime_type(c);
|
||||
node = ami_mime_to_plugincmd(mimetype, &plugincmd, NULL);
|
||||
plugincmd = ami_mime_content_to_cmd(c);
|
||||
if(plugincmd == NULL) return;
|
||||
|
||||
if(node && plugincmd)
|
||||
full_cmd = ASPrintf("%s %s", lwc_string_data(plugincmd), content_get_url(c));
|
||||
|
||||
if(full_cmd)
|
||||
{
|
||||
full_cmd = ASPrintf("%s %s", lwc_string_data(plugincmd), content_get_url(c));
|
||||
LOG(("Attempting to execute %s", full_cmd));
|
||||
|
||||
if(full_cmd)
|
||||
{
|
||||
LOG(("Attempting to execute %s", full_cmd));
|
||||
in = Open("NIL:", MODE_OLDFILE);
|
||||
out = Open("NIL:", MODE_NEWFILE);
|
||||
|
||||
in = Open("NIL:", MODE_OLDFILE);
|
||||
out = Open("NIL:", MODE_NEWFILE);
|
||||
|
||||
SystemTags(full_cmd,
|
||||
SystemTags(full_cmd,
|
||||
SYS_Input, in,
|
||||
SYS_Output, out,
|
||||
SYS_Error, out,
|
||||
@ -270,7 +266,6 @@ void amiga_plugin_hack_execute(struct hlcache_handle *c)
|
||||
NP_Name, "NetSurf External Process",
|
||||
TAG_DONE);
|
||||
|
||||
FreeVec(full_cmd);
|
||||
}
|
||||
FreeVec(full_cmd);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user