diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c index 62b9c4f38..d7e7d5903 100644 --- a/frontends/gtk/scaffolding.c +++ b/frontends/gtk/scaffolding.c @@ -90,10 +90,6 @@ static gboolean nsgtk_on_##q##_activate_menu(GtkMenuItem *widget, gpointer data) static gboolean nsgtk_on_##q##_activate(struct nsgtk_scaffolding *g) -/** Macro to define a handler for button events. */ -#define BUTTONHANDLER(q)\ -static gboolean nsgtk_on_##q##_activate(GtkButton *widget, gpointer data) - /** * handle menu activate signals by calling toolbar item activation */ @@ -574,41 +570,6 @@ nsgtk_window_tabs_remove(GtkNotebook *notebook, nsgtk_scaffolding_set_sensitivity(gs); } -/** - * Handle opening a file path. - * - * \param filename The filename to open. - */ -static void nsgtk_openfile_open(const char *filename) -{ - struct browser_window *bw; - char *urltxt; - nsurl *url; - nserror error; - - bw = nsgtk_get_browser_window(scaf_current->top_level); - - urltxt = malloc(strlen(filename) + FILE_SCHEME_PREFIX_LEN + 1); - - if (urltxt != NULL) { - sprintf(urltxt, FILE_SCHEME_PREFIX"%s", filename); - - error = nsurl_create(urltxt, &url); - if (error != NSERROR_OK) { - nsgtk_warning(messages_get_errorcode(error), 0); - } else { - browser_window_navigate(bw, - url, - NULL, - BW_NAVIGATE_HISTORY, - NULL, - NULL, - NULL); - nsurl_unref(url); - } - free(urltxt); - } -} /* signal handlers for menu entries */ @@ -967,113 +928,46 @@ MENUHANDLER(reload, RELOAD_BUTTON); */ MENUHANDLER(back, BACK_BUTTON); +/** + * menu signal handler for activation on forward item + */ +MENUHANDLER(forward, FORWARD_BUTTON); -MULTIHANDLER(forward) -{ - struct browser_window *bw = - nsgtk_get_browser_window(g->top_level); +/** + * menu signal handler for activation on home item + */ +MENUHANDLER(home, HOME_BUTTON); - if ((bw == NULL) || (!browser_window_history_forward_available(bw))) - return TRUE; +/** + * menu signal handler for activation on localhistory item + */ +MENUHANDLER(localhistory, LOCALHISTORY_BUTTON); - /* clear potential search effects */ - browser_window_search_clear(bw); +/** + * menu signal handler for activation on globalhistory item + */ +MENUHANDLER(globalhistory, GLOBALHISTORY_BUTTON); - browser_window_history_forward(bw, false); - scaffolding_update_context(g); +/** + * menu signal handler for activation on addbookmarks item + */ +MENUHANDLER(addbookmarks, ADDBOOKMARKS_BUTTON); - return TRUE; -} +/** + * menu signal handler for activation on showbookmarks item + */ +MENUHANDLER(showbookmarks, SHOWBOOKMARKS_BUTTON); -MULTIHANDLER(home) -{ - static const char *addr = NETSURF_HOMEPAGE; - struct browser_window *bw = nsgtk_get_browser_window(g->top_level); - nsurl *url; - nserror error; +/** + * menu signal handler for activation on showcookies item + */ +MENUHANDLER(showcookies, SHOWCOOKIES_BUTTON); - if (nsoption_charp(homepage_url) != NULL) { - addr = nsoption_charp(homepage_url); - } +/** + * menu signal handler for activation on showcookies item + */ +MENUHANDLER(openlocation, OPENLOCATION_BUTTON); - error = nsurl_create(addr, &url); - if (error != NSERROR_OK) { - nsgtk_warning(messages_get_errorcode(error), 0); - } else { - browser_window_navigate(bw, - url, - NULL, - BW_NAVIGATE_HISTORY, - NULL, - NULL, - NULL); - nsurl_unref(url); - } - - return TRUE; -} - -MULTIHANDLER(localhistory) -{ - struct browser_window *bw = nsgtk_get_browser_window(g->top_level); - nserror res; - - res = nsgtk_local_history_present(g->window, bw); - if (res != NSERROR_OK) { - NSLOG(netsurf, INFO, - "Unable to initialise local history window."); - } - return TRUE; -} - -MULTIHANDLER(globalhistory) -{ - nserror res; - res = nsgtk_global_history_present(); - if (res != NSERROR_OK) { - NSLOG(netsurf, INFO, - "Unable to initialise global history window."); - } - return TRUE; -} - -MULTIHANDLER(addbookmarks) -{ - struct browser_window *bw = nsgtk_get_browser_window(g->top_level); - - if (bw == NULL || !browser_window_has_content(bw)) - return TRUE; - hotlist_add_url(browser_window_access_url(bw)); - return TRUE; -} - -MULTIHANDLER(showbookmarks) -{ - nserror res; - res = nsgtk_hotlist_present(); - if (res != NSERROR_OK) { - NSLOG(netsurf, INFO, "Unable to initialise bookmark window."); - } - return TRUE; -} - -MULTIHANDLER(showcookies) -{ - nserror res; - res = nsgtk_cookies_present(); - if (res != NSERROR_OK) { - NSLOG(netsurf, INFO, "Unable to initialise cookies window."); - } - return TRUE; -} - -MULTIHANDLER(openlocation) -{ - #if 0 - gtk_widget_grab_focus(GTK_WIDGET(g->url_bar)); - #endif - return TRUE; -} MULTIHANDLER(nexttab) { @@ -1101,86 +995,29 @@ nsgtk_on_closetab_activate_menu(GtkMenuItem *widget, gpointer data) return TRUE; } -MULTIHANDLER(contents) -{ - struct browser_window *bw = nsgtk_get_browser_window(g->top_level); - nsurl *url; - nserror error; +/** + * menu signal handler for activation on showcookies item + */ +MENUHANDLER(contents, CONTENTS_BUTTON); - error = nsurl_create("http://www.netsurf-browser.org/documentation/", &url); - if (error != NSERROR_OK) { - nsgtk_warning(messages_get_errorcode(error), 0); - } else { - browser_window_navigate(bw, - url, - NULL, - BW_NAVIGATE_HISTORY, - NULL, - NULL, - NULL); - nsurl_unref(url); - } +/** + * menu signal handler for activation on showcookies item + */ +MENUHANDLER(guide, GUIDE_BUTTON); - return TRUE; -} +/** + * menu signal handler for activation on showcookies item + */ +MENUHANDLER(info, INFO_BUTTON); -MULTIHANDLER(guide) -{ - struct browser_window *bw = nsgtk_get_browser_window(g->top_level); - nsurl *url; +/** + * menu signal handler for activation on showcookies item + */ +MENUHANDLER(about, ABOUT_BUTTON); - if (nsurl_create("http://www.netsurf-browser.org/documentation/guide", &url) != NSERROR_OK) { - nsgtk_warning("NoMemory", 0); - } else { - browser_window_navigate(bw, - url, - NULL, - BW_NAVIGATE_HISTORY, - NULL, - NULL, - NULL); - nsurl_unref(url); - } - - return TRUE; -} - -MULTIHANDLER(info) -{ - struct browser_window *bw = nsgtk_get_browser_window(g->top_level); - nsurl *url; - - if (nsurl_create("http://www.netsurf-browser.org/documentation/info", &url) != NSERROR_OK) { - nsgtk_warning("NoMemory", 0); - } else { - browser_window_navigate(bw, - url, - NULL, - BW_NAVIGATE_HISTORY, - NULL, - NULL, - NULL); - nsurl_unref(url); - } - - return TRUE; -} - -MULTIHANDLER(about) -{ - nsgtk_about_dialog_init(g->window); - return TRUE; -} - -BUTTONHANDLER(history) -{ - struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data; - return nsgtk_on_localhistory_activate(g); -} #undef MULTIHANDLER -#undef CHECKHANDLER -#undef BUTTONHANDLER +#undef MENUHANDLER /** * attach gtk signal handlers for menus diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c index 03e07b9bf..fafa194ad 100644 --- a/frontends/gtk/toolbar.c +++ b/frontends/gtk/toolbar.c @@ -39,6 +39,7 @@ #include "desktop/save_complete.h" #include "desktop/save_text.h" #include "desktop/print.h" +#include "desktop/hotlist.h" #include "netsurf/content.h" #include "netsurf/browser_window.h" #include "netsurf/keypress.h" @@ -55,10 +56,16 @@ #include "gtk/resources.h" #include "gtk/schedule.h" #include "gtk/local_history.h" +#include "gtk/global_history.h" +#include "gtk/viewsource.h" +#include "gtk/download.h" +#include "gtk/viewdata.h" #include "gtk/tabs.h" #include "gtk/print.h" #include "gtk/layout_pango.h" #include "gtk/preferences.h" +#include "gtk/hotlist.h" +#include "gtk/cookies.h" #include "gtk/toolbar.h" /** @@ -1696,6 +1703,111 @@ set_item_sensitivity(struct nsgtk_toolbar_item *item, bool sensitivity) } +/** + * cause the toolbar browsing context to navigate to a new url. + * + * \param tb the toolbar context. + * \param urltxt The url string. + * \return NSERROR_OK on success else appropriate error code. + */ +static nserror +toolbar_navigate_to_url(struct nsgtk_toolbar *tb, const char *urltxt) +{ + struct browser_window *bw; + nsurl *url; + nserror res; + + res = nsurl_create(urltxt, &url); + if (res != NSERROR_OK) { + return res; + } + + bw = tb->get_bw(tb->get_bw_ctx); + + res = browser_window_navigate(bw, + url, + NULL, + BW_NAVIGATE_HISTORY, + NULL, + NULL, + NULL); + nsurl_unref(url); + + return res; +} + + +/** + * run a gtk file chooser as a save dialog to obtain a path + */ +static nserror +nsgtk_saveas_dialog(struct browser_window *bw, + const char *title, + GtkWindow *parent, + bool folder, + gchar **path_out) +{ + nserror res; + GtkWidget *fc; /* file chooser widget */ + GtkFileChooserAction action; + char *path; /* proposed path */ + + if (!browser_window_has_content(bw)) { + /* cannot save a page with no content */ + return NSERROR_INVALID; + } + + if (folder) { + action = GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER; + } else { + action = GTK_FILE_CHOOSER_ACTION_SAVE; + } + + fc = gtk_file_chooser_dialog_new(title, + parent, + action, + NSGTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + NSGTK_STOCK_SAVE, + GTK_RESPONSE_ACCEPT, + NULL); + + /* set a default file name */ + res = nsurl_nice(browser_window_access_url(bw), &path, false); + if (res != NSERROR_OK) { + path = strdup(messages_get("SaveText")); + if (path == NULL) { + gtk_widget_destroy(fc); + return NSERROR_NOMEM; + } + } + + if ((!folder) || (access(path, F_OK) != 0)) { + gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(fc), path); + } + free(path); + + /* confirm overwriting */ + gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(fc), TRUE); + + /* run the dialog to let user select path */ + if (gtk_dialog_run(GTK_DIALOG(fc)) != GTK_RESPONSE_ACCEPT) { + gtk_widget_destroy(fc); + return NSERROR_NOT_FOUND; + } + + *path_out = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fc)); + + gtk_widget_destroy(fc); + + return NSERROR_OK; +} + + +/* + * Toolbar button clicked handlers + */ + /** * callback for all toolbar items widget size allocation * @@ -1779,35 +1891,6 @@ back_button_clicked_cb(GtkWidget *widget, gpointer data) } -/** - * handler for local history tool bar item clicked signal - * - * \param widget The widget the signal is being delivered to. - * \param data The toolbar context passed when the signal was connected - * \return TRUE - */ -static gboolean -localhistory_button_clicked_cb(GtkWidget *widget, gpointer data) -{ - nserror res; - struct nsgtk_toolbar *tb = (struct nsgtk_toolbar *)data; - struct browser_window *bw; - GtkWidget *toplevel; - - toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW); - if (toplevel != NULL) { - bw = tb->get_bw(tb->get_bw_ctx); - - res = nsgtk_local_history_present(GTK_WINDOW(toplevel), bw); - if (res != NSERROR_OK) { - NSLOG(netsurf, INFO, - "Unable to present local history window."); - } - } - return TRUE; -} - - /** * handler for forward tool bar item clicked signal * @@ -1891,11 +1974,9 @@ reload_button_clicked_cb(GtkWidget *widget, gpointer data) static gboolean home_button_clicked_cb(GtkWidget *widget, gpointer data) { - nserror res; struct nsgtk_toolbar *tb = (struct nsgtk_toolbar *)data; + nserror res; const char *addr; - struct browser_window *bw; - nsurl *url; if (nsoption_charp(homepage_url) != NULL) { addr = nsoption_charp(homepage_url); @@ -1903,19 +1984,7 @@ home_button_clicked_cb(GtkWidget *widget, gpointer data) addr = NETSURF_HOMEPAGE; } - res = nsurl_create(addr, &url); - if (res == NSERROR_OK) { - bw = tb->get_bw(tb->get_bw_ctx); - - res = browser_window_navigate(bw, - url, - NULL, - BW_NAVIGATE_HISTORY, - NULL, - NULL, - NULL); - nsurl_unref(url); - } + res = toolbar_navigate_to_url(tb, addr); if (res != NSERROR_OK) { nsgtk_warning(messages_get_errorcode(res), 0); } @@ -2226,69 +2295,6 @@ closewindow_button_clicked_cb(GtkWidget *widget, gpointer data) } -static nserror -nsgtk_saveas_dialog(struct browser_window *bw, - const char *title, - GtkWindow *parent, - bool folder, - gchar **path_out) -{ - nserror res; - GtkWidget *fc; /* file chooser widget */ - GtkFileChooserAction action; - char *path; /* proposed path */ - - if (!browser_window_has_content(bw)) { - /* cannot save a page with no content */ - return NSERROR_INVALID; - } - - if (folder) { - action = GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER; - } else { - action = GTK_FILE_CHOOSER_ACTION_SAVE; - } - - fc = gtk_file_chooser_dialog_new(title, - parent, - action, - NSGTK_STOCK_CANCEL, - GTK_RESPONSE_CANCEL, - NSGTK_STOCK_SAVE, - GTK_RESPONSE_ACCEPT, - NULL); - - /* set a default file name */ - res = nsurl_nice(browser_window_access_url(bw), &path, false); - if (res != NSERROR_OK) { - path = strdup(messages_get("SaveText")); - if (path == NULL) { - gtk_widget_destroy(fc); - return NSERROR_NOMEM; - } - } - - if ((!folder) || (access(path, F_OK) != 0)) { - gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(fc), path); - } - free(path); - - /* confirm overwriting */ - gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(fc), TRUE); - - /* run the dialog to let user select path */ - if (gtk_dialog_run(GTK_DIALOG(fc)) != GTK_RESPONSE_ACCEPT) { - gtk_widget_destroy(fc); - return NSERROR_NOT_FOUND; - } - - *path_out = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fc)); - - gtk_widget_destroy(fc); - - return NSERROR_OK; -} - /** * handler for full save export tool bar item clicked signal * @@ -3013,6 +3019,220 @@ debugdomtree_button_clicked_cb(GtkWidget *widget, gpointer data) } +/** + * handler for local history tool bar item clicked signal + * + * \param widget The widget the signal is being delivered to. + * \param data The toolbar context passed when the signal was connected + * \return TRUE + */ +static gboolean +localhistory_button_clicked_cb(GtkWidget *widget, gpointer data) +{ + nserror res; + struct nsgtk_toolbar *tb = (struct nsgtk_toolbar *)data; + struct browser_window *bw; + GtkWidget *toplevel; + + toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW); + if (toplevel != NULL) { + bw = tb->get_bw(tb->get_bw_ctx); + + res = nsgtk_local_history_present(GTK_WINDOW(toplevel), bw); + if (res != NSERROR_OK) { + NSLOG(netsurf, INFO, + "Unable to present local history window."); + } + } + return TRUE; +} + + +/** + * handler for global history tool bar item clicked signal + * + * \param widget The widget the signal is being delivered to. + * \param data The toolbar context passed when the signal was connected + * \return TRUE + */ +static gboolean +globalhistory_button_clicked_cb(GtkWidget *widget, gpointer data) +{ + nserror res; + res = nsgtk_global_history_present(); + if (res != NSERROR_OK) { + NSLOG(netsurf, INFO, + "Unable to initialise global history window."); + } + return TRUE; +} + + +/** + * handler for add bookmark tool bar item clicked signal + * + * \param widget The widget the signal is being delivered to. + * \param data The toolbar context passed when the signal was connected + * \return TRUE + */ +static gboolean +addbookmarks_button_clicked_cb(GtkWidget *widget, gpointer data) +{ + struct nsgtk_toolbar *tb = (struct nsgtk_toolbar *)data; + struct browser_window *bw; + + bw = tb->get_bw(tb->get_bw_ctx); + if (browser_window_has_content(bw)) { + hotlist_add_url(browser_window_access_url(bw)); + } + return TRUE; +} + + +/** + * handler for show bookmark tool bar item clicked signal + * + * \param widget The widget the signal is being delivered to. + * \param data The toolbar context passed when the signal was connected + * \return TRUE + */ +static gboolean +showbookmarks_button_clicked_cb(GtkWidget *widget, gpointer data) +{ + nserror res; + res = nsgtk_hotlist_present(); + if (res != NSERROR_OK) { + NSLOG(netsurf, INFO, "Unable to initialise bookmark window."); + } + return TRUE; +} + + +/** + * handler for show cookies tool bar item clicked signal + * + * \param widget The widget the signal is being delivered to. + * \param data The toolbar context passed when the signal was connected + * \return TRUE + */ +static gboolean +showcookies_button_clicked_cb(GtkWidget *widget, gpointer data) +{ + nserror res; + res = nsgtk_cookies_present(); + if (res != NSERROR_OK) { + NSLOG(netsurf, INFO, "Unable to initialise cookies window."); + } + return TRUE; +} + + +/** + * handler for open location tool bar item clicked signal + * + * \param widget The widget the signal is being delivered to. + * \param data The toolbar context passed when the signal was connected + * \return TRUE + */ +static gboolean +openlocation_button_clicked_cb(GtkWidget *widget, gpointer data) +{ + struct nsgtk_toolbar *tb = (struct nsgtk_toolbar *)data; + GtkToolItem *urltitem; + + urltitem = tb->buttons[URL_BAR_ITEM]->button; + if (urltitem != NULL) { + GtkEntry *entry; + entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(urltitem))); + gtk_widget_grab_focus(GTK_WIDGET(entry)); + } + return TRUE; +} + + +/** + * handler for contents tool bar item clicked signal + * + * \param widget The widget the signal is being delivered to. + * \param data The toolbar context passed when the signal was connected + * \return TRUE + */ +static gboolean +contents_button_clicked_cb(GtkWidget *widget, gpointer data) +{ + struct nsgtk_toolbar *tb = (struct nsgtk_toolbar *)data; + nserror res; + + res = toolbar_navigate_to_url(tb, "http://www.netsurf-browser.org/documentation/"); + if (res != NSERROR_OK) { + nsgtk_warning(messages_get_errorcode(res), 0); + } + + return TRUE; +} + +/** + * handler for contents tool bar item clicked signal + * + * \param widget The widget the signal is being delivered to. + * \param data The toolbar context passed when the signal was connected + * \return TRUE + */ +static gboolean +guide_button_clicked_cb(GtkWidget *widget, gpointer data) +{ + struct nsgtk_toolbar *tb = (struct nsgtk_toolbar *)data; + nserror res; + + res = toolbar_navigate_to_url(tb, "http://www.netsurf-browser.org/documentation/guide"); + if (res != NSERROR_OK) { + nsgtk_warning(messages_get_errorcode(res), 0); + } + + return TRUE; +} + + +/** + * handler for contents tool bar item clicked signal + * + * \param widget The widget the signal is being delivered to. + * \param data The toolbar context passed when the signal was connected + * \return TRUE + */ +static gboolean +info_button_clicked_cb(GtkWidget *widget, gpointer data) +{ + struct nsgtk_toolbar *tb = (struct nsgtk_toolbar *)data; + nserror res; + + res = toolbar_navigate_to_url(tb, "http://www.netsurf-browser.org/documentation/info"); + if (res != NSERROR_OK) { + nsgtk_warning(messages_get_errorcode(res), 0); + } + + return TRUE; +} + + +/** + * handler for contents tool bar item clicked signal + * + * \param widget The widget the signal is being delivered to. + * \param data The toolbar context passed when the signal was connected + * \return TRUE + */ +static gboolean +about_button_clicked_cb(GtkWidget *widget, gpointer data) +{ + GtkWindow *parent; /* gtk window widget is in */ + + parent = GTK_WINDOW(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)); + + nsgtk_about_dialog_init(parent); + return TRUE; +} + /** * create a toolbar item * diff --git a/frontends/gtk/toolbar_items.h b/frontends/gtk/toolbar_items.h index 909b00d82..9bbb30004 100644 --- a/frontends/gtk/toolbar_items.h +++ b/frontends/gtk/toolbar_items.h @@ -128,17 +128,17 @@ TOOLBAR_ITEM(TOGGLEDEBUGGING_BUTTON, toggledebugging, true, toggledebugging_butt TOOLBAR_ITEM(SAVEBOXTREE_BUTTON, debugboxtree, true, debugboxtree_button_clicked_cb) TOOLBAR_ITEM(SAVEDOMTREE_BUTTON, debugdomtree, true, debugdomtree_button_clicked_cb) TOOLBAR_ITEM(LOCALHISTORY_BUTTON, localhistory, true, localhistory_button_clicked_cb) -TOOLBAR_ITEM(GLOBALHISTORY_BUTTON, globalhistory, true, NULL) -TOOLBAR_ITEM(ADDBOOKMARKS_BUTTON, addbookmarks, true, NULL) -TOOLBAR_ITEM(SHOWBOOKMARKS_BUTTON, showbookmarks, true, NULL) -TOOLBAR_ITEM(SHOWCOOKIES_BUTTON, showcookies, true, NULL) -TOOLBAR_ITEM(OPENLOCATION_BUTTON, openlocation, true, NULL) +TOOLBAR_ITEM(GLOBALHISTORY_BUTTON, globalhistory, true, globalhistory_button_clicked_cb) +TOOLBAR_ITEM(ADDBOOKMARKS_BUTTON, addbookmarks, true, addbookmarks_button_clicked_cb) +TOOLBAR_ITEM(SHOWBOOKMARKS_BUTTON, showbookmarks, true, showbookmarks_button_clicked_cb) +TOOLBAR_ITEM(SHOWCOOKIES_BUTTON, showcookies, true, showcookies_button_clicked_cb) +TOOLBAR_ITEM(OPENLOCATION_BUTTON, openlocation, true, openlocation_button_clicked_cb) TOOLBAR_ITEM(NEXTTAB_BUTTON, nexttab, false, NULL) TOOLBAR_ITEM(PREVTAB_BUTTON, prevtab, false, NULL) -TOOLBAR_ITEM(CONTENTS_BUTTON, contents, true, NULL) -TOOLBAR_ITEM(GUIDE_BUTTON, guide, true, NULL) -TOOLBAR_ITEM(INFO_BUTTON, info, true, NULL) -TOOLBAR_ITEM(ABOUT_BUTTON, about, true, NULL) +TOOLBAR_ITEM(CONTENTS_BUTTON, contents, true, contents_button_clicked_cb) +TOOLBAR_ITEM(GUIDE_BUTTON, guide, true, guide_button_clicked_cb) +TOOLBAR_ITEM(INFO_BUTTON, info, true, info_button_clicked_cb) +TOOLBAR_ITEM(ABOUT_BUTTON, about, true, about_button_clicked_cb) #ifdef TOOLBAR_ITEM_SET #undef TOOLBAR_ITEM