Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/fe38ce44365c018e8c5d34bb661d8b6282b20603
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/fe38ce44365c018e8c5d34bb661d8b6282b20603
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/fe38ce44365c018e8c5d34bb661d8b6282b20603

The branch, vince/gtk-tab-restyle has been updated
       via  fe38ce44365c018e8c5d34bb661d8b6282b20603 (commit)
       via  63473f54c87a7a7bbf0613c4384b58ed352818c6 (commit)
      from  9774499404e1f5fb37af37c9e939718ccd70ca56 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=fe38ce44365c018e8c5d34bb661d8b6282b20603
commit fe38ce44365c018e8c5d34bb661d8b6282b20603
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    cleanup some toolbar item creation bits

diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index 399db6c..e137e82 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -181,7 +181,7 @@ static bool edit_mode = false;
 
 /* the 'standard' width of a button that makes sufficient of its label
 visible */
-#define NSGTK_BUTTON_WIDTH 130
+#define NSGTK_BUTTON_WIDTH 120
 
 /* the 'standard' height of a button that fits as many toolbars as
 possible into the store */
@@ -542,7 +542,7 @@ static char *remove_underscores(const char *s, bool 
replacespace)
  * create a gtk entry widget with a completion attached
  */
 static GtkToolItem *
-make_toolbar_item_throbber(void)
+make_toolbar_item_throbber(bool sensitivity)
 {
        nserror res;
        GtkToolItem *item;
@@ -571,6 +571,8 @@ make_toolbar_item_throbber(void)
                        gtk_container_add(GTK_CONTAINER(item), image);
                }
        }
+       gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
+
        return item;
 }
 
@@ -580,7 +582,7 @@ make_toolbar_item_throbber(void)
  * create a gtk entry widget with a completion attached
  */
 static GtkToolItem *
-make_toolbar_item_url_bar(void)
+make_toolbar_item_url_bar(bool sensitivity)
 {
        GtkToolItem *item;
        GtkWidget *entry;
@@ -594,10 +596,17 @@ make_toolbar_item_url_bar(void)
                return NULL;
        }
 
-       gtk_entry_set_completion(GTK_ENTRY(entry), completion);
+       gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
+
        gtk_container_add(GTK_CONTAINER(item), entry);
        gtk_tool_item_set_expand(item, TRUE);
 
+       if (edit_mode) {
+               gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
+       } else {
+               gtk_entry_set_completion(GTK_ENTRY(entry), completion);
+       }
+
        return item;
 }
 
@@ -606,48 +615,45 @@ make_toolbar_item_url_bar(void)
  * create web search toolbar item widget
  */
 static GtkToolItem *
-make_toolbar_item_websearch(void)
+make_toolbar_item_websearch(bool sensitivity)
 {
        GtkToolItem *item;
+       nserror res;
+       GtkWidget *entry;
+       struct bitmap *bitmap;
+       GdkPixbuf *pixbuf = NULL;
 
-       if (edit_mode) {
-               item = gtk_tool_button_new(
-                               GTK_WIDGET(nsgtk_image_new_from_stock(
-                                               NSGTK_STOCK_FIND,
-                                               GTK_ICON_SIZE_LARGE_TOOLBAR)),
-                               "[websearch]");
-       } else {
-               nserror res;
-               GtkWidget *entry;
-               struct bitmap *bitmap;
-               GdkPixbuf *pixbuf = NULL;
+       entry = nsgtk_entry_new();
+       item = gtk_tool_item_new();
 
-               entry = nsgtk_entry_new();
-               item = gtk_tool_item_new();
+       if ((entry == NULL) || (item == NULL)) {
+               return NULL;
+       }
 
-               if ((entry == NULL) || (item == NULL)) {
-                       return NULL;
-               }
+       gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
 
-               gtk_widget_set_size_request(entry, NSGTK_WEBSEARCH_WIDTH, -1);
+       gtk_widget_set_size_request(entry, NSGTK_WEBSEARCH_WIDTH, -1);
 
-               res = search_web_get_provider_bitmap(&bitmap);
-               if ((res == NSERROR_OK) && (bitmap != NULL)) {
-                       pixbuf = nsgdk_pixbuf_get_from_surface(bitmap->surface,
-                                                              16, 16);
-               }
+       res = search_web_get_provider_bitmap(&bitmap);
+       if ((res == NSERROR_OK) && (bitmap != NULL)) {
+               pixbuf = nsgdk_pixbuf_get_from_surface(bitmap->surface,
+                                                      16, 16);
+       }
 
-               if (pixbuf != NULL) {
-                       nsgtk_entry_set_icon_from_pixbuf(entry,
-                                                        GTK_ENTRY_ICON_PRIMARY,
-                                                        pixbuf);
-               } else {
-                       nsgtk_entry_set_icon_from_stock(entry,
-                                                       GTK_ENTRY_ICON_PRIMARY,
-                                                       NSGTK_STOCK_INFO);
-               }
+       if (pixbuf != NULL) {
+               nsgtk_entry_set_icon_from_pixbuf(entry,
+                                                GTK_ENTRY_ICON_PRIMARY,
+                                                pixbuf);
+       } else {
+               nsgtk_entry_set_icon_from_stock(entry,
+                                               GTK_ENTRY_ICON_PRIMARY,
+                                               NSGTK_STOCK_INFO);
+       }
+
+       gtk_container_add(GTK_CONTAINER(item), entry);
 
-               gtk_container_add(GTK_CONTAINER(item), entry);
+       if (edit_mode) {
+               gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
        }
 
        return item;
@@ -662,114 +668,97 @@ make_toolbar_item_websearch(void)
  * \return gtk widget
  */
 static GtkToolItem *
-make_toolbar_item(nsgtk_toolbar_button i, struct nsgtk_theme *theme)
+make_toolbar_item(nsgtk_toolbar_button itemid,
+                 struct nsgtk_theme *theme,
+                 bool sensitivity)
 {
        GtkToolItem *w = NULL;
 
-       switch(i) {
-
-/* gtk_tool_button_new() accepts NULL args */
-#define MAKE_STOCKBUTTON(p, q)                                 \
-       case p##_BUTTON: {                                      \
-               GtkStockItem item;                                      \
-               char *label = NULL;                                     \
-               if (nsgtk_stock_lookup(q, &item) &&                     \
-                   (item.label != NULL) &&                             \
-                   ((label = remove_underscores(item.label, false)) != NULL)) 
{ \
-                       w = gtk_tool_button_new(GTK_WIDGET(     \
-                                          theme->image[p##_BUTTON]), label); \
-                       free(label);                                    \
-               } else {                                                \
-                       w = gtk_tool_button_new(GTK_WIDGET(     \
-                                          theme->image[p##_BUTTON]), q); \
-               }                                                       \
-               break;                                                  \
-       }
+       switch(itemid) {
 
 /* gtk_tool_button_new accepts NULL args */
-#define MAKE_MENUBUTTON(p, q)                                          \
+#define MAKE_ITEM(p, q)                                                        
\
        case p##_BUTTON: {                                              \
                char *label = NULL;                                     \
                label = remove_underscores(messages_get(#q), false);    \
-               w = gtk_tool_button_new(                        \
-                                       GTK_WIDGET(theme->image[p##_BUTTON]), \
-                                       label);                 \
+               w = gtk_tool_button_new(GTK_WIDGET(theme->image[p##_BUTTON]), \
+                                       label);                         \
+               gtk_widget_set_sensitive(GTK_WIDGET(w), sensitivity);   \
                if (label != NULL) {                                    \
                        free(label);                                    \
                }                                                       \
                break;                                                  \
        }
 
-       MAKE_STOCKBUTTON(HOME, NSGTK_STOCK_HOME)
-       MAKE_STOCKBUTTON(BACK, NSGTK_STOCK_GO_BACK)
-       MAKE_STOCKBUTTON(FORWARD, NSGTK_STOCK_GO_FORWARD)
-       MAKE_STOCKBUTTON(STOP, NSGTK_STOCK_STOP)
-       MAKE_STOCKBUTTON(RELOAD, NSGTK_STOCK_REFRESH)
-
-       MAKE_MENUBUTTON(NEWWINDOW, gtkNewWindow)
-       MAKE_MENUBUTTON(NEWTAB, gtkNewTab)
-       MAKE_MENUBUTTON(OPENFILE, gtkOpenFile)
-       MAKE_MENUBUTTON(CLOSETAB, gtkCloseTab)
-       MAKE_MENUBUTTON(CLOSEWINDOW, gtkCloseWindow)
-       MAKE_MENUBUTTON(SAVEPAGE, gtkSavePage)
-       MAKE_MENUBUTTON(PRINTPREVIEW, gtkPrintPreview)
-       MAKE_MENUBUTTON(PRINT, gtkPrint)
-       MAKE_MENUBUTTON(QUIT, gtkQuitMenu)
-       MAKE_MENUBUTTON(CUT, gtkCut)
-       MAKE_MENUBUTTON(COPY, gtkCopy)
-       MAKE_MENUBUTTON(PASTE, gtkPaste)
-       MAKE_MENUBUTTON(DELETE, gtkDelete)
-       MAKE_MENUBUTTON(SELECTALL, gtkSelectAll)
-       MAKE_MENUBUTTON(PREFERENCES, gtkPreferences)
-       MAKE_MENUBUTTON(ZOOMPLUS, gtkZoomPlus)
-       MAKE_MENUBUTTON(ZOOMMINUS, gtkZoomMinus)
-       MAKE_MENUBUTTON(ZOOMNORMAL, gtkZoomNormal)
-       MAKE_MENUBUTTON(FULLSCREEN, gtkFullScreen)
-       MAKE_MENUBUTTON(VIEWSOURCE, gtkViewSource)
-       MAKE_MENUBUTTON(CONTENTS, gtkContents)
-       MAKE_MENUBUTTON(ABOUT, gtkAbout)
-       MAKE_MENUBUTTON(PDF, gtkPDF)
-       MAKE_MENUBUTTON(PLAINTEXT, gtkPlainText)
-       MAKE_MENUBUTTON(DRAWFILE, gtkDrawFile)
-       MAKE_MENUBUTTON(POSTSCRIPT, gtkPostScript)
-       MAKE_MENUBUTTON(FIND, gtkFind)
-       MAKE_MENUBUTTON(DOWNLOADS, gtkDownloads)
-       MAKE_MENUBUTTON(SAVEWINDOWSIZE, gtkSaveWindowSize)
-       MAKE_MENUBUTTON(TOGGLEDEBUGGING, gtkToggleDebugging)
-       MAKE_MENUBUTTON(SAVEBOXTREE, gtkDebugBoxTree)
-       MAKE_MENUBUTTON(SAVEDOMTREE, gtkDebugDomTree)
-       MAKE_MENUBUTTON(LOCALHISTORY, gtkLocalHistory)
-       MAKE_MENUBUTTON(GLOBALHISTORY, gtkGlobalHistory)
-       MAKE_MENUBUTTON(ADDBOOKMARKS, gtkAddBookMarks)
-       MAKE_MENUBUTTON(SHOWBOOKMARKS, gtkShowBookMarks)
-       MAKE_MENUBUTTON(SHOWCOOKIES, gtkShowCookies)
-       MAKE_MENUBUTTON(OPENLOCATION, gtkOpenLocation)
-       MAKE_MENUBUTTON(NEXTTAB, gtkNextTab)
-       MAKE_MENUBUTTON(PREVTAB, gtkPrevTab)
-       MAKE_MENUBUTTON(GUIDE, gtkGuide)
-       MAKE_MENUBUTTON(INFO, gtkUserInformation)
-       MAKE_MENUBUTTON(OPENMENU, gtkOpenMenu)
-
-#undef MAKE_STOCKBUTTON
-#undef MAKE_MENUBUTTON
+       MAKE_ITEM(HOME, gtkHome)
+       MAKE_ITEM(BACK, gtkBack)
+       MAKE_ITEM(FORWARD, gtkForward)
+       MAKE_ITEM(STOP, Stop)
+       MAKE_ITEM(RELOAD, Reload)
+       MAKE_ITEM(NEWWINDOW, gtkNewWindow)
+       MAKE_ITEM(NEWTAB, gtkNewTab)
+       MAKE_ITEM(OPENFILE, gtkOpenFile)
+       MAKE_ITEM(CLOSETAB, gtkCloseTab)
+       MAKE_ITEM(CLOSEWINDOW, gtkCloseWindow)
+       MAKE_ITEM(SAVEPAGE, gtkSavePage)
+       MAKE_ITEM(PRINTPREVIEW, gtkPrintPreview)
+       MAKE_ITEM(PRINT, gtkPrint)
+       MAKE_ITEM(QUIT, gtkQuitMenu)
+       MAKE_ITEM(CUT, gtkCut)
+       MAKE_ITEM(COPY, gtkCopy)
+       MAKE_ITEM(PASTE, gtkPaste)
+       MAKE_ITEM(DELETE, gtkDelete)
+       MAKE_ITEM(SELECTALL, gtkSelectAll)
+       MAKE_ITEM(PREFERENCES, gtkPreferences)
+       MAKE_ITEM(ZOOMPLUS, gtkZoomPlus)
+       MAKE_ITEM(ZOOMMINUS, gtkZoomMinus)
+       MAKE_ITEM(ZOOMNORMAL, gtkZoomNormal)
+       MAKE_ITEM(FULLSCREEN, gtkFullScreen)
+       MAKE_ITEM(VIEWSOURCE, gtkViewSource)
+       MAKE_ITEM(CONTENTS, gtkContents)
+       MAKE_ITEM(ABOUT, gtkAbout)
+       MAKE_ITEM(PDF, gtkPDF)
+       MAKE_ITEM(PLAINTEXT, gtkPlainText)
+       MAKE_ITEM(DRAWFILE, gtkDrawFile)
+       MAKE_ITEM(POSTSCRIPT, gtkPostScript)
+       MAKE_ITEM(FIND, gtkFind)
+       MAKE_ITEM(DOWNLOADS, gtkDownloads)
+       MAKE_ITEM(SAVEWINDOWSIZE, gtkSaveWindowSize)
+       MAKE_ITEM(TOGGLEDEBUGGING, gtkToggleDebugging)
+       MAKE_ITEM(SAVEBOXTREE, gtkDebugBoxTree)
+       MAKE_ITEM(SAVEDOMTREE, gtkDebugDomTree)
+       MAKE_ITEM(LOCALHISTORY, gtkLocalHistory)
+       MAKE_ITEM(GLOBALHISTORY, gtkGlobalHistory)
+       MAKE_ITEM(ADDBOOKMARKS, gtkAddBookMarks)
+       MAKE_ITEM(SHOWBOOKMARKS, gtkShowBookMarks)
+       MAKE_ITEM(SHOWCOOKIES, gtkShowCookies)
+       MAKE_ITEM(OPENLOCATION, gtkOpenLocation)
+       MAKE_ITEM(NEXTTAB, gtkNextTab)
+       MAKE_ITEM(PREVTAB, gtkPrevTab)
+       MAKE_ITEM(GUIDE, gtkGuide)
+       MAKE_ITEM(INFO, gtkUserInformation)
+       MAKE_ITEM(OPENMENU, gtkOpenMenu)
+
+#undef MAKE_ITEM
 
        case HISTORY_BUTTON:
                w = gtk_tool_button_new(GTK_WIDGET(
                                theme->image[HISTORY_BUTTON]), "H");
                /* set history widget minimum width */
                gtk_widget_set_size_request(GTK_WIDGET(w), 20, -1);
+               gtk_widget_set_sensitive(GTK_WIDGET(w), sensitivity);
                break;
 
        case URL_BAR_ITEM:
-               w = make_toolbar_item_url_bar();
+               w = make_toolbar_item_url_bar(sensitivity);
                break;
 
        case THROBBER_ITEM:
-               w = make_toolbar_item_throbber();
+               w = make_toolbar_item_throbber(sensitivity);
                break;
 
        case WEBSEARCH_ITEM:
-               w = make_toolbar_item_websearch();
+               w = make_toolbar_item_websearch(sensitivity);
                break;
 
        default:
@@ -1011,7 +1000,9 @@ customisation_toolbar_drag_drop_cb(GtkWidget *widget,
                return TRUE;
        }
 
-       dragitem->button = make_toolbar_item(tbc->dragitem, theme);
+       edit_mode = true;
+       dragitem->button = make_toolbar_item(tbc->dragitem, theme, true);
+       edit_mode = false;
 
        free(theme);
        if (dragitem->button == NULL) {
@@ -1247,12 +1238,8 @@ add_item_to_toolbar(struct nsgtk_toolbar *tb,
 
                if (tb->buttons[bidx]->location == location) {
 
-                       tb->buttons[bidx]->button = make_toolbar_item(bidx,
-                                                                     theme);
-
-                       /* set widgets initial sensitivity */
-                       
gtk_widget_set_sensitive(GTK_WIDGET(tb->buttons[bidx]->button),
-                                                
tb->buttons[bidx]->sensitivity);
+                       tb->buttons[bidx]->button = make_toolbar_item(
+                               bidx, theme, tb->buttons[bidx]->sensitivity);
 
                        gtk_toolbar_insert(tb->widget,
                                           tb->buttons[bidx]->button,
@@ -1492,12 +1479,28 @@ toolbar_customisation_connect_signals(struct 
nsgtk_toolbar *tb)
 }
 
 
+static void
+item_size_allocate_cb(GtkWidget *widget,
+                     GdkRectangle *alloc,
+                     gpointer user_data)
+{
+       if (alloc->width > NSGTK_BUTTON_WIDTH) {
+               alloc->width = NSGTK_BUTTON_WIDTH;
+       }
+       if (alloc->height > NSGTK_BUTTON_HEIGHT) {
+               alloc->height = NSGTK_BUTTON_HEIGHT;
+       }
+       //NSLOG(netsurf, ERROR, "w:%d h:%d", alloc->width, alloc->height);
+       gtk_widget_set_allocation(widget, alloc);
+}
+
+
 /**
  * add a row to a toolbar customisation toolbox
  *
  * \param tbc The toolbar customisation context
  * \param startitem The item index of the beginning of the row
- * \param enditem The item index of teh beginning of teh next row
+ * \param enditem The item index of the beginning of the next row
  * \return NSERROR_OK on successs else error
  */
 static nserror
@@ -1535,6 +1538,10 @@ add_toolbox_row(struct nsgtk_toolbar_customisation *tbc,
                                 "drag-data-get",
                                 
G_CALLBACK(tbc->toolbar.buttons[iidx]->dataplus),
                                 &tbc->toolbar);
+               g_signal_connect(tbc->items[iidx],
+                                "size-allocate",
+                                G_CALLBACK(item_size_allocate_cb),
+                                NULL);
                gtk_toolbar_insert(rowbar, tbc->items[iidx], iidx - startitem);
        }
        return NSERROR_OK;
@@ -1577,7 +1584,7 @@ toolbar_customisation_create_toolbox(struct 
nsgtk_toolbar_customisation *tbc,
                        curcol = 0;
                        startidx = iidx;
                }
-               tbc->items[iidx] = make_toolbar_item(iidx, theme);
+               tbc->items[iidx] = make_toolbar_item(iidx, theme, true);
                if (tbc->items[iidx] != NULL) {
                        curcol++;
                }
@@ -1594,26 +1601,6 @@ toolbar_customisation_create_toolbox(struct 
nsgtk_toolbar_customisation *tbc,
 
 
 /**
- * customisation apply handler for clicked signal
- *
- * when 'save settings' button is clicked
- */
-static gboolean
-customisation_apply_clicked_cb(GtkWidget *widget, gpointer data)
-{
-       struct nsgtk_toolbar_customisation *tbc;
-       tbc = (struct nsgtk_toolbar_customisation *)data;
-
-       /* save state to file, update toolbars for all windows */
-       nsgtk_toolbar_customisation_save(tbc);
-       nsgtk_window_toolbar_update();
-       gtk_widget_destroy(tbc->container);
-
-       return TRUE;
-}
-
-
-/**
  * update toolbar in customisation to user settings
  */
 static nserror
@@ -1660,6 +1647,27 @@ customisation_toolbar_update(struct 
nsgtk_toolbar_customisation *tbc)
        return NSERROR_OK;
 }
 
+
+/**
+ * customisation apply handler for clicked signal
+ *
+ * when 'save settings' button is clicked
+ */
+static gboolean
+customisation_apply_clicked_cb(GtkWidget *widget, gpointer data)
+{
+       struct nsgtk_toolbar_customisation *tbc;
+       tbc = (struct nsgtk_toolbar_customisation *)data;
+
+       /* save state to file, update toolbars for all windows */
+       nsgtk_toolbar_customisation_save(tbc);
+       nsgtk_window_toolbar_update();
+       gtk_widget_destroy(tbc->container);
+
+       return TRUE;
+}
+
+
 /**
  * customisation reset handler for clicked signal
  *
@@ -1752,6 +1760,7 @@ static gboolean cutomize_button_clicked_cb(GtkWidget 
*widget, gpointer data)
                        }
                        goto cutomize_button_clicked_cb_error;
                }
+               tbc->toolbar.buttons[iidx]->sensitivity = true;
        }
 
        res = customisation_toolbar_update(tbc);


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=63473f54c87a7a7bbf0613c4384b58ed352818c6
commit 63473f54c87a7a7bbf0613c4384b58ed352818c6
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    fix customisation toolbar reset and remove unused code

diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index 9c51b5b..399db6c 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -191,7 +191,6 @@ possible into the store */
 #define NSGTK_WEBSEARCH_WIDTH 150
 
 
-
 enum image_sets {
        IMAGE_SET_MAIN_MENU = 0,
        IMAGE_SET_RCLICK_MENU,
@@ -213,7 +212,6 @@ struct nsgtk_theme {
 };
 
 /* forward declaration */
-void nsgtk_toolbar_connect_all(struct nsgtk_scaffolding *g);
 int nsgtk_toolbar_get_id_from_widget(GtkWidget *widget, struct 
nsgtk_scaffolding *g);
 static nserror toolbar_item_create(nsgtk_toolbar_button id, struct 
nsgtk_toolbar_item **item_out);
 
@@ -325,6 +323,7 @@ nsgtk_theme_image_default(nsgtk_toolbar_button tbbutton,
        return image;
 }
 
+
 /**
  * Get default image for search buttons / menu items from gtk stock items
  *
@@ -333,7 +332,6 @@ nsgtk_theme_image_default(nsgtk_toolbar_button tbbutton,
  * \param usedef Use the default image if not found.
  * \return default search image.
  */
-
 static GtkImage *
 nsgtk_theme_searchimage_default(nsgtk_search_buttons tbbutton,
                                GtkIconSize iconsize,
@@ -510,26 +508,6 @@ void nsgtk_theme_implement(struct nsgtk_scaffolding *g)
 }
 
 
-
-/**
- * get scaffolding button index of button at location
- *
- * \return toolbar item id from location when there is an item at that logical
- * location; else -1
- */
-static nsgtk_toolbar_button
-nsgtk_toolbar_get_id_at_location(struct nsgtk_scaffolding *g, int i)
-{
-       int q;
-       for (q = BACK_BUTTON; q < PLACEHOLDER_BUTTON; q++) {
-               if (nsgtk_scaffolding_button(g, q)->location == i) {
-                       return q;
-               }
-       }
-       return -1;
-}
-
-
 /**
  * returns a string without its underscores
  *
@@ -708,32 +686,6 @@ make_toolbar_item(nsgtk_toolbar_button i, struct 
nsgtk_theme *theme)
                break;                                                  \
        }
 
-       MAKE_STOCKBUTTON(HOME, NSGTK_STOCK_HOME)
-       MAKE_STOCKBUTTON(BACK, NSGTK_STOCK_GO_BACK)
-       MAKE_STOCKBUTTON(FORWARD, NSGTK_STOCK_GO_FORWARD)
-       MAKE_STOCKBUTTON(STOP, NSGTK_STOCK_STOP)
-       MAKE_STOCKBUTTON(RELOAD, NSGTK_STOCK_REFRESH)
-#undef MAKE_STOCKBUTTON
-
-       case HISTORY_BUTTON:
-               w = gtk_tool_button_new(GTK_WIDGET(
-                               theme->image[HISTORY_BUTTON]), "H");
-               /* set history widget minimum width */
-               gtk_widget_set_size_request(GTK_WIDGET(w), 20, -1);
-               break;
-
-       case URL_BAR_ITEM:
-               w = make_toolbar_item_url_bar();
-               break;
-
-       case THROBBER_ITEM:
-               w = make_toolbar_item_throbber();
-               break;
-
-       case WEBSEARCH_ITEM:
-               w = make_toolbar_item_websearch();
-               break;
-
 /* gtk_tool_button_new accepts NULL args */
 #define MAKE_MENUBUTTON(p, q)                                          \
        case p##_BUTTON: {                                              \
@@ -748,6 +700,12 @@ make_toolbar_item(nsgtk_toolbar_button i, struct 
nsgtk_theme *theme)
                break;                                                  \
        }
 
+       MAKE_STOCKBUTTON(HOME, NSGTK_STOCK_HOME)
+       MAKE_STOCKBUTTON(BACK, NSGTK_STOCK_GO_BACK)
+       MAKE_STOCKBUTTON(FORWARD, NSGTK_STOCK_GO_FORWARD)
+       MAKE_STOCKBUTTON(STOP, NSGTK_STOCK_STOP)
+       MAKE_STOCKBUTTON(RELOAD, NSGTK_STOCK_REFRESH)
+
        MAKE_MENUBUTTON(NEWWINDOW, gtkNewWindow)
        MAKE_MENUBUTTON(NEWTAB, gtkNewTab)
        MAKE_MENUBUTTON(OPENFILE, gtkOpenFile)
@@ -791,8 +749,29 @@ make_toolbar_item(nsgtk_toolbar_button i, struct 
nsgtk_theme *theme)
        MAKE_MENUBUTTON(GUIDE, gtkGuide)
        MAKE_MENUBUTTON(INFO, gtkUserInformation)
        MAKE_MENUBUTTON(OPENMENU, gtkOpenMenu)
+
+#undef MAKE_STOCKBUTTON
 #undef MAKE_MENUBUTTON
 
+       case HISTORY_BUTTON:
+               w = gtk_tool_button_new(GTK_WIDGET(
+                               theme->image[HISTORY_BUTTON]), "H");
+               /* set history widget minimum width */
+               gtk_widget_set_size_request(GTK_WIDGET(w), 20, -1);
+               break;
+
+       case URL_BAR_ITEM:
+               w = make_toolbar_item_url_bar();
+               break;
+
+       case THROBBER_ITEM:
+               w = make_toolbar_item_throbber();
+               break;
+
+       case WEBSEARCH_ITEM:
+               w = make_toolbar_item_websearch();
+               break;
+
        default:
                break;
 
@@ -810,535 +789,6 @@ static GtkTargetEntry target_entry = {
         0
 };
 
-#if 0
-
-/**
- * toolbar customisation window context
- */
-struct nsgtk_toolbar_custom_store {
-       GtkWidget *window;
-       GtkWidget *store_buttons[PLACEHOLDER_BUTTON];
-       GtkWidget *widgetvbox;
-       GtkWidget *currentbar;
-       char numberh; /* current horizontal location while adding */
-       GtkBuilder *builder; /* button widgets to store */
-       int buttonlocations[PLACEHOLDER_BUTTON];
-       int currentbutton;
-       bool fromstore;
-};
-static struct nsgtk_toolbar_custom_store store;
-static struct nsgtk_toolbar_custom_store *window = &store;
-
-/* exported interface documented in gtk/scaffolding.h */
-static GtkToolbar *nsgtk_scaffolding_toolbar(struct nsgtk_scaffolding *g)
-{
-       return NULL;//g->tool_bar;
-}
-
-/**
- * callback function to iterate toolbar's widgets
- */
-static void nsgtk_toolbar_clear_toolbar(GtkWidget *widget, gpointer data)
-{
-       struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
-       gtk_container_remove(GTK_CONTAINER(nsgtk_scaffolding_toolbar(g)),
-                            widget);
-}
-
-/**
- * connect temporary handler for toolbar edit events
- *
- * \param g The scaffolding
- * \param bi The button index
- */
-static void nsgtk_toolbar_temp_connect(struct nsgtk_scaffolding *g,
-                                      nsgtk_toolbar_button bi)
-{
-       struct nsgtk_toolbar_item *bc;
-
-       if (bi != URL_BAR_ITEM) {
-               bc = nsgtk_scaffolding_button(g, bi);
-               if ((bc->button != NULL) && (bc->dataminus != NULL)) {
-                       g_signal_connect(bc->button,
-                                        "drag-data-get",
-                                        G_CALLBACK(bc->dataminus),
-                                        g);
-               }
-       }
-}
-
-/* exported interface documented in gtk/scaffolding.h */
-static void nsgtk_scaffolding_reset_offset(struct nsgtk_scaffolding *g)
-{
-       //g->offset = 0;
-}
-
-
-
-/**
- * called when hovering an item above the toolbar
- */
-static gboolean
-nsgtk_toolbar_action(GtkWidget *widget, GdkDragContext *gdc, gint x,
-               gint y, guint time, gpointer data)
-{
-       struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
-       GtkToolItem *item = gtk_tool_button_new(NULL, NULL);
-       if (item != NULL)
-               gtk_toolbar_set_drop_highlight_item(
-                               nsgtk_scaffolding_toolbar(g),
-                               GTK_TOOL_ITEM(item),
-                               gtk_toolbar_get_drop_index(
-                               nsgtk_scaffolding_toolbar(g), x, y));
-       return FALSE;
-}
-
-
-/**
- * add item to toolbar.
- *
- * the function should be called, when multiple items are being added,
- * in ascending order.
- *
- * \param g the scaffolding whose toolbar an item is added to.
- * \param i the location in the toolbar.
- * \param theme The theme in use.
- */
-static void
-nsgtk_toolbar_add_item_to_toolbar(struct nsgtk_scaffolding *g, int i,
-               struct nsgtk_theme *theme)
-{
-       int q;
-       for (q = BACK_BUTTON; q < PLACEHOLDER_BUTTON; q++)
-               if (nsgtk_scaffolding_button(g, q)->location == i) {
-                       nsgtk_scaffolding_button(g, q)->button = GTK_TOOL_ITEM(
-                                       make_toolbar_item(q, theme));
-                       gtk_toolbar_insert(nsgtk_scaffolding_toolbar(g),
-                                       nsgtk_scaffolding_button(g, q)->button,
-                                       i);
-                       break;
-               }
-}
-
-/**
- * cleanup code physical update of all toolbars; resensitize
- * \param g the 'front' scaffolding that called customize
- */
-static void nsgtk_toolbar_close(struct nsgtk_scaffolding *g)
-{
-       int i;
-
-       struct nsgtk_scaffolding *list;
-       struct nsgtk_theme *theme;
-
-       list = nsgtk_scaffolding_iterate(NULL);
-       while (list) {
-               theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, false);
-               if (theme == NULL) {
-                       nsgtk_warning(messages_get("NoMemory"), 0);
-                       continue;
-               }
-               /* clear toolbar */
-               gtk_container_foreach(GTK_CONTAINER(nsgtk_scaffolding_toolbar(
-                               list)), nsgtk_toolbar_clear_toolbar, list);
-               /* then add items */
-               for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-                       nsgtk_toolbar_add_item_to_toolbar(list, i, theme);
-               }
-               nsgtk_toolbar_connect_all(list);
-               gtk_widget_show_all(GTK_WIDGET(nsgtk_scaffolding_toolbar(
-                               list)));
-               nsgtk_scaffolding_set_sensitivity(list);
-               nsgtk_widget_override_background_color(
-                       
GTK_WIDGET(nsgtk_window_get_layout(nsgtk_scaffolding_top_level(list))),
-                       GTK_STATE_FLAG_NORMAL,
-                       0, 0xFFFF, 0xFFFF, 0xFFFF);
-               g_signal_handler_unblock(GTK_WIDGET(
-                               nsgtk_window_get_layout(
-                               nsgtk_scaffolding_top_level(list))),
-                               nsgtk_window_get_signalhandler(
-                               nsgtk_scaffolding_top_level(list),
-                               NSGTK_WINDOW_SIGNAL_CLICK));
-               g_signal_handler_unblock(GTK_WIDGET(
-                               nsgtk_window_get_layout(
-                               nsgtk_scaffolding_top_level(list))),
-                               nsgtk_window_get_signalhandler(
-                               nsgtk_scaffolding_top_level(list),
-                               NSGTK_WINDOW_SIGNAL_REDRAW));
-               browser_window_refresh_url_bar(
-                               nsgtk_get_browser_window(
-                               nsgtk_scaffolding_top_level(list)));
-
-               if (list != g)
-                       gtk_widget_set_sensitive(GTK_WIDGET(
-                                       nsgtk_scaffolding_window(list)), TRUE);
-               free(theme);
-               list = nsgtk_scaffolding_iterate(list);
-       }
-       gtk_widget_set_sensitive(GTK_WIDGET(nsgtk_scaffolding_notebook(g)),
-                       TRUE);
-       gtk_widget_set_sensitive(GTK_WIDGET(nsgtk_scaffolding_menu_bar(g)),
-                       TRUE);
-       /* update favicon etc */
-       nsgtk_scaffolding_set_top_level(nsgtk_scaffolding_top_level(g));
-
-       search_web_select_provider(-1);
-}
-
-
-/**
- * set toolbar logical -> physical; physically visible toolbar buttons are made
- * to correspond to the logically stored schema in terms of location
- * visibility etc
- */
-static void nsgtk_toolbar_set_physical(struct nsgtk_scaffolding *g)
-{
-       int i;
-       struct nsgtk_theme *theme;
-
-       theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, false);
-       if (theme == NULL) {
-               nsgtk_warning(messages_get("NoMemory"), 0);
-               return;
-       }
-       /* simplest is to clear the toolbar then reload it from memory */
-       gtk_container_foreach(GTK_CONTAINER(nsgtk_scaffolding_toolbar(g)),
-                       nsgtk_toolbar_clear_toolbar, g);
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               nsgtk_toolbar_add_item_to_toolbar(g, i, theme);
-       }
-       gtk_widget_show_all(GTK_WIDGET(nsgtk_scaffolding_toolbar(g)));
-       free(theme);
-}
-
-
-/**
- * when cancel button is clicked
- */
-static gboolean nsgtk_toolbar_cancel_clicked(GtkWidget *widget, gpointer data)
-{
-       struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
-
-       edit_mode = false;
-       /* reset g->buttons->location */
-       for (int i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               nsgtk_scaffolding_button(g, i)->location =
-                               window->buttonlocations[i];
-       }
-       nsgtk_toolbar_set_physical(g);
-       nsgtk_toolbar_connect_all(g);
-       nsgtk_toolbar_close(g);
-       nsgtk_scaffolding_set_sensitivity(g);
-       gtk_widget_destroy(window->window);
-       return TRUE;
-}
-
-/**
- * physically add widgets to store window
- */
-static bool nsgtk_toolbar_add_store_widget(GtkWidget *widget)
-{
-       if (window->numberh >= NSGTK_STORE_WIDTH) {
-               window->currentbar = gtk_toolbar_new();
-               if (window->currentbar == NULL) {
-                       nsgtk_warning("NoMemory", 0);
-                       return false;
-               }
-               gtk_toolbar_set_style(GTK_TOOLBAR(window->currentbar),
-                               GTK_TOOLBAR_BOTH);
-               gtk_toolbar_set_icon_size(GTK_TOOLBAR(window->currentbar),
-                               GTK_ICON_SIZE_LARGE_TOOLBAR);
-               gtk_box_pack_start(GTK_BOX(window->widgetvbox),
-                       window->currentbar, FALSE, FALSE, 0);
-               window->numberh = 0;
-       }
-       gtk_widget_set_size_request(widget, NSGTK_BUTTON_WIDTH,
-                       NSGTK_BUTTON_HEIGHT);
-       gtk_toolbar_insert(GTK_TOOLBAR(window->currentbar), GTK_TOOL_ITEM(
-                       widget), window->numberh++);
-       gtk_tool_item_set_use_drag_window(GTK_TOOL_ITEM(widget), TRUE);
-       gtk_drag_source_set(widget, GDK_BUTTON1_MASK, &entry, 1,
-                       GDK_ACTION_COPY);
-       gtk_widget_show_all(window->window);
-       return true;
-}
-
-
-/**
- * cast toolbar settings to all scaffoldings referenced from the global linked
- * list of gui_windows
- */
-static void nsgtk_toolbar_cast(struct nsgtk_scaffolding *g)
-{
-       int i;
-       struct nsgtk_scaffolding *list;
-
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               window->buttonlocations[i] =
-                               ((nsgtk_scaffolding_button(g, i)->location
-                               >= -1) &&
-                               (nsgtk_scaffolding_button(g, i)->location
-                               < PLACEHOLDER_BUTTON)) ?
-                               nsgtk_scaffolding_button(g, i)->location : -1;
-       }
-
-       list = nsgtk_scaffolding_iterate(NULL);
-       while (list) {
-               if (list != g)
-                       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++)
-                               nsgtk_scaffolding_button(list, i)->location =
-                                               window->buttonlocations[i];
-               list = nsgtk_scaffolding_iterate(list);
-       }
-}
-
-
-
-
-
-
-
-/**
- * when 'reload defaults' button is clicked
- */
-static gboolean nsgtk_toolbar_reset(GtkWidget *widget, gpointer data)
-{
-       struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
-       int i;
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++)
-               nsgtk_scaffolding_button(g, i)->location =
-                               (i <= THROBBER_ITEM) ? i : -1;
-       nsgtk_toolbar_set_physical(g);
-       for (i = BACK_BUTTON; i <= THROBBER_ITEM; i++) {
-               if (i == URL_BAR_ITEM)
-                       continue;
-               gtk_tool_item_set_use_drag_window(GTK_TOOL_ITEM(
-                               nsgtk_scaffolding_button(g, i)->button), TRUE);
-               gtk_drag_source_set(GTK_WIDGET(
-                               nsgtk_scaffolding_button(g, i)->button),
-                               GDK_BUTTON1_MASK, &entry, 1, GDK_ACTION_COPY);
-               nsgtk_toolbar_temp_connect(g, i);
-       }
-       return TRUE;
-}
-
-/**
- * when titlebar / alt-F4 window close event happens
- */
-static gboolean nsgtk_toolbar_delete(GtkWidget *widget, GdkEvent *event,
-               gpointer data)
-{
-       edit_mode = false;
-       struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
-       /* reset g->buttons->location */
-       for (int i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               nsgtk_scaffolding_button(g, i)->location =
-                               window->buttonlocations[i];
-       }
-       nsgtk_toolbar_set_physical(g);
-       nsgtk_toolbar_connect_all(g);
-       nsgtk_toolbar_close(g);
-       nsgtk_scaffolding_set_sensitivity(g);
-       gtk_widget_destroy(window->window);
-       return TRUE;
-}
-
-
-
-/**
- * create store window
- */
-static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g)
-{
-       struct nsgtk_theme *theme;
-       nserror res;
-
-       theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, true);
-       if (theme == NULL) {
-               nsgtk_warning(messages_get("NoMemory"), 0);
-               nsgtk_toolbar_cancel_clicked(NULL, g);
-               return;
-       }
-
-       res = nsgtk_builder_new_from_resname("toolbar", &window->builder);
-       if (res != NSERROR_OK) {
-               NSLOG(netsurf, INFO, "Toolbar UI builder init failed");
-               nsgtk_warning("Toolbar UI builder init failed", 0);
-               nsgtk_toolbar_cancel_clicked(NULL, g);
-               free(theme);
-               return;
-       }
-
-       gtk_builder_connect_signals(window->builder, NULL);
-
-       window->window = GTK_WIDGET(gtk_builder_get_object(
-                                           window->builder, "dialogToolbar"));
-       if (window->window == NULL) {
-               nsgtk_warning(messages_get("NoMemory"), 0);
-               nsgtk_toolbar_cancel_clicked(NULL, g);
-               free(theme);
-               return;
-       }
-
-       gtk_window_set_transient_for(GTK_WINDOW(window->window),
-                                    nsgtk_scaffolding_window(g));
-
-       window->widgetvbox = GTK_WIDGET(gtk_builder_get_object(
-                                               window->builder, "widgetvbox"));
-       if (window->widgetvbox == NULL) {
-               nsgtk_warning(messages_get("NoMemory"), 0);
-               nsgtk_toolbar_cancel_clicked(NULL, g);
-               free(theme);
-               return;
-       }
-
-       /* preset to width [in buttons] of */
-       window->numberh = NSGTK_STORE_WIDTH;
-
-       /*  store to cause creation of a new toolbar */
-       window->currentbutton = -1;
-
-       /* load toolbuttons */
-       /* add toolbuttons to window */
-       /* set event handlers */
-       for (int i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               if (i == URL_BAR_ITEM)
-                       continue;
-               window->store_buttons[i] =
-                       make_toolbar_item(i, theme);
-               if (window->store_buttons[i] == NULL) {
-                       nsgtk_warning(messages_get("NoMemory"), 0);
-                       continue;
-               }
-               nsgtk_toolbar_add_store_widget(window->store_buttons[i]);
-               g_signal_connect(window->store_buttons[i], "drag-data-get",
-                                G_CALLBACK(
-                                        nsgtk_scaffolding_button(g, 
i)->dataplus), g);
-       }
-       free(theme);
-
-
-       gtk_window_set_accept_focus(GTK_WINDOW(window->window), FALSE);
-
-       gtk_drag_dest_set(GTK_WIDGET(window->window), GTK_DEST_DEFAULT_MOTION |
-                         GTK_DEST_DEFAULT_DROP, &entry, 1, GDK_ACTION_COPY);
-
-       g_signal_connect(GTK_WIDGET(gtk_builder_get_object(
-                                           window->builder, "close")),
-                        "clicked",
-                        G_CALLBACK(nsgtk_toolbar_persist),
-                        g);
-
-       g_signal_connect(GTK_WIDGET(gtk_builder_get_object(
-                                           window->builder, "reset")),
-                        "clicked",
-                        G_CALLBACK(nsgtk_toolbar_reset),
-                        g);
-
-       g_signal_connect(window->window, "delete-event",
-                        G_CALLBACK(nsgtk_toolbar_delete), g);
-
-       g_signal_connect(window->window, "drag-drop",
-                        G_CALLBACK(nsgtk_toolbar_store_return), g);
-
-       g_signal_connect(window->window, "drag-motion",
-                        G_CALLBACK(nsgtk_toolbar_store_action), g);
-
-       gtk_widget_show_all(window->window);
-}
-
-/**
- * change behaviour of scaffoldings while editing toolbar
- *
- * All buttons as well as window clicks are desensitized; then buttons
- * in the front window are changed to movable buttons
- */
-void nsgtk_toolbar_customisation_init(struct nsgtk_scaffolding *g)
-{
-       int i;
-       struct nsgtk_scaffolding *list;
-       edit_mode = true;
-
-       list = nsgtk_scaffolding_iterate(NULL);
-       while (list) {
-               g_signal_handler_block(GTK_WIDGET(
-                               nsgtk_window_get_layout(
-                               nsgtk_scaffolding_top_level(list))),
-                               nsgtk_window_get_signalhandler(
-                               nsgtk_scaffolding_top_level(list),
-                               NSGTK_WINDOW_SIGNAL_CLICK));
-               g_signal_handler_block(GTK_WIDGET(
-                               nsgtk_window_get_layout(
-                               nsgtk_scaffolding_top_level(list))),
-                               nsgtk_window_get_signalhandler(
-                               nsgtk_scaffolding_top_level(list),
-                               NSGTK_WINDOW_SIGNAL_REDRAW));
-               nsgtk_widget_override_background_color(
-                       GTK_WIDGET(nsgtk_window_get_layout(
-                               nsgtk_scaffolding_top_level(list))),
-                       GTK_STATE_NORMAL, 0, 0xEEEE, 0xEEEE, 0xEEEE);
-
-               if (list == g) {
-                       list = nsgtk_scaffolding_iterate(list);
-                       continue;
-               }
-               /* set sensitive for all gui_windows save g */
-               gtk_widget_set_sensitive(GTK_WIDGET(nsgtk_scaffolding_window(
-                               list)), FALSE);
-               list = nsgtk_scaffolding_iterate(list);
-       }
-       /* set sensitive for all of g save toolbar */
-       gtk_widget_set_sensitive(GTK_WIDGET(nsgtk_scaffolding_menu_bar(g)),
-                       FALSE);
-       gtk_widget_set_sensitive(GTK_WIDGET(nsgtk_scaffolding_notebook(g)),
-                       FALSE);
-
-       /* set editable aspect for toolbar */
-       gtk_container_foreach(GTK_CONTAINER(nsgtk_scaffolding_toolbar(g)),
-                       nsgtk_toolbar_clear_toolbar, g);
-       nsgtk_toolbar_set_physical(g);
-       /* memorize button locations, set editable */
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               window->buttonlocations[i] = nsgtk_scaffolding_button(g, i)
-                               ->location;
-               if ((window->buttonlocations[i] == -1) || (i == URL_BAR_ITEM))
-                       continue;
-               gtk_tool_item_set_use_drag_window(GTK_TOOL_ITEM(
-                               nsgtk_scaffolding_button(g, i)->button), TRUE);
-               gtk_drag_source_set(GTK_WIDGET(nsgtk_scaffolding_button(
-                               g, i)->button), GDK_BUTTON1_MASK, &entry, 1,
-                               GDK_ACTION_COPY);
-               nsgtk_toolbar_temp_connect(g, i);
-       }
-
-       /* add move button listeners */
-       g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_toolbar(g)),
-                       "drag-drop",
-                        G_CALLBACK(nsgtk_toolbar_data),
-                        g);
-       g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_toolbar(g)),
-                       "drag-data-received",
-                        G_CALLBACK(nsgtk_toolbar_move_complete),
-                        g);
-       g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_toolbar(g)),
-                       "drag-motion",
-                        G_CALLBACK(nsgtk_toolbar_action),
-                        g);
-       g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_toolbar(g)),
-                       "drag-leave",
-                        G_CALLBACK(nsgtk_toolbar_clear),
-                        g);
-
-       /* set data types */
-       gtk_drag_dest_set(GTK_WIDGET(nsgtk_scaffolding_toolbar(g)),
-                       GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
-                       &entry, 1, GDK_ACTION_COPY);
-
-       /* open toolbar window */
-       nsgtk_toolbar_window_open(g);
-}
-#endif
-
 
 /**
  * save toolbar settings to file
@@ -1391,26 +841,6 @@ nsgtk_toolbar_customisation_save(struct 
nsgtk_toolbar_customisation *tbc)
 
 
 /**
- * customisation apply handler for clicked signal
- *
- * when 'save settings' button is clicked
- */
-static gboolean
-customisation_apply_clicked_cb(GtkWidget *widget, gpointer data)
-{
-       struct nsgtk_toolbar_customisation *tbc;
-       tbc = (struct nsgtk_toolbar_customisation *)data;
-
-       /* save state to file, update toolbars for all windows */
-       nsgtk_toolbar_customisation_save(tbc);
-       nsgtk_window_toolbar_update();
-       gtk_widget_destroy(tbc->container);
-
-       return TRUE;
-}
-
-
-/**
  * find the toolbar item with a given location.
  *
  * \param tb the toolbar instance
@@ -1505,6 +935,7 @@ customisation_container_drag_drop_cb(GtkWidget *widget,
        return FALSE;
 }
 
+
 /**
  * customisation container handler for drag motion signal
  *
@@ -1668,6 +1099,7 @@ customisation_toolbar_drag_leave_cb(GtkWidget *widget,
        gtk_toolbar_set_drop_highlight_item(GTK_TOOLBAR(widget), NULL, 0);
 }
 
+
 /**
  * create a new browser window
  *
@@ -1730,22 +1162,6 @@ int nsgtk_toolbar_get_id_from_widget(GtkWidget *widget,
 }
 
 
-
-/**
- * connect 'normal' handlers to toolbar buttons
- */
-void nsgtk_toolbar_connect_all(struct nsgtk_scaffolding *g)
-{
-       int q, i;
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               q = nsgtk_toolbar_get_id_at_location(g, i);
-               if (q == -1)
-                       continue;
-
-       }
-}
-
-
 /**
  * Apply the user toolbar button settings from configuration
  *
@@ -1888,7 +1304,6 @@ static nserror populate_gtk_toolbar_widget(struct 
nsgtk_toolbar *tb)
 }
 
 
-
 /**
  * find the toolbar item with a given gtk widget.
  *
@@ -2177,6 +1592,91 @@ toolbar_customisation_create_toolbox(struct 
nsgtk_toolbar_customisation *tbc,
        return NSERROR_OK;
 }
 
+
+/**
+ * customisation apply handler for clicked signal
+ *
+ * when 'save settings' button is clicked
+ */
+static gboolean
+customisation_apply_clicked_cb(GtkWidget *widget, gpointer data)
+{
+       struct nsgtk_toolbar_customisation *tbc;
+       tbc = (struct nsgtk_toolbar_customisation *)data;
+
+       /* save state to file, update toolbars for all windows */
+       nsgtk_toolbar_customisation_save(tbc);
+       nsgtk_window_toolbar_update();
+       gtk_widget_destroy(tbc->container);
+
+       return TRUE;
+}
+
+
+/**
+ * update toolbar in customisation to user settings
+ */
+static nserror
+customisation_toolbar_update(struct nsgtk_toolbar_customisation *tbc)
+{
+       GtkEntry *entry;
+       nserror res;
+
+       res = apply_user_button_customisation(&tbc->toolbar);
+       if (res != NSERROR_OK) {
+               return res;
+       }
+
+       /* populate toolbar widget */
+       res = populate_gtk_toolbar_widget(&tbc->toolbar);
+       if (res != NSERROR_OK) {
+               return res;
+       }
+
+       /* ensure icon sizes and text labels on toolbar are set */
+       res = nsgtk_toolbar_restyle(&tbc->toolbar);
+       if (res != NSERROR_OK) {
+               return res;
+       }
+
+       /* attach handlers to toolbar widgets */
+       res = toolbar_customisation_connect_signals(&tbc->toolbar);
+       if (res != NSERROR_OK) {
+               return res;
+       }
+
+       if (tbc->toolbar.buttons[URL_BAR_ITEM]->location != INACTIVE_LOCATION) {
+               entry = 
GTK_ENTRY(gtk_bin_get_child(GTK_BIN(tbc->toolbar.buttons[URL_BAR_ITEM]->button)));
+
+               gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
+       }
+
+       if (tbc->toolbar.buttons[WEBSEARCH_ITEM]->location != 
INACTIVE_LOCATION) {
+               entry = 
GTK_ENTRY(gtk_bin_get_child(GTK_BIN(tbc->toolbar.buttons[WEBSEARCH_ITEM]->button)));
+
+               gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
+       }
+
+       return NSERROR_OK;
+}
+
+/**
+ * customisation reset handler for clicked signal
+ *
+ * when 'reload defaults' button is clicked
+ */
+static gboolean
+customisation_reset_clicked_cb(GtkWidget *widget, gpointer data)
+{
+       struct nsgtk_toolbar_customisation *tbc;
+       tbc = (struct nsgtk_toolbar_customisation *)data;
+
+       customisation_toolbar_update(tbc);
+
+       return TRUE;
+}
+
+
 /*
  * Toolbar button clicked handlers
  */
@@ -2254,45 +1754,12 @@ static gboolean cutomize_button_clicked_cb(GtkWidget 
*widget, gpointer data)
                }
        }
 
-       res = apply_user_button_customisation(&tbc->toolbar);
+       res = customisation_toolbar_update(tbc);
        if (res != NSERROR_OK) {
                goto cutomize_button_clicked_cb_error;
        }
 
-       /* populate toolbar widget */
-       res = populate_gtk_toolbar_widget(&tbc->toolbar);
-       if (res != NSERROR_OK) {
-               goto cutomize_button_clicked_cb_error;
-       }
-
-       /* ensure icon sizes and text labels on toolbar are set */
-       res = nsgtk_toolbar_restyle(&tbc->toolbar);
-       if (res != NSERROR_OK) {
-               goto cutomize_button_clicked_cb_error;
-       }
-
-       /* attach handlers to toolbar widgets */
-       res = toolbar_customisation_connect_signals(&tbc->toolbar);
-       if (res != NSERROR_OK) {
-               goto cutomize_button_clicked_cb_error;
-       }
-
-       if (tbc->toolbar.buttons[URL_BAR_ITEM]->location != INACTIVE_LOCATION) {
-               GtkEntry *entry;
-               entry = 
GTK_ENTRY(gtk_bin_get_child(GTK_BIN(tbc->toolbar.buttons[URL_BAR_ITEM]->button)));
-
-               gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
-       }
-
-       if (tbc->toolbar.buttons[WEBSEARCH_ITEM]->location != 
INACTIVE_LOCATION) {
-               GtkEntry *entry;
-               entry = 
GTK_ENTRY(gtk_bin_get_child(GTK_BIN(tbc->toolbar.buttons[WEBSEARCH_ITEM]->button)));
-
-               gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
-       }
-
        /* use toolbox for widgets to drag to/from */
-
        gtk_widget_get_allocation(GTK_WIDGET(notebook), &notebook_alloc);
 
        res = toolbar_customisation_create_toolbox(tbc, notebook_alloc.width);
@@ -2300,11 +1767,6 @@ static gboolean cutomize_button_clicked_cb(GtkWidget 
*widget, gpointer data)
                goto cutomize_button_clicked_cb_error;
        }
 
-
-       /* save and update on apply button then discard */
-       /* discard button causes destruction */
-       /* close and cleanup on destroy signal */
-
        /* configure the container */
        gtk_drag_dest_set(GTK_WIDGET(tbc->container),
                          GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
@@ -2312,22 +1774,26 @@ static gboolean cutomize_button_clicked_cb(GtkWidget 
*widget, gpointer data)
                          1,
                          GDK_ACTION_COPY);
 
+       /* discard button calls destroy */
        g_signal_connect_swapped(GTK_WIDGET(gtk_builder_get_object(builder,
                                                                   "discard")),
                                 "clicked",
                                 G_CALLBACK(gtk_widget_destroy),
                                 tbc->container);
 
+       /* save and update on apply button  */
        g_signal_connect(GTK_WIDGET(gtk_builder_get_object(builder, "apply")),
                         "clicked",
                         G_CALLBACK(customisation_apply_clicked_cb),
                         tbc);
 
-#if 0
        g_signal_connect(GTK_WIDGET(gtk_builder_get_object(builder, "reset")),
                         "clicked",
-                        G_CALLBACK(nsgtk_toolbar_reset),
-                        g);
+                        G_CALLBACK(customisation_reset_clicked_cb),
+                        tbc);
+
+       /* close and cleanup on destroy signal */
+#if 0
 
        g_signal_connect(tbc->container,
                         "delete-event",


-----------------------------------------------------------------------

Summary of changes:
 frontends/gtk/toolbar.c |  993 +++++++++++------------------------------------
 1 file changed, 234 insertions(+), 759 deletions(-)

diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index 9c51b5b..e137e82 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -181,7 +181,7 @@ static bool edit_mode = false;
 
 /* the 'standard' width of a button that makes sufficient of its label
 visible */
-#define NSGTK_BUTTON_WIDTH 130
+#define NSGTK_BUTTON_WIDTH 120
 
 /* the 'standard' height of a button that fits as many toolbars as
 possible into the store */
@@ -191,7 +191,6 @@ possible into the store */
 #define NSGTK_WEBSEARCH_WIDTH 150
 
 
-
 enum image_sets {
        IMAGE_SET_MAIN_MENU = 0,
        IMAGE_SET_RCLICK_MENU,
@@ -213,7 +212,6 @@ struct nsgtk_theme {
 };
 
 /* forward declaration */
-void nsgtk_toolbar_connect_all(struct nsgtk_scaffolding *g);
 int nsgtk_toolbar_get_id_from_widget(GtkWidget *widget, struct 
nsgtk_scaffolding *g);
 static nserror toolbar_item_create(nsgtk_toolbar_button id, struct 
nsgtk_toolbar_item **item_out);
 
@@ -325,6 +323,7 @@ nsgtk_theme_image_default(nsgtk_toolbar_button tbbutton,
        return image;
 }
 
+
 /**
  * Get default image for search buttons / menu items from gtk stock items
  *
@@ -333,7 +332,6 @@ nsgtk_theme_image_default(nsgtk_toolbar_button tbbutton,
  * \param usedef Use the default image if not found.
  * \return default search image.
  */
-
 static GtkImage *
 nsgtk_theme_searchimage_default(nsgtk_search_buttons tbbutton,
                                GtkIconSize iconsize,
@@ -510,26 +508,6 @@ void nsgtk_theme_implement(struct nsgtk_scaffolding *g)
 }
 
 
-
-/**
- * get scaffolding button index of button at location
- *
- * \return toolbar item id from location when there is an item at that logical
- * location; else -1
- */
-static nsgtk_toolbar_button
-nsgtk_toolbar_get_id_at_location(struct nsgtk_scaffolding *g, int i)
-{
-       int q;
-       for (q = BACK_BUTTON; q < PLACEHOLDER_BUTTON; q++) {
-               if (nsgtk_scaffolding_button(g, q)->location == i) {
-                       return q;
-               }
-       }
-       return -1;
-}
-
-
 /**
  * returns a string without its underscores
  *
@@ -564,7 +542,7 @@ static char *remove_underscores(const char *s, bool 
replacespace)
  * create a gtk entry widget with a completion attached
  */
 static GtkToolItem *
-make_toolbar_item_throbber(void)
+make_toolbar_item_throbber(bool sensitivity)
 {
        nserror res;
        GtkToolItem *item;
@@ -593,6 +571,8 @@ make_toolbar_item_throbber(void)
                        gtk_container_add(GTK_CONTAINER(item), image);
                }
        }
+       gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
+
        return item;
 }
 
@@ -602,7 +582,7 @@ make_toolbar_item_throbber(void)
  * create a gtk entry widget with a completion attached
  */
 static GtkToolItem *
-make_toolbar_item_url_bar(void)
+make_toolbar_item_url_bar(bool sensitivity)
 {
        GtkToolItem *item;
        GtkWidget *entry;
@@ -616,10 +596,17 @@ make_toolbar_item_url_bar(void)
                return NULL;
        }
 
-       gtk_entry_set_completion(GTK_ENTRY(entry), completion);
+       gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
+
        gtk_container_add(GTK_CONTAINER(item), entry);
        gtk_tool_item_set_expand(item, TRUE);
 
+       if (edit_mode) {
+               gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
+       } else {
+               gtk_entry_set_completion(GTK_ENTRY(entry), completion);
+       }
+
        return item;
 }
 
@@ -628,48 +615,45 @@ make_toolbar_item_url_bar(void)
  * create web search toolbar item widget
  */
 static GtkToolItem *
-make_toolbar_item_websearch(void)
+make_toolbar_item_websearch(bool sensitivity)
 {
        GtkToolItem *item;
+       nserror res;
+       GtkWidget *entry;
+       struct bitmap *bitmap;
+       GdkPixbuf *pixbuf = NULL;
 
-       if (edit_mode) {
-               item = gtk_tool_button_new(
-                               GTK_WIDGET(nsgtk_image_new_from_stock(
-                                               NSGTK_STOCK_FIND,
-                                               GTK_ICON_SIZE_LARGE_TOOLBAR)),
-                               "[websearch]");
-       } else {
-               nserror res;
-               GtkWidget *entry;
-               struct bitmap *bitmap;
-               GdkPixbuf *pixbuf = NULL;
+       entry = nsgtk_entry_new();
+       item = gtk_tool_item_new();
 
-               entry = nsgtk_entry_new();
-               item = gtk_tool_item_new();
+       if ((entry == NULL) || (item == NULL)) {
+               return NULL;
+       }
 
-               if ((entry == NULL) || (item == NULL)) {
-                       return NULL;
-               }
+       gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
 
-               gtk_widget_set_size_request(entry, NSGTK_WEBSEARCH_WIDTH, -1);
+       gtk_widget_set_size_request(entry, NSGTK_WEBSEARCH_WIDTH, -1);
 
-               res = search_web_get_provider_bitmap(&bitmap);
-               if ((res == NSERROR_OK) && (bitmap != NULL)) {
-                       pixbuf = nsgdk_pixbuf_get_from_surface(bitmap->surface,
-                                                              16, 16);
-               }
+       res = search_web_get_provider_bitmap(&bitmap);
+       if ((res == NSERROR_OK) && (bitmap != NULL)) {
+               pixbuf = nsgdk_pixbuf_get_from_surface(bitmap->surface,
+                                                      16, 16);
+       }
 
-               if (pixbuf != NULL) {
-                       nsgtk_entry_set_icon_from_pixbuf(entry,
-                                                        GTK_ENTRY_ICON_PRIMARY,
-                                                        pixbuf);
-               } else {
-                       nsgtk_entry_set_icon_from_stock(entry,
-                                                       GTK_ENTRY_ICON_PRIMARY,
-                                                       NSGTK_STOCK_INFO);
-               }
+       if (pixbuf != NULL) {
+               nsgtk_entry_set_icon_from_pixbuf(entry,
+                                                GTK_ENTRY_ICON_PRIMARY,
+                                                pixbuf);
+       } else {
+               nsgtk_entry_set_icon_from_stock(entry,
+                                               GTK_ENTRY_ICON_PRIMARY,
+                                               NSGTK_STOCK_INFO);
+       }
+
+       gtk_container_add(GTK_CONTAINER(item), entry);
 
-               gtk_container_add(GTK_CONTAINER(item), entry);
+       if (edit_mode) {
+               gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
        }
 
        return item;
@@ -684,115 +668,99 @@ make_toolbar_item_websearch(void)
  * \return gtk widget
  */
 static GtkToolItem *
-make_toolbar_item(nsgtk_toolbar_button i, struct nsgtk_theme *theme)
+make_toolbar_item(nsgtk_toolbar_button itemid,
+                 struct nsgtk_theme *theme,
+                 bool sensitivity)
 {
        GtkToolItem *w = NULL;
 
-       switch(i) {
+       switch(itemid) {
 
-/* gtk_tool_button_new() accepts NULL args */
-#define MAKE_STOCKBUTTON(p, q)                                 \
-       case p##_BUTTON: {                                      \
-               GtkStockItem item;                                      \
+/* gtk_tool_button_new accepts NULL args */
+#define MAKE_ITEM(p, q)                                                        
\
+       case p##_BUTTON: {                                              \
                char *label = NULL;                                     \
-               if (nsgtk_stock_lookup(q, &item) &&                     \
-                   (item.label != NULL) &&                             \
-                   ((label = remove_underscores(item.label, false)) != NULL)) 
{ \
-                       w = gtk_tool_button_new(GTK_WIDGET(     \
-                                          theme->image[p##_BUTTON]), label); \
+               label = remove_underscores(messages_get(#q), false);    \
+               w = gtk_tool_button_new(GTK_WIDGET(theme->image[p##_BUTTON]), \
+                                       label);                         \
+               gtk_widget_set_sensitive(GTK_WIDGET(w), sensitivity);   \
+               if (label != NULL) {                                    \
                        free(label);                                    \
-               } else {                                                \
-                       w = gtk_tool_button_new(GTK_WIDGET(     \
-                                          theme->image[p##_BUTTON]), q); \
                }                                                       \
                break;                                                  \
        }
 
-       MAKE_STOCKBUTTON(HOME, NSGTK_STOCK_HOME)
-       MAKE_STOCKBUTTON(BACK, NSGTK_STOCK_GO_BACK)
-       MAKE_STOCKBUTTON(FORWARD, NSGTK_STOCK_GO_FORWARD)
-       MAKE_STOCKBUTTON(STOP, NSGTK_STOCK_STOP)
-       MAKE_STOCKBUTTON(RELOAD, NSGTK_STOCK_REFRESH)
-#undef MAKE_STOCKBUTTON
+       MAKE_ITEM(HOME, gtkHome)
+       MAKE_ITEM(BACK, gtkBack)
+       MAKE_ITEM(FORWARD, gtkForward)
+       MAKE_ITEM(STOP, Stop)
+       MAKE_ITEM(RELOAD, Reload)
+       MAKE_ITEM(NEWWINDOW, gtkNewWindow)
+       MAKE_ITEM(NEWTAB, gtkNewTab)
+       MAKE_ITEM(OPENFILE, gtkOpenFile)
+       MAKE_ITEM(CLOSETAB, gtkCloseTab)
+       MAKE_ITEM(CLOSEWINDOW, gtkCloseWindow)
+       MAKE_ITEM(SAVEPAGE, gtkSavePage)
+       MAKE_ITEM(PRINTPREVIEW, gtkPrintPreview)
+       MAKE_ITEM(PRINT, gtkPrint)
+       MAKE_ITEM(QUIT, gtkQuitMenu)
+       MAKE_ITEM(CUT, gtkCut)
+       MAKE_ITEM(COPY, gtkCopy)
+       MAKE_ITEM(PASTE, gtkPaste)
+       MAKE_ITEM(DELETE, gtkDelete)
+       MAKE_ITEM(SELECTALL, gtkSelectAll)
+       MAKE_ITEM(PREFERENCES, gtkPreferences)
+       MAKE_ITEM(ZOOMPLUS, gtkZoomPlus)
+       MAKE_ITEM(ZOOMMINUS, gtkZoomMinus)
+       MAKE_ITEM(ZOOMNORMAL, gtkZoomNormal)
+       MAKE_ITEM(FULLSCREEN, gtkFullScreen)
+       MAKE_ITEM(VIEWSOURCE, gtkViewSource)
+       MAKE_ITEM(CONTENTS, gtkContents)
+       MAKE_ITEM(ABOUT, gtkAbout)
+       MAKE_ITEM(PDF, gtkPDF)
+       MAKE_ITEM(PLAINTEXT, gtkPlainText)
+       MAKE_ITEM(DRAWFILE, gtkDrawFile)
+       MAKE_ITEM(POSTSCRIPT, gtkPostScript)
+       MAKE_ITEM(FIND, gtkFind)
+       MAKE_ITEM(DOWNLOADS, gtkDownloads)
+       MAKE_ITEM(SAVEWINDOWSIZE, gtkSaveWindowSize)
+       MAKE_ITEM(TOGGLEDEBUGGING, gtkToggleDebugging)
+       MAKE_ITEM(SAVEBOXTREE, gtkDebugBoxTree)
+       MAKE_ITEM(SAVEDOMTREE, gtkDebugDomTree)
+       MAKE_ITEM(LOCALHISTORY, gtkLocalHistory)
+       MAKE_ITEM(GLOBALHISTORY, gtkGlobalHistory)
+       MAKE_ITEM(ADDBOOKMARKS, gtkAddBookMarks)
+       MAKE_ITEM(SHOWBOOKMARKS, gtkShowBookMarks)
+       MAKE_ITEM(SHOWCOOKIES, gtkShowCookies)
+       MAKE_ITEM(OPENLOCATION, gtkOpenLocation)
+       MAKE_ITEM(NEXTTAB, gtkNextTab)
+       MAKE_ITEM(PREVTAB, gtkPrevTab)
+       MAKE_ITEM(GUIDE, gtkGuide)
+       MAKE_ITEM(INFO, gtkUserInformation)
+       MAKE_ITEM(OPENMENU, gtkOpenMenu)
+
+#undef MAKE_ITEM
 
        case HISTORY_BUTTON:
                w = gtk_tool_button_new(GTK_WIDGET(
                                theme->image[HISTORY_BUTTON]), "H");
                /* set history widget minimum width */
                gtk_widget_set_size_request(GTK_WIDGET(w), 20, -1);
+               gtk_widget_set_sensitive(GTK_WIDGET(w), sensitivity);
                break;
 
        case URL_BAR_ITEM:
-               w = make_toolbar_item_url_bar();
+               w = make_toolbar_item_url_bar(sensitivity);
                break;
 
        case THROBBER_ITEM:
-               w = make_toolbar_item_throbber();
+               w = make_toolbar_item_throbber(sensitivity);
                break;
 
        case WEBSEARCH_ITEM:
-               w = make_toolbar_item_websearch();
+               w = make_toolbar_item_websearch(sensitivity);
                break;
 
-/* gtk_tool_button_new accepts NULL args */
-#define MAKE_MENUBUTTON(p, q)                                          \
-       case p##_BUTTON: {                                              \
-               char *label = NULL;                                     \
-               label = remove_underscores(messages_get(#q), false);    \
-               w = gtk_tool_button_new(                        \
-                                       GTK_WIDGET(theme->image[p##_BUTTON]), \
-                                       label);                 \
-               if (label != NULL) {                                    \
-                       free(label);                                    \
-               }                                                       \
-               break;                                                  \
-       }
-
-       MAKE_MENUBUTTON(NEWWINDOW, gtkNewWindow)
-       MAKE_MENUBUTTON(NEWTAB, gtkNewTab)
-       MAKE_MENUBUTTON(OPENFILE, gtkOpenFile)
-       MAKE_MENUBUTTON(CLOSETAB, gtkCloseTab)
-       MAKE_MENUBUTTON(CLOSEWINDOW, gtkCloseWindow)
-       MAKE_MENUBUTTON(SAVEPAGE, gtkSavePage)
-       MAKE_MENUBUTTON(PRINTPREVIEW, gtkPrintPreview)
-       MAKE_MENUBUTTON(PRINT, gtkPrint)
-       MAKE_MENUBUTTON(QUIT, gtkQuitMenu)
-       MAKE_MENUBUTTON(CUT, gtkCut)
-       MAKE_MENUBUTTON(COPY, gtkCopy)
-       MAKE_MENUBUTTON(PASTE, gtkPaste)
-       MAKE_MENUBUTTON(DELETE, gtkDelete)
-       MAKE_MENUBUTTON(SELECTALL, gtkSelectAll)
-       MAKE_MENUBUTTON(PREFERENCES, gtkPreferences)
-       MAKE_MENUBUTTON(ZOOMPLUS, gtkZoomPlus)
-       MAKE_MENUBUTTON(ZOOMMINUS, gtkZoomMinus)
-       MAKE_MENUBUTTON(ZOOMNORMAL, gtkZoomNormal)
-       MAKE_MENUBUTTON(FULLSCREEN, gtkFullScreen)
-       MAKE_MENUBUTTON(VIEWSOURCE, gtkViewSource)
-       MAKE_MENUBUTTON(CONTENTS, gtkContents)
-       MAKE_MENUBUTTON(ABOUT, gtkAbout)
-       MAKE_MENUBUTTON(PDF, gtkPDF)
-       MAKE_MENUBUTTON(PLAINTEXT, gtkPlainText)
-       MAKE_MENUBUTTON(DRAWFILE, gtkDrawFile)
-       MAKE_MENUBUTTON(POSTSCRIPT, gtkPostScript)
-       MAKE_MENUBUTTON(FIND, gtkFind)
-       MAKE_MENUBUTTON(DOWNLOADS, gtkDownloads)
-       MAKE_MENUBUTTON(SAVEWINDOWSIZE, gtkSaveWindowSize)
-       MAKE_MENUBUTTON(TOGGLEDEBUGGING, gtkToggleDebugging)
-       MAKE_MENUBUTTON(SAVEBOXTREE, gtkDebugBoxTree)
-       MAKE_MENUBUTTON(SAVEDOMTREE, gtkDebugDomTree)
-       MAKE_MENUBUTTON(LOCALHISTORY, gtkLocalHistory)
-       MAKE_MENUBUTTON(GLOBALHISTORY, gtkGlobalHistory)
-       MAKE_MENUBUTTON(ADDBOOKMARKS, gtkAddBookMarks)
-       MAKE_MENUBUTTON(SHOWBOOKMARKS, gtkShowBookMarks)
-       MAKE_MENUBUTTON(SHOWCOOKIES, gtkShowCookies)
-       MAKE_MENUBUTTON(OPENLOCATION, gtkOpenLocation)
-       MAKE_MENUBUTTON(NEXTTAB, gtkNextTab)
-       MAKE_MENUBUTTON(PREVTAB, gtkPrevTab)
-       MAKE_MENUBUTTON(GUIDE, gtkGuide)
-       MAKE_MENUBUTTON(INFO, gtkUserInformation)
-       MAKE_MENUBUTTON(OPENMENU, gtkOpenMenu)
-#undef MAKE_MENUBUTTON
-
        default:
                break;
 
@@ -810,535 +778,6 @@ static GtkTargetEntry target_entry = {
         0
 };
 
-#if 0
-
-/**
- * toolbar customisation window context
- */
-struct nsgtk_toolbar_custom_store {
-       GtkWidget *window;
-       GtkWidget *store_buttons[PLACEHOLDER_BUTTON];
-       GtkWidget *widgetvbox;
-       GtkWidget *currentbar;
-       char numberh; /* current horizontal location while adding */
-       GtkBuilder *builder; /* button widgets to store */
-       int buttonlocations[PLACEHOLDER_BUTTON];
-       int currentbutton;
-       bool fromstore;
-};
-static struct nsgtk_toolbar_custom_store store;
-static struct nsgtk_toolbar_custom_store *window = &store;
-
-/* exported interface documented in gtk/scaffolding.h */
-static GtkToolbar *nsgtk_scaffolding_toolbar(struct nsgtk_scaffolding *g)
-{
-       return NULL;//g->tool_bar;
-}
-
-/**
- * callback function to iterate toolbar's widgets
- */
-static void nsgtk_toolbar_clear_toolbar(GtkWidget *widget, gpointer data)
-{
-       struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
-       gtk_container_remove(GTK_CONTAINER(nsgtk_scaffolding_toolbar(g)),
-                            widget);
-}
-
-/**
- * connect temporary handler for toolbar edit events
- *
- * \param g The scaffolding
- * \param bi The button index
- */
-static void nsgtk_toolbar_temp_connect(struct nsgtk_scaffolding *g,
-                                      nsgtk_toolbar_button bi)
-{
-       struct nsgtk_toolbar_item *bc;
-
-       if (bi != URL_BAR_ITEM) {
-               bc = nsgtk_scaffolding_button(g, bi);
-               if ((bc->button != NULL) && (bc->dataminus != NULL)) {
-                       g_signal_connect(bc->button,
-                                        "drag-data-get",
-                                        G_CALLBACK(bc->dataminus),
-                                        g);
-               }
-       }
-}
-
-/* exported interface documented in gtk/scaffolding.h */
-static void nsgtk_scaffolding_reset_offset(struct nsgtk_scaffolding *g)
-{
-       //g->offset = 0;
-}
-
-
-
-/**
- * called when hovering an item above the toolbar
- */
-static gboolean
-nsgtk_toolbar_action(GtkWidget *widget, GdkDragContext *gdc, gint x,
-               gint y, guint time, gpointer data)
-{
-       struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
-       GtkToolItem *item = gtk_tool_button_new(NULL, NULL);
-       if (item != NULL)
-               gtk_toolbar_set_drop_highlight_item(
-                               nsgtk_scaffolding_toolbar(g),
-                               GTK_TOOL_ITEM(item),
-                               gtk_toolbar_get_drop_index(
-                               nsgtk_scaffolding_toolbar(g), x, y));
-       return FALSE;
-}
-
-
-/**
- * add item to toolbar.
- *
- * the function should be called, when multiple items are being added,
- * in ascending order.
- *
- * \param g the scaffolding whose toolbar an item is added to.
- * \param i the location in the toolbar.
- * \param theme The theme in use.
- */
-static void
-nsgtk_toolbar_add_item_to_toolbar(struct nsgtk_scaffolding *g, int i,
-               struct nsgtk_theme *theme)
-{
-       int q;
-       for (q = BACK_BUTTON; q < PLACEHOLDER_BUTTON; q++)
-               if (nsgtk_scaffolding_button(g, q)->location == i) {
-                       nsgtk_scaffolding_button(g, q)->button = GTK_TOOL_ITEM(
-                                       make_toolbar_item(q, theme));
-                       gtk_toolbar_insert(nsgtk_scaffolding_toolbar(g),
-                                       nsgtk_scaffolding_button(g, q)->button,
-                                       i);
-                       break;
-               }
-}
-
-/**
- * cleanup code physical update of all toolbars; resensitize
- * \param g the 'front' scaffolding that called customize
- */
-static void nsgtk_toolbar_close(struct nsgtk_scaffolding *g)
-{
-       int i;
-
-       struct nsgtk_scaffolding *list;
-       struct nsgtk_theme *theme;
-
-       list = nsgtk_scaffolding_iterate(NULL);
-       while (list) {
-               theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, false);
-               if (theme == NULL) {
-                       nsgtk_warning(messages_get("NoMemory"), 0);
-                       continue;
-               }
-               /* clear toolbar */
-               gtk_container_foreach(GTK_CONTAINER(nsgtk_scaffolding_toolbar(
-                               list)), nsgtk_toolbar_clear_toolbar, list);
-               /* then add items */
-               for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-                       nsgtk_toolbar_add_item_to_toolbar(list, i, theme);
-               }
-               nsgtk_toolbar_connect_all(list);
-               gtk_widget_show_all(GTK_WIDGET(nsgtk_scaffolding_toolbar(
-                               list)));
-               nsgtk_scaffolding_set_sensitivity(list);
-               nsgtk_widget_override_background_color(
-                       
GTK_WIDGET(nsgtk_window_get_layout(nsgtk_scaffolding_top_level(list))),
-                       GTK_STATE_FLAG_NORMAL,
-                       0, 0xFFFF, 0xFFFF, 0xFFFF);
-               g_signal_handler_unblock(GTK_WIDGET(
-                               nsgtk_window_get_layout(
-                               nsgtk_scaffolding_top_level(list))),
-                               nsgtk_window_get_signalhandler(
-                               nsgtk_scaffolding_top_level(list),
-                               NSGTK_WINDOW_SIGNAL_CLICK));
-               g_signal_handler_unblock(GTK_WIDGET(
-                               nsgtk_window_get_layout(
-                               nsgtk_scaffolding_top_level(list))),
-                               nsgtk_window_get_signalhandler(
-                               nsgtk_scaffolding_top_level(list),
-                               NSGTK_WINDOW_SIGNAL_REDRAW));
-               browser_window_refresh_url_bar(
-                               nsgtk_get_browser_window(
-                               nsgtk_scaffolding_top_level(list)));
-
-               if (list != g)
-                       gtk_widget_set_sensitive(GTK_WIDGET(
-                                       nsgtk_scaffolding_window(list)), TRUE);
-               free(theme);
-               list = nsgtk_scaffolding_iterate(list);
-       }
-       gtk_widget_set_sensitive(GTK_WIDGET(nsgtk_scaffolding_notebook(g)),
-                       TRUE);
-       gtk_widget_set_sensitive(GTK_WIDGET(nsgtk_scaffolding_menu_bar(g)),
-                       TRUE);
-       /* update favicon etc */
-       nsgtk_scaffolding_set_top_level(nsgtk_scaffolding_top_level(g));
-
-       search_web_select_provider(-1);
-}
-
-
-/**
- * set toolbar logical -> physical; physically visible toolbar buttons are made
- * to correspond to the logically stored schema in terms of location
- * visibility etc
- */
-static void nsgtk_toolbar_set_physical(struct nsgtk_scaffolding *g)
-{
-       int i;
-       struct nsgtk_theme *theme;
-
-       theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, false);
-       if (theme == NULL) {
-               nsgtk_warning(messages_get("NoMemory"), 0);
-               return;
-       }
-       /* simplest is to clear the toolbar then reload it from memory */
-       gtk_container_foreach(GTK_CONTAINER(nsgtk_scaffolding_toolbar(g)),
-                       nsgtk_toolbar_clear_toolbar, g);
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               nsgtk_toolbar_add_item_to_toolbar(g, i, theme);
-       }
-       gtk_widget_show_all(GTK_WIDGET(nsgtk_scaffolding_toolbar(g)));
-       free(theme);
-}
-
-
-/**
- * when cancel button is clicked
- */
-static gboolean nsgtk_toolbar_cancel_clicked(GtkWidget *widget, gpointer data)
-{
-       struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
-
-       edit_mode = false;
-       /* reset g->buttons->location */
-       for (int i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               nsgtk_scaffolding_button(g, i)->location =
-                               window->buttonlocations[i];
-       }
-       nsgtk_toolbar_set_physical(g);
-       nsgtk_toolbar_connect_all(g);
-       nsgtk_toolbar_close(g);
-       nsgtk_scaffolding_set_sensitivity(g);
-       gtk_widget_destroy(window->window);
-       return TRUE;
-}
-
-/**
- * physically add widgets to store window
- */
-static bool nsgtk_toolbar_add_store_widget(GtkWidget *widget)
-{
-       if (window->numberh >= NSGTK_STORE_WIDTH) {
-               window->currentbar = gtk_toolbar_new();
-               if (window->currentbar == NULL) {
-                       nsgtk_warning("NoMemory", 0);
-                       return false;
-               }
-               gtk_toolbar_set_style(GTK_TOOLBAR(window->currentbar),
-                               GTK_TOOLBAR_BOTH);
-               gtk_toolbar_set_icon_size(GTK_TOOLBAR(window->currentbar),
-                               GTK_ICON_SIZE_LARGE_TOOLBAR);
-               gtk_box_pack_start(GTK_BOX(window->widgetvbox),
-                       window->currentbar, FALSE, FALSE, 0);
-               window->numberh = 0;
-       }
-       gtk_widget_set_size_request(widget, NSGTK_BUTTON_WIDTH,
-                       NSGTK_BUTTON_HEIGHT);
-       gtk_toolbar_insert(GTK_TOOLBAR(window->currentbar), GTK_TOOL_ITEM(
-                       widget), window->numberh++);
-       gtk_tool_item_set_use_drag_window(GTK_TOOL_ITEM(widget), TRUE);
-       gtk_drag_source_set(widget, GDK_BUTTON1_MASK, &entry, 1,
-                       GDK_ACTION_COPY);
-       gtk_widget_show_all(window->window);
-       return true;
-}
-
-
-/**
- * cast toolbar settings to all scaffoldings referenced from the global linked
- * list of gui_windows
- */
-static void nsgtk_toolbar_cast(struct nsgtk_scaffolding *g)
-{
-       int i;
-       struct nsgtk_scaffolding *list;
-
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               window->buttonlocations[i] =
-                               ((nsgtk_scaffolding_button(g, i)->location
-                               >= -1) &&
-                               (nsgtk_scaffolding_button(g, i)->location
-                               < PLACEHOLDER_BUTTON)) ?
-                               nsgtk_scaffolding_button(g, i)->location : -1;
-       }
-
-       list = nsgtk_scaffolding_iterate(NULL);
-       while (list) {
-               if (list != g)
-                       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++)
-                               nsgtk_scaffolding_button(list, i)->location =
-                                               window->buttonlocations[i];
-               list = nsgtk_scaffolding_iterate(list);
-       }
-}
-
-
-
-
-
-
-
-/**
- * when 'reload defaults' button is clicked
- */
-static gboolean nsgtk_toolbar_reset(GtkWidget *widget, gpointer data)
-{
-       struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
-       int i;
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++)
-               nsgtk_scaffolding_button(g, i)->location =
-                               (i <= THROBBER_ITEM) ? i : -1;
-       nsgtk_toolbar_set_physical(g);
-       for (i = BACK_BUTTON; i <= THROBBER_ITEM; i++) {
-               if (i == URL_BAR_ITEM)
-                       continue;
-               gtk_tool_item_set_use_drag_window(GTK_TOOL_ITEM(
-                               nsgtk_scaffolding_button(g, i)->button), TRUE);
-               gtk_drag_source_set(GTK_WIDGET(
-                               nsgtk_scaffolding_button(g, i)->button),
-                               GDK_BUTTON1_MASK, &entry, 1, GDK_ACTION_COPY);
-               nsgtk_toolbar_temp_connect(g, i);
-       }
-       return TRUE;
-}
-
-/**
- * when titlebar / alt-F4 window close event happens
- */
-static gboolean nsgtk_toolbar_delete(GtkWidget *widget, GdkEvent *event,
-               gpointer data)
-{
-       edit_mode = false;
-       struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
-       /* reset g->buttons->location */
-       for (int i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               nsgtk_scaffolding_button(g, i)->location =
-                               window->buttonlocations[i];
-       }
-       nsgtk_toolbar_set_physical(g);
-       nsgtk_toolbar_connect_all(g);
-       nsgtk_toolbar_close(g);
-       nsgtk_scaffolding_set_sensitivity(g);
-       gtk_widget_destroy(window->window);
-       return TRUE;
-}
-
-
-
-/**
- * create store window
- */
-static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g)
-{
-       struct nsgtk_theme *theme;
-       nserror res;
-
-       theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, true);
-       if (theme == NULL) {
-               nsgtk_warning(messages_get("NoMemory"), 0);
-               nsgtk_toolbar_cancel_clicked(NULL, g);
-               return;
-       }
-
-       res = nsgtk_builder_new_from_resname("toolbar", &window->builder);
-       if (res != NSERROR_OK) {
-               NSLOG(netsurf, INFO, "Toolbar UI builder init failed");
-               nsgtk_warning("Toolbar UI builder init failed", 0);
-               nsgtk_toolbar_cancel_clicked(NULL, g);
-               free(theme);
-               return;
-       }
-
-       gtk_builder_connect_signals(window->builder, NULL);
-
-       window->window = GTK_WIDGET(gtk_builder_get_object(
-                                           window->builder, "dialogToolbar"));
-       if (window->window == NULL) {
-               nsgtk_warning(messages_get("NoMemory"), 0);
-               nsgtk_toolbar_cancel_clicked(NULL, g);
-               free(theme);
-               return;
-       }
-
-       gtk_window_set_transient_for(GTK_WINDOW(window->window),
-                                    nsgtk_scaffolding_window(g));
-
-       window->widgetvbox = GTK_WIDGET(gtk_builder_get_object(
-                                               window->builder, "widgetvbox"));
-       if (window->widgetvbox == NULL) {
-               nsgtk_warning(messages_get("NoMemory"), 0);
-               nsgtk_toolbar_cancel_clicked(NULL, g);
-               free(theme);
-               return;
-       }
-
-       /* preset to width [in buttons] of */
-       window->numberh = NSGTK_STORE_WIDTH;
-
-       /*  store to cause creation of a new toolbar */
-       window->currentbutton = -1;
-
-       /* load toolbuttons */
-       /* add toolbuttons to window */
-       /* set event handlers */
-       for (int i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               if (i == URL_BAR_ITEM)
-                       continue;
-               window->store_buttons[i] =
-                       make_toolbar_item(i, theme);
-               if (window->store_buttons[i] == NULL) {
-                       nsgtk_warning(messages_get("NoMemory"), 0);
-                       continue;
-               }
-               nsgtk_toolbar_add_store_widget(window->store_buttons[i]);
-               g_signal_connect(window->store_buttons[i], "drag-data-get",
-                                G_CALLBACK(
-                                        nsgtk_scaffolding_button(g, 
i)->dataplus), g);
-       }
-       free(theme);
-
-
-       gtk_window_set_accept_focus(GTK_WINDOW(window->window), FALSE);
-
-       gtk_drag_dest_set(GTK_WIDGET(window->window), GTK_DEST_DEFAULT_MOTION |
-                         GTK_DEST_DEFAULT_DROP, &entry, 1, GDK_ACTION_COPY);
-
-       g_signal_connect(GTK_WIDGET(gtk_builder_get_object(
-                                           window->builder, "close")),
-                        "clicked",
-                        G_CALLBACK(nsgtk_toolbar_persist),
-                        g);
-
-       g_signal_connect(GTK_WIDGET(gtk_builder_get_object(
-                                           window->builder, "reset")),
-                        "clicked",
-                        G_CALLBACK(nsgtk_toolbar_reset),
-                        g);
-
-       g_signal_connect(window->window, "delete-event",
-                        G_CALLBACK(nsgtk_toolbar_delete), g);
-
-       g_signal_connect(window->window, "drag-drop",
-                        G_CALLBACK(nsgtk_toolbar_store_return), g);
-
-       g_signal_connect(window->window, "drag-motion",
-                        G_CALLBACK(nsgtk_toolbar_store_action), g);
-
-       gtk_widget_show_all(window->window);
-}
-
-/**
- * change behaviour of scaffoldings while editing toolbar
- *
- * All buttons as well as window clicks are desensitized; then buttons
- * in the front window are changed to movable buttons
- */
-void nsgtk_toolbar_customisation_init(struct nsgtk_scaffolding *g)
-{
-       int i;
-       struct nsgtk_scaffolding *list;
-       edit_mode = true;
-
-       list = nsgtk_scaffolding_iterate(NULL);
-       while (list) {
-               g_signal_handler_block(GTK_WIDGET(
-                               nsgtk_window_get_layout(
-                               nsgtk_scaffolding_top_level(list))),
-                               nsgtk_window_get_signalhandler(
-                               nsgtk_scaffolding_top_level(list),
-                               NSGTK_WINDOW_SIGNAL_CLICK));
-               g_signal_handler_block(GTK_WIDGET(
-                               nsgtk_window_get_layout(
-                               nsgtk_scaffolding_top_level(list))),
-                               nsgtk_window_get_signalhandler(
-                               nsgtk_scaffolding_top_level(list),
-                               NSGTK_WINDOW_SIGNAL_REDRAW));
-               nsgtk_widget_override_background_color(
-                       GTK_WIDGET(nsgtk_window_get_layout(
-                               nsgtk_scaffolding_top_level(list))),
-                       GTK_STATE_NORMAL, 0, 0xEEEE, 0xEEEE, 0xEEEE);
-
-               if (list == g) {
-                       list = nsgtk_scaffolding_iterate(list);
-                       continue;
-               }
-               /* set sensitive for all gui_windows save g */
-               gtk_widget_set_sensitive(GTK_WIDGET(nsgtk_scaffolding_window(
-                               list)), FALSE);
-               list = nsgtk_scaffolding_iterate(list);
-       }
-       /* set sensitive for all of g save toolbar */
-       gtk_widget_set_sensitive(GTK_WIDGET(nsgtk_scaffolding_menu_bar(g)),
-                       FALSE);
-       gtk_widget_set_sensitive(GTK_WIDGET(nsgtk_scaffolding_notebook(g)),
-                       FALSE);
-
-       /* set editable aspect for toolbar */
-       gtk_container_foreach(GTK_CONTAINER(nsgtk_scaffolding_toolbar(g)),
-                       nsgtk_toolbar_clear_toolbar, g);
-       nsgtk_toolbar_set_physical(g);
-       /* memorize button locations, set editable */
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               window->buttonlocations[i] = nsgtk_scaffolding_button(g, i)
-                               ->location;
-               if ((window->buttonlocations[i] == -1) || (i == URL_BAR_ITEM))
-                       continue;
-               gtk_tool_item_set_use_drag_window(GTK_TOOL_ITEM(
-                               nsgtk_scaffolding_button(g, i)->button), TRUE);
-               gtk_drag_source_set(GTK_WIDGET(nsgtk_scaffolding_button(
-                               g, i)->button), GDK_BUTTON1_MASK, &entry, 1,
-                               GDK_ACTION_COPY);
-               nsgtk_toolbar_temp_connect(g, i);
-       }
-
-       /* add move button listeners */
-       g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_toolbar(g)),
-                       "drag-drop",
-                        G_CALLBACK(nsgtk_toolbar_data),
-                        g);
-       g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_toolbar(g)),
-                       "drag-data-received",
-                        G_CALLBACK(nsgtk_toolbar_move_complete),
-                        g);
-       g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_toolbar(g)),
-                       "drag-motion",
-                        G_CALLBACK(nsgtk_toolbar_action),
-                        g);
-       g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_toolbar(g)),
-                       "drag-leave",
-                        G_CALLBACK(nsgtk_toolbar_clear),
-                        g);
-
-       /* set data types */
-       gtk_drag_dest_set(GTK_WIDGET(nsgtk_scaffolding_toolbar(g)),
-                       GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
-                       &entry, 1, GDK_ACTION_COPY);
-
-       /* open toolbar window */
-       nsgtk_toolbar_window_open(g);
-}
-#endif
-
 
 /**
  * save toolbar settings to file
@@ -1391,26 +830,6 @@ nsgtk_toolbar_customisation_save(struct 
nsgtk_toolbar_customisation *tbc)
 
 
 /**
- * customisation apply handler for clicked signal
- *
- * when 'save settings' button is clicked
- */
-static gboolean
-customisation_apply_clicked_cb(GtkWidget *widget, gpointer data)
-{
-       struct nsgtk_toolbar_customisation *tbc;
-       tbc = (struct nsgtk_toolbar_customisation *)data;
-
-       /* save state to file, update toolbars for all windows */
-       nsgtk_toolbar_customisation_save(tbc);
-       nsgtk_window_toolbar_update();
-       gtk_widget_destroy(tbc->container);
-
-       return TRUE;
-}
-
-
-/**
  * find the toolbar item with a given location.
  *
  * \param tb the toolbar instance
@@ -1505,6 +924,7 @@ customisation_container_drag_drop_cb(GtkWidget *widget,
        return FALSE;
 }
 
+
 /**
  * customisation container handler for drag motion signal
  *
@@ -1580,7 +1000,9 @@ customisation_toolbar_drag_drop_cb(GtkWidget *widget,
                return TRUE;
        }
 
-       dragitem->button = make_toolbar_item(tbc->dragitem, theme);
+       edit_mode = true;
+       dragitem->button = make_toolbar_item(tbc->dragitem, theme, true);
+       edit_mode = false;
 
        free(theme);
        if (dragitem->button == NULL) {
@@ -1668,6 +1090,7 @@ customisation_toolbar_drag_leave_cb(GtkWidget *widget,
        gtk_toolbar_set_drop_highlight_item(GTK_TOOLBAR(widget), NULL, 0);
 }
 
+
 /**
  * create a new browser window
  *
@@ -1730,22 +1153,6 @@ int nsgtk_toolbar_get_id_from_widget(GtkWidget *widget,
 }
 
 
-
-/**
- * connect 'normal' handlers to toolbar buttons
- */
-void nsgtk_toolbar_connect_all(struct nsgtk_scaffolding *g)
-{
-       int q, i;
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               q = nsgtk_toolbar_get_id_at_location(g, i);
-               if (q == -1)
-                       continue;
-
-       }
-}
-
-
 /**
  * Apply the user toolbar button settings from configuration
  *
@@ -1831,12 +1238,8 @@ add_item_to_toolbar(struct nsgtk_toolbar *tb,
 
                if (tb->buttons[bidx]->location == location) {
 
-                       tb->buttons[bidx]->button = make_toolbar_item(bidx,
-                                                                     theme);
-
-                       /* set widgets initial sensitivity */
-                       
gtk_widget_set_sensitive(GTK_WIDGET(tb->buttons[bidx]->button),
-                                                
tb->buttons[bidx]->sensitivity);
+                       tb->buttons[bidx]->button = make_toolbar_item(
+                               bidx, theme, tb->buttons[bidx]->sensitivity);
 
                        gtk_toolbar_insert(tb->widget,
                                           tb->buttons[bidx]->button,
@@ -1888,7 +1291,6 @@ static nserror populate_gtk_toolbar_widget(struct 
nsgtk_toolbar *tb)
 }
 
 
-
 /**
  * find the toolbar item with a given gtk widget.
  *
@@ -2077,12 +1479,28 @@ toolbar_customisation_connect_signals(struct 
nsgtk_toolbar *tb)
 }
 
 
+static void
+item_size_allocate_cb(GtkWidget *widget,
+                     GdkRectangle *alloc,
+                     gpointer user_data)
+{
+       if (alloc->width > NSGTK_BUTTON_WIDTH) {
+               alloc->width = NSGTK_BUTTON_WIDTH;
+       }
+       if (alloc->height > NSGTK_BUTTON_HEIGHT) {
+               alloc->height = NSGTK_BUTTON_HEIGHT;
+       }
+       //NSLOG(netsurf, ERROR, "w:%d h:%d", alloc->width, alloc->height);
+       gtk_widget_set_allocation(widget, alloc);
+}
+
+
 /**
  * add a row to a toolbar customisation toolbox
  *
  * \param tbc The toolbar customisation context
  * \param startitem The item index of the beginning of the row
- * \param enditem The item index of teh beginning of teh next row
+ * \param enditem The item index of the beginning of the next row
  * \return NSERROR_OK on successs else error
  */
 static nserror
@@ -2120,6 +1538,10 @@ add_toolbox_row(struct nsgtk_toolbar_customisation *tbc,
                                 "drag-data-get",
                                 
G_CALLBACK(tbc->toolbar.buttons[iidx]->dataplus),
                                 &tbc->toolbar);
+               g_signal_connect(tbc->items[iidx],
+                                "size-allocate",
+                                G_CALLBACK(item_size_allocate_cb),
+                                NULL);
                gtk_toolbar_insert(rowbar, tbc->items[iidx], iidx - startitem);
        }
        return NSERROR_OK;
@@ -2162,7 +1584,7 @@ toolbar_customisation_create_toolbox(struct 
nsgtk_toolbar_customisation *tbc,
                        curcol = 0;
                        startidx = iidx;
                }
-               tbc->items[iidx] = make_toolbar_item(iidx, theme);
+               tbc->items[iidx] = make_toolbar_item(iidx, theme, true);
                if (tbc->items[iidx] != NULL) {
                        curcol++;
                }
@@ -2177,6 +1599,92 @@ toolbar_customisation_create_toolbox(struct 
nsgtk_toolbar_customisation *tbc,
        return NSERROR_OK;
 }
 
+
+/**
+ * update toolbar in customisation to user settings
+ */
+static nserror
+customisation_toolbar_update(struct nsgtk_toolbar_customisation *tbc)
+{
+       GtkEntry *entry;
+       nserror res;
+
+       res = apply_user_button_customisation(&tbc->toolbar);
+       if (res != NSERROR_OK) {
+               return res;
+       }
+
+       /* populate toolbar widget */
+       res = populate_gtk_toolbar_widget(&tbc->toolbar);
+       if (res != NSERROR_OK) {
+               return res;
+       }
+
+       /* ensure icon sizes and text labels on toolbar are set */
+       res = nsgtk_toolbar_restyle(&tbc->toolbar);
+       if (res != NSERROR_OK) {
+               return res;
+       }
+
+       /* attach handlers to toolbar widgets */
+       res = toolbar_customisation_connect_signals(&tbc->toolbar);
+       if (res != NSERROR_OK) {
+               return res;
+       }
+
+       if (tbc->toolbar.buttons[URL_BAR_ITEM]->location != INACTIVE_LOCATION) {
+               entry = 
GTK_ENTRY(gtk_bin_get_child(GTK_BIN(tbc->toolbar.buttons[URL_BAR_ITEM]->button)));
+
+               gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
+       }
+
+       if (tbc->toolbar.buttons[WEBSEARCH_ITEM]->location != 
INACTIVE_LOCATION) {
+               entry = 
GTK_ENTRY(gtk_bin_get_child(GTK_BIN(tbc->toolbar.buttons[WEBSEARCH_ITEM]->button)));
+
+               gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
+       }
+
+       return NSERROR_OK;
+}
+
+
+/**
+ * customisation apply handler for clicked signal
+ *
+ * when 'save settings' button is clicked
+ */
+static gboolean
+customisation_apply_clicked_cb(GtkWidget *widget, gpointer data)
+{
+       struct nsgtk_toolbar_customisation *tbc;
+       tbc = (struct nsgtk_toolbar_customisation *)data;
+
+       /* save state to file, update toolbars for all windows */
+       nsgtk_toolbar_customisation_save(tbc);
+       nsgtk_window_toolbar_update();
+       gtk_widget_destroy(tbc->container);
+
+       return TRUE;
+}
+
+
+/**
+ * customisation reset handler for clicked signal
+ *
+ * when 'reload defaults' button is clicked
+ */
+static gboolean
+customisation_reset_clicked_cb(GtkWidget *widget, gpointer data)
+{
+       struct nsgtk_toolbar_customisation *tbc;
+       tbc = (struct nsgtk_toolbar_customisation *)data;
+
+       customisation_toolbar_update(tbc);
+
+       return TRUE;
+}
+
+
 /*
  * Toolbar button clicked handlers
  */
@@ -2252,47 +1760,15 @@ static gboolean cutomize_button_clicked_cb(GtkWidget 
*widget, gpointer data)
                        }
                        goto cutomize_button_clicked_cb_error;
                }
+               tbc->toolbar.buttons[iidx]->sensitivity = true;
        }
 
-       res = apply_user_button_customisation(&tbc->toolbar);
-       if (res != NSERROR_OK) {
-               goto cutomize_button_clicked_cb_error;
-       }
-
-       /* populate toolbar widget */
-       res = populate_gtk_toolbar_widget(&tbc->toolbar);
-       if (res != NSERROR_OK) {
-               goto cutomize_button_clicked_cb_error;
-       }
-
-       /* ensure icon sizes and text labels on toolbar are set */
-       res = nsgtk_toolbar_restyle(&tbc->toolbar);
-       if (res != NSERROR_OK) {
-               goto cutomize_button_clicked_cb_error;
-       }
-
-       /* attach handlers to toolbar widgets */
-       res = toolbar_customisation_connect_signals(&tbc->toolbar);
+       res = customisation_toolbar_update(tbc);
        if (res != NSERROR_OK) {
                goto cutomize_button_clicked_cb_error;
        }
 
-       if (tbc->toolbar.buttons[URL_BAR_ITEM]->location != INACTIVE_LOCATION) {
-               GtkEntry *entry;
-               entry = 
GTK_ENTRY(gtk_bin_get_child(GTK_BIN(tbc->toolbar.buttons[URL_BAR_ITEM]->button)));
-
-               gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
-       }
-
-       if (tbc->toolbar.buttons[WEBSEARCH_ITEM]->location != 
INACTIVE_LOCATION) {
-               GtkEntry *entry;
-               entry = 
GTK_ENTRY(gtk_bin_get_child(GTK_BIN(tbc->toolbar.buttons[WEBSEARCH_ITEM]->button)));
-
-               gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
-       }
-
        /* use toolbox for widgets to drag to/from */
-
        gtk_widget_get_allocation(GTK_WIDGET(notebook), &notebook_alloc);
 
        res = toolbar_customisation_create_toolbox(tbc, notebook_alloc.width);
@@ -2300,11 +1776,6 @@ static gboolean cutomize_button_clicked_cb(GtkWidget 
*widget, gpointer data)
                goto cutomize_button_clicked_cb_error;
        }
 
-
-       /* save and update on apply button then discard */
-       /* discard button causes destruction */
-       /* close and cleanup on destroy signal */
-
        /* configure the container */
        gtk_drag_dest_set(GTK_WIDGET(tbc->container),
                          GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
@@ -2312,22 +1783,26 @@ static gboolean cutomize_button_clicked_cb(GtkWidget 
*widget, gpointer data)
                          1,
                          GDK_ACTION_COPY);
 
+       /* discard button calls destroy */
        g_signal_connect_swapped(GTK_WIDGET(gtk_builder_get_object(builder,
                                                                   "discard")),
                                 "clicked",
                                 G_CALLBACK(gtk_widget_destroy),
                                 tbc->container);
 
+       /* save and update on apply button  */
        g_signal_connect(GTK_WIDGET(gtk_builder_get_object(builder, "apply")),
                         "clicked",
                         G_CALLBACK(customisation_apply_clicked_cb),
                         tbc);
 
-#if 0
        g_signal_connect(GTK_WIDGET(gtk_builder_get_object(builder, "reset")),
                         "clicked",
-                        G_CALLBACK(nsgtk_toolbar_reset),
-                        g);
+                        G_CALLBACK(customisation_reset_clicked_cb),
+                        tbc);
+
+       /* close and cleanup on destroy signal */
+#if 0
 
        g_signal_connect(tbc->container,
                         "delete-event",


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to