From ba9a049d7bca2e6fb761349d96d527cfb43f3b53 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 21 Nov 2014 23:58:56 +0000 Subject: Simplify ami_history_open API and use correct call to get history object. --- amiga/context_menu.c | 2 +- amiga/history_local.c | 10 ++++++++-- amiga/history_local.h | 3 +-- amiga/menu.c | 3 +-- 4 files changed, 11 insertions(+), 7 deletions(-) (limited to 'amiga') diff --git a/amiga/context_menu.c b/amiga/context_menu.c index 682df2134..500f1895a 100644 --- a/amiga/context_menu.c +++ b/amiga/context_menu.c @@ -892,7 +892,7 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved case CMID_HISTORY: if(userdata == NULL) { - ami_history_open(gwin->gw, browser_window_get_history(gwin->gw->bw)); + ami_history_open(gwin->gw); } else { diff --git a/amiga/history_local.c b/amiga/history_local.c index 93af92e0e..2fb1ba677 100755 --- a/amiga/history_local.c +++ b/amiga/history_local.c @@ -98,11 +98,17 @@ static void ami_history_redraw(struct history_window *hw) /* exported interface documented in amiga/history_local.h */ -void ami_history_open(struct gui_window *gw, struct history *history) +void ami_history_open(struct gui_window *gw) { + struct history *history; int width, height; - assert(history); + if (gw->bw == NULL) + return; + + history = browser_window_get_history(gw->bw); + if (history == NULL) + return; if(!gw->hw) { diff --git a/amiga/history_local.h b/amiga/history_local.h index bc1cc79da..452fe1512 100755 --- a/amiga/history_local.h +++ b/amiga/history_local.h @@ -36,9 +36,8 @@ struct history_window { * Open history window. * * \param gw gui_window to open history for - * \param history history to open */ -void ami_history_open(struct gui_window *gw, struct history *history); +void ami_history_open(struct gui_window *gw); void ami_history_close(struct history_window *hw); BOOL ami_history_event(struct history_window *hw); diff --git a/amiga/menu.c b/amiga/menu.c index 0c39a5502..88cccd405 100644 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -963,8 +963,7 @@ static void ami_menu_item_browser_localhistory(struct Hook *hook, APTR window, s struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); - if(gwin->gw->bw && gwin->gw->bw->history) - ami_history_open(gwin->gw, gwin->gw->bw->history); + ami_history_open(gwin->gw); } static void ami_menu_item_browser_globalhistory(struct Hook *hook, APTR window, struct IntuiMessage *msg) -- cgit v1.2.3