summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2017-01-15 20:01:49 (GMT)
committer Chris Young <chris@unsatisfactorysoftware.co.uk>2017-01-15 20:01:49 (GMT)
commit9e814fd0f0f03584debb43b6d8acf144bd8675a2 (patch)
tree70b0c5baae987e138e537b7430621cafb94bb065
parentb78d6f458e5d5cb9c78d7430aacf10abd227eb32 (diff)
downloadnetsurf-9e814fd0f0f03584debb43b6d8acf144bd8675a2.tar.gz
netsurf-9e814fd0f0f03584debb43b6d8acf144bd8675a2.tar.bz2
minor menu fixes
-rw-r--r--frontends/amiga/gui.c3
-rw-r--r--frontends/amiga/gui_menu.c3
-rw-r--r--frontends/amiga/menu.c14
3 files changed, 10 insertions, 10 deletions
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index c6ca886..b2a489e 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -3335,8 +3335,7 @@ void ami_gui_hotlist_update_all(void)
nnode=(struct nsObject *)GetSucc((struct Node *)node);
gwin = node->objstruct;
- if(node->Type == AMINS_WINDOW)
- {
+ if(node->Type == AMINS_WINDOW) {
ami_gui_hotlist_toolbar_update(gwin);
}
} while((node = nnode));
diff --git a/frontends/amiga/gui_menu.c b/frontends/amiga/gui_menu.c
index c453c64..6b9b207 100644
--- a/frontends/amiga/gui_menu.c
+++ b/frontends/amiga/gui_menu.c
@@ -1084,6 +1084,7 @@ static void ami_free_menulabs(struct ami_menu_data **md)
md[i]->menukey = NULL;
md[i]->menutype = 0;
free(md[i]);
+ md[i] = NULL;
}
}
@@ -1093,6 +1094,8 @@ void ami_gui_menu_free(struct gui_window_2 *gwin)
#ifdef __amigaos4__
gui_menu_count--;
+ SetAttrs(gwin->objects[OID_MAIN], WINDOW_MenuStrip, NULL, TAG_DONE);
+
if(gui_menu_count == 0) {
ami_free_menulabs(gui_menu_data);
// if we detach our menu from the window we need to do this manually
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index cfbbd8d..91acce7 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -100,6 +100,7 @@ void ami_menu_free_lab_item(struct ami_menu_data **md, int i)
md[i]->menukey = NULL;
md[i]->menutype = 0;
free(md[i]);
+ md[i] = NULL;
}
static void ami_menu_free_labs(struct ami_menu_data **md, int max)
@@ -115,8 +116,6 @@ void ami_menu_alloc_item(struct ami_menu_data **md, int num, UBYTE type,
const char *restrict label, const char *restrict key, const char *restrict icon,
void *restrict func, void *restrict hookdata, UWORD flags)
{
- char menu_icon[1024];
-
md[num] = calloc(1, sizeof(struct ami_menu_data));
md[num]->menutype = type;
md[num]->flags = flags;
@@ -127,11 +126,7 @@ void ami_menu_alloc_item(struct ami_menu_data **md, int num, UBYTE type,
md[num]->menulab = NM_BARLABEL;
icon = NULL;
} else { /* horrid non-generic stuff */
- if((num >= AMI_MENU_HOTLIST) && (num <= AMI_MENU_HOTLIST_MAX)) {
- utf8_from_local_encoding(label,
- (strlen(label) < NSA_MAX_HOTLIST_MENU_LEN) ? strlen(label) : NSA_MAX_HOTLIST_MENU_LEN,
- (char **)&md[num]->menulab);
- } else if((num >= AMI_MENU_AREXX) && (num < AMI_MENU_AREXX_MAX)) {
+ if((num >= AMI_MENU_AREXX) && (num < AMI_MENU_AREXX_MAX)) {
md[num]->menulab = strdup(label);
} else {
md[num]->menulab = ami_utf8_easy(messages_get(label));
@@ -144,6 +139,8 @@ void ami_menu_alloc_item(struct ami_menu_data **md, int num, UBYTE type,
if(hookdata) md[num]->menu_hook.h_Data = hookdata;
#ifdef __amigaos4__
+ char menu_icon[1024];
+
if(LIB_IS_AT_LEAST((struct Library *)GadToolsBase, 53, 7)) {
if(icon) {
if(ami_locate_resource(menu_icon, icon) == true) {
@@ -265,6 +262,7 @@ static int ami_menu_layout_mc_recursive(Object *menu_parent, struct ami_menu_dat
TAG_DONE);
}
+ LOG("Adding item %p ID %d (%s) to parent %p", menu_item, j, md[j]->menulab, menu_parent);
IDoMethod(menu_parent, OM_ADDMEMBER, menu_item);
continue;
} else if (md[j]->menutype > level) {
@@ -452,7 +450,7 @@ void ami_menu_refresh(struct Menu *menu, struct ami_menu_data **md, int menu_ite
/* remove all children */
while((obj = (Object *)IDoMethod(menu_item_obj, MM_NEXTCHILD, 0, NULL)) != NULL) {
IDoMethod(menu_item_obj, OM_REMMEMBER, obj);
- /* do we need to disposeobject? */
+ DisposeObject(obj);
}
/* free associated data */