Author: chris_y
Date: Thu Jun 9 17:29:46 2011
New Revision: 12470
URL:
http://source.netsurf-browser.org?rev=12470&view=rev
Log:
Only show external app context menu item if an external app is actually defined
Modified:
trunk/netsurf/amiga/context_menu.c
trunk/netsurf/amiga/filetype.c
trunk/netsurf/amiga/filetype.h
trunk/netsurf/amiga/plugin_hack.c
Modified: trunk/netsurf/amiga/context_menu.c
URL:
http://source.netsurf-browser.org/trunk/netsurf/amiga/context_menu.c?rev=...
==============================================================================
--- trunk/netsurf/amiga/context_menu.c (original)
+++ trunk/netsurf/amiga/context_menu.c Thu Jun 9 17:29:46 2011
@@ -367,15 +367,18 @@
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(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;
+ }
}
if (curbox->gadget)
{
Modified: trunk/netsurf/amiga/filetype.c
URL:
http://source.netsurf-browser.org/trunk/netsurf/amiga/filetype.c?rev=1247...
==============================================================================
--- trunk/netsurf/amiga/filetype.c (original)
+++ trunk/netsurf/amiga/filetype.c Thu Jun 9 17:29:46 2011
@@ -564,6 +564,21 @@
}
}
+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 @@
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))
Modified: trunk/netsurf/amiga/filetype.h
URL:
http://source.netsurf-browser.org/trunk/netsurf/amiga/filetype.h?rev=1247...
==============================================================================
--- trunk/netsurf/amiga/filetype.h (original)
+++ trunk/netsurf/amiga/filetype.h Thu Jun 9 17:29:46 2011
@@ -36,9 +36,8 @@
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);
Modified: trunk/netsurf/amiga/plugin_hack.c
URL:
http://source.netsurf-browser.org/trunk/netsurf/amiga/plugin_hack.c?rev=1...
==============================================================================
--- trunk/netsurf/amiga/plugin_hack.c (original)
+++ trunk/netsurf/amiga/plugin_hack.c Thu Jun 9 17:29:46 2011
@@ -240,29 +240,25 @@
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);
-
- if(node && plugincmd)
+ plugincmd = ami_mime_content_to_cmd(c);
+ if(plugincmd == NULL) return;
+
+ 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));
-
- if(full_cmd)
- {
- LOG(("Attempting to execute %s", full_cmd));
-
- in = Open("NIL:", MODE_OLDFILE);
- out = Open("NIL:", MODE_NEWFILE);
-
- SystemTags(full_cmd,
+ LOG(("Attempting to execute %s", full_cmd));
+
+ in = Open("NIL:", MODE_OLDFILE);
+ out = Open("NIL:", MODE_NEWFILE);
+
+ SystemTags(full_cmd,
SYS_Input, in,
SYS_Output, out,
SYS_Error, out,
@@ -270,7 +266,6 @@
NP_Name, "NetSurf External Process",
TAG_DONE);
- FreeVec(full_cmd);
- }
- }
-}
+ FreeVec(full_cmd);
+ }
+}